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

Function seffect_charging

src/read.c:1787–1827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1785}
1786
1787staticfn void
1788seffect_charging(struct obj **sobjp)
1789{
1790 struct obj *sobj = *sobjp;
1791 int otyp = sobj->otyp;
1792 boolean sblessed = sobj->blessed;
1793 boolean scursed = sobj->cursed;
1794 boolean confused = (Confusion != 0);
1795 boolean already_known = (sobj->oclass == SPBOOK_CLASS /* spell */
1796 || objects[otyp].oc_name_known);
1797 struct obj *otmp;
1798
1799 if (confused) {
1800 if (scursed) {
1801 You_feel("discharged.");
1802 u.uen = 0;
1803 } else {
1804 You_feel("charged up!");
1805 u.uen += d(sblessed ? 6 : 4, 4);
1806 if (u.uen > u.uenmax) /* if current energy is already at */
1807 u.uenmax = u.uen; /* or near maximum, increase maximum */
1808 else
1809 u.uen = u.uenmax; /* otherwise restore current to max */
1810 }
1811 disp.botl = TRUE;
1812 return;
1813 }
1814 /* known = TRUE; -- handled inline here */
1815 if (!already_known) {
1816 pline("This is a charging scroll.");
1817 learnscroll(sobj);
1818 }
1819 /* use it up now to prevent it from showing in the
1820 getobj picklist because the "disappears" message
1821 was already delivered */
1822 useup(sobj);
1823 *sobjp = 0; /* it's gone */
1824 otmp = getobj("charge", charge_ok, GETOBJ_PROMPT | GETOBJ_ALLOWCNT);
1825 if (otmp)
1826 recharge(otmp, scursed ? -1 : sblessed ? 1 : 0);
1827}
1828
1829staticfn void
1830seffect_amnesia(struct obj **sobjp)

Callers 1

seffectsFunction · 0.85

Calls 7

You_feelFunction · 0.85
dFunction · 0.85
learnscrollFunction · 0.85
useupFunction · 0.85
getobjFunction · 0.85
rechargeFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected