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
committerShauren <shauren.trinity@gmail.com>2021-10-23 14:44:05 +0200
commit34f9666f209ab3f281bf81de92c4bc1a164b0059 (patch)
tree66b2f6dfe9ea2bf9bc8c270e31183a1a4df3a33d /src/server/game/AI/SmartScripts
parente88536f258dd187f1ee6855602501897138cf8b9 (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 (cherry picked from commit da21ca80fc35a325df0fb0ef2f687a91121d42de)
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 76b3778b060..39657dc78bd 100644
--- a/src/server/game/AI/SmartScripts/SmartAI.cpp
+++ b/src/server/game/AI/SmartScripts/SmartAI.cpp
@@ -681,8 +681,13 @@ void SmartAI::OnCharmed(bool /*isNew*/)
else
me->SetWalk(!mRun);
- if (Unit* charmer = me->GetCharmer())
- AttackStart(charmer);
+ if (!me->LastCharmerGUID.IsEmpty())
+ {
+ 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);