TrinityCore/TrinityCore — pull request #11039 by Elron103 (2013-10-13 15:48:57+00:00)
Title: Core/Creatures: Fix creatures being stuck in evade-mode

Description:
This one here fixes the bug, that sometimes creatures are being stuck in evade-mode. They keep following a target, although they are in evade mode and thereby do not attack and are not attackable.

The bug will occur, when creature A asks creature B for assistance in combat. If creature B is in home movement, the home movement generator will be interrupted by AttackStart -> MoveChase and the evade state will not be cleared anymore.

The fix checks for home motion type and NOT for evade mode, because these two are generally not equivalent to each other. (Thinking of missing feature: Evade mode should be active when combat begins and target of creature cannot be attacked by creature).

So, since creatures moving home should not be interrupted, they also can not assist to anyone else.

Reproduction:
1) Take a look at icecrown_citadel.cpp > npc_frostwing_vrykul > bool CanAIAttack(Unit const* target). Basically this says, that these creatures cannot attack a target, which is not beyond a specific coordinate, when the creature is on the other side of that coordinate. It is kind of an invisible-evasion-wall, since the creatures will evade, when there is no target that matches CanAIAttack.

2) .gm on

3) .go cr 137769
(You should land right inside the frost-wing of Icecrown Citadel)

4) Spam the following command many times (by using a macro):
.npc add temp 37134

5) .mod hp 2000000000

6) .gm off

7) Move inside and outside the frost-wing halls. (Beyond Y-coodinate 2660). All the creatures should start attacking you - evade - start attacking you - evade - and so on.

8) Sooner or later you will see some creatures stuck in evade mode, still following you and not being able to attack or to be attacked.

Related issue:
#4943

Environment:
Tested it under Win with:
TC: 895a23d
DB: TDB 52