4 * action.c Larn is copyrighted 1986 by Noah Morgan.
6 * Routines in this file:
10 #include <sys/cdefs.h>
12 __RCSID("$NetBSD: moreobj.c,v 1.10 2008/02/04 01:07:01 dholland Exp $");
19 static void ohear(void);
24 * Remove gems from a throne.
26 * arg is zero if there is a gnome king associated with the throne.
28 * Assumes that cursors() has been called previously, and that a check
29 * has been made that the throne actually has gems.
32 act_remove_gems(int arg
)
38 for (i
= 0; i
< rnd(4); i
++)
39 creategem(); /* gems pop off the
41 item
[playerx
][playery
] = ODEADTHRONE
;
42 know
[playerx
][playery
] = 0;
43 } else if (k
< 40 && arg
== 0) {
44 createmonster(GNOMEKING
);
45 item
[playerx
][playery
] = OTHRONE2
;
46 know
[playerx
][playery
] = 0;
48 lprcat("\nnothing happens");
56 * arg is zero if there is a gnome king associated with the throne
58 * Assumes that cursors() has been called previously.
61 act_sit_throne(int arg
)
66 if (k
< 30 && arg
== 0) {
67 createmonster(GNOMEKING
);
68 item
[playerx
][playery
] = OTHRONE2
;
69 know
[playerx
][playery
] = 0;
71 lprcat("\nZaaaappp! You've been teleported!\n");
75 lprcat("\nnothing happens");
79 * Code to perform the action of drinking at a fountain. Assumes that
80 * cursors() has already been called, and that a check has been made
81 * that the player is actually standing at a live fountain.
84 act_drink_fountain(void)
89 lprcat("\nOops! You seem to have caught the dreadful sleep!");
98 c
[HALFDAM
] += 200 + rnd(200);
99 lprcat("\nYou feel a sickness coming on");
101 quaffpotion(23); /* see invisible */
103 lprcat("\nnothing seems to have happened");
104 else if (rnd(3) != 2)
105 fntchange(1); /* change char levels upward */
107 fntchange(-1); /* change char levels
110 lprcat("\nThe fountains bubbling slowly quiets");
111 item
[playerx
][playery
] = ODEADFOUNTAIN
; /* dead fountain */
112 know
[playerx
][playery
] = 0;
117 * Code to perform the action of washing at a fountain. Assumes that
118 * cursors() has already been called and that a check has been made
119 * that the player is actually standing at a live fountain.
122 act_wash_fountain(void)
127 x
= rnd((level
<< 2) + 2);
128 lprintf("\nOh no! The water was foul! You suffer %ld hit points!", (long) x
);
133 } else if (rnd(100) < 29)
134 lprcat("\nYou got the dirt off!");
135 else if (rnd(100) < 31)
136 lprcat("\nThis water seems to be hard water! The dirt didn't come off!");
137 else if (rnd(100) < 34)
138 createmonster(WATERLORD
); /* make water lord */
140 lprcat("\nnothing seems to have happened");
144 * Perform the actions associated with altar desecration.
147 act_desecrate_altar(void)
150 createmonster(makemonst(level
+ 2) + 8);
151 c
[AGGRAVATE
] += 2500;
152 } else if (rnd(101) < 30) {
153 lprcat("\nThe altar crumbles into a pile of dust before your eyes");
154 forget(); /* remember to destroy
157 lprcat("\nnothing happens");
161 * Perform the actions associated with praying at an altar and giving
165 act_donation_pray(void)
174 lprcat("how much do you donate? ");
175 amt
= readnum((long) c
[GOLD
]);
176 if (amt
< 0 || c
[GOLD
] < amt
) {
177 lprcat("\nYou don't have that much!");
181 if (amt
< c
[GOLD
] / 10 || amt
< rnd(50)) {
182 createmonster(makemonst(level
+ 1));
184 } else if (rnd(101) > 50) {
187 } else if (rnd(43) == 5) {
189 lprcat("\nYou feel your armor vibrate for a moment");
192 } else if (rnd(43) == 8) {
194 lprcat("\nYou feel your weapon vibrate for a moment");
198 lprcat("\nThank You.");
203 * Performs the actions associated with 'just praying' at the altar. Called
204 * when the user responds 'just pray' when in prompt mode, or enters 0 to
205 * the money prompt when praying.
207 * Assumes cursors(), and that any leading \n have been printed.
213 lprcat("\nnothing happens");
214 else if (rnd(13) < 4)
216 else if (rnd(43) == 10) {
218 lprcat("\nYou feel your armor vibrate for a moment");
221 } else if (rnd(43) == 10) {
223 lprcat("\nYou feel your weapon vibrate for a moment");
227 createmonster(makemonst(level
+ 1));
231 * Function to cast a +3 protection on the player
236 lprcat("\nYou have been heard!");
238 c
[MOREDEFENSES
] += 3;
239 c
[ALTPRO
] += 500; /* protection field */
244 * Performs the act of ignoring an altar.
246 * Assumptions: cursors() has been called.
249 act_ignore_altar(void)
252 createmonster(makemonst(level
+ 1));
253 c
[AGGRAVATE
] += rnd(450);
255 lprcat("\nnothing happens");
259 * Performs the act of opening a chest.
261 * Parameters: x,y location of the chest to open.
262 * Assumptions: cursors() has been called previously
265 act_open_chest(int x
, int y
)
271 lprcat("\nThe chest explodes as you open it");
274 lastnum
= 281; /* in case he dies */
275 lprintf("\nYou suffer %ld hit points damage!", (long) i
);
277 switch (rnd(10)) { /* see if he gets a
280 c
[ITCHING
] += rnd(1000) + 100;
281 lprcat("\nYou feel an irritation spread over your skin!");
286 c
[CLUMSINESS
] += rnd(1600) + 200;
287 lprcat("\nYou begin to lose hand to eye coordination!");
292 c
[HALFDAM
] += rnd(1600) + 200;
294 lprcat("\nA sickness engulfs you!");
297 item
[x
][y
] = know
[x
][y
] = 0;
299 creategem(); /* gems from the chest */
300 dropgold(rnd(110 * iarg
[x
][y
] + 200));
301 for (i
= 0; i
< rnd(4); i
++)
302 something(iarg
[x
][y
] + 2);
304 lprcat("\nnothing happens");