]> granicus.if.org Git - nethack/commitdiff
couple of is_clinger bits
authorPatR <rankin@nethack.org>
Fri, 27 May 2022 22:28:49 +0000 (15:28 -0700)
committerPatR <rankin@nethack.org>
Fri, 27 May 2022 22:28:49 +0000 (15:28 -0700)
The grounded() macro wasn't fully handling is_clinger().  Not sure
what impact this fix will have.

Add ability to cling to the ceiling to enlightenment feedback.  If
it gets fixed up to a state where it is useable while polymorphed,
some or all of it should be moved to non-magic ^X feedback.

include/mondata.h
src/insight.c

index ba8760113f5552747b0382b9f9976038272540a1..e2cc238957e060a06c5c90ee5ffcbdafd0125b51 100644 (file)
@@ -38,7 +38,8 @@
 #define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT)
 /* clinger: piercers, mimics, wumpus -- generally don't fall down holes */
 #define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L)
-#define grounded(ptr) (!is_flyer(ptr) && !is_floater(ptr) && !is_clinger(ptr))
+#define grounded(ptr) (!is_flyer(ptr) && !is_floater(ptr) \
+                       && (!is_clinger(ptr) || !has_ceiling(&u.uz)))
 #define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L)
 #define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L)
 #define amphibious(ptr) \
index a9cb20ebcef7507f25e789fc1ef860f460c258b9..c0f574f15946b7083b336f9ca06f4e5674a907f7 100644 (file)
@@ -199,8 +199,7 @@ walking_on_water(void)
 {
     if (u.uinwater || Levitation || Flying)
         return FALSE;
-    return (boolean) (Wwalking
-                      && (is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)));
+    return (boolean) (Wwalking && is_pool_or_lava(u.ux, u.uy));
 }
 
 /* describe u.utraptype; used by status_enlightenment() and self_lookat() */
@@ -1643,6 +1642,23 @@ attributes_enlightenment(int unused_mode UNUSED, int final)
         }
         BFlying = save_BFly;
     }
+    /* including this might bring attention to the fact that ceiling
+       clinging has inconsistencies... */
+    if (is_clinger(g.youmonst.data)) {
+        boolean has_lid = has_ceiling(&u.uz);
+
+        if (has_lid && !u.uinwater) {
+            you_can("cling to the ceiling", "");
+        } else {
+            Sprintf(buf, " to the ceiling if %s%s%s",
+                    !has_lid ? "there was one" : "",
+                    (!has_lid && u.uinwater) ? " and " : "",
+                    u.uinwater ? (Underwater ? "you weren't underwater"
+                                  : "you weren't in the water") : "");
+            /* past tense is applicable for death while Unchanging */
+            enl_msg(You_, "could cling", "could have clung", buf, "");
+        }
+    }
     /* actively walking on water handled earlier as a status condition */
     if (Wwalking && !walking_on_water())
         you_can("walk on water", from_what(WWALKING));