Commands a robot to attack a unit, dealing the robot's standard amount of damage. Healers cannot attack, and should use `heal()` instead. 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. UnitNotOnMap - the unit or target is not on the map. OutOfRange - th
(&mut self, robot_id: UnitID, target_unit_id: UnitID)
| 555 | /// * OutOfRange - the target location is not in range. |
| 556 | /// * Overheated - the unit is not ready to attack. |
| 557 | pub fn attack(&mut self, robot_id: UnitID, target_unit_id: UnitID) -> Result<(), GameError> { |
| 558 | let delta = Delta::Attack { robot_id, target_unit_id }; |
| 559 | self.world.apply(&delta)?; |
| 560 | if self.config.generate_turn_messages { |
| 561 | self.turn.changes.push(delta); |
| 562 | } |
| 563 | Ok(()) |
| 564 | } |
| 565 | |
| 566 | // ************************************************************************ |
| 567 | // ************************* RESEARCH METHODS ***************************** |