]> granicus.if.org Git - nethack/commitdiff
teetering on edge of pit
authornethack.allison <nethack.allison>
Mon, 22 Dec 2003 19:09:39 +0000 (19:09 +0000)
committernethack.allison <nethack.allison>
Mon, 22 Dec 2003 19:09:39 +0000 (19:09 +0000)
- when you're teetering on the edge of a pit you can use '>' to enter the pit
- pull the numerious teetering checks into a new function

doc/fixes34.4
include/extern.h
include/hack.h
src/do.c
src/hack.c
src/pickup.c
src/trap.c

index d8a4a16687daf8cd1f154f61d48a3c3b3aaeb263..8d73a446a744680863058b69d7e44c5314539455 100644 (file)
@@ -8,6 +8,7 @@ wizard mode: avoid division by 0 crash for level teleport in the endgame if
        confusion overrides teleport control
 don't #sit on an object in a pit if you're only on the precipice
 fix message when pushing a boulder into a pool while riding
+when you're teetering on the edge of a pit you can use '>' to enter the pit
 
 
 Platform- and/or Interface-Specific Fixes
index 4afefe71df68363e5d8f0b595a4427d7bafc3a27..4bc7e4198effea387cdcadb7334c966b870aa0b8 100644 (file)
@@ -2088,6 +2088,7 @@ 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));
+E boolean FDECL(uteetering_at_seen_pit, (struct trap *));
 
 /* ### u_init.c ### */
 
index 5d7f91d4785df61c34402a6660f8171a324a5f37..b1677b1f508f6e902cb92b13d30d858ad322e353 100644 (file)
@@ -193,6 +193,7 @@ NEARDATA extern coord bhitpos;      /* place where throw or zap hits or stops */
 #define NOWEBMSG       0x01    /* suppress stumble into web message */
 #define FORCEBUNGLE    0x02    /* adjustments appropriate for bungling */
 #define RECURSIVETRAP  0x04    /* trap changed into another type this same turn */
+#define TOOKPLUNGE     0x08    /* used '>' to enter pit below you */
 
 /* Flags to control test_move in hack.c */
 #define DO_MOVE                0       /* really doing the move */
