fix(Core/Unit): Prevent creature evade when on another unit's threat list (#25328)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
Co-authored-by: Rocco Silipo <108557877+Rorschach91@users.noreply.github.com>
This commit is contained in:
blinkysc 2026-04-05 13:00:19 -05:00 committed by GitHub
parent 2265ee51ab
commit b00b424d63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11493,12 +11493,12 @@ Unit* Creature::SelectVictim()
return target;
}
// last case when creature must not go to evade mode:
// it in combat but attacker not make any damage and not enter to aggro radius to have record in threat list
// Note: creature does not have targeted movement generator but has attacker in this case
for (AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
if ((*itr) && CanCreatureAttack(*itr) && !(*itr)->IsPlayer() && !(*itr)->ToCreature()->HasUnitTypeMask(UNIT_MASK_CONTROLLABLE_GUARDIAN))
return nullptr;
// Don't evade if another unit has us on their threat list — evading would
// end the bidirectional combat reference and remove us from their threat list,
// causing them to lose their target (e.g. an NPC fighting a guardian whose
// CanAIAttack rejects the NPC).
if (!m_threatManager.GetThreatenedByMeList().empty())
return nullptr;
if (GetVehicle())
return nullptr;