does monster like object pile at x,y? */
| 1392 | |
| 1393 | /* does monster like object pile at x,y? */ |
| 1394 | staticfn boolean |
| 1395 | mon_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. |
no test coverage detected