mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-07 15:28:02 +00:00
fix(Core/Combat): Fix guardians not attacking after threat system port (#25157)
Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
@@ -239,14 +239,16 @@ void CreatureAI::EnterEvadeMode(EvadeReason why)
|
||||
{
|
||||
if (Unit* owner = me->GetCharmerOrOwner())
|
||||
{
|
||||
// Owned creatures (pets/guardians) follow their owner — clear evade state
|
||||
// so they can re-enter combat immediately via CanBeginCombat
|
||||
me->ClearUnitState(UNIT_STATE_EVADE);
|
||||
me->GetMotionMaster()->Clear(false);
|
||||
me->GetMotionMaster()->MoveFollow(owner, PET_FOLLOW_DIST, me->GetFollowAngle(), MOTION_SLOT_ACTIVE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Required to prevent attacking creatures that are evading and cause them to reenter combat
|
||||
// Does not apply to MoveFollow
|
||||
me->AddUnitState(UNIT_STATE_EVADE);
|
||||
// Does not apply to MoveFollow — UNIT_STATE_EVADE is already set from _EnterEvadeMode
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
}
|
||||
}
|
||||
@@ -381,8 +383,11 @@ bool CreatureAI::_EnterEvadeMode(EvadeReason /*why*/)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set evade state early to prevent recursion when CombatStop triggers JustExitedCombat
|
||||
// This will be cleared in MoveTargetedHome for pets/guardians following their owner
|
||||
// Set evade state early to prevent recursion: CombatStop below purges combat
|
||||
// refs, which triggers JustExitedCombat -> EnterEvadeMode -> _EnterEvadeMode.
|
||||
// The IsInEvadeMode() check above will catch it.
|
||||
// EnterEvadeMode will clear this for owned creatures (pets/guardians) that
|
||||
// use MoveFollow instead of MoveTargetedHome.
|
||||
me->AddUnitState(UNIT_STATE_EVADE);
|
||||
|
||||
// don't remove vehicle auras, passengers aren't supposed to drop off the vehicle
|
||||
|
||||
Reference in New Issue
Block a user