summaryrefslogtreecommitdiff
path: root/src/ships.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2017-06-22 20:08:54 +0200
committerJustin Worthe <justin@worthe-it.co.za>2017-06-22 20:08:54 +0200
commit29719e34889f14377c0865e320eb4c1571f60a42 (patch)
tree14124c40ce5a2d77c14517d65850a29cc123fe1e /src/ships.rs
parent862897ea1d183810c2783eaeeaf40f648ef3dc2d (diff)
Added turns to weapon being available to knowledge
Diffstat (limited to 'src/ships.rs')
-rw-r--r--src/ships.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ships.rs b/src/ships.rs
index e37fe33..104e986 100644
--- a/src/ships.rs
+++ b/src/ships.rs
@@ -54,6 +54,13 @@ impl Weapon {
&SeekerMissle => 10*epr
}
}
+ pub fn single_shot_rounds_to_ready(&self, current_energy: u16, map_size: u16) -> u16 {
+ let single_shot_cost = Weapon::SingleShot.energy_cost(map_size);
+ let energy_per_round = Weapon::energy_per_round(map_size) - single_shot_cost;
+ let required_energy = self.energy_cost(map_size) - current_energy;
+ //weird plus is to make the integer rounding up instead of down
+ (required_energy + energy_per_round - 1) / energy_per_round
+ }
}