the player has killed the monster mtmp */
| 3474 | |
| 3475 | /* the player has killed the monster mtmp */ |
| 3476 | void |
| 3477 | xkilled( |
| 3478 | struct monst *mtmp, |
| 3479 | int xkill_flags) /* 1: suppress mesg, 2: suppress corpse, 4: pacifist */ |
| 3480 | { |
| 3481 | int tmp, mndx; |
| 3482 | coordxy x = mtmp->mx, y = mtmp->my; |
| 3483 | struct monst museum = cg.zeromonst; |
| 3484 | struct permonst *mdat; |
| 3485 | struct obj *otmp; |
| 3486 | struct trap *t; |
| 3487 | boolean be_sad; |
| 3488 | boolean wasinside = engulfing_u(mtmp), |
| 3489 | burycorpse = FALSE, |
| 3490 | nomsg = (xkill_flags & XKILL_NOMSG) != 0, |
| 3491 | nocorpse = (xkill_flags & XKILL_NOCORPSE) != 0, |
| 3492 | noconduct = (xkill_flags & XKILL_NOCONDUCT) != 0; |
| 3493 | |
| 3494 | /* potential pet message; always clear global flag */ |
| 3495 | be_sad = iflags.sad_feeling; |
| 3496 | iflags.sad_feeling = FALSE; |
| 3497 | |
| 3498 | mtmp->mhp = 0; /* caller will usually have already done this */ |
| 3499 | if (!noconduct) { /* KMH, conduct */ |
| 3500 | if (!u.uconduct.killer++) |
| 3501 | livelog_printf(LL_CONDUCT, "killed for the first time"); |
| 3502 | } |
| 3503 | if (!nomsg) { |
| 3504 | boolean namedpet = has_mgivenname(mtmp) && !Hallucination; |
| 3505 | |
| 3506 | You("%s %s!", |
| 3507 | nonliving(mtmp->data) ? "destroy" : "kill", |
| 3508 | !(wasinside || canspotmon(mtmp)) ? "it" |
| 3509 | : !mtmp->mtame ? mon_nam(mtmp) |
| 3510 | : x_monnam(mtmp, namedpet ? ARTICLE_NONE : ARTICLE_THE, |
| 3511 | "poor", namedpet ? SUPPRESS_SADDLE : 0, FALSE)); |
| 3512 | } |
| 3513 | |
| 3514 | if (mtmp->mtrapped && (t = t_at(x, y)) != 0 && is_pit(t->ttyp)) { |
| 3515 | if (sobj_at(BOULDER, x, y)) |
| 3516 | nocorpse = TRUE; /* Prevent corpses/treasure being created |
| 3517 | * "on top" of boulder that is about to fall in. |
| 3518 | * This is out of order, but cannot be helped |
| 3519 | * unless this whole routine is rearranged. */ |
| 3520 | if (m_carrying(mtmp, BOULDER)) |
| 3521 | burycorpse = TRUE; |
| 3522 | } |
| 3523 | |
| 3524 | /* your pet knows who just killed it...watch out */ |
| 3525 | if (mtmp->mtame && !mtmp->isminion) |
| 3526 | EDOG(mtmp)->killed_by_u = 1; |
| 3527 | |
| 3528 | if (wasinside && gt.thrownobj && gt.thrownobj != uball |
| 3529 | /* don't give to mon if missile is going to be destroyed */ |
| 3530 | && gt.thrownobj->oclass != POTION_CLASS |
| 3531 | /* don't give to mon if missile is going to return to hero */ |
| 3532 | && gt.thrownobj != (struct obj *) iflags.returning_missile) { |
| 3533 | /* thrown object has killed hero's engulfer; add it to mon's |
no test coverage detected