MCPcopy Index your code
hub / github.com/NetHack/NetHack / curse

Function curse

src/mkobj.c:1782–1819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1780}
1781
1782void
1783curse(struct obj *otmp)
1784{
1785 unsigned already_cursed;
1786 int old_light = 0;
1787
1788 if (otmp->oclass == COIN_CLASS)
1789 return;
1790 if (otmp->lamplit)
1791 old_light = arti_light_radius(otmp);
1792 already_cursed = otmp->cursed;
1793 otmp->blessed = 0;
1794 otmp->cursed = 1;
1795 /* welded two-handed weapon interferes with some armor removal */
1796 if (otmp == uwep && bimanual(uwep))
1797 reset_remarm();
1798 /* rules at top of wield.c state that twoweapon cannot be done
1799 with cursed alternate weapon */
1800 if (otmp == uswapwep && u.twoweap)
1801 drop_uswapwep();
1802 /* some cursed items need immediate updating */
1803 if (carried(otmp) && confers_luck(otmp)) {
1804 set_moreluck();
1805 } else if (otmp->otyp == BAG_OF_HOLDING) {
1806 otmp->owt = weight(otmp);
1807 } else if (otmp->otyp == FIGURINE) {
1808 if (otmp->corpsenm != NON_PM && !dead_species(otmp->corpsenm, TRUE)
1809 && (carried(otmp) || mcarried(otmp)))
1810 attach_fig_transform_timeout(otmp);
1811 } else if (otmp->oclass == SPBOOK_CLASS) {
1812 /* if book hero is reading becomes cursed, interrupt */
1813 if (!already_cursed)
1814 book_cursed(otmp);
1815 }
1816 if (otmp->lamplit)
1817 maybe_adjust_light(otmp, old_light);
1818 return;
1819}
1820
1821void
1822uncurse(struct obj *otmp)

Callers 15

resetobjsFunction · 0.85
drop_upon_deathFunction · 0.85
mk_mplayer_armorFunction · 0.85
rndcurseFunction · 0.85
impact_arti_lightFunction · 0.85
Helmet_onFunction · 0.85
readobjnamFunction · 0.85
freeinv_coreFunction · 0.85
m_dowear_typeFunction · 0.85
makerogueghostFunction · 0.85
mksobj_initFunction · 0.85
blessorcurseFunction · 0.85

Calls 10

arti_light_radiusFunction · 0.85
reset_remarmFunction · 0.85
drop_uswapwepFunction · 0.85
confers_luckFunction · 0.85
set_moreluckFunction · 0.85
weightFunction · 0.85
dead_speciesFunction · 0.85
book_cursedFunction · 0.85
maybe_adjust_lightFunction · 0.85

Tested by

no test coverage detected