/* Select a defensive item/action for a monster. Returns TRUE iff one is
found. */
boolean
-find_defensive(struct monst* mtmp, boolean tryescape)
+find_defensive(struct monst *mtmp, boolean tryescape)
{
struct obj *obj;
struct trap *t;
}
}
- if (stuck || immobile) {
+ if (stuck || immobile || mtmp->mtrapped) {
; /* fleeing by stairs or traps is not possible */
} else if (levl[x][y].typ == STAIRS) {
stway = stairway_at(x,y);
* 2: did something and can't attack again (i.e. teleported).
*/
int
-use_defensive(struct monst* mtmp)
+use_defensive(struct monst *mtmp)
{
int i, fleetim, how = 0;
struct obj *otmp = gm.m.defensive;
}
int
-rnd_defensive_item(struct monst* mtmp)
+rnd_defensive_item(struct monst *mtmp)
{
struct permonst *pm = mtmp->data;
int difficulty = mons[(monsndx(pm))].difficulty;
}
static void
-m_use_undead_turning(struct monst* mtmp, struct obj* obj)
+m_use_undead_turning(struct monst *mtmp, struct obj *obj)
{
coordxy ax = u.ux + sgn(mtmp->mux - mtmp->mx) * 3,
ay = u.uy + sgn(mtmp->muy - mtmp->my) * 3;
* found.
*/
boolean
-find_offensive(struct monst* mtmp)
+find_offensive(struct monst *mtmp)
{
register struct obj *obj;
boolean reflection_skip = m_seenres(mtmp, M_SEEN_REFL) != 0
#undef nomore
}
-static
-int
-mbhitm(register struct monst* mtmp, register struct obj* otmp)
+static int
+mbhitm(struct monst *mtmp, struct obj *otmp)
{
int tmp;
boolean reveal_invis = FALSE, hits_you = (mtmp == &gy.youmonst);
* after find_offensive(). Return values are same as use_defensive().
*/
int
-use_offensive(struct monst* mtmp)
+use_offensive(struct monst *mtmp)
{
int i;
struct obj *otmp = gm.m.offensive;
}
int
-rnd_offensive_item(struct monst* mtmp)
+rnd_offensive_item(struct monst *mtmp)
{
struct permonst *pm = mtmp->data;
int difficulty = mons[(monsndx(pm))].difficulty;
#define MUSE_BAG 10
boolean
-find_misc(struct monst* mtmp)
+find_misc(struct monst *mtmp)
{
register struct obj *obj;
struct permonst *mdat = mtmp->data;
if (dist2(x, y, mtmp->mux, mtmp->muy) > 36)
return FALSE;
- if (!stuck && !immobile && (mtmp->cham == NON_PM)
+ if (!stuck && !immobile && !mtmp->mtrapped && (mtmp->cham == NON_PM)
&& mons[(pmidx = monsndx(mdat))].difficulty < 6) {
boolean ignore_boulders = (verysmall(mdat) || throws_rocks(mdat)
|| passes_walls(mdat)),
for (xx = x - 1; xx <= x + 1; xx++)
for (yy = y - 1; yy <= y + 1; yy++)
- if (isok(xx, yy) && (xx != u.ux || yy != u.uy)
+ if (isok(xx, yy) && !u_at(xx, yy)
&& (diag_ok || xx == x || yy == y)
&& ((xx == x && yy == y) || !gl.level.monsters[xx][yy]))
if ((t = t_at(xx, yy)) != 0
/* type of monster to polymorph into; defaults to one suitable for the
current level rather than the totally arbitrary choice of newcham() */
static struct permonst *
-muse_newcham_mon(struct monst* mon)
+muse_newcham_mon(struct monst *mon)
{
struct obj *m_armr;
DISABLE_WARNING_UNREACHABLE_CODE
int
-use_misc(struct monst* mtmp)
+use_misc(struct monst *mtmp)
{
char nambuf[BUFSZ];
boolean vis, vismon, vistrapspot, oseen;
RESTORE_WARNINGS
static void
-you_aggravate(struct monst* mtmp)
+you_aggravate(struct monst *mtmp)
{
pline("For some reason, %s presence is known to you.",
s_suffix(noit_mon_nam(mtmp)));
}
int
-rnd_misc_item(struct monst* mtmp)
+rnd_misc_item(struct monst *mtmp)
{
struct permonst *pm = mtmp->data;
int difficulty = mons[(monsndx(pm))].difficulty;
#if 0
/* check whether hero is carrying a corpse or contained petrifier corpse */
static boolean
-necrophiliac(struct obj* objlist, boolean any_corpse)
+necrophiliac(struct obj *objlist, boolean any_corpse)
{
while (objlist) {
if (objlist->otyp == CORPSE
#endif
boolean
-searches_for_item(struct monst* mon, struct obj* obj)
+searches_for_item(struct monst *mon, struct obj *obj)
{
int typ = obj->otyp;
DISABLE_WARNING_FORMAT_NONLITERAL
boolean
-mon_reflects(struct monst* mon, const char* str)
+mon_reflects(struct monst *mon, const char *str)
{
struct obj *orefl = which_armor(mon, W_ARMS);
}
boolean
-ureflects(const char* fmt, const char* str)
+ureflects(const char *fmt, const char *str)
{
/* Check from outermost to innermost objects */
if (EReflecting & W_ARMS) {
/* cure mon's blindness (use_defensive, dog_eat, meatobj) */
void
-mcureblindness(struct monst* mon, boolean verbos)
+mcureblindness(struct monst *mon, boolean verbos)
{
if (!mon->mcansee) {
mon->mcansee = 1;
/* TRUE if the monster ate something */
boolean
-munstone(struct monst* mon, boolean by_you)
+munstone(struct monst *mon, boolean by_you)
{
struct obj *obj;
boolean tinok;
/* decide whether obj can cure petrification; also used when picking up */
static boolean
-cures_stoning(struct monst* mon, struct obj* obj, boolean tinok)
+cures_stoning(struct monst *mon, struct obj *obj, boolean tinok)
{
if (obj->otyp == POT_ACID)
return TRUE;
}
static boolean
-mcould_eat_tin(struct monst* mon)
+mcould_eat_tin(struct monst *mon)
{
struct obj *obj, *mwep;
boolean welded_wep;
/* TRUE if monster does something to avoid turning into green slime */
boolean
-munslime(struct monst* mon, boolean by_you)
+munslime(struct monst *mon, boolean by_you)
{
struct obj *obj, odummy;
struct permonst *mptr = mon->data;
the display color, otherwise we just pick things that seem plausibly
green (which doesn't necessarily match the TEXTCOLOR categorization) */
static boolean
-green_mon(struct monst* mon)
+green_mon(struct monst *mon)
{
struct permonst *ptr = mon->data;