fix github issue #401 - roast/rust/rot in peace
This tries to fix the problem of the extra message when a tame golem is completely destroyed (paper or straw golem burned, iron golem rusted, wood or leather golem rotted) being issued at odd times. I basically punted on the visibility aspect since the original logic was strange: you had to be able to see both the attacker's and defender's spots and at least one of those two monsters. Now mon-attacks-mon visibility requires that you be able to see one of the two and if you don't see both, the unseen one will be referred to as "it". The "may the iron golem rust in peace" message is independent of that and may be displayed after "you have a sad feeling", but now that's intentional and will refer to an unseen pet by name or monster type, not "it". This needs a lot of testing and hasn't attempted to address issue #402: only some attacks that should compeletely destroy a golem actually do so. (So a hit by fire elemental against a paper golem does, but passive fire counterattack when a paper golem hits a fire elemental doesn't, nor does a wand of fire or being hit by Firebrand.) Fixes #401
This commit is contained in:
35
src/mon.c
35
src/mon.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 mon.c $NHDT-Date: 1604880454 2020/11/09 00:07:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.351 $ */
|
||||
/* NetHack 3.7 mon.c $NHDT-Date: 1606473489 2020/11/27 10:38:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.354 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2582,20 +2582,39 @@ struct monst *mdef;
|
||||
const char *fltxt;
|
||||
int how;
|
||||
{
|
||||
if ((mdef->wormno ? worm_known(mdef) : cansee(mdef->mx, mdef->my))
|
||||
&& fltxt)
|
||||
struct permonst *mptr = mdef->data;
|
||||
|
||||
if (fltxt && (mdef->wormno ? worm_known(mdef)
|
||||
: cansee(mdef->mx, mdef->my)))
|
||||
pline("%s is %s%s%s!", Monnam(mdef),
|
||||
nonliving(mdef->data) ? "destroyed" : "killed",
|
||||
nonliving(mptr) ? "destroyed" : "killed",
|
||||
*fltxt ? " by the " : "", fltxt);
|
||||
else
|
||||
/* sad feeling is deferred until after potential life-saving */
|
||||
iflags.sad_feeling = (mdef->mtame != 0);
|
||||
|
||||
/* no corpses if digested or disintegrated */
|
||||
g.disintegested = (how == AD_DGST || how == -AD_RBRE);
|
||||
/* no corpse if digested or disintegrated or flammable golem burnt up;
|
||||
no corpse for a paper golem means no scrolls; golems that rust or
|
||||
rot completely are described as "falling to pieces" so they do
|
||||
leave a corpse (which means staves for wood golem, leather armor for
|
||||
leather golem, iron chains for iron golem, not a regular corpse) */
|
||||
g.disintegested = (how == AD_DGST || how == -AD_RBRE
|
||||
|| (how == AD_FIRE && completelyburns(mptr)));
|
||||
if (g.disintegested)
|
||||
mondead(mdef);
|
||||
mondead(mdef); /* never leaves a corpse */
|
||||
else
|
||||
mondied(mdef);
|
||||
mondied(mdef); /* calls mondead() and maybe leaves a corpse */
|
||||
|
||||
/* extra message if pet golem is completely destroyed;
|
||||
if not visible, this will follow "you have a sad feeling" */
|
||||
if (mdef->mtame) {
|
||||
const char *rxt = (how == AD_FIRE && completelyburns(mptr)) ? "roast"
|
||||
: (how == AD_RUST && completelyrusts(mptr)) ? "rust"
|
||||
: (how == AD_DCAY && completelyrots(mptr)) ? "rot"
|
||||
: 0;
|
||||
if (rxt)
|
||||
pline("May %s %s in peace.", noit_mon_nam(mdef), rxt);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user