aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/AI/SmartScripts
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2018-08-28 12:52:50 +0200
committerTreeston <treeston.mmoc@gmail.com>2018-08-28 12:53:13 +0200
commitda21ca80fc35a325df0fb0ef2f687a91121d42de (patch)
tree5cb52972690d0f1aad69e7b9b085056e5ca96a50 /src/server/game/AI/SmartScripts
parentbf8c6f220c07a3316fcf0b04ac6a9a77755b9b1d (diff)
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
Diffstat (limited to 'src/server/game/AI/SmartScripts')
-rw-r--r--src/server/game/AI/SmartScripts/SmartAI.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp
index 058652563c3..a831649589a 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -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);