* Copyright (c) 1988 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
static char sccsid
[] = "@(#)spec_hit.c 5.3 (Berkeley) 6/1/90";
* 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
extern short cur_level
, max_level
, blind
, levitate
, ring_exp
;
extern long level_points
[];
extern boolean detect_monster
, mon_disappeared
;
extern boolean sustain_strength
, maintain_armor
;
extern char *you_can_move_again
;
if ((monster
->m_flags
& CONFUSED
) && rand_percent(66)) {
if (monster
->m_flags
& RUSTS
) {
if ((monster
->m_flags
& HOLDS
) && !levitate
) {
if (monster
->m_flags
& FREEZES
) {
if (monster
->m_flags
& STINGS
) {
if (monster
->m_flags
& DRAINS_LIFE
) {
if (monster
->m_flags
& DROPS_LEVEL
) {
if (monster
->m_flags
& STEALS_GOLD
) {
} else if (monster
->m_flags
& STEALS_ITEM
) {
if ((!rogue
.armor
) || (get_armor_class(rogue
.armor
) <= 1) ||
(rogue
.armor
->which_kind
== LEATHER
)) {
if ((rogue
.armor
->is_protected
) || maintain_armor
) {
if (monster
&& (!(monster
->m_flags
& RUST_VANISHED
))) {
message("the rust vanishes instantly", 0);
monster
->m_flags
|= RUST_VANISHED
;
rogue
.armor
->d_enchant
--;
message("your armor weakens", 0);
short freeze_percent
= 99;
freeze_percent
-= (rogue
.str_current
+(rogue
.str_current
/ 2));
freeze_percent
-= ((rogue
.exp
+ ring_exp
) * 4);
freeze_percent
-= (get_armor_class(rogue
.armor
) * 5);
freeze_percent
-= (rogue
.hp_max
/ 3);
if (freeze_percent
> 10) {
monster
->m_flags
|= FREEZING_ROGUE
;
message("you are frozen", 1);
for (i
= 0; i
< n
; i
++) {
if (rand_percent(freeze_percent
)) {
for (i
= 0; i
< 50; i
++) {
killed_by((object
*)0, HYPOTHERMIA
);
message(you_can_move_again
, 1);
monster
->m_flags
&= (~FREEZING_ROGUE
);
if ((rogue
.gold
<= 0) || rand_percent(10)) {
amount
= get_rand((cur_level
* 10), (cur_level
* 30));
if (amount
> rogue
.gold
) {
message("your purse feels lighter", 0);
boolean has_something
= 0;
obj
= rogue
.pack
.next_object
;
if (!(obj
->in_use_flags
& BEING_USED
)) {
n
= get_rand(0, MAX_PACK_COUNT
);
obj
= rogue
.pack
.next_object
;
for (i
= 0; i
<= n
; i
++) {
while ((!obj
) || (obj
->in_use_flags
& BEING_USED
)) {
obj
= rogue
.pack
.next_object
;
(void) strcpy(desc
, "she stole ");
if (obj
->what_is
!= WEAPON
) {
obj
->quantity
= ((obj
->what_is
!= WEAPON
) ? t
: 1);
vanish(obj
, 0, &rogue
.pack
);
dungeon
[row
][col
] &= ~MONSTER
;
if (rogue_can_see(row
, col
)) {
mvaddch(row
, col
, get_dungeon_char(row
, col
));
take_from_pack(monster
, &level_monsters
);
if (cur_level
< max_level
) {
if (monster
->m_flags
& STEALS_GOLD
) {
obj
->quantity
= get_rand((cur_level
* 15), (cur_level
* 30));
if (!rand_percent((int) monster
->drop_percent
)) {
for (n
= 0; n
<= 5; n
++) {
for (i
= -n
; i
<= n
; i
++) {
if (try_to_cough(row
+n
, col
+i
, obj
)) {
if (try_to_cough(row
-n
, col
+i
, obj
)) {
for (i
= -n
; i
<= n
; i
++) {
if (try_to_cough(row
+i
, col
-n
, obj
)) {
if (try_to_cough(row
+i
, col
+n
, obj
)) {
try_to_cough(row
, col
, obj
)
if ((row
< MIN_ROW
) || (row
> (DROWS
-2)) || (col
< 0) || (col
>(DCOLS
-1))) {
if ((!(dungeon
[row
][col
] & (OBJECT
| STAIRS
| TRAP
))) &&
(dungeon
[row
][col
] & (TUNNEL
| FLOOR
| DOOR
))) {
if (((row
!= rogue
.row
) || (col
!= rogue
.col
)) &&
(!(dungeon
[row
][col
] & MONSTER
))) {
mvaddch(row
, col
, get_dungeon_char(row
, col
));
if ((rn
= get_room_number(monster
->row
, monster
->col
)) < 0) {
for (i
= rooms
[rn
].top_row
+1; i
< rooms
[rn
].bottom_row
; i
++) {
for (j
= rooms
[rn
].left_col
+1; j
< rooms
[rn
].right_col
; j
++) {
if ((gold_at(i
, j
)) && !(dungeon
[i
][j
] & MONSTER
)) {
monster
->m_flags
|= CAN_FLIT
;
s
= mon_can_go(monster
, i
, j
);
monster
->m_flags
&= (~CAN_FLIT
);
move_mon_to(monster
, i
, j
);
monster
->m_flags
|= ASLEEP
;
monster
->m_flags
&= (~(WAKENS
| SEEKS_GOLD
));
monster
->m_flags
&= (~SEEKS_GOLD
);
monster
->m_flags
|= CAN_FLIT
;
mv_1_monster(monster
, i
, j
);
monster
->m_flags
&= (~CAN_FLIT
);
monster
->m_flags
|= SEEKS_GOLD
;
if (dungeon
[row
][col
] & OBJECT
) {
if ((obj
= object_at(&level_objects
, row
, col
)) &&
(obj
->what_is
== GOLD
)) {
check_gold_seeker(monster
)
monster
->m_flags
&= (~SEEKS_GOLD
);
if (monster
->m_flags
& IMITATES
) {
mvaddch(monster
->row
, monster
->col
,
get_dungeon_char(monster
->row
, monster
->col
));
sprintf(msg
, "wait, that's a %s!", mon_name(monster
));
if (dungeon
[row
][col
] & MONSTER
) {
object
*object_at(), *monster
;
if (monster
= object_at(&level_monsters
, row
, col
)) {
if (monster
->m_flags
& IMITATES
) {
if ((rogue
.str_current
<= 3) || sustain_strength
) {
sting_chance
+= (6 * (6 - get_armor_class(rogue
.armor
)));
if ((rogue
.exp
+ ring_exp
) > 8) {
sting_chance
-= (6 * ((rogue
.exp
+ ring_exp
) - 8));
if (rand_percent(sting_chance
)) {
sprintf(msg
, "the %s's bite has weakened you",
print_stats(STAT_STRENGTH
);
if (rand_percent(80) || (rogue
.exp
<= 5)) {
rogue
.exp_points
= level_points
[rogue
.exp
-2] - get_rand(9, 29);
if ((rogue
.hp_current
-= hp
) <= 0) {
if ((rogue
.hp_max
-= hp
) <= 0) {
if (rand_percent(60) || (rogue
.hp_max
<= 30) || (rogue
.hp_current
< 10)) {
n
= get_rand(1, 3); /* 1 Hp, 2 Str, 3 both */
if ((n
!= 2) || (!sustain_strength
)) {
message("you feel weaker", 0);
if ((rogue
.str_current
> 3) && (!sustain_strength
)) {
print_stats((STAT_STRENGTH
| STAT_HP
));
if (!rogue_can_see(monster
->row
, monster
->col
)) {
monster
->m_flags
&= (~CONFUSES
); /* will not confuse the rogue */
monster
->m_flags
&= (~CONFUSES
);
sprintf(msg
, "the gaze of the %s has confused you", mon_name(monster
));
if ((!mon_sees(monster
, rogue
.row
, rogue
.col
)) || coin_toss()) {
row
= rogue
.row
- monster
->row
;
col
= rogue
.col
- monster
->col
;
if (((row
!= 0) && (col
!= 0) && (row
!= col
)) ||
((row
> 7) || (col
> 7))) {
dir
= get_dir(monster
->row
, monster
->col
, row
, col
);
bounce(FIRE
, dir
, monster
->row
, monster
->col
, 0);
get_dir(srow
, scol
, drow
, dcol
)
short srow
, scol
, drow
, dcol
;
if ((srow
> drow
) && (scol
> dcol
)) {
if ((srow
< drow
) && (scol
< dcol
)) {
if ((srow
< drow
) && (scol
> dcol
)) {
/*if ((srow > drow) && (scol < dcol)) {*/