]> granicus.if.org Git - nethack/commitdiff
enlightenment feedback for sight-based properties (trunk only)
authornethack.rankin <nethack.rankin>
Fri, 26 Oct 2007 02:24:22 +0000 (02:24 +0000)
committernethack.rankin <nethack.rankin>
Fri, 26 Oct 2007 02:24:22 +0000 (02:24 +0000)
     "You can see invisible" is misleading when you can't see anything,
so use alternate phrasing for See_invisible when blind.  Also, add extra
wizard mode feedback when blindness is overridden by the monk's Eyes
artifact, when invisibility is blocked by worn mummy wrapping, and when
clairvoyance is blocked by worn cornuthaum.  And fix end-of-game disclosure
for blindness; it was only being shown if/when caused by worn blindfold.

doc/fixes35.0
src/attrib.c
src/cmd.c

index 4507ab579828dbe64d2a69725f3fe2d1c3571f10..02e98a029f4b8ecac8e66d4d36ef4ae42edea45c 100644 (file)
@@ -342,6 +342,7 @@ add Roderick Schertler's pickup_thrown patch
 add ability to sort the list when viewing known spells with '+' command
 describe magic cancellation from worn armor in enlightment/end-of-game feedback
 disclose half physical and/or spell damage in enlightment/end-of-game feedback
+rephrase see invisibility enlightenment feedback when unable to see at all
 add atmospheric sound messages for temples
 sometimes give announcement message when monsters teleport to hero's vicinity
 obsolete config file keywords: GRAPHICS, OBJECTS, TRAPS, EFFECTS
index 191556d9cbd993837a3670e8354b43396cd5a13d..12604141cb2eecea9bef17e46b5c88fd599a5b5f 100644 (file)
@@ -668,21 +668,25 @@ int
 is_innate(propidx)
 int propidx;
 {
+       if (propidx == BLINDED && !haseyes(youmonst.data)) return 1;
        return innately(&u.uprops[propidx].intrinsic);
 }
 
 char *
 from_what(propidx)
