Don't plan SEAD when only a search radar remains.

This commit is contained in:
Dan Albert 2021-05-23 13:15:42 -07:00
parent 1d7b0c9b17
commit fa321c7ddc
2 changed files with 8 additions and 8 deletions

View File

@ -143,12 +143,11 @@ class TheaterGroundObject(MissionTarget):
return False
@property
def has_alive_radar(self) -> bool:
"""Returns True if the ground object contains a unit with radar."""
def has_live_radar_sam(self) -> bool:
"""Returns True if the ground object contains a unit with working radar SAM."""
for group in self.groups:
for unit in group.units:
if db.unit_type_from_name(unit.type) in UNITS_WITH_RADAR:
return True
if self.threat_range(group, radar_only=True):
return True
return False
def _max_range_of_type(self, group: Group, range_type: str) -> Distance:

View File

@ -628,16 +628,17 @@ class CoalitionMissionPlanner:
# Only include SEAD against SAMs that still have emitters. No need to
# suppress an EWR, and SEAD isn't useful against a SAM that no longer has a
# radar.
# working track radar.
#
# For SAMs without radar and EWRs, we still want a SEAD escort if needed.
# For SAMs without track radars and EWRs, we still want a SEAD escort if
# needed.
#
# Note that there is a quirk here: we should potentially be included a SEAD
# escort *and* SEAD when the target is a radar SAM but the flight path is
# also threatened by SAMs. We don't want to include a SEAD escort if the
# package is *only* threatened by the target though. Could be improved, but
# needs a decent refactor to the escort planning to do so.
if isinstance(sam, SamGroundObject) and sam.has_alive_radar:
if sam.has_live_radar_sam:
flights.append(ProposedFlight(FlightType.SEAD, 2, self.MAX_SEAD_RANGE))
else:
flights.append(