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

Function mon_has_friends

src/muse.c:1370–1391  ·  view source on GitHub ↗

hostile monster has another hostile next to it */

Source from the content-addressed store, hash-verified

1368
1369/* hostile monster has another hostile next to it */
1370staticfn boolean
1371mon_has_friends(struct monst *mtmp)
1372{
1373 coordxy dx, dy;
1374 struct monst *mon2;
1375
1376 if (mtmp->mtame || mtmp->mpeaceful)
1377 return FALSE;
1378
1379 for (dx = -1; dx <= 1; dx++)
1380 for (dy = -1; dy <= 1; dy++) {
1381 coordxy x = mtmp->mx + dx;
1382 coordxy y = mtmp->my + dy;
1383
1384 if (isok(x, y) && (mon2 = m_at(x, y)) != 0
1385 && mon2 != mtmp
1386 && !mon2->mtame && !mon2->mpeaceful)
1387 return TRUE;
1388 }
1389
1390 return FALSE;
1391}
1392
1393/* does monster like object pile at x,y? */
1394staticfn boolean

Callers 1

find_offensiveFunction · 0.85

Calls 1

isokFunction · 0.85

Tested by

no test coverage detected