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