Javelins the robot, dealing the knight's standard damage. NoSuchUnit - either unit does not exist (inside the vision range). TeamNotAllowed - the knight is not on the current player's team. UnitNotOnMap - the knight is not on the map. InappropriateUnitType - the unit is not a knight. ResearchNotUnlocked - you do not have the needed research to use javelin. OutOfRange - the target does not lie wit
(&mut self, knight_id: UnitID, target_id: UnitID)
| 1508 | /// * OutOfRange - the target does not lie within ability range of the knight. |
| 1509 | /// * Overheated - the knight is not ready to use javelin again. |
| 1510 | pub fn javelin(&mut self, knight_id: UnitID, target_id: UnitID) -> Result<(), GameError> { |
| 1511 | self.ok_if_can_javelin(knight_id, target_id)?; |
| 1512 | self.ok_if_javelin_ready(knight_id)?; |
| 1513 | let damage = self.my_unit_mut(knight_id).unwrap().javelin(); |
| 1514 | self.damage_unit(target_id, damage); |
| 1515 | Ok(()) |
| 1516 | } |
| 1517 | |
| 1518 | // ************************************************************************ |
| 1519 | // *************************** RANGER METHODS ***************************** |
no test coverage detected