]> granicus.if.org Git - nethack/commitdiff
B01003 - blindfold vs dust vortex
authorcohrs <cohrs>
Wed, 26 Mar 2003 05:10:22 +0000 (05:10 +0000)
committercohrs <cohrs>
Wed, 26 Mar 2003 05:10:22 +0000 (05:10 +0000)
This started out as a change to address the strange sequence of messages if
you remove a blindfold while engulfed in a dust vortex.  That is addressed
by a new function that can be called in such situations.  Calls to this
function were added in all the cases where the can_blnd() engulfing
conditions end as a result of player action.  There are some other cases
that end ucreamed or usleep, but they happen between turns and shouldn't
need extra handling.

While I was at it, I noticed that a unicorn horn or prayer would cure
blindness even while engulfed in a dust vortex.  This is useless, because
you immediately get blind again the next turn.  So, I added checks to avoid
doing this.  Finally, it didn't make sense for eating a carrot to cure your
blindness in these situations either, only for it to return immediately.

doc/fixes35.0
include/extern.h
src/apply.c
src/do.c
src/do_wear.c
src/eat.c
src/mhitu.c
src/pray.c

index ed433419a775101a6f7a5465477d2f51e9801c3a..df20675cc8e9adb884ee51a8482fc198ca1ceb22 100644 (file)
@@ -22,6 +22,10 @@ apply weapon skill to-hit bonus or penalty to bare-handed attacks
 only give monk's "cumbersome armor" message when the armor penalty causes
        an attack to miss
 identified touchstone can rub on gold like the data.base entry says
+dust vortex-induced blindness should kick in immediately when blindfold
+       is removed or glop is wiped off
+prayer/unicorn-horn won't fix blindness while still engulfed in a dust
+       vortex since it will just return immediately
 
 
 Platform- and/or Interface-Specific Fixes
index dc083631fb8e0e3e0a2ab79c3b69a68cd7184222..8fb0b749f931771086be48d5f058d25231f91b73 100644 (file)
@@ -960,6 +960,7 @@ E void FDECL(expels, (struct monst *,struct permonst *,BOOLEAN_P));
 E struct attack *FDECL(getmattk, (struct permonst *,int,int *,struct attack *));
 E int FDECL(mattacku, (struct monst *));
 E int FDECL(magic_negation, (struct monst *));
+E boolean NDECL(gulp_blnd_check);
 E int FDECL(gazemu, (struct monst *,struct attack *));
 E void FDECL(mdamageu, (struct monst *,int));
 E int FDECL(could_seduce, (struct monst *,struct monst *,struct attack *));
