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:
+27
-5
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 do_wear.c $NHDT-Date: 1570566377 2019/10/08 20:26:17 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.111 $ */
|
||||
/* NetHack 3.6 do_wear.c $NHDT-Date: 1573290416 2019/11/09 09:06:56 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.112 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -562,6 +562,14 @@ Gloves_off(VOID_ARGS)
|
||||
context.takeoff.cancelled_don = FALSE;
|
||||
(void) encumber_msg(); /* immediate feedback for GoP */
|
||||
|
||||
/* usually can't remove gloves when they're slippery but it can
|
||||
be done by having them fall off (polymorph), stolen, or
|
||||
destroyed (scroll, overenchantment, monster spell); if that
|
||||
happens, 'cure' slippery fingers so that it doesn't transfer
|
||||
from gloves to bare hands */
|
||||
if (Glib)
|
||||
make_glib(0); /* for update_inventory() */
|
||||
|
||||
/* prevent wielding cockatrice when not wearing gloves */
|
||||
if (uwep && uwep->otyp == CORPSE)
|
||||
wielding_corpse(uwep, on_purpose);
|
||||
@@ -1586,7 +1594,7 @@ struct obj *otmp;
|
||||
else if (is_shield(otmp))
|
||||
(void) Shield_off();
|
||||
else
|
||||
setworn((struct obj *) 0, otmp->owornmask & W_ARMOR);
|
||||
(void) Armor_off();
|
||||
off_msg(otmp);
|
||||
}
|
||||
context.takeoff.mask = context.takeoff.what = 0L;
|
||||
@@ -1736,6 +1744,13 @@ boolean noisy;
|
||||
You("cannot wear gloves over your %s.",
|
||||
is_sword(uwep) ? c_sword : c_weapon);
|
||||
err++;
|
||||
} else if (Glib) {
|
||||
/* prevent slippery bare fingers from transferring to
|
||||
gloved fingers */
|
||||
if (noisy)
|
||||
Your("%s are too slippery to pull on %s.",
|
||||
makeplural(body_part(FINGER)), gloves_simple_name(otmp));
|
||||
err++;
|
||||
} else
|
||||
*mask = W_ARMG;
|
||||
} else if (is_shirt(otmp)) {
|
||||
@@ -1860,10 +1875,16 @@ struct obj *obj;
|
||||
}
|
||||
} while (!mask);
|
||||
}
|
||||
if (uarmg && Glib) {
|
||||
Your(
|
||||
"%s are too slippery to remove, so you cannot put on the ring.",
|
||||
gloves_simple_name(uarmg));
|
||||
return 1; /* always uses move */
|
||||
}
|
||||
if (uarmg && uarmg->cursed) {
|
||||
res = !uarmg->bknown;
|
||||
set_bknown(uarmg, 1);
|
||||
You("cannot remove your gloves to put on the ring.");
|
||||
You("cannot remove your %s to put on the ring.", c_gloves);
|
||||
return res; /* uses move iff we learned gloves are cursed */
|
||||
}
|
||||
if (uwep) {
|
||||
@@ -2264,8 +2285,9 @@ register struct obj *otmp;
|
||||
set_bknown(uwep, 1);
|
||||
return 0;
|
||||
} else if (Glib) {
|
||||
You_cant("take off the slippery %s with your slippery %s.",
|
||||
c_gloves, makeplural(body_part(FINGER)));
|
||||
pline("%s %s are too slippery to take off.",
|
||||
uarmg->unpaid ? "The" : "Your", /* simplified Shk_Your() */
|
||||
gloves_simple_name(uarmg));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user