From: cohrs Date: Fri, 25 Jan 2002 06:38:42 +0000 (+0000) Subject: landmines and boulders X-Git-Tag: MOVE2GIT~3352 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f73a1879c9aa30bd7bee0376fa56be82dce1e684;p=nethack 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. --- diff --git a/doc/fixes33.2 b/doc/fixes33.2 index d19268df6..f5a19904f 100644 --- a/doc/fixes33.2 +++ b/doc/fixes33.2 @@ -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 diff --git a/include/extern.h b/include/extern.h index f29615576..0020b1d80 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 ### */ diff --git a/src/explode.c b/src/explode.c index de3160487..9d53b67d2 100644 --- a/src/explode.c +++ b/src/explode.c @@ -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; diff --git a/src/hack.c b/src/hack.c index 9cef346d7..7fd89ab8c 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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; } diff --git a/src/mthrowu.c b/src/mthrowu.c index 09b85f5eb..86f5b65a0 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -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, diff --git a/src/trap.c b/src/trap.c index c31efe3c9..32005ef62 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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;