]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - larn/moreobj.c
1 /* $NetBSD: moreobj.c,v 1.6 2004/01/27 20:30:30 jsm 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.6 2004/01/27 20:30:30 jsm Exp $");
19 static void ohear(void);
20 static void fch(int, long *);
27 * subroutine to process an altar object
34 lprcat("\nDo you (p) pray (d) desecrate");
40 lprcat(" pray\nDo you (m) give money or (j) just pray? ");
45 lprcat("\nnothing happens");
48 else if (rnd(43) == 10) {
50 lprcat("\nYou feel your armor vibrate for a moment");
53 } else if (rnd(43) == 10) {
55 lprcat("\nYou feel your weapon vibrate for a moment");
59 createmonster(makemonst(level
+ 1));
68 lprcat("how much do you donate? ");
69 k
= readnum((long) c
[GOLD
]);
71 lprcat("\nYou don't have that much!");
75 if (k
< c
[GOLD
] / 10 || k
< rnd(50)) {
76 createmonster(makemonst(level
+ 1));
78 } else if (rnd(101) > 50) {
81 } else if (rnd(43) == 5) {
83 lprcat("\nYou feel your armor vibrate for a moment");
86 } else if (rnd(43) == 8) {
88 lprcat("\nYou feel your weapon vibrate for a moment");
92 lprcat("\nThank You.");
101 lprcat(" desecrate");
103 createmonster(makemonst(level
+ 2) + 8);
104 c
[AGGRAVATE
] += 2500;
105 } else if (rnd(101) < 30) {
106 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
107 forget(); /* remember to destroy
110 lprcat("\nnothing happens");
117 createmonster(makemonst(level
+ 1));
118 c
[AGGRAVATE
] += rnd(450);
120 lprcat("\nnothing happens");
127 function to cast a +3 protection on the player
132 lprcat("\nYou have been heard!");
134 c
[MOREDEFENSES
] += 3;
135 c
[ALTPRO
] += 500; /* protection field */
144 subroutine to process a throne object
152 lprcat("\nDo you (p) pry off jewels, (s) sit down");
156 switch (lgetchar()) {
161 for (i
= 0; i
< rnd(4); i
++)
162 creategem(); /* gems pop off the
164 item
[playerx
][playery
] = ODEADTHRONE
;
165 know
[playerx
][playery
] = 0;
166 } else if (k
< 40 && arg
== 0) {
167 createmonster(GNOMEKING
);
168 item
[playerx
][playery
] = OTHRONE2
;
169 know
[playerx
][playery
] = 0;
171 lprcat("\nnothing happens");
177 if (k
< 30 && arg
== 0) {
178 createmonster(GNOMEKING
);
179 item
[playerx
][playery
] = OTHRONE2
;
180 know
[playerx
][playery
] = 0;
182 lprcat("\nZaaaappp! You've been teleported!\n");
186 lprcat("\nnothing happens");
202 lprcat("\nDo you (s) sit down");
206 switch (lgetchar()) {
211 lprcat("\nZaaaappp! You've been teleported!\n");
215 lprcat("\nnothing happens");
231 subroutine to process a throne object
237 lprcat("\nDo you (t) take it, (o) try to open it");
241 switch (lgetchar()) {
246 lprcat("\nThe chest explodes as you open it");
249 lastnum
= 281; /* in case he dies */
250 lprintf("\nYou suffer %d hit points damage!", (long) i
);
252 switch (rnd(10)) { /* see if he gets a
255 c
[ITCHING
] += rnd(1000) + 100;
256 lprcat("\nYou feel an irritation spread over your skin!");
261 c
[CLUMSINESS
] += rnd(1600) + 200;
262 lprcat("\nYou begin to lose hand to eye coordination!");
267 c
[HALFDAM
] += rnd(1600) + 200;
269 lprcat("\nA sickness engulfs you!");
272 item
[playerx
][playery
] = know
[playerx
][playery
] = 0;
274 creategem(); /* gems from the chest */
275 dropgold(rnd(110 * iarg
[playerx
][playery
] + 200));
276 for (i
= 0; i
< rnd(4); i
++)
277 something(iarg
[playerx
][playery
] + 2);
279 lprcat("\nnothing happens");
284 if (take(OCHEST
, iarg
[playerx
][playery
]) == 0)
285 item
[playerx
][playery
] = know
[playerx
][playery
] = 0;
307 lprcat("\nDo you (d) drink, (w) wash yourself");
310 switch (lgetchar()) {
314 lprcat("\nOops! You seem to have caught the dreadful sleep!");
323 c
[HALFDAM
] += 200 + rnd(200);
324 lprcat("\nYou feel a sickness coming on");
326 quaffpotion(23); /* see invisible */
328 lprcat("\nnothing seems to have happened");
329 else if (rnd(3) != 2)
330 fntchange(1); /* change char levels upward */
332 fntchange(-1); /* change char levels
335 lprcat("\nThe fountains bubbling slowly quiets");
336 item
[playerx
][playery
] = ODEADFOUNTAIN
; /* dead fountain */
337 know
[playerx
][playery
] = 0;
347 lprcat("wash yourself");
349 x
= rnd((level
<< 2) + 2);
350 lprintf("\nOh no! The water was foul! You suffer %d hit points!", (long) x
);
355 } else if (rnd(100) < 29)
356 lprcat("\nYou got the dirt off!");
357 else if (rnd(100) < 31)
358 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
359 else if (rnd(100) < 34)
360 createmonster(WATERLORD
); /* make water lord */
362 lprcat("\nnothing seems to have happened");
372 subroutine to process an up/down of a character attribute for ofountain
380 lprcat(" went down by one!");
383 lprcat(" went up by one!");
390 a subroutine to raise or lower character levels
391 if x > 0 they are raised if x < 0 they are lowered
401 lprcat("Your strength");
405 lprcat("Your intelligence");
409 lprcat("Your wisdom");
413 lprcat("Your constitution");
417 lprcat("Your dexterity");
421 lprcat("Your charm");
427 lprintf("You lose %d hit point", (long) j
);
434 lprintf("You gain %d hit point", (long) j
);
447 lprintf("You just gained %d spell", (long) j
);
448 raisemspells((int) j
);
454 lprintf("You just lost %d spell", (long) j
);
455 losemspells((int) j
);
465 j
= 5 * rnd((level
+ 1) * (level
+ 1));
467 lprintf("You just lost %d experience point", (long) j
);
472 loseexperience((long) j
);
474 lprintf("You just gained %d experience point", (long) j
);
479 raiseexperience((long) j
);