From: PatR Date: Mon, 4 Jul 2022 19:28:12 +0000 (-0700) Subject: more #802 - lava travel rather than running X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb53addd149e22fcd0b9ca12dab6e5c7c45a6c31;p=nethack more #802 - lava travel rather than running Too many negations for my brain to cope with. I've tested travel properly this time, but not re-tested running (which shouldn't be affected by this code). --- diff --git a/src/do.c b/src/do.c index 7c6018f00..091808289 100644 --- a/src/do.c +++ b/src/do.c @@ -57,8 +57,10 @@ boulder_hits_pool( int chance = rn2(10); /* water: 90%; lava: 10% */ struct monst *mtmp; + /* chance for boulder to fill pool: Plane of Water==0%, + lava 10%, wall of water==50%, other water==90% */ fills_up = Is_waterlevel(&u.uz) ? FALSE - : (ltyp == WATER) ? (chance < 5) /* wall of water */ + : IS_WATERWALL(ltyp) ? (chance < 5) : lava ? (chance == 0) : (chance != 0); if (fills_up) { diff --git a/src/hack.c b/src/hack.c index a2499852b..7005d2347 100644 --- a/src/hack.c +++ b/src/hack.c @@ -1039,17 +1039,20 @@ test_move( if (g.context.run == 8 && (mode != DO_MOVE) && !u_at(x, y)) { struct trap *t = t_at(x, y); - if ((t && t->tseen && t->ttyp != VIBRATING_SQUARE) - || ((!Levitation && !Flying - /* FIXME: should be using lastseentyp[x][y] rather than - seen vector (ditto for WATERWALL below) */ - && levl[x][y].seenv && is_pool_or_lava(x, y)) - /* is_lava(ux,uy): don't move onto/over lava with known - lava-walking because it isn't completely safe, but do - continue to move over lava if already doing so */ - ? (is_lava(x, y) && Known_lwalking && is_lava(u.ux, u.uy)) - : Known_wwalking) /* must be seen && is_pool() to get here */ - || (IS_WATERWALL(levl[x][y].typ) && levl[x][y].seenv)) + if (t && t->tseen && t->ttyp != VIBRATING_SQUARE) + return (mode == TEST_TRAP); + + /* FIXME: should be using lastseentyp[x][y] rather than seen vector + */ + if ((levl[x][y].seenv && is_pool_or_lava(x, y)) /* known pool/lava */ + && (IS_WATERWALL(levl[x][y].typ) /* never enter wall of water */ + /* don't enter pool or lava (must be one of the two to + get here) unless flying or levitating or have known + water-walking for pool or known lava-walking and + already be on/over lava for lava */ + || !(Levitation || Flying + || (is_pool(x, y) ? Known_wwalking + : (Known_lwalking && is_lava(u.ux, u.uy)))))) return (mode == TEST_TRAP); } @@ -1592,12 +1595,12 @@ u_simple_floortyp(coordxy x, coordxy y) { boolean u_in_air = (Levitation || Flying || !grounded(g.youmonst.data)); - if (is_waterwall(x,y)) + if (is_waterwall(x, y)) return WATER; /* wall of water, fly/lev does not matter */ if (!u_in_air) { - if (is_pool(x,y)) + if (is_pool(x, y)) return POOL; - if (is_lava(x,y)) + if (is_lava(x, y)) return LAVAPOOL; } return ROOM;