]> granicus.if.org Git - nethack/commitdiff
fix #H4275 - blinded, stunned, confused timers
authorPatR <rankin@nethack.org>
Tue, 15 Mar 2016 08:00:36 +0000 (01:00 -0700)
committerPatR <rankin@nethack.org>
Tue, 15 Mar 2016 08:00:36 +0000 (01:00 -0700)
Blindness due to face covered by pie was ignored for several cases
of magically curing blindness--cleaning the face seems better than
adjusting timeout to account for u.ucreamed for those cases.  A few
instances of taking stun or confusion damage overrode existing stun
or confusion rather than increasing it.  Plus a copy/paste mistake
for dual stun+confusion when casting an expired spell.

There was also a suggestion that vomiting when already nauseated
should decrement the timer instead of increasing it.  But there is a
negative effect for as long as it's in effect, so I left that as is.

doc/fixes36.1
src/eat.c
src/mhitu.c
src/potion.c
src/pray.c
src/sit.c
src/spell.c

index 68dacfdab19736153c87cc3f84999003cb4b085e..d990e736c97af800454aa0d574c2abe500c54d31 100644 (file)
@@ -185,6 +185,9 @@ wand/spell/breath zaps that reached the edge of the level on the Plane of Air
 stop amulets and other items which aren't affected by erosion damage from
        being subjected to erosion damage
 grammar bit: polyself w/ gender change yielded "you turn into a Elvenking"
+some blindness cures ignored u.ucreamed
+some instances of stun or confusion timers were being overridden rather than
+       incremented when new stun or confusion damage was suffered
 
 
 Platform- and/or Interface-Specific Fixes
index 269fcaf28ea6118ee6e0b9534847c34aea1d7bdf..4c69cf14786d9b6da92ddc9997f5f07616474305 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1502,7 +1502,9 @@ struct obj *obj;
         make_confused(HConfusion + d(2, 4), FALSE);
     } else if (!rn2(4) && !Blind) {
         pline("Everything suddenly goes dark.");
-        make_blinded((long) d(2, 10), FALSE);
+        /* hero is not Blind, but Blinded timer might be nonzero if
+           blindness is being overridden by the Eyes of the Overworld */
+        make_blinded((Blinded & TIMEOUT) + (long) d(2, 10), FALSE);
         if (!Blind)
             Your1(vision_clears);
     } else if (!rn2(3)) {
@@ -1785,6 +1787,9 @@ struct obj *otmp;
 #endif
         } else if (otmp->otyp == EGG && stale_egg(otmp)) {
             pline("Ugh.  Rotten egg."); /* perhaps others like it */
+            /* increasing existing nausea means that it will take longer
+               before eventual vomit, but also means that constitution
+               will be abused more times before illness completes */
             make_vomiting((Vomiting & TIMEOUT) + (long) d(10, 4), TRUE);
         } else {
         give_feedback:
index f7f0afde2bf0d4cd602fd1f3ee705ba92e800898..9f3d70b14d2e5d3d0367f683c9ea79ab86ae455b 100644 (file)
@@ -2147,10 +2147,15 @@ register struct attack *mattk;
                 /* not blind at this point implies you're wearing
                    the Eyes of the Overworld; make them block this
                    particular stun attack too */
-                if (!Blind)
+                if (!Blind) {
                     Your1(vision_clears);
-                else
-                    make_stunned((long) d(1, 3), TRUE);
+                } else {
+                    long oldstun = (HStun & TIMEOUT), newstun = (long) rnd(3);
+
+                    /* we don't want to increment stun duration every time
+                       or sighted hero will become incapacitated */
+                    make_stunned(max(oldstun, newstun), TRUE);
+                }
             }
         }
         break;
index 53de9e8d9cb58cba2140bf74616270951ffff56f..568c48d99639a3227eacf8da652b44a8bc530008 100644 (file)
@@ -1090,8 +1090,12 @@ register boolean curesick, cureblind;
                 u.uhp = (u.uhpmax += nxtra);
         }
     }
-    if (cureblind)
+    if (cureblind) {
+        /* 3.6.1: it's debatible whether healing magic should clean off
+           mundane 'dirt', but if it doesn't, blindness isn't cured */
+        u.ucreamed = 0;
         make_blinded(0L, TRUE);
+    }
     if (curesick) {
         make_vomiting(0L, TRUE);
         make_sick(0L, (char *) 0, TRUE, SICK_ALL);
index 4c2df62a63aea2b2b7074c365eb596b76aa168cd..604e0663f4ee48c397d8fb0cb3ee6dc38c9a83f3 100644 (file)
@@ -289,7 +289,7 @@ worst_cursed_item()
     } else if (uright && uright->cursed) { /* right ring */
         otmp = uright;
     } else if (ublindf && ublindf->cursed) { /* eyewear */
-        otmp = ublindf;                      /* must be non-blinding lenses */
+        otmp = ublindf; /* must be non-blinding lenses */
         /* if weapon wasn't handled above, do it now */
     } else if (welded(uwep)) { /* weapon */
         otmp = uwep;
@@ -1048,8 +1048,15 @@ aligntyp g_align;
             ABASE(A_STR) = AMAX(A_STR);
             if (u.uhunger < 900)
                 init_uhunger();
+            /* luck couldn't have been negative at start of prayer because
+               the prayer would have failed, but might have been decremented
+               due to a timed event (delayed death of peaceful monster hit
+               by hero-created stinking cloud) during the praying interval */
             if (u.uluck < 0)
                 u.uluck = 0;
+            /* superfluous; if hero was blinded we'd be handling trouble
+               rather than issuing a pat-on-head */
+            u.ucreamed = 0;
             make_blinded(0L, TRUE);
             context.botl = 1;
             break;
index b91da158198f2b451030219572884266705d074b..b39df58eaab32d9cb8e261db894247f954b36185 100644 (file)
--- a/src/sit.c
+++ b/src/sit.c
@@ -184,6 +184,7 @@ dosit()
                 if (u.uhp >= (u.uhpmax - 5))
                     u.uhpmax += 4;
                 u.uhp = u.uhpmax;
+                u.ucreamed = 0;
                 make_blinded(0L, TRUE);
                 make_sick(0L, (char *) 0, FALSE, SICK_ALL);
                 heal_legs();
index 6110a8472e850b7a5d95d9f4b72134c8e216dc55..a8adba34c4c06775abec7d0418c1ee65e09f571a 100644 (file)
@@ -866,8 +866,8 @@ int spell;
         break;
     case 7:
     case 8:
-        make_stunned(old_conf + 2L * duration / 3L, FALSE); /* 20% */
-        make_confused(old_stun + duration / 3L, FALSE);
+        make_stunned(old_stun + 2L * duration / 3L, FALSE); /* 20% */
+        make_confused(old_conf + duration / 3L, FALSE);
         break;
     case 9:
         make_stunned(old_stun + duration, FALSE); /* 10% */