[Tank target] Improve position

This commit is contained in:
Yunfan Li
2024-09-26 20:02:37 +08:00
parent 8d524cdaf0
commit 5b8d8fbf6e

View File

@@ -2333,8 +2333,8 @@ bool TankFaceAction::Execute(Event event)
if (fabs(deltaAngle) > tolerable) if (fabs(deltaAngle) > tolerable)
return false; return false;
float goodAngle1 = Position::NormalizeOrientation(averageAngle + M_PI * 5 / 8); float goodAngle1 = Position::NormalizeOrientation(averageAngle + M_PI * 3 / 5);
float goodAngle2 = Position::NormalizeOrientation(averageAngle - M_PI * 5 / 8); float goodAngle2 = Position::NormalizeOrientation(averageAngle - M_PI * 3 / 5);
// if dist < bot->GetMeleeRange(target) / 2, target will move backward // if dist < bot->GetMeleeRange(target) / 2, target will move backward
float dist = std::max(bot->GetExactDist(target), bot->GetMeleeRange(target) / 2) - bot->GetCombatReach() - target->GetCombatReach(); float dist = std::max(bot->GetExactDist(target), bot->GetMeleeRange(target) / 2) - bot->GetCombatReach() - target->GetCombatReach();
@@ -2526,8 +2526,8 @@ bool SetBehindTargetAction::Execute(Event event)
if (fabs(deltaAngle) > tolerable) if (fabs(deltaAngle) > tolerable)
return false; return false;
float goodAngle1 = Position::NormalizeOrientation(target->GetOrientation() + M_PI * 5 / 8); float goodAngle1 = Position::NormalizeOrientation(target->GetOrientation() + M_PI * 3 / 5);
float goodAngle2 = Position::NormalizeOrientation(target->GetOrientation() - M_PI * 5 / 8); float goodAngle2 = Position::NormalizeOrientation(target->GetOrientation() - M_PI * 3 / 5);
float dist = std::max(bot->GetExactDist(target), bot->GetMeleeRange(target) / 2) - bot->GetCombatReach() - target->GetCombatReach(); float dist = std::max(bot->GetExactDist(target), bot->GetMeleeRange(target) / 2) - bot->GetCombatReach() - target->GetCombatReach();
std::vector<Position> availablePos; std::vector<Position> availablePos;