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

Function m_next2m

src/muse.c:419–436  ·  view source on GitHub ↗

return TRUE if monster mtmp has another monster next to it. * Called from find_defensive() where it is limited to Is_knox() * only, otherwise you could trap two monsters next to each other * in a boulder fort, and they would be happy to stay in there. */

Source from the content-addressed store, hash-verified

417 * only, otherwise you could trap two monsters next to each other
418 * in a boulder fort, and they would be happy to stay in there. */
419staticfn boolean
420m_next2m(struct monst *mtmp)
421{
422 coordxy x, y;
423 struct monst *m2;
424
425 if (DEADMONSTER(mtmp) || mon_offmap(mtmp))
426 return FALSE;
427
428 for (x = mtmp->mx - 1; x <= mtmp->mx + 1; x++)
429 for (y = mtmp->my - 1; y <= mtmp->my + 1; y++) {
430 if (!isok(x,y))
431 continue;
432 if ((m2 = m_at(x, y)) && m2 != mtmp)
433 return TRUE;
434 }
435 return FALSE;
436}
437
438/* Select a defensive item/action for a monster. Returns TRUE iff one is
439 found. */

Callers 1

find_defensiveFunction · 0.85

Calls 1

isokFunction · 0.85

Tested by

no test coverage detected