teetering on edge of pit

- 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
This commit is contained in:
nethack.allison
2003-12-22 19:09:39 +00:00
parent 712771f4f7
commit 57b1e96238
7 changed files with 40 additions and 24 deletions
+1
View File
@@ -8,6 +8,7 @@ wizard mode: avoid division by 0 crash for level teleport in the endgame if
confusion overrides teleport control confusion overrides teleport control
don't #sit on an object in a pit if you're only on the precipice 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 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 Platform- and/or Interface-Specific Fixes
+1
View File
@@ -2088,6 +2088,7 @@ E boolean NDECL(unconscious);
E boolean NDECL(lava_effects); E boolean NDECL(lava_effects);
E void FDECL(blow_up_landmine, (struct trap *)); E void FDECL(blow_up_landmine, (struct trap *));
E int FDECL(launch_obj,(SHORT_P,int,int,int,int,int)); E int FDECL(launch_obj,(SHORT_P,int,int,int,int,int));
E boolean FDECL(uteetering_at_seen_pit, (struct trap *));
/* ### u_init.c ### */ /* ### u_init.c ### */
+1
View 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 NOWEBMSG 0x01 /* suppress stumble into web message */
#define FORCEBUNGLE 0x02 /* adjustments appropriate for bungling */ #define FORCEBUNGLE 0x02 /* adjustments appropriate for bungling */
#define RECURSIVETRAP 0x04 /* trap changed into another type this same turn */ #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 */ /* Flags to control test_move in hack.c */
#define DO_MOVE 0 /* really doing the move */ #define DO_MOVE 0 /* really doing the move */
+8 -8
View File
@@ -209,10 +209,7 @@ const char *verb;
} }
water_damage(obj, FALSE, FALSE); water_damage(obj, FALSE, FALSE);
} else if (u.ux == x && u.uy == y && } else if (u.ux == x && u.uy == y &&
(!u.utrap || u.utraptype != TT_PIT) && (t = t_at(x,y)) != 0 && uteetering_at_seen_pit(t)) {
(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 */
if (Blind && !Deaf) if (Blind && !Deaf)
You_hear("%s tumble downwards.", You_hear("%s tumble downwards.",
the(xname(obj))); the(xname(obj)));
@@ -778,10 +775,13 @@ dodown()
return (0); /* didn't move */ return (0); /* didn't move */
} }
if (!stairs_down && !ladder_down) { if (!stairs_down && !ladder_down) {
if (!(trap = t_at(u.ux,u.uy)) || trap = t_at(u.ux,u.uy);
(trap->ttyp != TRAPDOOR && trap->ttyp != HOLE) if (trap && uteetering_at_seen_pit(trap)) {
|| !Can_fall_thru(&u.uz) || !trap->tseen) { 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 && if (flags.autodig && !context.nopick &&
uwep && is_pick(uwep)) { uwep && is_pick(uwep)) {
return use_pick_axe2(uwep); return use_pick_axe2(uwep);
+3 -6
View File
@@ -1937,17 +1937,14 @@ dopickup()
return(0); return(0);
} }
if (traphere && traphere->tseen) { if (traphere && uteetering_at_seen_pit(traphere)) {
/* Allow pickup from holes and trap doors that you escaped from /* Allow pickup from holes and trap doors that you escaped from
* because that stuff is teetering on the edge just like you, but * because that stuff is teetering on the edge just like you, but
* not pits, because there is an elevation discrepancy with stuff * not pits, because there is an elevation discrepancy with stuff
* in pits. * in pits.
*/ */
if ((traphere->ttyp == PIT || traphere->ttyp == SPIKED_PIT) && You("cannot reach the bottom of the pit.");
(!u.utrap || (u.utrap && u.utraptype != TT_PIT))) { return(0);
You("cannot reach the bottom of the pit.");
return(0);
}
} }
return (pickup(-count)); return (pickup(-count));
+3 -6
View File
@@ -412,17 +412,14 @@ int what; /* should be a long */
read_engr_at(u.ux, u.uy); read_engr_at(u.ux, u.uy);
return (0); return (0);
} }
if (ttmp && ttmp->tseen) { if (ttmp && uteetering_at_seen_pit(ttmp)) {
/* Allow pickup from holes and trap doors that you escaped /* Allow pickup from holes and trap doors that you escaped
* from because that stuff is teetering on the edge just * from because that stuff is teetering on the edge just
* like you, but not pits, because there is an elevation * like you, but not pits, because there is an elevation
* discrepancy with stuff in pits. * discrepancy with stuff in pits.
*/ */
if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT) && read_engr_at(u.ux, u.uy);
(!u.utrap || (u.utrap && u.utraptype != TT_PIT))) { return(0);
read_engr_at(u.ux, u.uy);
return(0);
}
} }
/* multi && !context.run means they are in the middle of some other /* multi && !context.run means they are in the middle of some other
* action, or possibly paralyzed, sleeping, etc.... and they just * action, or possibly paralyzed, sleeping, etc.... and they just
+23 -4
View File
@@ -577,6 +577,7 @@ unsigned trflags;
boolean already_seen = trap->tseen; boolean already_seen = trap->tseen;
boolean webmsgok = (!(trflags & NOWEBMSG)); boolean webmsgok = (!(trflags & NOWEBMSG));
boolean forcebungle = (trflags & FORCEBUNGLE); boolean forcebungle = (trflags & FORCEBUNGLE);
boolean plunged = (trflags & TOOKPLUNGE);
nomul(0); nomul(0);
@@ -604,7 +605,7 @@ unsigned trflags;
return; return;
} }
if(!Fumbling && ttype != MAGIC_PORTAL && if(!Fumbling && ttype != MAGIC_PORTAL &&
ttype != ANTI_MAGIC && !forcebungle && ttype != ANTI_MAGIC && !forcebungle && !plunged &&
(!rn2(5) || (!rn2(5) ||
((ttype == PIT || ttype == SPIKED_PIT) && is_clinger(youmonst.data)))) { ((ttype == PIT || ttype == SPIKED_PIT) && is_clinger(youmonst.data)))) {
You("escape %s %s.", You("escape %s %s.",
@@ -877,7 +878,7 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
"poor", SUPPRESS_SADDLE, FALSE)); "poor", SUPPRESS_SADDLE, FALSE));
} else } else
#endif #endif
Strcpy(verbbuf,"fall"); Strcpy(verbbuf, plunged ? "plunge" : "fall");
You("%s into %s pit!", verbbuf, a_your[trap->madeby_u]); You("%s into %s pit!", verbbuf, a_your[trap->madeby_u]);
} }
/* wumpus reference */ /* wumpus reference */
@@ -909,13 +910,16 @@ glovecheck: (void) rust_dmg(uarmg, "gauntlets", 1, TRUE, &youmonst);
#endif #endif
if (ttype == SPIKED_PIT) { if (ttype == SPIKED_PIT) {
losehp(Maybe_Half_Phys(rnd(10)), 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); NO_KILLER_PREFIX);
if (!rn2(6)) if (!rn2(6))
poisoned("spikes", A_STR, "fall onto poison spikes", poisoned("spikes", A_STR, "fall onto poison spikes",
8, FALSE); 8, FALSE);
} else } 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); NO_KILLER_PREFIX);
if (Punished && !carried(uball)) { if (Punished && !carried(uball)) {
unplacebc(); unplacebc();
@@ -3779,6 +3783,21 @@ register struct trap *trap;
dealloc_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 boolean
delfloortrap(ttmp) delfloortrap(ttmp)
register struct trap *ttmp; register struct trap *ttmp;