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

Function could_reach_item

src/dogmove.c:1361–1369  ·  view source on GitHub ↗

check if a monster could pick up objects from a location */

Source from the content-addressed store, hash-verified

1359
1360/* check if a monster could pick up objects from a location */
1361boolean
1362could_reach_item(struct monst *mon, coordxy nx, coordxy ny)
1363{
1364 if ((!is_pool(nx, ny) || is_swimmer(mon->data))
1365 && (!is_lava(nx, ny) || likes_lava(mon->data))
1366 && (!sobj_at(BOULDER, nx, ny) || throws_rocks(mon->data)))
1367 return TRUE;
1368 return FALSE;
1369}
1370
1371/* Hack to prevent a dog from being endlessly stuck near an object that
1372 * it can't reach, such as caught in a teleport scroll niche. It recursively

Callers 6

dog_inventFunction · 0.85
dog_goalFunction · 0.85
dog_moveFunction · 0.85
can_reach_locationFunction · 0.85
mpickstuffFunction · 0.85
m_search_itemsFunction · 0.85

Calls 3

is_poolFunction · 0.85
is_lavaFunction · 0.85
sobj_atFunction · 0.85

Tested by

no test coverage detected