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

Method ok_if_ability_ready

battlecode-engine/src/unit.rs:615–620  ·  view source on GitHub ↗

Ok if unit can use its ability. The unit's ability heat must be lower than the maximum heat to act. InappropriateUnitType - the unit is not a robot. Overheated - the unit is not ready to use its ability.

(&self)

Source from the content-addressed store, hash-verified

613 /// * InappropriateUnitType - the unit is not a robot.
614 /// * Overheated - the unit is not ready to use its ability.
615 pub(crate) fn ok_if_ability_ready(&self) -> Result<(), GameError> {
616 if self.ability_heat()? >= MAX_HEAT_TO_ACT {
617 Err(GameError::Overheated)?;
618 }
619 Ok(())
620 }
621
622 /// Ok if the robot can use its ability on the target location.
623 ///

Callers 5

ok_if_can_replicateMethod · 0.80
ok_if_javelin_readyMethod · 0.80
ok_if_blink_readyMethod · 0.80

Calls 1

ability_heatMethod · 0.80

Tested by

no test coverage detected