corpse revival and statue animation (trunk only)

Try to address the problem From a bug report:  turning the Wizard
of Yendor to stone preserves monster information with his statue and
presence of that information overrides the statue animation check
intended to prevent players from creating the Wizard (or other unique
monsters).  That's ok for the current game--the monster had to have been
in play in order to be turned to stone--but is a problem if the statue
is found in a bones file.  The report was for placing such a statue at
the location of an untriggered statue trap by a player who leaves bones,
but stone-to-flesh by the player who loads bones is a simpler way to
trigger this.  (Aside from getting unique monsters earlier than usual
under some degree of player control they won't have their starting
inventory so special items like the Candelabrum might not get created.)
Using undead turning to revive corpses found in bones was another way to
get into the same trouble (I thought corpses of special monsters were
already excluded from bones?).

     It looks like it's also possible to get strange quest behavior if
a corpse or statue of the leader or nemesis is brought into the dungeon,
left in bones, then revived by the second player, but I didn't attempt
to reproduce it.  More work is probably needed; this tightens up leader
handling a bit but doesn't do anything about the nemesis.  This patch
has already been spreading tentacles and I've got to cut it off....

     The patch discards saved monster traits for corpses and statues of
unique monsters while saving bones; reviving or reanimating them will
produce doppelgangers instead of the original monsters, same as stone-to-
flesh on wished-for statues behaves.  It also discards saved traits for
shopkeepers (also temple priests and vault guards--their traits weren't
saved in 3.4.2 though).  That info might be useable when the corpse or
statue is on the same level as the monster started (ie, where its special
room is located), but that's a complication I'm going to bypass.  This
patch also adds chameleon handling for statue activation--it wouldn't
have mattered in 3.4.2 since shapechangers didn't get their traits saved;
it does matter now but was omitted when trait-saving was extended to all
statues a while back.  (It adds chameleon handling to corpse revival too,
but they still don't get their traits saved with corpses so that's just
protection in case of future modifications.)

     Other bits:  `cant_create()' is renamed to `cant_revive()' since
the latter is a more signicant use than wizard mode <ctrl/G> handling.
Now save traits with nymph corses so that cancellation can be propagated
if they're revived; that doesn't matter much but matches statue handling
(where it was more important since it dealt with succubi as well as with
nymphs).  Explicitly initialize the shape-changer field of all monsters
instead of relying on implicit initialization to 0 (CHAM_ORDINARY).

     There'll be a *much* shorter patch for 3.4.3 which will have to get
by with most of these obscure problems--fortunately they're unlikely to
impact many (any?) players.
This commit is contained in:
nethack.rankin
2003-11-30 21:19:01 +00:00
parent d6bf777e63
commit fbfb8e92ab
8 changed files with 170 additions and 83 deletions

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)bones.c 3.4 2003/09/06 */
/* SCCS Id: @(#)bones.c 3.4 2003/11/29 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */
@@ -64,17 +64,21 @@ boolean restore;
if (otmp->cobj)
resetobjs(otmp->cobj,restore);
if (((otmp->otyp != CORPSE || otmp->corpsenm < SPECIAL_PM)
&& otmp->otyp != STATUE)
&& (!otmp->oartifact ||
(restore && (exist_artifact(otmp->otyp, ONAME(otmp))
|| is_quest_artifact(otmp))))) {
otmp->oartifact = 0;
otmp->onamelth = 0;
*ONAME(otmp) = '\0';
} else if (otmp->oartifact && restore)
artifact_exists(otmp,ONAME(otmp),TRUE);
if (!restore) {
if (restore) {
/* artifact bookeeping needs to be done during
restore; other fixups are done while saving */
if (otmp->oartifact) {
if (exist_artifact(otmp->otyp, ONAME(otmp)) ||
is_quest_artifact(otmp)) {
/* prevent duplicate--revert to ordinary obj */
otmp->oartifact = 0;
otmp->onamelth = 0;
*ONAME(otmp) = '\0';
} else {
artifact_exists(otmp, ONAME(otmp), TRUE);
}
}
} else { /* saving */
/* do not zero out o_ids for ghost levels anymore */
if(objects[otmp->otyp].oc_uses_known) otmp->known = 0;
@@ -83,6 +87,23 @@ boolean restore;
otmp->invlet = 0;
otmp->no_charge = 0;
/* strip user-supplied names */
/* Statue and some corpse names are left intact,
presumeably in case they came from score file.
[TODO: this ought to be done differently--names
which came from such a source or came from any
stoned or killed monster should be flagged in
some manner; then we could just check the flag
here and keep "real" names (dead pets, &c) while
discarding player notes attached to statues.] */
if (otmp->onamelth &&
!(otmp->oartifact || otmp->otyp == STATUE ||
(otmp->otyp == CORPSE &&
otmp->corpsenm >= SPECIAL_PM))) {
otmp->onamelth = 0;
*ONAME(otmp) = '\0';
}
if (otmp->otyp == SLIME_MOLD) goodfruit(otmp->spe);
#ifdef MAIL
else if (otmp->otyp == SCR_MAIL) otmp->spe = 1;
@@ -91,8 +112,21 @@ boolean restore;
else if (otmp->otyp == TIN) {
/* make tins of unique monster's meat be empty */
if (otmp->corpsenm >= LOW_PM &&
(mons[otmp->corpsenm].geno & G_UNIQ))
unique_corpstat(&mons[otmp->corpsenm]))
otmp->corpsenm = NON_PM;
} else if (otmp->otyp == CORPSE ||
otmp->otyp == STATUE) {
int mnum = otmp->corpsenm;
/* Discard incarnation details of unique
monsters (by passing null instead of otmp
for object), shopkeepers (by passing false
for revival flag), temple priests, and
vault guards in order to prevent corpse
revival or statue reanimation. */
if (otmp->oattached == OATTACHED_MONST &&
cant_revive(&mnum, FALSE, (struct obj *)0))
otmp->oattached = OATTACHED_NOTHING;
} else if (otmp->otyp == AMULET_OF_YENDOR) {
/* no longer the real Amulet */
otmp->otyp = FAKE_AMULET_OF_YENDOR;