Pets avoid a possible boulder pushing location in Sokoban
This commit is contained in:
@@ -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