Fixed pets repositioning themselves after every cast (#23923)

This commit is contained in:
Ovah
2019-11-17 18:29:31 +01:00
committed by Keader
parent 754e207777
commit 4ddf7f5976

View File

@@ -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)))
{