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

Function fprefx

src/eat.c:2098–2217  ·  view source on GitHub ↗

* Called on "first bite" of (non-corpse) food, after touchfood() has * marked it 'partly eaten'. Used for non-rotten non-tin non-corpse food. * Messages should use present tense since multi-turn food won't be * finishing at the time they're issued. * Returns FALSE if eating should not succeed for whatever reason. */

Source from the content-addressed store, hash-verified

2096 * Returns FALSE if eating should not succeed for whatever reason.
2097 */
2098staticfn boolean
2099fprefx(struct obj *otmp)
2100{
2101 switch (otmp->otyp) {
2102 case EGG:
2103 if (otmp->corpsenm == PM_PYROLISK) {
2104 if (carried(otmp))
2105 useup(otmp);
2106 else
2107 useupf(otmp, 1L);
2108 explode(u.ux, u.uy, -11, d(3, 6), 0, EXPL_FIERY);
2109 return FALSE;
2110 } else if (stale_egg(otmp)) {
2111 pline("Ugh. Rotten egg."); /* perhaps others like it */
2112 /* increasing existing nausea means that it will take longer
2113 before eventual vomit, but also means that constitution
2114 will be abused more times before illness completes */
2115 make_vomiting((Vomiting & TIMEOUT) + (long) d(10, 4), TRUE);
2116 } else
2117 goto give_feedback;
2118 break;
2119 case FOOD_RATION: /* nutrition 800 */
2120 /* 200+800 remains below 1000+1, the satiation threshold */
2121 if (u.uhunger <= 200)
2122 pline("%s!", Hallucination ? "Oh wow, like, superior, man"
2123 : "This food really hits the spot");
2124
2125 /* 700-1+800 remains below 1500, the choking threshold which
2126 triggers "you're having a hard time getting it down" feedback */
2127 else if (u.uhunger < 700)
2128 pline("This satiates your %s!", body_part(STOMACH));
2129 /* [satiation message may be inaccurate if eating gets interrupted] */
2130 break;
2131 case TRIPE_RATION:
2132 if (carnivorous(gy.youmonst.data) && !humanoid(gy.youmonst.data)) {
2133 pline("This tripe ration is surprisingly good!");
2134 } else if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC))) {
2135 pline(Hallucination ? "Tastes great! Less filling!"
2136 : "Mmm, tripe... not bad!");
2137 } else {
2138 pline("Yak - dog food!");
2139 more_experienced(1, 0);
2140 newexplevel();
2141 /* not cannibalism, but we use similar criteria
2142 for deciding whether to be sickened by this meal */
2143 if (rn2(2) && !CANNIBAL_ALLOWED())
2144 make_vomiting((long) rn1(svc.context.victual.reqtime, 14),
2145 FALSE);
2146 }
2147 break;
2148 case LEMBAS_WAFER:
2149 if (maybe_polyd(is_orc(gy.youmonst.data), Race_if(PM_ORC))) {
2150 pline("%s", "!#?&* elf kibble!");
2151 break;
2152 } else if (maybe_polyd(is_elf(gy.youmonst.data), Race_if(PM_ELF))) {
2153 pline("A little goes a long way.");
2154 break;
2155 }

Callers 1

doeatFunction · 0.85

Calls 13

useupFunction · 0.85
useupfFunction · 0.85
explodeFunction · 0.85
dFunction · 0.85
make_vomitingFunction · 0.85
body_partFunction · 0.85
more_experiencedFunction · 0.85
newexplevelFunction · 0.85
rn2Function · 0.85
iter_monsFunction · 0.85
singularFunction · 0.85
rndFunction · 0.85

Tested by

no test coverage detected