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

Function mm_aggression

src/mon.c:2427–2447  ·  view source on GitHub ↗

Monster against monster special attacks; for the specified monster combinations, this allows one monster to attack another adjacent one in the absence of Conflict. There is no provision for targeting other monsters; just hand to hand fighting when they happen to be next to each other. */

Source from the content-addressed store, hash-verified

2425 other monsters; just hand to hand fighting when they happen to be
2426 next to each other. */
2427staticfn long
2428mm_aggression(
2429 struct monst *magr, /* monster that is currently deciding where to move */
2430 struct monst *mdef) /* another monster which is next to it */
2431{
2432 int mndx = monsndx(magr->data);
2433
2434 /* don't allow pets to fight each other */
2435 if (magr->mtame && mdef->mtame)
2436 return 0L;
2437
2438 /* supposedly purple worms are attracted to shrieking because they
2439 like to eat shriekers, so attack the latter when feasible */
2440 if ((mndx == PM_PURPLE_WORM || mndx == PM_BABY_PURPLE_WORM)
2441 && mdef->data == &mons[PM_SHRIEKER])
2442 return ALLOW_M | ALLOW_TM;
2443 /* Various other combinations such as dog vs cat, cat vs rat, and
2444 elf vs orc have been suggested. For the time being we don't
2445 support those. */
2446 return (mm_2way_aggression(magr, mdef) | mm_2way_aggression(mdef, magr));
2447}
2448
2449/* Monster displacing another monster out of the way */
2450staticfn long

Callers 1

mfndposFunction · 0.85

Calls 1

mm_2way_aggressionFunction · 0.85

Tested by

no test coverage detected