xref: /csrg-svn/games/rogue/use.c (revision 32689)
1*32689Sbostic /*
2*32689Sbostic  * use.c
3*32689Sbostic  *
4*32689Sbostic  * This source herein may be modified and/or distributed by anybody who
5*32689Sbostic  * so desires, with the following restrictions:
6*32689Sbostic  *    1.)  No portion of this notice shall be removed.
7*32689Sbostic  *    2.)  Credit shall not be taken for the creation of this source.
8*32689Sbostic  *    3.)  This code is not to be traded, sold, or used for personal
9*32689Sbostic  *         gain or profit.
10*32689Sbostic  *
11*32689Sbostic  */
12*32689Sbostic 
13*32689Sbostic #ifndef lint
14*32689Sbostic static char sccsid[] = "@(#)use.c	5.1 (Berkeley) 11/25/87";
15*32689Sbostic #endif /* not lint */
16*32689Sbostic 
17*32689Sbostic #include "rogue.h"
18*32689Sbostic 
19*32689Sbostic short halluc = 0;
20*32689Sbostic short blind = 0;
21*32689Sbostic short confused = 0;
22*32689Sbostic short levitate = 0;
23*32689Sbostic short haste_self = 0;
24*32689Sbostic boolean see_invisible = 0;
25*32689Sbostic short extra_hp = 0;
26*32689Sbostic boolean detect_monster = 0;
27*32689Sbostic boolean con_mon = 0;
28*32689Sbostic char *strange_feeling = "you have a strange feeling for a moment, then it passes";
29*32689Sbostic 
30*32689Sbostic extern short bear_trap;
31*32689Sbostic extern char hunger_str[];
32*32689Sbostic extern short cur_room;
33*32689Sbostic extern long level_points[];
34*32689Sbostic extern boolean being_held;
35*32689Sbostic extern char *fruit, *you_can_move_again;
36*32689Sbostic extern boolean sustain_strength;
37*32689Sbostic 
38*32689Sbostic quaff()
39*32689Sbostic {
40*32689Sbostic 	short ch;
41*32689Sbostic 	char buf[80];
42*32689Sbostic 	object *obj;
43*32689Sbostic 
44*32689Sbostic 	ch = pack_letter("quaff what?", POTION);
45*32689Sbostic 
46*32689Sbostic 	if (ch == CANCEL) {
47*32689Sbostic 		return;
48*32689Sbostic 	}
49*32689Sbostic 	if (!(obj = get_letter_object(ch))) {
50*32689Sbostic 		message("no such item.", 0);
51*32689Sbostic 		return;
52*32689Sbostic 	}
53*32689Sbostic 	if (obj->what_is != POTION) {
54*32689Sbostic 		message("you can't drink that", 0);
55*32689Sbostic 		return;
56*32689Sbostic 	}
57*32689Sbostic 	switch(obj->which_kind) {
58*32689Sbostic 		case INCREASE_STRENGTH:
59*32689Sbostic 			message("you feel stronger now, what bulging muscles!",
60*32689Sbostic 			0);
61*32689Sbostic 			rogue.str_current++;
62*32689Sbostic 			if (rogue.str_current > rogue.str_max) {
63*32689Sbostic 				rogue.str_max = rogue.str_current;
64*32689Sbostic 			}
65*32689Sbostic 			break;
66*32689Sbostic 		case RESTORE_STRENGTH:
67*32689Sbostic 			rogue.str_current = rogue.str_max;
68*32689Sbostic 			message("this tastes great, you feel warm all over", 0);
69*32689Sbostic 			break;
70*32689Sbostic 		case HEALING:
71*32689Sbostic 			message("you begin to feel better", 0);
72*32689Sbostic 			potion_heal(0);
73*32689Sbostic 			break;
74*32689Sbostic 		case EXTRA_HEALING:
75*32689Sbostic 			message("you begin to feel much better", 0);
76*32689Sbostic 			potion_heal(1);
77*32689Sbostic 			break;
78*32689Sbostic 		case POISON:
79*32689Sbostic 			if (!sustain_strength) {
80*32689Sbostic 				rogue.str_current -= get_rand(1, 3);
81*32689Sbostic 				if (rogue.str_current < 1) {
82*32689Sbostic 					rogue.str_current = 1;
83*32689Sbostic 				}
84*32689Sbostic 			}
85*32689Sbostic 			message("you feel very sick now", 0);
86*32689Sbostic 			if (halluc) {
87*32689Sbostic 				unhallucinate();
88*32689Sbostic 			}
89*32689Sbostic 			break;
90*32689Sbostic 		case RAISE_LEVEL:
91*32689Sbostic 			rogue.exp_points = level_points[rogue.exp - 1];
92*32689Sbostic 			message("you suddenly feel much more skillful", 0);
93*32689Sbostic 			add_exp(1, 1);
94*32689Sbostic 			break;
95*32689Sbostic 		case BLINDNESS:
96*32689Sbostic 			go_blind();
97*32689Sbostic 			break;
98*32689Sbostic 		case HALLUCINATION:
99*32689Sbostic 			message("oh wow, everything seems so cosmic", 0);
100*32689Sbostic 			halluc += get_rand(500, 800);
101*32689Sbostic 			break;
102*32689Sbostic 		case DETECT_MONSTER:
103*32689Sbostic 			show_monsters();
104*32689Sbostic 			if (!(level_monsters.next_monster)) {
105*32689Sbostic 				message(strange_feeling, 0);
106*32689Sbostic 			}
107*32689Sbostic 			break;
108*32689Sbostic 		case DETECT_OBJECTS:
109*32689Sbostic 			if (level_objects.next_object) {
110*32689Sbostic 				if (!blind) {
111*32689Sbostic 					show_objects();
112*32689Sbostic 				}
113*32689Sbostic 			} else {
114*32689Sbostic 				message(strange_feeling, 0);
115*32689Sbostic 			}
116*32689Sbostic 			break;
117*32689Sbostic 		case CONFUSION:
118*32689Sbostic 			message((halluc ? "what a trippy feeling" :
119*32689Sbostic 			"you feel confused"), 0);
120*32689Sbostic 			cnfs();
121*32689Sbostic 			break;
122*32689Sbostic 		case LEVITATION:
123*32689Sbostic 			message("you start to float in the air", 0);
124*32689Sbostic 			levitate += get_rand(15, 30);
125*32689Sbostic 			being_held = bear_trap = 0;
126*32689Sbostic 			break;
127*32689Sbostic 		case HASTE_SELF:
128*32689Sbostic 			message("you feel yourself moving much faster", 0);
129*32689Sbostic 			haste_self += get_rand(11, 21);
130*32689Sbostic 			if (!(haste_self % 2)) {
131*32689Sbostic 				haste_self++;
132*32689Sbostic 			}
133*32689Sbostic 			break;
134*32689Sbostic 		case SEE_INVISIBLE:
135*32689Sbostic 			sprintf(buf, "hmm, this potion tastes like %sjuice", fruit);
136*32689Sbostic 			message(buf, 0);
137*32689Sbostic 			if (blind) {
138*32689Sbostic 				unblind();
139*32689Sbostic 			}
140*32689Sbostic 			see_invisible = 1;
141*32689Sbostic 			relight();
142*32689Sbostic 			break;
143*32689Sbostic 	}
144*32689Sbostic 	print_stats((STAT_STRENGTH | STAT_HP));
145*32689Sbostic 	if (id_potions[obj->which_kind].id_status != CALLED) {
146*32689Sbostic 		id_potions[obj->which_kind].id_status = IDENTIFIED;
147*32689Sbostic 	}
148*32689Sbostic 	vanish(obj, 1, &rogue.pack);
149*32689Sbostic }
150*32689Sbostic 
151*32689Sbostic read_scroll()
152*32689Sbostic {
153*32689Sbostic 	short ch;
154*32689Sbostic 	object *obj;
155*32689Sbostic 	char msg[DCOLS];
156*32689Sbostic 
157*32689Sbostic 	ch = pack_letter("read what?", SCROL);
158*32689Sbostic 
159*32689Sbostic 	if (ch == CANCEL) {
160*32689Sbostic 		return;
161*32689Sbostic 	}
162*32689Sbostic 	if (!(obj = get_letter_object(ch))) {
163*32689Sbostic 		message("no such item.", 0);
164*32689Sbostic 		return;
165*32689Sbostic 	}
166*32689Sbostic 	if (obj->what_is != SCROL) {
167*32689Sbostic 		message("you can't read that", 0);
168*32689Sbostic 		return;
169*32689Sbostic 	}
170*32689Sbostic 	switch(obj->which_kind) {
171*32689Sbostic 		case SCARE_MONSTER:
172*32689Sbostic 			message("you hear a maniacal laughter in the distance",
173*32689Sbostic 			0);
174*32689Sbostic 			break;
175*32689Sbostic 		case HOLD_MONSTER:
176*32689Sbostic 			hold_monster();
177*32689Sbostic 			break;
178*32689Sbostic 		case ENCH_WEAPON:
179*32689Sbostic 			if (rogue.weapon) {
180*32689Sbostic 				if (rogue.weapon->what_is == WEAPON) {
181*32689Sbostic 					sprintf(msg, "your %sglow%s %sfor a moment",
182*32689Sbostic 					name_of(rogue.weapon),
183*32689Sbostic 					((rogue.weapon->quantity <= 1) ? "s" : ""),
184*32689Sbostic 					get_ench_color());
185*32689Sbostic 					message(msg, 0);
186*32689Sbostic 					if (coin_toss()) {
187*32689Sbostic 						rogue.weapon->hit_enchant++;
188*32689Sbostic 					} else {
189*32689Sbostic 						rogue.weapon->d_enchant++;
190*32689Sbostic 					}
191*32689Sbostic 				}
192*32689Sbostic 				rogue.weapon->is_cursed = 0;
193*32689Sbostic 			} else {
194*32689Sbostic 				message("your hands tingle", 0);
195*32689Sbostic 			}
196*32689Sbostic 			break;
197*32689Sbostic 		case ENCH_ARMOR:
198*32689Sbostic 			if (rogue.armor) {
199*32689Sbostic 				sprintf(msg, "your armor glows %sfor a moment",
200*32689Sbostic 				get_ench_color());
201*32689Sbostic 				message(msg, 0);
202*32689Sbostic 				rogue.armor->d_enchant++;
203*32689Sbostic 				rogue.armor->is_cursed = 0;
204*32689Sbostic 				print_stats(STAT_ARMOR);
205*32689Sbostic 			} else {
206*32689Sbostic 				message("your skin crawls", 0);
207*32689Sbostic 			}
208*32689Sbostic 			break;
209*32689Sbostic 		case IDENTIFY:
210*32689Sbostic 			message("this is a scroll of identify", 0);
211*32689Sbostic 			obj->identified = 1;
212*32689Sbostic 			id_scrolls[obj->which_kind].id_status = IDENTIFIED;
213*32689Sbostic 			idntfy();
214*32689Sbostic 			break;
215*32689Sbostic 		case TELEPORT:
216*32689Sbostic 			tele();
217*32689Sbostic 			break;
218*32689Sbostic 		case SLEEP:
219*32689Sbostic 			message("you fall asleep", 0);
220*32689Sbostic 			take_a_nap();
221*32689Sbostic 			break;
222*32689Sbostic 		case PROTECT_ARMOR:
223*32689Sbostic 			if (rogue.armor) {
224*32689Sbostic 				message( "your armor is covered by a shimmering gold shield",0);
225*32689Sbostic 				rogue.armor->is_protected = 1;
226*32689Sbostic 				rogue.armor->is_cursed = 0;
227*32689Sbostic 			} else {
228*32689Sbostic 				message("your acne seems to have disappeared", 0);
229*32689Sbostic 			}
230*32689Sbostic 			break;
231*32689Sbostic 		case REMOVE_CURSE:
232*32689Sbostic 				message((!halluc) ?
233*32689Sbostic 					"you feel as though someone is watching over you" :
234*32689Sbostic 					"you feel in touch with the universal oneness", 0);
235*32689Sbostic 			uncurse_all();
236*32689Sbostic 			break;
237*32689Sbostic 		case CREATE_MONSTER:
238*32689Sbostic 			create_monster();
239*32689Sbostic 			break;
240*32689Sbostic 		case AGGRAVATE_MONSTER:
241*32689Sbostic 			aggravate();
242*32689Sbostic 			break;
243*32689Sbostic 		case MAGIC_MAPPING:
244*32689Sbostic 			message("this scroll seems to have a map on it", 0);
245*32689Sbostic 			draw_magic_map();
246*32689Sbostic 			break;
247*32689Sbostic 		case CON_MON:
248*32689Sbostic 			con_mon = 1;
249*32689Sbostic 			sprintf(msg, "your hands glow %sfor a moment", get_ench_color());
250*32689Sbostic 			message(msg, 0);
251*32689Sbostic 			break;
252*32689Sbostic 	}
253*32689Sbostic 	if (id_scrolls[obj->which_kind].id_status != CALLED) {
254*32689Sbostic 		id_scrolls[obj->which_kind].id_status = IDENTIFIED;
255*32689Sbostic 	}
256*32689Sbostic 	vanish(obj, (obj->which_kind != SLEEP), &rogue.pack);
257*32689Sbostic }
258*32689Sbostic 
259*32689Sbostic /* vanish() does NOT handle a quiver of weapons with more than one
260*32689Sbostic  *  arrow (or whatever) in the quiver.  It will only decrement the count.
261*32689Sbostic  */
262*32689Sbostic 
263*32689Sbostic vanish(obj, rm, pack)
264*32689Sbostic object *obj;
265*32689Sbostic short rm;
266*32689Sbostic object *pack;
267*32689Sbostic {
268*32689Sbostic 	if (obj->quantity > 1) {
269*32689Sbostic 		obj->quantity--;
270*32689Sbostic 	} else {
271*32689Sbostic 		if (obj->in_use_flags & BEING_WIELDED) {
272*32689Sbostic 			unwield(obj);
273*32689Sbostic 		} else if (obj->in_use_flags & BEING_WORN) {
274*32689Sbostic 			unwear(obj);
275*32689Sbostic 		} else if (obj->in_use_flags & ON_EITHER_HAND) {
276*32689Sbostic 			un_put_on(obj);
277*32689Sbostic 		}
278*32689Sbostic 		take_from_pack(obj, pack);
279*32689Sbostic 		free_object(obj);
280*32689Sbostic 	}
281*32689Sbostic 	if (rm) {
282*32689Sbostic 		(void) reg_move();
283*32689Sbostic 	}
284*32689Sbostic }
285*32689Sbostic 
286*32689Sbostic potion_heal(extra)
287*32689Sbostic {
288*32689Sbostic 	float ratio;
289*32689Sbostic 	short add;
290*32689Sbostic 
291*32689Sbostic 	rogue.hp_current += rogue.exp;
292*32689Sbostic 
293*32689Sbostic 	ratio = ((float)rogue.hp_current) / rogue.hp_max;
294*32689Sbostic 
295*32689Sbostic 	if (ratio >= 1.00) {
296*32689Sbostic 		rogue.hp_max += (extra ? 2 : 1);
297*32689Sbostic 		extra_hp += (extra ? 2 : 1);
298*32689Sbostic 		rogue.hp_current = rogue.hp_max;
299*32689Sbostic 	} else if (ratio >= 0.90) {
300*32689Sbostic 		rogue.hp_max += (extra ? 1 : 0);
301*32689Sbostic 		extra_hp += (extra ? 1 : 0);
302*32689Sbostic 		rogue.hp_current = rogue.hp_max;
303*32689Sbostic 	} else {
304*32689Sbostic 		if (ratio < 0.33) {
305*32689Sbostic 			ratio = 0.33;
306*32689Sbostic 		}
307*32689Sbostic 		if (extra) {
308*32689Sbostic 			ratio += ratio;
309*32689Sbostic 		}
310*32689Sbostic 		add = (short)(ratio * ((float)rogue.hp_max - rogue.hp_current));
311*32689Sbostic 		rogue.hp_current += add;
312*32689Sbostic 		if (rogue.hp_current > rogue.hp_max) {
313*32689Sbostic 			rogue.hp_current = rogue.hp_max;
314*32689Sbostic 		}
315*32689Sbostic 	}
316*32689Sbostic 	if (blind) {
317*32689Sbostic 		unblind();
318*32689Sbostic 	}
319*32689Sbostic 	if (confused && extra) {
320*32689Sbostic 			unconfuse();
321*32689Sbostic 	} else if (confused) {
322*32689Sbostic 		confused = (confused / 2) + 1;
323*32689Sbostic 	}
324*32689Sbostic 	if (halluc && extra) {
325*32689Sbostic 		unhallucinate();
326*32689Sbostic 	} else if (halluc) {
327*32689Sbostic 		halluc = (halluc / 2) + 1;
328*32689Sbostic 	}
329*32689Sbostic }
330*32689Sbostic 
331*32689Sbostic idntfy()
332*32689Sbostic {
333*32689Sbostic 	short ch;
334*32689Sbostic 	object *obj;
335*32689Sbostic 	struct id *id_table;
336*32689Sbostic 	char desc[DCOLS];
337*32689Sbostic AGAIN:
338*32689Sbostic 	ch = pack_letter("what would you like to identify?", ALL_OBJECTS);
339*32689Sbostic 
340*32689Sbostic 	if (ch == CANCEL) {
341*32689Sbostic 		return;
342*32689Sbostic 	}
343*32689Sbostic 	if (!(obj = get_letter_object(ch))) {
344*32689Sbostic 		message("no such item, try again", 0);
345*32689Sbostic 		message("", 0);
346*32689Sbostic 		check_message();
347*32689Sbostic 		goto AGAIN;
348*32689Sbostic 	}
349*32689Sbostic 	obj->identified = 1;
350*32689Sbostic 	if (obj->what_is & (SCROL | POTION | WEAPON | ARMOR | WAND | RING)) {
351*32689Sbostic 		id_table = get_id_table(obj);
352*32689Sbostic 		id_table[obj->which_kind].id_status = IDENTIFIED;
353*32689Sbostic 	}
354*32689Sbostic 	get_desc(obj, desc);
355*32689Sbostic 	message(desc, 0);
356*32689Sbostic }
357*32689Sbostic 
358*32689Sbostic eat()
359*32689Sbostic {
360*32689Sbostic 	short ch;
361*32689Sbostic 	short moves;
362*32689Sbostic 	object *obj;
363*32689Sbostic 	char buf[70];
364*32689Sbostic 
365*32689Sbostic 	ch = pack_letter("eat what?", FOOD);
366*32689Sbostic 
367*32689Sbostic 	if (ch == CANCEL) {
368*32689Sbostic 		return;
369*32689Sbostic 	}
370*32689Sbostic 	if (!(obj = get_letter_object(ch))) {
371*32689Sbostic 		message("no such item.", 0);
372*32689Sbostic 		return;
373*32689Sbostic 	}
374*32689Sbostic 	if (obj->what_is != FOOD) {
375*32689Sbostic 		message("you can't eat that", 0);
376*32689Sbostic 		return;
377*32689Sbostic 	}
378*32689Sbostic 	if ((obj->which_kind == FRUIT) || rand_percent(60)) {
379*32689Sbostic 		moves = get_rand(950, 1150);
380*32689Sbostic 		if (obj->which_kind == RATION) {
381*32689Sbostic 			message("yum, that tasted good", 0);
382*32689Sbostic 		} else {
383*32689Sbostic 			sprintf(buf, "my, that was a yummy %s", fruit);
384*32689Sbostic 			message(buf, 0);
385*32689Sbostic 		}
386*32689Sbostic 	} else {
387*32689Sbostic 		moves = get_rand(750, 950);
388*32689Sbostic 		message("yuk, that food tasted awful", 0);
389*32689Sbostic 		add_exp(2, 1);
390*32689Sbostic 	}
391*32689Sbostic 	rogue.moves_left /= 3;
392*32689Sbostic 	rogue.moves_left += moves;
393*32689Sbostic 	hunger_str[0] = 0;
394*32689Sbostic 	print_stats(STAT_HUNGER);
395*32689Sbostic 
396*32689Sbostic 	vanish(obj, 1, &rogue.pack);
397*32689Sbostic }
398*32689Sbostic 
399*32689Sbostic hold_monster()
400*32689Sbostic {
401*32689Sbostic 	short i, j;
402*32689Sbostic 	short mcount = 0;
403*32689Sbostic 	object *monster;
404*32689Sbostic 	short row, col;
405*32689Sbostic 
406*32689Sbostic 	for (i = -2; i <= 2; i++) {
407*32689Sbostic 		for (j = -2; j <= 2; j++) {
408*32689Sbostic 			row = rogue.row + i;
409*32689Sbostic 			col = rogue.col + j;
410*32689Sbostic 			if ((row < MIN_ROW) || (row > (DROWS-2)) || (col < 0) ||
411*32689Sbostic 				 (col > (DCOLS-1))) {
412*32689Sbostic 				continue;
413*32689Sbostic 			}
414*32689Sbostic 			if (dungeon[row][col] & MONSTER) {
415*32689Sbostic 				monster = object_at(&level_monsters, row, col);
416*32689Sbostic 				monster->m_flags |= ASLEEP;
417*32689Sbostic 				monster->m_flags &= (~WAKENS);
418*32689Sbostic 				mcount++;
419*32689Sbostic 			}
420*32689Sbostic 		}
421*32689Sbostic 	}
422*32689Sbostic 	if (mcount == 0) {
423*32689Sbostic 		message("you feel a strange sense of loss", 0);
424*32689Sbostic 	} else if (mcount == 1) {
425*32689Sbostic 		message("the monster freezes", 0);
426*32689Sbostic 	} else {
427*32689Sbostic 		message("the monsters around you freeze", 0);
428*32689Sbostic 	}
429*32689Sbostic }
430*32689Sbostic 
431*32689Sbostic tele()
432*32689Sbostic {
433*32689Sbostic 	mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col));
434*32689Sbostic 
435*32689Sbostic 	if (cur_room >= 0) {
436*32689Sbostic 		darken_room(cur_room);
437*32689Sbostic 	}
438*32689Sbostic 	put_player(get_room_number(rogue.row, rogue.col));
439*32689Sbostic 	being_held = 0;
440*32689Sbostic 	bear_trap = 0;
441*32689Sbostic }
442*32689Sbostic 
443*32689Sbostic hallucinate()
444*32689Sbostic {
445*32689Sbostic 	object *obj, *monster;
446*32689Sbostic 	short ch;
447*32689Sbostic 
448*32689Sbostic 	if (blind) return;
449*32689Sbostic 
450*32689Sbostic 	obj = level_objects.next_object;
451*32689Sbostic 
452*32689Sbostic 	while (obj) {
453*32689Sbostic 		ch = mvinch(obj->row, obj->col);
454*32689Sbostic 		if (((ch < 'A') || (ch > 'Z')) &&
455*32689Sbostic 			((obj->row != rogue.row) || (obj->col != rogue.col)))
456*32689Sbostic 		if ((ch != ' ') && (ch != '.') && (ch != '#') && (ch != '+')) {
457*32689Sbostic 			addch(gr_obj_char());
458*32689Sbostic 		}
459*32689Sbostic 		obj = obj->next_object;
460*32689Sbostic 	}
461*32689Sbostic 	monster = level_monsters.next_monster;
462*32689Sbostic 
463*32689Sbostic 	while (monster) {
464*32689Sbostic 		ch = mvinch(monster->row, monster->col);
465*32689Sbostic 		if ((ch >= 'A') && (ch <= 'Z')) {
466*32689Sbostic 			addch(get_rand('A', 'Z'));
467*32689Sbostic 		}
468*32689Sbostic 		monster = monster->next_monster;
469*32689Sbostic 	}
470*32689Sbostic }
471*32689Sbostic 
472*32689Sbostic unhallucinate()
473*32689Sbostic {
474*32689Sbostic 	halluc = 0;
475*32689Sbostic 	relight();
476*32689Sbostic 	message("everything looks SO boring now", 1);
477*32689Sbostic }
478*32689Sbostic 
479*32689Sbostic unblind()
480*32689Sbostic {
481*32689Sbostic 	blind = 0;
482*32689Sbostic 	message("the veil of darkness lifts", 1);
483*32689Sbostic 	relight();
484*32689Sbostic 	if (halluc) {
485*32689Sbostic 		hallucinate();
486*32689Sbostic 	}
487*32689Sbostic 	if (detect_monster) {
488*32689Sbostic 		show_monsters();
489*32689Sbostic 	}
490*32689Sbostic }
491*32689Sbostic 
492*32689Sbostic relight()
493*32689Sbostic {
494*32689Sbostic 	if (cur_room == PASSAGE) {
495*32689Sbostic 		light_passage(rogue.row, rogue.col);
496*32689Sbostic 	} else {
497*32689Sbostic 		light_up_room(cur_room);
498*32689Sbostic 	}
499*32689Sbostic 	mvaddch(rogue.row, rogue.col, rogue.fchar);
500*32689Sbostic }
501*32689Sbostic 
502*32689Sbostic take_a_nap()
503*32689Sbostic {
504*32689Sbostic 	short i;
505*32689Sbostic 
506*32689Sbostic 	i = get_rand(2, 5);
507*32689Sbostic 	md_sleep(1);
508*32689Sbostic 
509*32689Sbostic 	while (i--) {
510*32689Sbostic 		mv_mons();
511*32689Sbostic 	}
512*32689Sbostic 	md_sleep(1);
513*32689Sbostic 	message(you_can_move_again, 0);
514*32689Sbostic }
515*32689Sbostic 
516*32689Sbostic go_blind()
517*32689Sbostic {
518*32689Sbostic 	short i, j;
519*32689Sbostic 
520*32689Sbostic 	if (!blind) {
521*32689Sbostic 		message("a cloak of darkness falls around you", 0);
522*32689Sbostic 	}
523*32689Sbostic 	blind += get_rand(500, 800);
524*32689Sbostic 
525*32689Sbostic 	if (detect_monster) {
526*32689Sbostic 		object *monster;
527*32689Sbostic 
528*32689Sbostic 		monster = level_monsters.next_monster;
529*32689Sbostic 
530*32689Sbostic 		while (monster) {
531*32689Sbostic 			mvaddch(monster->row, monster->col, monster->trail_char);
532*32689Sbostic 			monster = monster->next_monster;
533*32689Sbostic 		}
534*32689Sbostic 	}
535*32689Sbostic 	if (cur_room >= 0) {
536*32689Sbostic 		for (i = rooms[cur_room].top_row + 1;
537*32689Sbostic 			 i < rooms[cur_room].bottom_row; i++) {
538*32689Sbostic 			for (j = rooms[cur_room].left_col + 1;
539*32689Sbostic 				 j < rooms[cur_room].right_col; j++) {
540*32689Sbostic 				mvaddch(i, j, ' ');
541*32689Sbostic 			}
542*32689Sbostic 		}
543*32689Sbostic 	}
544*32689Sbostic 	mvaddch(rogue.row, rogue.col, rogue.fchar);
545*32689Sbostic }
546*32689Sbostic 
547*32689Sbostic char *
548*32689Sbostic get_ench_color()
549*32689Sbostic {
550*32689Sbostic 	if (halluc) {
551*32689Sbostic 		return(id_potions[get_rand(0, POTIONS-1)].title);
552*32689Sbostic 	} else if (con_mon) {
553*32689Sbostic 		return("red ");
554*32689Sbostic 	}
555*32689Sbostic 	return("blue ");
556*32689Sbostic }
557*32689Sbostic 
558*32689Sbostic cnfs()
559*32689Sbostic {
560*32689Sbostic 	confused += get_rand(12, 22);
561*32689Sbostic }
562*32689Sbostic 
563*32689Sbostic unconfuse()
564*32689Sbostic {
565*32689Sbostic 	char msg[80];
566*32689Sbostic 
567*32689Sbostic 	confused = 0;
568*32689Sbostic 	sprintf(msg, "you feel less %s now", (halluc ? "trippy" : "confused"));
569*32689Sbostic 	message(msg, 1);
570*32689Sbostic }
571*32689Sbostic 
572*32689Sbostic uncurse_all()
573*32689Sbostic {
574*32689Sbostic 	object *obj;
575*32689Sbostic 
576*32689Sbostic 	obj = rogue.pack.next_object;
577*32689Sbostic 
578*32689Sbostic 	while (obj) {
579*32689Sbostic 		obj->is_cursed = 0;
580*32689Sbostic 		obj = obj->next_object;
581*32689Sbostic 	}
582*32689Sbostic }
583