fix #H7385 - double trap activation when jumping

Jumping performs the placement of the last step after using hurtle()
to move to the destination, so if hurtle() triggered a trap then it
would happen twice.  Report was for a Sokoban pit but it would happen
for fire traps too.  Other traps would yield "you pass over <trap>"
while hurtling and then trigger the trap when landing.  Have
hurtle_step() ignore a trap for the last step of a jump, leaving it
to the jump's landing to handle.

Also, give feedback when hurtling over water or lava, similar to what
happens when passing over a previously seen trap which doesn't
activate.
This commit is contained in:
PatR
2018-09-13 17:10:25 -07:00
parent 7d4a7a1f42
commit 37f8d0edb3
2 changed files with 23 additions and 11 deletions

View File

@@ -114,7 +114,7 @@ add window port status_update() value BL_RESET to use as a flag to
for hilite_status of string status fields (title, dungeon-level, alignment),
the types value-goes-up and -down aren't meaningful; treat them as
value-changed if from config file and don't offer as choices with 'O'
spiders will occasionally spin webs when moving around
jumping into or over a Sokoban pit, or over a fire trap, triggers trap twice
Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
@@ -182,6 +182,7 @@ make it clear when a leprechaun dodges your attack
wizard mode #wizidentify can now select individual items for permanent
identification and don't display the selection to permanently
identify everything if everything is already fully identified
spiders will occasionally spin webs when moving around
Code Cleanup and Reorganization

View File

@@ -571,7 +571,7 @@ int x, y;
int ox, oy, *range = (int *) arg;
struct obj *obj;
struct monst *mon;
boolean may_pass = TRUE;
boolean may_pass = TRUE, via_jumping, stopping_short;
struct trap *ttmp;
int dmg = 0;
@@ -583,6 +583,8 @@ int x, y;
} else if (*range == 0) {
return FALSE; /* previous step wants to stop now */
}
via_jumping = (EWwalking & I_SPECIAL) != 0L;
stopping_short = (via_jumping && *range < 2);
if (!Passes_walls || !(may_pass = may_passwall(x, y))) {
boolean odoor_diag = (IS_DOOR(levl[x][y].typ)
@@ -710,12 +712,17 @@ int x, y;
vision_recalc(1); /* update for new position */
flush_screen(1);
if (is_pool(x, y) && !u.uinwater
&& ((Is_waterlevel(&u.uz) && levl[x][y].typ == WATER)
|| !(Levitation || Flying || Wwalking))) {
multi = 0; /* can move, so drown() allows crawling out of water */
(void) drown();
return FALSE;
if (is_pool(x, y) && !u.uinwater) {
if ((Is_waterlevel(&u.uz) && levl[x][y].typ == WATER)
|| !(Levitation || Flying || Wwalking)) {
multi = 0; /* can move, so drown() allows crawling out of water */
(void) drown();
return FALSE;
} else if (!Is_waterlevel(&u.uz) && !stopping_short) {
Norep("You move over %s.", an(is_moat(x, y) ? "moat" : "pool"));
}
} else if (is_lava(x, y) && !stopping_short) {
Norep("You move over some lava.");
}
/* FIXME:
@@ -727,7 +734,9 @@ int x, y;
* ones that we have not yet tested.
*/
if ((ttmp = t_at(x, y)) != 0) {
if (ttmp->ttyp == MAGIC_PORTAL) {
if (stopping_short) {
; /* see the comment above hurtle_jump() */
} else if (ttmp->ttyp == MAGIC_PORTAL) {
dotrap(ttmp, 0);
return FALSE;
} else if (ttmp->ttyp == VIBRATING_SQUARE) {
@@ -738,8 +747,10 @@ int x, y;
} else if ((ttmp->ttyp == PIT || ttmp->ttyp == SPIKED_PIT
|| ttmp->ttyp == HOLE || ttmp->ttyp == TRAPDOOR)
&& Sokoban) {
/* Air currents overcome the recoil */
dotrap(ttmp, 0);
/* air currents overcome the recoil in Sokoban;
when jumping, caller performs last step and enters trap */
if (!via_jumping)
dotrap(ttmp, 0);
*range = 0;
return TRUE;
} else {