mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
pet react state & reach target for autoshoot
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user