fix(Core/Movement): skip TriggerAlert for creatures immune to players (#25147)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Andrew 2026-03-21 00:59:56 -03:00 committed by GitHub
parent f301aaea53
commit 51ee56d1e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -211,6 +211,9 @@ void CreatureAI::TriggerAlert(Unit const* who) const
// If this unit isn't an NPC, is already distracted, is in combat, is confused, stunned or fleeing, do nothing
if (!me->IsCreature() || me->IsEngaged() || me->HasUnitState(UNIT_STATE_CONFUSED | UNIT_STATE_STUNNED | UNIT_STATE_FLEEING | UNIT_STATE_DISTRACTED))
return;
// If the creature is immune to players, it should not be alerted by them
if (me->IsImmuneToPC())
return;
// Only alert for hostiles!
if (me->IsCivilian() || me->HasReactState(REACT_PASSIVE) || !me->IsHostileTo(who) || !me->_IsTargetAcceptable(who))
return;