CleverRaven/Cataclysm-DDA — pull request #10693 by Coolthulhu (2014-12-31 05:59:17+00:00)
Title: Non-player creature fighting overhaul

Biggest change is probably how the monmove function handles non-player things. Friendly creatures can now be hostile to NPCs and do not ignore their sight range when fighting non-player targets (before, friendlies would ignore their VIS_x flags when looking for non-player targets).

NPCs will no longer check creature friendliness (which is friendliness to player), but its actual attitude to given NPC. As a minor positive side effect, this should make them prioritize stuff that wants them dead over neutral animals.

Zombies who are friendly to the player will still be hostile to NPCs (pheromones make the player, not NPCs, smell like a zombie). This is currently a special hardcoded case, other species of tame monsters will not attack non-hostile NPCs.

Example of above behaviors: friendly drone, friendly zombie and friendly NPC. Zombie and NPC will fight, drone will ignore both. Currently there's no friendly creature infighting or non-friendly creature infighting.

I also updates some of the special attacks and zapback defense.

Zapback defense will now zap back non-player stuff. Not just NPCs, but also zombies. I also fixed the bug where NPC striking a zapback monster adjacent to the player would cause the player to get zapped.
Special attacks do not respect zapback yet, so a zombie can bite a shocker and not get hurt and then get zapped when bashing it.

Shockstorm, spit and knockback can target stuff that isn't the player now.

I can split the changes into two or even three PRs (AI update in the first, attacks to show it in one after it, zapback in third) if so desired, but the updated AI is best seen with the special attacks, which are also relatively simple changes (basically the same thing I did to bite function).

Happy new year everyone