light damages hero in gremlin form */
| 3023 | |
| 3024 | /* light damages hero in gremlin form */ |
| 3025 | int |
| 3026 | lightdamage( |
| 3027 | struct obj *obj, /* item making light (fake book if spell) */ |
| 3028 | boolean ordinary, /* wand/camera zap vs wand destruction */ |
| 3029 | int amt) /* pseudo-damage used to determine blindness duration */ |
| 3030 | { |
| 3031 | char buf[BUFSZ]; |
| 3032 | const char *how; |
| 3033 | int dmg = amt; |
| 3034 | |
| 3035 | if (dmg && gy.youmonst.data == &mons[PM_GREMLIN]) { |
| 3036 | /* reduce high values (from destruction of wand with many charges) */ |
| 3037 | dmg = rnd(dmg); |
| 3038 | if (dmg > 10) |
| 3039 | dmg = 10 + rnd(dmg - 10); |
| 3040 | if (dmg > 20) |
| 3041 | dmg = 20; |
| 3042 | pline("Ow, that light hurts%c", (dmg > 2 || u.mh <= 5) ? '!' : '.'); |
| 3043 | /* [composing killer/reason is superfluous here; if fatal, cause |
| 3044 | of death will always be "killed while stuck in creature form"] */ |
| 3045 | if (obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS) |
| 3046 | ordinary = FALSE; /* say blasted rather than zapped */ |
| 3047 | how = (obj->oclass == SPBOOK_CLASS) ? "spell of light" |
| 3048 | : (!obj->oartifact) ? ansimpleoname(obj) |
| 3049 | : bare_artifactname(obj); |
| 3050 | Sprintf(buf, "%s %sself with %s", ordinary ? "zapped" : "blasted", |
| 3051 | uhim(), how); |
| 3052 | /* might rehumanize(); could be fatal, but only for Unchanging */ |
| 3053 | losehp(Maybe_Half_Phys(dmg), buf, NO_KILLER_PREFIX); |
| 3054 | } |
| 3055 | return dmg; |
| 3056 | } |
| 3057 | |
| 3058 | /* light[ning] causes blindness */ |
| 3059 | boolean |
no test coverage detected