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

Function explmu

src/mhitu.c:1590–1664  ·  view source on GitHub ↗

monster explodes in your face */

Source from the content-addressed store, hash-verified

1588
1589/* monster explodes in your face */
1590staticfn int
1591explmu(
1592 struct monst *mtmp,
1593 struct attack *mattk,
1594 boolean ufound)
1595{
1596 boolean kill_agr = TRUE;
1597 boolean not_affected;
1598 int tmp;
1599
1600 if (mtmp->mcan)
1601 return M_ATTK_MISS;
1602
1603 tmp = d((int) mattk->damn, (int) mattk->damd);
1604 not_affected = defended(mtmp, (int) mattk->adtyp);
1605
1606 if (!ufound) {
1607 pline("%s explodes at a spot in %s!",
1608 canseemon(mtmp) ? Monnam(mtmp) : "It",
1609 is_waterwall(mtmp->mux,mtmp->muy) ? "empty water"
1610 : "thin air");
1611 } else {
1612 hitmsg(mtmp, mattk);
1613 }
1614
1615 switch (mattk->adtyp) {
1616 case AD_COLD:
1617 case AD_FIRE:
1618 case AD_ELEC:
1619 mon_explodes(mtmp, mattk);
1620 if (!DEADMONSTER(mtmp))
1621 kill_agr = FALSE; /* lifesaving? */
1622 break;
1623 case AD_BLND:
1624 not_affected = resists_blnd(&gy.youmonst);
1625 if (ufound && !not_affected) {
1626 /* sometimes you're affected even if it's invisible */
1627 if (mon_visible(mtmp) || (rnd(tmp /= 2) > u.ulevel)) {
1628 You("are blinded by a blast of light!");
1629 make_blinded((long) tmp, FALSE);
1630 if (!Blind)
1631 Your1(vision_clears);
1632 } else if (flags.verbose)
1633 You("get the impression it was not terribly bright.");
1634 }
1635 break;
1636 case AD_HALU:
1637 not_affected |= Blind || (u.umonnum == PM_BLACK_LIGHT
1638 || u.umonnum == PM_VIOLET_FUNGUS
1639 || dmgtype(gy.youmonst.data, AD_STUN));
1640 if (ufound && !not_affected) {
1641 boolean chg;
1642 if (!Hallucination)
1643 You("are caught in a blast of kaleidoscopic light!");
1644 /* avoid hallucinating the black light as it dies */
1645 mondead(mtmp); /* remove it from map now */
1646 kill_agr = FALSE; /* already killed (maybe lifesaved) */
1647 chg =

Callers 1

mattackuFunction · 0.85

Calls 15

dFunction · 0.85
defendedFunction · 0.85
canseemonFunction · 0.85
MonnamFunction · 0.85
is_waterwallFunction · 0.85
hitmsgFunction · 0.85
mon_explodesFunction · 0.85
resists_blndFunction · 0.85
mon_visibleFunction · 0.85
rndFunction · 0.85
YouFunction · 0.85
make_blindedFunction · 0.85

Tested by

no test coverage detected