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

Method heal

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

Commands the healer to heal the target robot. NoSuchUnit - either unit does not exist (inside the vision range). InappropriateUnitType - the unit is not a healer, or the target is not a robot. TeamNotAllowed - either robot is not on the current player's team. UnitNotOnMap - the healer is not on the map. OutOfRange - the target does not lie within "attack" range of the healer. Overheated - the hea

(&mut self, healer_id: UnitID, robot_id: UnitID)

Source from the content-addressed store, hash-verified

1691 /// * OutOfRange - the target does not lie within "attack" range of the healer.
1692 /// * Overheated - the healer is not ready to heal again.
1693 pub fn heal(&mut self, healer_id: UnitID, robot_id: UnitID) -> Result<(), GameError> {
1694 self.ok_if_can_heal(healer_id, robot_id)?;
1695 self.ok_if_heal_ready(healer_id)?;
1696 let damage = self.my_unit_mut(healer_id).unwrap().use_attack();
1697 self.damage_unit(robot_id, damage);
1698 Ok(())
1699 }
1700
1701 fn ok_if_can_overcharge(&self, healer_id: UnitID, robot_id: UnitID)
1702 -> Result<(), GameError> {

Callers 1

applyMethod · 0.45

Calls 5

ok_if_can_healMethod · 0.80
ok_if_heal_readyMethod · 0.80
use_attackMethod · 0.80
my_unit_mutMethod · 0.80
damage_unitMethod · 0.80

Tested by

no test coverage detected