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

Function cprefx

src/eat.c:790–864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

788}
789
790staticfn void
791cprefx(int pm)
792{
793 (void) maybe_cannibal(pm, TRUE);
794 if (flesh_petrifies(&mons[pm])) {
795 if (!Stone_resistance
796 && !(poly_when_stoned(gy.youmonst.data)
797 && polymon(PM_STONE_GOLEM))) {
798 /* if food was a tin, use it up early to keep it out of bones */
799 if (svc.context.tin.tin)
800 use_up_tin(svc.context.tin.tin);
801
802 Sprintf(svk.killer.name, "tasting %s meat",
803 mons[pm].pmnames[NEUTRAL]);
804 svk.killer.format = KILLED_BY;
805 You("turn to stone.");
806 done(STONING);
807 if (svc.context.victual.piece)
808 svc.context.victual.eating = 0;
809 return; /* lifesaved */
810 }
811 }
812
813 switch (pm) {
814 case PM_LITTLE_DOG:
815 case PM_DOG:
816 case PM_LARGE_DOG:
817 case PM_KITTEN:
818 case PM_HOUSECAT:
819 case PM_LARGE_CAT:
820 /* cannibals are allowed to eat domestic animals without penalty */
821 if (!CANNIBAL_ALLOWED()) {
822 You_feel("that eating the %s was a bad idea.",
823 mons[pm].pmnames[NEUTRAL]);
824 HAggravate_monster |= FROMOUTSIDE;
825 }
826 break;
827 case PM_LIZARD:
828 if (Stoned)
829 fix_petrification();
830 break;
831 case PM_DEATH:
832 case PM_PESTILENCE:
833 case PM_FAMINE: {
834 pline("Eating that is instantly fatal.");
835 Sprintf(svk.killer.name, "unwisely ate the body of %s",
836 mons[pm].pmnames[NEUTRAL]);
837 svk.killer.format = NO_KILLER_PREFIX;
838 done(DIED);
839 /* life-saving needed to reach here */
840 exercise(A_WIS, FALSE);
841 /* revive an actual corpse; can't do that if it was a tin;
842 5.0: this used to assume that such tins were impossible but
843 they can be wished for in wizard mode; they can't make it
844 to normal play though because bones creation empties them */
845 if (svc.context.victual.piece /* Null for tins */
846 && svc.context.victual.piece->otyp == CORPSE /* paranoia */
847 && revive_corpse(svc.context.victual.piece))

Callers 2

consume_tinFunction · 0.85
start_eatingFunction · 0.85

Calls 13

maybe_cannibalFunction · 0.85
poly_when_stonedFunction · 0.85
polymonFunction · 0.85
use_up_tinFunction · 0.85
YouFunction · 0.85
doneFunction · 0.85
You_feelFunction · 0.85
fix_petrificationFunction · 0.85
exerciseFunction · 0.85
revive_corpseFunction · 0.85
make_slimedFunction · 0.85
delayed_killerFunction · 0.85

Tested by

no test coverage detected