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

Function monkilled

src/mon.c:3376–3418  ·  view source on GitHub ↗

another monster has killed the monster mdef */

Source from the content-addressed store, hash-verified

3374
3375/* another monster has killed the monster mdef */
3376void
3377monkilled(
3378 struct monst *mdef,
3379 const char *fltxt,
3380 int how)
3381{
3382 struct permonst *mptr = mdef->data;
3383
3384 if (fltxt && (mdef->wormno ? worm_known(mdef)
3385 : cansee(mdef->mx, mdef->my)))
3386 pline_mon(mdef, "%s is %s%s%s!", Monnam(mdef),
3387 nonliving(mptr) ? "destroyed" : "killed",
3388 *fltxt ? " by the " : "", fltxt);
3389 else
3390 /* sad feeling is deferred until after potential life-saving */
3391 iflags.sad_feeling = mdef->mtame ? TRUE : FALSE;
3392
3393 /* no corpse if digested or disintegrated or flammable golem burnt up;
3394 no corpse for a paper golem means no scrolls; golems that rust or
3395 rot completely are described as "falling to pieces" so they do
3396 leave a corpse (which means staves for wood golem, leather armor for
3397 leather golem, iron chains for iron golem, not a regular corpse) */
3398 gd.disintegested = (how == AD_DGST || how == -AD_RBRE
3399 || (how == AD_FIRE && completelyburns(mptr)));
3400 if (gd.disintegested)
3401 mondead(mdef); /* never leaves a corpse */
3402 else
3403 mondied(mdef); /* calls mondead() and maybe leaves a corpse */
3404
3405 if (!DEADMONSTER(mdef))
3406 return; /* life-saved */
3407 /* extra message if pet golem is completely destroyed;
3408 if not visible, this will follow "you have a sad feeling" */
3409 if (mdef->mtame) {
3410 const char *rxt = (how == AD_FIRE && completelyburns(mptr)) ? "roast"
3411 : (how == AD_RUST && completelyrusts(mptr)) ? "rust"
3412 : (how == AD_DCAY && completelyrots(mptr)) ? "rot"
3413 : 0;
3414 if (rxt)
3415 pline("May %s %s in peace.", noit_mon_nam(mdef), rxt);
3416 }
3417 return;
3418}
3419
3420void
3421set_ustuck(struct monst *mtmp)

Callers 15

potionhitFunction · 0.85
mhitm_ad_rustFunction · 0.85
mhitm_ad_dcayFunction · 0.85
mhitm_ad_fireFunction · 0.85
light_hits_gremlinFunction · 0.85
dismount_steedFunction · 0.85
mdamagemFunction · 0.85
mon_polyFunction · 0.85
passivemmFunction · 0.85
inside_gas_cloudFunction · 0.85
wiz_killFunction · 0.85
trapeffect_rust_trapFunction · 0.85

Calls 7

worm_knownFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
mondeadFunction · 0.85
mondiedFunction · 0.85
noit_mon_namFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected