land mine vs drawbridge

Fix the reported problem that having a land mine explode on an open
drawbridge or under its portcullis did not cause the bridge to be destroyed.
This commit is contained in:
nethack.rankin
2005-03-17 05:20:34 +00:00
parent 59cc0d221b
commit acb416abcc
2 changed files with 27 additions and 11 deletions

View File

@@ -95,6 +95,7 @@ mbodypart should return forehoof, not foreclaw, for horselike monsters
further digging of an existing hole finishes in a single turn
only prefix shopkeeper names with "Mr." or "Ms." when not a personal name
green slime should not affect noncorporeal monsters
land mine explosion will destroy a drawbridge at same location
Platform- and/or Interface-Specific Fixes

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)trap.c 3.5 2004/12/21 */
/* SCCS Id: @(#)trap.c 3.5 2005/03/16 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1309,18 +1309,30 @@ void
blow_up_landmine(trap)
struct trap *trap;
{
(void)scatter(trap->tx, trap->ty, 4,
MAY_DESTROY | MAY_HIT | MAY_FRACTURE | VIS_EFFECTS,
(struct obj *)0);
del_engr_at(trap->tx, trap->ty);
wake_nearto(trap->tx, trap->ty, 400);
if (IS_DOOR(levl[trap->tx][trap->ty].typ))
levl[trap->tx][trap->ty].doormask = D_BROKEN;
/* TODO: destroy drawbridge if present */
/* caller may subsequently fill pit, e.g. with a boulder */
int x = trap->tx, y = trap->ty, dbx, dby;
struct rm *lev = &levl[x][y];
(void)scatter(x, y, 4,
MAY_DESTROY | MAY_HIT | MAY_FRACTURE | VIS_EFFECTS,
(struct obj *)0);
del_engr_at(x, y);
wake_nearto(x, y, 400);
if (IS_DOOR(lev->typ))
lev->doormask = D_BROKEN;
/* destroy drawbridge if present */
if (lev->typ == DRAWBRIDGE_DOWN || is_drawbridge_wall(x, y) >= 0) {
dbx = x, dby = y;
/* if under the portcullis, the bridge is adjacent */
if (find_drawbridge(&dbx, &dby))
destroy_drawbridge(dbx, dby);
trap = t_at(x, y); /* expected to be null after destruction */
}
/* convert landmine into pit */
if (trap) {
trap->ttyp = PIT; /* explosion creates a pit */
trap->madeby_u = FALSE; /* resulting pit isn't yours */
seetrap(trap); /* and it isn't concealed */
}
}
/*
@@ -2183,7 +2195,10 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
if (!in_sight)
pline("Kaablamm! You hear an explosion in the distance!");
blow_up_landmine(trap);
if (thitm(0, mtmp, (struct obj *)0, rnd(16), FALSE))
/* explosion might have destroyed a drawbridge; don't
dish out more damage if monster is already dead */
if (mtmp->mhp <= 0 ||
thitm(0, mtmp, (struct obj *)0, rnd(16), FALSE))
trapkilled = TRUE;
else {
/* monsters recursively fall into new pit */