summaryrefslogtreecommitdiff
path: root/src/game.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin@worthe-it.co.za>2019-08-06 15:44:37 +0200
committerJustin Worthe <justin@worthe-it.co.za>2019-08-06 15:44:37 +0200
commite2b32320c8531f266d22d9302c28b0e863a95ba0 (patch)
tree7ab40165ea74686f24355e1a19485bb06d7d15fa /src/game.rs
parent05cd604ed4090664c0f7522e34c19de76e1c6b27 (diff)
Damaged the worms with lava
Diffstat (limited to 'src/game.rs')
-rw-r--r--src/game.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/game.rs b/src/game.rs
index 4e07e2f..3eb7b11 100644
--- a/src/game.rs
+++ b/src/game.rs
@@ -216,7 +216,12 @@ impl GameBoard {
}
fn simulate_worms_on_lava(&mut self) {
- // TODO
+ let lava_map = LAVA_MAP[self.round as usize];
+ self.players
+ .iter_mut()
+ .flat_map(|p| p.worms.iter_mut())
+ .filter(|w| lava_map.at(w.position) == Some(true))
+ .for_each(|ref mut w| w.health -= LAVA_DAMAGE);
}
fn simulate_tick_frozen_timers(&mut self) {