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.
This commit is contained in:
nethack.rankin
2007-12-17 23:43:31 +00:00
parent d454ca0d6e
commit faa3543063
3 changed files with 9 additions and 2 deletions
+2
View File
@@ -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 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 secret door detection's trap finding is no longer blocked by water or clouds
on the Planes of Water and Air 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 Platform- and/or Interface-Specific Fixes
+1
View File
@@ -929,6 +929,7 @@ boolean twoweap; /* used to restore twoweapon mode if wielded weapon returns */
impaired = (Confusion || Stunned || Blind || impaired = (Confusion || Stunned || Blind ||
Hallucination || Fumbling); Hallucination || Fumbling);
notonhead = FALSE; /* reset potentially stale value */
if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) { if ((obj->cursed || obj->greased) && (u.dx || u.dy) && !rn2(7)) {
boolean slipok = TRUE; boolean slipok = TRUE;
if (ammo_and_launcher(obj, uwep)) if (ammo_and_launcher(obj, uwep))
+6 -2
View File
@@ -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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -26,6 +26,8 @@ STATIC_OVL NEARDATA const char *breathwep[] = {
"strange breath #9" "strange breath #9"
}; };
extern boolean notonhead; /* for long worms */
/* hero is hit by something other than a monster */ /* hero is hit by something other than a monster */
int int
thitu(tlev, dam, obj, name) 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) */ return 1 if the object has stopped moving (hit or its range used up) */
int int
ohitmon(mtmp, otmp, range, verbose) ohitmon(mtmp, otmp, range, verbose)
struct monst *mtmp; /* accidental target */ struct monst *mtmp; /* accidental target, located at <bhitpos.x,.y> */
struct obj *otmp; /* missile; might be destroyed by drop_throw */ struct obj *otmp; /* missile; might be destroyed by drop_throw */
int range; /* how much farther will object travel if it misses */ int range; /* how much farther will object travel if it misses */
/* Use -1 to signify to keep going even after hit, */ /* 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; boolean vis, ismimic;
int objgone = 1; int objgone = 1;
notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER; ismimic = mtmp->m_ap_type && mtmp->m_ap_type != M_AP_MONSTER;
vis = cansee(bhitpos.x, bhitpos.y); vis = cansee(bhitpos.x, bhitpos.y);
@@ -245,6 +248,7 @@ struct obj *obj; /* missile (or stack providing it) */
bhitpos.x = x; bhitpos.x = x;
bhitpos.y = y; bhitpos.y = y;
notonhead = FALSE; /* reset potentially stale value */
if (obj->quan == 1L) { if (obj->quan == 1L) {
/* /*