]> granicus.if.org Git - nethack/commitdiff
fix #H9117 - bookeeping for fatal status condition
authorPatR <rankin@nethack.org>
Mon, 12 Aug 2019 01:56:43 +0000 (18:56 -0700)
committerPatR <rankin@nethack.org>
Mon, 12 Aug 2019 01:56:43 +0000 (18:56 -0700)
When Stoned, Slimed, Strangled, Sick (TermIll or FoodPois or both)
counts down to 0 without being cured, keep it listed as an active
condition while killing off the hero.  It will show in the status
section when disclosing final attributes and in both that section
and map's status lines when producing a dumplog.

doc/fixes36.3
src/cmd.c
src/timeout.c

index 907d9b88346560522c61835edec2c88eb8b51066..ea02fdf3960892445a83580d27b7414f6dffcc5b 100644 (file)
@@ -1,4 +1,4 @@
-$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.101 $ $NHDT-Date: 1565287308 2019/08/08 18:01:48 $
+$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.102 $ $NHDT-Date: 1565574993 2019/08/12 01:56:33 $
 
 This fixes36.3 file is here to capture information about updates in the 3.6.x
 lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -118,6 +118,8 @@ when a boulder was teleported, if it landed in a pit or trap door or hole its
 Terry Pratchett tribute, fix typo in passage #4 for Mort ("the" -> "they")
 fix typo in end_of_input() present since 3.6.0 that would prevent compilation
        for NOSAVEONHANGUP+INSURANCE configuration
+when a status condition becomes fatal, keep it listed as an active condition
+       during disclosure and/or dumplog rather than having it already reset
 
 
 Fixes to Post-3.6.2 Problems that Were Exposed Via git Repository
index 6a89d3dd495605e5b066e1964a111718f0403907..82a7819c7425f93476c16752629b71fcca28b006 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1,4 +1,4 @@
-/* NetHack 3.6 cmd.c   $NHDT-Date: 1565287308 2019/08/08 18:01:48 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.342 $ */
+/* NetHack 3.6 cmd.c   $NHDT-Date: 1565574994 2019/08/12 01:56:34 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.343 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2013. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -2333,26 +2333,50 @@ int final;
         youhiding(TRUE, final);
 
     /* internal troubles, mostly in the order that prayer ranks them */
-    if (Stoned)
-        you_are("turning to stone", "");
-    if (Slimed)
-        you_are("turning into slime", "");
+    if (Stoned) {
+        if (final && (Stoned & I_SPECIAL))
+            enlght_out(" You turned into stone.");
+        else
+            you_are("turning to stone", "");
+    }
+    if (Slimed) {
+        if (final && (Slimed & I_SPECIAL))
+            enlght_out(" You turned into slime.");
+        else
+            you_are("turning into slime", "");
+    }
     if (Strangled) {
         if (u.uburied) {
             you_are("buried", "");
         } else {
-            Strcpy(buf, "being strangled");
-            if (wizard)
-                Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
-            you_are(buf, from_what(STRANGLED));
+            if (final && (Strangled & I_SPECIAL)) {
+                enlght_out(" You died from strangulation.");
+            } else {
+                Strcpy(buf, "being strangled");
+                if (wizard)
+                    Sprintf(eos(buf), " (%ld)", (Strangled & TIMEOUT));
+                you_are(buf, from_what(STRANGLED));
+            }
         }
     }
     if (Sick) {
-        /* prayer lumps these together; botl puts Ill before FoodPois */
-        if (u.usick_type & SICK_NONVOMITABLE)
-            you_are("terminally sick from illness", "");
-        if (u.usick_type & SICK_VOMITABLE)
-            you_are("terminally sick from food poisoning", "");
+        /* the two types of sickness are lumped together; hero can be
+           afflicted by both but there is only one timeout; botl status
+           puts TermIll before FoodPois and death due to timeout reports
+           terminal illness if both are in effect, so do the same here */
+        if (final && (Sick & I_SPECIAL)) {
+            Sprintf(buf, " %sdied from %s.", You_, /* has trailing space */
+                    (u.usick_type & SICK_NONVOMITABLE)
+                    ? "terminal illness" : "food poisoning");
+            enlght_out(buf);
+        } else {
+            /* unlike death due to sickness, report the two cases separately
+               because it is possible to cure one without curing the other */
+            if (u.usick_type & SICK_NONVOMITABLE)
+                you_are("terminally sick from illness", "");
+            if (u.usick_type & SICK_VOMITABLE)
+                you_are("terminally sick from food poisoning", "");
+        }
     }
     if (Vomiting)
         you_are("nauseated", "");
