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

Function fpostfx

src/eat.c:2509–2600  ·  view source on GitHub ↗

called after consuming (non-corpse) food */

Source from the content-addressed store, hash-verified

2507
2508/* called after consuming (non-corpse) food */
2509staticfn void
2510fpostfx(struct obj *otmp)
2511{
2512 switch (otmp->otyp) {
2513 case SPRIG_OF_WOLFSBANE:
2514 if (ismnum(u.ulycn) || is_were(gy.youmonst.data))
2515 you_unwere(TRUE);
2516 break;
2517 case CARROT:
2518 if (!u.uswallow
2519 || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
2520 make_blinded((long) u.ucreamed, TRUE);
2521 break;
2522 case FORTUNE_COOKIE:
2523 outrumor(bcsign(otmp), BY_COOKIE);
2524 if (!Blind)
2525 if (!u.uconduct.literate++)
2526 livelog_printf(LL_CONDUCT,
2527 "became literate by reading the fortune inside a cookie");
2528 break;
2529 case LUMP_OF_ROYAL_JELLY:
2530 if (gy.youmonst.data == &mons[PM_KILLER_BEE] && !Unchanging
2531 && polymon(PM_QUEEN_BEE))
2532 break;
2533
2534 /* This stuff seems to be VERY healthy! */
2535 gainstr(otmp, 1, TRUE);
2536 if (Upolyd) {
2537 u.mh += otmp->cursed ? -rnd(20) : rnd(20), disp.botl = TRUE;
2538 if (u.mh > u.mhmax) {
2539 if (!rn2(17))
2540 setuhpmax(u.mhmax + 1, FALSE);
2541 u.mh = u.mhmax;
2542 } else if (u.mh <= 0) {
2543 rehumanize();
2544 }
2545 } else {
2546 u.uhp += otmp->cursed ? -rnd(20) : rnd(20), disp.botl = TRUE;
2547 if (u.uhp > u.uhpmax) {
2548 if (!rn2(17))
2549 setuhpmax(u.uhpmax + 1, FALSE);
2550 u.uhp = u.uhpmax;
2551 } else if (u.uhp <= 0) {
2552 svk.killer.format = KILLED_BY_AN;
2553 Strcpy(svk.killer.name, "rotten lump of royal jelly");
2554 done(POISONING);
2555 }
2556 }
2557 if (!otmp->cursed)
2558 heal_legs(0);
2559 break;
2560 case EGG:
2561 if (ismnum(otmp->corpsenm)
2562 && flesh_petrifies(&mons[otmp->corpsenm])) {
2563 if (!Stone_resistance
2564 && !(poly_when_stoned(gy.youmonst.data)
2565 && polymon(PM_STONE_GOLEM))) {
2566 if (!Stoned) {

Callers 1

done_eatingFunction · 0.85

Calls 15

you_unwereFunction · 0.85
attacktype_fordmgFunction · 0.85
make_blindedFunction · 0.85
outrumorFunction · 0.85
bcsignFunction · 0.85
livelog_printfFunction · 0.85
polymonFunction · 0.85
gainstrFunction · 0.85
rndFunction · 0.85
rn2Function · 0.85
setuhpmaxFunction · 0.85
rehumanizeFunction · 0.85

Tested by

no test coverage detected