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

Function mon_likes_objpile_at

src/muse.c:1394–1415  ·  view source on GitHub ↗

does monster like object pile at x,y? */

Source from the content-addressed store, hash-verified

1392
1393/* does monster like object pile at x,y? */
1394staticfn boolean
1395mon_likes_objpile_at(struct monst *mtmp, coordxy x, coordxy y)
1396{
1397 int i;
1398 struct obj *otmp;
1399
1400 if (!isok(x,y) || !OBJ_AT(x,y))
1401 return FALSE;
1402
1403 /* monster likes any of the top 3 items in the pile? */
1404 for (i = 0, otmp = svl.level.objects[x][y]; otmp && i < 3; i++) {
1405 if (mon_would_take_item(mtmp, otmp))
1406 return TRUE;
1407 otmp = otmp->nexthere;
1408 }
1409
1410 /* pile is larger than 3 stacks? */
1411 if (i >= 3)
1412 return TRUE;
1413
1414 return FALSE;
1415}
1416
1417/* Select an offensive item/action for a monster. Returns TRUE iff one is
1418 * found.

Callers 1

find_offensiveFunction · 0.85

Calls 2

isokFunction · 0.85
mon_would_take_itemFunction · 0.85

Tested by

no test coverage detected