From: PatR Date: Fri, 27 May 2022 22:28:49 +0000 (-0700) Subject: couple of is_clinger bits X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01f3be9a7cf5f5be37c982dc013b9a2f6d920d0d;p=nethack couple of is_clinger bits 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. --- diff --git a/include/mondata.h b/include/mondata.h index ba8760113..e2cc23895 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -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) \ diff --git a/src/insight.c b/src/insight.c index a9cb20ebc..c0f574f15 100644 --- a/src/insight.c +++ b/src/insight.c @@ -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));