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:
parent
2265ee51ab
commit
b00b424d63
1 changed files with 6 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue