diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-11 16:20:37 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-11 16:20:37 +0200 |
| commit | 97d4e814d1136b4749f924d6010a9666f7c0076d (patch) | |
| tree | 403a07423e53ba7e8656d4f5a06f1b27647bb63c | |
| parent | fix shifting maze sanity thresholds: only triggers at <60% (diff) | |
| download | dungeon-97d4e814d1136b4749f924d6010a9666f7c0076d.tar.gz dungeon-97d4e814d1136b4749f924d6010a9666f7c0076d.zip | |
fix player surviving at 0 HP after enemy retaliation
| -rw-r--r-- | src/game.rs | 10 |
1 files changed, 7 insertions, 3 deletions
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 { | |||
| 1022 | self.maze.take_entity(fx, fy); | 1022 | self.maze.take_entity(fx, fy); |
| 1023 | self.kills += 1; | 1023 | self.kills += 1; |
| 1024 | self.set_message(&format!("You slay the enemy! ({} dmg)", total_dmg)); | 1024 | self.set_message(&format!("You slay the enemy! ({} dmg)", total_dmg)); |
| 1025 | self.flash_color = 0xFF_CC3333; | ||
| 1026 | self.flash_alpha = 0.4; | ||
| 1027 | self.begin_attack_animation(); | ||
| 1025 | } else { | 1028 | } else { |
| 1026 | self.maze.entity_at_mut(fx, fy).map(|e| { | 1029 | self.maze.entity_at_mut(fx, fy).map(|e| { |
| 1027 | if let Entity::Enemy { hp: h, .. } = e { | 1030 | if let Entity::Enemy { hp: h, .. } = e { |
| @@ -1036,11 +1039,12 @@ impl Game { | |||
| 1036 | )); | 1039 | )); |
| 1037 | if self.hp == 0 { | 1040 | if self.hp == 0 { |
| 1038 | self.state = GameState::GameOver; | 1041 | self.state = GameState::GameOver; |
| 1042 | } else { | ||
| 1043 | self.flash_color = 0xFF_CC3333; | ||
| 1044 | self.flash_alpha = 0.4; | ||
| 1045 | self.begin_attack_animation(); | ||
| 1039 | } | 1046 | } |
| 1040 | } | 1047 | } |
| 1041 | self.flash_color = 0xFF_CC3333; | ||
| 1042 | self.flash_alpha = 0.4; | ||
| 1043 | self.begin_attack_animation(); | ||
| 1044 | true | 1048 | true |
| 1045 | } | 1049 | } |
| 1046 | 1050 | ||
