From 077cdc5d23d4ccd61115bcfbb8eda6de7b812224 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 1 Jan 2022 17:08:13 -0500 Subject: [PATCH] Core/AI: No longer override chase movement with follow movement if the creature engages before JustAppeared has had a chance to fire. Port From (https://github.com/TrinityCore/TrinityCore/commit/a4c2c0fb1d1b9fae832ecc52aa68fe3fb8d1ca52) --- Source/Game/AI/CoreAI/CreatureAI.cs | 19 +++++++++++-------- Source/Game/Combat/ThreatManager.cs | 11 ++++++++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Source/Game/AI/CoreAI/CreatureAI.cs b/Source/Game/AI/CoreAI/CreatureAI.cs index a1ec8e2ac..68bfed014 100644 --- a/Source/Game/AI/CoreAI/CreatureAI.cs +++ b/Source/Game/AI/CoreAI/CreatureAI.cs @@ -186,17 +186,20 @@ namespace Game.AI // Called when creature appears in the world (spawn, respawn, grid load etc...) public virtual void JustAppeared() { - TempSummon summon = me.ToTempSummon(); - if (summon != null) + if (!IsEngaged()) { - // Only apply this to specific types of summons - if (!summon.GetVehicle() && ShouldFollowOnSpawn(summon.m_Properties)) + TempSummon summon = me.ToTempSummon(); + if (summon != null) { - Unit owner = summon.GetCharmerOrOwner(); - if (owner != null) + // Only apply this to specific types of summons + if (!summon.GetVehicle() && ShouldFollowOnSpawn(summon.m_Properties)) { - summon.GetMotionMaster().Clear(); - summon.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, summon.GetFollowAngle()); + Unit owner = summon.GetCharmerOrOwner(); + if (owner != null) + { + summon.GetMotionMaster().Clear(); + summon.GetMotionMaster().MoveFollow(owner, SharedConst.PetFollowDist, summon.GetFollowAngle()); + } } } } diff --git a/Source/Game/Combat/ThreatManager.cs b/Source/Game/Combat/ThreatManager.cs index 7946a2d07..340ab5a98 100644 --- a/Source/Game/Combat/ThreatManager.cs +++ b/Source/Game/Combat/ThreatManager.cs @@ -59,9 +59,14 @@ namespace Game.Combat if (cWho.IsPet() || cWho.IsTotem() || cWho.IsTrigger()) return false; - // summons cannot have a threat list, unless they are controlled by a creature - if (cWho.HasUnitTypeMask(UnitTypeMask.Minion | UnitTypeMask.Guardian) && !cWho.GetOwnerGUID().IsCreature()) - return false; + // summons cannot have a threat list if they were summoned by a player + if (cWho.HasUnitTypeMask(UnitTypeMask.Minion | UnitTypeMask.Guardian)) + { + TempSummon tWho = cWho.ToTempSummon(); + if (tWho != null) + if (tWho.GetSummonerGUID().IsPlayer()) + return false; + } return true; }