summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-08-09 20:48:04 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-08-09 20:48:04 +0200
commitcd0c5b9d8c3f6a274018e0e60a4c0b82fc3598f3 (patch)
treef67d209f7f23552ebefbfbd29e60596d344fa2c1 /src/game
parent74becec945c19bad637cb2760ca30da9b4d395f8 (diff)
More filtering of silly moves
Diffstat (limited to 'src/game')
-rw-r--r--src/game/player.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/game/player.rs b/src/game/player.rs
index 0d24e60..8b63f9f 100644
--- a/src/game/player.rs
+++ b/src/game/player.rs
@@ -92,6 +92,14 @@ impl Player {
.map(|worm| worm.rounds_until_unfrozen > 1)
.unwrap_or(false)
}
+
+ pub fn bombs(&self) -> u8 {
+ self.worms.iter().map(|w| w.bombs).sum()
+ }
+
+ pub fn snowballs(&self) -> u8 {
+ self.worms.iter().map(|w| w.snowballs).sum()
+ }
}
#[cfg(test)]