Monsters try to escape from boulder forts
If a monster cannot move, for example because it's being blocked off by boulders or walls, it will try to escape by some method - such as a wand or scroll of teleportation.
This commit is contained in:
@@ -1012,6 +1012,7 @@ if a pet gelatinous cube eats a container, treat it the same as when a hostile
|
||||
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
|
||||
|
||||
@@ -1766,7 +1766,7 @@ extern boolean hits_bars(struct obj **, coordxy, coordxy, coordxy, coordxy, int,
|
||||
|
||||
/* ### 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 *);
|
||||
|
||||
@@ -645,7 +645,7 @@ dochug(register struct monst* mtmp)
|
||||
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)) {
|
||||
@@ -1391,8 +1391,11 @@ m_move(register struct monst* mtmp, register int after)
|
||||
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;
|
||||
|
||||
25
src/muse.c
25
src/muse.c
@@ -350,7 +350,7 @@ m_sees_sleepy_soldier(struct monst *mtmp)
|
||||
/* 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;
|
||||
@@ -365,7 +365,7 @@ find_defensive(struct monst* mtmp)
|
||||
|
||||
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;
|
||||
@@ -448,17 +448,20 @@ find_defensive(struct monst* mtmp)
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user