Home | History | Annotate | Line # | Download | only in rogue
monster.c revision 1.17
      1  1.17  dholland /*	$NetBSD: monster.c,v 1.17 2013/08/11 03:44:27 dholland Exp $	*/
      2   1.3       cgd 
      3   1.1       cgd /*
      4   1.3       cgd  * Copyright (c) 1988, 1993
      5   1.3       cgd  *	The Regents of the University of California.  All rights reserved.
      6   1.1       cgd  *
      7   1.1       cgd  * This code is derived from software contributed to Berkeley by
      8   1.1       cgd  * Timothy C. Stoehr.
      9   1.1       cgd  *
     10   1.1       cgd  * Redistribution and use in source and binary forms, with or without
     11   1.1       cgd  * modification, are permitted provided that the following conditions
     12   1.1       cgd  * are met:
     13   1.1       cgd  * 1. Redistributions of source code must retain the above copyright
     14   1.1       cgd  *    notice, this list of conditions and the following disclaimer.
     15   1.1       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1       cgd  *    notice, this list of conditions and the following disclaimer in the
     17   1.1       cgd  *    documentation and/or other materials provided with the distribution.
     18   1.8       agc  * 3. Neither the name of the University nor the names of its contributors
     19   1.1       cgd  *    may be used to endorse or promote products derived from this software
     20   1.1       cgd  *    without specific prior written permission.
     21   1.1       cgd  *
     22   1.1       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     23   1.1       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     24   1.1       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     25   1.1       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     26   1.1       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     27   1.1       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     28   1.1       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29   1.1       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30   1.1       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31   1.1       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32   1.1       cgd  * SUCH DAMAGE.
     33   1.1       cgd  */
     34   1.1       cgd 
     35   1.4     lukem #include <sys/cdefs.h>
     36   1.1       cgd #ifndef lint
     37   1.3       cgd #if 0
     38   1.3       cgd static char sccsid[] = "@(#)monster.c	8.1 (Berkeley) 5/31/93";
     39   1.3       cgd #else
     40  1.17  dholland __RCSID("$NetBSD: monster.c,v 1.17 2013/08/11 03:44:27 dholland Exp $");
     41   1.3       cgd #endif
     42   1.1       cgd #endif /* not lint */
     43   1.1       cgd 
     44   1.1       cgd /*
     45   1.1       cgd  * monster.c
     46   1.1       cgd  *
     47   1.1       cgd  * This source herein may be modified and/or distributed by anybody who
     48   1.1       cgd  * so desires, with the following restrictions:
     49   1.1       cgd  *    1.)  No portion of this notice shall be removed.
     50   1.1       cgd  *    2.)  Credit shall not be taken for the creation of this source.
     51   1.1       cgd  *    3.)  This code is not to be traded, sold, or used for personal
     52   1.1       cgd  *         gain or profit.
     53   1.1       cgd  *
     54   1.1       cgd  */
     55   1.1       cgd 
     56   1.1       cgd #include "rogue.h"
     57   1.1       cgd 
     58   1.1       cgd object level_monsters;
     59   1.1       cgd boolean mon_disappeared;
     60   1.1       cgd 
     61   1.7   hubertf const char *const m_names[] = {
     62   1.1       cgd 	"aquator",
     63   1.1       cgd 	"bat",
     64   1.1       cgd 	"centaur",
     65   1.1       cgd 	"dragon",
     66   1.1       cgd 	"emu",
     67   1.1       cgd 	"venus fly-trap",
     68   1.1       cgd 	"griffin",
     69   1.1       cgd 	"hobgoblin",
     70   1.1       cgd 	"ice monster",
     71   1.1       cgd 	"jabberwock",
     72   1.1       cgd 	"kestrel",
     73   1.1       cgd 	"leprechaun",
     74   1.1       cgd 	"medusa",
     75   1.1       cgd 	"nymph",
     76   1.1       cgd 	"orc",
     77   1.1       cgd 	"phantom",
     78   1.1       cgd 	"quagga",
     79   1.1       cgd 	"rattlesnake",
     80   1.1       cgd 	"snake",
     81   1.1       cgd 	"troll",
     82   1.1       cgd 	"black unicorn",
     83   1.1       cgd 	"vampire",
     84   1.1       cgd 	"wraith",
     85   1.1       cgd 	"xeroc",
     86   1.1       cgd 	"yeti",
     87   1.1       cgd 	"zombie"
     88   1.1       cgd };
     89   1.1       cgd 
     90  1.17  dholland #define FILL 0,0,0,0,0,0,0,0,0,0,0,0,0,NULL
     91  1.17  dholland 
     92  1.14  dholland static object mon_tab[MONSTERS] = {
     93  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS|RUSTS),"0d0",25,'A',20,9,18,100,0,0, FILL},
     94  1.17  dholland 	{(ASLEEP|WANDERS|FLITS|FLIES),"1d3",10,'B',2,1,8,60,0,0, FILL},
     95  1.17  dholland 	{(ASLEEP|WANDERS),"3d3/2d5",32,'C',15,7,16,85,0,10, FILL},
     96  1.17  dholland 	{(ASLEEP|WAKENS|FLAMES),"4d6/4d9",145,'D',5000,21,126,100,0,90, FILL},
     97  1.17  dholland 	{(ASLEEP|WAKENS),"1d3",11,'E',2,1,7,65,0,0, FILL},
     98  1.17  dholland 	{(HOLDS|STATIONARY),"5d5",73,'F',91,12,126,80,0,0, FILL},
     99   1.1       cgd 	{(ASLEEP|WAKENS|WANDERS|FLIES),"5d5/5d5",115,'G',
    100  1.17  dholland 			2000,20,126,85,0,10, FILL},
    101  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS),"1d3/1d2",15,'H',3,1,10,67,0,0, FILL},
    102  1.17  dholland 	{(ASLEEP|FREEZES),"0d0",15,'I',5,2,11,68,0,0, FILL},
    103  1.17  dholland 	{(ASLEEP|WANDERS),"3d10/4d5",132,'J',3000,21,126,100,0,0, FILL},
    104  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS|FLIES),"1d4",10,'K',2,1,6,60,0,0, FILL},
    105  1.17  dholland 	{(ASLEEP|STEALS_GOLD),"0d0",25,'L',21,6,16,75,0,0, FILL},
    106   1.1       cgd 	{(ASLEEP|WAKENS|WANDERS|CONFUSES),"4d4/3d7",97,'M',
    107  1.17  dholland 			250,18,126,85,0,25, FILL},
    108  1.17  dholland 	{(ASLEEP|STEALS_ITEM),"0d0",25,'N',39,10,19,75,0,100, FILL},
    109  1.17  dholland 	{(ASLEEP|WANDERS|WAKENS|SEEKS_GOLD),"1d6",25,'O',5,4,13,70,0,10, FILL},
    110  1.17  dholland 	{(ASLEEP|INVISIBLE|WANDERS|FLITS),"5d4",76,'P',120,15,24,80,0,50, FILL},
    111  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS),"3d5",30,'Q',20,8,17,78,0,20, FILL},
    112  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS|STINGS),"2d5",19,'R',10,3,12,70,0,0, FILL},
    113  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS),"1d3",8,'S',2,1,9,50,0,0, FILL},
    114  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS),"4d6/1d4",75,'T',125,13,22,75,0,33, FILL},
    115   1.1       cgd 	{(ASLEEP|WAKENS|WANDERS),"4d10",90,'U',
    116  1.17  dholland 			200,17,26,85,0,33, FILL},
    117   1.1       cgd 	{(ASLEEP|WAKENS|WANDERS|DRAINS_LIFE),"1d14/1d4",55,'V',
    118  1.17  dholland 			350,19,126,85,0,18, FILL},
    119  1.17  dholland 	{(ASLEEP|WANDERS|DROPS_LEVEL),"2d8",45,'W',55,14,23,75,0,0, FILL},
    120  1.17  dholland 	{(ASLEEP|IMITATES),"4d6",42,'X',110,16,25,75,0,0, FILL},
    121  1.17  dholland 	{(ASLEEP|WANDERS),"3d6",35,'Y',50,11,20,80,0,20, FILL},
    122  1.17  dholland 	{(ASLEEP|WAKENS|WANDERS),"1d7",21,'Z',8,5,14,69,0,0, FILL}
    123   1.1       cgd };
    124   1.1       cgd 
    125  1.15  dholland static void aim_monster(object *);
    126  1.15  dholland static int flit(object *);
    127  1.15  dholland static int move_confused(object *);
    128  1.15  dholland static int mtry(object *, short, short);
    129  1.15  dholland static int no_room_for_monster(int);
    130  1.15  dholland static void put_m_at(short, short, object *);
    131  1.15  dholland static int rogue_is_around(int, int);
    132  1.15  dholland 
    133   1.4     lukem void
    134  1.14  dholland put_mons(void)
    135   1.1       cgd {
    136   1.1       cgd 	short i;
    137   1.1       cgd 	short n;
    138   1.1       cgd 	object *monster;
    139   1.1       cgd 	short row, col;
    140   1.1       cgd 
    141   1.1       cgd 	n = get_rand(4, 6);
    142   1.1       cgd 
    143   1.1       cgd 	for (i = 0; i < n; i++) {
    144  1.14  dholland 		monster = gr_monster(NULL, 0);
    145   1.1       cgd 		if ((monster->m_flags & WANDERS) && coin_toss()) {
    146   1.1       cgd 			wake_up(monster);
    147   1.1       cgd 		}
    148   1.1       cgd 		gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
    149   1.1       cgd 		put_m_at(row, col, monster);
    150   1.1       cgd 	}
    151   1.1       cgd }
    152   1.1       cgd 
    153   1.1       cgd object *
    154  1.14  dholland gr_monster(object *monster, int mn)
    155   1.1       cgd {
    156   1.1       cgd 	if (!monster) {
    157   1.1       cgd 		monster = alloc_object();
    158   1.1       cgd 
    159   1.1       cgd 		for (;;) {
    160   1.1       cgd 			mn = get_rand(0, MONSTERS-1);
    161   1.1       cgd 			if ((cur_level >= mon_tab[mn].first_level) &&
    162   1.1       cgd 			(cur_level <= mon_tab[mn].last_level)) {
    163   1.1       cgd 				break;
    164   1.1       cgd 			}
    165   1.1       cgd 		}
    166   1.1       cgd 	}
    167   1.1       cgd 	*monster = mon_tab[mn];
    168   1.1       cgd 	if (monster->m_flags & IMITATES) {
    169   1.1       cgd 		monster->disguise = gr_obj_char();
    170   1.1       cgd 	}
    171   1.1       cgd 	if (cur_level > (AMULET_LEVEL + 2)) {
    172   1.1       cgd 		monster->m_flags |= HASTED;
    173   1.1       cgd 	}
    174   1.1       cgd 	monster->trow = NO_ROOM;
    175   1.1       cgd 	return(monster);
    176   1.1       cgd }
    177   1.1       cgd 
    178   1.4     lukem void
    179  1.14  dholland mv_mons(void)
    180   1.1       cgd {
    181   1.5   hubertf 	object *monster, *next_monster, *test_mons;
    182   1.1       cgd 	boolean flew;
    183   1.1       cgd 
    184   1.1       cgd 	if (haste_self % 2) {
    185   1.1       cgd 		return;
    186   1.1       cgd 	}
    187   1.1       cgd 
    188   1.1       cgd 	monster = level_monsters.next_monster;
    189   1.1       cgd 
    190   1.1       cgd 	while (monster) {
    191   1.1       cgd 		next_monster = monster->next_monster;
    192   1.1       cgd 		mon_disappeared = 0;
    193   1.1       cgd 		if (monster->m_flags & HASTED) {
    194   1.1       cgd 			mv_1_monster(monster, rogue.row, rogue.col);
    195   1.1       cgd 			if (mon_disappeared) {
    196   1.1       cgd 				goto NM;
    197   1.1       cgd 			}
    198   1.1       cgd 		} else if (monster->m_flags & SLOWED) {
    199   1.1       cgd 			monster->slowed_toggle = !monster->slowed_toggle;
    200   1.1       cgd 			if (monster->slowed_toggle) {
    201   1.1       cgd 				goto NM;
    202   1.1       cgd 			}
    203   1.1       cgd 		}
    204   1.1       cgd 		if ((monster->m_flags & CONFUSED) && move_confused(monster)) {
    205   1.1       cgd 			goto NM;
    206   1.1       cgd 		}
    207   1.1       cgd 		flew = 0;
    208   1.1       cgd 		if (	(monster->m_flags & FLIES) &&
    209   1.1       cgd 				!(monster->m_flags & NAPPING) &&
    210   1.1       cgd 				!mon_can_go(monster, rogue.row, rogue.col)) {
    211   1.1       cgd 			flew = 1;
    212   1.1       cgd 			mv_1_monster(monster, rogue.row, rogue.col);
    213   1.1       cgd 			if (mon_disappeared) {
    214   1.1       cgd 				goto NM;
    215   1.1       cgd 			}
    216   1.1       cgd 		}
    217   1.1       cgd 		if (!(flew && mon_can_go(monster, rogue.row, rogue.col))) {
    218   1.1       cgd 			mv_1_monster(monster, rogue.row, rogue.col);
    219   1.1       cgd 		}
    220   1.5   hubertf NM:		test_mons = level_monsters.next_monster;
    221   1.5   hubertf 		monster = NULL;
    222   1.5   hubertf 		while (test_mons)
    223   1.5   hubertf 		{
    224   1.5   hubertf 			if (next_monster == test_mons)
    225   1.5   hubertf 			{
    226   1.5   hubertf 				monster = next_monster;
    227   1.5   hubertf 				break;
    228   1.5   hubertf 			}
    229   1.5   hubertf 			test_mons = test_mons -> next_monster;
    230   1.5   hubertf 		}
    231   1.1       cgd 	}
    232   1.1       cgd }
    233   1.1       cgd 
    234   1.4     lukem void
    235  1.14  dholland party_monsters(int rn, int n)
    236   1.1       cgd {
    237   1.1       cgd 	short i, j;
    238   1.1       cgd 	short row, col;
    239   1.1       cgd 	object *monster;
    240   1.1       cgd 	boolean found;
    241   1.1       cgd 
    242   1.4     lukem 	row = col = 0;
    243   1.1       cgd 	n += n;
    244   1.1       cgd 
    245   1.1       cgd 	for (i = 0; i < MONSTERS; i++) {
    246   1.1       cgd 		mon_tab[i].first_level -= (cur_level % 3);
    247   1.1       cgd 	}
    248   1.1       cgd 	for (i = 0; i < n; i++) {
    249   1.1       cgd 		if (no_room_for_monster(rn)) {
    250   1.1       cgd 			break;
    251   1.1       cgd 		}
    252   1.1       cgd 		for (j = found = 0; ((!found) && (j < 250)); j++) {
    253   1.1       cgd 			row = get_rand(rooms[rn].top_row+1,
    254   1.1       cgd 				rooms[rn].bottom_row-1);
    255   1.1       cgd 			col = get_rand(rooms[rn].left_col+1,
    256   1.1       cgd 				rooms[rn].right_col-1);
    257   1.1       cgd 			if ((!(dungeon[row][col] & MONSTER)) &&
    258   1.1       cgd 				(dungeon[row][col] & (FLOOR | TUNNEL))) {
    259   1.1       cgd 				found = 1;
    260   1.1       cgd 			}
    261   1.1       cgd 		}
    262   1.1       cgd 		if (found) {
    263  1.13  dholland 			monster = gr_monster((object *)0, 0);
    264   1.1       cgd 			if (!(monster->m_flags & IMITATES)) {
    265   1.1       cgd 				monster->m_flags |= WAKENS;
    266   1.1       cgd 			}
    267   1.1       cgd 			put_m_at(row, col, monster);
    268   1.1       cgd 		}
    269   1.1       cgd 	}
    270   1.1       cgd 	for (i = 0; i < MONSTERS; i++) {
    271   1.1       cgd 		mon_tab[i].first_level += (cur_level % 3);
    272   1.1       cgd 	}
    273   1.1       cgd }
    274   1.1       cgd 
    275   1.4     lukem char
    276  1.14  dholland gmc_row_col(int row, int col)
    277   1.1       cgd {
    278   1.4     lukem 	object *monster;
    279   1.1       cgd 
    280   1.4     lukem 	if ((monster = object_at(&level_monsters, row, col)) != NULL) {
    281   1.1       cgd 		if ((!(detect_monster || see_invisible || r_see_invisible) &&
    282   1.1       cgd 			(monster->m_flags & INVISIBLE)) || blind) {
    283   1.1       cgd 			return(monster->trail_char);
    284   1.1       cgd 		}
    285   1.1       cgd 		if (monster->m_flags & IMITATES) {
    286   1.1       cgd 			return(monster->disguise);
    287   1.1       cgd 		}
    288   1.1       cgd 		return(monster->m_char);
    289   1.1       cgd 	} else {
    290   1.1       cgd 		return('&');	/* BUG if this ever happens */
    291   1.1       cgd 	}
    292   1.1       cgd }
    293   1.1       cgd 
    294   1.4     lukem char
    295  1.14  dholland gmc(object *monster)
    296   1.1       cgd {
    297   1.1       cgd 	if ((!(detect_monster || see_invisible || r_see_invisible) &&
    298   1.1       cgd 		(monster->m_flags & INVISIBLE))
    299   1.1       cgd 		|| blind) {
    300   1.1       cgd 		return(monster->trail_char);
    301   1.1       cgd 	}
    302   1.1       cgd 	if (monster->m_flags & IMITATES) {
    303   1.1       cgd 		return(monster->disguise);
    304   1.1       cgd 	}
    305   1.1       cgd 	return(monster->m_char);
    306   1.1       cgd }
    307   1.1       cgd 
    308   1.4     lukem void
    309  1.14  dholland mv_1_monster(object *monster, short row, short col)
    310   1.1       cgd {
    311   1.1       cgd 	short i, n;
    312   1.1       cgd 	boolean tried[6];
    313   1.1       cgd 
    314   1.1       cgd 	if (monster->m_flags & ASLEEP) {
    315   1.1       cgd 		if (monster->m_flags & NAPPING) {
    316   1.1       cgd 			if (--monster->nap_length <= 0) {
    317   1.1       cgd 				monster->m_flags &= (~(NAPPING | ASLEEP));
    318   1.1       cgd 			}
    319   1.1       cgd 			return;
    320   1.1       cgd 		}
    321   1.1       cgd 		if ((monster->m_flags & WAKENS) &&
    322   1.1       cgd 			 rogue_is_around(monster->row, monster->col) &&
    323   1.1       cgd 			 rand_percent(((stealthy > 0) ?
    324   1.1       cgd 			 	(WAKE_PERCENT / (STEALTH_FACTOR + stealthy)) :
    325   1.1       cgd 				WAKE_PERCENT))) {
    326   1.1       cgd 			wake_up(monster);
    327   1.1       cgd 		}
    328   1.1       cgd 		return;
    329   1.1       cgd 	} else if (monster->m_flags & ALREADY_MOVED) {
    330   1.1       cgd 		monster->m_flags &= (~ALREADY_MOVED);
    331   1.1       cgd 		return;
    332   1.1       cgd 	}
    333   1.1       cgd 	if ((monster->m_flags & FLITS) && flit(monster)) {
    334   1.1       cgd 		return;
    335   1.1       cgd 	}
    336   1.1       cgd 	if ((monster->m_flags & STATIONARY) &&
    337   1.1       cgd 		(!mon_can_go(monster, rogue.row, rogue.col))) {
    338   1.1       cgd 		return;
    339   1.1       cgd 	}
    340   1.1       cgd 	if (monster->m_flags & FREEZING_ROGUE) {
    341   1.1       cgd 		return;
    342   1.1       cgd 	}
    343   1.1       cgd 	if ((monster->m_flags & CONFUSES) && m_confuse(monster)) {
    344   1.1       cgd 		return;
    345   1.1       cgd 	}
    346   1.1       cgd 	if (mon_can_go(monster, rogue.row, rogue.col)) {
    347   1.1       cgd 		mon_hit(monster);
    348   1.1       cgd 		return;
    349   1.1       cgd 	}
    350   1.1       cgd 	if ((monster->m_flags & FLAMES) && flame_broil(monster)) {
    351   1.1       cgd 		return;
    352   1.1       cgd 	}
    353   1.1       cgd 	if ((monster->m_flags & SEEKS_GOLD) && seek_gold(monster)) {
    354   1.1       cgd 		return;
    355   1.1       cgd 	}
    356   1.1       cgd 	if ((monster->trow == monster->row) &&
    357   1.1       cgd 		   (monster->tcol == monster->col)) {
    358   1.1       cgd 		monster->trow = NO_ROOM;
    359   1.1       cgd 	} else if (monster->trow != NO_ROOM) {
    360   1.1       cgd 		row = monster->trow;
    361   1.1       cgd 		col = monster->tcol;
    362   1.1       cgd 	}
    363   1.1       cgd 	if (monster->row > row) {
    364   1.1       cgd 		row = monster->row - 1;
    365   1.1       cgd 	} else if (monster->row < row) {
    366   1.1       cgd 		row = monster->row + 1;
    367   1.1       cgd 	}
    368   1.1       cgd 	if ((dungeon[row][monster->col] & DOOR) &&
    369   1.1       cgd 		 mtry(monster, row, monster->col)) {
    370   1.1       cgd 		return;
    371   1.1       cgd 	}
    372   1.1       cgd 	if (monster->col > col) {
    373   1.1       cgd 		col = monster->col - 1;
    374   1.1       cgd 	} else if (monster->col < col) {
    375   1.1       cgd 		col = monster->col + 1;
    376   1.1       cgd 	}
    377   1.1       cgd 	if ((dungeon[monster->row][col] & DOOR) &&
    378   1.1       cgd 		 mtry(monster, monster->row, col)) {
    379   1.1       cgd 		return;
    380   1.1       cgd 	}
    381   1.1       cgd 	if (mtry(monster, row, col)) {
    382   1.1       cgd 		return;
    383   1.1       cgd 	}
    384   1.1       cgd 
    385   1.1       cgd 	for (i = 0; i <= 5; i++) tried[i] = 0;
    386   1.1       cgd 
    387   1.1       cgd 	for (i = 0; i < 6; i++) {
    388   1.1       cgd NEXT_TRY:	n = get_rand(0, 5);
    389   1.1       cgd 		switch(n) {
    390   1.1       cgd 		case 0:
    391   1.1       cgd 			if (!tried[n] && mtry(monster, row, monster->col-1)) {
    392   1.1       cgd 				goto O;
    393   1.1       cgd 			}
    394   1.1       cgd 			break;
    395   1.1       cgd 		case 1:
    396   1.1       cgd 			if (!tried[n] && mtry(monster, row, monster->col)) {
    397   1.1       cgd 				goto O;
    398   1.1       cgd 			}
    399   1.1       cgd 			break;
    400   1.1       cgd 		case 2:
    401   1.1       cgd 			if (!tried[n] && mtry(monster, row, monster->col+1)) {
    402   1.1       cgd 				goto O;
    403   1.1       cgd 			}
    404   1.1       cgd 			break;
    405   1.1       cgd 		case 3:
    406   1.1       cgd 			if (!tried[n] && mtry(monster, monster->row-1, col)) {
    407   1.1       cgd 				goto O;
    408   1.1       cgd 			}
    409   1.1       cgd 			break;
    410   1.1       cgd 		case 4:
    411   1.1       cgd 			if (!tried[n] && mtry(monster, monster->row, col)) {
    412   1.1       cgd 				goto O;
    413   1.1       cgd 			}
    414   1.1       cgd 			break;
    415   1.1       cgd 		case 5:
    416   1.1       cgd 			if (!tried[n] && mtry(monster, monster->row+1, col)) {
    417   1.1       cgd 				goto O;
    418   1.1       cgd 			}
    419   1.1       cgd 			break;
    420   1.1       cgd 		}
    421   1.1       cgd 		if (!tried[n]) {
    422   1.1       cgd 			tried[n] = 1;
    423   1.1       cgd 		} else {
    424   1.1       cgd 			goto NEXT_TRY;
    425   1.1       cgd 		}
    426   1.1       cgd 	}
    427   1.1       cgd O:
    428   1.1       cgd 	if ((monster->row == monster->o_row) && (monster->col == monster->o_col)) {
    429   1.1       cgd 		if (++(monster->o) > 4) {
    430   1.1       cgd 			if ((monster->trow == NO_ROOM) &&
    431   1.1       cgd 					(!mon_sees(monster, rogue.row, rogue.col))) {
    432   1.1       cgd 				monster->trow = get_rand(1, (DROWS - 2));
    433   1.1       cgd 				monster->tcol = get_rand(0, (DCOLS - 1));
    434   1.1       cgd 			} else {
    435   1.1       cgd 				monster->trow = NO_ROOM;
    436   1.1       cgd 				monster->o = 0;
    437   1.1       cgd 			}
    438   1.1       cgd 		}
    439   1.1       cgd 	} else {
    440   1.1       cgd 		monster->o_row = monster->row;
    441   1.1       cgd 		monster->o_col = monster->col;
    442   1.1       cgd 		monster->o = 0;
    443   1.1       cgd 	}
    444   1.1       cgd }
    445   1.1       cgd 
    446  1.15  dholland static int
    447  1.14  dholland mtry(object *monster, short row, short col)
    448   1.1       cgd {
    449   1.1       cgd 	if (mon_can_go(monster, row, col)) {
    450   1.1       cgd 		move_mon_to(monster, row, col);
    451   1.1       cgd 		return(1);
    452   1.1       cgd 	}
    453   1.1       cgd 	return(0);
    454   1.1       cgd }
    455   1.1       cgd 
    456   1.4     lukem void
    457  1.14  dholland move_mon_to(object *monster, short row, short col)
    458   1.1       cgd {
    459   1.1       cgd 	short c;
    460   1.4     lukem 	int mrow, mcol;
    461   1.1       cgd 
    462   1.1       cgd 	mrow = monster->row;
    463   1.1       cgd 	mcol = monster->col;
    464   1.1       cgd 
    465   1.1       cgd 	dungeon[mrow][mcol] &= ~MONSTER;
    466   1.1       cgd 	dungeon[row][col] |= MONSTER;
    467   1.1       cgd 
    468   1.1       cgd 	c = mvinch(mrow, mcol);
    469   1.1       cgd 
    470   1.1       cgd 	if ((c >= 'A') && (c <= 'Z')) {
    471   1.1       cgd 		if (!detect_monster) {
    472   1.1       cgd 			mvaddch(mrow, mcol, monster->trail_char);
    473   1.1       cgd 		} else {
    474   1.1       cgd 			if (rogue_can_see(mrow, mcol)) {
    475   1.1       cgd 				mvaddch(mrow, mcol, monster->trail_char);
    476   1.1       cgd 			} else {
    477   1.1       cgd 				if (monster->trail_char == '.') {
    478   1.1       cgd 					monster->trail_char = ' ';
    479   1.1       cgd 				}
    480   1.1       cgd 				mvaddch(mrow, mcol, monster->trail_char);
    481   1.1       cgd 			}
    482   1.1       cgd 		}
    483   1.1       cgd 	}
    484   1.1       cgd 	monster->trail_char = mvinch(row, col);
    485   1.1       cgd 	if (!blind && (detect_monster || rogue_can_see(row, col))) {
    486   1.1       cgd 		if ((!(monster->m_flags & INVISIBLE) ||
    487   1.1       cgd 			(detect_monster || see_invisible || r_see_invisible))) {
    488   1.1       cgd 			mvaddch(row, col, gmc(monster));
    489   1.1       cgd 		}
    490   1.1       cgd 	}
    491   1.1       cgd 	if ((dungeon[row][col] & DOOR) &&
    492   1.1       cgd 		(get_room_number(row, col) != cur_room) &&
    493   1.1       cgd 		(dungeon[mrow][mcol] == FLOOR) && !blind) {
    494   1.1       cgd 			mvaddch(mrow, mcol, ' ');
    495   1.1       cgd 	}
    496   1.1       cgd 	if (dungeon[row][col] & DOOR) {
    497   1.1       cgd 			dr_course(monster, ((dungeon[mrow][mcol] & TUNNEL) ? 1 : 0),
    498   1.1       cgd 				row, col);
    499   1.1       cgd 	} else {
    500   1.1       cgd 		monster->row = row;
    501   1.1       cgd 		monster->col = col;
    502   1.1       cgd 	}
    503   1.1       cgd }
    504   1.1       cgd 
    505   1.4     lukem int
    506  1.14  dholland mon_can_go(const object *monster, short row, short col)
    507   1.1       cgd {
    508   1.1       cgd 	object *obj;
    509   1.1       cgd 	short dr, dc;
    510   1.1       cgd 
    511   1.1       cgd 	dr = monster->row - row;	/* check if move distance > 1 */
    512   1.1       cgd 	if ((dr >= 2) || (dr <= -2)) {
    513   1.1       cgd 		return(0);
    514   1.1       cgd 	}
    515   1.1       cgd 	dc = monster->col - col;
    516   1.1       cgd 	if ((dc >= 2) || (dc <= -2)) {
    517   1.1       cgd 		return(0);
    518   1.1       cgd 	}
    519   1.1       cgd 	if ((!dungeon[monster->row][col]) || (!dungeon[row][monster->col])) {
    520   1.1       cgd 		return(0);
    521   1.1       cgd 	}
    522   1.1       cgd 	if ((!is_passable(row, col)) || (dungeon[row][col] & MONSTER)) {
    523   1.1       cgd 		return(0);
    524   1.1       cgd 	}
    525   1.1       cgd 	if ((monster->row!=row)&&(monster->col!=col)&&((dungeon[row][col]&DOOR) ||
    526   1.1       cgd 		(dungeon[monster->row][monster->col]&DOOR))) {
    527   1.1       cgd 		return(0);
    528   1.1       cgd 	}
    529   1.1       cgd 	if (!(monster->m_flags & (FLITS | CONFUSED | CAN_FLIT)) &&
    530   1.1       cgd 		(monster->trow == NO_ROOM)) {
    531   1.1       cgd 		if ((monster->row < rogue.row) && (row < monster->row)) return(0);
    532   1.1       cgd 		if ((monster->row > rogue.row) && (row > monster->row)) return(0);
    533   1.1       cgd 		if ((monster->col < rogue.col) && (col < monster->col)) return(0);
    534   1.1       cgd 		if ((monster->col > rogue.col) && (col > monster->col)) return(0);
    535   1.1       cgd 	}
    536   1.1       cgd 	if (dungeon[row][col] & OBJECT) {
    537   1.1       cgd 		obj = object_at(&level_objects, row, col);
    538   1.1       cgd 		if ((obj->what_is == SCROL) && (obj->which_kind == SCARE_MONSTER)) {
    539   1.1       cgd 			return(0);
    540   1.1       cgd 		}
    541   1.1       cgd 	}
    542   1.1       cgd 	return(1);
    543   1.1       cgd }
    544   1.1       cgd 
    545   1.4     lukem void
    546  1.14  dholland wake_up(object *monster)
    547   1.1       cgd {
    548   1.1       cgd 	if (!(monster->m_flags & NAPPING)) {
    549   1.1       cgd 		monster->m_flags &= (~(ASLEEP | IMITATES | WAKENS));
    550   1.1       cgd 	}
    551   1.1       cgd }
    552   1.1       cgd 
    553   1.4     lukem void
    554  1.14  dholland wake_room(short rn, boolean entering, short row, short col)
    555   1.1       cgd {
    556   1.1       cgd 	object *monster;
    557   1.1       cgd 	short wake_percent;
    558   1.1       cgd 	boolean in_room;
    559   1.1       cgd 
    560   1.1       cgd 	wake_percent = (rn == party_room) ? PARTY_WAKE_PERCENT : WAKE_PERCENT;
    561   1.1       cgd 	if (stealthy > 0) {
    562   1.1       cgd 		wake_percent /= (STEALTH_FACTOR + stealthy);
    563   1.1       cgd 	}
    564   1.1       cgd 
    565   1.1       cgd 	monster = level_monsters.next_monster;
    566   1.1       cgd 
    567   1.1       cgd 	while (monster) {
    568   1.1       cgd 		in_room = (rn == get_room_number(monster->row, monster->col));
    569   1.1       cgd 		if (in_room) {
    570   1.1       cgd 			if (entering) {
    571   1.1       cgd 				monster->trow = NO_ROOM;
    572   1.1       cgd 			} else {
    573   1.1       cgd 				monster->trow = row;
    574   1.1       cgd 				monster->tcol = col;
    575   1.1       cgd 			}
    576   1.1       cgd 		}
    577   1.1       cgd 		if ((monster->m_flags & WAKENS) &&
    578   1.1       cgd 			(rn == get_room_number(monster->row, monster->col))) {
    579   1.1       cgd 			if (rand_percent(wake_percent)) {
    580   1.1       cgd 				wake_up(monster);
    581   1.1       cgd 			}
    582   1.1       cgd 		}
    583   1.1       cgd 		monster = monster->next_monster;
    584   1.1       cgd 	}
    585   1.1       cgd }
    586   1.1       cgd 
    587   1.7   hubertf const char *
    588  1.14  dholland mon_name(const object *monster)
    589   1.1       cgd {
    590   1.1       cgd 	short ch;
    591   1.1       cgd 
    592   1.1       cgd 	if (blind || ((monster->m_flags & INVISIBLE) &&
    593   1.1       cgd 		!(detect_monster || see_invisible || r_see_invisible))) {
    594   1.1       cgd 		return("something");
    595   1.1       cgd 	}
    596   1.1       cgd 	if (halluc) {
    597   1.1       cgd 		ch = get_rand('A', 'Z') - 'A';
    598   1.1       cgd 		return(m_names[ch]);
    599   1.1       cgd 	}
    600   1.1       cgd 	ch = monster->m_char - 'A';
    601   1.1       cgd 	return(m_names[ch]);
    602   1.1       cgd }
    603   1.1       cgd 
    604  1.15  dholland static int
    605  1.14  dholland rogue_is_around(int row, int col)
    606   1.1       cgd {
    607   1.1       cgd 	short rdif, cdif, retval;
    608   1.1       cgd 
    609   1.1       cgd 	rdif = row - rogue.row;
    610   1.1       cgd 	cdif = col - rogue.col;
    611   1.1       cgd 
    612   1.1       cgd 	retval = (rdif >= -1) && (rdif <= 1) && (cdif >= -1) && (cdif <= 1);
    613   1.1       cgd 	return(retval);
    614   1.1       cgd }
    615   1.1       cgd 
    616   1.4     lukem void
    617  1.14  dholland wanderer(void)
    618   1.1       cgd {
    619   1.1       cgd 	object *monster;
    620   1.1       cgd 	short row, col, i;
    621   1.1       cgd 	boolean found = 0;
    622   1.1       cgd 
    623  1.10      tron 	monster = NULL;		/* XXXGCC -Wuninitialized [powerpc] */
    624   1.9        he 
    625   1.1       cgd 	for (i = 0; ((i < 15) && (!found)); i++) {
    626  1.14  dholland 		monster = gr_monster(NULL, 0);
    627   1.1       cgd 		if (!(monster->m_flags & (WAKENS | WANDERS))) {
    628   1.1       cgd 			free_object(monster);
    629   1.1       cgd 		} else {
    630   1.1       cgd 			found = 1;
    631   1.1       cgd 		}
    632   1.1       cgd 	}
    633   1.1       cgd 	if (found) {
    634   1.1       cgd 		found = 0;
    635   1.1       cgd 		wake_up(monster);
    636   1.1       cgd 		for (i = 0; ((i < 25) && (!found)); i++) {
    637   1.1       cgd 			gr_row_col(&row, &col, (FLOOR | TUNNEL | STAIRS | OBJECT));
    638   1.1       cgd 			if (!rogue_can_see(row, col)) {
    639   1.1       cgd 				put_m_at(row, col, monster);
    640   1.1       cgd 				found = 1;
    641   1.1       cgd 			}
    642   1.1       cgd 		}
    643   1.1       cgd 		if (!found) {
    644   1.1       cgd 			free_object(monster);
    645   1.1       cgd 		}
    646   1.1       cgd 	}
    647   1.1       cgd }
    648   1.1       cgd 
    649   1.4     lukem void
    650  1.14  dholland show_monsters(void)
    651   1.1       cgd {
    652   1.1       cgd 	object *monster;
    653   1.1       cgd 
    654   1.1       cgd 	detect_monster = 1;
    655   1.1       cgd 
    656   1.1       cgd 	if (blind) {
    657   1.1       cgd 		return;
    658   1.1       cgd 	}
    659   1.1       cgd 	monster = level_monsters.next_monster;
    660   1.1       cgd 
    661   1.1       cgd 	while (monster) {
    662   1.1       cgd 		mvaddch(monster->row, monster->col, monster->m_char);
    663   1.1       cgd 		if (monster->m_flags & IMITATES) {
    664   1.1       cgd 			monster->m_flags &= (~IMITATES);
    665   1.1       cgd 			monster->m_flags |= WAKENS;
    666   1.1       cgd 		}
    667   1.1       cgd 		monster = monster->next_monster;
    668   1.1       cgd 	}
    669   1.1       cgd }
    670   1.1       cgd 
    671   1.4     lukem void
    672  1.14  dholland create_monster(void)
    673   1.1       cgd {
    674   1.1       cgd 	short row, col;
    675   1.1       cgd 	short i;
    676   1.1       cgd 	boolean found = 0;
    677   1.1       cgd 	object *monster;
    678   1.1       cgd 
    679   1.1       cgd 	row = rogue.row;
    680   1.1       cgd 	col = rogue.col;
    681   1.1       cgd 
    682   1.1       cgd 	for (i = 0; i < 9; i++) {
    683   1.1       cgd 		rand_around(i, &row, &col);
    684  1.16  dholland 		if (((row == rogue.row) && (col == rogue.col)) ||
    685   1.1       cgd 				(row < MIN_ROW) || (row > (DROWS-2)) ||
    686   1.1       cgd 				(col < 0) || (col > (DCOLS-1))) {
    687   1.1       cgd 			continue;
    688   1.1       cgd 		}
    689   1.1       cgd 		if ((!(dungeon[row][col] & MONSTER)) &&
    690   1.1       cgd 			  (dungeon[row][col] & (FLOOR|TUNNEL|STAIRS|DOOR))) {
    691   1.1       cgd 			found = 1;
    692   1.1       cgd 			break;
    693   1.1       cgd 		}
    694   1.1       cgd 	}
    695   1.1       cgd 	if (found) {
    696  1.13  dholland 		monster = gr_monster((object *)0, 0);
    697   1.1       cgd 		put_m_at(row, col, monster);
    698   1.1       cgd 		mvaddch(row, col, gmc(monster));
    699   1.1       cgd 		if (monster->m_flags & (WANDERS | WAKENS)) {
    700   1.1       cgd 			wake_up(monster);
    701   1.1       cgd 		}
    702   1.1       cgd 	} else {
    703  1.12  dholland 		messagef(0, "you hear a faint cry of anguish in the distance");
    704   1.1       cgd 	}
    705   1.1       cgd }
    706   1.1       cgd 
    707  1.15  dholland static void
    708  1.14  dholland put_m_at(short row, short col, object *monster)
    709   1.1       cgd {
    710   1.1       cgd 	monster->row = row;
    711   1.1       cgd 	monster->col = col;
    712   1.1       cgd 	dungeon[row][col] |= MONSTER;
    713   1.1       cgd 	monster->trail_char = mvinch(row, col);
    714  1.13  dholland 	(void)add_to_pack(monster, &level_monsters, 0);
    715   1.1       cgd 	aim_monster(monster);
    716   1.1       cgd }
    717   1.1       cgd 
    718  1.15  dholland static void
    719  1.14  dholland aim_monster(object *monster)
    720   1.1       cgd {
    721   1.1       cgd 	short i, rn, d, r;
    722   1.1       cgd 
    723   1.1       cgd 	rn = get_room_number(monster->row, monster->col);
    724  1.11   jnemeth 	if (rn == NO_ROOM)
    725  1.11   jnemeth 		clean_up("aim_monster: monster not in room");
    726   1.1       cgd 	r = get_rand(0, 12);
    727   1.1       cgd 
    728   1.1       cgd 	for (i = 0; i < 4; i++) {
    729   1.1       cgd 		d = (r + i) % 4;
    730   1.1       cgd 		if (rooms[rn].doors[d].oth_room != NO_ROOM) {
    731   1.1       cgd 			monster->trow = rooms[rn].doors[d].door_row;
    732   1.1       cgd 			monster->tcol = rooms[rn].doors[d].door_col;
    733   1.1       cgd 			break;
    734   1.1       cgd 		}
    735   1.1       cgd 	}
    736   1.1       cgd }
    737   1.1       cgd 
    738   1.4     lukem int
    739  1.14  dholland rogue_can_see(int row, int col)
    740   1.1       cgd {
    741   1.4     lukem 	int retval;
    742   1.1       cgd 
    743   1.1       cgd 	retval = !blind &&
    744   1.1       cgd 			(((get_room_number(row, col) == cur_room) &&
    745   1.1       cgd 					!(rooms[cur_room].is_room & R_MAZE)) ||
    746   1.1       cgd 			rogue_is_around(row, col));
    747   1.1       cgd 
    748   1.1       cgd 	return(retval);
    749   1.1       cgd }
    750   1.1       cgd 
    751  1.15  dholland static int
    752  1.14  dholland move_confused(object *monster)
    753   1.1       cgd {
    754   1.1       cgd 	short i, row, col;
    755   1.1       cgd 
    756   1.1       cgd 	if (!(monster->m_flags & ASLEEP)) {
    757   1.1       cgd 		if (--monster->moves_confused <= 0) {
    758   1.1       cgd 			monster->m_flags &= (~CONFUSED);
    759   1.1       cgd 		}
    760   1.1       cgd 		if (monster->m_flags & STATIONARY) {
    761   1.1       cgd 			return(coin_toss() ? 1 : 0);
    762   1.1       cgd 		} else if (rand_percent(15)) {
    763   1.1       cgd 			return(1);
    764   1.1       cgd 		}
    765   1.1       cgd 		row = monster->row;
    766   1.1       cgd 		col = monster->col;
    767   1.1       cgd 
    768   1.1       cgd 		for (i = 0; i < 9; i++) {
    769   1.1       cgd 			rand_around(i, &row, &col);
    770   1.1       cgd 			if ((row == rogue.row) && (col == rogue.col)) {
    771   1.1       cgd 				return(0);
    772   1.1       cgd 			}
    773   1.1       cgd 			if (mtry(monster, row, col)) {
    774   1.1       cgd 				return(1);
    775   1.1       cgd 			}
    776   1.1       cgd 		}
    777   1.1       cgd 	}
    778   1.1       cgd 	return(0);
    779   1.1       cgd }
    780   1.1       cgd 
    781  1.15  dholland static int
    782  1.14  dholland flit(object *monster)
    783   1.1       cgd {
    784   1.1       cgd 	short i, row, col;
    785   1.1       cgd 
    786   1.1       cgd 	if (!rand_percent(FLIT_PERCENT + ((monster->m_flags & FLIES) ? 20 : 0))) {
    787   1.1       cgd 		return(0);
    788   1.1       cgd 	}
    789   1.1       cgd 	if (rand_percent(10)) {
    790   1.1       cgd 		return(1);
    791   1.1       cgd 	}
    792   1.1       cgd 	row = monster->row;
    793   1.1       cgd 	col = monster->col;
    794   1.1       cgd 
    795   1.1       cgd 	for (i = 0; i < 9; i++) {
    796   1.1       cgd 		rand_around(i, &row, &col);
    797   1.1       cgd 		if ((row == rogue.row) && (col == rogue.col)) {
    798   1.1       cgd 			continue;
    799   1.1       cgd 		}
    800   1.1       cgd 		if (mtry(monster, row, col)) {
    801   1.1       cgd 			return(1);
    802   1.1       cgd 		}
    803   1.1       cgd 	}
    804   1.1       cgd 	return(1);
    805   1.1       cgd }
    806   1.1       cgd 
    807   1.4     lukem char
    808  1.14  dholland gr_obj_char(void)
    809   1.1       cgd {
    810   1.1       cgd 	short r;
    811   1.7   hubertf 	const char *rs = "%!?]=/):*";
    812   1.1       cgd 
    813   1.1       cgd 	r = get_rand(0, 8);
    814   1.1       cgd 
    815   1.1       cgd 	return(rs[r]);
    816   1.1       cgd }
    817   1.1       cgd 
    818  1.15  dholland static int
    819  1.14  dholland no_room_for_monster(int rn)
    820   1.1       cgd {
    821   1.1       cgd 	short i, j;
    822   1.1       cgd 
    823   1.1       cgd 	for (i = rooms[rn].top_row+1; i < rooms[rn].bottom_row; i++) {
    824   1.1       cgd 		for (j = rooms[rn].left_col+1; j < rooms[rn].right_col; j++) {
    825   1.1       cgd 			if (!(dungeon[i][j] & MONSTER)) {
    826   1.1       cgd 				return(0);
    827   1.1       cgd 			}
    828   1.1       cgd 		}
    829   1.1       cgd 	}
    830   1.1       cgd 	return(1);
    831   1.1       cgd }
    832   1.1       cgd 
    833   1.4     lukem void
    834  1.14  dholland aggravate(void)
    835   1.1       cgd {
    836   1.1       cgd 	object *monster;
    837   1.1       cgd 
    838  1.12  dholland 	messagef(0, "you hear a high pitched humming noise");
    839   1.1       cgd 
    840   1.1       cgd 	monster = level_monsters.next_monster;
    841   1.1       cgd 
    842   1.1       cgd 	while (monster) {
    843   1.1       cgd 		wake_up(monster);
    844   1.1       cgd 		monster->m_flags &= (~IMITATES);
    845   1.1       cgd 		if (rogue_can_see(monster->row, monster->col)) {
    846   1.1       cgd 			mvaddch(monster->row, monster->col, monster->m_char);
    847   1.1       cgd 		}
    848   1.1       cgd 		monster = monster->next_monster;
    849   1.1       cgd 	}
    850   1.1       cgd }
    851   1.1       cgd 
    852   1.1       cgd boolean
    853  1.14  dholland mon_sees(const object *monster, int row, int col)
    854   1.1       cgd {
    855   1.1       cgd 	short rn, rdif, cdif, retval;
    856   1.1       cgd 
    857   1.1       cgd 	rn = get_room_number(row, col);
    858   1.1       cgd 
    859   1.1       cgd 	if (	(rn != NO_ROOM) &&
    860   1.1       cgd 			(rn == get_room_number(monster->row, monster->col)) &&
    861   1.1       cgd 			!(rooms[rn].is_room & R_MAZE)) {
    862   1.1       cgd 		return(1);
    863   1.1       cgd 	}
    864   1.1       cgd 	rdif = row - monster->row;
    865   1.1       cgd 	cdif = col - monster->col;
    866   1.1       cgd 
    867   1.1       cgd 	retval = (rdif >= -1) && (rdif <= 1) && (cdif >= -1) && (cdif <= 1);
    868   1.1       cgd 	return(retval);
    869   1.1       cgd }
    870   1.1       cgd 
    871   1.4     lukem void
    872  1.14  dholland mv_aquatars(void)
    873   1.1       cgd {
    874   1.1       cgd 	object *monster;
    875   1.1       cgd 
    876   1.1       cgd 	monster = level_monsters.next_monster;
    877   1.1       cgd 
    878   1.1       cgd 	while (monster) {
    879   1.1       cgd 		if ((monster->m_char == 'A') &&
    880   1.1       cgd 			mon_can_go(monster, rogue.row, rogue.col)) {
    881   1.1       cgd 			mv_1_monster(monster, rogue.row, rogue.col);
    882   1.1       cgd 			monster->m_flags |= ALREADY_MOVED;
    883   1.1       cgd 		}
    884   1.1       cgd 		monster = monster->next_monster;
    885   1.1       cgd 	}
    886   1.1       cgd }
    887