throwing through iron bars
Make throwing things through iron bars by the player and by monsters behave consistently with each other. Also prevent stone-to-flesh'd boulders and wands from passing through.
This commit is contained in:
+5
-2
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)mthrowu.c 3.4 2002/04/06 */
|
/* SCCS Id: @(#)mthrowu.c 3.4 2002/07/23 */
|
||||||
/* 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. */
|
||||||
|
|
||||||
@@ -451,7 +451,7 @@ m_throw(mon, x, y, dx, dy, range, obj)
|
|||||||
|| closed_door(bhitpos.x+dx, bhitpos.y+dy)
|
|| closed_door(bhitpos.x+dx, bhitpos.y+dy)
|
||||||
/* missile might hit iron bars */
|
/* missile might hit iron bars */
|
||||||
|| (levl[bhitpos.x+dx][bhitpos.y+dy].typ == IRONBARS &&
|
|| (levl[bhitpos.x+dx][bhitpos.y+dy].typ == IRONBARS &&
|
||||||
hits_bars(&singleobj, bhitpos.x, bhitpos.y, !rn2(2), 0))
|
hits_bars(&singleobj, bhitpos.x, bhitpos.y, !rn2(5), 0))
|
||||||
#ifdef SINKS
|
#ifdef SINKS
|
||||||
/* Thrown objects "sink" */
|
/* Thrown objects "sink" */
|
||||||
|| IS_SINK(levl[bhitpos.x][bhitpos.y].typ)
|
|| IS_SINK(levl[bhitpos.x][bhitpos.y].typ)
|
||||||
@@ -809,6 +809,9 @@ int whodidit; /* 1==hero, 0=other, -1==just check whether it'll pass thru */
|
|||||||
case FOOD_CLASS:
|
case FOOD_CLASS:
|
||||||
if (obj_type == CORPSE &&
|
if (obj_type == CORPSE &&
|
||||||
mons[otmp->corpsenm].msize > MZ_TINY) hits = TRUE;
|
mons[otmp->corpsenm].msize > MZ_TINY) hits = TRUE;
|
||||||
|
else
|
||||||
|
hits = (obj_type == MEAT_STICK ||
|
||||||
|
obj_type == HUGE_CHUNK_OF_MEAT);
|
||||||
break;
|
break;
|
||||||
case SPBOOK_CLASS:
|
case SPBOOK_CLASS:
|
||||||
case WAND_CLASS:
|
case WAND_CLASS:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)zap.c 3.4 2002/04/06 */
|
/* SCCS Id: @(#)zap.c 3.4 2002/07/23 */
|
||||||
/* 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. */
|
||||||
|
|
||||||
@@ -2587,7 +2587,7 @@ struct obj *obj; /* object tossed/used */
|
|||||||
{
|
{
|
||||||
struct monst *mtmp;
|
struct monst *mtmp;
|
||||||
uchar typ;
|
uchar typ;
|
||||||
boolean shopdoor = FALSE;
|
boolean shopdoor = FALSE, point_blank = TRUE;
|
||||||
|
|
||||||
if (weapon == KICKED_WEAPON) {
|
if (weapon == KICKED_WEAPON) {
|
||||||
/* object starts one square in front of player */
|
/* object starts one square in front of player */
|
||||||
@@ -2628,7 +2628,8 @@ struct obj *obj; /* object tossed/used */
|
|||||||
/* iron bars will block anything big enough */
|
/* iron bars will block anything big enough */
|
||||||
if ((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON) &&
|
if ((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON) &&
|
||||||
typ == IRONBARS &&
|
typ == IRONBARS &&
|
||||||
hits_bars(&obj, x - ddx, y - ddy, !rn2(20), 1)) {
|
hits_bars(&obj, x - ddx, y - ddy,
|
||||||
|
point_blank ? 0 : !rn2(5), 1)) {
|
||||||
/* caveat: obj might now be null... */
|
/* caveat: obj might now be null... */
|
||||||
bhitpos.x -= ddx;
|
bhitpos.x -= ddx;
|
||||||
bhitpos.y -= ddy;
|
bhitpos.y -= ddy;
|
||||||
@@ -2761,6 +2762,8 @@ struct obj *obj; /* object tossed/used */
|
|||||||
break; /* physical objects fall onto sink */
|
break; /* physical objects fall onto sink */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
/* thrown/kicked missile has moved away from its starting spot */
|
||||||
|
point_blank = FALSE; /* affects passing through iron bars */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM) tmp_at(DISP_END, 0);
|
if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM) tmp_at(DISP_END, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user