MCPcopy Create free account
hub / github.com/NetHack/NetHack / use_towel

Function use_towel

src/apply.c:111–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

109}
110
111staticfn int
112use_towel(struct obj *obj)
113{
114 boolean drying_feedback = (obj == uwep);
115
116 if (!freehand()) {
117 You("have no free %s!", body_part(HAND));
118 return ECMD_OK;
119 } else if (obj == ublindf) {
120 You("cannot use it while you're wearing it!");
121 return ECMD_OK;
122 } else if (obj->cursed) {
123 long old;
124
125 switch (rn2(3)) {
126 case 2:
127 old = (Glib & TIMEOUT);
128 make_glib((int) old + rn1(10, 3)); /* + 3..12 */
129 Your("%s %s!", makeplural(body_part(HAND)),
130 (old ? "are filthier than ever" : "get slimy"));
131 if (is_wet_towel(obj))
132 dry_a_towel(obj, -1, drying_feedback);
133 return ECMD_TIME;
134 case 1:
135 if (!ublindf) {
136 old = u.ucreamed;
137 u.ucreamed += rn1(10, 3);
138 pline("Yecch! Your %s %s gunk on it!", body_part(FACE),
139 (old ? "has more" : "now has"));
140 make_blinded(BlindedTimeout + (long) u.ucreamed - old, TRUE);
141 } else {
142 const char *what;
143
144 what = (ublindf->otyp == LENSES)
145 ? "lenses"
146 : (obj->otyp == ublindf->otyp) ? "other towel"
147 : "blindfold";
148 if (ublindf->cursed) {
149 You("push your %s %s.", what,
150 rn2(2) ? "cock-eyed" : "crooked");
151 } else {
152 struct obj *saved_ublindf = ublindf;
153 You("push your %s off.", what);
154 Blindf_off(ublindf);
155 dropx(saved_ublindf);
156 }
157 }
158 if (is_wet_towel(obj))
159 dry_a_towel(obj, -1, drying_feedback);
160 return ECMD_TIME;
161 case 0:
162 break;
163 }
164 }
165
166 if (Glib) {
167 make_glib(0);
168 You("wipe off your %s.",

Callers 1

doapplyFunction · 0.85

Calls 15

freehandFunction · 0.85
YouFunction · 0.85
body_partFunction · 0.85
rn2Function · 0.85
make_glibFunction · 0.85
YourFunction · 0.85
makepluralFunction · 0.85
dry_a_towelFunction · 0.85
make_blindedFunction · 0.85
Blindf_offFunction · 0.85
dropxFunction · 0.85
gloves_simple_nameFunction · 0.85

Tested by

no test coverage detected