xref: /csrg-svn/games/rogue/use.c (revision 36704)
132689Sbostic /*
2*36704Sbostic  * Copyright (c) 1988 The Regents of the University of California.
3*36704Sbostic  * All rights reserved.
4*36704Sbostic  *
5*36704Sbostic  * This code is derived from software contributed to Berkeley by
6*36704Sbostic  * Timothy C. Stoehr.
7*36704Sbostic  *
8*36704Sbostic  * Redistribution and use in source and binary forms are permitted
9*36704Sbostic  * provided that the above copyright notice and this paragraph are
10*36704Sbostic  * duplicated in all such forms and that any documentation,
11*36704Sbostic  * advertising materials, and other materials related to such
12*36704Sbostic  * distribution and use acknowledge that the software was developed
13*36704Sbostic  * by the University of California, Berkeley.  The name of the
14*36704Sbostic  * University may not be used to endorse or promote products derived
15*36704Sbostic  * from this software without specific prior written permission.
16*36704Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17*36704Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18*36704Sbostic  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19*36704Sbostic  */
20*36704Sbostic 
21*36704Sbostic #ifndef lint
22*36704Sbostic static char sccsid[] = "@(#)use.c	5.2 (Berkeley) 02/07/89";
23*36704Sbostic #endif /* not lint */
24*36704Sbostic 
25*36704Sbostic /*
2632689Sbostic  * use.c
2732689Sbostic  *
2832689Sbostic  * This source herein may be modified and/or distributed by anybody who
2932689Sbostic  * so desires, with the following restrictions:
3032689Sbostic  *    1.)  No portion of this notice shall be removed.
3132689Sbostic  *    2.)  Credit shall not be taken for the creation of this source.
3232689Sbostic  *    3.)  This code is not to be traded, sold, or used for personal
3332689Sbostic  *         gain or profit.
3432689Sbostic  *
3532689Sbostic  */
3632689Sbostic 
3732689Sbostic #include "rogue.h"
3832689Sbostic 
3932689Sbostic short halluc = 0;
4032689Sbostic short blind = 0;
4132689Sbostic short confused = 0;
4232689Sbostic short levitate = 0;
4332689Sbostic short haste_self = 0;
4432689Sbostic boolean see_invisible = 0;
4532689Sbostic short extra_hp = 0;
4632689Sbostic boolean detect_monster = 0;
4732689Sbostic boolean con_mon = 0;
4832689Sbostic char *strange_feeling = "you have a strange feeling for a moment, then it passes";
4932689Sbostic 
5032689Sbostic extern short bear_trap;
5132689Sbostic extern char hunger_str[];
5232689Sbostic extern short cur_room;
5332689Sbostic extern long level_points[];
5432689Sbostic extern boolean being_held;
5532689Sbostic extern char *fruit, *you_can_move_again;
5632689Sbostic extern boolean sustain_strength;
5732689Sbostic 
5832689Sbostic quaff()
5932689Sbostic {
6032689Sbostic 	short ch;
6132689Sbostic 	char buf[80];
6232689Sbostic 	object *obj;
6332689Sbostic 
6432689Sbostic 	ch = pack_letter("quaff what?", POTION);
6532689Sbostic 
6632689Sbostic 	if (ch == CANCEL) {
6732689Sbostic 		return;
6832689Sbostic 	}
6932689Sbostic 	if (!(obj = get_letter_object(ch))) {
7032689Sbostic 		message("no such item.", 0);
7132689Sbostic 		return;
7232689Sbostic 	}
7332689Sbostic 	if (obj->what_is != POTION) {
7432689Sbostic 		message("you can't drink that", 0);
7532689Sbostic 		return;
7632689Sbostic 	}
7732689Sbostic 	switch(obj->which_kind) {
7832689Sbostic 		case INCREASE_STRENGTH:
7932689Sbostic 			message("you feel stronger now, what bulging muscles!",
8032689Sbostic 			0);
8132689Sbostic 			rogue.str_current++;
8232689Sbostic 			if (rogue.str_current > rogue.str_max) {
8332689Sbostic 				rogue.str_max = rogue.str_current;
8432689Sbostic 			}
8532689Sbostic 			break;
8632689Sbostic 		case RESTORE_STRENGTH:
8732689Sbostic 			rogue.str_current = rogue.str_max;
8832689Sbostic 			message("this tastes great, you feel warm all over", 0);
8932689Sbostic 			break;
9032689Sbostic 		case HEALING:
9132689Sbostic 			message("you begin to feel better", 0);
9232689Sbostic 			potion_heal(0);
9332689Sbostic 			break;
9432689Sbostic 		case EXTRA_HEALING:
9532689Sbostic 			message("you begin to feel much better", 0);
9632689Sbostic 			potion_heal(1);
9732689Sbostic 			break;
9832689Sbostic 		case POISON:
9932689Sbostic 			if (!sustain_strength) {
10032689Sbostic 				rogue.str_current -= get_rand(1, 3);
10132689Sbostic 				if (rogue.str_current < 1) {
10232689Sbostic 					rogue.str_current = 1;
10332689Sbostic 				}
10432689Sbostic 			}
10532689Sbostic 			message("you feel very sick now", 0);
10632689Sbostic 			if (halluc) {
10732689Sbostic 				unhallucinate();
10832689Sbostic 			}
10932689Sbostic 			break;
11032689Sbostic 		case RAISE_LEVEL:
11132689Sbostic 			rogue.exp_points = level_points[rogue.exp - 1];
11232689Sbostic 			message("you suddenly feel much more skillful", 0);
11332689Sbostic 			add_exp(1, 1);
11432689Sbostic 			break;
11532689Sbostic 		case BLINDNESS:
11632689Sbostic 			go_blind();
11732689Sbostic 			break;
11832689Sbostic 		case HALLUCINATION:
11932689Sbostic 			message("oh wow, everything seems so cosmic", 0);
12032689Sbostic 			halluc += get_rand(500, 800);
12132689Sbostic 			break;
12232689Sbostic 		case DETECT_MONSTER:
12332689Sbostic 			show_monsters();
12432689Sbostic 			if (!(level_monsters.next_monster)) {
12532689Sbostic 				message(strange_feeling, 0);
12632689Sbostic 			}
12732689Sbostic 			break;
12832689Sbostic 		case DETECT_OBJECTS:
12932689Sbostic 			if (level_objects.next_object) {
13032689Sbostic 				if (!blind) {
13132689Sbostic 					show_objects();
13232689Sbostic 				}
13332689Sbostic 			} else {
13432689Sbostic 				message(strange_feeling, 0);
13532689Sbostic 			}
13632689Sbostic 			break;
13732689Sbostic 		case CONFUSION:
13832689Sbostic 			message((halluc ? "what a trippy feeling" :
13932689Sbostic 			"you feel confused"), 0);
14032689Sbostic 			cnfs();
14132689Sbostic 			break;
14232689Sbostic 		case LEVITATION:
14332689Sbostic 			message("you start to float in the air", 0);
14432689Sbostic 			levitate += get_rand(15, 30);
14532689Sbostic 			being_held = bear_trap = 0;
14632689Sbostic 			break;
14732689Sbostic 		case HASTE_SELF:
14832689Sbostic 			message("you feel yourself moving much faster", 0);
14932689Sbostic 			haste_self += get_rand(11, 21);
15032689Sbostic 			if (!(haste_self % 2)) {
15132689Sbostic 				haste_self++;
15232689Sbostic 			}
15332689Sbostic 			break;
15432689Sbostic 		case SEE_INVISIBLE:
15532689Sbostic 			sprintf(buf, "hmm, this potion tastes like %sjuice", fruit);
15632689Sbostic 			message(buf, 0);
15732689Sbostic 			if (blind) {
15832689Sbostic 				unblind();
15932689Sbostic 			}
16032689Sbostic 			see_invisible = 1;
16132689Sbostic 			relight();
16232689Sbostic 			break;
16332689Sbostic 	}
16432689Sbostic 	print_stats((STAT_STRENGTH | STAT_HP));
16532689Sbostic 	if (id_potions[obj->which_kind].id_status != CALLED) {
16632689Sbostic 		id_potions[obj->which_kind].id_status = IDENTIFIED;
16732689Sbostic 	}
16832689Sbostic 	vanish(obj, 1, &rogue.pack);
16932689Sbostic }
17032689Sbostic 
17132689Sbostic read_scroll()
17232689Sbostic {
17332689Sbostic 	short ch;
17432689Sbostic 	object *obj;
17532689Sbostic 	char msg[DCOLS];
17632689Sbostic 
17732689Sbostic 	ch = pack_letter("read what?", SCROL);
17832689Sbostic 
17932689Sbostic 	if (ch == CANCEL) {
18032689Sbostic 		return;
18132689Sbostic 	}
18232689Sbostic 	if (!(obj = get_letter_object(ch))) {
18332689Sbostic 		message("no such item.", 0);
18432689Sbostic 		return;
18532689Sbostic 	}
18632689Sbostic 	if (obj->what_is != SCROL) {
18732689Sbostic 		message("you can't read that", 0);
18832689Sbostic 		return;
18932689Sbostic 	}
19032689Sbostic 	switch(obj->which_kind) {
19132689Sbostic 		case SCARE_MONSTER:
19232689Sbostic 			message("you hear a maniacal laughter in the distance",
19332689Sbostic 			0);
19432689Sbostic 			break;
19532689Sbostic 		case HOLD_MONSTER:
19632689Sbostic 			hold_monster();
19732689Sbostic 			break;
19832689Sbostic 		case ENCH_WEAPON:
19932689Sbostic 			if (rogue.weapon) {
20032689Sbostic 				if (rogue.weapon->what_is == WEAPON) {
20132689Sbostic 					sprintf(msg, "your %sglow%s %sfor a moment",
20232689Sbostic 					name_of(rogue.weapon),
20332689Sbostic 					((rogue.weapon->quantity <= 1) ? "s" : ""),
20432689Sbostic 					get_ench_color());
20532689Sbostic 					message(msg, 0);
20632689Sbostic 					if (coin_toss()) {
20732689Sbostic 						rogue.weapon->hit_enchant++;
20832689Sbostic 					} else {
20932689Sbostic 						rogue.weapon->d_enchant++;
21032689Sbostic 					}
21132689Sbostic 				}
21232689Sbostic 				rogue.weapon->is_cursed = 0;
21332689Sbostic 			} else {
21432689Sbostic 				message("your hands tingle", 0);
21532689Sbostic 			}
21632689Sbostic 			break;
21732689Sbostic 		case ENCH_ARMOR:
21832689Sbostic 			if (rogue.armor) {
21932689Sbostic 				sprintf(msg, "your armor glows %sfor a moment",
22032689Sbostic 				get_ench_color());
22132689Sbostic 				message(msg, 0);
22232689Sbostic 				rogue.armor->d_enchant++;
22332689Sbostic 				rogue.armor->is_cursed = 0;
22432689Sbostic 				print_stats(STAT_ARMOR);
22532689Sbostic 			} else {
22632689Sbostic 				message("your skin crawls", 0);
22732689Sbostic 			}
22832689Sbostic 			break;
22932689Sbostic 		case IDENTIFY:
23032689Sbostic 			message("this is a scroll of identify", 0);
23132689Sbostic 			obj->identified = 1;
23232689Sbostic 			id_scrolls[obj->which_kind].id_status = IDENTIFIED;
23332689Sbostic 			idntfy();
23432689Sbostic 			break;
23532689Sbostic 		case TELEPORT:
23632689Sbostic 			tele();
23732689Sbostic 			break;
23832689Sbostic 		case SLEEP:
23932689Sbostic 			message("you fall asleep", 0);
24032689Sbostic 			take_a_nap();
24132689Sbostic 			break;
24232689Sbostic 		case PROTECT_ARMOR:
24332689Sbostic 			if (rogue.armor) {
24432689Sbostic 				message( "your armor is covered by a shimmering gold shield",0);
24532689Sbostic 				rogue.armor->is_protected = 1;
24632689Sbostic 				rogue.armor->is_cursed = 0;
24732689Sbostic 			} else {
24832689Sbostic 				message("your acne seems to have disappeared", 0);
24932689Sbostic 			}
25032689Sbostic 			break;
25132689Sbostic 		case REMOVE_CURSE:
25232689Sbostic 				message((!halluc) ?
25332689Sbostic 					"you feel as though someone is watching over you" :
25432689Sbostic 					"you feel in touch with the universal oneness", 0);
25532689Sbostic 			uncurse_all();
25632689Sbostic 			break;
25732689Sbostic 		case CREATE_MONSTER:
25832689Sbostic 			create_monster();
25932689Sbostic 			break;
26032689Sbostic 		case AGGRAVATE_MONSTER:
26132689Sbostic 			aggravate();
26232689Sbostic 			break;
26332689Sbostic 		case MAGIC_MAPPING:
26432689Sbostic 			message("this scroll seems to have a map on it", 0);
26532689Sbostic 			draw_magic_map();
26632689Sbostic 			break;
26732689Sbostic 		case CON_MON:
26832689Sbostic 			con_mon = 1;
26932689Sbostic 			sprintf(msg, "your hands glow %sfor a moment", get_ench_color());
27032689Sbostic 			message(msg, 0);
27132689Sbostic 			break;
27232689Sbostic 	}
27332689Sbostic 	if (id_scrolls[obj->which_kind].id_status != CALLED) {
27432689Sbostic 		id_scrolls[obj->which_kind].id_status = IDENTIFIED;
27532689Sbostic 	}
27632689Sbostic 	vanish(obj, (obj->which_kind != SLEEP), &rogue.pack);
27732689Sbostic }
27832689Sbostic 
27932689Sbostic /* vanish() does NOT handle a quiver of weapons with more than one
28032689Sbostic  *  arrow (or whatever) in the quiver.  It will only decrement the count.
28132689Sbostic  */
28232689Sbostic 
28332689Sbostic vanish(obj, rm, pack)
28432689Sbostic object *obj;
28532689Sbostic short rm;
28632689Sbostic object *pack;
28732689Sbostic {
28832689Sbostic 	if (obj->quantity > 1) {
28932689Sbostic 		obj->quantity--;
29032689Sbostic 	} else {
29132689Sbostic 		if (obj->in_use_flags & BEING_WIELDED) {
29232689Sbostic 			unwield(obj);
29332689Sbostic 		} else if (obj->in_use_flags & BEING_WORN) {
29432689Sbostic 			unwear(obj);
29532689Sbostic 		} else if (obj->in_use_flags & ON_EITHER_HAND) {
29632689Sbostic 			un_put_on(obj);
29732689Sbostic 		}
29832689Sbostic 		take_from_pack(obj, pack);
29932689Sbostic 		free_object(obj);
30032689Sbostic 	}
30132689Sbostic 	if (rm) {
30232689Sbostic 		(void) reg_move();
30332689Sbostic 	}
30432689Sbostic }
30532689Sbostic 
30632689Sbostic potion_heal(extra)
30732689Sbostic {
30832689Sbostic 	float ratio;
30932689Sbostic 	short add;
31032689Sbostic 
31132689Sbostic 	rogue.hp_current += rogue.exp;
31232689Sbostic 
31332689Sbostic 	ratio = ((float)rogue.hp_current) / rogue.hp_max;
31432689Sbostic 
31532689Sbostic 	if (ratio >= 1.00) {
31632689Sbostic 		rogue.hp_max += (extra ? 2 : 1);
31732689Sbostic 		extra_hp += (extra ? 2 : 1);
31832689Sbostic 		rogue.hp_current = rogue.hp_max;
31932689Sbostic 	} else if (ratio >= 0.90) {
32032689Sbostic 		rogue.hp_max += (extra ? 1 : 0);
32132689Sbostic 		extra_hp += (extra ? 1 : 0);
32232689Sbostic 		rogue.hp_current = rogue.hp_max;
32332689Sbostic 	} else {
32432689Sbostic 		if (ratio < 0.33) {
32532689Sbostic 			ratio = 0.33;
32632689Sbostic 		}
32732689Sbostic 		if (extra) {
32832689Sbostic 			ratio += ratio;
32932689Sbostic 		}
33032689Sbostic 		add = (short)(ratio * ((float)rogue.hp_max - rogue.hp_current));
33132689Sbostic 		rogue.hp_current += add;
33232689Sbostic 		if (rogue.hp_current > rogue.hp_max) {
33332689Sbostic 			rogue.hp_current = rogue.hp_max;
33432689Sbostic 		}
33532689Sbostic 	}
33632689Sbostic 	if (blind) {
33732689Sbostic 		unblind();
33832689Sbostic 	}
33932689Sbostic 	if (confused && extra) {
34032689Sbostic 			unconfuse();
34132689Sbostic 	} else if (confused) {
34232689Sbostic 		confused = (confused / 2) + 1;
34332689Sbostic 	}
34432689Sbostic 	if (halluc && extra) {
34532689Sbostic 		unhallucinate();
34632689Sbostic 	} else if (halluc) {
34732689Sbostic 		halluc = (halluc / 2) + 1;
34832689Sbostic 	}
34932689Sbostic }
35032689Sbostic 
35132689Sbostic idntfy()
35232689Sbostic {
35332689Sbostic 	short ch;
35432689Sbostic 	object *obj;
35532689Sbostic 	struct id *id_table;
35632689Sbostic 	char desc[DCOLS];
35732689Sbostic AGAIN:
35832689Sbostic 	ch = pack_letter("what would you like to identify?", ALL_OBJECTS);
35932689Sbostic 
36032689Sbostic 	if (ch == CANCEL) {
36132689Sbostic 		return;
36232689Sbostic 	}
36332689Sbostic 	if (!(obj = get_letter_object(ch))) {
36432689Sbostic 		message("no such item, try again", 0);
36532689Sbostic 		message("", 0);
36632689Sbostic 		check_message();
36732689Sbostic 		goto AGAIN;
36832689Sbostic 	}
36932689Sbostic 	obj->identified = 1;
37032689Sbostic 	if (obj->what_is & (SCROL | POTION | WEAPON | ARMOR | WAND | RING)) {
37132689Sbostic 		id_table = get_id_table(obj);
37232689Sbostic 		id_table[obj->which_kind].id_status = IDENTIFIED;
37332689Sbostic 	}
37432689Sbostic 	get_desc(obj, desc);
37532689Sbostic 	message(desc, 0);
37632689Sbostic }
37732689Sbostic 
37832689Sbostic eat()
37932689Sbostic {
38032689Sbostic 	short ch;
38132689Sbostic 	short moves;
38232689Sbostic 	object *obj;
38332689Sbostic 	char buf[70];
38432689Sbostic 
38532689Sbostic 	ch = pack_letter("eat what?", FOOD);
38632689Sbostic 
38732689Sbostic 	if (ch == CANCEL) {
38832689Sbostic 		return;
38932689Sbostic 	}
39032689Sbostic 	if (!(obj = get_letter_object(ch))) {
39132689Sbostic 		message("no such item.", 0);
39232689Sbostic 		return;
39332689Sbostic 	}
39432689Sbostic 	if (obj->what_is != FOOD) {
39532689Sbostic 		message("you can't eat that", 0);
39632689Sbostic 		return;
39732689Sbostic 	}
39832689Sbostic 	if ((obj->which_kind == FRUIT) || rand_percent(60)) {
39932689Sbostic 		moves = get_rand(950, 1150);
40032689Sbostic 		if (obj->which_kind == RATION) {
40132689Sbostic 			message("yum, that tasted good", 0);
40232689Sbostic 		} else {
40332689Sbostic 			sprintf(buf, "my, that was a yummy %s", fruit);
40432689Sbostic 			message(buf, 0);
40532689Sbostic 		}
40632689Sbostic 	} else {
40732689Sbostic 		moves = get_rand(750, 950);
40832689Sbostic 		message("yuk, that food tasted awful", 0);
40932689Sbostic 		add_exp(2, 1);
41032689Sbostic 	}
41132689Sbostic 	rogue.moves_left /= 3;
41232689Sbostic 	rogue.moves_left += moves;
41332689Sbostic 	hunger_str[0] = 0;
41432689Sbostic 	print_stats(STAT_HUNGER);
41532689Sbostic 
41632689Sbostic 	vanish(obj, 1, &rogue.pack);
41732689Sbostic }
41832689Sbostic 
41932689Sbostic hold_monster()
42032689Sbostic {
42132689Sbostic 	short i, j;
42232689Sbostic 	short mcount = 0;
42332689Sbostic 	object *monster;
42432689Sbostic 	short row, col;
42532689Sbostic 
42632689Sbostic 	for (i = -2; i <= 2; i++) {
42732689Sbostic 		for (j = -2; j <= 2; j++) {
42832689Sbostic 			row = rogue.row + i;
42932689Sbostic 			col = rogue.col + j;
43032689Sbostic 			if ((row < MIN_ROW) || (row > (DROWS-2)) || (col < 0) ||
43132689Sbostic 				 (col > (DCOLS-1))) {
43232689Sbostic 				continue;
43332689Sbostic 			}
43432689Sbostic 			if (dungeon[row][col] & MONSTER) {
43532689Sbostic 				monster = object_at(&level_monsters, row, col);
43632689Sbostic 				monster->m_flags |= ASLEEP;
43732689Sbostic 				monster->m_flags &= (~WAKENS);
43832689Sbostic 				mcount++;
43932689Sbostic 			}
44032689Sbostic 		}
44132689Sbostic 	}
44232689Sbostic 	if (mcount == 0) {
44332689Sbostic 		message("you feel a strange sense of loss", 0);
44432689Sbostic 	} else if (mcount == 1) {
44532689Sbostic 		message("the monster freezes", 0);
44632689Sbostic 	} else {
44732689Sbostic 		message("the monsters around you freeze", 0);
44832689Sbostic 	}
44932689Sbostic }
45032689Sbostic 
45132689Sbostic tele()
45232689Sbostic {
45332689Sbostic 	mvaddch(rogue.row, rogue.col, get_dungeon_char(rogue.row, rogue.col));
45432689Sbostic 
45532689Sbostic 	if (cur_room >= 0) {
45632689Sbostic 		darken_room(cur_room);
45732689Sbostic 	}
45832689Sbostic 	put_player(get_room_number(rogue.row, rogue.col));
45932689Sbostic 	being_held = 0;
46032689Sbostic 	bear_trap = 0;
46132689Sbostic }
46232689Sbostic 
46332689Sbostic hallucinate()
46432689Sbostic {
46532689Sbostic 	object *obj, *monster;
46632689Sbostic 	short ch;
46732689Sbostic 
46832689Sbostic 	if (blind) return;
46932689Sbostic 
47032689Sbostic 	obj = level_objects.next_object;
47132689Sbostic 
47232689Sbostic 	while (obj) {
47332689Sbostic 		ch = mvinch(obj->row, obj->col);
47432689Sbostic 		if (((ch < 'A') || (ch > 'Z')) &&
47532689Sbostic 			((obj->row != rogue.row) || (obj->col != rogue.col)))
47632689Sbostic 		if ((ch != ' ') && (ch != '.') && (ch != '#') && (ch != '+')) {
47732689Sbostic 			addch(gr_obj_char());
47832689Sbostic 		}
47932689Sbostic 		obj = obj->next_object;
48032689Sbostic 	}
48132689Sbostic 	monster = level_monsters.next_monster;
48232689Sbostic 
48332689Sbostic 	while (monster) {
48432689Sbostic 		ch = mvinch(monster->row, monster->col);
48532689Sbostic 		if ((ch >= 'A') && (ch <= 'Z')) {
48632689Sbostic 			addch(get_rand('A', 'Z'));
48732689Sbostic 		}
48832689Sbostic 		monster = monster->next_monster;
48932689Sbostic 	}
49032689Sbostic }
49132689Sbostic 
49232689Sbostic unhallucinate()
49332689Sbostic {
49432689Sbostic 	halluc = 0;
49532689Sbostic 	relight();
49632689Sbostic 	message("everything looks SO boring now", 1);
49732689Sbostic }
49832689Sbostic 
49932689Sbostic unblind()
50032689Sbostic {
50132689Sbostic 	blind = 0;
50232689Sbostic 	message("the veil of darkness lifts", 1);
50332689Sbostic 	relight();
50432689Sbostic 	if (halluc) {
50532689Sbostic 		hallucinate();
50632689Sbostic 	}
50732689Sbostic 	if (detect_monster) {
50832689Sbostic 		show_monsters();
50932689Sbostic 	}
51032689Sbostic }
51132689Sbostic 
51232689Sbostic relight()
51332689Sbostic {
51432689Sbostic 	if (cur_room == PASSAGE) {
51532689Sbostic 		light_passage(rogue.row, rogue.col);
51632689Sbostic 	} else {
51732689Sbostic 		light_up_room(cur_room);
51832689Sbostic 	}
51932689Sbostic 	mvaddch(rogue.row, rogue.col, rogue.fchar);
52032689Sbostic }
52132689Sbostic 
52232689Sbostic take_a_nap()
52332689Sbostic {
52432689Sbostic 	short i;
52532689Sbostic 
52632689Sbostic 	i = get_rand(2, 5);
52732689Sbostic 	md_sleep(1);
52832689Sbostic 
52932689Sbostic 	while (i--) {
53032689Sbostic 		mv_mons();
53132689Sbostic 	}
53232689Sbostic 	md_sleep(1);
53332689Sbostic 	message(you_can_move_again, 0);
53432689Sbostic }
53532689Sbostic 
53632689Sbostic go_blind()
53732689Sbostic {
53832689Sbostic 	short i, j;
53932689Sbostic 
54032689Sbostic 	if (!blind) {
54132689Sbostic 		message("a cloak of darkness falls around you", 0);
54232689Sbostic 	}
54332689Sbostic 	blind += get_rand(500, 800);
54432689Sbostic 
54532689Sbostic 	if (detect_monster) {
54632689Sbostic 		object *monster;
54732689Sbostic 
54832689Sbostic 		monster = level_monsters.next_monster;
54932689Sbostic 
55032689Sbostic 		while (monster) {
55132689Sbostic 			mvaddch(monster->row, monster->col, monster->trail_char);
55232689Sbostic 			monster = monster->next_monster;
55332689Sbostic 		}
55432689Sbostic 	}
55532689Sbostic 	if (cur_room >= 0) {
55632689Sbostic 		for (i = rooms[cur_room].top_row + 1;
55732689Sbostic 			 i < rooms[cur_room].bottom_row; i++) {
55832689Sbostic 			for (j = rooms[cur_room].left_col + 1;
55932689Sbostic 				 j < rooms[cur_room].right_col; j++) {
56032689Sbostic 				mvaddch(i, j, ' ');
56132689Sbostic 			}
56232689Sbostic 		}
56332689Sbostic 	}
56432689Sbostic 	mvaddch(rogue.row, rogue.col, rogue.fchar);
56532689Sbostic }
56632689Sbostic 
56732689Sbostic char *
56832689Sbostic get_ench_color()
56932689Sbostic {
57032689Sbostic 	if (halluc) {
57132689Sbostic 		return(id_potions[get_rand(0, POTIONS-1)].title);
57232689Sbostic 	} else if (con_mon) {
57332689Sbostic 		return("red ");
57432689Sbostic 	}
57532689Sbostic 	return("blue ");
57632689Sbostic }
57732689Sbostic 
57832689Sbostic cnfs()
57932689Sbostic {
58032689Sbostic 	confused += get_rand(12, 22);
58132689Sbostic }
58232689Sbostic 
58332689Sbostic unconfuse()
58432689Sbostic {
58532689Sbostic 	char msg[80];
58632689Sbostic 
58732689Sbostic 	confused = 0;
58832689Sbostic 	sprintf(msg, "you feel less %s now", (halluc ? "trippy" : "confused"));
58932689Sbostic 	message(msg, 1);
59032689Sbostic }
59132689Sbostic 
59232689Sbostic uncurse_all()
59332689Sbostic {
59432689Sbostic 	object *obj;
59532689Sbostic 
59632689Sbostic 	obj = rogue.pack.next_object;
59732689Sbostic 
59832689Sbostic 	while (obj) {
59932689Sbostic 		obj->is_cursed = 0;
60032689Sbostic 		obj = obj->next_object;
60132689Sbostic 	}
60232689Sbostic }
603