From 97d4e814d1136b4749f924d6010a9666f7c0076d Mon Sep 17 00:00:00 2001 From: salmonik Date: Sat, 11 Jul 2026 16:20:37 +0200 Subject: fix player surviving at 0 HP after enemy retaliation --- src/game.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/game.rs b/src/game.rs index cec85a2..133a43f 100644 --- a/src/game.rs +++ b/src/game.rs @@ -1022,6 +1022,9 @@ impl Game { self.maze.take_entity(fx, fy); self.kills += 1; self.set_message(&format!("You slay the enemy! ({} dmg)", total_dmg)); + self.flash_color = 0xFF_CC3333; + self.flash_alpha = 0.4; + self.begin_attack_animation(); } else { self.maze.entity_at_mut(fx, fy).map(|e| { if let Entity::Enemy { hp: h, .. } = e { @@ -1036,11 +1039,12 @@ impl Game { )); if self.hp == 0 { self.state = GameState::GameOver; + } else { + self.flash_color = 0xFF_CC3333; + self.flash_alpha = 0.4; + self.begin_attack_animation(); } } - self.flash_color = 0xFF_CC3333; - self.flash_alpha = 0.4; - self.begin_attack_animation(); true } -- cgit v1.2.3