Core/Unit: Some charm fixes:

* Properly restore react state after possession expires. Closes #20769.
* Possessed creatures now don't override player control with random/waypoint motion
* SmartAI creatures now properly re-aggress charmer after charm expires
This commit is contained in:
Treeston
2018-08-28 12:52:50 +02:00
parent bf8c6f220c
commit da21ca80fc
5 changed files with 41 additions and 47 deletions
+7 -2
View File
@@ -679,8 +679,13 @@ void SmartAI::OnCharmed(bool /*isNew*/)
else
me->SetWalk(!mRun);
if (Unit* charmer = me->GetCharmer())
AttackStart(charmer);
if (me->LastCharmerGUID)
{
if (!me->HasReactState(REACT_PASSIVE))
if (Unit* lastCharmer = ObjectAccessor::GetUnit(*me, me->LastCharmerGUID))
me->EngageWithTarget(lastCharmer);
me->LastCharmerGUID.Clear();
}
}
GetScript()->ProcessEventsFor(SMART_EVENT_CHARMED, nullptr, 0, 0, charmed);