unlike the finger of death spell which behaves like a wand of death, this monster spell only attacks the hero */
| 320 | /* unlike the finger of death spell which behaves like a wand of death, |
| 321 | this monster spell only attacks the hero */ |
| 322 | void |
| 323 | touch_of_death(struct monst *mtmp) |
| 324 | { |
| 325 | char kbuf[BUFSZ]; |
| 326 | int dmg = 50 + d(8, 6); |
| 327 | int drain = dmg / 2; |
| 328 | |
| 329 | /* if we get here, we know that hero isn't magic resistant and isn't |
| 330 | poly'd into an undead or demon */ |
| 331 | You_feel("drained..."); |
| 332 | (void) death_inflicted_by(kbuf, "the touch of death", mtmp); |
| 333 | |
| 334 | if (Upolyd) { |
| 335 | u.mh = 0; |
| 336 | rehumanize(); /* fatal iff Unchanging */ |
| 337 | } else if (drain >= u.uhpmax) { |
| 338 | svk.killer.format = KILLED_BY; |
| 339 | Strcpy(svk.killer.name, kbuf); |
| 340 | done(DIED); |
| 341 | } else { |
| 342 | /* HP manipulation similar to poisoned(attrib.c) */ |
| 343 | int olduhp = u.uhp, |
| 344 | uhpmin = minuhpmax(3), |
| 345 | newuhpmax = u.uhpmax - drain; |
| 346 | |
| 347 | setuhpmax(max(newuhpmax, uhpmin), FALSE); |
| 348 | dmg = adjuhploss(dmg, olduhp); /* reduce pending damage if uhp has |
| 349 | * already been reduced due to drop |
| 350 | * in uhpmax */ |
| 351 | losehp(dmg, kbuf, KILLED_BY); |
| 352 | } |
| 353 | svk.killer.name[0] = '\0'; /* not killed if we get here... */ |
| 354 | } |
| 355 | |
| 356 | /* give a reason for death by some monster spells */ |
| 357 | char * |
no test coverage detected