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

Method ok_if_ability_unlocked

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

Ok if unit has unlocked its ability. InappropriateUnitType - the unit is not a robot. ResearchNotUnlocked - the ability is not researched.

(&self)

Source from the content-addressed store, hash-verified

601 /// * InappropriateUnitType - the unit is not a robot.
602 /// * ResearchNotUnlocked - the ability is not researched.
603 pub(crate) fn ok_if_ability_unlocked(&self) -> Result<(), GameError> {
604 if !self.is_ability_unlocked()? {
605 Err(GameError::ResearchNotUnlocked { unit_type: self.unit_type() })?
606 }
607 Ok(())
608 }
609
610 /// Ok if unit can use its ability. The unit's ability heat must
611 /// be lower than the maximum heat to act.

Callers 4

ok_if_snipe_unlockedMethod · 0.80
ok_if_blink_unlockedMethod · 0.80

Calls 2

is_ability_unlockedMethod · 0.80
unit_typeMethod · 0.80

Tested by

no test coverage detected