]> granicus.if.org Git - nethack/commitdiff
wishing bit (trunk only)
authornethack.rankin <nethack.rankin>
Sat, 19 Nov 2005 04:38:42 +0000 (04:38 +0000)
committernethack.rankin <nethack.rankin>
Sat, 19 Nov 2005 04:38:42 +0000 (04:38 +0000)
     The code let you wish for trapped containers in wizard mode and tried
not to let you do so in normal mode.  But it handled the trapped attribute
by overloading the poisoned one, so wishing for a "poisoned chest" would
produce a trapped chest in any mode.  This fixes that by removing the
overloading.  You can wish for a trapped box/chest (or tin) in wizard mode
and you can now also explicitly wish for an untrapped one in any mode.
Asking for trapped in normal mode--most likely hoping to seed a dangerous
bones file--just negates any preceding "untrapped" handled earlier within
the same wish, and specifying "poisoned" for a container no longer has any
effect.

doc/fixes35.0
src/objnam.c

index b7ba20fd6a543c780751d6b517b8a91040a53e8b..ff389d2139e21384d905159120c1dfa194c8119c 100644 (file)
@@ -99,6 +99,7 @@ assigning an artifact name is rejected on objects with similar description to
        corresponding artifact's type rather than just those of the same type
 adjust feedback for gas spore explosion when hallucinating
 traps detected by scroll or crystal ball overlooked carried or buried chests
+can't wish for a trapped box/chest/tin by specifying "poisoned"
 
 
 Platform- and/or Interface-Specific Fixes
index f0e4d047b4ffdcc9b75983135a622259c5009f7e..e7175b1df1315f8f8123283f4ba91af70baa7d1a 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)objnam.c   3.5     2005/10/21      */
+/*     SCCS Id: @(#)objnam.c   3.5     2005/11/18      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1835,7 +1835,7 @@ struct obj *no_wish;
        int isinvisible;
 #endif
        int halfeaten, mntmp, contents;
-       int islit, unlabeled, ishistoric, isdiluted;
+       int islit, unlabeled, ishistoric, isdiluted, trapped;
        int tmp, tinv, tvariety;
        struct fruit *f;
        int ftype = current_fruit;
@@ -1865,7 +1865,8 @@ struct obj *no_wish;
                isinvisible =
 #endif
                ispoisoned = isgreased = eroded = eroded2 = erodeproof =
-               halfeaten = islit = unlabeled = ishistoric = isdiluted = 0;
+               halfeaten = islit = unlabeled = ishistoric = isdiluted =
+               trapped = 0;
        tvariety = RANDOM_TIN;
        mntmp = NON_PM;
 #define UNDEFINED 0
@@ -1935,12 +1936,16 @@ struct obj *no_wish;
                           !strncmpi(bp,"unlabelled ", l=11) ||
                           !strncmpi(bp,"blank ", l=6)) {
                        unlabeled = 1;
-               } else if(!strncmpi(bp, "poisoned ",l=9)
+               } else if(!strncmpi(bp, "poisoned ",l=9)) {
+                       ispoisoned=1;
+               /* "trapped" recognized but not honored outside wizard mode */
+               } else if(!strncmpi(bp, "trapped ",l=8)) {
+                       trapped = 0;    /* undo any previous "untrapped" */
 #ifdef WIZARD
-                         || (wizard && !strncmpi(bp, "trapped ",l=8))
+                       if (wizard) trapped = 1;
 #endif
-                         ) {
-                       ispoisoned=1;
+               } else if(!strncmpi(bp, "untrapped ",l=10)) {
+                       trapped = 2;    /* not trapped */
                } else if(!strncmpi(bp, "greased ",l=8)) {
                        isgreased=1;
                } else if (!strncmpi(bp, "very ", l=5)) {
@@ -2774,12 +2779,15 @@ typfnd:
        if (ispoisoned) {
            if (is_poisonable(otmp))
                otmp->opoisoned = (Luck >= 0);
-           else if (Is_box(otmp) || typ == TIN)
-               otmp->otrapped = 1;
            else if (oclass == FOOD_CLASS)
                /* try to taint by making it as old as possible */
                otmp->age = 1L;
        }
+       /* and [un]trapped */
+       if (trapped) {
+           if (Is_box(otmp) || typ == TIN)
+               otmp->otrapped = (trapped == 1);
+       }
 
        if (isgreased) otmp->greased = 1;