Alright, a bit on the technical side. I have changed the current behavior of "friendlyfire" to "selffire" and added a "friendlyfire" option. This allows you to differentiate talents between hitting the source of the talent (now selffire) and all allies (now friendlyfire). There are also two variables that can be set in the ai_state table of NPCs, "self_compassion" and "ally_compassion." These default to 5 and 1, respectively, and are weights that bias against ATTACKAREA if it would hit you or an ally, respecively. These can be set to range from "servile behavior" (low self_compassion, high ally_compassion) to "me first" (high self_compassion, 0 ally_compassion), to "psychopath" (0 self_compassion and ally_compassion).
Enough of technical talk, here is an example that will intrigue most players: the alchemist and his golem. I started Testme the Alchemist and immediately switched control to the golem to test how the new AI works. At first there was nothing in sight:
Code: Select all
============================== TACTICAL AI Testme
Testme 142 tactical ai talents can use Infusion: Regeneration T_INFUSION:_REGENERATION_2 heal weight 2.4343428021592
Testme 142 tactical ai talents can use Rune: Manasurge T_RUNE:_MANASURGE_1 mana weight 1.9145789156229
Testme 142 tactical ai talents can use Infusion: Wild T_INFUSION:_WILD_3 defend weight 36.681561663639
Testme 142 tactical ai talents can use Gift of the Pureborn T_HIGHER_HEAL heal weight 24.821997264353
Tactical ai report for Testme
[PARTY AI] following master Testme
But then a grey rat sneaks up on Testme and:
Code: Select all
[LOG] Giant grey rat crawls poison onto Testme.
Now I haven't played with the DEFEND AI at all, but it does the right thing:
Code: Select all
============================== TACTICAL AI Testme
Testme 142 tactical ai talents can use Infusion: Regeneration T_INFUSION:_REGENERATION_2 heal weight 3.2991020740246
[DEBUG] hit an ally!
[DEBUG] hit a foe!
[DEBUG] hit self!
Testme 142 tactical ai talents can use Throw Bomb T_THROW_BOMB attackarea weight 0.75636969218239
Testme 142 tactical ai talents can use Rune: Manasurge T_RUNE:_MANASURGE_1 mana weight 1.833423985742
Testme 142 tactical ai talents can use Channel Staff T_CHANNEL_STAFF attack weight 1.5122363507949
Testme 142 tactical ai talents can use Infusion: Wild T_INFUSION:_WILD_3 defend weight 36.733531647309
Testme 142 tactical ai talents can use Gift of the Pureborn T_HIGHER_HEAL heal weight 24.269180612905
Tactical ai report for Testme
* defend 3.0117904259987
* attack 2.6219430768068
Tactical choice: defend T_INFUSION:_WILD_3
And once he is defended, Testme sets about to do some damage. Note that while deciding the tactical weight for T_THROW_BOMB (0.42) there is a dummy projection that shows he would hit an ally (the player controlled golem) as well as a foe, resulting in a low weight and a negative want (not shown) so ATTACKAREA is discarded as an option (not shown in the Tactical ai report segment).
Code: Select all
============================== TACTICAL AI Testme
Testme 142 tactical ai talents can use Infusion: Regeneration T_INFUSION:_REGENERATION_2 heal weight 3.2852049698747
[DEBUG] hit an ally!
[DEBUG] hit a foe!
Testme 142 tactical ai talents can use Throw Bomb T_THROW_BOMB attackarea weight 0.42556243010719
Testme 142 tactical ai talents can use Rune: Manasurge T_RUNE:_MANASURGE_1 mana weight 1.2698157574577
Testme 142 tactical ai talents can use Channel Staff T_CHANNEL_STAFF attack weight 2.0026311470617
Testme 142 tactical ai talents can use Gift of the Pureborn T_HIGHER_HEAL heal weight 24.515816430242
Tactical ai report for Testme
* attack 2.5209391415002
Tactical choice: attack T_CHANNEL_STAFF
So far so good. What if I move the golem out of the way?
Code: Select all
============================== TACTICAL AI Testme
Testme 142 tactical ai talents can use Infusion: Regeneration T_INFUSION:_REGENERATION_2 heal weight 2.4064778485031
[DEBUG] hit a foe!
Testme 142 tactical ai talents can use Throw Bomb T_THROW_BOMB attackarea weight 2.9873212289445
Testme 142 tactical ai talents can use Channel Staff T_CHANNEL_STAFF attack weight 1.2158420071735
Testme 142 tactical ai talents can use Gift of the Pureborn T_HIGHER_HEAL heal weight 24.550599283563
Tactical ai report for Testme
* attackarea 2.3617680636236
* attack 2.0506774491828
Tactical choice: attackarea T_THROW_BOMB
Success! The tactical AI respects allies and hitting itself (not shown) with AoE. Note that the AI will not shift the targeting off of the target to optimize the number of foes versus number of enemies, so for example if you are facing a radius 1, selffire AoE enemy and always stay adjacent to it the AI will never shift the target off to the side to hit you and not it. The easier solution to that one is to give some escape talents, though.
