]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/moreobj.c
1 /* $NetBSD: moreobj.c,v 1.4 1997/10/18 20:03:32 christos Exp $ */
4 * moreobj.c Larn is copyrighted 1986 by Noah Morgan.
6 * Routines in this file:
8 * oaltar() othrone() ochest() ofountain()
10 #include <sys/cdefs.h>
12 __RCSID("$NetBSD: moreobj.c,v 1.4 1997/10/18 20:03:32 christos Exp $");
20 static void ohear
__P((void));
21 static void fch
__P((int, long *));
28 * subroutine to process an altar object
35 lprcat("\nDo you (p) pray (d) desecrate");
41 lprcat(" pray\nDo you (m) give money or (j) just pray? ");
46 lprcat("\nnothing happens");
49 else if (rnd(43) == 10) {
51 lprcat("\nYou feel your armor vibrate for a moment");
54 } else if (rnd(43) == 10) {
56 lprcat("\nYou feel your weapon vibrate for a moment");
60 createmonster(makemonst(level
+ 1));
69 lprcat("how much do you donate? ");
70 k
= readnum((long) c
[GOLD
]);
72 lprcat("\nYou don't have that much!");
76 if (k
< c
[GOLD
] / 10 || k
< rnd(50)) {
77 createmonster(makemonst(level
+ 1));
79 } else if (rnd(101) > 50) {
82 } else if (rnd(43) == 5) {
84 lprcat("\nYou feel your armor vibrate for a moment");
87 } else if (rnd(43) == 8) {
89 lprcat("\nYou feel your weapon vibrate for a moment");
93 lprcat("\nThank You.");
102 lprcat(" desecrate");
104 createmonster(makemonst(level
+ 2) + 8);
105 c
[AGGRAVATE
] += 2500;
106 } else if (rnd(101) < 30) {
107 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
108 forget(); /* remember to destroy
111 lprcat("\nnothing happens");
118 createmonster(makemonst(level
+ 1));
119 c
[AGGRAVATE
] += rnd(450);
121 lprcat("\nnothing happens");
128 function to cast a +3 protection on the player
133 lprcat("\nYou have been heard!");
135 c
[MOREDEFENSES
] += 3;
136 c
[ALTPRO
] += 500; /* protection field */
145 subroutine to process a throne object
153 lprcat("\nDo you (p) pry off jewels, (s) sit down");
162 for (i
= 0; i
< rnd(4); i
++)
163 creategem(); /* gems pop off the
165 item
[playerx
][playery
] = ODEADTHRONE
;
166 know
[playerx
][playery
] = 0;
167 } else if (k
< 40 && arg
== 0) {
168 createmonster(GNOMEKING
);
169 item
[playerx
][playery
] = OTHRONE2
;
170 know
[playerx
][playery
] = 0;
172 lprcat("\nnothing happens");
178 if (k
< 30 && arg
== 0) {
179 createmonster(GNOMEKING
);
180 item
[playerx
][playery
] = OTHRONE2
;
181 know
[playerx
][playery
] = 0;
183 lprcat("\nZaaaappp! You've been teleported!\n");
187 lprcat("\nnothing happens");
203 lprcat("\nDo you (s) sit down");
212 lprcat("\nZaaaappp! You've been teleported!\n");
216 lprcat("\nnothing happens");
232 subroutine to process a throne object
238 lprcat("\nDo you (t) take it, (o) try to open it");
247 lprcat("\nThe chest explodes as you open it");
250 lastnum
= 281; /* in case he dies */
251 lprintf("\nYou suffer %d hit points damage!", (long) i
);
253 switch (rnd(10)) { /* see if he gets a
256 c
[ITCHING
] += rnd(1000) + 100;
257 lprcat("\nYou feel an irritation spread over your skin!");
262 c
[CLUMSINESS
] += rnd(1600) + 200;
263 lprcat("\nYou begin to lose hand to eye coordination!");
268 c
[HALFDAM
] += rnd(1600) + 200;
270 lprcat("\nA sickness engulfs you!");
273 item
[playerx
][playery
] = know
[playerx
][playery
] = 0;
275 creategem(); /* gems from the chest */
276 dropgold(rnd(110 * iarg
[playerx
][playery
] + 200));
277 for (i
= 0; i
< rnd(4); i
++)
278 something(iarg
[playerx
][playery
] + 2);
280 lprcat("\nnothing happens");
285 if (take(OCHEST
, iarg
[playerx
][playery
]) == 0)
286 item
[playerx
][playery
] = know
[playerx
][playery
] = 0;
308 lprcat("\nDo you (d) drink, (w) wash yourself");
315 lprcat("\nOops! You seem to have caught the dreadful sleep!");
324 c
[HALFDAM
] += 200 + rnd(200);
325 lprcat("\nYou feel a sickness coming on");
327 quaffpotion(23); /* see invisible */
329 lprcat("\nnothing seems to have happened");
330 else if (rnd(3) != 2)
331 fntchange(1); /* change char levels upward */
333 fntchange(-1); /* change char levels
336 lprcat("\nThe fountains bubbling slowly quiets");
337 item
[playerx
][playery
] = ODEADFOUNTAIN
; /* dead fountain */
338 know
[playerx
][playery
] = 0;
348 lprcat("wash yourself");
350 x
= rnd((level
<< 2) + 2);
351 lprintf("\nOh no! The water was foul! You suffer %d hit points!", (long) x
);
356 } else if (rnd(100) < 29)
357 lprcat("\nYou got the dirt off!");
358 else if (rnd(100) < 31)
359 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
360 else if (rnd(100) < 34)
361 createmonster(WATERLORD
); /* make water lord */
363 lprcat("\nnothing seems to have happened");
373 subroutine to process an up/down of a character attribute for ofountain
381 lprcat(" went down by one!");
384 lprcat(" went up by one!");
391 a subroutine to raise or lower character levels
392 if x > 0 they are raised if x < 0 they are lowered
402 lprcat("Your strength");
406 lprcat("Your intelligence");
410 lprcat("Your wisdom");
414 lprcat("Your constitution");
418 lprcat("Your dexterity");
422 lprcat("Your charm");
428 lprintf("You lose %d hit point", (long) j
);
435 lprintf("You gain %d hit point", (long) j
);
448 lprintf("You just gained %d spell", (long) j
);
449 raisemspells((int) j
);
455 lprintf("You just lost %d spell", (long) j
);
456 losemspells((int) j
);
466 j
= 5 * rnd((level
+ 1) * (level
+ 1));
468 lprintf("You just lost %d experience point", (long) j
);
473 loseexperience((long) j
);
475 lprintf("You just gained %d experience point", (long) j
);
480 raiseexperience((long) j
);