From 78d9a4186a07d96161252dc72642169350c04515 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 17 May 2007 06:30:18 +0000 Subject: [PATCH] defunct tame engulfer From the newsgroup: Conflict caused tame engulfer to swallow hero. To try to get out, player hit it (with Magicbane, but that's not relevant other than to provide an alternate "you hit it" message). The magic-absorbing blade probes the invisible Audrey! You get regurgitated! placing defunct monster onto map? Program in disorder, &c [some look_here() feedback] You kill poor invisible Audrey! The problem was caused by hmon_hitmon(): it subtracted damage from the target's hit points, did some bookkeeping and message delivery, then called killed(). One bit of bookkeeping was to call abuse_pet() and monflee() when the target is tame, regardless of whether the damage was fatal. monflee() -> release_hero() -> expels() puts the hero and the engulfer back onto the map, and that warning was triggered because the former engulfer had no hit points left. --- doc/fixes34.4 | 2 ++ src/monmove.c | 5 ++++- src/uhitm.c | 10 +++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 9e4ba11b1..3743f7914 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -352,6 +352,8 @@ if magically removing steed's saddle is fatal, don't leave it saddled in bones charging prompt used wrong criteria when deciding whether to list rings an orc (or gnome) will respond to #chat if hero is also an orc (or gnome) kicking at "empty space" has side-effects so should use current turn +using weapon to kill tame engulfer from inside triggered "placing defunct + monster onto map?" warning Platform- and/or Interface-Specific Fixes diff --git a/src/monmove.c b/src/monmove.c index d2c4a5c4a..7d4b98227 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)monmove.c 3.5 2006/12/13 */ +/* SCCS Id: @(#)monmove.c 3.5 2007/05/16 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -228,6 +228,9 @@ int fleetime; boolean first; boolean fleemsg; { + /* shouldn't happen; maybe warrants impossible()? */ + if (DEADMONSTER(mtmp)) return; + if (mtmp == u.ustuck) release_hero(mtmp); /* expels/unstuck */ if (!first || !mtmp->mflee) { diff --git a/src/uhitm.c b/src/uhitm.c index 62b1371fa..72823bad8 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)uhitm.c 3.5 2007/04/13 */ +/* SCCS Id: @(#)uhitm.c 3.5 2007/05/16 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1031,8 +1031,12 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ if (mon->mhp > mon->mhpmax) mon->mhp = mon->mhpmax; if (mon->mhp < 1) destroyed = TRUE; - if (mon->mtame && (!mon->mflee || mon->mfleetim) && tmp > 0) { - abuse_dog(mon); + if (mon->mtame && tmp > 0) { + /* do this even if the pet is being killed (affects revival) */ + abuse_dog(mon); /* reduces tameness */ + /* flee if still alive and still tame; if already suffering from + untimed fleeing, no effect, otherwise increases timed fleeing */ + if (mon->mtame && !destroyed) monflee(mon, 10 * rnd(tmp), FALSE, FALSE); } if ((mdat == &mons[PM_BLACK_PUDDING] ||