MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / attack

Method attack

battlecode-engine/src/controller/mod.rs:557–564  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 *****************************

Callers

nothing calls this directly

Calls 1

applyMethod · 0.80

Tested by

no test coverage detected