diff --git a/game/theater/theatergroundobject.py b/game/theater/theatergroundobject.py index 00e3953d..1d1f0ffc 100644 --- a/game/theater/theatergroundobject.py +++ b/game/theater/theatergroundobject.py @@ -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: diff --git a/gen/flights/ai_flight_planner.py b/gen/flights/ai_flight_planner.py index 027230ed..91c50e5d 100644 --- a/gen/flights/ai_flight_planner.py +++ b/gen/flights/ai_flight_planner.py @@ -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(