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

View 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

View 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 ### */

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 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 */

View File

@@ -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);

View 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));

View 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

View 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;