* This source herein may be modified and/or distributed by anybody who
* so desires, with the following restrictions:
* 1.) No portion of this notice shall be removed.
* 2.) Credit shall not be taken for the creation of this source.
* 3.) This code is not to be traded, sold, or used for personal
static char sccsid
[] = "@(#)use.c 5.1 (Berkeley) %G%";
boolean see_invisible
= 0;
boolean detect_monster
= 0;
char *strange_feeling
= "you have a strange feeling for a moment, then it passes";
extern char hunger_str
[];
extern long level_points
[];
extern boolean being_held
;
extern char *fruit
, *you_can_move_again
;
extern boolean sustain_strength
;
ch
= pack_letter("quaff what?", POTION
);
if (!(obj
= get_letter_object(ch
))) {
message("no such item.", 0);
if (obj
->what_is
!= POTION
) {
message("you can't drink that", 0);
switch(obj
->which_kind
) {
message("you feel stronger now, what bulging muscles!",
if (rogue
.str_current
> rogue
.str_max
) {
rogue
.str_max
= rogue
.str_current
;
rogue
.str_current
= rogue
.str_max
;
message("this tastes great, you feel warm all over", 0);
message("you begin to feel better", 0);
message("you begin to feel much better", 0);
rogue
.str_current
-= get_rand(1, 3);
if (rogue
.str_current
< 1) {
message("you feel very sick now", 0);
rogue
.exp_points
= level_points
[rogue
.exp
- 1];
message("you suddenly feel much more skillful", 0);
message("oh wow, everything seems so cosmic", 0);
halluc
+= get_rand(500, 800);
if (!(level_monsters
.next_monster
)) {
message(strange_feeling
, 0);
if (level_objects
.next_object
) {
message(strange_feeling
, 0);
message((halluc
? "what a trippy feeling" :
"you feel confused"), 0);
message("you start to float in the air", 0);
levitate
+= get_rand(15, 30);
being_held
= bear_trap
= 0;
message("you feel yourself moving much faster", 0);
haste_self
+= get_rand(11, 21);
sprintf(buf
, "hmm, this potion tastes like %sjuice", fruit
);
print_stats((STAT_STRENGTH
| STAT_HP
));
if (id_potions
[obj
->which_kind
].id_status
!= CALLED
) {
id_potions
[obj
->which_kind
].id_status
= IDENTIFIED
;
vanish(obj
, 1, &rogue
.pack
);
ch
= pack_letter("read what?", SCROL
);
if (!(obj
= get_letter_object(ch
))) {
message("no such item.", 0);
if (obj
->what_is
!= SCROL
) {
message("you can't read that", 0);
switch(obj
->which_kind
) {
message("you hear a maniacal laughter in the distance",
if (rogue
.weapon
->what_is
== WEAPON
) {
sprintf(msg
, "your %sglow%s %sfor a moment",
((rogue
.weapon
->quantity
<= 1) ? "s" : ""),
rogue
.weapon
->hit_enchant
++;
rogue
.weapon
->d_enchant
++;
rogue
.weapon
->is_cursed
= 0;
message("your hands tingle", 0);
sprintf(msg
, "your armor glows %sfor a moment",
rogue
.armor
->d_enchant
++;
rogue
.armor
->is_cursed
= 0;
message("your skin crawls", 0);
message("this is a scroll of identify", 0);
id_scrolls
[obj
->which_kind
].id_status
= IDENTIFIED
;
message("you fall asleep", 0);
message( "your armor is covered by a shimmering gold shield",0);
rogue
.armor
->is_protected
= 1;
rogue
.armor
->is_cursed
= 0;
message("your acne seems to have disappeared", 0);
"you feel as though someone is watching over you" :
"you feel in touch with the universal oneness", 0);
message("this scroll seems to have a map on it", 0);
sprintf(msg
, "your hands glow %sfor a moment", get_ench_color());
if (id_scrolls
[obj
->which_kind
].id_status
!= CALLED
) {
id_scrolls
[obj
->which_kind
].id_status
= IDENTIFIED
;
vanish(obj
, (obj
->which_kind
!= SLEEP
), &rogue
.pack
);
/* vanish() does NOT handle a quiver of weapons with more than one
* arrow (or whatever) in the quiver. It will only decrement the count.
if (obj
->in_use_flags
& BEING_WIELDED
) {
} else if (obj
->in_use_flags
& BEING_WORN
) {
} else if (obj
->in_use_flags
& ON_EITHER_HAND
) {
take_from_pack(obj
, pack
);
rogue
.hp_current
+= rogue
.exp
;
ratio
= ((float)rogue
.hp_current
) / rogue
.hp_max
;
rogue
.hp_max
+= (extra
? 2 : 1);
extra_hp
+= (extra
? 2 : 1);
rogue
.hp_current
= rogue
.hp_max
;
} else if (ratio
>= 0.90) {
rogue
.hp_max
+= (extra
? 1 : 0);
extra_hp
+= (extra
? 1 : 0);
rogue
.hp_current
= rogue
.hp_max
;
add
= (short)(ratio
* ((float)rogue
.hp_max
- rogue
.hp_current
));
if (rogue
.hp_current
> rogue
.hp_max
) {
rogue
.hp_current
= rogue
.hp_max
;
confused
= (confused
/ 2) + 1;
halluc
= (halluc
/ 2) + 1;
ch
= pack_letter("what would you like to identify?", ALL_OBJECTS
);
if (!(obj
= get_letter_object(ch
))) {
message("no such item, try again", 0);
if (obj
->what_is
& (SCROL
| POTION
| WEAPON
| ARMOR
| WAND
| RING
)) {
id_table
= get_id_table(obj
);
id_table
[obj
->which_kind
].id_status
= IDENTIFIED
;
ch
= pack_letter("eat what?", FOOD
);
if (!(obj
= get_letter_object(ch
))) {
message("no such item.", 0);
if (obj
->what_is
!= FOOD
) {
message("you can't eat that", 0);
if ((obj
->which_kind
== FRUIT
) || rand_percent(60)) {
moves
= get_rand(950, 1150);
if (obj
->which_kind
== RATION
) {
message("yum, that tasted good", 0);
sprintf(buf
, "my, that was a yummy %s", fruit
);
moves
= get_rand(750, 950);
message("yuk, that food tasted awful", 0);
rogue
.moves_left
+= moves
;
print_stats(STAT_HUNGER
);
vanish(obj
, 1, &rogue
.pack
);
for (i
= -2; i
<= 2; i
++) {
for (j
= -2; j
<= 2; j
++) {
if ((row
< MIN_ROW
) || (row
> (DROWS
-2)) || (col
< 0) ||
if (dungeon
[row
][col
] & MONSTER
) {
monster
= object_at(&level_monsters
, row
, col
);
monster
->m_flags
|= ASLEEP
;
monster
->m_flags
&= (~WAKENS
);
message("you feel a strange sense of loss", 0);
} else if (mcount
== 1) {
message("the monster freezes", 0);
message("the monsters around you freeze", 0);
mvaddch(rogue
.row
, rogue
.col
, get_dungeon_char(rogue
.row
, rogue
.col
));
put_player(get_room_number(rogue
.row
, rogue
.col
));
obj
= level_objects
.next_object
;
ch
= mvinch(obj
->row
, obj
->col
);
if (((ch
< 'A') || (ch
> 'Z')) &&
((obj
->row
!= rogue
.row
) || (obj
->col
!= rogue
.col
)))
if ((ch
!= ' ') && (ch
!= '.') && (ch
!= '#') && (ch
!= '+')) {
monster
= level_monsters
.next_monster
;
ch
= mvinch(monster
->row
, monster
->col
);
if ((ch
>= 'A') && (ch
<= 'Z')) {
addch(get_rand('A', 'Z'));
monster
= monster
->next_monster
;
message("everything looks SO boring now", 1);
message("the veil of darkness lifts", 1);
if (cur_room
== PASSAGE
) {
light_passage(rogue
.row
, rogue
.col
);
mvaddch(rogue
.row
, rogue
.col
, rogue
.fchar
);
message(you_can_move_again
, 0);
message("a cloak of darkness falls around you", 0);
blind
+= get_rand(500, 800);
monster
= level_monsters
.next_monster
;
mvaddch(monster
->row
, monster
->col
, monster
->trail_char
);
monster
= monster
->next_monster
;
for (i
= rooms
[cur_room
].top_row
+ 1;
i
< rooms
[cur_room
].bottom_row
; i
++) {
for (j
= rooms
[cur_room
].left_col
+ 1;
j
< rooms
[cur_room
].right_col
; j
++) {
mvaddch(rogue
.row
, rogue
.col
, rogue
.fchar
);
return(id_potions
[get_rand(0, POTIONS
-1)].title
);
confused
+= get_rand(12, 22);
sprintf(msg
, "you feel less %s now", (halluc
? "trippy" : "confused"));
obj
= rogue
.pack
.next_object
;