index 410411edfb402f5b8acff9d8099eeaaa000510ee..1219da2e122c554303fd39da8e32b6b91c4384e9 100644 (file)
@@ -134,21 +134,23 @@ use_towel(obj)
        }
 
        if (Glib) {
-               Glib = 0;
-               You("wipe off your %s.", makeplural(body_part(HAND)));
-               return 1;
+           Glib = 0;
+           You("wipe off your %s.", makeplural(body_part(HAND)));
+           return 1;
        } else if(u.ucreamed) {
-               Blinded -= u.ucreamed;
-               u.ucreamed = 0;
-
-               if (!Blinded) {
-                       pline("You've got the glop off.");
-                       Blinded = 1;
-                       make_blinded(0L,TRUE);
-               } else {
-                       Your("%s feels clean now.", body_part(FACE));
+           Blinded -= u.ucreamed;
+           u.ucreamed = 0;
+
+           if (!Blinded) {
+               pline("You've got the glop off.");
+               if (!gulp_blnd_check()) {
+                   Blinded = 1;
+                   make_blinded(0L,TRUE);
                }
-               return 1;
+           } else {
+               Your("%s feels clean now.", body_part(FACE));
+           }
+           return 1;
        }
 
        Your("%s and %s are already clean.",
@@ -1476,7 +1478,10 @@ struct obj *obj;
 
        /* collect property troubles */
        if (Sick) prop_trouble(SICK);
-       if (Blinded > (long)u.ucreamed) prop_trouble(BLINDED);
+       if (Blinded > (long)u.ucreamed &&
+           !(u.uswallow &&
+             attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
+           prop_trouble(BLINDED);
        if (HHallucination) prop_trouble(HALLUC);
        if (Vomiting) prop_trouble(VOMITING);
        if (HConfusion) prop_trouble(CONFUSION);
index e4d6fac5c88494d21a93c348a3b8a34eafce518d..717efed21638b2398e23a87a44305ebda5fb12c4 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1580,8 +1580,10 @@ wipeoff()
        if (!Blinded) {
                pline("You've got the glop off.");
                u.ucreamed = 0;
-               Blinded = 1;
-               make_blinded(0L,TRUE);
+               if (!gulp_blnd_check()) {
+                   Blinded = 1;
+                   make_blinded(0L,TRUE);
+               }
                return(0);
        } else if (!u.ucreamed) {
                Your("%s feels clean now.", body_part(FACE));
index 5caca22d1396650b440050d8703cd2d2c80aa9d3..cad425b1ed00ffa96bc84b5e0d9fd569f1e2a9a0 100644 (file)
@@ -912,8 +912,10 @@ register struct obj *otmp;
                if (Punished) set_bc(0);
            }
        } else if (was_blind) {
-           changed = TRUE;     /* !Blind */
-           You("can see again.");
+           if (!gulp_blnd_check()) {
+               changed = TRUE; /* !Blind */
+               You("can see again.");
+           }
        }
        if (changed) {
            /* blindness has just been toggled */
index df14e1d65b59d101afd0e56d368af216274b055d..f7ed266c7019d1630a61e333f9915c6b82c7036e 100644 (file)
--- a/src/eat.c
+++ b/src/eat.c
@@ -1638,7 +1638,9 @@ register struct obj *otmp;
                    you_unwere(TRUE);
                break;
            case CARROT:
-               make_blinded((long)u.ucreamed,TRUE);
+               if (!u.uswallow ||
+                   !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
+                   make_blinded((long)u.ucreamed,TRUE);
                break;
            case FORTUNE_COOKIE:
                outrumor(bcsign(otmp), BY_COOKIE);
index 54b83e1288b73b1de667a61af3467f17af0f8699..f446da92a4b58d96d78b9279ec677e5e7501329b 100644 (file)
@@ -1588,6 +1588,24 @@ dopois:
 #endif /* OVL1 */
 #ifdef OVLB
 
+/* An interface for use when taking a blindfold off, for example,
+ * to see if an engulfing attack should immediately take affect, like
+ * a passive attack. TRUE if engulfing blindness occurred */
+boolean
+gulp_blnd_check()
+{
+       struct attack *mattk;
+
+       if (!Blinded && u.uswallow &&
+           (mattk = attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)) &&
+           can_blnd(u.ustuck, &youmonst, mattk->aatyp, (struct obj*)0)) {
+           ++u.uswldtim;               /* compensate for gulpmu change */
+           (void) gulpmu(u.ustuck, mattk);
+           return TRUE;
+       }
+       return FALSE;
+}
+
 STATIC_OVL int
 gulpmu(mtmp, mattk)    /* monster swallows you, or damage if u.uswallow */
        register struct monst *mtmp;
index 5915a890c5a682c3d1235ea08f61e9011270a985..084f6d702a6d691585236217eb872c3eda0be867 100644 (file)
@@ -187,7 +187,10 @@ in_trouble()
        }
 #endif
 
-       if (Blinded > 1 && haseyes(youmonst.data)) return(TROUBLE_BLIND);
+       if (Blinded > 1 && haseyes(youmonst.data) &&
+           (!u.uswallow ||
+            !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
+           return(TROUBLE_BLIND);
        for(i=0; i<A_MAX; i++)
            if(ABASE(i) < AMAX(i)) return(TROUBLE_POISONED);
        if(Wounded_legs