From faa3543063276624844d0fac3005e62710e92a8b Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 17 Dec 2007 23:43:31 +0000 Subject: [PATCH] long worm tail hit by potion thrown by monster (trunk only) From the newsgroup: when a monster throws a potion at the hero and it hits a long worm's tail, you'd get "The bottle|flask|&c crashes on the long worm's _head_ and breaks into shards." The relevant code changes "head" to "body" when appropriate, but monster throwing wasn't setting up `notonhead' so that alteration only kicked in for player throwing. --- doc/fixes35.0 | 2 ++ src/dothrow.c | 1 + src/mthrowu.c | 8 ++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index a4f27b072..c385d5aa7 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -273,6 +273,8 @@ always update map display and use up turn if open or close command attempted while blind reveals change in door state or discloses non-door spot secret door detection's trap finding is no longer blocked by water or clouds on the Planes of Water and Air +potion thrown by monster which hit a long worm's tail gave feedback about + hitting its head Platform- and/or Interface-Specific Fixes diff --git a/src/dothrow.c b/src/dothrow.c index ef6fc7982..22936809e 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -929,6 +929,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */ impaired = (Confusion || Stunned || Blind || Hallucination || Fumbling); + notonhead = FALSE; /* reset potentially stale value */ if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) { boolean slipok = TRUE; if (ammo_and_launcher(obj, uwep)) diff --git a/src/mthrowu.c b/src/mthrowu.c index 943501d04..00e9b2d06 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mthrowu.c 3.5 2007/06/07 */ +/* SCCS Id: @(#)mthrowu.c 3.5 2007/12/17 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -26,6 +26,8 @@ STATIC_OVL NEARDATA const char *breathwep[] = { "strange breath #9" }; +extern boolean notonhead; /* for long worms */ + /* hero is hit by something other than a monster */ int thitu(tlev, dam, obj, name) @@ -129,7 +131,7 @@ int x,y; return 1 if the object has stopped moving (hit or its range used up) */ int ohitmon(mtmp, otmp, range, verbose) -struct monst *mtmp; /* accidental target */ +struct monst *mtmp; /* accidental target, located at */ struct obj *otmp; /* missile; might be destroyed by drop_throw */ int range; /* how much farther will object travel if it misses */ /* Use -1 to signify to keep going even after hit, */ @@ -140,6 +142,7 @@ boolean verbose; /* give message(s) even when you can't see what happened */ boolean vis, ismimic; int objgone = 1; + notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my); ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER; vis = cansee(bhitpos.x, bhitpos.y); @@ -245,6 +248,7 @@ struct obj *obj; /* missile (or stack providing it) */ bhitpos.x = x; bhitpos.y = y; + notonhead = FALSE; /* reset potentially stale value */ if (obj->quan == 1L) { /*