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

Method javelin

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

Javelins the robot, dealing the knight's standard damage. NoSuchUnit - either unit does not exist (inside the vision range). TeamNotAllowed - the knight is not on the current player's team. UnitNotOnMap - the knight is not on the map. InappropriateUnitType - the unit is not a knight. ResearchNotUnlocked - you do not have the needed research to use javelin. OutOfRange - the target does not lie wit

(&mut self, knight_id: UnitID, target_id: UnitID)

Source from the content-addressed store, hash-verified

1508 /// * OutOfRange - the target does not lie within ability range of the knight.
1509 /// * Overheated - the knight is not ready to use javelin again.
1510 pub fn javelin(&mut self, knight_id: UnitID, target_id: UnitID) -> Result<(), GameError> {
1511 self.ok_if_can_javelin(knight_id, target_id)?;
1512 self.ok_if_javelin_ready(knight_id)?;
1513 let damage = self.my_unit_mut(knight_id).unwrap().javelin();
1514 self.damage_unit(target_id, damage);
1515 Ok(())
1516 }
1517
1518 // ************************************************************************
1519 // *************************** RANGER METHODS *****************************

Callers 1

applyMethod · 0.45

Calls 4

ok_if_can_javelinMethod · 0.80
ok_if_javelin_readyMethod · 0.80
my_unit_mutMethod · 0.80
damage_unitMethod · 0.80

Tested by

no test coverage detected