]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/moreobj.c
f834b1a136eef56c453203870a6ac93f974d37ba
1 /* moreobj.c Larn is copyrighted 1986 by Noah Morgan.
3 * Routines in this file:
19 * subroutine to process an altar object
25 lprcat("\nDo you (p) pray (d) desecrate"); iopts();
28 while (1) switch(getchar())
30 case 'p': lprcat(" pray\nDo you (m) give money or (j) just pray? ");
31 while (1) switch(getchar())
33 case 'j': if (rnd(100)<75)
34 lprcat("\nnothing happens");
35 else if (rnd(13)<4) ohear();
36 else if (rnd(43) == 10)
38 if (c
[WEAR
]) lprcat("\nYou feel your armor vibrate for a moment");
39 enchantarmor(); return;
41 else if (rnd(43) == 10)
43 if (c
[WIELD
]) lprcat("\nYou feel your weapon vibrate for a moment");
46 else createmonster(makemonst(level
+1));
49 case 'm': lprcat("\n\n"); cursor(1,24); cltoeoln();
50 cursor(1,23); cltoeoln();
51 lprcat("how much do you donate? ");
52 k
= readnum((long)c
[GOLD
]);
55 lprcat("\nYou don't have that much!");
59 if (k
< c
[GOLD
]/10 || k
<rnd(50))
60 { createmonster(makemonst(level
+1)); c
[AGGRAVATE
] += 200; }
61 else if (rnd(101) > 50) { ohear(); return; }
62 else if (rnd(43) == 5)
64 if (c
[WEAR
]) lprcat("\nYou feel your armor vibrate for a moment");
65 enchantarmor(); return;
67 else if (rnd(43) == 8)
69 if (c
[WIELD
]) lprcat("\nYou feel your weapon vibrate for a moment");
72 else lprcat("\nThank You.");
78 case 'd': lprcat(" desecrate");
80 { createmonster(makemonst(level
+2)+8); c
[AGGRAVATE
] += 2500; }
84 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
85 forget(); /* remember to destroy the altar */
88 lprcat("\nnothing happens");
93 if (rnd(100)<30) { createmonster(makemonst(level
+1)); c
[AGGRAVATE
] += rnd(450); }
94 else lprcat("\nnothing happens");
101 function to cast a +3 protection on the player
106 lprcat("\nYou have been heard!");
107 if (c
[ALTPRO
]==0) c
[MOREDEFENSES
]+=3;
108 c
[ALTPRO
] += 500; /* protection field */
117 subroutine to process a throne object
124 lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts();
127 while (1) switch(getchar())
129 case 'p': lprcat(" pry off"); k
=rnd(101);
132 for (i
=0; i
<rnd(4); i
++) creategem(); /* gems pop off the throne */
133 item
[playerx
][playery
]=ODEADTHRONE
;
134 know
[playerx
][playery
]=0;
136 else if (k
<40 && arg
==0)
138 createmonster(GNOMEKING
);
139 item
[playerx
][playery
]=OTHRONE2
;
140 know
[playerx
][playery
]=0;
142 else lprcat("\nnothing happens");
145 case 's': lprcat(" sit down"); k
=rnd(101);
148 createmonster(GNOMEKING
);
149 item
[playerx
][playery
]=OTHRONE2
;
150 know
[playerx
][playery
]=0;
152 else if (k
<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
153 else lprcat("\nnothing happens");
157 case '\33': ignore(); return;
166 lprcat("\nDo you (s) sit down"); iopts();
169 while (1) switch(getchar())
171 case 's': lprcat(" sit down"); k
=rnd(101);
172 if (k
<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
173 else lprcat("\nnothing happens");
177 case '\33': ignore(); return;
187 subroutine to process a throne object
192 lprcat("\nDo you (t) take it, (o) try to open it"); iopts();
195 while (1) switch(getchar())
197 case 'o': lprcat(" open it"); k
=rnd(101);
200 lprcat("\nThe chest explodes as you open it"); beep();
201 i
= rnd(10); lastnum
=281; /* in case he dies */
202 lprintf("\nYou suffer %d hit points damage!",(long)i
);
204 switch(rnd(10)) /* see if he gets a curse */
206 case 1: c
[ITCHING
]+= rnd(1000)+100;
207 lprcat("\nYou feel an irritation spread over your skin!");
211 case 2: c
[CLUMSINESS
]+= rnd(1600)+200;
212 lprcat("\nYou begin to lose hand to eye coordination!");
216 case 3: c
[HALFDAM
]+= rnd(1600)+200;
218 lprcat("\nA sickness engulfs you!"); break;
220 item
[playerx
][playery
]=know
[playerx
][playery
]=0;
221 if (rnd(100)<69) creategem(); /* gems from the chest */
222 dropgold(rnd(110*iarg
[playerx
][playery
]+200));
223 for (i
=0; i
<rnd(4); i
++) something(iarg
[playerx
][playery
]+2);
225 else lprcat("\nnothing happens");
228 case 't': lprcat(" take");
229 if (take(OCHEST
,iarg
[playerx
][playery
])==0)
230 item
[playerx
][playery
]=know
[playerx
][playery
]=0;
234 case '\33': ignore(); return;
249 lprcat("\nDo you (d) drink, (w) wash yourself"); iopts();
250 while (1) switch(getchar())
252 case 'd': lprcat("drink");
255 lprcat("\nOops! You seem to have caught the dreadful sleep!");
256 beep(); lflush(); sleep(3); died(280); return;
261 c
[HALFDAM
] += 200+rnd(200);
262 lprcat("\nYou feel a sickness coming on");
264 else if (x
<13) quaffpotion(23); /* see invisible */
266 lprcat("\nnothing seems to have happened");
267 else if (rnd(3) != 2)
268 fntchange(1); /* change char levels upward */
270 fntchange(-1); /* change char levels downward */
273 lprcat("\nThe fountains bubbling slowly quiets");
274 item
[playerx
][playery
]=ODEADFOUNTAIN
; /* dead fountain */
275 know
[playerx
][playery
]=0;
280 case 'i': ignore(); return;
282 case 'w': lprcat("wash yourself");
286 lprintf("\nOh no! The water was foul! You suffer %d hit points!",(long)x
);
287 lastnum
=273; losehp(x
); bottomline(); cursors();
291 lprcat("\nYou got the dirt off!");
294 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
297 createmonster(WATERLORD
); /* make water lord */
299 lprcat("\nnothing seems to have happened");
309 subroutine to process an up/down of a character attribute for ofountain
316 if (how
< 0) { lprcat(" went down by one!"); --(*x
); }
317 else { lprcat(" went up by one!"); (*x
)++; }
322 a subroutine to raise or lower character levels
323 if x > 0 they are raised if x < 0 they are lowered
332 case 1: lprcat("Your strength"); fch(how
,&c
[0]); break;
333 case 2: lprcat("Your intelligence"); fch(how
,&c
[1]); break;
334 case 3: lprcat("Your wisdom"); fch(how
,&c
[2]); break;
335 case 4: lprcat("Your constitution"); fch(how
,&c
[3]); break;
336 case 5: lprcat("Your dexterity"); fch(how
,&c
[4]); break;
337 case 6: lprcat("Your charm"); fch(how
,&c
[5]); break;
338 case 7: j
=rnd(level
+1);
340 { lprintf("You lose %d hit point",(long)j
); if (j
>1) lprcat("s!"); else lprc('!'); losemhp((int)j
); }
342 { lprintf("You gain %d hit point",(long)j
); if (j
>1) lprcat("s!"); else lprc('!'); raisemhp((int)j
); }
345 case 8: j
=rnd(level
+1);
348 lprintf("You just gained %d spell",(long)j
); raisemspells((int)j
);
349 if (j
>1) lprcat("s!"); else lprc('!');
353 lprintf("You just lost %d spell",(long)j
); losemspells((int)j
);
354 if (j
>1) lprcat("s!"); else lprc('!');
358 case 9: j
= 5*rnd((level
+1)*(level
+1));
361 lprintf("You just lost %d experience point",(long)j
);
362 if (j
>1) lprcat("s!"); else lprc('!'); loseexperience((long)j
);
366 lprintf("You just gained %d experience point",(long)j
);
367 if (j
>1) lprcat("s!"); else lprc('!'); raiseexperience((long)j
);