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

Method ok_if_attack_ready

battlecode-engine/src/world.rs:1109–1115  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 3

is_attack_readyMethod · 0.45
attackMethod · 0.45
ok_if_heal_readyMethod · 0.45

Calls 2

unit_typeMethod · 0.80
my_unitMethod · 0.80

Tested by

no test coverage detected