| 399 | } |
| 400 | |
| 401 | staticfn void |
| 402 | e_died( |
| 403 | struct entity *etmp, |
| 404 | int xkill_flags, int how) |
| 405 | { |
| 406 | if (is_u(etmp)) { |
| 407 | if (how == DROWNING) { |
| 408 | svk.killer.name[0] = 0; /* drown() sets its own killer */ |
| 409 | (void) drown(); |
| 410 | } else if (how == BURNING) { |
| 411 | svk.killer.name[0] = 0; /* lava_effects() sets own killer */ |
| 412 | (void) lava_effects(); |
| 413 | } else { |
| 414 | coord xy; |
| 415 | |
| 416 | /* use more specific killer if specified */ |
| 417 | if (!svk.killer.name[0]) { |
| 418 | svk.killer.format = KILLED_BY_AN; |
| 419 | Strcpy(svk.killer.name, "falling drawbridge"); |
| 420 | } |
| 421 | done(how); |
| 422 | /* So, you didn't die */ |
| 423 | if (!e_survives_at(etmp, etmp->ex, etmp->ey)) { |
| 424 | if (enexto(&xy, etmp->ex, etmp->ey, etmp->edata)) { |
| 425 | pline("A %s force teleports you away...", |
| 426 | Hallucination ? "normal" : "strange"); |
| 427 | teleds(xy.x, xy.y, TELEDS_NO_FLAGS); |
| 428 | } |
| 429 | /* otherwise on top of the drawbridge is the |
| 430 | * only viable spot in the dungeon, so stay there |
| 431 | */ |
| 432 | } |
| 433 | } |
| 434 | /* we might have crawled out of the moat to survive */ |
| 435 | etmp->ex = u.ux, etmp->ey = u.uy; |
| 436 | } else { |
| 437 | int entitycnt; |
| 438 | |
| 439 | svk.killer.name[0] = 0; |
| 440 | /* fake "digested to death" damage-type suppresses corpse */ |
| 441 | #define mk_message(dest) (((dest & XKILL_NOMSG) != 0) ? (char *) 0 : "") |
| 442 | #define mk_corpse(dest) (((dest & XKILL_NOCORPSE) != 0) ? AD_DGST : AD_PHYS) |
| 443 | /* if monsters are moving, one of them caused the destruction */ |
| 444 | if (svc.context.mon_moving) |
| 445 | monkilled(etmp->emon, |
| 446 | mk_message(xkill_flags), mk_corpse(xkill_flags)); |
| 447 | else /* you caused it */ |
| 448 | xkilled(etmp->emon, xkill_flags); |
| 449 | |
| 450 | /* if etmp gets life-saved, kill it again; otherwise we might end up |
| 451 | trying to place another monster (probably a xorn) on same spot */ |
| 452 | if (!DEADMONSTER(etmp->emon)) { |
| 453 | int seeit = canspotmon(etmp->emon); |
| 454 | |
| 455 | xkill_flags |= XKILL_NOMSG | XKILL_NOCONDUCT; |
| 456 | if (svc.context.mon_moving) |
| 457 | monkilled(etmp->emon, "", mk_corpse(xkill_flags)); |
| 458 | else /* you caused it */ |
no test coverage detected