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

Function eatspecial

src/eat.c:2413–2486  ·  view source on GitHub ↗

called after eating non-food */

Source from the content-addressed store, hash-verified

2411
2412/* called after eating non-food */
2413staticfn void
2414eatspecial(void)
2415{
2416 struct obj *otmp = svc.context.victual.piece;
2417
2418 /* lesshungry wants an occupation to handle choke messages correctly */
2419 set_occupation(eatfood, "eating non-food", 0);
2420 lesshungry(svc.context.victual.nmod);
2421 go.occupation = 0;
2422 svc.context.victual = zero_victual; /* victual.piece = 0, .o_id = 0 */
2423
2424 if (otmp->oclass == COIN_CLASS) {
2425 if (carried(otmp))
2426 useupall(otmp);
2427 else
2428 useupf(otmp, otmp->quan);
2429 vault_gd_watching(GD_EATGOLD);
2430 return;
2431 }
2432 if (objects[otmp->otyp].oc_material == PAPER) {
2433#ifdef MAIL_STRUCTURES
2434 if (otmp->otyp == SCR_MAIL)
2435 /* no nutrition */
2436 pline("This junk mail is less than satisfying.");
2437 else
2438#endif
2439 if (otmp->otyp == SCR_SCARE_MONSTER)
2440 /* to eat scroll, hero is currently polymorphed into a monster */
2441 pline("Yuck%c", otmp->blessed ? '!' : '.');
2442 else if (otmp->oclass == SCROLL_CLASS
2443 /* check description after checking for specific scrolls */
2444 && objdescr_is(otmp, "YUM YUM"))
2445 pline("Yum%c", otmp->blessed ? '!' : '.');
2446 else
2447 pline("Needs salt...");
2448 }
2449 if (otmp->oclass == POTION_CLASS) {
2450 otmp->quan++; /* dopotion() does a useup() */
2451 (void) dopotion(otmp);
2452 } else if (otmp->oclass == RING_CLASS || otmp->oclass == AMULET_CLASS) {
2453 eataccessory(otmp);
2454 } else if (otmp->otyp == LEASH && otmp->leashmon) {
2455 o_unleash(otmp);
2456 }
2457
2458 /* KMH -- idea by "Tommy the Terrorist" */
2459 if (otmp->otyp == TRIDENT && !otmp->cursed) {
2460 /* sugarless chewing gum which used to be heavily advertised on TV */
2461 pline(Hallucination ? "Four out of five dentists agree."
2462 : "That was pure chewing satisfaction!");
2463 exercise(A_WIS, TRUE);
2464 }
2465 if (otmp->otyp == FLINT && !otmp->cursed) {
2466 /* chewable vitamin for kids based on "The Flintstones" TV cartoon */
2467 pline("Yabba-dabba delicious!");
2468 exercise(A_CON, TRUE);
2469 }
2470

Callers 1

doeat_nonfoodFunction · 0.85

Calls 15

set_occupationFunction · 0.85
lesshungryFunction · 0.85
useupallFunction · 0.85
useupfFunction · 0.85
vault_gd_watchingFunction · 0.85
objdescr_isFunction · 0.85
dopotionFunction · 0.85
eataccessoryFunction · 0.85
o_unleashFunction · 0.85
exerciseFunction · 0.85
uwepgoneFunction · 0.85
uqwepgoneFunction · 0.85

Tested by

no test coverage detected