Merge branch 'NetHack-3.6'
This commit is contained in:
56
src/zap.c
56
src/zap.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 zap.c $NHDT-Date: 1559685281 2019/06/04 21:54:41 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.310 $ */
|
||||
/* NetHack 3.6 zap.c $NHDT-Date: 1559994626 2019/06/08 11:50:26 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.311 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -3215,7 +3215,7 @@ int FDECL((*fhitm), (MONST_P, OBJ_P)), /* fns called when mon/obj hit */
|
||||
struct obj **pobj; /* object tossed/used, set to NULL
|
||||
* if object is destroyed */
|
||||
{
|
||||
struct monst *mtmp;
|
||||
struct monst *mtmp, *result = (struct monst *) 0;
|
||||
struct obj *obj = *pobj;
|
||||
uchar typ;
|
||||
boolean shopdoor = FALSE, point_blank = TRUE;
|
||||
@@ -3241,9 +3241,9 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
if (weapon == FLASHED_LIGHT) {
|
||||
tmp_at(DISP_BEAM, cmap_to_glyph(S_flashbeam));
|
||||
} else if (weapon == THROWN_TETHERED_WEAPON && obj) {
|
||||
tethered_weapon = TRUE;
|
||||
weapon = THROWN_WEAPON; /* simplify if's that follow below */
|
||||
tmp_at(DISP_TETHER, obj_to_glyph(obj, rn2_on_display_rng));
|
||||
tethered_weapon = TRUE;
|
||||
weapon = THROWN_WEAPON; /* simplify 'if's that follow below */
|
||||
tmp_at(DISP_TETHER, obj_to_glyph(obj, rn2_on_display_rng));
|
||||
} else if (weapon != ZAPPED_WAND && weapon != INVIS_BEAM)
|
||||
tmp_at(DISP_FLASH, obj_to_glyph(obj, rn2_on_display_rng));
|
||||
|
||||
@@ -3264,21 +3264,25 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
if (is_pick(obj) && inside_shop(x, y)
|
||||
&& (mtmp = shkcatch(obj, x, y)) != 0) {
|
||||
tmp_at(DISP_END, 0);
|
||||
return mtmp;
|
||||
result = mtmp;
|
||||
goto bhit_done;
|
||||
}
|
||||
|
||||
typ = levl[g.bhitpos.x][g.bhitpos.y].typ;
|
||||
|
||||
/* iron bars will block anything big enough */
|
||||
if ((weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
|
||||
&& typ == IRONBARS
|
||||
&& hits_bars(pobj, x - ddx, y - ddy, g.bhitpos.x, g.bhitpos.y,
|
||||
point_blank ? 0 : !rn2(5), 1)) {
|
||||
/* caveat: obj might now be null... */
|
||||
obj = *pobj;
|
||||
g.bhitpos.x -= ddx;
|
||||
g.bhitpos.y -= ddy;
|
||||
break;
|
||||
/* iron bars will block anything big enough and break some things */
|
||||
if (weapon == THROWN_WEAPON || weapon == KICKED_WEAPON) {
|
||||
if (typ == IRONBARS
|
||||
&& hits_bars(pobj, x - ddx, y - ddy, g.bhitpos.x, g.bhitpos.y,
|
||||
point_blank ? 0 : !rn2(5), 1)) {
|
||||
/* caveat: obj might now be null... */
|
||||
obj = *pobj;
|
||||
g.bhitpos.x -= ddx;
|
||||
g.bhitpos.y -= ddy;
|
||||
break;
|
||||
} else if (obj->lamplit && !Blind) {
|
||||
show_transient_light(obj, g.bhitpos.x, g.bhitpos.y);
|
||||
}
|
||||
}
|
||||
|
||||
if (weapon == ZAPPED_WAND && find_drawbridge(&x, &y)) {
|
||||
@@ -3358,7 +3362,8 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
(void) flash_hits_mon(mtmp, obj);
|
||||
} else {
|
||||
tmp_at(DISP_END, 0);
|
||||
return mtmp; /* caller will call flash_hits_mon */
|
||||
result = mtmp; /* caller will call flash_hits_mon */
|
||||
goto bhit_done;
|
||||
}
|
||||
} else if (weapon == INVIS_BEAM) {
|
||||
/* Like FLASHED_LIGHT, INVIS_BEAM should continue
|
||||
@@ -3366,8 +3371,10 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
prepared for multiple hits so just get first one
|
||||
that's either visible or could see its invisible
|
||||
self. [No tmp_at() cleanup is needed here.] */
|
||||
if (!mtmp->minvis || perceives(mtmp->data))
|
||||
return mtmp;
|
||||
if (!mtmp->minvis || perceives(mtmp->data)) {
|
||||
result = mtmp;
|
||||
goto bhit_done;
|
||||
}
|
||||
} else if (weapon != ZAPPED_WAND) {
|
||||
|
||||
/* THROWN_WEAPON, KICKED_WEAPON */
|
||||
@@ -3376,7 +3383,8 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
|
||||
if (cansee(g.bhitpos.x, g.bhitpos.y) && !canspotmon(mtmp))
|
||||
map_invisible(g.bhitpos.x, g.bhitpos.y);
|
||||
return mtmp;
|
||||
result = mtmp;
|
||||
goto bhit_done;
|
||||
} else {
|
||||
/* ZAPPED_WAND */
|
||||
(*fhitm)(mtmp, obj);
|
||||
@@ -3399,7 +3407,7 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
|| ship_object(obj, g.bhitpos.x, g.bhitpos.y,
|
||||
costly_spot(g.bhitpos.x, g.bhitpos.y)))) {
|
||||
tmp_at(DISP_END, 0);
|
||||
return (struct monst *) 0;
|
||||
goto bhit_done; /* result == (struct monst *) 0 */
|
||||
}
|
||||
}
|
||||
if (weapon == ZAPPED_WAND && (IS_DOOR(typ) || typ == SDOOR)) {
|
||||
@@ -3482,7 +3490,11 @@ struct obj **pobj; /* object tossed/used, set to NULL
|
||||
if (shopdoor)
|
||||
pay_for_damage("destroy", FALSE);
|
||||
|
||||
return (struct monst *) 0;
|
||||
bhit_done:
|
||||
if (weapon == THROWN_WEAPON || weapon == KICKED_WEAPON)
|
||||
transient_light_cleanup();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* process thrown boomerang, which travels a curving path...
|
||||
|
||||
Reference in New Issue
Block a user