index 0bd243579c49140fef78ecc25a219ab6c09b9490..9bb52b0edb366e0171e60ad1e256ca733dab9bcb 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -209,10 +209,7 @@ const char *verb;
                }
                water_damage(obj, FALSE, FALSE);
        } else if (u.ux == x && u.uy == y &&
-               (!u.utrap || u.utraptype != TT_PIT) &&
-               (t = t_at(x,y)) != 0 && t->tseen &&
-                       (t->ttyp==PIT || t->ttyp==SPIKED_PIT)) {
-               /* you escaped a pit and are standing on the precipice */
+               (t = t_at(x,y)) != 0 && uteetering_at_seen_pit(t)) {
                if (Blind && !Deaf)
                        You_hear("%s tumble downwards.",
                                the(xname(obj)));
@@ -778,10 +775,13 @@ dodown()
            return (0);   /* didn't move */
        }
        if (!stairs_down && !ladder_down) {
-               if (!(trap = t_at(u.ux,u.uy)) ||
-                       (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE)
-                       || !Can_fall_thru(&u.uz) || !trap->tseen) {
-
+               trap = t_at(u.ux,u.uy);
+               if (trap && uteetering_at_seen_pit(trap)) {
+                       dotrap(trap, TOOKPLUNGE);
+                       return(1);
+               } else if (!trap ||
+                   (trap->ttyp != TRAPDOOR && trap->ttyp != HOLE) ||
+                   !Can_fall_thru(&u.uz) || !trap->tseen) {
                        if (flags.autodig && !context.nopick &&
                                uwep && is_pick(uwep)) {
                                return use_pick_axe2(uwep);
index b4520e06ba50fca6db8c1f28f32b762defe2f777..4431e679d8f73a66ee8e0db40dc845ec9a08e960 100644 (file)
@@ -1937,17 +1937,14 @@ dopickup()
                return(0);
        }
 
-       if (traphere && traphere->tseen) {
+       if (traphere && uteetering_at_seen_pit(traphere)) {
                /* Allow pickup from holes and trap doors that you escaped from
                 * because that stuff is teetering on the edge just like you, but
                 * not pits, because there is an elevation discrepancy with stuff
                 * in pits.
                 */
-               if ((traphere->ttyp == PIT || traphere->ttyp == SPIKED_PIT) &&
-                    (!u.utrap || (u.utrap && u.utraptype != TT_PIT))) {
-                       You("cannot reach the bottom of the pit.");
-                       return(0);
-               }
+               You("cannot reach the bottom of the pit.");
+               return(0);
        }
 
        return (pickup(-count));
index af7216f4834c2e68c92ea3eba7b6d6b5f75e9ad1..b93a89fb55192d09826143d27656a69974eb8743 100644 (file)
@@ -412,17 +412,14 @@ int what;         /* should be a long */
                        read_engr_at(u.ux, u.uy);
                    return (0);
                }
-               if (ttmp && ttmp->tseen) {
+               if (ttmp && uteetering_at_seen_pit(ttmp)) {
                    /* Allow pickup from holes and trap doors that you escaped
                     * from because that stuff is teetering on the edge just
                     * like you, but not pits, because there is an elevation
                     * discrepancy with stuff in pits.
                     */
-                   if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT) &&
-                       (!u.utrap || (u.utrap && u.utraptype != TT_PIT))) {
-                       read_engr_at(u.ux, u.uy);
-                       return(0);
-                   }
+                    read_engr_at(u.ux, u.uy);
+                    return(0);
                }
                /* multi && !context.run means they are in the middle of some other
                 * action, or possibly paralyzed, sleeping, etc.... and they just
index a3fbc065399a8be8bc979d560a00b41b8d0f11b6..ce6704bb01fc2d9117e08931e0e972f788a8ff22 100644 (file)
@@ -577,6 +577,7 @@ unsigned trflags;
        boolean already_seen = trap->tseen;
        boolean webmsgok = (!(trflags & NOWEBMSG));
        boolean forcebungle = (trflags & FORCEBUNGLE);
+       boolean plunged = (trflags & TOOKPLUNGE);
 
        nomul(0);
 
@@ -604,7 +605,7 @@ unsigned trflags;
                return;
            }
            if(!Fumbling && ttype != MAGIC_PORTAL &&
-               ttype != ANTI_MAGIC && !forcebungle &&
+               ttype != ANTI_MAGIC && !forcebungle && !plunged &&
                (!rn2(5) ||
            ((ttype == PIT || ttype == SPIKED_PIT) && is_clinger(youmonst.data)))) {
                You("escape %s %s.",
@@ -877,7 +878,7 @@ glovecheck:         (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
                                         "poor", SUPPRESS_SADDLE, FALSE));
                    } else
 #endif
-                   Strcpy(verbbuf,"fall");
+                   Strcpy(verbbuf, plunged ? "plunge" : "fall");
                    You("%s into %s pit!", verbbuf, a_your[trap->madeby_u]);
                }
                /* wumpus reference */
@@ -909,13 +910,16 @@ glovecheck:               (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
 #endif
                if (ttype == SPIKED_PIT) {
                    losehp(Maybe_Half_Phys(rnd(10)),
-                       "fell into a pit of iron spikes",
+                       plunged ? "deliberately plunged into a pit of iron spikes" :
+                                 "fell into a pit of iron spikes",
                        NO_KILLER_PREFIX);
                    if (!rn2(6))
                        poisoned("spikes", A_STR, "fall onto poison spikes",
                                 8, FALSE);
                } else
-                   losehp(Maybe_Half_Phys(rnd(6)),"fell into a pit",
+                   losehp(Maybe_Half_Phys(rnd(6)),
+                       plunged ? "deliberately plunged into a pit" :
+                                 "fell into a pit",
                        NO_KILLER_PREFIX);
                if (Punished && !carried(uball)) {
                    unplacebc();
@@ -3779,6 +3783,21 @@ register struct trap *trap;
        dealloc_trap(trap);
 }
 
+/*
+ * Returns TRUE if you escaped a pit and are standing on the precipice.
+ */
+boolean
+uteetering_at_seen_pit(trap)
+struct trap *trap;
+{
+   if (trap && trap->tseen &&
+       (!u.utrap || u.utraptype != TT_PIT) &&
+       (trap->ttyp==PIT || trap->ttyp==SPIKED_PIT))
+       return TRUE;
+   else 
+       return FALSE;
+} 
+
 boolean
 delfloortrap(ttmp)
 register struct trap *ttmp;