Fixing OCA-bug against FOBs

OCA Aircraft should be properly allowed against FOBs given Ghosti's roadbases
This commit is contained in:
Raffson 2023-07-05 23:23:00 +02:00
parent 785ac6eacc
commit 2ec187bc9c
No known key found for this signature in database
GPG Key ID: B0402B2C9B764D99
3 changed files with 6 additions and 4 deletions

View File

@ -3,7 +3,7 @@ from __future__ import annotations
import logging import logging
from typing import Type from typing import Type
from game.theater import Airfield from game.theater import Airfield, Fob
from .formationattack import ( from .formationattack import (
FormationAttackBuilder, FormationAttackBuilder,
FormationAttackFlightPlan, FormationAttackFlightPlan,
@ -23,7 +23,7 @@ class Builder(FormationAttackBuilder[OcaAircraftFlightPlan, FormationAttackLayou
def layout(self) -> FormationAttackLayout: def layout(self) -> FormationAttackLayout:
location = self.package.target location = self.package.target
if not isinstance(location, Airfield): if not isinstance(location, Airfield) and not isinstance(location, Fob):
logging.exception( logging.exception(
f"Invalid Objective Location for OCA/Aircraft flight " f"Invalid Objective Location for OCA/Aircraft flight "
f"{self.flight=} at {location=}." f"{self.flight=} at {location=}."

View File

@ -1,7 +1,6 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
from random import randint
from game.ato.flighttype import FlightType from game.ato.flighttype import FlightType
from game.commander.tasks.packageplanningtask import PackagePlanningTask from game.commander.tasks.packageplanningtask import PackagePlanningTask
@ -25,7 +24,8 @@ class PlanOcaStrike(PackagePlanningTask[ControlPoint]):
def propose_flights(self) -> None: def propose_flights(self) -> None:
size = self.get_flight_size() size = self.get_flight_size()
self.propose_flight(FlightType.OCA_RUNWAY, size) if self.target.cptype == self.target.cptype.AIRBASE:
self.propose_flight(FlightType.OCA_RUNWAY, size)
if self.aircraft_cold_start: if self.aircraft_cold_start:
self.propose_flight(FlightType.OCA_AIRCRAFT, 2) self.propose_flight(FlightType.OCA_AIRCRAFT, 2)
self.propose_common_escorts() self.propose_common_escorts()

View File

@ -1558,6 +1558,8 @@ class Fob(ControlPoint, RadioFrequencyContainer, CTLD):
if not self.is_friendly(for_player): if not self.is_friendly(for_player):
yield FlightType.STRIKE yield FlightType.STRIKE
yield FlightType.AIR_ASSAULT yield FlightType.AIR_ASSAULT
if self.total_aircraft_parking(ParkingType(True, True, True)):
yield FlightType.OCA_AIRCRAFT
else: else:
yield FlightType.AEWC yield FlightType.AEWC