index 3d820b0fb09905d735b0a6737f728dd3b3b14c4c..7b5fb78186cad8b5a8b97b96f4f5c61e136ec4a7 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 timeout.c       $NHDT-Date: 1564269133 2019/07/27 23:12:13 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.91 $ */
+/* NetHack 3.6 timeout.c       $NHDT-Date: 1565574996 2019/08/12 01:56:36 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.92 $ */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /*-Copyright (c) Robert Patrick Rankin, 2018. */
 /* NetHack may be freely redistributed.  See license for details. */
@@ -12,6 +12,8 @@ STATIC_DCL void NDECL(choke_dialogue);
 STATIC_DCL void NDECL(levitation_dialogue);
 STATIC_DCL void NDECL(slime_dialogue);
 STATIC_DCL void FDECL(slimed_to_death, (struct kinfo *));
+STATIC_DCL void NDECL(phaze_dialogue);
+STATIC_DCL void FDECL(done_timeout, (int, int));
 STATIC_DCL void NDECL(slip_or_trip);
 STATIC_DCL void FDECL(see_lamp_flicker, (struct obj *, const char *));
 STATIC_DCL void FDECL(lantern_message, (struct obj *));
@@ -406,7 +408,7 @@ struct kinfo *kptr;
     /* become a green slime; also resets youmonst.m_ap_type+.mappearance */
     (void) polymon(PM_GREEN_SLIME);
     mvitals[PM_GREEN_SLIME].mvflags = save_mvflags;
-    done(TURNED_SLIME);
+    done_timeout(TURNED_SLIME, SLIMED);
 
     /* life-saved; even so, hero still has turned into green slime;
        player may have genocided green slimes after being infected */
@@ -425,7 +427,7 @@ struct kinfo *kptr;
             /* follows "The medallion crumbles to dust." */
             pline("Unfortunately, %s", slimebuf);
         /* die again; no possibility of amulet this time */
-        done(GENOCIDED);
+        done(GENOCIDED); /* [should it be done_timeout(GENOCIDED, SLIMED)?] */
         /* could be life-saved again (only in explore or wizard mode)
            but green slimes are gone; just stay in current form */
     }
@@ -456,6 +458,23 @@ phaze_dialogue()
         pline1(phaze_texts[SIZE(phaze_texts) - i]);
 }
 
+/* when a status timeout is fatal, keep the status line indicator shown
+   during end of game rundown (and potential dumplog);
+   timeout has already counted down to 0 by the time we get here */
+STATIC_OVL void
+done_timeout(how, which)
+int how, which;
+{
+    long *intrinsic_p = &u.uprops[which].intrinsic;
+
+    *intrinsic_p |= I_SPECIAL; /* affects final disclosure */
+    done(how);
+
+    /* life-saved */
+    *intrinsic_p &= ~I_SPECIAL;
+    context.botl = TRUE;
+}
+
 void
 nh_timeout()
 {
@@ -541,10 +560,10 @@ nh_timeout()
                 }
                 dealloc_killer(kptr);
                 /* (unlike sliming, you aren't changing form here) */
-                done(STONING);
+                done_timeout(STONING, STONED);
                 break;
             case SLIMED:
-                slimed_to_death(kptr); /* done(TURNED_SLIME) */
+                slimed_to_death(kptr); /* done_timeout(TURNED_SLIME,SLIMED) */
                 break;
             case VOMITING:
                 make_vomiting(0L, TRUE);
@@ -568,8 +587,8 @@ nh_timeout()
                         killer.format = KILLED_BY;
                     }
                 }
+                done_timeout(POISONING, SICK);
                 u.usick_type = 0;
-                done(POISONING);
                 break;
             case FAST:
                 if (!Very_fast)
@@ -672,7 +691,7 @@ nh_timeout()
                 killer.format = KILLED_BY;
                 Strcpy(killer.name,
                        (u.uburied) ? "suffocation" : "strangulation");
-                done(DIED);
+                done_timeout(DIED, STRANGLED);
                 /* must be declining to die in explore|wizard mode;
                    treat like being cured of strangulation by prayer */
                 if (uamul && uamul->otyp == AMULET_OF_STRANGULATION) {