Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/server/game/AI/SmartScripts/SmartAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mCanRepeatPath = false;

mEvadeDisabled = false;
mSuppressEvade = false;

mCanAutoAttack = true;

Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/AI/SmartScripts/SmartAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class SmartAI : public CreatureAI
void SetSwim(bool swim = true);

void SetEvadeDisabled(bool disable = true);
void SetSuppressEvade(bool suppress) { mSuppressEvade = suppress; }

void SetInvincibilityHpLevel(uint32 level) { mInvincibilityHpLevel = level; }

Expand Down Expand Up @@ -249,6 +250,7 @@ class SmartAI : public CreatureAI
uint32 GetWPCount() { return mWayPoints ? mWayPoints->Nodes.size() : 0; }
bool mCanRepeatPath;
bool mEvadeDisabled;
bool mSuppressEvade;
bool mCanAutoAttack;
bool mForcedPaused;
uint32 mInvincibilityHpLevel;
Expand Down
9 changes: 9 additions & 0 deletions src/server/game/AI/SmartScripts/SmartScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading