MCPcopy Create free account
hub / github.com/NetHack/NetHack / m_avoid_soko_push_loc

Function m_avoid_soko_push_loc

src/monmove.c:1312–1323  ·  view source on GitHub ↗

monster avoids a location nx, ny, if we're in sokoban, and there's a boulder between the location and hero */

Source from the content-addressed store, hash-verified

1310/* monster avoids a location nx, ny, if we're in sokoban, and
1311 there's a boulder between the location and hero */
1312boolean
1313m_avoid_soko_push_loc(struct monst *mtmp, coordxy nx, coordxy ny)
1314{
1315 if (Sokoban
1316 && (mtmp->mpeaceful || mtmp->mtame)
1317 && !mtmp->mconf && !mtmp->mstun
1318 && !Conflict
1319 && (dist2(nx, ny, u.ux, u.uy) == 4)
1320 && sobj_at(BOULDER, nx + sgn(u.ux - nx), ny + sgn(u.uy - ny)))
1321 return TRUE;
1322 return FALSE;
1323}
1324
1325/* max distmin() distance for monster to look for items */
1326#define SQSRCHRADIUS 5

Callers 1

dog_moveFunction · 0.85

Calls 3

dist2Function · 0.85
sobj_atFunction · 0.85
sgnFunction · 0.85

Tested by

no test coverage detected