when breaking a wand of sleep hits the hero with the explosion, don't describe
that as "the sleep ray hits you"
expose fuz tester to wizard-mode as #fuzzer extended command
+monsters which cannot move due to boulders or walls try to escape
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
/* ### muse.c ### */
-extern boolean find_defensive(struct monst *);
+extern boolean find_defensive(struct monst *, boolean);
extern int use_defensive(struct monst *);
extern int rnd_defensive_item(struct monst *);
extern boolean find_offensive(struct monst *);
distfleeck(mtmp, &inrange, &nearby, &scared);
/* search for and potentially use defensive or miscellaneous items. */
- if (find_defensive(mtmp)) {
+ if (find_defensive(mtmp, FALSE)) {
if (use_defensive(mtmp) != 0)
return 1;
} else if (find_misc(mtmp)) {
coord poss[9];
cnt = mfndpos(mtmp, poss, info, flag);
- if (cnt == 0)
+ if (cnt == 0) {
+ if (find_defensive(mtmp, TRUE))
+ (void) use_defensive(mtmp);
return MMOVE_NOMOVES;
+ }
chcnt = 0;
jcnt = min(MTSZ, cnt - 1);
chi = -1;
/* Select a defensive item/action for a monster. Returns TRUE iff one is
found. */
boolean
-find_defensive(struct monst* mtmp)
+find_defensive(struct monst* mtmp, boolean tryescape)
{
struct obj *obj;
struct trap *t;
if (is_animal(mtmp->data) || mindless(mtmp->data))
return FALSE;
- if (dist2(x, y, mtmp->mux, mtmp->muy) > 25)
+ if (!tryescape && dist2(x, y, mtmp->mux, mtmp->muy) > 25)
return FALSE;
if (u.uswallow && stuck)
return FALSE;
}
}
- fraction = u.ulevel < 10 ? 5 : u.ulevel < 14 ? 4 : 3;
- if (mtmp->mhp >= mtmp->mhpmax
- || (mtmp->mhp >= 10 && mtmp->mhp * fraction >= mtmp->mhpmax))
- return FALSE;
+ if (!tryescape) {
+ /* do we try to heal? */
+ fraction = u.ulevel < 10 ? 5 : u.ulevel < 14 ? 4 : 3;
+ if (mtmp->mhp >= mtmp->mhpmax
+ || (mtmp->mhp >= 10 && mtmp->mhp * fraction >= mtmp->mhpmax))
+ return FALSE;
- if (mtmp->mpeaceful) {
- if (!nohands(mtmp->data)) {
- if (m_use_healing(mtmp))
- return TRUE;
+ if (mtmp->mpeaceful) {
+ if (!nohands(mtmp->data)) {
+ if (m_use_healing(mtmp))
+ return TRUE;
+ }
+ return FALSE;
}
- return FALSE;
}
if (stuck || immobile) {