Core/AI: Fix remaining charming issue

Make creatures evade when a charming expires and they cannot attack the charmer (i.e. charmer with .gm on)

(cherry picked from commit 69809d12031d055d8d0cffb5a187d9af09dd0efe)
This commit is contained in:
jackpoz
2021-12-22 21:00:14 +01:00
committed by Shauren
parent 93e66f3f3e
commit dab7e5688c
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -70,6 +70,9 @@ void CreatureAI::OnCharmed(bool isNew)
}
me->LastCharmerGUID.Clear();
if (!me->IsInCombat())
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
}
UnitAI::OnCharmed(isNew);
@@ -708,6 +708,9 @@ void SmartAI::OnCharmed(bool /*isNew*/)
if (Unit* lastCharmer = ObjectAccessor::GetUnit(*me, me->LastCharmerGUID))
me->EngageWithTarget(lastCharmer);
me->LastCharmerGUID.Clear();
if (!me->IsInCombat())
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
}
}