]> granicus.if.org Git - nethack/commitdiff
Make minliquid handle walls of water
authorPasi Kallinen <paxed@alt.org>
Wed, 23 Feb 2022 09:30:51 +0000 (11:30 +0200)
committerPasi Kallinen <paxed@alt.org>
Wed, 23 Feb 2022 09:30:51 +0000 (11:30 +0200)
src/mon.c

index 825601b1450df1cb207fad4cf98f97a15cd2bf7a..b2a25a4f5045e52909a83961f2a4672dba703534 100644 (file)
--- a/src/mon.c
+++ b/src/mon.c
@@ -708,6 +708,7 @@ static int
 minliquid_core(struct monst* mtmp)
 {
     boolean inpool, inlava, infountain;
+    boolean waterwall = (levl[mtmp->mx][mtmp->my].typ == WATER);
 
     /* [ceiling clingers are handled below] */
     inpool = (is_pool(mtmp->mx, mtmp->my)
@@ -723,7 +724,7 @@ minliquid_core(struct monst* mtmp)
        water location on the Plane of Water, flight and levitating
        are blocked so this (Flying || Levitation) test fails there
        and steed will be subject to water effects, as intended) */
-    if (mtmp == u.usteed && (Flying || Levitation))
+    if (mtmp == u.usteed && (Flying || Levitation) && !waterwall)
         return 0;
 
     /* Gremlin multiplying won't go on forever since the hit points
@@ -801,13 +802,13 @@ minliquid_core(struct monst* mtmp)
             }
             return 1;
         }
-    } else if (inpool) {
+    } else if (inpool || waterwall) {
         /* Most monsters drown in pools.  flooreffects() will take care of
          * water damage to dead monsters' inventory, but survivors need to
          * be handled here.  Swimmers are able to protect their stuff...
          */
-        if (!is_clinger(mtmp->data) && !is_swimmer(mtmp->data)
-            && !amphibious(mtmp->data)) {
+        if ((waterwall || !is_clinger(mtmp->data))
+            && !is_swimmer(mtmp->data) && !amphibious(mtmp->data)) {
             /* like hero with teleport intrinsic or spell, teleport away
                if possible */
             if (can_teleport(mtmp->data) && !tele_restrict(mtmp)) {