From 6e9fe76cf9f9c33fdbd2df0d6fefa11c86f7a188 Mon Sep 17 00:00:00 2001 From: biroder <107300789+biroder@users.noreply.github.com> Date: Sat, 4 Mar 2023 18:15:20 +0200 Subject: [PATCH] Add damage amount display when taking fatal damage Fix doukutsu-rs/doukutsu-rs#163 --- src/game/player/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/game/player/mod.rs b/src/game/player/mod.rs index da6ddb0..95d9824 100644 --- a/src/game/player/mod.rs +++ b/src/game/player/mod.rs @@ -939,7 +939,13 @@ impl Player { impl GameEntity<&NPCList> for Player { fn tick(&mut self, state: &mut SharedGameState, npc_list: &NPCList) -> GameResult { - if !self.cond.alive() { + if !self.cond.alive() && self.life > 0 { + return Ok(()); + } else if !self.cond.alive() && self.life == 0 { + self.popup.x = self.x; + self.popup.y = self.y - self.display_bounds.top as i32 + 0x1000; + self.popup.tick(state, ())?; + return Ok(()); }