Launches the rocket into space, damaging the units adjacent to the takeoff location. NoSuchUnit - the rocket does not exist (inside the vision range). TeamNotAllowed - the rocket is not on the current player's team. SamePlanet - the rocket cannot fly to a location on the same planet. InappropriateUnitType - the unit is not a rocket. StructureNotYetBuilt - the rocket has not yet been completed. Ro
(&mut self, rocket_id: UnitID, destination: MapLocation)
| 1963 | /// * LocationOffMap - the given location is off the map. |
| 1964 | /// * LocationNotEmpty - the given location contains impassable terrain. |
| 1965 | pub fn launch_rocket(&mut self, rocket_id: UnitID, destination: MapLocation) |
| 1966 | -> Result<(), GameError> { |
| 1967 | self.ok_if_can_launch_rocket(rocket_id, destination)?; |
| 1968 | let takeoff_loc = self.my_unit(rocket_id)?.location().map_location()?; |
| 1969 | let blast_damage = self.my_unit(rocket_id)?.rocket_blast_damage()?; |
| 1970 | for dir in Direction::all() { |
| 1971 | self.damage_location(takeoff_loc.add(dir), blast_damage); |
| 1972 | } |
| 1973 | self.move_to_space(rocket_id); |
| 1974 | self.my_unit_mut(rocket_id)?.launch_rocket(); |
| 1975 | |
| 1976 | let landing_round = self.round + self.orbit.duration(self.round) |
| 1977 | - self.my_unit(rocket_id)?.rocket_travel_time_decrease().unwrap(); |
| 1978 | self.my_team_mut().rocket_landings.add_landing( |
| 1979 | landing_round, RocketLanding::new(rocket_id, destination) |
| 1980 | ); |
| 1981 | Ok(()) |
| 1982 | } |
| 1983 | |
| 1984 | /// Lands the rocket, damaging the units in adjacent squares. The rocket |
| 1985 | /// is destroyed if it lands on a factory, rocket, or impassable terrain. |