1 /* object.c Larn is copyrighted 1986 by Noah Morgan. */
2 /* $FreeBSD: src/games/larn/object.c,v 1.4 1999/11/16 02:57:23 billf Exp $ */
3 /* $DragonFly: src/games/larn/object.c,v 1.2 2003/06/17 04:25:24 dillon Exp $ */
11 subroutine to look for an object and give the player his options
12 if an object was found.
17 if (c[TIMESTOP]) return; /* can't find objects is time is stopped */
18 i=item[playerx][playery]; if (i==0) return;
19 showcell(playerx,playery); cursors(); yrepcount=0;
22 case OGOLDPILE: case OMAXGOLD:
23 case OKGOLD: case ODGOLD: lprcat("\n\nYou have found some gold!"); ogold(i); break;
25 case OPOTION: lprcat("\n\nYou have found a magic potion");
26 i = iarg[playerx][playery];
27 if (potionname[i][0]) lprintf(" of %s",&potionname[i][1]); opotion(i); break;
29 case OSCROLL: lprcat("\n\nYou have found a magic scroll");
30 i = iarg[playerx][playery];
31 if (scrollname[i][0]) lprintf(" of %s",&scrollname[i][1]);
34 case OALTAR: if (nearbymonst()) return;
35 lprcat("\n\nThere is a Holy Altar here!"); oaltar(); break;
37 case OBOOK: lprcat("\n\nYou have found a book."); obook(); break;
39 case OCOOKIE: lprcat("\n\nYou have found a fortune cookie."); ocookie(); break;
41 case OTHRONE: if (nearbymonst()) return;
42 lprintf("\n\nThere is %s here!",objectname[i]); othrone(0); break;
44 case OTHRONE2: if (nearbymonst()) return;
45 lprintf("\n\nThere is %s here!",objectname[i]); othrone(1); break;
47 case ODEADTHRONE: lprintf("\n\nThere is %s here!",objectname[i]); odeadthrone(); break;
49 case OORB: lprcat("\n\nYou have found the Orb!!!!!"); oorb(); break;
51 case OPIT: lprcat("\n\nYou're standing at the top of a pit."); opit(); break;
53 case OSTAIRSUP: lprcat("\n\nThere is a circular staircase here"); ostairs(1); /* up */ break;
55 case OELEVATORUP: lprcat("\n\nYou feel heavy for a moment, but the feeling disappears");
56 oelevator(1); /* up */ break;
58 case OFOUNTAIN: if (nearbymonst()) return;
59 lprcat("\n\nThere is a fountain here"); ofountain(); break;
61 case OSTATUE: if (nearbymonst()) return;
62 lprcat("\n\nYou are standing in front of a statue"); ostatue(); break;
64 case OCHEST: lprcat("\n\nThere is a chest here"); ochest(); break;
66 case OIVTELETRAP: if (rnd(11)<6) return;
67 item[playerx][playery] = OTELEPORTER;
68 know[playerx][playery] = 1;
70 case OTELEPORTER: lprcat("\nZaaaappp! You've been teleported!\n");
71 beep(); nap(3000); oteleport(0);
74 case OSCHOOL: if (nearbymonst()) return;
75 lprcat("\n\nYou have found the College of Larn.");
76 lprcat("\nDo you (g) go inside, or (i) stay here? ");
77 i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
78 if (i == 'g') { oschool(); /* the college of larn */ }
79 else lprcat(" stay here");
82 case OMIRROR: if (nearbymonst()) return;
83 lprcat("\n\nThere is a mirror here"); omirror(); break;
86 case OBANK: if (nearbymonst()) return;
87 if (i==OBANK) lprcat("\n\nYou have found the bank of Larn.");
88 else lprcat("\n\nYou have found a branch office of the bank of Larn.");
89 lprcat("\nDo you (g) go inside, or (i) stay here? ");
90 j=0; while ((j!='g') && (j!='i') && (j!='\33')) j=getchar();
91 if (j == 'g') { if (i==OBANK) obank(); else obank2(); /* the bank of larn */ }
92 else lprcat(" stay here");
95 case ODEADFOUNTAIN: if (nearbymonst()) return;
96 lprcat("\n\nThere is a dead fountain here"); break;
98 case ODNDSTORE: if (nearbymonst()) return;
99 lprcat("\n\nThere is a DND store here.");
100 lprcat("\nDo you (g) go inside, or (i) stay here? ");
101 i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
103 dndstore(); /* the dnd adventurers store */
104 else lprcat(" stay here");
107 case OSTAIRSDOWN: lprcat("\n\nThere is a circular staircase here"); ostairs(-1); /* down */ break;
109 case OELEVATORDOWN: lprcat("\n\nYou feel light for a moment, but the feeling disappears");
110 oelevator(-1); /* down */
113 case OOPENDOOR: lprintf("\n\nYou have found %s",objectname[i]);
114 lprcat("\nDo you (c) close it"); iopts();
115 i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
116 if ((i=='\33') || (i=='i')) { ignore(); break; }
117 lprcat("close"); forget();
118 item[playerx][playery]=OCLOSEDDOOR;
119 iarg[playerx][playery]=0;
120 playerx = lastpx; playery = lastpy;
123 case OCLOSEDDOOR: lprintf("\n\nYou have found %s",objectname[i]);
124 lprcat("\nDo you (o) try to open it"); iopts();
125 i=0; while ((i!='o') && (i!='i') && (i!='\33')) i=getchar();
126 if ((i=='\33') || (i=='i'))
127 { ignore(); playerx = lastpx;
128 playery = lastpy; break; }
134 switch(iarg[playerx][playery])
136 case 6: c[AGGRAVATE] += rnd(400); break;
138 case 7: lprcat("\nYou are jolted by an electric shock ");
139 lastnum=274; losehp(rnd(20)); bottomline(); break;
141 case 8: loselevel(); break;
143 case 9: lprcat("\nYou suddenly feel weaker ");
144 if (c[STRENGTH]>3) c[STRENGTH]--;
149 playerx = lastpx; playery = lastpy;
153 forget(); item[playerx][playery]=OOPENDOOR;
158 case OENTRANCE: lprcat("\nYou have found "); lprcat(objectname[OENTRANCE]);
159 lprcat("\nDo you (g) go inside"); iopts();
160 i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
163 newcavelevel(1); playerx=33; playery=MAXY-2;
164 item[33][MAXY-1]=know[33][MAXY-1]=mitem[33][MAXY-1]=0;
165 draws(0,MAXX,0,MAXY); bot_linex(); return;
170 case OVOLDOWN: lprcat("\nYou have found "); lprcat(objectname[OVOLDOWN]);
171 lprcat("\nDo you (c) climb down"); iopts();
172 i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
173 if ((i=='\33') || (i=='i')) { ignore(); break; }
174 if (level!=0) { lprcat("\nThe shaft only extends 5 feet downward!"); return; }
175 if (packweight() > 45+3*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep();
176 lastnum=275; losehp(30+rnd(20)); bottomhp(); }
178 else lprcat("climb down"); nap(3000); newcavelevel(MAXLEVEL);
179 for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */
180 if (item[j][i]==OVOLUP) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); }
181 draws(0,MAXX,0,MAXY); bot_linex(); return;
183 case OVOLUP: lprcat("\nYou have found "); lprcat(objectname[OVOLUP]);
184 lprcat("\nDo you (c) climb up"); iopts();
185 i=0; while ((i!='c') && (i!='i') && (i!='\33')) i=getchar();
186 if ((i=='\33') || (i=='i')) { ignore(); break; }
187 if (level!=11) { lprcat("\nThe shaft only extends 8 feet upwards before you find a blockage!"); return; }
188 if (packweight() > 45+5*(c[STRENGTH]+c[STREXTRA])) { lprcat("\nYou slip and fall down the shaft"); beep();
189 lastnum=275; losehp(15+rnd(20)); bottomhp(); return; }
190 lprcat("climb up"); lflush(); nap(3000); newcavelevel(0);
191 for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) /* put player near volcano shaft */
192 if (item[j][i]==OVOLDOWN) { playerx=j; playery=i; j=MAXX; i=MAXY; positionplayer(); }
193 draws(0,MAXX,0,MAXY); bot_linex(); return;
195 case OTRAPARROWIV: if (rnd(17)<13) return; /* for an arrow trap */
196 item[playerx][playery] = OTRAPARROW;
197 know[playerx][playery] = 0;
199 case OTRAPARROW: lprcat("\nYou are hit by an arrow"); beep(); /* for an arrow trap */
200 lastnum=259; losehp(rnd(10)+level);
203 case OIVDARTRAP: if (rnd(17)<13) return; /* for a dart trap */
204 item[playerx][playery] = ODARTRAP;
205 know[playerx][playery] = 0;
207 case ODARTRAP: lprcat("\nYou are hit by a dart"); beep(); /* for a dart trap */
208 lastnum=260; losehp(rnd(5));
209 if ((--c[STRENGTH]) < 3) c[STRENGTH] = 3;
210 bottomline(); return;
212 case OIVTRAPDOOR: if (rnd(17)<13) return; /* for a trap door */
213 item[playerx][playery] = OTRAPDOOR;
214 know[playerx][playery] = 1;
216 case OTRAPDOOR: lastnum = 272; /* a trap door */
217 if ((level==MAXLEVEL-1) || (level==MAXLEVEL+MAXVLEVEL-1))
218 { lprcat("\nYou fell through a bottomless trap door!"); beep(); nap(3000); died(271); }
219 lprcat("\nYou fall through a trap door!"); beep(); /* for a trap door */
220 losehp(rnd(5+level));
221 nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); bot_linex();
225 case OTRADEPOST: if (nearbymonst()) return;
226 lprcat("\nYou have found the Larn trading Post.");
227 lprcat("\nDo you (g) go inside, or (i) stay here? ");
228 i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
229 if (i == 'g') otradepost(); else lprcat("stay here");
232 case OHOME: if (nearbymonst()) return;
233 lprcat("\nYou have found your way home.");
234 lprcat("\nDo you (g) go inside, or (i) stay here? ");
235 i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
236 if (i == 'g') ohome(); else lprcat("stay here");
241 case OANNIHILATION: died(283); return; /* annihilated by sphere of annihilation */
243 case OLRS: if (nearbymonst()) return;
244 lprcat("\n\nThere is an LRS office here.");
245 lprcat("\nDo you (g) go inside, or (i) stay here? ");
246 i=0; while ((i!='g') && (i!='i') && (i!='\33')) i=getchar();
248 olrs(); /* the larn revenue service */
249 else lprcat(" stay here");
252 default: finditem(i); break;
257 function to say what object we found and ask if player wants to take it
263 lprintf("\n\nYou have found %s ",objectname[itm]);
264 tmp=iarg[playerx][playery];
267 case ODIAMOND: case ORUBY: case OEMERALD:
268 case OSAPPHIRE: case OSPIRITSCARAB: case OORBOFDRAGON:
269 case OCUBEofUNDEAD: case ONOTHEFT: break;
272 if (tmp>0) lprintf("+ %d",(long)tmp); else if (tmp<0) lprintf(" %d",(long)tmp);
274 lprcat("\nDo you want to (t) take it"); iopts();
275 i=0; while (i!='t' && i!='i' && i!='\33') i=getchar();
277 { lprcat("take"); if (take(itm,tmp)==0) forget(); return; }
287 subroutine to process the stair cases
288 if dir > 0 the up else down
294 lprcat("\nDo you (s) stay here ");
295 if (dir > 0) lprcat("(u) go up "); else lprcat("(d) go down ");
296 lprcat("or (f) kick stairs? ");
298 while (1) switch(getchar())
301 case 's': case 'i': lprcat("stay here"); return;
303 case 'f': lprcat("kick stairs");
305 lprcat("\nI hope you feel better. Showing anger rids you of frustration.");
309 lprintf("\nYou hurt your foot dumb dumb! You suffer %d hit points",(long)k);
310 lastnum=276; losehp(k); bottomline();
314 case 'u': lprcat("go up");
315 if (dir < 0) lprcat("\nThe stairs don't go up!");
317 if (level>=2 && level!=11)
319 k = level; newcavelevel(level-1);
320 draws(0,MAXX,0,MAXY); bot_linex();
322 else lprcat("\nThe stairs lead to a dead end!");
325 case 'd': lprcat("go down");
326 if (dir > 0) lprcat("\nThe stairs don't go down!");
328 if (level!=0 && level!=10 && level!=13)
330 k = level; newcavelevel(level+1);
331 draws(0,MAXX,0,MAXY); bot_linex();
333 else lprcat("\nThe stairs lead to a dead end!");
344 subroutine to handle a teleport trap +/- 1 level maximum
350 if (err) if (rnd(151)<3) died(264); /* stuck in a rock */
351 c[TELEFLAG]=1; /* show ?? on bottomline if been teleported */
353 else if (level < MAXLEVEL)
354 { tmp=rnd(5)+level-3; if (tmp>=MAXLEVEL) tmp=MAXLEVEL-1;
357 { tmp=rnd(3)+level-2; if (tmp>=MAXLEVEL+MAXVLEVEL) tmp=MAXLEVEL+MAXVLEVEL-1;
358 if (tmp<MAXLEVEL) tmp=MAXLEVEL; }
359 playerx = rnd(MAXX-2); playery = rnd(MAXY-2);
360 if (level != tmp) newcavelevel(tmp); positionplayer();
361 draws(0,MAXX,0,MAXY); bot_linex();
369 function to process a potion
374 lprcat("\nDo you (d) drink it, (t) take it"); iopts();
375 while (1) switch(getchar())
378 case 'i': ignore(); return;
380 case 'd': lprcat("drink\n"); forget(); /* destroy potion */
381 quaffpotion(pot); return;
383 case 't': lprcat("take\n"); if (take(OPOTION,pot)==0) forget();
389 function to drink a potion
395 if (pot<0 || pot>=MAXPOTION) return; /* check for within bounds */
396 potionname[pot][0] = ' ';
399 case 9: lprcat("\nYou feel greedy . . ."); nap(2000);
400 for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
401 if ((item[j][i]==OGOLDPILE) || (item[j][i]==OMAXGOLD))
403 know[j][i]=1; show1cell(j,i);
405 showplayer(); return;
407 case 19: lprcat("\nYou feel greedy . . ."); nap(2000);
408 for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
411 if ((k==ODIAMOND) || (k==ORUBY) || (k==OEMERALD) || (k==OMAXGOLD)
412 || (k==OSAPPHIRE) || (k==OLARNEYE) || (k==OGOLDPILE))
414 know[j][i]=1; show1cell(j,i);
417 showplayer(); return;
419 case 20: c[HP] = c[HPMAX]; break; /* instant healing */
421 case 1: lprcat("\nYou feel better");
422 if (c[HP] == c[HPMAX]) raisemhp(1);
423 else if ((c[HP] += rnd(20)+20+c[LEVEL]) > c[HPMAX]) c[HP]=c[HPMAX]; break;
425 case 2: lprcat("\nSuddenly, you feel much more skillful!");
426 raiselevel(); raisemhp(1); return;
428 case 3: lprcat("\nYou feel strange for a moment");
431 case 4: lprcat("\nYou feel more self confident!");
432 c[WISDOM] += rnd(2); break;
434 case 5: lprcat("\nWow! You feel great!");
435 if (c[STRENGTH]<12) c[STRENGTH]=12; else c[STRENGTH]++; break;
437 case 6: lprcat("\nYour charm went up by one!"); c[CHARISMA]++; break;
439 case 8: lprcat("\nYour intelligence went up by one!");
440 c[INTELLIGENCE]++; break;
442 case 10: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
445 know[j][i]=1; show1cell(j,i);
447 /* monster detection */ return;
449 case 12: lprcat("\nThis potion has no taste to it"); return;
451 case 15: lprcat("\nWOW!!! You feel Super-fantastic!!!");
452 if (c[HERO]==0) for (i=0; i<6; i++) c[i] += 11;
453 c[HERO] += 250; break;
455 case 16: lprcat("\nYou have a greater intestinal constitude!");
456 c[CONSTITUTION]++; break;
458 case 17: lprcat("\nYou now have incredibly bulging muscles!!!");
459 if (c[GIANTSTR]==0) c[STREXTRA] += 21;
460 c[GIANTSTR] += 700; break;
462 case 18: lprcat("\nYou feel a chill run up your spine!");
463 c[FIRERESISTANCE] += 1000; break;
465 case 0: lprcat("\nYou fall asleep. . .");
466 i=rnd(11)-(c[CONSTITUTION]>>2)+2; while(--i>0) { parse2(); nap(1000); }
467 cursors(); lprcat("\nYou woke up!"); return;
469 case 7: lprcat("\nYou become dizzy!");
470 if (--c[STRENGTH] < 3) c[STRENGTH]=3; break;
472 case 11: lprcat("\nYou stagger for a moment . .");
473 for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
475 nap(2000); draws(0,MAXX,0,MAXY); /* potion of forgetfulness */ return;
477 case 13: lprcat("\nYou can't see anything!"); /* blindness */
478 c[BLINDCOUNT]+=500; return;
480 case 14: lprcat("\nYou feel confused"); c[CONFUSE]+= 20+rnd(9); return;
482 case 21: lprcat("\nYou don't seem to be affected"); return; /* cure dianthroritis */
484 case 22: lprcat("\nYou feel a sickness engulf you"); /* poison */
485 c[HALFDAM] += 200 + rnd(200); return;
487 case 23: lprcat("\nYou feel your vision sharpen"); /* see invisible */
488 c[SEEINVISIBLE] += rnd(1000)+400;
489 monstnamelist[INVISIBLESTALKER] = 'I'; return;
491 bottomline(); /* show new stats */ return;
499 function to process a magic scroll
505 if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts();
506 while (1) switch(getchar())
509 case 'i': ignore(); return;
511 case 'r': if (c[BLINDCOUNT]) break;
512 lprcat("read"); forget();
513 if (typ==2 || typ==15) { show1cell(playerx,playery); cursors(); }
514 /* destroy it */ read_scroll(typ); return;
516 case 't': lprcat("take"); if (take(OSCROLL,typ)==0) forget(); /* destroy it */
522 data for the function to read a scroll
524 static int xh,yh,yl,xl;
525 static char curse[] = { BLINDCOUNT, CONFUSE, AGGRAVATE, HASTEMONST, ITCHING,
526 LAUGHING, DRAINSTRENGTH, CLUMSINESS, INFEEBLEMENT, HALFDAM };
527 static char exten[] = { PROTECTIONTIME, DEXCOUNT, STRCOUNT, CHARMCOUNT,
528 INVISIBILITY, CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP };
529 char time_change[] = { HASTESELF,HERO,ALTPRO,PROTECTIONTIME,DEXCOUNT,
530 STRCOUNT,GIANTSTR,CHARMCOUNT,INVISIBILITY,CANCELLATION,
531 HASTESELF,AGGRAVATE,SCAREMONST,STEALTH,AWARENESS,HOLDMONST,HASTEMONST,
532 FIRERESISTANCE,GLOBE,SPIRITPRO,UNDEADPRO,HALFDAM,SEEINVISIBLE,
533 ITCHING,CLUMSINESS, WTW };
535 * function to adjust time when time warping and taking courses in school
541 for (j=0; j<26; j++) /* adjust time related parameters */
542 if (c[time_change[j]])
543 if ((c[time_change[j]] -= tim) < 1) c[time_change[j]]=1;
548 function to read a scroll
554 if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */
555 scrollname[typ][0] = ' ';
558 case 0: lprcat("\nYour armor glows for a moment"); enchantarmor(); return;
560 case 1: lprcat("\nYour weapon glows for a moment"); enchweapon(); return; /* enchant weapon */
562 case 2: lprcat("\nYou have been granted enlightenment!");
563 yh = min(playery+7,MAXY); xh = min(playerx+25,MAXX);
564 yl = max(playery-7,0); xl = max(playerx-25,0);
565 for (i=yl; i<yh; i++) for (j=xl; j<xh; j++) know[j][i]=1;
566 nap(2000); draws(xl,xh,yl,yh); return;
568 case 3: lprcat("\nThis scroll seems to be blank"); return;
570 case 4: createmonster(makemonst(level+1)); return; /* this one creates a monster */
572 case 5: something(level); /* create artifact */ return;
574 case 6: c[AGGRAVATE]+=800; return; /* aggravate monsters */
576 case 7: gtime += (i = rnd(1000) - 850); /* time warp */
577 if (i>=0) lprintf("\nYou went forward in time by %d mobuls",(long)((i+99)/100));
578 else lprintf("\nYou went backward in time by %d mobuls",(long)(-(i+99)/100));
579 adjtime((long)i); /* adjust time for time warping */
582 case 8: oteleport(0); return; /* teleportation */
584 case 9: c[AWARENESS] += 1800; return; /* expanded awareness */
586 case 10: c[HASTEMONST] += rnd(55)+12; return; /* haste monster */
588 case 11: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++)
590 hitp[j][i] = monster[mitem[j][i]].hitpoints;
591 return; /* monster healing */
592 case 12: c[SPIRITPRO] += 300 + rnd(200); bottomline(); return; /* spirit protection */
594 case 13: c[UNDEADPRO] += 300 + rnd(200); bottomline(); return; /* undead protection */
596 case 14: c[STEALTH] += 250 + rnd(250); bottomline(); return; /* stealth */
598 case 15: lprcat("\nYou have been granted enlightenment!"); /* magic mapping */
599 for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=1;
600 nap(2000); draws(0,MAXX,0,MAXY); return;
602 case 16: c[HOLDMONST] += 30; bottomline(); return; /* hold monster */
604 case 17: for (i=0; i<26; i++) /* gem perfection */
607 case ODIAMOND: case ORUBY:
608 case OEMERALD: case OSAPPHIRE:
609 j = ivenarg[i]; j &= 255; j <<= 1;
610 if (j > 255) j=255; /* double value */
611 ivenarg[i] = j; break;
615 case 18: for (i=0; i<11; i++) c[exten[i]] <<= 1; /* spell extension */
618 case 19: for (i=0; i<26; i++) /* identify */
620 if (iven[i]==OPOTION) potionname[ivenarg[i]][0] = ' ';
621 if (iven[i]==OSCROLL) scrollname[ivenarg[i]][0] = ' ';
625 case 20: for (i=0; i<10; i++) /* remove curse */
626 if (c[curse[i]]) c[curse[i]] = 1;
629 case 21: annihilate(); break; /* scroll of annihilation */
631 case 22: godirect(22,150,"The ray hits the %s",0,' '); /* pulverization */
633 case 23: c[LIFEPROT]++; break; /* life protection */
646 if (rnd(70) > 9*c[DEXTERITY]-packweight() || rnd(101)<5)
647 if (level==MAXLEVEL-1) obottomless(); else
648 if (level==MAXLEVEL+MAXVLEVEL-1) obottomless(); else
652 i=0; lprcat("\nYou fell into a pit! Your fall is cushioned by an unknown force\n");
657 lprintf("\nYou fell into a pit! You suffer %d hit points damage",(long)i);
658 lastnum=261; /* if he dies scoreboard will say so */
660 losehp(i); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY);
666 lprcat("\nYou fell into a bottomless pit!"); beep(); nap(3000); died(262);
689 if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts();
690 while (1) switch(getchar())
693 case 'i': ignore(); return;
695 case 'r': if (c[BLINDCOUNT]) break;
697 /* no more book */ readbook(iarg[playerx][playery]); forget(); return;
699 case 't': lprcat("take"); if (take(OBOOK,iarg[playerx][playery])==0) forget(); /* no more book */
705 function to read a book
711 if (lev<=3) i = rund((tmp=splev[lev])?tmp:1); else
712 i = rnd((tmp=splev[lev]-9)?tmp:1) + 9;
714 lprintf("\nSpell \"%s\": %s\n%s",spelcode[i],spelname[i],speldescript[i]);
716 { lprcat("\nYour int went up by one!"); c[INTELLIGENCE]++; bottomline(); }
722 lprcat("\nDo you (e) eat it, (t) take it"); iopts();
723 while (1) switch(getchar())
726 case 'i': ignore(); return;
728 case 'e': lprcat("eat\nThe cookie tasted good.");
729 forget(); /* no more cookie */
730 if (c[BLINDCOUNT]) return;
731 if (!(p=fortune(fortfile))) return;
732 lprcat(" A message inside the cookie reads:\n"); lprcat(p);
735 case 't': lprcat("take"); if (take(OCOOKIE,0)==0) forget(); /* no more book */
741 /* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */
746 i = iarg[playerx][playery];
747 if (arg==OMAXGOLD) i *= 100;
748 else if (arg==OKGOLD) i *= 1000;
749 else if (arg==ODGOLD) i *= 10;
750 lprintf("\nIt is worth %d!",(long)i); c[GOLD] += i; bottomgold();
751 item[playerx][playery] = know[playerx][playery] = 0; /* destroy gold */
757 nosignal = 1; /* disable signals */
758 for (i=0; i<26; i++) if (iven[i]==OPOTION) if (ivenarg[i]==21)
760 iven[i]=0; /* remove the potion of cure dianthroritis from inventory */
761 clear(); lprcat("Congratulations. You found a potion of cure dianthroritis.\n");
762 lprcat("\nFrankly, No one thought you could do it. Boy! Did you surprise them!\n");
765 lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n");
766 lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad!\n");
767 nap(5000); died(269);
771 lprcat("\nThe doctor is now administering the potion, and in a few moments\n");
772 lprcat("Your daughter should be well on her way to recovery.\n");
774 lprcat("\nThe potion is"); nap(3000); lprcat(" working! The doctor thinks that\n");
775 lprcat("your daughter will recover in a few days. Congratulations!\n");
776 beep(); nap(5000); died(263);
782 clear(); lprintf("Welcome home %s. Latest word from the doctor is not good.\n",logname);
786 lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n");
787 lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad!\n");
788 nap(5000); died(269);
791 lprcat("\nThe diagnosis is confirmed as dianthroritis. He guesses that\n");
792 lprintf("your daughter has only %d mobuls left in this world. It's up to you,\n",(long)((TIMELIMIT-gtime+99)/100));
793 lprintf("%s, to find the only hope for your daughter, the very rare\n",logname);
794 lprcat("potion of cure dianthroritis. It is rumored that only deep in the\n");
795 lprcat("depths of the caves can this potion be found.\n\n\n");
796 lprcat("\n ----- press "); standout("return");
797 lprcat(" to continue, "); standout("escape");
798 lprcat(" to leave ----- ");
799 i=getchar(); while (i!='\33' && i!='\n') i=getchar();
800 if (i=='\33') { drawscreen(); nosignal = 0; /* enable signals */ return; }
804 /* routine to save program space */
806 { lprcat(", or (i) ignore it? "); }
808 { lprcat("ignore\n"); }