Unify mfndpos monster movement flags
This commit is contained in:
59
src/mon.c
59
src/mon.c
@@ -1541,6 +1541,65 @@ struct obj *otmp;
|
||||
return iquan;
|
||||
}
|
||||
|
||||
/* return flags based on monster data, for mfndpos() */
|
||||
long
|
||||
mon_allowflags(mtmp)
|
||||
struct monst *mtmp;
|
||||
{
|
||||
long flags = 0L;
|
||||
boolean can_open = !(nohands(mtmp->data) || verysmall(mtmp->data));
|
||||
boolean can_unlock = ((can_open && monhaskey(mtmp, TRUE))
|
||||
|| mtmp->iswiz || is_rider(mtmp->data));
|
||||
boolean doorbuster = is_giant(mtmp->data);
|
||||
|
||||
if (mtmp->mtame)
|
||||
flags |= ALLOW_M | ALLOW_TRAPS | ALLOW_SANCT | ALLOW_SSM;
|
||||
else if (mtmp->mpeaceful)
|
||||
flags |= ALLOW_SANCT | ALLOW_SSM;
|
||||
else
|
||||
flags |= ALLOW_U;
|
||||
if (Conflict && !resist(mtmp, RING_CLASS, 0, 0))
|
||||
flags |= ALLOW_U;
|
||||
if (mtmp->isshk)
|
||||
flags |= ALLOW_SSM;
|
||||
if (mtmp->ispriest)
|
||||
flags |= ALLOW_SSM | ALLOW_SANCT;
|
||||
if (passes_walls(mtmp->data))
|
||||
flags |= (ALLOW_ROCK | ALLOW_WALL);
|
||||
if (throws_rocks(mtmp->data))
|
||||
flags |= ALLOW_ROCK;
|
||||
if (tunnels(mtmp->data)
|
||||
&& !Is_rogue_level(&u.uz)) /* same restriction as m_move() */
|
||||
flags |= ALLOW_DIG;
|
||||
if (doorbuster)
|
||||
flags |= BUSTDOOR;
|
||||
if (can_open)
|
||||
flags |= OPENDOOR;
|
||||
if (can_unlock)
|
||||
flags |= UNLOCKDOOR;
|
||||
if (passes_bars(mtmp->data))
|
||||
flags |= ALLOW_BARS;
|
||||
if (is_displacer(mtmp->data))
|
||||
flags |= ALLOW_MDISP;
|
||||
if (is_minion(mtmp->data) || is_rider(mtmp->data))
|
||||
flags |= ALLOW_SANCT;
|
||||
/* unicorn may not be able to avoid hero on a noteleport level */
|
||||
if (is_unicorn(mtmp->data) && !noteleport_level(mtmp))
|
||||
flags |= NOTONL;
|
||||
if (passes_walls(mtmp->data))
|
||||
flags |= (ALLOW_WALL | ALLOW_ROCK);
|
||||
if (passes_bars(mtmp->data))
|
||||
flags |= ALLOW_BARS;
|
||||
if (is_human(mtmp->data) || mtmp->data == &mons[PM_MINOTAUR])
|
||||
flags |= ALLOW_SSM;
|
||||
if ((is_undead(mtmp->data) && mtmp->data->mlet != S_GHOST) || is_vampshifter(mtmp))
|
||||
flags |= NOGARLIC;
|
||||
if (throws_rocks(mtmp->data))
|
||||
flags |= ALLOW_ROCK;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* return number of acceptable neighbour positions */
|
||||
int
|
||||
mfndpos(mon, poss, info, flag)
|
||||
|
||||
Reference in New Issue
Block a user