fix: dont display death text after fleeing
authorxangelo <me@xangelo.ca>
Wed, 16 Aug 2023 18:30:59 +0000 (14:30 -0400)
committerxangelo <me@xangelo.ca>
Wed, 16 Aug 2023 18:30:59 +0000 (14:30 -0400)
The check now validates that the player has ACTUALLY died before
displaying that they died on the front end.

src/server/views/fight.ts

index 1995d9a326ccea8a247610354577cf411ecb8d6b..4663c62a9d476dda531363bb0d0635477e1a4761 100644 (file)
@@ -19,8 +19,9 @@ export function renderRoundDetails(roundData: FightRound): string {
       }
     break;
     case 'monster':
-      // prompt to return to town and don't let them do anything
-      html.push(`<p>You were killed...</p>`);
+      if(roundData.player.hp === 0) {
+        html.push(`<p>You were killed...</p>`);
+      }
       html.push('<p><button hx-get="/player/explore" hx-target="#explore">Back to Town</button></p>');
     break;
     case 'in-progress':