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