mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 17:09:08 +00:00
distance and reach related
This commit is contained in:
@@ -10,27 +10,7 @@
|
||||
|
||||
bool ReachTargetAction::Execute(Event event)
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, GetTargetName());
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
UpdateMovementState();
|
||||
|
||||
float combatReach = bot->GetCombatReach() + target->GetCombatReach() + 4.0f / 3.0f;
|
||||
if (distance < std::max(5.0f, combatReach))
|
||||
{
|
||||
// return MoveTo(target, 0.0f);
|
||||
return ChaseTo(target, 0.0f, bot->GetAngle(target));
|
||||
}
|
||||
else
|
||||
{
|
||||
combatReach = bot->GetCombatReach() + target->GetCombatReach();
|
||||
bool inLos = bot->IsWithinLOSInMap(target);
|
||||
bool isFriend = bot->IsFriendlyTo(target);
|
||||
float chaseDist = inLos ? distance : isFriend ? distance / 2 : distance;
|
||||
return ChaseTo(target, chaseDist - sPlayerbotAIConfig->contactDistance, bot->GetAngle(target));
|
||||
// return MoveTo(target, chaseDist - sPlayerbotAIConfig->contactDistance);
|
||||
}
|
||||
return MoveTo(AI_VALUE(Unit*, GetTargetName()), distance);
|
||||
}
|
||||
|
||||
bool ReachTargetAction::isUseful()
|
||||
@@ -39,8 +19,7 @@ bool ReachTargetAction::isUseful()
|
||||
if (bot->IsNonMeleeSpellCast(true))
|
||||
return false;
|
||||
|
||||
Unit* target = AI_VALUE(Unit*, GetTargetName());
|
||||
return target && (!bot->IsWithinDistInMap(target, distance) || (bot->IsWithinDistInMap(target, distance) && !bot->IsWithinLOSInMap(target)));
|
||||
return AI_VALUE2(float, "distance", GetTargetName()) > (distance + sPlayerbotAIConfig->contactDistance);
|
||||
}
|
||||
|
||||
std::string const ReachTargetAction::GetTargetName()
|
||||
@@ -57,7 +36,7 @@ ReachSpellAction::ReachSpellAction(PlayerbotAI* botAI) : ReachTargetAction(botAI
|
||||
{
|
||||
}
|
||||
|
||||
ReachPartyMemberToHealAction::ReachPartyMemberToHealAction(PlayerbotAI* botAI) : ReachTargetAction(botAI, "reach party member to heal", botAI->GetRange("heal"))
|
||||
ReachPartyMemberToHealAction::ReachPartyMemberToHealAction(PlayerbotAI* botAI) : ReachTargetAction(botAI, "reach party member to heal", botAI->GetRange("spell"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user