static boolean holds_up_web(xchar, xchar);
static int count_webbing_walls(xchar, xchar);
static boolean soko_allow_web(struct monst *);
+static boolean leppie_avoidance(struct monst *);
static boolean m_balks_at_approaching(struct monst *);
static boolean stuff_prevents_passage(struct monst *);
static int vamp_shift(struct monst *, struct permonst *, boolean);
return FALSE;
}
+/* does leprechaun want to avoid the hero? */
+static boolean
+leppie_avoidance(struct monst *mtmp)
+{
+ struct obj *lepgold, *ygold;
+
+ if (mtmp->data == &mons[PM_LEPRECHAUN]
+ && ((lepgold = findgold(mtmp->minvent))
+ && (lepgold->quan
+ > ((ygold = findgold(g.invent)) ? ygold->quan : 0L))))
+ return TRUE;
+
+ return FALSE;
+}
+
/* does monster want to avoid you? */
static boolean
m_balks_at_approaching(struct monst* mtmp)
if (mtmp->mconf || (u.uswallow && mtmp == u.ustuck)) {
appr = 0;
} else {
- struct obj *lepgold, *ygold;
boolean should_see = (couldsee(omx, omy)
&& (levl[gx][gy].lit || !levl[omx][omy].lit)
&& (dist2(omx, omy, gx, gy) <= 36));
|| ptr->mlet == S_LIGHT) && !rn2(3)))
appr = 0;
- if (monsndx(ptr) == PM_LEPRECHAUN && (appr == 1)
- && ((lepgold = findgold(mtmp->minvent))
- && (lepgold->quan
- > ((ygold = findgold(g.invent)) ? ygold->quan : 0L))))
+ if (appr == 1 && leppie_avoidance(mtmp))
appr = -1;
/* hostiles with ranged weapon or attack try to stay away */