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

Function arti_light_radius

src/light.c:880–911  ·  view source on GitHub ↗

light emitting artifact's range depends upon its curse/bless state */

Source from the content-addressed store, hash-verified

878
879/* light emitting artifact's range depends upon its curse/bless state */
880int
881arti_light_radius(struct obj *obj)
882{
883 int res;
884
885 /*
886 * Used by begin_burn() when setting up a new light source
887 * (obj->lamplit will already be set by this point) and
888 * also by bless()/unbless()/uncurse()/curse() to decide
889 * whether to call obj_adjust_light_radius().
890 */
891
892 /* sanity check [simplifies usage by bless()/curse()/&c] */
893 if (!obj->lamplit || !artifact_light(obj))
894 return 0;
895
896 /* cursed radius of 1 is not noticeable for an item that's
897 carried by the hero but is if it's carried by a monster
898 or left lit on the floor (not applicable for Sunsword) */
899 res = (obj->blessed ? 3 : !obj->cursed ? 2 : 1);
900
901 /* if poly'd into gold dragon with embedded scales, make the scales
902 have minimum radiance (hero as light source will use light radius
903 based on monster form); otherwise, worn gold DSM gives off more
904 light than other light sources */
905 if (obj == uskin)
906 res = 1;
907 else if (obj->otyp == GOLD_DRAGON_SCALE_MAIL) /* DSM but not scales */
908 ++res;
909
910 return res;
911}
912
913/* adverb describing lit artifact's light; radius varies depending upon
914 curse/bless state; also used for gold dragon scales/scale mail */

Callers 10

arti_light_descriptionFunction · 0.85
begin_burnFunction · 0.85
polyselfFunction · 0.85
skinbackFunction · 0.85
maybe_adjust_lightFunction · 0.85
blessFunction · 0.85
unblessFunction · 0.85
curseFunction · 0.85
uncurseFunction · 0.85
seffect_enchant_armorFunction · 0.85

Calls 1

artifact_lightFunction · 0.85

Tested by

no test coverage detected