fix #H9391 - slippery gloves

Slippery fingers would transfer from bare hands to gloved hands if
you put gloves on.  The reverse, transfering from gloves to bare
hands when taking gloves off, was already being prevented for
directly taking them off, but still allowed the slipperiness to
transfer when gloves were lost.  This prevents putting on gloves
when fingers are slippery and attempts to handle cases where gloves
get unworn by ways other than 'T' (or 'R') or 'A'.

There's no slippery attribute for objects (way too much work for too
little value); slippery gloves is just the combination of wearing
gloves and having slippery fingers (which now has to have happened
while already wearing those gloves).  This changes inventory to use
"(being worn; slippery)" when applicable and much of the patch deals
with funnelling Glib changes through new make_glib() to try to make
sure that persistent inventory adds or removes "; slippery" right
away when changes happen.

If gloves are taken off involuntarily (shapechange to a form that
can't wear them, destruction via scroll of destroy armor or monster
spell of same or via overenchantment, theft), slippery fingers ends
right away instead of the usual few turns later.
This commit is contained in:
PatR
2019-11-09 01:07:09 -08:00
parent 7da9104fac
commit 0615387f95
10 changed files with 121 additions and 33 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 potion.c $NHDT-Date: 1572887644 2019/11/04 17:14:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.164 $ */
/* NetHack 3.6 potion.c $NHDT-Date: 1573290421 2019/11/09 09:07:01 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.165 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2013. */
/* NetHack may be freely redistributed. See license for details. */
@@ -440,6 +440,17 @@ boolean talk;
}
}
/* set or clear "slippery fingers" */
void
make_glib(xtime)
int xtime;
{
set_itimeout(&Glib, xtime);
/* may change "(being worn)" to "(being worn; slippery)" or vice versa */
if (uarmg)
update_inventory();
}
void
self_invis_message()
{
@@ -2127,8 +2138,9 @@ dodip()
fire_damage(obj, TRUE, u.ux, u.uy);
} else if (potion->cursed) {
pline_The("potion spills and covers your %s with oil.",
makeplural(body_part(FINGER)));
incr_itimeout(&Glib, d(2, 10));
!uarmg ? makeplural(body_part(FINGER))
: gloves_simple_name(uarmg));
make_glib((int) (Glib & TIMEOUT) + d(2, 10));
} else if (obj->oclass != WEAPON_CLASS && !is_weptool(obj)) {
/* the following cases apply only to weapons */
goto more_dips;