aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/AI/CoreAI/PetAI.cpp35
1 files changed, 15 insertions, 20 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp
index a8d2a2248ad..2792f68004f 100644
--- a/src/server/game/AI/CoreAI/PetAI.cpp
+++ b/src/server/game/AI/CoreAI/PetAI.cpp
@@ -432,29 +432,23 @@ void PetAI::HandleReturnMovement()
if (!me->GetCharmInfo()->IsAtStay() && !me->GetCharmInfo()->IsReturning())
{
// Return to previous position where stay was clicked
- if (!me->GetCharmInfo()->IsCommandAttack())
- {
- float x, y, z;
+ float x, y, z;
- me->GetCharmInfo()->GetStayPosition(x, y, z);
- ClearCharmInfoFlags();
- me->GetCharmInfo()->SetIsReturning(true);
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MovePoint(me->GetGUIDLow(), x, y, z);
- }
+ me->GetCharmInfo()->GetStayPosition(x, y, z);
+ ClearCharmInfoFlags();
+ me->GetCharmInfo()->SetIsReturning(true);
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MovePoint(me->GetGUIDLow(), x, y, z);
}
}
else // COMMAND_FOLLOW
{
if (!me->GetCharmInfo()->IsFollowing() && !me->GetCharmInfo()->IsReturning())
{
- if (!me->GetCharmInfo()->IsCommandAttack())
- {
- ClearCharmInfoFlags();
- me->GetCharmInfo()->SetIsReturning(true);
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveFollow(me->GetCharmerOrOwner(), PET_FOLLOW_DIST, me->GetFollowAngle());
- }
+ ClearCharmInfoFlags();
+ me->GetCharmInfo()->SetIsReturning(true);
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveFollow(me->GetCharmerOrOwner(), PET_FOLLOW_DIST, me->GetFollowAngle());
}
}
}
@@ -473,12 +467,13 @@ void PetAI::DoAttack(Unit* target, bool chase)
if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack())
me->SendPetAIReaction(me->GetGUID());
-
if (chase)
{
- ClearCharmInfoFlags();
- me->GetMotionMaster()->Clear();
- me->GetMotionMaster()->MoveChase(target);
+ bool oldCmdAttack = me->GetCharmInfo()->IsCommandAttack(); // This needs to be reset after other flags are cleared
+ ClearCharmInfoFlags();
+ me->GetCharmInfo()->SetIsCommandAttack(oldCmdAttack); // For passive pets commanded to attack so they will use spells
+ me->GetMotionMaster()->Clear();
+ me->GetMotionMaster()->MoveChase(target);
}
else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
{