Esempio n. 1
0
 def steam_into_wind(self, group: ShipGroup) -> Optional[int]:
     brc = self.m.weather.wind_at_ground.direction + 180
     for attempt in range(5):
         point = group.points[0].position.point_from_heading(
             brc, 100000 - attempt * 20000)
         if self.game.theater.is_in_sea(point):
             group.add_waypoint(point)
             return brc
     return None
Esempio n. 2
0
 def steam_into_wind(self, group: ShipGroup) -> Optional[int]:
     wind = self.game.conditions.weather.wind.at_0m
     brc = wind.direction + 180
     # Aim for 25kts over the deck.
     carrier_speed = knots(25) - mps(wind.speed)
     for attempt in range(5):
         point = group.points[0].position.point_from_heading(
             brc, 100000 - attempt * 20000)
         if self.game.theater.is_in_sea(point):
             group.points[0].speed = carrier_speed.meters_per_second
             group.add_waypoint(point, carrier_speed.kph)
             return brc
     return None
Esempio n. 3
0
 def add_unit_to_group(
     self,
     group: ShipGroup,
     unit_type: Type[ShipType],
     name: str,
     position: Point,
     heading: int,
 ) -> Ship:
     unit = Ship(self.game.next_unit_id(), f"{self.go.group_name}|{name}",
                 unit_type)
     unit.position = position
     unit.heading = heading
     group.add_unit(unit)
     return unit