Example #1
0
char *random_engraving(char *outbuf)
{
	const char *rumor;

	/* a random engraving may come from the "rumors" file,
	   or from the list above */
	if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor)
	    strcpy(outbuf, random_mesg[rn2(SIZE(random_mesg))]);

	wipeout_text(outbuf, (int)(strlen(outbuf) / 4), 0);
	return outbuf;
}
Example #2
0
const char *
random_engraving(enum rng rng)
{
    const char *rumor;

    /* a random engraving may come from the "rumors" file, or from the list
       above */
    if (!rn2_on_rng(4, rng) ||
        !((rumor = getrumor(0, TRUE, NULL, rng))) || !*rumor)
        rumor = random_mesg[rn2_on_rng(SIZE(random_mesg), rng)];

    return eroded_text(rumor, (int)(strlen(rumor) / 4),
                       rn2_on_rng(255, rng) + 1);
}
Example #3
0
void
outrumor(int truth,     /* 1=true, -1=false, 0=either 3=potter*/
         int mechanism)
{
    static const char fortune_msg[] =
        "This cookie has a scrap of paper inside.";
    const char *line;
    char buf[BUFSZ];
    boolean reading = (mechanism == BY_COOKIE || mechanism == BY_PAPER);
    int truth_out;

    if (reading) {
        /* deal with various things that prevent reading */
        if (is_fainted() && mechanism == BY_COOKIE)
            return;
        else if (Blind) {
            if (mechanism == BY_COOKIE)
                pline(fortune_msg);
            pline("What a pity that you cannot read it!");
            return;
        }
    }
    else{
        truth=3; /* We're talking to Potter, we want the Potter quotes */
    }
    line = getrumor(truth, buf, reading ? FALSE : TRUE, &truth_out);
    if (truth_out)
        exercise(A_WIS, truth_out == 1);
    if (!*line)
        line = "NetHack rumors file closed for renovation.";
    switch (mechanism) {
    case BY_ORACLE:
        /* Oracle delivers the rumor */
        pline("True to his word, Potter %ssays: ",
              (!rn2(4) ? "nonchalantly "
               : (!rn2(3) ? "casually " : (rn2(2) ? "excitedly " : ""))));
        verbalize("%s", line);
        return;
    case BY_COOKIE:
        pline(fortune_msg);
        /* FALLTHRU */
    case BY_PAPER:
        pline("It reads:");
        break;
    }
    pline("%s", line);
}
Example #4
0
const char *
random_engraving()
{
	char *rumor, *s;

/* a random engraving may come from the "rumors" file, or from the
   list above */
	rumor = getrumor(0);
	if (rn2(4) && *rumor) {
		for (s = rumor; *s; s++)
			if (!rn2(7) && *s != ' ') *s = '?';
		if (s[-1] == '.') s[-1] = 0;
		return (const char *)rumor;
	}
	else
		return random_mesg[rn2(SIZE(random_mesg))];
}
Example #5
0
/* KMH -- Talking artifacts are finally implemented */
void arti_speak(struct obj *obj)
{
	const struct artifact *oart = get_artifact(obj);
	const char *line;
	char buf[BUFSZ];


	/* Is this a speaking artifact? */
	if (!oart || !(oart->spfx & SPFX_SPEAK))
		return;

	line = getrumor(bcsign(obj), buf, TRUE);
	if (!*line)
		line = "NitroHack rumors file closed for renovation.";
	pline("%s:", Tobjnam(obj, "whisper"));
	verbalize("%s", line);
	return;
}
Example #6
0
void
outrumor(int truth,     /* 1=true, -1=false, 0=either */
         int mechanism)
{
    static const char fortune_msg[] =
        "This cookie has a scrap of paper inside.";
    const char *line;
    boolean reading = (mechanism == BY_COOKIE || mechanism == BY_PAPER);
    int truth_out;

    if (reading) {
        /* deal with various things that prevent reading */
        if (u_helpless(hm_all) && mechanism == BY_COOKIE)
            return;
        else if (Blind) {
            if (mechanism == BY_COOKIE)
                pline(fortune_msg);
            pline("What a pity that you cannot read it!");
            return;
        }
    }
    line = getrumor(truth, reading ? FALSE : TRUE, &truth_out, rng_main);
    if (truth_out)
        exercise(A_WIS, truth_out == 1);
    if (!*line)
        line = "NetHack rumors file closed for renovation.";
    switch (mechanism) {
    case BY_ORACLE:
        /* Oracle delivers the rumor */
        pline("True to her word, the Oracle %ssays: ",
              (!rn2(4) ? "offhandedly "
               : (!rn2(3) ? "casually " : (rn2(2) ? "nonchalantly " : ""))));
        verbalize("%s", line);
        return;
    case BY_COOKIE:
        pline(fortune_msg);
        /* FALLTHRU */
    case BY_PAPER:
        pline("It reads:");
        break;
    }
    pline("%s", line);
}