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

Function outrumor

src/rumors.c:528–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526}
527
528void
529outrumor(
530 int truth, /* 1=true, -1=false, 0=either */
531 int mechanism)
532{
533 static const char fortune_msg[] =
534 "This cookie has a scrap of paper inside.";
535 const char *line;
536 char buf[BUFSZ];
537 boolean reading = (mechanism == BY_COOKIE || mechanism == BY_PAPER);
538
539 if (reading) {
540 /* deal with various things that prevent reading */
541 if (is_fainted() && mechanism == BY_COOKIE) {
542 return;
543 } else if (Blind) {
544 if (mechanism == BY_COOKIE)
545 pline(fortune_msg);
546 pline("What a pity that you cannot read it!");
547 return;
548 }
549 }
550
551 line = getrumor(truth, buf, reading ? FALSE : TRUE);
552 if (!*line)
553 line = "NetHack rumors file closed for renovation.";
554 switch (mechanism) {
555 case BY_ORACLE:
556 /* Oracle delivers the rumor */
557 pline("True to her word, the Oracle %ssays: ",
558 (!rn2(4) ? "offhandedly "
559 : (!rn2(3) ? "casually "
560 : (rn2(2) ? "nonchalantly " : ""))));
561 SetVoice((struct monst *) 0, 0, 80, voice_oracle);
562 verbalize1(line);
563 /* [WIS exercised by getrumor()] */
564 return;
565 case BY_COOKIE:
566 pline(fortune_msg);
567 FALLTHROUGH;
568 /* FALLTHRU */
569 case BY_PAPER:
570 pline("It reads:");
571 break;
572 }
573 pline1(line);
574}
575
576staticfn void
577init_oracles(dlb *fp)

Callers 3

fpostfxFunction · 0.85
doreadFunction · 0.85
doconsultFunction · 0.85

Calls 4

is_faintedFunction · 0.85
getrumorFunction · 0.85
rn2Function · 0.85
plineFunction · 0.70

Tested by

no test coverage detected