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

Function make_hallucinated

src/potion.c:366–438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366DISABLE_WARNING_FORMAT_NONLITERAL
367
368boolean
369make_hallucinated(
370 long xtime, /* nonzero if this is an attempt to turn on hallucination */
371 boolean talk,
372 long mask) /* nonzero if resistance status should change by mask */
373{
374 long old = HHallucination;
375 boolean changed = 0;
376 const char *message, *verb;
377
378 if (Unaware)
379 talk = FALSE;
380
381 message = (!xtime) ? "Everything %s SO boring now."
382 : "Oh wow! Everything %s so cosmic!";
383 verb = (!Blind) ? "looks" : "feels";
384
385 if (mask) {
386 if (HHallucination)
387 changed = TRUE;
388
389 if (!xtime)
390 EHalluc_resistance |= mask;
391 else
392 EHalluc_resistance &= ~mask;
393 } else {
394 if (!EHalluc_resistance && (!!HHallucination != !!xtime))
395 changed = TRUE;
396 set_itimeout(&HHallucination, xtime);
397
398 /* clearing temporary hallucination without toggling vision */
399 if (!changed && !HHallucination && old && talk) {
400 if (!haseyes(gy.youmonst.data)) {
401 strange_feeling((struct obj *) 0, (char *) 0);
402 } else if (Blind) {
403 const char *eyes = body_part(EYE);
404
405 if (eyecount(gy.youmonst.data) != 1)
406 eyes = makeplural(eyes);
407 Your(eyemsg, eyes, vtense(eyes, "itch"));
408 } else { /* Grayswandir */
409 Your(vismsg, "flatten", "normal");
410 }
411 }
412 }
413
414 if (changed) {
415 /* in case we're mimicking an orange (hallucinatory form
416 of mimicking gold) update the mimicking's-over message */
417 if (!Hallucination)
418 eatmupdate();
419
420 if (u.uswallow) {
421 swallowed(0); /* redraw swallow display */
422 } else {
423 /* The see_* routines should be called *before* the pline. */

Callers 14

peffect_hallucinationFunction · 0.85
peffect_sicknessFunction · 0.85
peffect_extra_healingFunction · 0.85
peffect_full_healingFunction · 0.85
use_crystal_ballFunction · 0.85
dragon_armor_handlingFunction · 0.85
set_artifact_intrinsicFunction · 0.85
nh_timeoutFunction · 0.85
fix_worst_troubleFunction · 0.85
wiz_intrinsicFunction · 0.85
cpostfxFunction · 0.85
chest_trapFunction · 0.85

Calls 13

set_itimeoutFunction · 0.85
strange_feelingFunction · 0.85
body_partFunction · 0.85
makepluralFunction · 0.85
YourFunction · 0.85
vtenseFunction · 0.85
eatmupdateFunction · 0.85
swallowedFunction · 0.85
see_monstersFunction · 0.85
see_objectsFunction · 0.85
see_trapsFunction · 0.85
update_inventoryFunction · 0.85

Tested by

no test coverage detected