MCPcopy Index your code
hub / github.com/NetHack/NetHack / make_blinded

Function make_blinded

src/potion.c:260–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258static const char eyemsg[] = "%s momentarily %s.";
259
260void
261make_blinded(long xtime, boolean talk)
262{
263 long old = BlindedTimeout;
264 boolean u_could_see, can_see_now;
265 const char *eyes;
266
267 /* we probe ahead in case the Eyes of the Overworld
268 are or will be overriding blindness */
269 u_could_see = !Blind;
270 set_itimeout(&HBlinded, xtime ? 1L : 0L);
271 can_see_now = !Blind;
272 set_itimeout(&HBlinded, old);
273
274 if (Unaware)
275 talk = FALSE;
276
277 if (can_see_now && !u_could_see) { /* regaining sight */
278 if (talk) {
279 if (Hallucination)
280 pline("Far out! Everything is all cosmic again!");
281 else
282 You("can see again.");
283 }
284 } else if (old && !xtime) {
285 /* clearing temporary blindness without toggling blindness */
286 if (talk) {
287 if (!haseyes(gy.youmonst.data) || PermaBlind) {
288 strange_feeling((struct obj *) 0, (char *) 0);
289 } else if (Blindfolded) {
290 eyes = body_part(EYE);
291 if (eyecount(gy.youmonst.data) != 1)
292 eyes = makeplural(eyes);
293 Your(eyemsg, eyes, vtense(eyes, "itch"));
294 } else { /* Eyes of the Overworld */
295 Your(vismsg, "brighten", Hallucination ? "sadder" : "normal");
296 }
297 }
298 }
299
300 if (u_could_see && !can_see_now) { /* losing sight */
301 if (talk) {
302 if (Hallucination)
303 pline("Oh, bummer! Everything is dark! Help!");
304 else
305 pline("A cloud of darkness falls upon you.");
306 }
307 /* Before the hero goes blind, set the ball&chain variables. */
308 if (Punished)
309 set_bc(0);
310 } else if (!old && xtime) {
311 /* setting temporary blindness without toggling blindness */
312 if (talk) {
313 if (!haseyes(gy.youmonst.data) || PermaBlind) {
314 strange_feeling((struct obj *) 0, (char *) 0);
315 } else if (Blindfolded) {
316 eyes = body_part(EYE);
317 if (eyecount(gy.youmonst.data) != 1)

Callers 15

throne_sit_effectFunction · 0.85
peffect_see_invisibleFunction · 0.85
peffect_blindnessFunction · 0.85
healupFunction · 0.85
potionbreatheFunction · 0.85
use_crystal_ballFunction · 0.85
mhitm_ad_blndFunction · 0.85
mcast_blind_youFunction · 0.85
scrollteleFunction · 0.85
wipeoffFunction · 0.85
invoke_healingFunction · 0.85
inside_gas_cloudFunction · 0.85

Calls 10

set_itimeoutFunction · 0.85
YouFunction · 0.85
strange_feelingFunction · 0.85
body_partFunction · 0.85
makepluralFunction · 0.85
YourFunction · 0.85
vtenseFunction · 0.85
set_bcFunction · 0.85
toggle_blindnessFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected