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

Function invoke_blinding_ray

src/artifact.c:2053–2086  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2051}
2052
2053staticfn int
2054invoke_blinding_ray(struct obj *obj)
2055{
2056 if (getdir((char *) 0)) {
2057 if (u.dx || u.dy) {
2058 do_blinding_ray(obj);
2059 } else if (u.dz) {
2060 /* up or down => light this map spot; litroom() uses
2061 radius 0 for Sunsword, except on Rogue level where
2062 whole room gets lit and corridor spots remain unlit */
2063 litroom(TRUE, obj);
2064 pline("%s", ((!Blind && levl[u.ux][u.uy].lit
2065 && !levl[u.ux][u.uy].waslit)
2066 ? "It is lit here now."
2067 : nothing_seems_to_happen));
2068 } else { /* zapyourself() */
2069 boolean vulnerable = (u.umonnum == PM_GREMLIN);
2070 int damg = obj->blessed ? 15 : !obj->cursed ? 10 : 5;
2071
2072 if (vulnerable) /* could be fatal if Unchanging */
2073 (void) lightdamage(obj, TRUE, 2 * damg);
2074
2075 if (!flashburn((long) (damg + rnd(damg)), FALSE)
2076 && !vulnerable)
2077 pline("%s", nothing_seems_to_happen);
2078 }
2079 } else {
2080 /* no direction picked */
2081 pline("%s", Never_mind);
2082 obj->age = svm.moves;
2083 return ECMD_CANCEL;
2084 }
2085 return ECMD_TIME;
2086}
2087
2088/* return the amount of Pw invoking an object costs.
2089 return a negative value, if obj invoking cannot be paid with Pw */

Callers 1

arti_invokeFunction · 0.85

Calls 7

getdirFunction · 0.85
do_blinding_rayFunction · 0.85
litroomFunction · 0.85
lightdamageFunction · 0.85
flashburnFunction · 0.85
rndFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected