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

Function use_magic_whistle

src/apply.c:494–514  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492}
493
494staticfn void
495use_magic_whistle(struct obj *obj)
496{
497 if (!can_blow(&gy.youmonst)) {
498 You("are incapable of using the whistle.");
499 } else if (obj->cursed && !rn2(2)) {
500 You("produce a %shigh-%s.", Underwater ? "very " : "",
501 Deaf ? "frequency vibration" : "pitched humming noise");
502 wake_nearby(TRUE);
503 if (!rn2(2) && !noteleport_level(&gy.youmonst))
504 tele_to_rnd_pet();
505 } else {
506 /* it's magic! it works underwater too (at a higher pitch) */
507 You(Deaf ? alt_whistle_str : whistle_str,
508 Hallucination ? "normal"
509 : (Underwater && !Deaf) ? "strange, high-pitched"
510 : "strange");
511 Soundeffect(se_shrill_whistle, 80);
512 magic_whistled(obj);
513 }
514}
515
516/* 'obj' is assumed to be a magic whistle */
517staticfn void

Callers 1

doapplyFunction · 0.85

Calls 7

can_blowFunction · 0.85
YouFunction · 0.85
rn2Function · 0.85
wake_nearbyFunction · 0.85
noteleport_levelFunction · 0.85
tele_to_rnd_petFunction · 0.85
magic_whistledFunction · 0.85

Tested by

no test coverage detected