]> granicus.if.org Git - nethack/commitdiff
fix github issue #511 - no death message when
authorPatR <rankin@nethack.org>
Tue, 18 May 2021 23:26:38 +0000 (16:26 -0700)
committerPatR <rankin@nethack.org>
Tue, 18 May 2021 23:26:38 +0000 (16:26 -0700)
level-drained below level 1.  No "you die" or equivalent, just
straight to being life-saved or to "do you want your possessions
identifed?".  Change it to issue "Goodbye level 1."  The fact
that it is has been fatal will become obvious.  An issue comment
on github pointed out where the fix was needed.

Fixes #511

doc/fixes37.0
src/end.c
src/exper.c

index 3c82aaf5d0a5c45afe76a52b6589264ed7ea334c..04d58c1e7b0272993e8e5207b13a6e14e67ac7f1 100644 (file)
@@ -1,4 +1,4 @@
-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.535 $ $NHDT-Date: 1621208908 2021/05/16 23:48:28 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.539 $ $NHDT-Date: 1621380392 2021/05/18 23:26:32 $
 
 General Fixes and Modified Features
 -----------------------------------
@@ -522,6 +522,8 @@ prediscovered weapons adjustmens:  only knights and samurai know polearms;
 if the move counter ever reaches 1000000000, end the game
 knights get no metal armor penalty for clerical spells
 change touch of death from instadeath to maxhp reduction and damage
+dying from being level-drained below level 1 killed hero without saying so
+       and jumped straight to "do you want your possessions identified?"
 
 
 Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
index 614e161c52d8122f3d0855713dada826da1eb659..020ad15a2612d7b0ec9fbb7f97b2a9e3aad9ff57 100644 (file)
--- a/src/end.c
+++ b/src/end.c
@@ -1,4 +1,4 @@
-/* NetHack 3.7 end.c   $NHDT-Date: 1615304753 2021/03/09 15:45:53 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */
+/* NetHack 3.7 end.c   $NHDT-Date: 1621380392 2021/05/18 23:26:32 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.225 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2012. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -902,8 +902,13 @@ disclose(int how, boolean taken)
 static void
 savelife(int how)
 {
-    int uhpmin = max(2 * u.ulevel, 10);
+    int uhpmin;
 
+    /* life-drain/level-loss to experience level 0 kills without actually
+       reducing ulevel below 1, but include this for bulletproofing */
+    if (u.ulevel < 1)
+        u.ulevel = 1;
+    uhpmin = max(2 * u.ulevel, 10);
     if (u.uhpmax < uhpmin)
         u.uhpmax = uhpmin;
     u.uhp = u.uhpmax;
index be3e11da756cf97c05668cd816d2ed7e741d178f..4673d8aec40077aa54efd6b0a12ea481775c416b 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.7 exper.c $NHDT-Date: 1596498167 2020/08/03 23:42:47 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.43 $ */
+/* NetHack 3.7 exper.c $NHDT-Date: 1621380393 2021/05/18 23:26:33 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.46 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2007. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -205,8 +205,14 @@ losexp(const char *drainer) /* cause of death, if drain should be fatal */
     else if (resists_drli(&g.youmonst))
         return;
 
+    /* level-loss message; "Goodbye level 1." is fatal; divine anger
+       (drainer==NULL) resets a level 1 character to 0 experience points
+       without reducing level and that isn't fatal so suppress the message
+       in that situation */
+    if (u.ulevel > 1 || drainer)
+        pline("%s level %d.", Goodbye(), u.ulevel);
     if (u.ulevel > 1) {
-        pline("%s level %d.", Goodbye(), u.ulevel--);
+        u.ulevel -= 1;
         /* remove intrinsic abilities */
         adjabil(u.ulevel + 1, u.ulevel);
     } else {