From 86f7a6e9d1b9e0636f2adea66afede35dc105529 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Fri, 14 Jul 2023 16:58:50 +0800 Subject: [PATCH] pet react state & reach target for autoshoot --- src/strategy/actions/AttackAction.cpp | 5 ++--- src/strategy/actions/ReachTargetActions.cpp | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/strategy/actions/AttackAction.cpp b/src/strategy/actions/AttackAction.cpp index 7625eb3f..b0876ac7 100644 --- a/src/strategy/actions/AttackAction.cpp +++ b/src/strategy/actions/AttackAction.cpp @@ -104,19 +104,18 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/) if (Pet* pet = bot->GetPet()) { - if (with_pet) { - pet->SetReactState(REACT_DEFENSIVE); pet->SetTarget(target->GetGUID()); pet->GetCharmInfo()->SetCommandState(COMMAND_ATTACK); pet->GetCharmInfo()->SetIsCommandAttack(true); pet->AI()->AttackStart(target); + pet->SetReactState(REACT_DEFENSIVE); } else { - pet->SetReactState(REACT_PASSIVE); pet->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW); pet->GetCharmInfo()->SetIsCommandFollow(true); pet->GetCharmInfo()->IsReturning(); pet->GetMotionMaster()->MoveFollow(bot, PET_FOLLOW_DIST, pet->GetFollowAngle()); + pet->SetReactState(REACT_PASSIVE); } } diff --git a/src/strategy/actions/ReachTargetActions.cpp b/src/strategy/actions/ReachTargetActions.cpp index 9fc27e71..77cc17a4 100644 --- a/src/strategy/actions/ReachTargetActions.cpp +++ b/src/strategy/actions/ReachTargetActions.cpp @@ -16,8 +16,9 @@ bool ReachTargetAction::Execute(Event event) bool ReachTargetAction::isUseful() { // do not move while casting - if (bot->IsNonMeleeSpellCast(true)) + if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) { return false; + } return AI_VALUE2(float, "distance", GetTargetName()) > (distance + sPlayerbotAIConfig->contactDistance); }