Pets avoid a possible boulder pushing location in Sokoban
This commit is contained in:
@@ -1401,6 +1401,7 @@ gold thrown or kicked at a sleeping monster with the 'greedy' attribute gets
|
||||
neglected to report that target monster was awakened in the process
|
||||
hero movement affects the water bubble movement direction
|
||||
pets and peacefuls avoid a location hero just kicked
|
||||
pets avoid a possible boulder pushing location in sokoban
|
||||
shopkeepers bill you for using their bear trap or land mine
|
||||
when engraving with a stack of eligible weapons, split one off the stack and
|
||||
dull it rather than dull the whole stack
|
||||
|
||||
@@ -1850,6 +1850,7 @@ extern void m_break_boulder(struct monst *, coordxy, coordxy) NONNULLARG1;
|
||||
extern int dochug(struct monst *) NONNULLARG1;
|
||||
extern boolean m_digweapon_check(struct monst *, coordxy, coordxy) NONNULLARG1;
|
||||
extern boolean m_avoid_kicked_loc(struct monst *, coordxy, coordxy) NONNULLARG1;
|
||||
extern boolean m_avoid_soko_push_loc(struct monst *, coordxy, coordxy) NONNULLARG1;
|
||||
extern int m_move(struct monst *, int) NONNULLARG1;
|
||||
extern int m_move_aggress(struct monst *, coordxy, coordxy) NONNULLARG1;
|
||||
extern void dissolve_bars(coordxy, coordxy);
|
||||
|
||||
@@ -1148,6 +1148,8 @@ dog_move(
|
||||
/* avoid a location hero just kicked */
|
||||
if (m_avoid_kicked_loc(mtmp, nx, ny))
|
||||
continue;
|
||||
if (m_avoid_soko_push_loc(mtmp, nx, ny))
|
||||
continue;
|
||||
|
||||
{
|
||||
/* Dog avoids harmful traps, but perhaps it has to pass one
|
||||
|
||||
@@ -1240,6 +1240,21 @@ m_avoid_kicked_loc(struct monst *mtmp, coordxy nx, coordxy ny)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* monster avoids a location nx, ny, if we're in sokoban, and
|
||||
there's a boulder between the location and hero */
|
||||
boolean
|
||||
m_avoid_soko_push_loc(struct monst *mtmp, coordxy nx, coordxy ny)
|
||||
{
|
||||
if (Sokoban
|
||||
&& (mtmp->mpeaceful || mtmp->mtame)
|
||||
&& !mtmp->mconf && !mtmp->mstun
|
||||
&& !Conflict
|
||||
&& (dist2(nx, ny, u.ux, u.uy) == 4)
|
||||
&& sobj_at(BOULDER, nx + sgn(u.ux - nx), ny + sgn(u.uy - ny)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* max distmin() distance for monster to look for items */
|
||||
#define SQSRCHRADIUS 5
|
||||
|
||||
|
||||
Reference in New Issue
Block a user