more random novels

Give statues 'real' spellbooks only.

Provide mkobj() a way to accomplish that instead of resorting to
mksobj(rnd_class()).
This commit is contained in:
PatR
2020-01-12 22:02:36 -08:00
parent caaf1b375a
commit 3409546876
5 changed files with 25 additions and 24 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkobj.c $NHDT-Date: 1578855620 2020/01/12 19:00:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.173 $ */
/* NetHack 3.6 mkobj.c $NHDT-Date: 1578895344 2020/01/13 06:02:24 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.174 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -245,7 +245,7 @@ boolean init, artif;
result is always non-Null */
struct obj *
mkobj(oclass, artif)
char oclass;
int oclass;
boolean artif;
{
int tprob, i, prob = rnd(1000);
@@ -257,13 +257,18 @@ boolean artif;
: (const struct icp *) mkobjprobs;
for (tprob = rnd(100); (tprob -= iprobs->iprob) > 0; iprobs++)
;
continue;
oclass = iprobs->iclass;
}
i = g.bases[(int) oclass];
while ((prob -= objects[i].oc_prob) > 0)
i++;
if (oclass == SPBOOK_no_NOVEL) {
i = rnd_class(g.bases[SPBOOK_CLASS], SPE_BLANK_PAPER);
oclass = SPBOOK_CLASS; /* for sanity check below */
} else {
i = g.bases[oclass];
while ((prob -= objects[i].oc_prob) > 0)
++i;
}
if (objects[i].oc_class != oclass || !OBJ_NAME(objects[i]))
panic("probtype error, oclass=%d i=%d", (int) oclass, i);
@@ -1054,10 +1059,10 @@ boolean artif;
case STATUE:
/* possibly overridden by mkcorpstat() */
otmp->corpsenm = rndmonnum();
/* note: might produce a novel rather than a spellbook */
if (!verysmall(&mons[otmp->corpsenm])
&& rn2(level_difficulty() / 2 + 10) > 10)
(void) add_to_container(otmp, mkobj(SPBOOK_CLASS, FALSE));
(void) add_to_container(otmp,
mkobj(SPBOOK_no_NOVEL, FALSE));
}
break;
case COIN_CLASS: