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

Function trapeffect_fire_trap

src/trap.c:1729–1822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1727}
1728
1729staticfn int
1730trapeffect_fire_trap(
1731 struct monst *mtmp,
1732 struct trap *trap,
1733 unsigned int trflags UNUSED)
1734{
1735 if (mtmp == &gy.youmonst) {
1736 seetrap(trap);
1737 dofiretrap((struct obj *) 0);
1738 } else {
1739 coordxy tx = trap->tx, ty = trap->ty;
1740 boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
1741 boolean see_it = cansee(tx, ty);
1742 boolean trapkilled = FALSE;
1743 struct permonst *mptr = mtmp->data;
1744 int orig_dmg = d(2, 4);
1745
1746 if (in_sight)
1747 pline_mon(mtmp,
1748 "A %s erupts from the %s under %s!", tower_of_flame,
1749 surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
1750 else if (see_it) { /* evidently `mtmp' is invisible */
1751 set_msg_xy(mtmp->mx, mtmp->my);
1752 You_see("a %s erupt from the %s!", tower_of_flame,
1753 surface(mtmp->mx, mtmp->my));
1754 }
1755 if (resists_fire(mtmp)) {
1756 if (in_sight) {
1757 shieldeff(mtmp->mx, mtmp->my);
1758 pline("%s is uninjured.", Monnam(mtmp));
1759 }
1760 } else {
1761 int num = orig_dmg, alt;
1762 boolean immolate = FALSE;
1763
1764 /* paper burns very fast, assume straw is tightly packed
1765 and burns a bit slower
1766 (note: this is inconsistent with mattackm()'s AD_FIRE
1767 damage where completelyburns() includes straw golem) */
1768 switch (monsndx(mptr)) {
1769 case PM_PAPER_GOLEM:
1770 immolate = TRUE;
1771 alt = mtmp->mhpmax;
1772 break;
1773 case PM_STRAW_GOLEM:
1774 alt = mtmp->mhpmax / 2;
1775 break;
1776 case PM_WOOD_GOLEM:
1777 alt = mtmp->mhpmax / 4;
1778 break;
1779 case PM_LEATHER_GOLEM:
1780 alt = mtmp->mhpmax / 8;
1781 break;
1782 default:
1783 alt = 0;
1784 break;
1785 }
1786 if (alt > num)

Callers 2

trapeffect_magic_trapFunction · 0.85
trapeffect_selectorFunction · 0.85

Calls 15

seetrapFunction · 0.85
dofiretrapFunction · 0.85
canseemonFunction · 0.85
dFunction · 0.85
pline_monFunction · 0.85
surfaceFunction · 0.85
mon_namFunction · 0.85
set_msg_xyFunction · 0.85
You_seeFunction · 0.85
shieldeffFunction · 0.85
MonnamFunction · 0.85
thitmFunction · 0.85

Tested by

no test coverage detected