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

@@ -959,6 +959,8 @@ a hero on the quest home level who runs or travels past the quest leader and
gets tossed out of the quest for some reason would keep running on the
far side of the quest portal
allow rush/run over water if wearing discovered water walking boots
wearing water walking boots while underwater (maybe via magical breathing)
and rising to surface wasn't causing the boots to become discovered
flying pets wouldn't target underwater food but if they happened to fly over
such food they could and would eat it
praying on an altar with pet corpse on it can revive the pet

View File

@@ -1044,6 +1044,9 @@ struct instance_globals_w {
int warn_obj_cnt; /* count of monsters meeting criteria */
long wailmsg;
/* do_wear.c */
uint8 wasinwater;
/* symbols.c */
nhsym warnsyms[WARNCOUNT]; /* the current warning display symbols */

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 */