aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOvah <dreadkiller@gmx.de>2019-11-17 18:29:31 +0100
committerShauren <shauren.trinity@gmail.com>2021-12-19 00:37:22 +0100
commite42aae18952d198680f4215d16175d274d4be179 (patch)
tree2c156d386b4e8b340d308be854a652379518b460 /src
parent9c154074ed6c16640ce60a8e3ff28cc06f341442 (diff)
Fixed pets repositioning themselves after every cast (#23923)
(cherry picked from commit 4ddf7f59761df525e6ab5ef99175258a1d86101d)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index 0adbf47633a..5d5e8a60084 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -420,8 +420,12 @@ void PetAI::DoAttack(Unit* target, bool chase)
if (me->HasUnitState(UNIT_STATE_FOLLOW))
me->GetMotionMaster()->Remove(FOLLOW_MOTION_TYPE);
-
- me->GetMotionMaster()->MoveChase(target, me->GetPetChaseDistance(), float(M_PI));
+
+ // Pets with ranged attacks should not care about the chase angle at all.
+ float chaseDistance = me->GetPetChaseDistance();
+ float angle = chaseDistance == 0.f ? float(M_PI) : 0.f;
+ float tolerance = chaseDistance == 0.f ? float(M_PI_4) : float(M_PI * 2);
+ me->GetMotionMaster()->MoveChase(target, ChaseRange(0.f, chaseDistance), ChaseAngle(angle, tolerance));
}
else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
{