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

Function seffect_light

src/read.c:1740–1785  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1738}
1739
1740staticfn void
1741seffect_light(struct obj **sobjp)
1742{
1743 struct obj *sobj = *sobjp;
1744 boolean sblessed = sobj->blessed;
1745 boolean scursed = sobj->cursed;
1746 boolean confused = (Confusion != 0);
1747
1748 if (!confused) {
1749 if (!Blind)
1750 gk.known = TRUE;
1751 litroom(!scursed, sobj);
1752 if (!scursed) {
1753 if (lightdamage(sobj, TRUE, 5))
1754 gk.known = TRUE;
1755 }
1756 } else {
1757 int pm = scursed ? PM_BLACK_LIGHT : PM_YELLOW_LIGHT;
1758
1759 if ((svm.mvitals[pm].mvflags & G_GONE)) {
1760 pline("Tiny lights sparkle in the air momentarily.");
1761 } else {
1762 /* surround with cancelled tame lights which won't explode */
1763 struct monst *mon;
1764 boolean sawlights = FALSE;
1765 int i, numlights = rn1(2, 3) + (sblessed * 2);
1766
1767 for (i = 0; i < numlights; ++i) {
1768 mon = makemon(&mons[pm], u.ux, u.uy,
1769 MM_EDOG | NO_MINVENT | MM_NOMSG);
1770 if (mon) {
1771 initedog(mon, TRUE);
1772 mon->msleeping = 0;
1773 mon->mcan = TRUE;
1774 if (canspotmon(mon))
1775 sawlights = TRUE;
1776 newsym(mon->mx, mon->my);
1777 }
1778 }
1779 if (sawlights) {
1780 pline("Lights appear all around you!");
1781 gk.known = TRUE;
1782 }
1783 }
1784 }
1785}
1786
1787staticfn void
1788seffect_charging(struct obj **sobjp)

Callers 1

seffectsFunction · 0.85

Calls 6

litroomFunction · 0.85
lightdamageFunction · 0.85
makemonFunction · 0.85
initedogFunction · 0.85
newsymFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected