diff --git a/doc/fixes37.0 b/doc/fixes37.0 index 9f1b11c21..296007d4f 100644 --- a/doc/fixes37.0 +++ b/doc/fixes37.0 @@ -1,4 +1,4 @@ -$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.54 $ $NHDT-Date: 1578297243 2020/01/06 07:54:03 $ +$NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.55 $ $NHDT-Date: 1578394755 2020/01/07 10:59:15 $ General Fixes and Modified Features ----------------------------------- @@ -32,6 +32,9 @@ drum of earthquake feedback reported various things (fountains, thrones, &c) falling into a chasm but they remained intact because trap creation had been changed to not clobber such things (so couldn't make pits) make earthquake which hits a secret door or a secret corridor reveal it +wizard mode wishing for "Amulet of Yendor" has 50:50 chance for true Amulet + or a cheap plastic imitation; recognize "real Amulet of Yendor" and + "fake Amulet of Yendor" to precisely specify either of them Fixes to 3.7.0-x Problems that Were Exposed Via git Repository diff --git a/src/objnam.c b/src/objnam.c index df23fb57d..05a8958ad 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 objnam.c $NHDT-Date: 1578258724 2020/01/05 21:12:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.280 $ */ +/* NetHack 3.7 objnam.c $NHDT-Date: 1578394756 2020/01/07 10:59:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.281 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2011. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2962,7 +2962,7 @@ struct obj *no_wish; register struct obj *otmp; int cnt, spe, spesgn, typ, very, rechrg; int blessed, uncursed, iscursed, ispoisoned, isgreased; - int eroded, eroded2, erodeproof, locked, unlocked, broken; + int eroded, eroded2, erodeproof, locked, unlocked, broken, real, fake; int halfeaten, mntmp, contents; int islit, unlabeled, ishistoric, isdiluted, trapped; int tmp, tinv, tvariety; @@ -2970,7 +2970,7 @@ struct obj *no_wish; struct fruit *f; int ftype = g.context.current_fruit; char fruitbuf[BUFSZ], globbuf[BUFSZ]; - /* Fruits may not mess up the ability to wish for real objects (since + /* Fruits must not mess up the ability to wish for real objects (since * you can leave a fruit in a bones file and it will be added to * another person's game), so they must be checked for last, after * stripping all the possible prefixes and seeing if there's a real @@ -2992,7 +2992,7 @@ struct obj *no_wish; very = rechrg = blessed = uncursed = iscursed = ispoisoned = isgreased = eroded = eroded2 = erodeproof = halfeaten = islit = unlabeled = ishistoric = isdiluted = trapped = - locked = unlocked = broken = 0; + locked = unlocked = broken = real = fake = 0; tvariety = RANDOM_TIN; mntmp = NON_PM; #define UNDEFINED 0 @@ -3135,6 +3135,15 @@ struct obj *no_wish; break; /* "very large " had "very " peeled off on previous iteration */ gsize = (very != 1) ? 3 : 4; + } else if (!strncmpi(bp, "real ", l = 5)) { + /* accept "real Amulet of Yendor" with "blessed" or "cursed" + or useless "erodeproof" before or after "real" ... */ + real = 1; /* don't negate 'fake' here; "real fake amulet" and + * "fake real amulet" will both yield fake amulet + * (so will "real amulet" outside of wizard mode) */ + } else if (!strncmpi(bp, "fake ", l = 5)) { + /* ... and "fake Amulet of Yendor" likewise */ + fake = 1; /* doesn't matter whether 'real' is negated here */ } else break; bp += l; @@ -3231,6 +3240,33 @@ struct obj *no_wish; *p = 0; contents = SPINACH; } + /* this is only useful for wizard mode but we'll accept its parsing + in normal play (result is never the real Amulet for that case) */ + if ((p = strstri(bp, OBJ_DESCR(objects[AMULET_OF_YENDOR]))) != 0 + && (p == bp || p[-1] == ' ')) { + char *s = bp; + + /* "Amulet of Yendor" matches two items; disambiguate via "real" + or "fake" prefix (parsed above so that both "blessed real" + and "real blessed" work); also accept partial specification of + the full name of the fake; unlike the prefix recognition loop + above, these have to be in the right order when more than one + is present (similar to glass gems below) */ + if (!strncmpi(s, "cheap ", 6)) + fake = 1, s += 6; + if (!strncmpi(s, "plastic ", 8)) + fake = 1, s += 8; + if (!strncmpi(s, "imitation ", 10)) + fake = 1, s += 10; + nhUse(s); /* suppress potential assigned-but-not-used complaint */ + /* '(!real && !fake)' is the default, so 50:50 chance for either */ + if (real && fake) + real = 0; + else if (!real && !fake && !rn2(2)) + real = 1; + typ = real ? AMULET_OF_YENDOR : FAKE_AMULET_OF_YENDOR; + goto typfnd; + } /* * Skip over "pair of ", "pairs of", "set of" and "sets of".