MCPcopy Index your code
hub / github.com/NetHack/NetHack / make_corpse

Function make_corpse

src/mon.c:563–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

561 * etc....
562 */
563staticfn struct obj *
564make_corpse(struct monst *mtmp, unsigned int corpseflags)
565{
566 struct permonst *mdat = mtmp->data;
567 int num;
568 struct obj *obj = (struct obj *) 0;
569 struct obj *otmp = (struct obj *) 0;
570 coordxy x = mtmp->mx, y = mtmp->my;
571/* int mndx = monsndx(mdat); */
572 enum monnums mndx = monsndx(mdat);
573 unsigned corpstatflags = corpseflags;
574 boolean burythem = ((corpstatflags & CORPSTAT_BURIED) != 0);
575
576 if (mtmp->female)
577 corpstatflags |= CORPSTAT_FEMALE;
578 else if (!is_neuter(mtmp->data))
579 corpstatflags |= CORPSTAT_MALE;
580
581 switch (mndx) {
582 case PM_GRAY_DRAGON:
583 case PM_GOLD_DRAGON:
584 case PM_SILVER_DRAGON:
585#if 0 /* DEFERRED */
586 case PM_SHIMMERING_DRAGON:
587#endif
588 case PM_RED_DRAGON:
589 case PM_ORANGE_DRAGON:
590 case PM_WHITE_DRAGON:
591 case PM_BLACK_DRAGON:
592 case PM_BLUE_DRAGON:
593 case PM_GREEN_DRAGON:
594 case PM_YELLOW_DRAGON:
595 /* Make dragon scales. This assumes that the order of the
596 dragons is the same as the order of the scales. */
597 if (!rn2(mtmp->mrevived ? 20 : 3)) {
598 num = GRAY_DRAGON_SCALES + monsndx(mdat) - PM_GRAY_DRAGON;
599 obj = mksobj_at(num, x, y, FALSE, FALSE);
600 obj->spe = 0;
601 obj->cursed = obj->blessed = FALSE;
602 }
603 goto default_1;
604 case PM_WHITE_UNICORN:
605 case PM_GRAY_UNICORN:
606 case PM_BLACK_UNICORN:
607 if (mtmp->mrevived && rn2(2)) {
608 if (canseemon(mtmp))
609 pline_mon(mtmp,
610 "%s recently regrown horn crumbles to dust.",
611 s_suffix(Monnam(mtmp)));
612 } else {
613 obj = mksobj_at(UNICORN_HORN, x, y, TRUE, FALSE);
614 if (obj && mtmp->mrevived)
615 obj->degraded_horn = 1;
616 }
617 goto default_1;
618 case PM_LONG_WORM:
619 (void) mksobj_at(WORM_TOOTH, x, y, TRUE, FALSE);
620 goto default_1;

Callers 2

mondiedFunction · 0.85
xkilledFunction · 0.85

Calls 15

rn2Function · 0.85
mksobj_atFunction · 0.85
canseemonFunction · 0.85
pline_monFunction · 0.85
s_suffixFunction · 0.85
MonnamFunction · 0.85
undead_to_corpseFunction · 0.85
mkcorpstatFunction · 0.85
dFunction · 0.85
weightFunction · 0.85
mkgoldFunction · 0.85
rnlFunction · 0.85

Tested by

no test coverage detected