From 366edf57a811e979fd39c3eb7d5bb06d21de41f7 Mon Sep 17 00:00:00 2001 From: Justin Worthe Date: Fri, 9 Aug 2019 17:27:21 +0200 Subject: Scoring based on multiple criteria --- src/game/player.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/game/player.rs') 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 { -- cgit v1.2.3