more PR #1077 - #sit on floor trap while Flying
Sitting on a squeaky board wasn't triggering it even after the handler for that type of trap allowed VIASITTING to override Flying. The check_in_air() test for floor traps didn't have the same override, so the squeaky board handler didn't get called. This fixes that, which led to inconsistency with some other trap types, and additional fixes for pits and bear traps. There might be others that still behave oddly. For example, if flying over a hole, using #sit yields |You land. There's a gaping hole under you! You don't fall in. I think that's a message phrasing issue rather than a falling trap issue; if you want to go down, use '>' instead of #sit. On the other hand, you do now fall into pit traps for #sit while flying over them.
This commit is contained in:
@@ -321,7 +321,10 @@ dosit(void)
|
|||||||
u.utrap++;
|
u.utrap++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
You("sit down.");
|
/* when flying, "you land" might need some refinement; it aounds
|
||||||
|
as if you're staying on the ground but you will immediately
|
||||||
|
take off again unless you become stuck in a holding trap */
|
||||||
|
You("%s.", Flying ? "land" : "sit down");
|
||||||
dotrap(trap, VIASITTING);
|
dotrap(trap, VIASITTING);
|
||||||
}
|
}
|
||||||
} else if ((Underwater || Is_waterlevel(&u.uz))
|
} else if ((Underwater || Is_waterlevel(&u.uz))
|
||||||
|
|||||||
25
src/trap.c
25
src/trap.c
@@ -1041,13 +1041,12 @@ floor_trigger(int ttyp)
|
|||||||
static boolean
|
static boolean
|
||||||
check_in_air(struct monst *mtmp, unsigned trflags)
|
check_in_air(struct monst *mtmp, unsigned trflags)
|
||||||
{
|
{
|
||||||
boolean plunged = (trflags & TOOKPLUNGE) != 0;
|
boolean is_you = mtmp == &gy.youmonst,
|
||||||
|
plunged = (trflags & (TOOKPLUNGE | VIASITTING)) != 0;
|
||||||
|
|
||||||
return (is_floater(mtmp->data)
|
return ((trflags & HURTLING) != 0
|
||||||
|| (is_flyer(mtmp->data) && !plunged)
|
|| (is_you ? Levitation : is_floater(mtmp->data))
|
||||||
|| (trflags & HURTLING) != 0
|
|| ((is_you ? Flying : is_flyer(mtmp->data)) && !plunged));
|
||||||
|| (mtmp == &gy.youmonst ?
|
|
||||||
(Levitation || (Flying && !plunged)) : 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -1337,10 +1336,12 @@ trapeffect_bear_trap(
|
|||||||
struct trap *trap,
|
struct trap *trap,
|
||||||
unsigned trflags)
|
unsigned trflags)
|
||||||
{
|
{
|
||||||
boolean forcetrap = ((trflags & FORCETRAP) != 0
|
boolean is_you = mtmp == &gy.youmonst,
|
||||||
|| (trflags & FAILEDUNTRAP) != 0);
|
forcetrap = ((trflags & FORCETRAP) != 0
|
||||||
|
|| (trflags & FAILEDUNTRAP) != 0
|
||||||
|
|| (is_you && (trflags & VIASITTING) != 0));
|
||||||
|
|
||||||
if (mtmp == &gy.youmonst) {
|
if (is_you) {
|
||||||
int dmg = d(2, 4);
|
int dmg = d(2, 4);
|
||||||
|
|
||||||
if ((Levitation || Flying) && !forcetrap)
|
if ((Levitation || Flying) && !forcetrap)
|
||||||
@@ -1663,6 +1664,7 @@ trapeffect_pit(
|
|||||||
|
|
||||||
if (mtmp == &gy.youmonst) {
|
if (mtmp == &gy.youmonst) {
|
||||||
boolean plunged = (trflags & TOOKPLUNGE) != 0;
|
boolean plunged = (trflags & TOOKPLUNGE) != 0;
|
||||||
|
boolean viasitting = (trflags & VIASITTING) != 0;
|
||||||
boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
|
boolean conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE);
|
||||||
boolean adj_pit = adj_nonconjoined_pit(trap);
|
boolean adj_pit = adj_nonconjoined_pit(trap);
|
||||||
boolean already_known = trap->tseen ? TRUE : FALSE;
|
boolean already_known = trap->tseen ? TRUE : FALSE;
|
||||||
@@ -1676,7 +1678,7 @@ trapeffect_pit(
|
|||||||
steed_article = ARTICLE_NONE;
|
steed_article = ARTICLE_NONE;
|
||||||
|
|
||||||
/* KMH -- You can't escape the Sokoban level traps */
|
/* KMH -- You can't escape the Sokoban level traps */
|
||||||
if (!Sokoban && (Levitation || (Flying && !plunged)))
|
if (!Sokoban && (Levitation || (Flying && !plunged && !viasitting)))
|
||||||
return Trap_Effect_Finished;
|
return Trap_Effect_Finished;
|
||||||
feeltrap(trap);
|
feeltrap(trap);
|
||||||
if (!Sokoban && is_clinger(gy.youmonst.data) && !plunged) {
|
if (!Sokoban && is_clinger(gy.youmonst.data) && !plunged) {
|
||||||
@@ -2638,8 +2640,7 @@ dotrap(struct trap *trap, unsigned trflags)
|
|||||||
if (already_seen && !Fumbling && !undestroyable_trap(ttype)
|
if (already_seen && !Fumbling && !undestroyable_trap(ttype)
|
||||||
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
|
&& ttype != ANTI_MAGIC && !forcebungle && !plunged
|
||||||
&& !conj_pit && !adj_pit
|
&& !conj_pit && !adj_pit
|
||||||
&& (!rn2(5) || (is_pit(ttype)
|
&& (!rn2(5) || (is_pit(ttype) && is_clinger(gy.youmonst.data)))) {
|
||||||
&& is_clinger(gy.youmonst.data)))) {
|
|
||||||
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
|
You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
|
||||||
? "an"
|
? "an"
|
||||||
: a_your[trap->madeby_u],
|
: a_your[trap->madeby_u],
|
||||||
|
|||||||
Reference in New Issue
Block a user