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)
This commit is contained in:
jackpoz
2020-03-02 20:43:52 +01:00
parent 817ae5bca6
commit 69809d1203
2 changed files with 6 additions and 0 deletions

View File

@@ -62,6 +62,9 @@ void CreatureAI::OnCharmed(bool isNew)
}
me->LastCharmerGUID.Clear();
if (!me->IsInCombat())
EnterEvadeMode(EVADE_REASON_NO_HOSTILES);
}
UnitAI::OnCharmed(isNew);

View File

@@ -706,6 +706,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);
}
}