]> granicus.if.org Git - nethack/commitdiff
landmines and boulders
authorcohrs <cohrs>
Fri, 25 Jan 2002 06:38:42 +0000 (06:38 +0000)
committercohrs <cohrs>
Fri, 25 Jan 2002 06:38:42 +0000 (06:38 +0000)
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.

doc/fixes33.2
include/extern.h
src/explode.c
src/hack.c
src/mthrowu.c
src/trap.c

index d19268df65805a3f4b2770b88e6d3c75222c5668..f5a19904febebbf3d6998826f7920ef368b632da 100644 (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
index f29615576ca25a9812606a21c4437db7c4105728..0020b1d80a03c29ae87a1b0afa7e1fe3a94170e8 100644 (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 ### */
index de3160487078230e6e8cd644fe7c442400ed7f0a..9d53b67d218f5194ce26e2d1527ca6ae7d13c840 100644 (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;
 
index 9cef346d7392cb53d3966f638f5468e0f1d3a89c..7fd89ab8cbccb961c71640f9f613e138e3d02903 100644 (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;
                    }
index 09b85f5eb5e8412762bb304bd0391b9f75502ce6..86f5b65a00e4590a70dc4de13f709019943d1232 100644 (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,
index c31efe3c9ba51ca967324fb0ec73b5086a381fa8..32005ef62aacfe0528057a0a68972e377b5bd743 100644 (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;