landmines and boulders

Make pushing a boulder onto a landmine share code with the trap case,
resulting in pits, waking sleepers, et al.
Don't leave a boulder suspended over the new pit, fill it.
Make sure any remaining boulder is placed on top of the pile.
If player sets off landmine, monsters killed are credited to/blamed on player.
This commit is contained in:
cohrs
2002-01-25 06:38:42 +00:00
parent 7406ad3855
commit f73a1879c9
6 changed files with 21 additions and 13 deletions

View File

@@ -405,6 +405,7 @@ when reading spellbooks, don't "continue studying" wrong book if original one
correctly handle polymorphed quest leader
swallowing zombies/mummies whole makes you sick, like when eating them normally
impose additional teleport restrictions on the no-teleport Plane of Air
landmines set off by pushed boulders have same effects as stepping on them
Platform- and/or Interface-Specific Fixes

View File

@@ -1953,6 +1953,7 @@ E struct trap *FDECL(t_at, (int,int));
E void FDECL(b_trapped, (const char *,int));
E boolean NDECL(unconscious);
E boolean NDECL(lava_effects);
E void FDECL(blow_up_landmine, (struct trap *));
E int FDECL(launch_obj,(SHORT_P,int,int,int,int,int));
/* ### u_init.c ### */

View File

@@ -440,6 +440,11 @@ struct obj *obj; /* only scatter this obj */
pline("%s breaks apart.",The(xname(otmp)));
fracture_rock(otmp);
place_object(otmp, sx, sy); /* put fragments on floor */
if ((otmp = sobj_at(BOULDER, sx, sy)) != 0) {
/* another boulder here, restack it to the top */
obj_extract_self(otmp);
place_object(otmp, sx, sy);
}
} else {
struct trap *trap;

View File

@@ -137,11 +137,9 @@ moverock()
ttmp->madeby_u ? "your" : "a");
obj_extract_self(otmp);
place_object(otmp, rx, ry);
deltrap(ttmp);
del_engr_at(rx,ry);
scatter(rx,ry, 4,
MAY_DESTROY|MAY_HIT|MAY_FRACTURE|VIS_EFFECTS,
(struct obj *)0);
blow_up_landmine(ttmp);
/* if the boulder remains, it should fill the pit */
fill_pit(u.ux, u.uy);
if (cansee(rx,ry)) newsym(rx,ry);
continue;
}

View File

@@ -223,7 +223,8 @@ boolean verbose; /* give message(s) even when you can't see what happened */
pline("%s is %s!", Monnam(mtmp),
(nonliving(mtmp->data) || !vis)
? "destroyed" : "killed");
mondied(mtmp);
if (!flags.mon_moving) xkilled(mtmp,0);
else mondied(mtmp);
}
if (can_blnd((struct monst*)0, mtmp,

View File

@@ -24,7 +24,6 @@ STATIC_DCL boolean FDECL(thitm, (int, struct monst *, struct obj *, int));
STATIC_DCL int FDECL(mkroll_launch,
(struct trap *,XCHAR_P,XCHAR_P,SHORT_P,long));
STATIC_DCL boolean FDECL(isclearpath,(coord *, int, SCHAR_P, SCHAR_P));
STATIC_DCL void FDECL(blow_up_landmine, (struct trap *));
#ifdef STEED
STATIC_OVL int FDECL(steedintrap, (struct trap *, struct obj *));
#endif
@@ -1002,6 +1001,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
losehp(rnd(16), "land mine", KILLED_BY_AN);
/* fall recursively into the pit... */
if ((trap = t_at(u.ux, u.uy)) != 0) dotrap(trap, 0);
fill_pit(u.ux, u.uy);
break;
case ROLLING_BOULDER_TRAP:
@@ -1118,7 +1118,7 @@ struct obj *otmp;
#endif /*STEED*/
/* some actions common to both player and monsters for triggered landmine */
STATIC_OVL void
void
blow_up_landmine(trap)
struct trap *trap;
{
@@ -1129,8 +1129,8 @@ struct trap *trap;
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;
sometimes delete trap instead of always leaving a pit */
/* TODO: destroy drawbridge if present */
/* caller may subsequently fill pit, e.g. with a boulder */
trap->ttyp = PIT; /* explosion creates a pit */
trap->madeby_u = FALSE; /* resulting pit isn't yours */
}
@@ -1852,6 +1852,9 @@ glovecheck: target = which_armor(mtmp, W_ARMG);
/* monsters recursively fall into new pit */
if (mintrap(mtmp) == 2) trapkilled=TRUE;
}
/* a boulder may fill the new pit, crushing monster */
fill_pit(trap->tx, trap->ty);
if (mtmp->mhp <= 0) trapkilled = TRUE;
if (unconscious()) {
multi = -1;
nomovemsg="The explosion awakens you!";
@@ -3488,9 +3491,8 @@ int d_override;
* obj->spe into account.
*/
if(!strike) {
if (cansee(mon->mx, mon->my))
pline("%s is almost hit by %s!", Monnam(mon),
doname(obj));
if (obj && cansee(mon->mx, mon->my))
pline("%s is almost hit by %s!", Monnam(mon), doname(obj));
} else {
int dam = 1;