From ec83cf5a6d80d4e8df833e75b1885b346f6450dc Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 5 Jan 2022 17:42:54 -0500 Subject: [PATCH] Fixed pets repositioning themselves after every cast Port From (https://github.com/TrinityCore/TrinityCore/commit/e42aae18952d198680f4215d16175d274d4be179) --- Source/Game/AI/CoreAI/PetAI.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Game/AI/CoreAI/PetAI.cs b/Source/Game/AI/CoreAI/PetAI.cs index 9ec93dd6a..8c5627758 100644 --- a/Source/Game/AI/CoreAI/PetAI.cs +++ b/Source/Game/AI/CoreAI/PetAI.cs @@ -18,6 +18,7 @@ using Framework.Constants; using Game.Entities; using Game.Groups; +using Game.Movement; using Game.Spells; using System; using System.Collections.Generic; @@ -410,7 +411,11 @@ namespace Game.AI if (me.HasUnitState(UnitState.Follow)) me.GetMotionMaster().Remove(MovementGeneratorType.Follow); - me.GetMotionMaster().MoveChase(target, me.GetPetChaseDistance(), MathF.PI); + // Pets with ranged attacks should not care about the chase angle at all. + float chaseDistance = me.GetPetChaseDistance(); + float angle = chaseDistance == 0.0f ? MathF.PI : 0.0f; + float tolerance = chaseDistance == 0.0f ? MathFunctions.PiOver4 : (MathF.PI * 2); + me.GetMotionMaster().MoveChase(target, new ChaseRange(0.0f, chaseDistance), new ChaseAngle(angle, tolerance)); } else {