TrinityCore/TrinityCore — pull request #6820 by Elron103 (2012-06-16 18:30:48+00:00)
Title: Core/Combat: Fix CanAIAttack implementation

As it seems the current implementation of "bool CanAIAttack" is not working as intended. There are two cases, in which this function is simply being ignored:

1) Creature searching for any target right before entering evade mode
2) ThreatManager of creature gives the command, to keep the current victim, although current victim might should not be attackable due to CanAIAttack any longer

== EnterEvadeMode ==
It is quite simple, you just need a creature, which uses CanAIAttack. Then you need to trigger evade mode for it, but you will notice, that the creature will continue attacking you, although you should not be attacked any longer according to CanAIAttack.

== Keep victim ==
https://github.com/TrinityCore/TrinityCore/blob/master/src/server/game/Combat/ThreatManager.cpp#L357
Creature in fight versus 2 players. Overwritten CanAIAttack tells the creature, that the current victim is not valid any longer. So it searches for a new target. The first iteration is skipped, since attacker->canCreatureAttack(target) causes the function to skip the current victim. Then it checks for the second player. But there, it jumps into that spot "currentRef = currentVictim;". This causes the creature to keep attacking the old victim, which should not be attackable any longer.

== Revs ==
TDB: 46
TC: f0f68f15a86c5ac