From b00b424d63b391ffdbd2c07eda3b2dfff844b966 Mon Sep 17 00:00:00 2001 From: blinkysc <37940565+blinkysc@users.noreply.github.com> Date: Sun, 5 Apr 2026 13:00:19 -0500 Subject: [PATCH] fix(Core/Unit): Prevent creature evade when on another unit's threat list (#25328) Co-authored-by: blinkysc Co-authored-by: Rocco Silipo <108557877+Rorschach91@users.noreply.github.com> --- src/server/game/Entities/Unit/Unit.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bf75c804a..95c5a1529 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -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;