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.
This commit is contained in:
PatR
2022-05-27 15:28:49 -07:00
parent 5c1e22b337
commit 01f3be9a7c
2 changed files with 20 additions and 3 deletions

View 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) \

View 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));