mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Aew&c ai planning.
AI will generate AWE&C * Only one flight per turn * Takes the airfield farthest away from the frontline * Prefers CV over any airfield
This commit is contained in:
parent
7a077a0d21
commit
71914b8a8b
@ -173,8 +173,8 @@ class Package:
|
||||
FlightType.SEAD,
|
||||
FlightType.TARCAP,
|
||||
FlightType.BARCAP,
|
||||
FlightType.SWEEP,
|
||||
FlightType.AEWC,
|
||||
FlightType.SWEEP,
|
||||
FlightType.ESCORT,
|
||||
]
|
||||
for task in task_priorities:
|
||||
|
||||
@ -433,6 +433,22 @@ class ObjectiveFinder:
|
||||
return (c for c in self.game.theater.controlpoints if
|
||||
c.is_friendly(self.is_player))
|
||||
|
||||
def farthest_friendly_control_point(self) -> ControlPoint:
|
||||
"""
|
||||
Iterates over all friendly control points and find the one farthest away from the frontline
|
||||
BUT! prefer Cvs. Everybody likes CVs!
|
||||
"""
|
||||
from_frontline = 0
|
||||
|
||||
for c in self.game.theater.controlpoints:
|
||||
if c.is_carrier:
|
||||
return c
|
||||
if c.is_friendly(self.is_player) & c.has_frontline:
|
||||
if c.distance_to(self.front_lines().__next__()) > from_frontline:
|
||||
from_frontline = c.distance_to(self.front_lines().__next__())
|
||||
cp = c
|
||||
return cp
|
||||
|
||||
def enemy_control_points(self) -> Iterator[ControlPoint]:
|
||||
"""Iterates over all enemy control points."""
|
||||
return (c for c in self.game.theater.controlpoints if
|
||||
@ -487,6 +503,7 @@ class CoalitionMissionPlanner:
|
||||
MAX_OCA_RANGE = nautical_miles(150)
|
||||
MAX_SEAD_RANGE = nautical_miles(150)
|
||||
MAX_STRIKE_RANGE = nautical_miles(150)
|
||||
MAX_AWEC_RANGE = nautical_miles(200)
|
||||
|
||||
def __init__(self, game: Game, is_player: bool) -> None:
|
||||
self.game = game
|
||||
@ -506,6 +523,13 @@ class CoalitionMissionPlanner:
|
||||
ensure that they can be planned again next turn even if all aircraft are
|
||||
eliminated this turn.
|
||||
"""
|
||||
|
||||
#Find farthest, friendly CP for AEWC
|
||||
cp = self.objective_finder.farthest_friendly_control_point()
|
||||
yield ProposedMission(cp, [
|
||||
ProposedFlight(FlightType.AEWC, 1, self.MAX_AWEC_RANGE)
|
||||
])
|
||||
|
||||
# Find friendly CPs within 100 nmi from an enemy airfield, plan CAP.
|
||||
for cp in self.objective_finder.vulnerable_control_points():
|
||||
# Plan three rounds of CAP to give ~90 minutes coverage. Spacing
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user