Fix melee reach target

This commit is contained in:
Yunfan Li
2024-02-09 20:31:34 +08:00
parent 27569f431f
commit 5e39f3c732
6 changed files with 46 additions and 8 deletions

View File

@@ -10,7 +10,7 @@
bool ReachTargetAction::Execute(Event event)
{
return MoveTo(AI_VALUE(Unit*, GetTargetName()), distance);
return ReachCombatTo(AI_VALUE(Unit*, GetTargetName()), distance);
}
bool ReachTargetAction::isUseful()
@@ -19,8 +19,9 @@ bool ReachTargetAction::isUseful()
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) {
return false;
}
return AI_VALUE2(float, "distance", GetTargetName()) > (distance + sPlayerbotAIConfig->contactDistance);
Unit* target = GetTarget();
// float dis = distance + CONTACT_DISTANCE;
return target && !bot->IsWithinCombatRange(target, distance); // sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", GetTargetName()), distance);
}
std::string const ReachTargetAction::GetTargetName()