discoverying water walking boots

If water walking boots haven't been discovered yet and underwater
hero rises to the surface when putting a pair on, discover them.

(Sinking while removing such on water already discovers them.)
This commit is contained in:
PatR
2025-01-02 23:12:15 -08:00
parent d3c57e1b42
commit ce947600e5
4 changed files with 24 additions and 0 deletions

View File

@@ -851,6 +851,8 @@ static const struct instance_globals_w g_init_w = {
/* decl.c */
0, /* warn_obj_cnt */
0L, /* wailmsg */
/* do_wear.c */
0U,
/* symbols.c */
DUMMY, /* warnsyms */
/* files.c */

View File

@@ -196,8 +196,22 @@ Boots_on(void)
case KICKING_BOOTS:
break;
case WATER_WALKING_BOOTS:
/*
* Sequencing issue? If underwater (perhaps via magical breathing),
* putting on water walking boots produces "you slowly rise above
* the surface" then "you finish your dressing maneuver".
*/
/* spoteffects() doesn't get called here; pooleffects() is called
during movement and u.uinwater is already False after setworn() */
if (u.uinwater)
spoteffects(TRUE);
/* init'd in accessory_or_armor_on() and only used here */
if (gw.wasinwater) {
if (!u.uinwater)
makeknown(WATER_WALKING_BOOTS);
gw.wasinwater = 0U;
}
/* (we don't need a lava check here since boots can't be
put on while feet are stuck) */
break;
@@ -2338,6 +2352,7 @@ accessory_or_armor_on(struct obj *obj)
*
obj->known = 1;
*/
gw.wasinwater = u.uinwater; /* for WWALKING; Boots_on() is too late */
setworn(obj, mask);
/* if there's no delay, we'll execute 'afternmv' immediately */
if (obj == uarm)
@@ -2367,6 +2382,8 @@ accessory_or_armor_on(struct obj *obj)
on_msg(obj);
}
svc.context.takeoff.mask = svc.context.takeoff.what = 0L;
/* gw.wasinwater = 0U; // can't clear this yet; Boots_on() needs it
* and gets called via afternmv() after this routine has returned */
} else { /* not armor */
if (ring) {
/* Ring_on() expects ring to already be worn as uleft or uright */