Exemple #1
0
/*
 *	subroutine to process an altar object
 */
void
oaltar(void)
{

	lprcat("\nDo you (p) pray  (d) desecrate");
	iopts();
	while (1) {
		while (1)
			switch (ttgetch()) {
			case 'p':
				lprcat(" pray\nDo you (m) give money or (j) just pray? ");
				while (1)
					switch (ttgetch()) {
					case 'j':
						act_just_pray();
						return;

					case 'm':
						act_donation_pray();
						return;

					case '\33':
						return;
					};

			case 'd':
				lprcat(" desecrate");
				act_desecrate_altar();
				return;

			case 'i':
			case '\33':
				ignore();
				act_ignore_altar();
				return;
			};
	}
}
Exemple #2
0
/*
    Perform the actions associated with praying at an altar and giving a
    donation.
*/
void act_donation_pray(void)
{
	unsigned long k,temp ;

    while (1)
        {
        lprcat("\n\n");
        cursor(1,24);
        cltoeoln();
        cursor(1,23);
        cltoeoln();
        lprcat("how much do you donate? ");
        k = readnum((long)c[GOLD]);

	lprcat("\n");

        /* make giving zero gold equivalent to 'just pray'ing.  Allows player to
           'just pray' in command mode, without having to add yet another command.
        */
        if (k == 0)
            {
            act_just_pray();
            return;
            }

        if (c[GOLD] >= k)
            {
            temp = c[GOLD] / 10 ;
            c[GOLD] -= k;
            bottomline();

            /* if player gave less than 10% of _original_ gold, make a monster
            */
            if (k < temp || k < rnd(50))
                {
                createmonster(makemonst(level+1));
                c[AGGRAVATE] += 200;
                return;
                }
            if (rnd(101) > 50)
                {
                act_prayer_heard();
                return;
                }
            if (rnd(43) == 5)
                {
                if (c[WEAR])
                    lprcat("You feel your armor vibrate for a moment");
                enchantarmor();
                return;
                }
            if (rnd(43) == 8)
                {
                if (c[WIELD])
                    lprcat("You feel your weapon vibrate for a moment");
                enchweapon();
                return;
                }

            lprcat("Thank You.");
            return ;
            }

        /* Player donates more gold than they have.  Loop back around so
           player can't escape the altar for free.
        */
        lprcat("You don't have that much!");
        }
}