1 /* moreobj.c Larn is copyrighted 1986 by Noah Morgan.
4 * Routines in this file:
20 * subroutine to process an altar object
26 lprcat("\nDo you (p) pray (d) desecrate"); iopts();
29 while (1) switch(getchar())
31 case 'p': lprcat(" pray\nDo you (m) give money or (j) just pray? ");
32 while (1) switch(getchar())
34 case 'j': if (rnd(100)<75)
35 lprcat("\nnothing happens");
36 else if (rnd(13)<4) ohear();
37 else if (rnd(43) == 10)
39 if (c[WEAR]) lprcat("\nYou feel your armor vibrate for a moment");
40 enchantarmor(); return;
42 else if (rnd(43) == 10)
44 if (c[WIELD]) lprcat("\nYou feel your weapon vibrate for a moment");
47 else createmonster(makemonst(level+1));
50 case 'm': lprcat("\n\n"); cursor(1,24); cltoeoln();
51 cursor(1,23); cltoeoln();
52 lprcat("how much do you donate? ");
53 k = readnum((long)c[GOLD]);
56 lprcat("\nYou don't have that much!");
60 if (k < c[GOLD]/10 || k<rnd(50))
61 { createmonster(makemonst(level+1)); c[AGGRAVATE] += 200; }
62 else if (rnd(101) > 50) { ohear(); return; }
63 else if (rnd(43) == 5)
65 if (c[WEAR]) lprcat("\nYou feel your armor vibrate for a moment");
66 enchantarmor(); return;
68 else if (rnd(43) == 8)
70 if (c[WIELD]) lprcat("\nYou feel your weapon vibrate for a moment");
73 else lprcat("\nThank You.");
79 case 'd': lprcat(" desecrate");
81 { createmonster(makemonst(level+2)+8); c[AGGRAVATE] += 2500; }
85 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
86 forget(); /* remember to destroy the altar */
89 lprcat("\nnothing happens");
94 if (rnd(100)<30) { createmonster(makemonst(level+1)); c[AGGRAVATE] += rnd(450); }
95 else lprcat("\nnothing happens");
102 function to cast a +3 protection on the player
107 lprcat("\nYou have been heard!");
108 if (c[ALTPRO]==0) c[MOREDEFENSES]+=3;
109 c[ALTPRO] += 500; /* protection field */
118 subroutine to process a throne object
125 lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts();
128 while (1) switch(getchar())
130 case 'p': lprcat(" pry off"); k=rnd(101);
133 for (i=0; i<rnd(4); i++) creategem(); /* gems pop off the throne */
134 item[playerx][playery]=ODEADTHRONE;
135 know[playerx][playery]=0;
137 else if (k<40 && arg==0)
139 createmonster(GNOMEKING);
140 item[playerx][playery]=OTHRONE2;
141 know[playerx][playery]=0;
143 else lprcat("\nnothing happens");
146 case 's': lprcat(" sit down"); k=rnd(101);
149 createmonster(GNOMEKING);
150 item[playerx][playery]=OTHRONE2;
151 know[playerx][playery]=0;
153 else if (k<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
154 else lprcat("\nnothing happens");
158 case '\33': ignore(); return;
167 lprcat("\nDo you (s) sit down"); iopts();
170 while (1) switch(getchar())
172 case 's': lprcat(" sit down"); k=rnd(101);
173 if (k<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
174 else lprcat("\nnothing happens");
178 case '\33': ignore(); return;
188 subroutine to process a throne object
193 lprcat("\nDo you (t) take it, (o) try to open it"); iopts();
196 while (1) switch(getchar())
198 case 'o': lprcat(" open it"); k=rnd(101);
201 lprcat("\nThe chest explodes as you open it"); beep();
202 i = rnd(10); lastnum=281; /* in case he dies */
203 lprintf("\nYou suffer %d hit points damage!",(long)i);
205 switch(rnd(10)) /* see if he gets a curse */
207 case 1: c[ITCHING]+= rnd(1000)+100;
208 lprcat("\nYou feel an irritation spread over your skin!");
212 case 2: c[CLUMSINESS]+= rnd(1600)+200;
213 lprcat("\nYou begin to lose hand to eye coordination!");
217 case 3: c[HALFDAM]+= rnd(1600)+200;
219 lprcat("\nA sickness engulfs you!"); break;
221 item[playerx][playery]=know[playerx][playery]=0;
222 if (rnd(100)<69) creategem(); /* gems from the chest */
223 dropgold(rnd(110*iarg[playerx][playery]+200));
224 for (i=0; i<rnd(4); i++) something(iarg[playerx][playery]+2);
226 else lprcat("\nnothing happens");
229 case 't': lprcat(" take");
230 if (take(OCHEST,iarg[playerx][playery])==0)
231 item[playerx][playery]=know[playerx][playery]=0;
235 case '\33': ignore(); return;
250 lprcat("\nDo you (d) drink, (w) wash yourself"); iopts();
251 while (1) switch(getchar())
253 case 'd': lprcat("drink");
256 lprcat("\nOops! You seem to have caught the dreadful sleep!");
257 beep(); lflush(); sleep(3); died(280); return;
262 c[HALFDAM] += 200+rnd(200);
263 lprcat("\nYou feel a sickness coming on");
265 else if (x<13) quaffpotion(23); /* see invisible */
267 lprcat("\nnothing seems to have happened");
268 else if (rnd(3) != 2)
269 fntchange(1); /* change char levels upward */
271 fntchange(-1); /* change char levels downward */
274 lprcat("\nThe fountains bubbling slowly quiets");
275 item[playerx][playery]=ODEADFOUNTAIN; /* dead fountain */
276 know[playerx][playery]=0;
281 case 'i': ignore(); return;
283 case 'w': lprcat("wash yourself");
287 lprintf("\nOh no! The water was foul! You suffer %d hit points!",(long)x);
288 lastnum=273; losehp(x); bottomline(); cursors();
292 lprcat("\nYou got the dirt off!");
295 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
298 createmonster(WATERLORD); /* make water lord */
300 lprcat("\nnothing seems to have happened");
310 subroutine to process an up/down of a character attribute for ofountain
317 if (how < 0) { lprcat(" went down by one!"); --(*x); }
318 else { lprcat(" went up by one!"); (*x)++; }
323 a subroutine to raise or lower character levels
324 if x > 0 they are raised if x < 0 they are lowered
333 case 1: lprcat("Your strength"); fch(how,&c[0]); break;
334 case 2: lprcat("Your intelligence"); fch(how,&c[1]); break;
335 case 3: lprcat("Your wisdom"); fch(how,&c[2]); break;
336 case 4: lprcat("Your constitution"); fch(how,&c[3]); break;
337 case 5: lprcat("Your dexterity"); fch(how,&c[4]); break;
338 case 6: lprcat("Your charm"); fch(how,&c[5]); break;
339 case 7: j=rnd(level+1);
341 { lprintf("You lose %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); losemhp((int)j); }
343 { lprintf("You gain %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); raisemhp((int)j); }
346 case 8: j=rnd(level+1);
349 lprintf("You just gained %d spell",(long)j); raisemspells((int)j);
350 if (j>1) lprcat("s!"); else lprc('!');
354 lprintf("You just lost %d spell",(long)j); losemspells((int)j);
355 if (j>1) lprcat("s!"); else lprc('!');
359 case 9: j = 5*rnd((level+1)*(level+1));
362 lprintf("You just lost %d experience point",(long)j);
363 if (j>1) lprcat("s!"); else lprc('!'); loseexperience((long)j);
367 lprintf("You just gained %d experience point",(long)j);
368 if (j>1) lprcat("s!"); else lprc('!'); raiseexperience((long)j);