void ocookie() { char *fortune(), *p; lprcat("\nDo you (e) eat it, (t) take it"); iopts(); while (1) switch(getcharacter()) { case ESC: case 'i': ignore(); return; case 'e': lprcat("eat.\nThe cookie tasted good."); forget(); /* no more cookie */ if (c[BLINDCOUNT]) return; if ((p=fortune(fortfile))==(char *)NULL) return; lprcat(" A message inside the cookie reads:\n"); lprcat(p); return; case 't': lprcat("take."); if (take(OCOOKIE,0)==0) forget(); return; }; }
/* subroutine to process a throne object */ void othrone(int arg) { lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts(); while (1) { while (1) switch (ttgetch()) { case 'p': lprcat(" pry off"); act_remove_gems(arg); return; case 's': lprcat(" sit down"); act_sit_throne(arg); return; case 'i': case '\33': ignore(); return; }; } }
/* ******* OSCROLL ******* function to process a magic scroll */ void oscroll(int typ) { lprcat("\nDo you "); if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts(); while (1) switch(getcharacter()) { case ESC: case 'i': ignore(); return; case 'r': if (c[BLINDCOUNT]) break; lprcat("read."); forget(); if (typ==2 || typ==15) { show1cell(playerx,playery); cursors(); } /* destroy it */ read_scroll(typ); return; case 't': lprcat("take."); if (take(OSCROLL,typ)==0) forget(); /* destroy it */ return; }; }
void obook() { lprcat("\nDo you "); if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts(); while (1) switch(getcharacter()) { case ESC: case 'i': ignore(); return; case 'r': if (c[BLINDCOUNT]) break; lprcat("read."); readbook(iarg[playerx][playery]); /* no more book */ forget(); return; case 't': lprcat("take."); if (take(OBOOK,iarg[playerx][playery])==0) forget(); /* no more book */ return; }; }
void odeadthrone() { int k; lprcat("\nDo you (s) sit down"); iopts(); while (1) { while (1) switch(getcharacter()) { case 's': lprcat(" sit down"); k=rnd(101); if (k<5) raiselevel(); else if (k<25) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); } else lprcat("\nNothing happens."); return; case 'i': case ESC: ignore(); return; }; } /* NOTREACHED */ }
void odeadthrone(void) { int k; lprcat("\nDo you (s) sit down"); iopts(); while (1) { while (1) switch (ttgetch()) { case 's': lprcat(" sit down"); k = rnd(101); if (k < 35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); } else lprcat("\nnothing happens"); return; case 'i': case '\33': ignore(); return; }; } }
/* process a fountain object */ void ofountain(void) { cursors(); lprcat("\nDo you (d) drink, (w) wash yourself"); iopts(); while (1) switch (ttgetch()) { case 'd': lprcat("drink"); act_drink_fountain(); return; case '\33': case 'i': ignore(); return; case 'w': lprcat("wash yourself"); act_wash_fountain(); return; } }
/* subroutine to process a throne object */ void ochest(void) { lprcat("\nDo you (t) take it, (o) try to open it"); iopts(); while (1) { while (1) switch (ttgetch()) { case 'o': lprcat(" open it"); act_open_chest(playerx, playery); return; case 't': lprcat(" take"); if (take(OCHEST, iarg[playerx][playery]) == 0) item[playerx][playery] = know[playerx][playery] = 0; return; case 'i': case '\33': ignore(); return; }; } }
/* * ******* * OTHRONE * ******* * */ void othrone(int arg) { int i,k; lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts(); while (1) { while (1) switch(getcharacter()) { case 'p': lprcat(" pry off"); k=rnd(101); if (k<25) { for (i=0; i<rnd(4); i++) creategem(); /*gems pop off the throne*/ item[playerx][playery]=ODEADTHRONE; know[playerx][playery]=0; } else if (k<40 && arg==0) { createmonster(GNOMEKING); item[playerx][playery]=OTHRONE2; know[playerx][playery]=0; } else lprcat("\nNothing happens."); return; case 's': lprcat(" sit down"); k=rnd(101); if (k<30 && arg==0) { createmonster(GNOMEKING); item[playerx][playery]=OTHRONE2; know[playerx][playery]=0; } else if (k<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); } else lprcat("\nNothing happens."); return; case 'i': case ESC: ignore(); return; }; } /* NOTREACHED */ }
/* * 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; }; } }
/* function to say what object we found and ask if player wants to take it */ void finditem(int itm) { int tmp,i; lprintf("\n\nYou find %s",objectname[itm]); tmp=iarg[playerx][playery]; switch(itm) { case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE: case OSPIRITSCARAB: case OORBOFDRAGON: case OORB: case OHANDofFEAR: case OWWAND: case OCUBEofUNDEAD: case ONOTHEFT: lprcat("."); break; default: if (tmp>0) lprintf(" + %d",(long)tmp); else if (tmp<0) lprintf(" %d",(long)tmp); } lprcat("\nDo you want to (t) take it"); iopts(); i=0; while (i!='t' && i!='i' && i!=ESC) i=getcharacter(); if (i == 't') { lprcat("take."); if (take(itm,tmp)==0) forget(); return; } ignore(); }
/* ******* OPOTION ******* function to process a potion */ void opotion(int pot) { lprcat("\nDo you (d) drink it, (t) take it"); iopts(); while (1) switch(getcharacter()) { case ESC: case 'i': ignore(); return; case 'd': lprcat("drink.\n"); forget(); /* destroy potion */ quaffpotion(pot); return; case 't': lprcat("take.\n"); if (take(OPOTION,pot)==0) forget(); return; }; }
/* * ********* * OFOUNTAIN * ********* */ void ofountain() { int x; cursors(); lprcat("\nDo you (d) drink, (w) wash yourself"); iopts(); while (1) switch(getcharacter()) { case 'd': lprcat("drink"); if (rnd(1501)<4) { lprcat("\nOH MY GOD!! You have caught the *dreadful sleep*!"); beep(); lflush(); sleep(3); died(280); return; } x = rnd(100); if (x==1) raiselevel(); else if (x < 11) { x=rnd((level<<2)+2); lprintf("\nBleah! The water tasted like stale gatorade! " "You lose %d hit point%s!", (long)x, x==1?"":"s"); lastnum=273; losehp(x); bottomline(); cursors(); } else if (x<14) { c[HALFDAM] += 200+rnd(200); lprcat("\nThe water makes you vomit."); } else if (x<17) quaffpotion(17); /* giant strength */ else if (x < 45) lprcat("\nNothing seems to have happened."); else if (rnd(3) != 2) fntchange(1); /*change char levels upward*/ else fntchange(-1); /*change char levels downward*/ if (rnd(12)<3) { lprcat("\nThe fountains bubbling slowly quietens."); /* dead fountain */ item[playerx][playery]=ODEADFOUNTAIN; know[playerx][playery]=0; } return; case 'i': case ESC: ignore(); return; case 'w': lprcat("wash yourself."); if (rnd(100) < 11) { x=rnd((level<<2)+2); lprintf("\nThe water burns like acid! You lose %d hit point%s!", (long)x, x==1?"":"s"); lastnum=273; losehp(x); bottomline(); cursors(); } else if (rnd(100) < 29) lprcat("\nYou are now clean."); else if (rnd(100) < 31) lprcat("\nThis water needs soap -- the dirt didn't come off."); else if (rnd(100) < 34) createmonster(WATERLORD); else lprcat("\nNothing seems to have happened."); return; } }
/* * ****** * OCHEST * ****** * */ void ochest() { int i,k; lprcat("\nDo you (t) take it, (o) try to open it"); iopts(); while (1) { while (1) switch(getcharacter()) { case 'o': lprcat(" open it."); k=rnd(101); if (k<40) { lprcat("\nThe chest explodes as you open it."); beep(); i = rnd(10); if (i > c[HP]) i = c[HP]; lastnum=281; /* in case he dies */ lprintf("\nYou suffer %d hit point%s damage!", (long)i, i==1?"":"s"); checkloss(i); switch(rnd(10)) { case 1: c[ITCHING]+= rnd(1000)+100; lprcat("\nYou feel an irritation spread over your skin!"); beep(); break; case 2: c[CLUMSINESS]+= rnd(1600)+200; lprcat("\nYou begin to lose hand-eye co-ordination!"); beep(); break; case 3: c[HALFDAM]+= rnd(1600)+200; lprcat("\nYou suddenly feel sick and BARF all over your " "shoes!"); beep(); break; }; item[playerx][playery]=know[playerx][playery]=0; if (rnd(100)<69) creategem(); /* gems from the chest */ dropgold(rnd(110*iarg[playerx][playery]+200)); for (i=0; i<rnd(4); i++) something(playerx, playery, iarg[playerx][playery]+2); } else lprcat("\nNothing happens."); return; case 't': lprcat(" take"); if (take(OCHEST,iarg[playerx][playery])==0) item[playerx][playery]=know[playerx][playery]=0; return; case 'i': case ESC: ignore(); return; }; } /* NOTREACHED */ }
/* * ****** * 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 */
/* *************** LOOK_FOR_OBJECT *************** subroutine to look for an object and give the player his options if an object was found. */ lookforobject() { register int i,j; if (c[TIMESTOP]) return; /* can't find objects is time is stopped */ i=item[playerx][playery]; if (i==0) return; showcell(playerx,playery); cursors(); yrepcount=0; switch(i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: lprcat("\n\nYou have found some gold!"); ogold(i); break; case OPOTION: lprcat("\n\nYou have found a magic potion"); i = iarg[playerx][playery]; if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]); opotion(i); break; case OSCROLL: lprcat("\n\nYou have found a magic scroll"); i = iarg[playerx][playery]; if (scrollname[i][0]) lprintf(" of %s",&scrollname[i][1]); oscroll(i); break; case OALTAR: if (nearbymonst()) return; lprcat("\n\nThere is a Holy Altar here!"); oaltar(); break; case OBOOK: lprcat("\n\nYou have found a book."); obook(); break; case OCOOKIE: lprcat("\n\nYou have found a fortune cookie."); ocookie(); break; case OTHRONE: if (nearbymonst()) return; lprintf("\n\nThere is %s here!",objectname[i]); othrone(0); break; case OTHRONE2: if (nearbymonst()) return; lprintf("\n\nThere is %s here!",objectname[i]); othrone(1); break; case ODEADTHRONE: lprintf("\n\nThere is %s here!",objectname[i]); odeadthrone(); break; case OORB: lprcat("\n\nYou have found the Orb!!!!!"); oorb(); break; case OPIT: lprcat("\n\nYou're standing at the top of a pit."); opit(); break; case OSTAIRSUP: lprcat("\n\nThere is a circular staircase here"); ostairs(1); /* up */ break; case OELEVATORUP: lprcat("\n\nYou feel heavy for a moment, but the feeling disappears"); oelevator(1); /* up */ break; case OFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a fountain here"); ofountain(); break; case OSTATUE: if (nearbymonst()) return; lprcat("\n\nYou are standing in front of a statue"); ostatue(); break; case OCHEST: lprcat("\n\nThere is a chest here"); ochest(); break; case OIVTELETRAP: if (rnd(11)<6) return; item[playerx][playery] = OTELEPORTER; know[playerx][playery] = 1; case OTELEPORTER: lprcat("\nZaaaappp! You've been teleported!\n"); beep(); nap(3000); oteleport(0); break; case OSCHOOL: if (nearbymonst()) return; lprcat("\n\nYou have found the College of Larn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') { oschool(); /* the college of larn */ } else lprcat(" stay here"); break; case OMIRROR: if (nearbymonst()) return; lprcat("\n\nThere is a mirror here"); omirror(); break; case OBANK2: case OBANK: if (nearbymonst()) return; if (i==OBANK) lprcat("\n\nYou have found the bank of Larn."); else lprcat("\n\nYou have found a branch office of the bank of Larn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); j=0; while ((j!='g') && (j!='i') && (j!='\33')) j=getchar(); if (j == 'g') { if (i==OBANK) obank(); else obank2(); /* the bank of larn */ } else lprcat(" stay here"); break; case ODEADFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a dead fountain here"); break; case ODNDSTORE: if (nearbymonst()) return; lprcat("\n\nThere is a DND store here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') dndstore(); /* the dnd adventurers store */ else lprcat(" stay here"); break; case OSTAIRSDOWN: lprcat("\n\nThere is a circular staircase here"); ostairs(-1); /* down */ break; case OELEVATORDOWN: lprcat("\n\nYou feel light for a moment, but the feeling disappears"); oelevator(-1); /* down */ break; case OOPENDOOR: lprintf("\n\nYou have found %s",objectname[i]); lprcat("\nDo you (c) close it"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); break; } lprcat("close"); forget(); item[playerx][playery]=OCLOSEDDOOR; iarg[playerx][playery]=0; playerx = lastpx; playery = lastpy; break; case OCLOSEDDOOR: lprintf("\n\nYou have found %s",objectname[i]); lprcat("\nDo you (o) try to open it"); iopts(); i=0; while ((i!='o') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); playerx = lastpx; playery = lastpy; break; } else { lprcat("open"); if (rnd(11)<7) { switch(iarg[playerx][playery]) { case 6: c[AGGRAVATE] += rnd(400); break; case 7: lprcat("\nYou are jolted by an electric shock "); lastnum=274; losehp(rnd(20)); bottomline(); break; case 8: loselevel(); break; case 9: lprcat("\nYou suddenly feel weaker "); if (c[STRENGTH]>3) c[STRENGTH]--; bottomline(); break; default: break; } playerx = lastpx; playery = lastpy; } else { forget(); item[playerx][playery]=OOPENDOOR; } } break; case OENTRANCE: lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]); lprcat("\nDo you (g) go inside"); iopts(); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') { newcavelevel(1); playerx=33; playery=MAXY-2; item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1]=0; draws(0,MAXX,0,MAXY); bot_linex(); return; } else ignore(); break; case OVOLDOWN: lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]); lprcat("\nDo you (c) climb down"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); break; } if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; } if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep(); lastnum=275; losehp(30+rnd(20)); bottomhp(); } else lprcat("climb down"); nap(3000); newcavelevel(MAXLEVEL); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */ if (item[j][i]==OVOLUP) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); } draws(0,MAXX,0,MAXY); bot_linex(); return; case OVOLUP: lprcat("\nYou have found "); lprcat(objectname[OVOLUP]); lprcat("\nDo you (c) climb up"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar(); if ((i=='\33') || (i=='i')) { ignore(); break; } if (level!=11) { lprcat("\nThe shaft only extends 8 feet upwards before you find a blockage!"); return; } if (packweight() > 45+5*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep(); lastnum=275; losehp(15+rnd(20)); bottomhp(); return; } lprcat("climb up"); lflush(); nap(3000); newcavelevel(0); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */ if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); } draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */ item[playerx][playery] = OTRAPARROW; know[playerx][playery] = 0; case OTRAPARROW: lprcat("\nYou are hit by an arrow"); beep(); /* for an arrow trap */ lastnum=259; losehp(rnd(10)+level); bottomhp(); return; case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */ item[playerx][playery] = ODARTRAP; know[playerx][playery] = 0; case ODARTRAP: lprcat("\nYou are hit by a dart"); beep(); /* for a dart trap */ lastnum=260; losehp(rnd(5)); if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3; bottomline(); return; case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */ item[playerx][playery] = OTRAPDOOR; know[playerx][playery] = 1; case OTRAPDOOR: lastnum = 272; /* a trap door */ if ((level==MAXLEVEL-1) || (level==MAXLEVEL+MAXVLEVEL-1)) { lprcat("\nYou fell through a bottomless trap door!"); beep(); nap(3000); died(271); } lprcat("\nYou fall through a trap door!"); beep(); /* for a trap door */ losehp(rnd(5+level)); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRADEPOST: if (nearbymonst()) return; lprcat("\nYou have found the Larn trading Post."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') otradepost(); else lprcat("stay here"); return; case OHOME: if (nearbymonst()) return; lprcat("\nYou have found your way home."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') ohome(); else lprcat("stay here"); return; case OWALL: break; case OANNIHILATION: died(283); return; /* annihilated by sphere of annihilation */ case OLRS: if (nearbymonst()) return; lprcat("\n\nThere is an LRS office here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar(); if (i == 'g') olrs(); /* the larn revenue service */ else lprcat(" stay here"); break; default: finditem(i); break; }; }
/* *************** LOOK_FOR_OBJECT *************** subroutine to look for an object and give the player his options if an object was found. */ lookforobject() { int i,j; /* can't find objects is time is stopped*/ if (c[TIMESTOP]) return; i=item[playerx][playery]; if (i==0) return; showcell(playerx,playery); cursors(); yrepcount=0; switch(i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: ogold(i); break; case OPOTION: lprcat("\n\nYou find a magic potion"); i = iarg[playerx][playery]; if (potionknown[i]) lprintf(" of %s",&potionname[i][1]); lprcat("."); opotion(i); break; case OSCROLL: lprcat("\n\nYou find a magic scroll"); i = iarg[playerx][playery]; if (scrollknown[i]) lprintf(" of %s",&scrollname[i][1]); lprcat("."); oscroll(i); break; case OALTAR: if (nearbymonst()) return; lprcat("\n\nThere is a holy altar here."); oaltar(); break; case OBOOK: lprcat("\n\nYou find a book."); obook(); break; case OCOOKIE: lprcat("\n\nYou find a fortune cookie."); ocookie(); break; case OTHRONE: if (nearbymonst()) return; lprintf("\n\nThere is %s here.",objectname[i]); othrone(0); break; case OTHRONE2: if (nearbymonst()) return; lprintf("\n\nThere is %s here.",objectname[i]); othrone(1); break; case ODEADTHRONE: lprintf("\n\nThere is %s here.",objectname[i]); odeadthrone(); break; case OORB: if (nearbymonst()) return; finditem(i); break; case OBRASSLAMP: lprcat("\nYou find a brass lamp."); lprcat("\nDo you want to (r) rub it, (t) take it, or (i) ignore it? "); i=0; while ((i!='r') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='r') { i=rnd(100); if (i>90) { lprcat("\nThe magic genie was very upset at being disturbed!"); lastnum = 286; losehp((int)c[HP]/2+1); beep(); } /* higher level, better chance of spell */ else if ( (rnd(100)+c[LEVEL]/2) > 80) { int a,b,d; lprcat("\nA magic genie appears!"); cursors(); lprcat("\n What spell would you like? : "); while ((a=getcharacter())=='D') { seemagic(99); cursors(); lprcat("\n What spell would you like? : "); } /* to escape casting a spell */ if (a==ESC) goto over; if ((b=getcharacter())==ESC) goto over; if ((d=getcharacter())==ESC) { over: lprcat("aborted"); return; } lprc('\n'); for (i=0; i<SPNUM; i++) if ((spelcode[i][0]==a) && (spelcode[i][1]==b) && (spelcode[i][2]==d)) { spelknow[i]=1; lprintf("\nSpell \"%s\": %s\n%s",spelcode[i], spelname[i],speldescript[i]); lprcat("\nThe genie prefers not to be disturbed " "again."); forget(); bottomline(); return; } lprcat("\nThe genie has never heard of such a spell!"); lprcat("\nThe genie prefers not to be disturbed again."); forget(); bottomline(); return; } else lprcat("\nnothing happened."); if (rnd(100) < 15) { lprcat("\nThe genie prefers not to be disturbed again!"); forget(); c[LAMP]=0; /* chance of finding lamp again */ } bottomline(); } else if (i=='t') { lprcat("take."); if (take(OBRASSLAMP,0)==0) forget(); } else lprcat("ignore."); return; case OWWAND: if (nearbymonst()) return; finditem(i); break; case OHANDofFEAR: if (nearbymonst()) return; finditem(i); break; case OPIT: lprcat("\n\nYou're standing at the top of a pit."); opit(); break; case OSTAIRSUP: lprcat("\n\nThere is a circular staircase here."); ostairs(1); /* up */ break; case OELEVATORUP: lprcat("\n\nYou have found an express elevator going up."); oelevator(1); /* up */ break; case OELEVATORDOWN: lprcat("\n\nYou have found an express elevator going down."); oelevator(-1); /* down */ break; case OFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a fountain here."); ofountain(); break; case OSTATUE: if (nearbymonst()) return; lprcat("\n\nYou stand before a statue."); ostatue(); break; case OCHEST: lprcat("\n\nThere is a chest here."); ochest(); break; case OIVTELETRAP: if (rnd(11)<6) return; item[playerx][playery] = OTELEPORTER; know[playerx][playery] = 1; case OTELEPORTER: lprcat("\nZaaaappp! You've been teleported!\n"); beep(); nap(3000); oteleport(0); break; case OSCHOOL: if (nearbymonst()) return; lprcat("\n\nYou have found the College of Ularn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') { oschool(); /* the college of larn */ } else lprcat(" stay here."); break; case OMIRROR: if (nearbymonst()) return; lprcat("\n\nThere is a mirror here."); omirror(); break; case OBANK2: case OBANK: if (nearbymonst()) return; if (i==OBANK) lprcat("\n\nYou have found the bank of Ularn."); else lprcat("\n\nYou have found a branch office of the bank of Ularn."); lprcat("\nDo you (g) go inside, or (i) stay here? "); j=0; while ((j!='g') && (j!='i') && (j!=ESC)) j=getcharacter(); if (j == 'g') { if (i==OBANK) obank(); else obank2(); /* the bank of larn */ } else lprcat(" stay here."); break; case ODEADFOUNTAIN: if (nearbymonst()) return; lprcat("\n\nThere is a dead fountain here."); break; case ODNDSTORE: if (nearbymonst()) return; lprcat("\n\nThere is a DND store here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') dndstore(); /* the dnd adventurers store */ else lprcat(" stay here."); break; case OSTAIRSDOWN: lprcat("\n\nThere is a circular staircase here."); ostairs(-1); /* down */ break; case OOPENDOOR: lprcat("\nThere is an open door here."); break; case OCLOSEDDOOR: if (dropflag) return; lprintf("\n\nYou find %s",objectname[i]); lprcat("\nDo you (o) try to open it"); iopts(); i=0; while ((i!='o') && (i!='i') && (i!=ESC)) i=getcharacter(); if ((i==ESC) || (i=='i')) { ignore(); playerx = lastpx; playery = lastpy; break; } else { lprcat("open."); if (rnd(11)<7) { switch(iarg[playerx][playery]) { case 6: c[AGGRAVATE] += rnd(400); break; case 7: case 8: lprcat("\nYou are jolted by an electric shock!"); lastnum=274; losehp(rnd(20)); bottomline(); break; /* Losing a level is just too harsh... */ /* case 8: loselevel(); break; */ case 9: lprcat("\nYou suddenly feel weaker!"); if (c[STRENGTH]>3) c[STRENGTH]--; bottomline(); break; default: break; } playerx = lastpx; playery = lastpy; } else { forget(); item[playerx][playery]=OOPENDOOR; } } break; case OENTRANCE: lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]); lprcat("\nDo you (g) go inside"); iopts(); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') { newcavelevel(1); playerx=33; playery=MAXY-2; item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1].mon=0; draws(0,MAXX,0,MAXY); bot_linex(); return; } else ignore(); break; case OVOLDOWN: lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]); lprcat("\nDo you (c) climb down"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!=ESC)) i=getcharacter(); if ((i==ESC) || (i=='i')) { ignore(); break; } if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; } if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft."); beep(); lastnum=275; losehp(30+rnd(20)); bottomhp(); } else lprcat("climb down."); nap(3000); newcavelevel(DBOTTOM+1); /* down to V1 */ playerx = rnd(MAXX-2); playery = rnd(MAXY-2); positionplayer(); draws(0,MAXX,0,MAXY); bot_linex(); return; case OVOLUP: lprcat("\nYou have found "); lprcat(objectname[OVOLUP]); lprcat("\nDo you (c) climb up"); iopts(); i=0; while ((i!='c') && (i!='i') && (i!=ESC)) i=getcharacter(); if ((i==ESC) || (i=='i')) { ignore(); break; } if (packweight() > 40+5*(c[DEXTERITY]+c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft."); beep(); lastnum=275; losehp(15+rnd(20)); bottomhp(); return; } lprcat("climb up."); lflush(); nap(3000); newcavelevel(0); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */ if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); } draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */ item[playerx][playery] = OTRAPARROW; know[playerx][playery] = 0; case OTRAPARROW: lprcat("\nYou are hit by an arrow!"); beep(); /* for an arrow trap */ lastnum=259; losehp(rnd(10)+level); bottomhp(); return; case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */ item[playerx][playery] = ODARTRAP; know[playerx][playery] = 0; case ODARTRAP: lprcat("\nYou are hit by a dart!"); beep(); /* for a dart trap */ lastnum=260; losehp(rnd(5)); if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3; bottomline(); return; case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */ item[playerx][playery] = OTRAPDOOR; know[playerx][playery] = 1; case OTRAPDOOR: lastnum = 272; /* a trap door */ for (i=0;i<IVENSIZE;i++) if (iven[i]==OWWAND) { lprcat("\nYou escape a trap door."); return; } if ((level==DBOTTOM)||(level==VBOTTOM)) { lprcat("\nYou fall through a trap door leading straight to HELL!"); beep(); lflush(); nap(3000); died(271); } lprcat("\nYou fall through a trap door!"); beep(); lflush(); losehp(rnd(5+level)); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); bot_linex(); return; case OTRADEPOST: if (nearbymonst()) return; lprcat("\nYou have found the Ularn trading Post."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') otradepost(); else lprcat("stay here."); return; case OHOME: if (nearbymonst()) return; lprcat("\nYou have found your way home."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') ohome(); else lprcat("stay here."); return; case OPAD: if (nearbymonst()) return; lprcat("\nYou have found Dealer McDope's Hideout!"); lprcat("\nDo you (c) check it out, or (i) ignore it? "); i=0; while ((i!='c') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'c') opad(); else lprcat("forget it."); return; case OSPEED: lprcat("\nYou find some speed."); lprcat("\nDo you (s) snort it, (t) take it, or (i) ignore it? "); i=0; while ((i!='s') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='s') { lprcat("snort!"); lprcat("\nOhwowmanlikethingstotallyseemtoslowdown!"); c[HASTESELF] += 200 + c[LEVEL]; c[HALFDAM] += 300 + rnd(200); if ((c[INTELLIGENCE]-=2) < 3) c[INTELLIGENCE]=3; if ((c[WISDOM]-=2) < 3) c[WISDOM]=3; if ((c[CONSTITUTION]-=2) <3) c[CONSTITUTION]=3; if ((c[DEXTERITY]-=2) <3) c[DEXTERITY]=3; if ((c[STRENGTH]-=2) <3) c[STRENGTH]=3; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OSPEED,0)==0) forget(); } else lprcat("ignore."); break; case OSHROOMS: lprcat("\nYou find some magic mushrooms."); lprcat("\nDo you (e) eat them, (t) take them, or (i) ignore them? "); i=0; while ((i!='e') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='e') { lprcat("eat!"); lprcat("\nThings start to get real spacey..."); c[HASTEMONST] += rnd(75) + 25; c[CONFUSE] += 30+rnd(10); c[WISDOM]+=2; c[CHARISMA]+=2; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OSHROOMS,0)==0) forget(); } else lprcat("ignore."); break; case OACID: lprcat("\nYou find some LSD."); lprcat("\nDo you (e) eat it, (t) take it, or (i) ignore it? "); i=0; while ((i!='e') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='e') { lprcat("eat!"); lprcat("\nYou are now frying your ass off!"); c[CONFUSE]+=30+rnd(10); c[WISDOM]+=2; c[INTELLIGENCE]+=2; c[AWARENESS]+=1500; c[AGGRAVATE]+=1500; { int j,k; /* heal monsters */ for(j=0;j<MAXY;j++) for(k=0;k<MAXX;k++) if (mitem[k][j].mon) hitp[k][j]=monster[mitem[k][j].mon].hitpoints; } forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OACID,0)==0) forget(); } else lprcat("ignore."); break; case OHASH: lprcat("\nYou find some hashish."); lprcat("\nDo you (s) smoke it, (t) take it, or (i) ignore it? "); i=0; while ((i!='s') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='s') { lprcat("smoke!"); lprcat("\nWOW! You feel stooooooned..."); c[HASTEMONST]+=rnd(75)+25; c[INTELLIGENCE]+=2; c[WISDOM]+=2; if( (c[CONSTITUTION]-=2) < 3) c[CONSTITUTION]=3; if( (c[DEXTERITY]-=2) < 3) c[DEXTERITY]=3; c[HALFDAM]+=300+rnd(200); c[CLUMSINESS]+=rnd(1800)+200; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OHASH,0)==0) forget(); } else lprcat("ignore."); break; case OCOKE: lprcat("\nYou find some cocaine."); lprcat("\nDo you want to (s) snort it, (t) take it, or (i) ignore it? "); i=0; while ((i!='s') && (i!='i') && (i!='t') && (i!=ESC)) i=getcharacter(); if (i=='s') { lprcat("snort!"); lprcat("\nYour nose begins to bleed!"); if ((c[DEXTERITY]-=2) <3) c[DEXTERITY]=3; if ((c[CONSTITUTION]-=2) <3) c[CONSTITUTION]=3; c[CHARISMA]+=3; for(i=0;i<6;i++) c[i]+=33; c[COKED]+=10; forget(); bottomline(); } else if (i=='t') { lprcat("take."); if (take(OCOKE,0)==0) forget(); } else lprcat("ignore."); break; case OWALL: break; case OANNIHILATION: for (i=0;i<IVENSIZE;i++) if (iven[i]==OSPHTALISMAN) { lprcat("\nThe Talisman of the Sphere protects you from " "annihilation!"); return; } /* annihilated by sphere of annihilation */ died(283); return; case OLRS: if (nearbymonst()) return; lprcat("\n\nThere is an LRS office here."); lprcat("\nDo you (g) go inside, or (i) stay here? "); i=0; while ((i!='g') && (i!='i') && (i!=ESC)) i=getcharacter(); if (i == 'g') olrs(); /* the larn revenue service */ else lprcat(" stay here."); break; default: finditem(i); break; }; }