1 /* moreobj.c Larn is copyrighted 1986 by Noah Morgan.
2 * $FreeBSD: src/games/larn/moreobj.c,v 1.4 1999/11/16 02:57:22 billf Exp $
3 * $DragonFly: src/games/larn/moreobj.c,v 1.3 2006/08/26 17:05:05 pavalos Exp $
5 * Routines in this file:
14 static void ohear(void);
15 static void fch(int, long *);
16 static void fntchange(int);
19 * subroutine to process an altar object
26 lprcat("\nDo you (p) pray (d) desecrate");
32 lprcat(" pray\nDo you (m) give money or (j) just pray? ");
37 lprcat("\nnothing happens");
40 else if (rnd(43) == 10) {
42 lprcat("\nYou feel your armor vibrate for a moment");
45 } else if (rnd(43) == 10) {
47 lprcat("\nYou feel your weapon vibrate for a moment");
51 createmonster(makemonst(level
+ 1));
60 lprcat("how much do you donate? ");
61 k
= readnum((long)c
[GOLD
]);
62 if (c
[GOLD
] < (long)k
) {
63 lprcat("\nYou don't have that much!");
67 if ((long)k
< c
[GOLD
] / 10 || (long)k
< rnd(50)) {
68 createmonster(makemonst(level
+ 1));
70 } else if (rnd(101) > 50) {
73 } else if (rnd(43) == 5) {
75 lprcat("\nYou feel your armor vibrate for a moment");
78 } else if (rnd(43) == 8) {
80 lprcat("\nYou feel your weapon vibrate for a moment");
84 lprcat("\nThank You.");
95 createmonster(makemonst(level
+ 2) + 8);
97 } else if (rnd(101) < 30) {
98 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
99 forget(); /* remember to destroy the altar */
101 lprcat("\nnothing happens");
108 createmonster(makemonst(level
+ 1));
109 c
[AGGRAVATE
] += rnd(450);
111 lprcat("\nnothing happens");
118 function to cast a +3 protection on the player
123 lprcat("\nYou have been heard!");
125 c
[MOREDEFENSES
] += 3;
126 c
[ALTPRO
] += 500; /* protection field */
131 subroutine to process a throne object
138 lprcat("\nDo you (p) pry off jewels, (s) sit down");
147 for (i
= 0; i
< rnd(4); i
++)
148 creategem(); /* gems pop off the throne */
149 item
[playerx
][playery
] = ODEADTHRONE
;
150 know
[playerx
][playery
] = 0;
151 } else if (k
< 40 && arg
== 0) {
152 createmonster(GNOMEKING
);
153 item
[playerx
][playery
] = OTHRONE2
;
154 know
[playerx
][playery
] = 0;
156 lprcat("\nnothing happens");
162 if (k
< 30 && arg
== 0) {
163 createmonster(GNOMEKING
);
164 item
[playerx
][playery
] = OTHRONE2
;
165 know
[playerx
][playery
] = 0;
167 lprcat("\nZaaaappp! You've been teleported!\n");
171 lprcat("\nnothing happens");
187 lprcat("\nDo you (s) sit down");
196 lprcat("\nZaaaappp! You've been teleported!\n");
200 lprcat("\nnothing happens");
212 subroutine to process a throne object
218 lprcat("\nDo you (t) take it, (o) try to open it");
227 lprcat("\nThe chest explodes as you open it");
230 lastnum
= 281; /* in case he dies */
231 lprintf("\nYou suffer %d hit points damage!", (long)i
);
233 switch (rnd(10)) { /* see if he gets a curse */
235 c
[ITCHING
] += rnd(1000) + 100;
236 lprcat("\nYou feel an irritation spread over your skin!");
241 c
[CLUMSINESS
] += rnd(1600) + 200;
242 lprcat("\nYou begin to lose hand to eye coordination!");
247 c
[HALFDAM
] += rnd(1600) + 200;
249 lprcat("\nA sickness engulfs you!");
252 item
[playerx
][playery
] = know
[playerx
][playery
] = 0;
254 creategem(); /* gems from the chest */
255 dropgold(rnd(110 * iarg
[playerx
][playery
] + 200));
256 for (i
= 0; i
< rnd(4); i
++)
257 something(iarg
[playerx
][playery
] + 2);
259 lprcat("\nnothing happens");
264 if (take(OCHEST
, iarg
[playerx
][playery
]) == 0)
265 item
[playerx
][playery
] = know
[playerx
][playery
] = 0;
277 process a fountain object
284 lprcat("\nDo you (d) drink, (w) wash yourself");
291 lprcat("\nOops! You seem to have caught the dreadful sleep!");
300 c
[HALFDAM
] += 200 + rnd(200);
301 lprcat("\nYou feel a sickness coming on");
303 quaffpotion(23); /* see invisible */
305 lprcat("\nnothing seems to have happened");
306 else if (rnd(3) != 2)
307 fntchange(1); /* change char levels upward */
309 fntchange(-1); /* change char levels downward */
311 lprcat("\nThe fountains bubbling slowly quiets");
312 item
[playerx
][playery
] = ODEADFOUNTAIN
; /* dead fountain */
313 know
[playerx
][playery
] = 0;
323 lprcat("wash yourself");
325 x
= rnd((level
<< 2) + 2);
326 lprintf("\nOh no! The water was foul! You suffer %d hit points!", (long)x
);
331 } else if (rnd(100) < 29)
332 lprcat("\nYou got the dirt off!");
333 else if (rnd(100) < 31)
334 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
335 else if (rnd(100) < 34)
336 createmonster(WATERLORD
); /* make water lord */
338 lprcat("\nnothing seems to have happened");
348 subroutine to process an up/down of a character attribute for ofountain
351 fch(int how
, long *x
)
354 lprcat(" went down by one!");
357 lprcat(" went up by one!");
364 a subroutine to raise or lower character levels
365 if x > 0 they are raised if x < 0 they are lowered
374 lprcat("Your strength");
378 lprcat("Your intelligence");
382 lprcat("Your wisdom");
386 lprcat("Your constitution");
390 lprcat("Your dexterity");
394 lprcat("Your charm");
400 lprintf("You lose %d hit point", (long)j
);
407 lprintf("You gain %d hit point", (long)j
);
420 lprintf("You just gained %d spell", (long)j
);
421 raisemspells((int)j
);
427 lprintf("You just lost %d spell", (long)j
);
438 j
= 5 * rnd((level
+ 1) * (level
+ 1));
440 lprintf("You just lost %d experience point", (long)j
);
445 loseexperience((long)j
);
447 lprintf("You just gained %d experience point", (long)j
);
452 raiseexperience((long)j
);