wanghao_branch
jiehaoxuan 1 year ago
parent b5d2e83695
commit 5a6249f280

@ -1,3 +1,4 @@
//2023/23/3 wh
/* NetHack 3.7 apply.c $NHDT-Date: 1695159606 2023/09/19 21:40:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */ /* NetHack 3.7 apply.c $NHDT-Date: 1695159606 2023/09/19 21:40:06 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.422 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */
@ -97,18 +98,18 @@ use_camera(struct obj *obj)
static int static int
use_towel(struct obj *obj) use_towel(struct obj *obj)
{ {
boolean drying_feedback = (obj == uwep); boolean drying_feedback = (obj == uwep); // Check if the object being used is the player's wielded weapon
if (!freehand()) { if (!freehand()) { // If the player doesn't have a free hand
You("have no free %s!", body_part(HAND)); You("have no free %s!", body_part(HAND)); // Display a message indicating that the player has no free hand
return ECMD_OK; return ECMD_OK; // Return with the result code ECMD_OK to indicate successful execution
} else if (obj == ublindf) { } else if (obj == ublindf) { // If the object being used is the player's blindfold
You("cannot use it while you're wearing it!"); You("cannot use it while you're wearing it!"); // Display a message indicating that the player cannot use the blindfold while wearing it
return ECMD_OK; return ECMD_OK; // Return with the result code ECMD_OK to indicate successful execution
} else if (obj->cursed) { } else if (obj->cursed) { // If the object being used is cursed
long old; long old;
switch (rn2(3)) { switch (rn2(3)) { // Randomly choose one of three cases
case 2: case 2:
old = (Glib & TIMEOUT); old = (Glib & TIMEOUT);
make_glib((int) old + rn1(10, 3)); /* + 3..12 */ make_glib((int) old + rn1(10, 3)); /* + 3..12 */
@ -116,7 +117,7 @@ use_towel(struct obj *obj)
(old ? "are filthier than ever" : "get slimy")); (old ? "are filthier than ever" : "get slimy"));
if (is_wet_towel(obj)) if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback); dry_a_towel(obj, -1, drying_feedback);
return ECMD_TIME; return ECMD_TIME; // Return with the result code ECMD_TIME to indicate that time has passed
case 1: case 1:
if (!ublindf) { if (!ublindf) {
old = u.ucreamed; old = u.ucreamed;
@ -143,20 +144,20 @@ use_towel(struct obj *obj)
} }
if (is_wet_towel(obj)) if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback); dry_a_towel(obj, -1, drying_feedback);
return ECMD_TIME; return ECMD_TIME; // Return with the result code ECMD_TIME to indicate that time has passed
case 0: case 0:
break; break;
} }
} }
if (Glib) { if (Glib) { // If the player's hands are slippery
make_glib(0); make_glib(0); // Remove slipperiness from the player's hands
You("wipe off your %s.", You("wipe off your %s.",
!uarmg ? makeplural(body_part(HAND)) : gloves_simple_name(uarmg)); !uarmg ? makeplural(body_part(HAND)) : gloves_simple_name(uarmg));
if (is_wet_towel(obj)) if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback); dry_a_towel(obj, -1, drying_feedback);
return ECMD_TIME; return ECMD_TIME; // Return with the result code ECMD_TIME to indicate that time has passed
} else if (u.ucreamed) { } else if (u.ucreamed) { // If the player's face is creamed
incr_itimeout(&HBlinded, (-1 * (int) u.ucreamed)); incr_itimeout(&HBlinded, (-1 * (int) u.ucreamed));
u.ucreamed = 0; u.ucreamed = 0;
if (!Blinded) { if (!Blinded) {
@ -170,13 +171,13 @@ use_towel(struct obj *obj)
} }
if (is_wet_towel(obj)) if (is_wet_towel(obj))
dry_a_towel(obj, -1, drying_feedback); dry_a_towel(obj, -1, drying_feedback);
return ECMD_TIME; return ECMD_TIME; // Return with the result code ECMD_TIME to indicate that time has passed
} }
Your("%s and %s are already clean.", body_part(FACE), Your("%s and %s are already clean.", body_part(FACE),
makeplural(body_part(HAND))); makeplural(body_part(HAND)));
return ECMD_OK; return ECMD_OK; // Return with the result code ECMD_OK to indicate successful execution
} }
/* maybe give a stethoscope message based on floor objects */ /* maybe give a stethoscope message based on floor objects */

Loading…
Cancel
Save