Remove front line minimum distance.

This isn't what it says. It doesn't enforce a minimum distance between
points, but a minimum path length, which isn't useful and isn't a
documented requirement.
This commit is contained in:
MetalStormGhost 2022-01-02 23:34:01 +02:00 committed by GitHub
parent 4139258508
commit c844c364fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,9 +13,6 @@ if TYPE_CHECKING:
from game.ato import FlightType from game.ato import FlightType
FRONTLINE_MIN_CP_DISTANCE = 5000
@dataclass @dataclass
class FrontLineSegment: class FrontLineSegment:
""" """
@ -173,23 +170,8 @@ class FrontLine(MissionTarget):
""" """
total_strength = self.blue_cp.base.strength + self.red_cp.base.strength total_strength = self.blue_cp.base.strength + self.red_cp.base.strength
if self.blue_cp.base.strength == 0: if self.blue_cp.base.strength == 0:
return self._adjust_for_min_dist(0) return 0
if self.red_cp.base.strength == 0: if self.red_cp.base.strength == 0:
return self._adjust_for_min_dist(self.attack_distance) return self.attack_distance
strength_pct = self.blue_cp.base.strength / total_strength strength_pct = self.blue_cp.base.strength / total_strength
return self._adjust_for_min_dist(strength_pct * self.attack_distance) return strength_pct * self.attack_distance
def _adjust_for_min_dist(self, distance: float) -> float:
"""
Ensures the frontline conflict is never located within the minimum distance
constant of either end control point.
"""
if (distance > self.attack_distance / 2) and (
distance + FRONTLINE_MIN_CP_DISTANCE > self.attack_distance
):
distance = self.attack_distance - FRONTLINE_MIN_CP_DISTANCE
elif (distance < self.attack_distance / 2) and (
distance < FRONTLINE_MIN_CP_DISTANCE
):
distance = FRONTLINE_MIN_CP_DISTANCE
return distance