]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/moreobj.c
2 static char rcsid
[] = "$Id: moreobj.c,v 1.2 1993/08/02 17:20:12 mycroft Exp $";
5 /* moreobj.c Larn is copyrighted 1986 by Noah Morgan.
7 * Routines in this file:
23 * subroutine to process an altar object
29 lprcat("\nDo you (p) pray (d) desecrate"); iopts();
32 while (1) switch(getchar())
34 case 'p': lprcat(" pray\nDo you (m) give money or (j) just pray? ");
35 while (1) switch(getchar())
37 case 'j': if (rnd(100)<75)
38 lprcat("\nnothing happens");
39 else if (rnd(13)<4) ohear();
40 else if (rnd(43) == 10)
42 if (c
[WEAR
]) lprcat("\nYou feel your armor vibrate for a moment");
43 enchantarmor(); return;
45 else if (rnd(43) == 10)
47 if (c
[WIELD
]) lprcat("\nYou feel your weapon vibrate for a moment");
50 else createmonster(makemonst(level
+1));
53 case 'm': lprcat("\n\n"); cursor(1,24); cltoeoln();
54 cursor(1,23); cltoeoln();
55 lprcat("how much do you donate? ");
56 k
= readnum((long)c
[GOLD
]);
59 lprcat("\nYou don't have that much!");
63 if (k
< c
[GOLD
]/10 || k
<rnd(50))
64 { createmonster(makemonst(level
+1)); c
[AGGRAVATE
] += 200; }
65 else if (rnd(101) > 50) { ohear(); return; }
66 else if (rnd(43) == 5)
68 if (c
[WEAR
]) lprcat("\nYou feel your armor vibrate for a moment");
69 enchantarmor(); return;
71 else if (rnd(43) == 8)
73 if (c
[WIELD
]) lprcat("\nYou feel your weapon vibrate for a moment");
76 else lprcat("\nThank You.");
82 case 'd': lprcat(" desecrate");
84 { createmonster(makemonst(level
+2)+8); c
[AGGRAVATE
] += 2500; }
88 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
89 forget(); /* remember to destroy the altar */
92 lprcat("\nnothing happens");
97 if (rnd(100)<30) { createmonster(makemonst(level
+1)); c
[AGGRAVATE
] += rnd(450); }
98 else lprcat("\nnothing happens");
105 function to cast a +3 protection on the player
110 lprcat("\nYou have been heard!");
111 if (c
[ALTPRO
]==0) c
[MOREDEFENSES
]+=3;
112 c
[ALTPRO
] += 500; /* protection field */
121 subroutine to process a throne object
128 lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts();
131 while (1) switch(getchar())
133 case 'p': lprcat(" pry off"); k
=rnd(101);
136 for (i
=0; i
<rnd(4); i
++) creategem(); /* gems pop off the throne */
137 item
[playerx
][playery
]=ODEADTHRONE
;
138 know
[playerx
][playery
]=0;
140 else if (k
<40 && arg
==0)
142 createmonster(GNOMEKING
);
143 item
[playerx
][playery
]=OTHRONE2
;
144 know
[playerx
][playery
]=0;
146 else lprcat("\nnothing happens");
149 case 's': lprcat(" sit down"); k
=rnd(101);
152 createmonster(GNOMEKING
);
153 item
[playerx
][playery
]=OTHRONE2
;
154 know
[playerx
][playery
]=0;
156 else if (k
<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
157 else lprcat("\nnothing happens");
161 case '\33': ignore(); return;
170 lprcat("\nDo you (s) sit down"); iopts();
173 while (1) switch(getchar())
175 case 's': lprcat(" sit down"); k
=rnd(101);
176 if (k
<35) { lprcat("\nZaaaappp! You've been teleported!\n"); beep(); oteleport(0); }
177 else lprcat("\nnothing happens");
181 case '\33': ignore(); return;
191 subroutine to process a throne object
196 lprcat("\nDo you (t) take it, (o) try to open it"); iopts();
199 while (1) switch(getchar())
201 case 'o': lprcat(" open it"); k
=rnd(101);
204 lprcat("\nThe chest explodes as you open it"); beep();
205 i
= rnd(10); lastnum
=281; /* in case he dies */
206 lprintf("\nYou suffer %d hit points damage!",(long)i
);
208 switch(rnd(10)) /* see if he gets a curse */
210 case 1: c
[ITCHING
]+= rnd(1000)+100;
211 lprcat("\nYou feel an irritation spread over your skin!");
215 case 2: c
[CLUMSINESS
]+= rnd(1600)+200;
216 lprcat("\nYou begin to lose hand to eye coordination!");
220 case 3: c
[HALFDAM
]+= rnd(1600)+200;
222 lprcat("\nA sickness engulfs you!"); break;
224 item
[playerx
][playery
]=know
[playerx
][playery
]=0;
225 if (rnd(100)<69) creategem(); /* gems from the chest */
226 dropgold(rnd(110*iarg
[playerx
][playery
]+200));
227 for (i
=0; i
<rnd(4); i
++) something(iarg
[playerx
][playery
]+2);
229 else lprcat("\nnothing happens");
232 case 't': lprcat(" take");
233 if (take(OCHEST
,iarg
[playerx
][playery
])==0)
234 item
[playerx
][playery
]=know
[playerx
][playery
]=0;
238 case '\33': ignore(); return;
253 lprcat("\nDo you (d) drink, (w) wash yourself"); iopts();
254 while (1) switch(getchar())
256 case 'd': lprcat("drink");
259 lprcat("\nOops! You seem to have caught the dreadful sleep!");
260 beep(); lflush(); sleep(3); died(280); return;
265 c
[HALFDAM
] += 200+rnd(200);
266 lprcat("\nYou feel a sickness coming on");
268 else if (x
<13) quaffpotion(23); /* see invisible */
270 lprcat("\nnothing seems to have happened");
271 else if (rnd(3) != 2)
272 fntchange(1); /* change char levels upward */
274 fntchange(-1); /* change char levels downward */
277 lprcat("\nThe fountains bubbling slowly quiets");
278 item
[playerx
][playery
]=ODEADFOUNTAIN
; /* dead fountain */
279 know
[playerx
][playery
]=0;
284 case 'i': ignore(); return;
286 case 'w': lprcat("wash yourself");
290 lprintf("\nOh no! The water was foul! You suffer %d hit points!",(long)x
);
291 lastnum
=273; losehp(x
); bottomline(); cursors();
295 lprcat("\nYou got the dirt off!");
298 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
301 createmonster(WATERLORD
); /* make water lord */
303 lprcat("\nnothing seems to have happened");
313 subroutine to process an up/down of a character attribute for ofountain
320 if (how
< 0) { lprcat(" went down by one!"); --(*x
); }
321 else { lprcat(" went up by one!"); (*x
)++; }
326 a subroutine to raise or lower character levels
327 if x > 0 they are raised if x < 0 they are lowered
336 case 1: lprcat("Your strength"); fch(how
,&c
[0]); break;
337 case 2: lprcat("Your intelligence"); fch(how
,&c
[1]); break;
338 case 3: lprcat("Your wisdom"); fch(how
,&c
[2]); break;
339 case 4: lprcat("Your constitution"); fch(how
,&c
[3]); break;
340 case 5: lprcat("Your dexterity"); fch(how
,&c
[4]); break;
341 case 6: lprcat("Your charm"); fch(how
,&c
[5]); break;
342 case 7: j
=rnd(level
+1);
344 { lprintf("You lose %d hit point",(long)j
); if (j
>1) lprcat("s!"); else lprc('!'); losemhp((int)j
); }
346 { lprintf("You gain %d hit point",(long)j
); if (j
>1) lprcat("s!"); else lprc('!'); raisemhp((int)j
); }
349 case 8: j
=rnd(level
+1);
352 lprintf("You just gained %d spell",(long)j
); raisemspells((int)j
);
353 if (j
>1) lprcat("s!"); else lprc('!');
357 lprintf("You just lost %d spell",(long)j
); losemspells((int)j
);
358 if (j
>1) lprcat("s!"); else lprc('!');
362 case 9: j
= 5*rnd((level
+1)*(level
+1));
365 lprintf("You just lost %d experience point",(long)j
);
366 if (j
>1) lprcat("s!"); else lprc('!'); loseexperience((long)j
);
370 lprintf("You just gained %d experience point",(long)j
);
371 if (j
>1) lprcat("s!"); else lprc('!'); raiseexperience((long)j
);