From 77de36bb9ea4c6b011070fab241f5c7ae35fe0d2 Mon Sep 17 00:00:00 2001 From: blinkysc <37940565+blinkysc@users.noreply.github.com> Date: Sun, 29 Mar 2026 09:44:20 -0500 Subject: [PATCH] fix(Core/SmartAI): Suppress evade during SMART_ACTION_COMBAT_STOP (#25249) Co-authored-by: blinkysc --- src/server/game/AI/SmartScripts/SmartAI.cpp | 4 ++++ src/server/game/AI/SmartScripts/SmartAI.h | 2 ++ src/server/game/AI/SmartScripts/SmartScript.cpp | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 80a65b113..df978f02e 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -44,6 +44,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c) mCanRepeatPath = false; mEvadeDisabled = false; + mSuppressEvade = false; mCanAutoAttack = true; @@ -698,6 +699,9 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data) void SmartAI::EnterEvadeMode(EvadeReason /*why*/) { + if (mSuppressEvade) + return; + if (mEvadeDisabled) { GetScript()->ProcessEventsFor(SMART_EVENT_EVADE); diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 5449e4970..e36a258b7 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -181,6 +181,7 @@ public: void SetSwim(bool swim = true); void SetEvadeDisabled(bool disable = true); + void SetSuppressEvade(bool suppress) { mSuppressEvade = suppress; } void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; } @@ -249,6 +250,7 @@ private: uint32 GetWPCount() { return mWayPoints ? mWayPoints->Nodes.size() : 0; } bool mCanRepeatPath; bool mEvadeDisabled; + bool mSuppressEvade; bool mCanAutoAttack; bool mForcedPaused; uint32 mInvincibilityHpLevel; diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 4024052b4..27b390bd0 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1039,7 +1039,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!me) break; + // Suppress evade during script-initiated combat stop so + // JustExitedCombat does not trigger EnterEvadeMode. + if (SmartAI* sai = CAST_AI(SmartAI, me->AI())) + sai->SetSuppressEvade(true); + me->CombatStop(true); + + if (SmartAI* sai = CAST_AI(SmartAI, me->AI())) + sai->SetSuppressEvade(false); + break; } case SMART_ACTION_CALL_GROUPEVENTHAPPENS: