]> granicus.if.org Git - nethack/commitdiff
more #802 - lava travel rather than running
authorPatR <rankin@nethack.org>
Mon, 4 Jul 2022 19:28:12 +0000 (12:28 -0700)
committerPatR <rankin@nethack.org>
Mon, 4 Jul 2022 19:28:12 +0000 (12:28 -0700)
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).

src/do.c
src/hack.c

index 7c6018f0014ee143193446b990275df1341bb42e..091808289e928551039a85c3fe8f4b85a27f90b5 100644 (file)
--- 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) {
index a2499852be25c3e8ef282b063323e32e98d2a3ab..7005d23471cf7092811c41061c7008379a53e1a7 100644 (file)
@@ -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;