pet react state & reach target for autoshoot

This commit is contained in:
Yunfan Li
2023-07-14 16:58:50 +08:00
parent 63573b5c7e
commit 86f7a6e9d1
2 changed files with 4 additions and 4 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}