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

Method ok_if_within_ability_range

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

Ok if the robot can use its ability on the target location. InappropriateUnitType - the unit is not a robot. OutOfRange - the target location is not in range.

(&self, target_loc: Location)

Source from the content-addressed store, hash-verified

624 /// * InappropriateUnitType - the unit is not a robot.
625 /// * OutOfRange - the target location is not in range.
626 pub(crate) fn ok_if_within_ability_range(&self, target_loc: Location) -> Result<(), GameError> {
627 if !self.location().is_within_range(self.ability_range()?, target_loc) {
628 Err(GameError::OutOfRange)?;
629 }
630 Ok(())
631 }
632
633 // ************************************************************************
634 // *************************** WORKER METHODS *****************************

Callers 4

ok_if_can_buildMethod · 0.80
ok_if_can_javelinMethod · 0.80
ok_if_can_blinkMethod · 0.80
ok_if_can_overchargeMethod · 0.80

Calls 3

is_within_rangeMethod · 0.80
locationMethod · 0.80
ability_rangeMethod · 0.80

Tested by

no test coverage detected