wishing for novels

Make novels be wishable in normal and explore modes in addition to
wizard mode.  I don't think this weakens the tribute and it prevents
someone who attempts such a wish from getting misleading feedback of
"Nothing fitting that description exists in the game."

Wishing for "novel" will yield "novel named Foo" where "Foo" is a
randomly chosen Discworld title.  Wishing for "novel named Bar" will
yield "novel named Bar" or "novel named The Bar" if "Bar" or "The Bar"
is a valid Discworld title, or else override "Bar" and pick random
Discworld "novel named Foo" if it isn't.

Since first read of a novel bestows some experience (once per game, no
matter how many novels become available), a pacifist with an early
wish can get a head start.  I don't think that's a big deal.  And it
will require an awful lot of wishes for any player who wants to acquire
all 41 titles in one game.  I imagine someone will manage it.
This commit is contained in:
PatR
2015-10-11 19:39:23 -07:00
parent 1e8f4ee0b1
commit b2aea3e9d7
4 changed files with 31 additions and 42 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_name.c $NHDT-Date: 1432937666 2015/05/29 22:14:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.74 $ */
/* NetHack 3.6 do_name.c $NHDT-Date: 1444617209 2015/10/12 02:33:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1299,13 +1299,13 @@ const char *
noveltitle(novidx)
int *novidx;
{
int j, k = SIZE(sir_Terry_novels) - 1;
int j, k = SIZE(sir_Terry_novels);
j = rn2(k);
if (novidx) {
if (*novidx == -1)
*novidx = j;
else if ((*novidx >= 0) && (*novidx <= k))
else if (*novidx >= 0 && *novidx < k)
j = *novidx;
}
return sir_Terry_novels[j];
@@ -1319,16 +1319,20 @@ int *idx;
int k;
/* Take American or U.K. spelling of this one */
if (strcmpi(lookname, "The Color of Magic") == 0)
if (!strcmpi(The(lookname), "The Color of Magic"))
lookname = sir_Terry_novels[0];
for (k = 0; k < SIZE(sir_Terry_novels); ++k) {
if (strcmpi(lookname, sir_Terry_novels[k]) == 0) {
if (!strcmpi(lookname, sir_Terry_novels[k])
|| !strcmpi(The(lookname), sir_Terry_novels[k])) {
if (idx)
*idx = k;
return sir_Terry_novels[k];
}
}
/* name not found; if novelidx is already set, override the name */
if (idx && *idx >= 0 && *idx < SIZE(sir_Terry_novels))
return sir_Terry_novels[*idx];
return (const char *) 0;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1444094263 2015/10/06 01:17:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.105 $ */
/* NetHack 3.6 mkobj.c $NHDT-Date: 1444617220 2015/10/12 02:33:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.110 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -939,11 +939,10 @@ boolean artif;
/* case TIN: */
set_corpsenm(otmp, otmp->corpsenm);
break;
case SPE_NOVEL: {
int novidx = -1;
otmp = oname(otmp, noveltitle(&novidx));
otmp->novelidx = novidx;
} break;
case SPE_NOVEL:
otmp->novelidx = -1; /* "none of the above"; will be changed */
otmp = oname(otmp, noveltitle(&otmp->novelidx));
break;
}
/* unique objects may have an associated artifact entry */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objects.c $NHDT-Date: 1436052459 2015/07/04 23:27:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.43 $ */
/* NetHack 3.6 objects.c $NHDT-Date: 1444617222 2015/10/12 02:33:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.46 $ */
/* Copyright (c) Mike Threepoint, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -977,7 +977,7 @@ SPELL("freeze sphere", "hardcover",
SPELL("blank paper", "plain", P_NONE, 18, 0, 0, 0, 0, HI_PAPER),
/* tribute book for 3.6 */
OBJECT(OBJ("novel", "paperback"),
BITS(0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, P_NONE, HI_PAPER),
BITS(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, HI_PAPER),
0, SPBOOK_CLASS, 0, 0, 0, 20, 0, 0, 0, 1, 20, CLR_BRIGHT_BLUE),
/* a special, one of a kind, spellbook */
OBJECT(OBJ("Book of the Dead", "papyrus"),

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 objnam.c $NHDT-Date: 1433058272 2015/05/31 07:44:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.141 $ */
/* NetHack 3.6 objnam.c $NHDT-Date: 1444617222 2015/10/12 02:33:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.143 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -2568,12 +2568,10 @@ struct obj *no_wish;
}
}
/*
otmp->spe is type schar; so we don't want spe to be any bigger or
smaller.
also, spe should always be positive -- some cheaters may try to
confuse
atoi()
*/
* otmp->spe is type schar, so we don't want spe to be any bigger or
* smaller. Also, spe should always be positive --some cheaters may
* try to confuse atoi().
*/
if (spe < 0) {
spesgn = -1; /* cheaters get what they deserve */
spe = abs(spe);
@@ -2584,14 +2582,14 @@ struct obj *no_wish;
rechrg = 7; /* recharge_limit */
/* now we have the actual name, as delivered by xname, say
green potions called whisky
scrolls labeled "QWERTY"
egg
fortune cookies
very heavy iron ball named hoei
wand of wishing
elven cloak
*/
* green potions called whisky
* scrolls labeled "QWERTY"
* egg
* fortune cookies
* very heavy iron ball named hoei
* wand of wishing
* elven cloak
*/
if ((p = strstri(bp, " named ")) != 0) {
*p = 0;
name = p + 7;
@@ -3216,15 +3214,6 @@ typfnd:
}
}
if (typ && wizard) {
if (typ == SPE_NOVEL) {
if (name && !lookup_novel(name, (int *) 0)) {
pline("There's no novel by that name.");
return ((struct obj *) 0);
}
}
}
/*
* Create the object, then fine-tune it.
*/
@@ -3433,14 +3422,11 @@ typfnd:
/* 3.6.0 tribute - fix up novel */
if (otmp->otyp == SPE_NOVEL) {
int novidx = 0;
const char *novelname;
novelname = lookup_novel(name, &novidx);
if (novelname) {
otmp->novelidx = novidx;
novelname = lookup_novel(name, &otmp->novelidx);
if (novelname)
name = novelname;
}
}
otmp = oname(otmp, name);