NoSuchUnit - the unit does not exist (inside the vision range). TeamNotAllowed - the unit is not on the current player's team. InappropriateUnitType - the unit is not a robot, or is a healer. Overheated - the unit is not ready to attack.
(&self, robot_id: UnitID)
| 1107 | /// * InappropriateUnitType - the unit is not a robot, or is a healer. |
| 1108 | /// * Overheated - the unit is not ready to attack. |
| 1109 | fn ok_if_attack_ready(&self, robot_id: UnitID) -> Result<(), GameError> { |
| 1110 | if self.my_unit(robot_id)?.unit_type() == UnitType::Healer { |
| 1111 | Err(GameError::InappropriateUnitType)?; |
| 1112 | } |
| 1113 | self.my_unit(robot_id)?.ok_if_attack_ready()?; |
| 1114 | Ok(()) |
| 1115 | } |
| 1116 | |
| 1117 | /// Whether the robot is ready to attack. Tests whether the robot's attack |
| 1118 | /// heat is sufficiently low. |
no test coverage detected