-int propidx;
+int propidx;   /* special cases can have negative values */
 {
-       static char buf[BUFSZ];
+    static char buf[BUFSZ];
 
-       buf[0] = '\0';
-       /*
-        * Restrict the source of the attributes just to debug mode for now
-        */
+    buf[0] = '\0';
+    /*
+     * Restrict the source of the attributes just to debug mode for now
+     */
 #ifdef WIZARD
-       if (wizard) {
+    if (wizard) {
+       static NEARDATA const char because_of[] = " because of %s";
+
+       if (propidx >= 0) {
            struct obj *obj = (struct obj *)0;
            int innate = is_innate(propidx);
 
@@ -691,11 +695,33 @@ int propidx;
            else if (innate == 1)
                Strcpy(buf, " innately");
            else if (wizard && (obj = what_gives(&u.uprops[propidx].extrinsic)))
-               Sprintf(buf, " because of %s",
+               Sprintf(buf, because_of,
                        (obj->oartifact) ? bare_artifactname(obj) : yname(obj));
+           else if (propidx == BLINDED && Blindfolded_only)
+               Sprintf(buf, because_of, yname(ublindf));
+
+       } else {        /* negative property index */
+           /* if more blocking capabilities get implemented we'll need to
+              replace this with what_blocks() comparable to what_gives() */
+           switch (-propidx) {
+           case BLINDED:
+               if (ublindf && ublindf->oartifact == ART_EYES_OF_THE_OVERWORLD)
+                   Sprintf(buf, because_of, bare_artifactname(ublindf));
+               break;
+           case INVIS:
+               if (u.uprops[INVIS].blocked & W_ARMC)
+                   Sprintf(buf, because_of, yname(uarmc)); /* mummy wrapping */
+               break;
+           case CLAIRVOYANT:
+               if (wizard && (u.uprops[CLAIRVOYANT].blocked & W_ARMH))
+                   Sprintf(buf, because_of, yname(uarmh)); /* cornuthaum */
+               break;
+           }
        }
+
+    } /*wizard*/
 #endif
-       return buf;
+    return buf;
 }
 
 void
index 82045b8f5cacf07dee4138ba93f5660446b370bd..4ae0a5a04573d0f2a1b3d030eeaa829e43fa4ee5 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1111,7 +1111,7 @@ int final;        /* 0 => still in progress; 1 => over, survived; 2 => dead */
                if (Hallucination) you_are("hallucinating","");
                if (Stunned) you_are("stunned","");
                if (Confusion) you_are("confused","");
-               if (Blinded) you_are("blinded",from_what(BLINDED));
+               if (Blind) you_are("blind",from_what(BLINDED));
                if (Deaf) you_are("deaf",from_what(DEAF));
                if (Sick) {
                        if (u.usick_type & SICK_VOMITABLE)
@@ -1150,8 +1150,15 @@ int final;       /* 0 => still in progress; 1 => over, survived; 2 => dead */
        if (Hate_silver) you_are("harmed by silver","");
 
        /*** Vision and senses ***/
-       if (See_invisible) enl_msg(You_, "see", "saw", " invisible",
-                                       from_what(SEE_INVIS));
+       if (!Blind && (Blinded || !haseyes(youmonst.data)))
+           you_can("see", from_what(-BLINDED)); /* Eyes of the Overworld */
+       if (See_invisible) {
+           if (!Blind)
+               enl_msg(You_, "see", "saw", " invisible", from_what(SEE_INVIS));
+           else
+               enl_msg(You_, "will see", "would have seen",
+                       " invisible when not blind", from_what(SEE_INVIS));
+       } 
        if (Blind_telepat) you_are("telepathic",from_what(TELEPAT));
        if (Warning) you_are("warned", from_what(WARNING));
        if (Warn_of_mon && context.warntype.obj) {
@@ -1163,8 +1170,8 @@ int final;        /* 0 => still in progress; 1 => over, survived; 2 => dead */
        }
        if (Warn_of_mon && context.warntype.polyd) {
                Sprintf(buf, "aware of the presence of %s",
-                   ((context.warntype.polyd &
-                     (M2_HUMAN|M2_ELF))==(M2_HUMAN|M2_ELF)) ? "humans and elves" :
+                   ((context.warntype.polyd & (M2_HUMAN|M2_ELF))
+                       == (M2_HUMAN|M2_ELF)) ? "humans and elves" :
                    (context.warntype.polyd & M2_HUMAN) ? "humans" :
                    (context.warntype.polyd & M2_ELF) ? "elves" :
                    (context.warntype.polyd & M2_ORC) ? "orcs" :
@@ -1180,9 +1187,17 @@ int final;       /* 0 => still in progress; 1 => over, survived; 2 => dead */
        if (Undead_warning) you_are("warned of undead",from_what(WARN_UNDEAD));
        if (Searching) you_have("automatic searching",from_what(SEARCHING));
        if (Clairvoyant) you_are("clairvoyant",from_what(CLAIRVOYANT));
+       else if ((HClairvoyant || EClairvoyant) && BClairvoyant) {
+           Strcpy(buf, from_what(-CLAIRVOYANT));
+           if (!strncmp(buf, " because of ", 12))
+               /* overwrite substring; strncpy doesn't add terminator */
+               (void) strncpy(buf, " if not for ", 12);
+           enl_msg(You_, "could be", "could have been",
+                   " clairvoyant", buf);
+       }
        if (Infravision) you_have("infravision",from_what(INFRAVISION));
        if (Detect_monsters)
-          you_are("sensing the presence of monsters", "");
+           you_are("sensing the presence of monsters", "");
        if (u.umconf) you_are("going to confuse monsters","");
 
        /*** Appearance and behavior ***/
@@ -1201,7 +1216,7 @@ int final;        /* 0 => still in progress; 1 => over, survived; 2 => dead */
        /* ordinarily "visible" is redundant; this is a special case for
           the situation when invisibility would be an expected attribute */
        else if ((HInvis || EInvis || pm_invisible(youmonst.data)) && BInvis)
-           you_are("visible","");
+           you_are("visible", from_what(-INVIS));
        if (Displaced) you_are("displaced",from_what(DISPLACED));
        if (Stealth) you_are("stealthy",from_what(STEALTH));
        if (Aggravate_monster)