diff options
author | Justin Worthe <justin@worthe-it.co.za> | 2019-08-09 17:27:21 +0200 |
---|---|---|
committer | Justin Worthe <justin@worthe-it.co.za> | 2019-08-09 17:27:21 +0200 |
commit | 366edf57a811e979fd39c3eb7d5bb06d21de41f7 (patch) | |
tree | 91590cd82afc9878564b0610b5a06723a0ccee3a /src/game | |
parent | bcf28f2fcb7935b316a5a2f660b065faae51f0d9 (diff) |
Scoring based on multiple criteria
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/player.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/game/player.rs b/src/game/player.rs index 6c2efb2..0d24e60 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -46,6 +46,10 @@ impl Player { self.worms.iter().map(|w| w.health).sum() } + pub fn max_worm_health(&self) -> i32 { + self.worms.iter().map(|w| w.health).max().unwrap_or(0) + } + pub fn clear_dead_worms(&mut self) { for worm_index in (0..self.worms.len()).rev() { if self.worms[worm_index].health <= 0 { |