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

Function seffect_scare_monster

src/read.c:1453–1486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1451}
1452
1453staticfn void
1454seffect_scare_monster(struct obj **sobjp)
1455{
1456 struct obj *sobj = *sobjp;
1457 int otyp = sobj->otyp;
1458 boolean scursed = sobj->cursed;
1459 boolean confused = (Confusion != 0);
1460 int ct = 0;
1461 struct monst *mtmp;
1462
1463 for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1464 if (DEADMONSTER(mtmp))
1465 continue;
1466 if (cansee(mtmp->mx, mtmp->my)) {
1467 if (confused || scursed) {
1468 mtmp->mflee = mtmp->mfrozen = mtmp->msleeping = 0;
1469 mtmp->mcanmove = 1;
1470 } else if (!resist(mtmp, sobj->oclass, 0, NOTELL))
1471 monflee(mtmp, 0, FALSE, FALSE);
1472 if (!mtmp->mtame)
1473 ct++; /* pets don't laugh at you */
1474 }
1475 }
1476 if (otyp == SCR_SCARE_MONSTER || !ct) {
1477 if (confused || scursed) {
1478 Soundeffect(se_sad_wailing, 50);
1479 } else {
1480 Soundeffect(se_maniacal_laughter, 50);
1481 }
1482 You_hear("%s %s.", (confused || scursed) ? "sad wailing"
1483 : "maniacal laughter",
1484 !ct ? "in the distance" : "close by");
1485 }
1486}
1487
1488staticfn void
1489seffect_remove_curse(struct obj **sobjp)

Callers 1

seffectsFunction · 0.85

Calls 3

resistFunction · 0.85
monfleeFunction · 0.85
You_hearFunction · 0.85

Tested by

no test coverage detected