summaryrefslogtreecommitdiff
path: root/src/game.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-05-13 17:33:22 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-05-13 17:33:22 +0200
commit652242e584ee2b7cfb3021d570a63e57cfa52773 (patch)
treecec80eeaafa5cdaa0ece8e395bafcccf70496f92 /src/game.rs
parent3d1676842e20c90bb5599daa2caefdea2bbf9fe8 (diff)
Building up unsimulated moves list
Diffstat (limited to 'src/game.rs')
-rw-r--r--src/game.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/game.rs b/src/game.rs
index b6a051f..bf014f1 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -255,6 +255,13 @@ impl Player {
fn active_worm_mut(&mut self) -> &mut Worm {
&mut self.worms[self.active_worm]
}
+
+ pub fn health(&self) -> i32 {
+ self.worms
+ .iter()
+ .map(|w| w.health)
+ .sum()
+ }
}
impl Map {