fix(Core/SmartAI): Suppress evade during SMART_ACTION_COMBAT_STOP (#25249)

Co-authored-by: blinkysc <blinkysc@users.noreply.github.com>
This commit is contained in:
blinkysc 2026-03-29 09:44:20 -05:00 committed by GitHub
parent a6d8fa9f39
commit 77de36bb9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 0 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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: