/* Performs the actions associated with 'just praying' at the altar. Called when the user responds 'just pray' when in prompt mode, or enters 0 to the money prompt when praying. Assumes cursors(), and that any leading \n have been printed */ void act_just_pray(void) { if (rnd(100)<75) lprcat("nothing happens"); else if (rnd(43) == 10) { if (c[WEAR]) lprcat("You feel your armor vibrate for a moment"); enchantarmor(); return; } else if (rnd(43) == 10) { if (c[WIELD]) lprcat("You feel your weapon vibrate for a moment"); enchweapon(); return; } else createmonster(makemonst(level+1)); return; }
/* * ****** * OALTAR * ****** * */ void oaltar() { long k; int p; start: lprcat("\nDo you (p) pray (d) desecrate"); iopts(); while (1) { while (1) switch(getcharacter()) { case 'p': lprcat(" pray.\nDo you (m) give money or (j) just pray? "); while (1) switch(getcharacter()) { case 'j': p = rund(100); if (p < 12) createmonster(makemonst(level+2)); else if (p < 17) enchweapon(ENCH_ALTAR); else if (p < 22) enchantarmor(ENCH_ALTAR); else if (p < 27) ohear(); else lprcat("\nNothing happens."); return; case 'm': cursor(1,24); cltoeoln(); cursor(1,23); cltoeoln(); lprcat("how much do you donate? "); if ((k = readnum(c[GOLD])) < 0) goto start; if (c[GOLD] < k) { lprcat("You don't have that much!"); nap(1001); goto start; } if (k < (c[GOLD]/10) && rnd(60)<30 && !wizard) { lprcat("Cheapskate! The Gods are insulted by such a " "tiny offering!"); forget(); createmonster(DEMONPRINCE); c[AGGRAVATE] += 1500; return; } c[GOLD] -= k; if (k < (c[GOLD]+k)/10 || k < rnd(50) && !wizard) { createmonster(makemonst(level+2)); c[AGGRAVATE] += 500; bottomline(); return; } p = rund(16); if (p < 4) lprcat("Thank you."); else if (p < 6) { enchantarmor(ENCH_ALTAR); enchantarmor(ENCH_ALTAR); } else if (p < 8) { enchweapon(ENCH_ALTAR); enchweapon(ENCH_ALTAR); } else ohear(); bottomline(); return; } /* end while switch : case j or m */ case 'd': lprcat(" desecrate"); if (rnd(100)<60) { createmonster(makemonst(level+3)+8); c[AGGRAVATE] += 2500; } else if(rnd(100)<5) raiselevel(); else if (rnd(101)<30) { lprcat("\nThe altar crumbles into a pile of dust before your eyes."); forget(); /*remember to destroy the altar*/ } else lprcat("\nNothing happens."); return; case 'i': case ESC: ignore(); if (rnd(100)<30) { createmonster(makemonst(level+2)); c[AGGRAVATE] += rnd(450); } else lprcat("\nNothing happens."); return; } /* end while switch: pray, des, ignore */ } /* NOTREACHED */ } /* end oaltar */
/* 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!"); } }
/* function to read a scroll */ void read_scroll(int typ) { int i,j; if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */ if (scrollknown[typ] == 0) scrollknown[typ] = 1; lprintf("\nYou read a scroll of %s.", &(scrollname[typ][1])); switch(typ) { case SENCHANTARM: enchantarmor(ENCH_SCROLL); return; case SENCHANTWEAP: enchweapon(ENCH_SCROLL); return; case SENLIGHTEN: lflush(); yh = min(playery+7,MAXY); xh = min(playerx+25,MAXX); yl = max(playery-7,0); xl = max(playerx-25,0); for (i=yl; i<yh; i++) for (j=xl; j<xh; j++) know[j][i]=1; nap(2000); draws(xl,xh,yl,yh); return; case SBLANK: return; case SCREATEMONST: createmonster(makemonst(level+1)); return; case SCREATEITEM: something(playerx, playery, level); return; case SAGGMONST: c[AGGRAVATE]+=800; return; case STIMEWARP: /* * This code is slightly wrong in that, if gtime is small and * we can't go back by the required number of mobuls, it's * still reported that we did. I don't think this is * critical -- dmr */ i = (rnd(1000) - 850)/100; if (i==0) i=1; gtime += 100*i; if (gtime < 0) gtime = 0; lprintf("\nYou go %sward in time by %d mobul%s", (i<0)?"back":"for", (i<0)?-i:i, i==1?"":"s"); adjusttime((long)(i*100));/* adjust time for time warping */ return; case STELEPORT: oteleport(0); return; case SAWARENESS: c[AWARENESS] += 1800; return; case SHASTEMONST: c[HASTEMONST] += rnd(55)+12; lprintf(" You feel nervous."); return; case SMONSTHEAL: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) if (mitem[j][i].mon) hitp[j][i] = monster[mitem[j][i].mon].hitpoints; lprintf(" You feel uneasy."); return; case SSPIRITPROT: c[SPIRITPRO] += 300 + rnd(200); bottomline(); return; case SUNDEADPROT: c[UNDEADPRO] += 300 + rnd(200); bottomline(); return; case SSTEALTH: c[STEALTH] += 250 + rnd(250); bottomline(); return; case SMAGICMAP: lflush(); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=1; nap(2000); draws(0,MAXX,0,MAXY); return; case SHOLDMONST: c[HOLDMONST] += 30; bottomline(); return; case SGEMPERFECT: for (i=0; i<IVENSIZE; i++) switch(iven[i]) { case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE: j = ivenarg[i]; j *= 2; if (j <= 0 && ivenarg[i]) j=2550; ivenarg[i] = j; break; } break; case SSPELLEXT: for (i=0; i<11; i++) c[exten[i]] <<= 1; break; case SIDENTIFY: for (i=0; i<IVENSIZE; i++) { if (iven[i]==OPOTION) potionknown[ivenarg[i]] = 1; if (iven[i]==OSCROLL) scrollknown[ivenarg[i]] = 1; } break; case SREMCURSE: removecurse(); break; case SANNIHILATE: annihilate(); break; case SPULVERIZE: godirect(22,150,"The ray hits the %s.",0,' '); break; case SLIFEPROT: c[LIFEPROT]++; break; }; }