Pets avoid a possible boulder pushing location in Sokoban

This commit is contained in:
Pasi Kallinen
2024-07-06 23:12:19 +03:00
parent a33f1edd24
commit d4ac146c5f
4 changed files with 19 additions and 0 deletions
+1
View File
@@ -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 neglected to report that target monster was awakened in the process
hero movement affects the water bubble movement direction hero movement affects the water bubble movement direction
pets and peacefuls avoid a location hero just kicked 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 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 when engraving with a stack of eligible weapons, split one off the stack and
dull it rather than dull the whole stack dull it rather than dull the whole stack
+1
View File
@@ -1850,6 +1850,7 @@ extern void m_break_boulder(struct monst *, coordxy, coordxy) NONNULLARG1;
extern int dochug(struct monst *) NONNULLARG1; extern int dochug(struct monst *) NONNULLARG1;
extern boolean m_digweapon_check(struct monst *, coordxy, coordxy) 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_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(struct monst *, int) NONNULLARG1;
extern int m_move_aggress(struct monst *, coordxy, coordxy) NONNULLARG1; extern int m_move_aggress(struct monst *, coordxy, coordxy) NONNULLARG1;
extern void dissolve_bars(coordxy, coordxy); extern void dissolve_bars(coordxy, coordxy);
+2
View File
@@ -1148,6 +1148,8 @@ dog_move(
/* avoid a location hero just kicked */ /* avoid a location hero just kicked */
if (m_avoid_kicked_loc(mtmp, nx, ny)) if (m_avoid_kicked_loc(mtmp, nx, ny))
continue; continue;
if (m_avoid_soko_push_loc(mtmp, nx, ny))
continue;
{ {
/* Dog avoids harmful traps, but perhaps it has to pass one /* Dog avoids harmful traps, but perhaps it has to pass one
+15
View File
@@ -1240,6 +1240,21 @@ m_avoid_kicked_loc(struct monst *mtmp, coordxy nx, coordxy ny)
return FALSE; 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 */ /* max distmin() distance for monster to look for items */
#define SQSRCHRADIUS 5 #define SQSRCHRADIUS 5