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:
24
src/mhitm.c
24
src/mhitm.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 mhitm.c $NHDT-Date: 1596498178 2020/08/03 23:42:58 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.140 $ */
|
||||
/* NetHack 3.7 mhitm.c $NHDT-Date: 1606473486 2020/11/27 10:38:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.144 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2011. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -335,8 +335,8 @@ register struct monst *magr, *mdef;
|
||||
tmp++;
|
||||
|
||||
/* Set up the visibility of action */
|
||||
g.vis = (cansee(magr->mx, magr->my) && cansee(mdef->mx, mdef->my)
|
||||
&& (canspotmon(magr) || canspotmon(mdef)));
|
||||
g.vis = ((cansee(magr->mx, magr->my) && canspotmon(magr))
|
||||
|| (cansee(mdef->mx, mdef->my) && canspotmon(mdef)));
|
||||
|
||||
/* Set flag indicating monster has moved this turn. Necessary since a
|
||||
* monster might get an attack out of sequence (i.e. before its move) in
|
||||
@@ -369,7 +369,7 @@ register struct monst *magr, *mdef;
|
||||
/* D: Do a ranged attack here! */
|
||||
strike = thrwmm(magr, mdef);
|
||||
if (strike)
|
||||
/* We don't really know if we hit or not; pretend we did. */
|
||||
/* don't really know if we hit or not; pretend we did */
|
||||
res[i] |= MM_HIT;
|
||||
if (DEADMONSTER(mdef))
|
||||
res[i] = MM_DEF_DIED;
|
||||
@@ -1024,11 +1024,9 @@ int dieroll;
|
||||
if (completelyburns(pd)) { /* paper golem or straw golem */
|
||||
if (g.vis && canseemon(mdef))
|
||||
pline("%s burns completely!", Monnam(mdef));
|
||||
mondead(mdef); /* was mondied() but that dropped paper scrolls */
|
||||
monkilled(mdef, (char *) 0, AD_FIRE);
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !g.vis)
|
||||
pline("May %s roast in peace.", mon_nam(mdef));
|
||||
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
}
|
||||
tmp += destroy_mitem(mdef, SCROLL_CLASS, AD_FIRE);
|
||||
@@ -1100,14 +1098,12 @@ int dieroll;
|
||||
case AD_RUST:
|
||||
if (magr->mcan)
|
||||
break;
|
||||
if (pd == &mons[PM_IRON_GOLEM]) {
|
||||
if (completelyrusts(pd)) { /* PM_IRON_GOLEM */
|
||||
if (g.vis && canseemon(mdef))
|
||||
pline("%s falls to pieces!", Monnam(mdef));
|
||||
mondied(mdef);
|
||||
monkilled(mdef, (char *) 0, AD_RUST);
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !g.vis)
|
||||
pline("May %s rust in peace.", mon_nam(mdef));
|
||||
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
}
|
||||
erode_armor(mdef, ERODE_RUST);
|
||||
@@ -1124,14 +1120,12 @@ int dieroll;
|
||||
case AD_DCAY:
|
||||
if (magr->mcan)
|
||||
break;
|
||||
if (pd == &mons[PM_WOOD_GOLEM] || pd == &mons[PM_LEATHER_GOLEM]) {
|
||||
if (completelyrots(pd)) { /* PM_WOOD_GOLEM || PM_LEATHER_GOLEM */
|
||||
if (g.vis && canseemon(mdef))
|
||||
pline("%s falls to pieces!", Monnam(mdef));
|
||||
mondied(mdef);
|
||||
monkilled(mdef, (char *) 0, AD_DCAY);
|
||||
if (!DEADMONSTER(mdef))
|
||||
return 0;
|
||||
else if (mdef->mtame && !g.vis)
|
||||
pline("May %s rot in peace.", mon_nam(mdef));
|
||||
return (MM_DEF_DIED | (grow_up(magr, mdef) ? 0 : MM_AGR_DIED));
|
||||
}
|
||||
erode_armor(mdef, ERODE_CORRODE);
|
||||
|
||||
Reference in New Issue
Block a user