diff options
author | MrSmite <mrsmite@att.net> | 2013-01-14 21:42:23 -0500 |
---|---|---|
committer | MrSmite <mrsmite@att.net> | 2013-01-14 21:47:14 -0500 |
commit | 98f502f32f092fe1bcb9e19c32c189d2ea552d19 (patch) | |
tree | 02a16c98d282a60ec7c277e2ffe3098b81fe019d /src | |
parent | 602950cb77166993bd2386d30d0d1b50b30b1b1d (diff) |
Fix passive pets not using spells when commanded to attack
Closes #8941
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/PetAI.cpp | 35 |
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))) { |