From 496b1e0c461be9486e388bb29377c220fe04bf79 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 30 May 2022 14:08:55 -0400 Subject: [PATCH] Core/Pets: Do not force pets to follow their charmer when possessed by player Port From (https://github.com/TrinityCore/TrinityCore/commit/8f02596162715b273b1a830425ae783bd00561c9) --- Source/Game/AI/CoreAI/PetAI.cs | 2 +- Source/Game/Entities/Unit/Unit.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Game/AI/CoreAI/PetAI.cs b/Source/Game/AI/CoreAI/PetAI.cs index b7c688802..90f260f60 100644 --- a/Source/Game/AI/CoreAI/PetAI.cs +++ b/Source/Game/AI/CoreAI/PetAI.cs @@ -633,7 +633,7 @@ namespace Game.AI public override void OnCharmed(bool isNew) { - if (me.IsCharmed()) + if (!me.IsPossessedByPlayer() && me.IsCharmed()) me.GetMotionMaster().MoveFollow(me.GetCharmer(), SharedConst.PetFollowDist, me.GetFollowAngle()); base.OnCharmed(isNew); diff --git a/Source/Game/Entities/Unit/Unit.cs b/Source/Game/Entities/Unit/Unit.cs index cb5d6fa4e..54c824d0e 100644 --- a/Source/Game/Entities/Unit/Unit.cs +++ b/Source/Game/Entities/Unit/Unit.cs @@ -1239,6 +1239,11 @@ namespace Game.Entities return; } + public bool IsPossessedByPlayer() + { + return HasUnitState(UnitState.Possessed) && GetCharmerGUID().IsPlayer(); + } + public bool IsPossessing() { Unit u = GetCharmed();