From 2fa9bd03014830ee2cc046d90b7be9ec8679a463 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Fri, 10 Nov 2006 05:13:57 +0000 Subject: [PATCH] petrification fixes Eliminate the somewhat redundant "You die..." following "You turned to stone..." when becoming petrified by touching a cockatrice (reported by for kicking, but occurs for weaponless hitting too). Also, if a cockatrice killed you with normal damage, your tombstone would erroneously report petrification and presumeably there'd be a statue instead of a ghost in the resulting bones file. This fixes both things. --- doc/fixes34.4 | 1 + include/extern.h | 2 +- src/end.c | 13 ++++++------- src/mcastu.c | 2 +- src/mhitu.c | 7 +++---- src/uhitm.c | 3 +-- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 8486a92d2..d7ba2e465 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -270,6 +270,7 @@ hero can't carry an unlimited number of boulders when poly'd into a giant prevent very large number of objects in # inventory slot from causing buffer overflow !fixinv config was using arbitrary characters instead of # for invent overflow +don't report death by petrification if cockatrice kills hero via HP loss Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 96a043505..7e47c8e5d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -609,7 +609,7 @@ E int NDECL(done2); #ifdef USE_TRAMPOLI E void FDECL(done_intr, (int)); #endif -E void FDECL(done_in_by, (struct monst *)); +E void FDECL(done_in_by, (struct monst *,int)); #endif /* !MAKEDEFS_C && !LEV_LEX_C */ E void VDECL(panic, (const char *,...)) PRINTF_F(1,2); #if !defined(MAKEDEFS_C) && !defined(LEV_LEX_C) diff --git a/src/end.c b/src/end.c index 382a0eb1d..842f80880 100644 --- a/src/end.c +++ b/src/end.c @@ -186,13 +186,14 @@ int sig; #endif /* NO_SIGNAL */ void -done_in_by(mtmp) -register struct monst *mtmp; +done_in_by(mtmp, how) +struct monst *mtmp; +int how; { char buf[BUFSZ]; boolean distorted = (boolean)(Hallucination && canspotmon(mtmp)); - You("die..."); + You((how == STONING) ? "turn to stone..." : "die..."); mark_synch(); /* flush buffered screen output */ buf[0] = '\0'; killer.format = KILLED_BY_AN; @@ -246,10 +247,8 @@ register struct monst *mtmp; if (u.ugrave_arise >= LOW_PM && (mvitals[u.ugrave_arise].mvflags & G_GENOD)) u.ugrave_arise = NON_PM; - if (touch_petrifies(mtmp->data)) - done(STONING); - else - done(DIED); + + done(how); return; } diff --git a/src/mcastu.c b/src/mcastu.c index ddcbf72c2..022c76977 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -403,7 +403,7 @@ int spellnum; if (Half_spell_damage) dmg = (dmg + 1) / 2; losestr(rnd(dmg)); if (u.uhp < 1) - done_in_by(mtmp); + done_in_by(mtmp, DIED); } dmg = 0; break; diff --git a/src/mhitu.c b/src/mhitu.c index ba943f75d..98e797ee0 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1169,8 +1169,7 @@ dopois: } make_stoned(5L, (char *)0, kformat, kname); return(1); - /* You("turn to stone..."); */ - /* done_in_by(mtmp); */ + /* done_in_by(mtmp, STONING); */ } } } @@ -1518,7 +1517,7 @@ dopois: default: dmg = 0; break; } - if(u.uhp < 1) done_in_by(mtmp); + if (u.uhp < 1) done_in_by(mtmp, DIED); /* Negative armor class reduces damage done instead of fully protecting * against hits. @@ -2059,7 +2058,7 @@ register int n; if (u.mh < 1) rehumanize(); } else { u.uhp -= n; - if(u.uhp < 1) done_in_by(mtmp); + if (u.uhp < 1) done_in_by(mtmp, DIED); } } diff --git a/src/uhitm.c b/src/uhitm.c index f88327c08..21f845a26 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -2239,8 +2239,7 @@ boolean wep_was_destroyed; if (!Stone_resistance && !(poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))) { - You("turn to stone..."); - done_in_by(mon); + done_in_by(mon, STONING); /* "You turn to stone..." */ return 2; } }