Ejemplo n.º 1
0
    def order_airlift_assets_at(self, control_point: ControlPoint) -> None:
        unclaimed_parking = control_point.unclaimed_parking(self.game)
        # Buy a maximum of unclaimed_parking only to prevent that aircraft procurement
        # take place at another base
        gap = min(
            [
                self.desired_airlift_capacity(control_point)
                - self.current_airlift_capacity(control_point),
                unclaimed_parking,
            ]
        )

        if gap <= 0:
            return

        if gap % 2:
            # Always buy in pairs since we're not trying to fill odd squadrons. Purely
            # aesthetic.
            gap += 1

        if gap > unclaimed_parking:
            # Prevent to buy more aircraft than possible
            return

        self.game.procurement_requests_for(player=control_point.captured).append(
            AircraftProcurementRequest(
                control_point, nautical_miles(200), FlightType.TRANSPORT, gap
            )
        )
Ejemplo n.º 2
0
    def plan_relocation(self, destination: ControlPoint,
                        theater: ConflictTheater) -> None:
        if destination == self.location:
            logging.warning(
                f"Attempted to plan relocation of {self} to current location "
                f"{destination}. Ignoring.")
            return
        if destination == self.destination:
            logging.warning(
                f"Attempted to plan relocation of {self} to current destination "
                f"{destination}. Ignoring.")
            return

        if self.expected_size_next_turn > destination.unclaimed_parking():
            raise RuntimeError(
                f"Not enough parking for {self} at {destination}.")
        if not destination.can_operate(self.aircraft):
            raise RuntimeError(f"{self} cannot operate at {destination}.")
        self.destination = destination
        self.replan_ferry_flights(theater)