1 /* NetHack 3.6 eat.c $NHDT-Date: 1449269916 2015/12/04 22:58:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.154 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000 */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016 */
8 /* JNetHack may be freely redistributed. See license for details. */
12 STATIC_PTR int NDECL(eatmdone);
13 STATIC_PTR int NDECL(eatfood);
14 STATIC_PTR void FDECL(costly_tin, (int));
15 STATIC_PTR int NDECL(opentin);
16 STATIC_PTR int NDECL(unfaint);
18 STATIC_DCL const char *FDECL(food_xname, (struct obj *, BOOLEAN_P));
19 STATIC_DCL void FDECL(choke, (struct obj *));
20 STATIC_DCL void NDECL(recalc_wt);
21 STATIC_DCL struct obj *FDECL(touchfood, (struct obj *));
22 STATIC_DCL void NDECL(do_reset_eat);
23 STATIC_DCL void FDECL(done_eating, (BOOLEAN_P));
24 STATIC_DCL void FDECL(cprefx, (int));
25 STATIC_DCL int FDECL(intrinsic_possible, (int, struct permonst *));
26 STATIC_DCL void FDECL(givit, (int, struct permonst *));
27 STATIC_DCL void FDECL(cpostfx, (int));
28 STATIC_DCL void FDECL(consume_tin, (const char *));
29 STATIC_DCL void FDECL(start_tin, (struct obj *));
30 STATIC_DCL int FDECL(eatcorpse, (struct obj *));
31 STATIC_DCL void FDECL(start_eating, (struct obj *));
32 STATIC_DCL void FDECL(fprefx, (struct obj *));
33 STATIC_DCL void FDECL(fpostfx, (struct obj *));
34 STATIC_DCL int NDECL(bite);
35 STATIC_DCL int FDECL(edibility_prompts, (struct obj *));
36 STATIC_DCL int FDECL(rottenfood, (struct obj *));
37 STATIC_DCL void NDECL(eatspecial);
38 STATIC_DCL int FDECL(bounded_increase, (int, int, int));
39 STATIC_DCL void FDECL(accessory_has_effect, (struct obj *));
40 STATIC_DCL void FDECL(eataccessory, (struct obj *));
41 STATIC_DCL const char *FDECL(foodword, (struct obj *));
42 STATIC_DCL int FDECL(tin_variety, (struct obj *, BOOLEAN_P));
43 STATIC_DCL boolean FDECL(maybe_cannibal, (int, BOOLEAN_P));
47 /* also used to see if you're allowed to eat cats and dogs */
48 #define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC))
50 /* monster types that cause hero to be turned into stone if eaten */
51 #define flesh_petrifies(pm) (touch_petrifies(pm) || (pm) == &mons[PM_MEDUSA])
53 /* Rider corpses are treated as non-rotting so that attempting to eat one
54 will be sure to reach the stage of eating where that meal is fatal */
55 #define nonrotting_corpse(mnum) \
56 ((mnum) == PM_LIZARD || (mnum) == PM_LICHEN || is_rider(&mons[mnum]))
58 /* non-rotting non-corpses; unlike lizard corpses, these items will behave
59 as if rotten if they are cursed (fortune cookies handled elsewhere) */
60 #define nonrotting_food(otyp) \
61 ((otyp) == LEMBAS_WAFER || (otyp) == CRAM_RATION)
63 STATIC_OVL NEARDATA const char comestibles[] = { FOOD_CLASS, 0 };
64 STATIC_OVL NEARDATA const char offerfodder[] = { FOOD_CLASS, AMULET_CLASS,
67 /* Gold must come first for getobj(). */
68 STATIC_OVL NEARDATA const char allobj[] = {
69 COIN_CLASS, WEAPON_CLASS, ARMOR_CLASS, POTION_CLASS,
70 SCROLL_CLASS, WAND_CLASS, RING_CLASS, AMULET_CLASS,
71 FOOD_CLASS, TOOL_CLASS, GEM_CLASS, ROCK_CLASS,
72 BALL_CLASS, CHAIN_CLASS, SPBOOK_CLASS, 0
75 STATIC_OVL boolean force_save_hs = FALSE;
77 /* see hunger states in hack.h - texts used on bottom line */
79 const char *hu_stat[] = { "Satiated", " ", "Hungry ", "Weak ",
80 "Fainting", "Fainted ", "Starved " };
82 const char *hu_stat[] = { "
\96\9e\95 ", " ", "
\82Ø
\82±
\82Ø
\82±", "
\90\8a\8eã ",
83 "
\82Ó
\82ç
\82Ó
\82ç", "
\91²
\93| ", "
\89ì
\8e\80 " };
87 * Decide whether a particular object can be eaten by the possibly
88 * polymorphed character. Not used for monster checks.
92 register struct obj *obj;
94 /* protect invocation tools but not Rider corpses (handled elsewhere)*/
95 /* if (obj->oclass != FOOD_CLASS && obj_resists(obj, 0, 0)) */
96 if (objects[obj->otyp].oc_unique)
98 /* above also prevents the Amulet from being eaten, so we must never
99 allow fake amulets to be eaten either [which is already the case] */
101 if (metallivorous(youmonst.data) && is_metallic(obj)
102 && (youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj)))
105 if (u.umonnum == PM_GELATINOUS_CUBE && is_organic(obj)
106 /* [g.cubes can eat containers and retain all contents
107 as engulfed items, but poly'd player can't do that] */
108 && !Has_contents(obj))
111 /* return (boolean) !!index(comestibles, obj->oclass); */
112 return (boolean) (obj->oclass == FOOD_CLASS);
122 /* tin types [SPINACH_TIN = -1, overrides corpsenm, nut==600] */
123 static const struct {
124 const char *txt; /* description */
125 int nut; /* nutrition */
126 Bitfield(fodder, 1); /* stocked by health food shops */
127 Bitfield(greasy, 1); /* causes slippery fingers */
129 } tintxts[] = { { "rotten", -50, 0, 0 }, /* ROTTEN_TIN = 0 */
130 { "homemade", 50, 1, 0 }, /* HOMEMADE_TIN = 1 */
131 { "soup made from", 20, 1, 0 },
132 { "french fried", 40, 0, 1 },
133 { "pickled", 40, 1, 0 },
134 { "boiled", 50, 1, 0 },
135 { "smoked", 50, 1, 0 },
136 { "dried", 55, 1, 0 },
137 { "deep fried", 60, 0, 1 },
138 { "szechuan", 70, 1, 0 },
139 { "broiled", 80, 0, 0 },
140 { "stir fried", 80, 0, 1 },
141 { "sauteed", 95, 0, 0 },
142 { "candied", 100, 1, 0 },
143 { "pureed", 500, 1, 0 },
146 } tintxts[] = { { "
\95\85\82Á
\82½", -50, 0, 0 }, /* ROTTEN_TIN = 0 */
147 { "
\8e©
\89Æ
\90»
\82Ì", 50, 1, 0 }, /* HOMEMADE_TIN = 1 */
148 { "
\82Ì
\83X
\81[
\83v", 20, 1, 0 },
149 { "
\82Ì
\83t
\83\89\83C", 40, 0, 1 },
150 { "
\82Ì
\92Ð
\95¨", 40, 1, 0 },
151 { "
\82ä
\82Å", 50, 1, 0 },
152 { "
\82Ìà
\8e\90»", 50, 1, 0 },
153 { "
\8a£
\91\87", 55, 1, 0 },
154 { "
\82Ì
\97g
\82°
\95¨", 60, 0, 1 },
155 { "
\8el
\90ì
\95\97", 70, 1, 0 },
156 { "
\82Ì
\96Ô
\8fÄ
\82«", 80, 0, 0 },
157 { "àu
\82ß", 80, 0, 1 },
158 { "
\82Ì
\83\
\83e
\81[", 95, 0, 0 },
159 { "
\82Ì
\8d»
\93\9c\92Ð
\82¯", 100, 1, 0 },
160 { "
\82Ì
\83s
\83\85\81[
\83\8c", 500, 1, 0 },
163 #define TTSZ SIZE(tintxts)
165 static char *eatmbuf = 0; /* set by cpostfx() */
167 /* called after mimicing is over */
171 /* release `eatmbuf' */
173 if (nomovemsg == eatmbuf)
175 free((genericptr_t) eatmbuf), eatmbuf = 0;
178 if (youmonst.m_ap_type) {
179 youmonst.m_ap_type = M_AP_NOTHING;
185 /* called when hallucination is toggled */
189 const char *altmsg = 0;
190 int altapp = 0; /* lint suppression */
192 if (!eatmbuf || nomovemsg != eatmbuf)
195 if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) {
196 /* revert from hallucinatory to "normal" mimicking */
197 altmsg = "You now prefer mimicking yourself.";
199 } else if (is_obj_mappear(&youmonst,GOLD_PIECE) && Hallucination) {
200 /* won't happen; anything which might make immobilized
201 hero begin hallucinating (black light attack, theft
202 of Grayswandir) will terminate the mimicry first */
203 altmsg = "Your rind escaped intact.";
208 /* replace end-of-mimicking message */
209 if (strlen(altmsg) > strlen(eatmbuf)) {
210 free((genericptr_t) eatmbuf);
211 eatmbuf = (char *) alloc(strlen(altmsg) + 1);
213 nomovemsg = strcpy(eatmbuf, altmsg);
214 /* update current image */
215 youmonst.mappearance = altapp;
220 /* ``[the(] singular(food, xname) [)]'' */
221 STATIC_OVL const char *
222 food_xname(food, the_pfx)
228 if (food->otyp == CORPSE) {
229 result = corpse_xname(food, (const char *) 0,
230 CXN_SINGULAR | (the_pfx ? CXN_PFX_THE : 0));
231 /* not strictly needed since pname values are capitalized
232 and the() is a no-op for them */
233 if (type_is_pname(&mons[food->corpsenm]))
236 /* the ordinary case */
237 result = singular(food, xname);
240 result = the(result);
244 /* Created by GAN 01/28/87
245 * Amended by AKP 09/22/87: if not hard, don't choke, just vomit.
246 * Amended by 3. 06/12/89: if not hard, sometimes choke anyway, to keep risk.
247 * 11/10/89: if hard, rarely vomit anyway, for slim chance.
249 * To a full belly all food is bad. (It.)
255 /* only happens if you were satiated */
256 if (u.uhs != SATIATED) {
257 if (!food || food->otyp != AMULET_OF_STRANGULATION)
259 } else if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL) {
260 adjalign(-1); /* gluttony is unchivalrous */
262 You_feel("like a glutton!");
264 You("
\91å
\90H
\8a¿
\82Ì
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
267 exercise(A_CON, FALSE);
269 if (Breathless || (!Strangled && !rn2(20))) {
270 /* choking by eating AoS doesn't involve stuffing yourself */
271 if (food && food->otyp == AMULET_OF_STRANGULATION) {
273 You("choke, but recover your composure.");
275 You("
\8eñ
\82ð
\8di
\82ß
\82ç
\82ê
\82½
\81D
\82µ
\82©
\82µ
\82È
\82ñ
\82Æ
\82à
\82È
\82©
\82Á
\82½
\81D");
279 You("stuff yourself and then vomit voluminously.");
281 pline("
\82ª
\82Â
\82ª
\82Â
\82Æ
\8cû
\82É
\8bl
\82ß
\8d\9e\82ñ
\82¾
\82ª
\81C
\83h
\83o
\82Á
\82Æ
\93f
\82«
\8fo
\82µ
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
282 morehungry(1000); /* you just got *very* sick! */
285 killer.format = KILLED_BY_AN;
287 * Note all "killer"s below read "Choked on %s" on the
288 * high score list & tombstone. So plan accordingly.
292 You("choke over your %s.", foodword(food));
294 You("%s
\82ð
\8dA
\82É
\8bl
\82Ü
\82ç
\82¹
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D", foodword(food));
295 if (food->oclass == COIN_CLASS) {
297 Strcpy(killer.name, "very rich meal");
299 Strcpy(killer.name, "
\82Æ
\82Ä
\82à
\8d\82\89¿
\82È
\97¿
\97\9d");
301 killer.format = KILLED_BY;
302 Strcpy(killer.name, killer_xname(food));
306 You("choke over it.");
308 pline("
\8dA
\82É
\8bl
\82Ü
\82ç
\82¹
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
310 Strcpy(killer.name, "quick snack");
312 Strcpy(killer.name, "
\91\81\90H
\82¢");
317 pline("
\82 \82È
\82½
\82Í
\8e\80\82É
\82Ü
\82µ
\82½
\81D
\81D
\81D");
322 /* modify object wt. depending on time spent consuming it */
326 struct obj *piece = context.victual.piece;
328 impossible("recalc_wt without piece");
331 debugpline1("Old weight = %d", piece->owt);
332 debugpline2("Used time = %d, Req'd time = %d", context.victual.usedtime,
333 context.victual.reqtime);
334 piece->owt = weight(piece);
335 debugpline1("New weight = %d", piece->owt);
338 /* called when eating interrupted by an event */
342 /* we only set a flag here - the actual reset process is done after
343 * the round is spent eating.
345 if (context.victual.eating && !context.victual.doreset) {
346 debugpline0("reset_eat...");
347 context.victual.doreset = TRUE;
352 STATIC_OVL struct obj *
356 if (otmp->quan > 1L) {
358 (void) splitobj(otmp, otmp->quan - 1L);
360 otmp = splitobj(otmp, 1L);
361 debugpline0("split object,");
365 costly_alteration(otmp, COST_BITE);
367 (otmp->otyp == CORPSE ? mons[otmp->corpsenm].cnutrit
368 : objects[otmp->otyp].oc_nutrition);
373 if (inv_cnt(FALSE) >= 52) {
374 sellobj_state(SELL_DONTSELL);
376 sellobj_state(SELL_NORMAL);
378 otmp->nomerge = 1; /* used to prevent merge */
386 /* When food decays, in the middle of your meal, we don't want to dereference
387 * any dangling pointers, so set it to null (which should still trigger
388 * do_reset_eat() at the beginning of eatfood()) and check for null pointers
395 if (obj == context.victual.piece) {
396 context.victual.piece = (struct obj *) 0;
397 context.victual.o_id = 0;
400 obj_stop_timers(obj);
403 /* renaming an object used to result in it having a different address,
404 so the sequence start eating/opening, get interrupted, name the food,
405 resume eating/opening would restart from scratch */
407 food_substitution(old_obj, new_obj)
408 struct obj *old_obj, *new_obj;
410 if (old_obj == context.victual.piece) {
411 context.victual.piece = new_obj;
412 context.victual.o_id = new_obj->o_id;
414 if (old_obj == context.tin.tin) {
415 context.tin.tin = new_obj;
416 context.tin.o_id = new_obj->o_id;
423 debugpline0("do_reset_eat...");
424 if (context.victual.piece) {
425 context.victual.o_id = 0;
426 context.victual.piece = touchfood(context.victual.piece);
427 if (context.victual.piece)
428 context.victual.o_id = context.victual.piece->o_id;
431 context.victual.fullwarn = context.victual.eating =
432 context.victual.doreset = FALSE;
433 /* Do not set canchoke to FALSE; if we continue eating the same object
434 * we need to know if canchoke was set when they started eating it the
435 * previous time. And if we don't continue eating the same object
436 * canchoke always gets recalculated anyway.
442 /* called each move during eating process */
446 if (!context.victual.piece
447 || (!carried(context.victual.piece)
448 && !obj_here(context.victual.piece, u.ux, u.uy))) {
449 /* maybe it was stolen? */
453 if (!context.victual.eating)
456 if (++context.victual.usedtime <= context.victual.reqtime) {
459 return 1; /* still busy */
470 context.victual.piece->in_use = TRUE;
471 occupation = 0; /* do this early, so newuhs() knows we're done */
479 You("finish eating %s.", food_xname(context.victual.piece, TRUE));
481 You("%s
\82ð
\90H
\82×
\8fI
\82¦
\82½
\81D", food_xname(context.victual.piece, TRUE));
483 if (context.victual.piece->otyp == CORPSE)
484 cpostfx(context.victual.piece->corpsenm);
486 fpostfx(context.victual.piece);
488 if (carried(context.victual.piece))
489 useup(context.victual.piece);
491 useupf(context.victual.piece, 1L);
492 context.victual.piece = (struct obj *) 0;
493 context.victual.o_id = 0;
494 context.victual.fullwarn = context.victual.eating =
495 context.victual.doreset = FALSE;
504 u.uconduct.unvegan++;
506 violated_vegetarian();
509 /* handle side-effects of mind flayer's tentacle attack */
511 eat_brains(magr, mdef, visflag, dmg_p)
512 struct monst *magr, *mdef;
514 int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
516 struct permonst *pd = mdef->data;
517 boolean give_nutrit = FALSE;
518 int result = MM_HIT, xtra_dmg = rnd(10);
520 if (noncorporeal(pd)) {
522 pline("%s brain is unharmed.",
523 (mdef == &youmonst) ? "Your" : s_suffix(Monnam(mdef)));
524 return MM_MISS; /* side-effects can't occur */
525 } else if (magr == &youmonst) {
526 You("eat %s brain!", s_suffix(mon_nam(mdef)));
527 } else if (mdef == &youmonst) {
528 Your("brain is eaten!");
529 } else { /* monster against monster */
531 pline("%s brain is eaten!", s_suffix(Monnam(mdef)));
534 if (flesh_petrifies(pd)) {
535 /* mind flayer has attempted to eat the brains of a petrification
536 inducing critter (most likely Medusa; attacking a cockatrice via
537 tentacle-touch should have been caught before reaching this far) */
538 if (magr == &youmonst) {
539 if (!Stone_resistance && !Stoned)
540 make_stoned(5L, (char *) 0, KILLED_BY_AN, pd->mname);
542 /* no need to check for poly_when_stoned or Stone_resistance;
543 mind flayers don't have those capabilities */
545 pline("%s turns to stone!", Monnam(magr));
548 /* life-saved; don't continue eating the brains */
551 if (magr->mtame && !visflag)
552 /* parallels mhitm.c's brief_feeling */
553 You("have a sad thought for a moment, then is passes.");
559 if (magr == &youmonst) {
561 * player mind flayer is eating something's brain
564 if (mindless(pd)) { /* (cannibalism not possible here) */
565 pline("%s doesn't notice.", Monnam(mdef));
566 /* all done; no extra harm inflicted upon target */
568 } else if (is_rider(pd)) {
569 pline("Ingesting that is fatal.");
570 Sprintf(killer.name, "unwisely ate the brain of %s", pd->mname);
571 killer.format = NO_KILLER_PREFIX;
573 /* life-saving needed to reach here */
574 exercise(A_WIS, FALSE);
575 *dmg_p += xtra_dmg; /* Rider takes extra damage */
577 morehungry(-rnd(30)); /* cannot choke */
578 if (ABASE(A_INT) < AMAX(A_INT)) {
579 /* recover lost Int; won't increase current max */
580 ABASE(A_INT) += rnd(4);
581 if (ABASE(A_INT) > AMAX(A_INT))
582 ABASE(A_INT) = AMAX(A_INT);
585 exercise(A_WIS, TRUE);
588 /* targetting another mind flayer or your own underlying species
590 (void) maybe_cannibal(monsndx(pd), TRUE);
592 } else if (mdef == &youmonst) {
594 * monster mind flayer is eating hero's brain
596 /* no such thing as mindless players */
597 if (ABASE(A_INT) <= ATTRMIN(A_INT)) {
598 static NEARDATA const char brainlessness[] = "brainlessness";
601 Strcpy(killer.name, brainlessness);
602 killer.format = KILLED_BY;
604 /* amulet of life saving has now been used up */
605 pline("Unfortunately your brain is still gone.");
606 /* sanity check against adding other forms of life-saving */
607 u.uprops[LIFESAVED].extrinsic =
608 u.uprops[LIFESAVED].intrinsic = 0L;
610 Your("last thought fades away.");
612 Strcpy(killer.name, brainlessness);
613 killer.format = KILLED_BY;
615 /* can only get here when in wizard or explore mode and user has
616 explicitly chosen not to die; arbitrarily boost intelligence */
617 ABASE(A_INT) = ATTRMIN(A_INT) + 2;
618 You_feel("like a scarecrow.");
620 give_nutrit = TRUE; /* in case a conflicted pet is doing this */
621 exercise(A_WIS, FALSE);
622 /* caller handles Int and memory loss */
626 * monster mind flayer is eating another monster's brain
630 pline("%s doesn't notice.", Monnam(mdef));
632 } else if (is_rider(pd)) {
635 result = MM_AGR_DIED;
636 /* Rider takes extra damage regardless of whether attacker dies */
641 if (*dmg_p >= mdef->mhp && visflag)
642 pline("%s last thought fades away...",
643 s_suffix(Monnam(mdef)));
647 if (give_nutrit && magr->mtame && !magr->isminion) {
648 EDOG(magr)->hungrytime += rnd(60);
655 /* eating a corpse or egg of one's own species is usually naughty */
657 maybe_cannibal(pm, allowmsg)
661 static NEARDATA long ate_brains = 0L;
662 struct permonst *fptr = &mons[pm]; /* food type */
664 /* when poly'd into a mind flayer, multiple tentacle hits in one
665 turn cause multiple digestion checks to occur; avoid giving
666 multiple luck penalties for the same attack */
667 if (moves == ate_brains)
669 ate_brains = moves; /* ate_anything, not just brains... */
671 if (!CANNIBAL_ALLOWED()
672 /* non-cannibalistic heroes shouldn't eat own species ever
673 and also shouldn't eat current species when polymorphed
674 (even if having the form of something which doesn't care
675 about cannibalism--hero's innate traits aren't altered) */
676 && (your_race(fptr) || (Upolyd && same_race(youmonst.data, fptr)))) {
678 if (Upolyd && your_race(fptr))
680 You("have a bad feeling deep inside.");
682 You("
\8c\99\88«
\8a´
\82É
\82¨
\82»
\82í
\82ê
\82½
\81D");
684 You("cannibal! You will regret this!");
686 pline("
\8b¤
\8bò
\82¢
\82¾
\81I
\8cã
\89÷
\82·
\82é
\82¼
\81I");
688 HAggravate_monster |= FROMOUTSIDE;
689 change_luck(-rn1(4, 2)); /* -5..-2 */
699 (void) maybe_cannibal(pm, TRUE);
700 if (flesh_petrifies(&mons[pm])) {
701 if (!Stone_resistance
702 && !(poly_when_stoned(youmonst.data)
703 && polymon(PM_STONE_GOLEM))) {
705 Sprintf(killer.name, "tasting %s meat", mons[pm].mname);
707 Sprintf(killer.name, "%s
\82Ì
\93÷
\82ð
\90H
\82×", mons[pm].mname);
708 killer.format = KILLED_BY;
710 You("turn to stone.");
712 You("
\90Î
\82É
\82È
\82Á
\82½
\81D");
714 if (context.victual.piece)
715 context.victual.eating = FALSE;
716 return; /* lifesaved */
727 /* cannibals are allowed to eat domestic animals without penalty */
728 if (!CANNIBAL_ALLOWED()) {
730 You_feel("that eating the %s was a bad idea.", mons[pm].mname);
732 pline("%s
\82ð
\90H
\82×
\82é
\82Ì
\82Í
\82æ
\82
\82È
\82¢
\8bC
\82ª
\82µ
\82½
\81D", mons[pm].mname);
733 HAggravate_monster |= FROMOUTSIDE;
744 pline("Eating that is instantly fatal.");
746 pline("
\90H
\82×
\82½
\82ç
\82·
\82®
\82É
\8e\80\82ñ
\82Å
\82µ
\82Ü
\82Á
\82½
\81D");
748 Sprintf(killer.name, "unwisely ate the body of %s", mons[pm].mname);
749 killer.format = NO_KILLER_PREFIX;
751 Sprintf(killer.name, "
\8bð
\82©
\82É
\82à%s
\82Ì
\91Ì
\82ð
\90H
\82×
\82Ä", mons[pm].mname);
752 killer.format = KILLED_BY;
755 /* life-saving needed to reach here */
756 exercise(A_WIS, FALSE);
757 /* It so happens that since we know these monsters */
758 /* cannot appear in tins, context.victual.piece will always */
759 /* be what we want, which is not generally true. */
760 if (revive_corpse(context.victual.piece)) {
761 context.victual.piece = (struct obj *) 0;
762 context.victual.o_id = 0;
767 if (!Slimed && !Unchanging && !slimeproof(youmonst.data)) {
769 You("don't feel very well.");
771 You("
\82·
\82²
\82
\8bC
\95ª
\82ª
\88«
\82¢
\81D");
772 make_slimed(10L, (char *) 0);
773 delayed_killer(SLIMED, KILLED_BY_AN, "");
777 if (acidic(&mons[pm]) && Stoned)
790 Sprintf(buf, "What a pity--you just ruined a future piece of %sart!",
791 ACURR(A_CHA) > 15 ? "fine " : "");
793 Sprintf(buf, "
\82È
\82ñ
\82Ä
\82±
\82Æ
\82¾
\81I%s
\8c|
\8fp
\8dì
\95i
\82É
\82È
\82ê
\82½
\82©
\82à
\82µ
\82ê
\82È
\82¢
\82Ì
\82É
\81I",
794 ACURR(A_CHA) > 15 ? "
\8bM
\8fd
\82È" : "");
798 Strcpy(buf, "You feel limber!");
800 Strcpy(buf, "
\91Ì
\82ª
\93î
\82ç
\82©
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
801 make_stoned(0L, buf, 0, (char *) 0);
805 * If you add an intrinsic that can be gotten by eating a monster, add it
806 * to intrinsic_possible() and givit(). (It must already be in prop.h to
807 * be an intrinsic property.)
808 * It would be very easy to make the intrinsics not try to give you one
809 * that you already had by checking to see if you have it in
810 * intrinsic_possible() instead of givit(), but we're not that nice.
813 /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
815 intrinsic_possible(type, ptr)
817 register struct permonst *ptr;
822 #define ifdebugresist(Msg) \
828 #define ifdebugresist(Msg) /*empty*/
832 res = (ptr->mconveys & MR_FIRE) != 0;
833 ifdebugresist("can get fire resistance");
836 res = (ptr->mconveys & MR_SLEEP) != 0;
837 ifdebugresist("can get sleep resistance");
840 res = (ptr->mconveys & MR_COLD) != 0;
841 ifdebugresist("can get cold resistance");
844 res = (ptr->mconveys & MR_DISINT) != 0;
845 ifdebugresist("can get disintegration resistance");
847 case SHOCK_RES: /* shock (electricity) resistance */
848 res = (ptr->mconveys & MR_ELEC) != 0;
849 ifdebugresist("can get shock resistance");
852 res = (ptr->mconveys & MR_POISON) != 0;
853 ifdebugresist("can get poison resistance");
856 res = can_teleport(ptr);
857 ifdebugresist("can get teleport");
859 case TELEPORT_CONTROL:
860 res = control_teleport(ptr);
861 ifdebugresist("can get teleport control");
864 res = telepathic(ptr);
865 ifdebugresist("can get telepathy");
875 /* givit() tries to give you an intrinsic based on the monster's level
876 * and what type of intrinsic it is trying to give you.
881 register struct permonst *ptr;
885 debugpline1("Attempting to give intrinsic %d", type);
886 /* some intrinsics are easier to get than others */
889 if ((ptr == &mons[PM_KILLER_BEE] || ptr == &mons[PM_SCORPION])
898 case TELEPORT_CONTROL:
909 if (ptr->mlevel <= rn2(chance))
910 return; /* failed die roll */
914 debugpline0("Trying to give fire resistance");
915 if (!(HFire_resistance & FROMOUTSIDE)) {
917 You(Hallucination ? "be chillin'." : "feel a momentary chill.");
919 You(Hallucination ? "
\81u
\83N
\81[
\83\8b\91î
\94z
\95Ö
\81v
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82¾
\81D" : "
\88ê
\8fu
\8a¦
\82¯
\82ª
\82µ
\82½
\81D");
920 HFire_resistance |= FROMOUTSIDE;
924 debugpline0("Trying to give sleep resistance");
925 if (!(HSleep_resistance & FROMOUTSIDE)) {
927 You_feel("wide awake.");
929 You("
\82Ï
\82Á
\82¿
\82è
\96Ú
\82ª
\82³
\82ß
\82½
\81D");
930 HSleep_resistance |= FROMOUTSIDE;
934 debugpline0("Trying to give cold resistance");
935 if (!(HCold_resistance & FROMOUTSIDE)) {
937 You_feel("full of hot air.");
939 You("
\94M
\95\97\82ð
\91S
\90g
\82É
\8a´
\82¶
\82½
\81D");
940 HCold_resistance |= FROMOUTSIDE;
944 debugpline0("Trying to give disintegration resistance");
945 if (!(HDisint_resistance & FROMOUTSIDE)) {
947 You_feel(Hallucination ? "totally together, man." : "very firm.");
949 You_feel(Hallucination ? "
\90¢
\8aE
\90l
\97Þ
\82Æ
\8cZ
\92í
\82É
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D" : "
\82Æ
\82Ä
\82à
\8aæ
\8fä
\82É
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
950 HDisint_resistance |= FROMOUTSIDE;
953 case SHOCK_RES: /* shock (electricity) resistance */
954 debugpline0("Trying to give shock resistance");
955 if (!(HShock_resistance & FROMOUTSIDE)) {
958 You_feel("grounded in reality.");
960 You("
\8eÀ
\82Í
\83A
\81[
\83X
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
963 Your("health currently feels amplified!");
965 pline("
\8c\92\8dN
\82ª
\91\9d\95\9d\82³
\82ê
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
966 HShock_resistance |= FROMOUTSIDE;
970 debugpline0("Trying to give poison resistance");
971 if (!(HPoison_resistance & FROMOUTSIDE)) {
973 You_feel(Poison_resistance ? "especially healthy." : "healthy.");
975 You_feel(Poison_resistance ? "
\93Á
\82É
\8c\92\8dN
\82É
\82È
\82Á
\82½
\8bC
\82ª
\82µ
\82½
\81D" : "
\8c\92\8dN
\82É
\82È
\82Á
\82½
\8bC
\82ª
\82µ
\82½
\81D");
976 HPoison_resistance |= FROMOUTSIDE;
980 debugpline0("Trying to give teleport");
981 if (!(HTeleportation & FROMOUTSIDE)) {
983 You_feel(Hallucination ? "diffuse." : "very jumpy.");
985 pline(Hallucination ? "
\91Ì
\82ª
\94ò
\82Ñ
\8eU
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D" : "
\92µ
\96ô
\97Í
\82ª
\8d\82\82Ü
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
986 HTeleportation |= FROMOUTSIDE;
989 case TELEPORT_CONTROL:
990 debugpline0("Trying to give teleport control");
991 if (!(HTeleport_control & FROMOUTSIDE)) {
993 You_feel(Hallucination ? "centered in your personal space."
994 : "in control of yourself.");
996 You_feel(Hallucination ? "
\8e©
\8cÈ
\92\86\90S
\93I
\82É
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D"
997 : "
\8e©
\95ª
\8e©
\90g
\82ð
\90§
\8cä
\82Å
\82«
\82é
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
999 HTeleport_control |= FROMOUTSIDE;
1003 debugpline0("Trying to give telepathy");
1004 if (!(HTelepat & FROMOUTSIDE)) {
1006 You_feel(Hallucination ? "in touch with the cosmos."
1007 : "a strange mental acuity.");
1009 You_feel(Hallucination ? "
\89F
\92\88\82Ì
\90_
\94é
\82É
\90G
\82ê
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D"
1010 : "
\8aï
\96
\82È
\90¸
\90_
\93I
\89s
\82³
\82ð
\8a´
\82¶
\82½
\81D");
1012 HTelepat |= FROMOUTSIDE;
1013 /* If blind, make sure monsters show up. */
1019 debugpline0("Tried to give an impossible intrinsic");
1024 /* called after completely consuming a corpse */
1029 register int tmp = 0;
1030 boolean catch_lycanthropy = FALSE;
1032 /* in case `afternmv' didn't get called for previously mimicking
1033 gold, clean up now to avoid `eatmbuf' memory leak */
1039 /* MRKR: "eye of newt" may give small magical energy boost */
1040 if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
1041 int old_uen = u.uen;
1043 if (u.uen > u.uenmax) {
1048 if (old_uen != u.uen) {
1050 You_feel("a mild buzz.");
1052 You("
\82·
\82±
\82µ
\82Ó
\82ç
\82Ó
\82ç
\82µ
\82½
\81D");
1060 case PM_HUMAN_WERERAT:
1061 catch_lycanthropy = TRUE;
1062 u.ulycn = PM_WERERAT;
1064 case PM_HUMAN_WEREJACKAL:
1065 catch_lycanthropy = TRUE;
1066 u.ulycn = PM_WEREJACKAL;
1068 case PM_HUMAN_WEREWOLF:
1069 catch_lycanthropy = TRUE;
1070 u.ulycn = PM_WEREWOLF;
1081 set_itimeout(&HInvis, (long) rn1(100, 50));
1082 if (!Blind && !BInvis)
1083 self_invis_message();
1085 if (!(HInvis & INTRINSIC))
1087 You_feel("hidden!");
1089 Your("
\8ep
\82Í
\89B
\82³
\82ê
\82½
\81I");
1090 HInvis |= FROMOUTSIDE;
1091 HSee_invisible |= FROMOUTSIDE;
1095 case PM_YELLOW_LIGHT:
1097 make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1100 make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1102 case PM_GIANT_MIMIC:
1105 case PM_LARGE_MIMIC:
1108 case PM_SMALL_MIMIC:
1110 if (youmonst.data->mlet != S_MIMIC && !Unchanging) {
1113 u.uconduct.polyselfs++; /* you're changing form */
1115 You_cant("resist the temptation to mimic %s.",
1116 Hallucination ? "an orange" : "a pile of gold");
1118 You("%s
\82ð
\90^
\8e\97\82µ
\82½
\82¢
\97U
\98f
\82É
\82©
\82ç
\82ê
\82½
\81D",
1119 Hallucination ? "
\83I
\83\8c\83\93\83W" : "
\8bà
\89Ý
\82Ì
\8eR");
1121 /* A pile of gold can't ride. */
1123 dismount_steed(DISMOUNT_FELL);
1125 multi_reason = "pretending to be a pile of gold";
1129 ? "You suddenly dread being peeled and mimic %s again!"
1131 ? "
\93Ë
\91R
\8aÛ
\97\87\82É
\82³
\82ê
\82é
\82Ì
\82ª
\8b°
\82ë
\82µ
\82
\82È
\82Á
\82Ä
\82Ü
\82½%s
\82Ì
\90^
\8e\97\82ð
\82µ
\82½
\81I"
1133 : "You now prefer mimicking %s again.",
1135 : "
\82±
\82ñ
\82Ç
\82Í
\82Ü
\82½%s
\82Ì
\90^
\8e\97\82ª
\82µ
\82½
\82
\82È
\82Á
\82½
\81D",
1136 an(Upolyd ? youmonst.data->mname : urace.noun));
1137 eatmbuf = dupstr(buf);
1138 nomovemsg = eatmbuf;
1139 afternmv = eatmdone;
1140 /* ??? what if this was set before? */
1141 youmonst.m_ap_type = M_AP_OBJECT;
1142 youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE;
1145 /* make gold symbol show up now */
1146 display_nhwindow(WIN_MAP, TRUE);
1149 case PM_QUANTUM_MECHANIC:
1151 Your("velocity suddenly seems very uncertain!");
1153 Your("
\91¬
\93x
\82ª
\93Ë
\91R
\81C
\95s
\8am
\92è
\82É
\82È
\82Á
\82½
\81I");
1154 if (HFast & INTRINSIC) {
1155 HFast &= ~INTRINSIC;
1157 You("seem slower.");
1159 You("
\92x
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D");
1161 HFast |= FROMOUTSIDE;
1163 You("seem faster.");
1165 You("
\91¬
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D");
1169 if ((HStun & TIMEOUT) > 2)
1170 make_stunned(2L, FALSE);
1171 if ((HConfusion & TIMEOUT) > 2)
1172 make_confused(2L, FALSE);
1175 case PM_DOPPELGANGER:
1176 case PM_SANDESTIN: /* moot--they don't leave corpses */
1178 You_feel("momentarily different."); /* same as poly trap */
1181 You_feel("a change coming over you.");
1183 pline("
\95Ï
\89»
\82ª
\96K
\82ê
\82½
\81D");
1187 case PM_DISENCHANTER:
1188 /* picks an intrinsic at random and removes it; there's
1189 no feedback if hero already lacks the chosen ability */
1190 debugpline0("using attrcurse to strip an intrinsic");
1193 case PM_MIND_FLAYER:
1194 case PM_MASTER_MIND_FLAYER:
1195 if (ABASE(A_INT) < ATTRMAX(A_INT)) {
1198 pline("Yum! That was real brain food!");
1200 pline("
\82¤
\82Ü
\82¢
\81I
\82±
\82ê
\82±
\82»
\96{
\93\96\82Ì
\81u
\93ª
\82Ì
\97Ç
\82
\82È
\82é
\90H
\8e\96\81v
\82¾
\81I");
1201 (void) adjattrib(A_INT, 1, FALSE);
1202 break; /* don't give them telepathy, too */
1206 pline("For some reason, that tasted bland.");
1208 pline("
\82Ç
\82¤
\82µ
\82½
\82í
\82¯
\82©
\81C
\92W
\94\92\82È
\96¡
\82¾
\81D");
1212 struct permonst *ptr = &mons[pm];
1213 boolean conveys_STR = is_giant(ptr);
1216 if (dmgtype(ptr, AD_STUN) || dmgtype(ptr, AD_HALU)
1217 || pm == PM_VIOLET_FUNGUS) {
1219 pline("Oh wow! Great stuff!");
1221 pline("
\83\8f\81[
\83H
\81I
\82±
\82è
\82á
\82·
\82²
\82¢
\81I");
1222 (void) make_hallucinated((HHallucination & TIMEOUT) + 200L, FALSE,
1226 /* Check the monster for all of the intrinsics. If this
1227 * monster can give more than one, pick one to try to give
1228 * from among all it can give.
1230 * Strength from giants is now treated like an intrinsic
1231 * rather than being given unconditionally.
1233 count = 0; /* number of possible intrinsics */
1234 tmp = 0; /* which one we will try to give */
1237 tmp = -1; /* use -1 as fake prop index for STR */
1238 debugpline1("\"Intrinsic\" strength, %d", tmp);
1240 for (i = 1; i <= LAST_PROP; i++) {
1241 if (!intrinsic_possible(i, ptr))
1244 /* a 1 in count chance of replacing the old choice
1245 with this one, and a count-1 in count chance
1246 of keeping the old choice (note that 1 in 1 and
1247 0 in 1 are what we want for the first candidate) */
1249 debugpline2("Intrinsic %d replacing %d", i, tmp);
1253 /* if strength is the only candidate, give it 50% chance */
1254 if (conveys_STR && count == 1 && !rn2(2))
1256 /* if something was chosen, give it now (givit() might fail) */
1258 gainstr((struct obj *) 0, 0, TRUE);
1264 if (catch_lycanthropy)
1265 retouch_equipment(2);
1271 violated_vegetarian()
1273 u.uconduct.unvegetarian++;
1274 if (Role_if(PM_MONK)) {
1276 You_feel("guilty.");
1278 pline("
\8dß
\82ð
\8a´
\82¶
\82½
\81D");
1284 /* common code to check and possibly charge for 1 context.tin.tin,
1285 * will split() context.tin.tin if necessary */
1287 costly_tin(alter_type)
1288 int alter_type; /* COST_xxx */
1290 struct obj *tin = context.tin.tin;
1292 if (carried(tin) ? tin->unpaid
1293 : (costly_spot(tin->ox, tin->oy) && !tin->no_charge)) {
1294 if (tin->quan > 1L) {
1295 tin = context.tin.tin = splitobj(tin, 1L);
1296 context.tin.o_id = tin->o_id;
1298 costly_alteration(tin, alter_type);
1303 tin_variety_txt(s, tinvariety)
1309 if (s && tinvariety) {
1311 for (k = 0; k < TTSZ - 1; ++k) {
1312 l = (int) strlen(tintxts[k].txt);
1313 if (!strncmpi(s, tintxts[k].txt, l) && ((int) strlen(s) > l)
1324 * This assumes that buf already contains the word "tin",
1325 * as is the case with caller xname().
1327 /*JP:
\81u
\8aÊ
\8bl
\81v
\82Í
\8cã
\82Å
\95t
\82¯
\82é */
1329 tin_details(obj, mnum, buf)
1335 int r = tin_variety(obj, TRUE);
1338 if (r == SPINACH_TIN)
1340 Strcat(buf, " of spinach");
1342 Strcat(buf, "
\83z
\83E
\83\8c\83\93\91\90\82Ì");
1343 else if (mnum == NON_PM)
1345 Strcpy(buf, "empty tin");
1347 Strcat(buf, "
\8bó
\82Á
\82Û
\82Ì");
1349 if ((obj->cknown || iflags.override_ID) && obj->spe < 0) {
1350 if (r == ROTTEN_TIN || r == HOMEMADE_TIN) {
1351 /* put these before the word tin */
1352 Sprintf(buf2, "%s %s of ", tintxts[r].txt, buf);
1355 Sprintf(eos(buf), " of %s ", tintxts[r].txt);
1358 Strcpy(eos(buf), " of ");
1360 if (vegetarian(&mons[mnum]))
1362 Sprintf(eos(buf), "%s", mons[mnum].mname);
1364 Sprintf(eos(buf), "%s
\82Ì", mons[mnum].mname);
1367 Sprintf(eos(buf), "%s meat", mons[mnum].mname);
1369 Sprintf(eos(buf), "%s
\82Ì
\93÷
\82Ì", mons[mnum].mname);
1375 set_tin_variety(obj, forcetype)
1381 if (forcetype == SPINACH_TIN
1382 || (forcetype == HEALTHY_TIN
1383 && (obj->corpsenm == NON_PM /* empty or already spinach */
1384 || !vegetarian(&mons[obj->corpsenm])))) { /* replace meat */
1385 obj->corpsenm = NON_PM; /* not based on any monster */
1386 obj->spe = 1; /* spinach */
1388 } else if (forcetype == HEALTHY_TIN) {
1389 r = tin_variety(obj, FALSE);
1390 if (r < 0 || r >= TTSZ)
1391 r = ROTTEN_TIN; /* shouldn't happen */
1392 while ((r == ROTTEN_TIN && !obj->cursed) || !tintxts[r].fodder)
1394 } else if (forcetype >= 0 && forcetype < TTSZ - 1) {
1396 } else { /* RANDOM_TIN */
1397 r = rn2(TTSZ - 1); /* take your pick */
1398 if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1399 r = HOMEMADE_TIN; /* lizards don't rot */
1401 obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
1405 tin_variety(obj, disp)
1407 boolean disp; /* we're just displaying so leave things alone */
1411 if (obj->spe == 1) {
1413 } else if (obj->cursed) {
1414 r = ROTTEN_TIN; /* always rotten if cursed */
1415 } else if (obj->spe < 0) {
1417 --r; /* get rid of the offset */
1421 if (!disp && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
1422 r = ROTTEN_TIN; /* some homemade tins go bad */
1424 if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1425 r = HOMEMADE_TIN; /* lizards don't rot */
1435 struct obj *tin = context.tin.tin;
1437 r = tin_variety(tin, FALSE);
1438 if (tin->otrapped || (tin->cursed && r != HOMEMADE_TIN && !rn2(8))) {
1439 b_trapped("tin", 0);
1440 costly_tin(COST_DSTROY);
1444 pline1(mesg); /* "You succeed in opening the tin." */
1446 if (r != SPINACH_TIN) {
1447 mnum = tin->corpsenm;
1448 if (mnum == NON_PM) {
1450 pline("It turns out to be empty.");
1452 pline("
\8aÊ
\82Í
\8bó
\82Á
\82Û
\82¾
\82Á
\82½
\81D");
1453 tin->dknown = tin->known = 1;
1454 costly_tin(COST_OPEN);
1458 which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */
1459 if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
1460 && (Stone_resistance || Hallucination)) {
1462 which = 1; /* suppress pluralization */
1463 } else if (Hallucination) {
1464 what = rndmonnam(NULL);
1466 what = mons[mnum].mname;
1467 if (the_unique_pm(&mons[mnum]))
1469 else if (type_is_pname(&mons[mnum]))
1473 what = makeplural(what);
1474 else if (which == 2)
1478 pline("It smells like %s.", what);
1480 pline("%s
\82Ì
\82æ
\82¤
\82È
\93õ
\82¢
\82ª
\82µ
\82½
\81D", what);
1482 if (yn("Eat it?") == 'n') {
1484 if (yn("
\90H
\82×
\82Ü
\82·
\82©
\81H") == 'n') {
1487 You("discard the open tin.");
1489 You("
\8aJ
\82¯
\82½
\8aÊ
\82ð
\8eÌ
\82Ä
\82½
\81D");
1491 tin->dknown = tin->known = 1;
1492 costly_tin(COST_OPEN);
1496 /* in case stop_occupation() was called on previous meal */
1497 context.victual.piece = (struct obj *) 0;
1498 context.victual.o_id = 0;
1499 context.victual.fullwarn = context.victual.eating =
1500 context.victual.doreset = FALSE;
1503 You("consume %s %s.", tintxts[r].txt, mons[mnum].mname);
1504 #else /*JP:
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u */
1505 if (strstr(tintxts[r].txt, "
\82Ì") == tintxts[r].txt) {
1506 You("%s%s
\82Ì
\8aÊ
\8bl
\82ð
\82½
\82¢
\82ç
\82°
\82½
\81D", mons[mnum].mname, tintxts[r].txt);
1508 You("%s%s
\82Ì
\8aÊ
\8bl
\82ð
\82½
\82¢
\82ç
\82°
\82½
\81D", tintxts[r].txt, mons[mnum].mname);
1512 eating_conducts(&mons[mnum]);
1514 tin->dknown = tin->known = 1;
1518 /* charge for one at pre-eating cost */
1519 costly_tin(COST_OPEN);
1521 if (tintxts[r].nut < 0) /* rotten */
1522 make_vomiting((long) rn1(15, 10), FALSE);
1524 lesshungry(tintxts[r].nut);
1526 if (tintxts[r].greasy) {
1527 /* Assume !Glib, because you can't open tins when Glib. */
1528 incr_itimeout(&Glib, rnd(15));
1530 pline("Eating %s food made your %s very slippery.",
1531 tintxts[r].txt, makeplural(body_part(FINGER)));
1533 pline("
\96û
\82Á
\82Û
\82¢
\95¨
\82ð
\90H
\82×
\82½
\82Ì
\82Å
\82 \82È
\82½
\82Ì%s
\82Í
\8a\8a\82è
\82â
\82·
\82
\82È
\82Á
\82½
\81D",
1538 } else { /* spinach... */
1541 pline("It contains some decaying%s%s substance.",
1542 Blind ? "" : " ", Blind ? "" : hcolor(NH_GREEN));
1544 pline("%s
\95\85\82Á
\82½
\95¨
\91Ì
\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\81D",
1545 Blind ? "" : hcolor(NH_GREEN));
1549 pline("It contains spinach.");
1551 pline("
\83z
\83E
\83\8c\83\93\91\90\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\81D");
1552 tin->dknown = tin->known = 1;
1556 if (yn("Eat it?") == 'n') {
1558 if (yn("
\90H
\82×
\82Ü
\82·
\82©
\81H") == 'n') {
1561 You("discard the open tin.");
1563 You("
\8aJ
\82¯
\82½
\8aÊ
\82ð
\8eÌ
\82Ä
\82½
\81D");
1564 costly_tin(COST_OPEN);
1569 * Same order as with non-spinach above:
1570 * conduct update, side-effects, shop handling, and nutrition.
1573 .food++; /* don't need vegan/vegetarian checks for spinach */
1576 pline("This makes you feel like %s!",
1577 Hallucination ? "Swee'pea" : "Popeye");
1579 pline("%s
\82Ì
\82æ
\82¤
\82È
\8bC
\95ª
\82É
\82È
\82Á
\82½
\81I",
1580 Hallucination ? "
\83X
\83C
\81[
\83s
\81[" : "
\83|
\83p
\83C");
1582 gainstr(tin, 0, FALSE);
1584 costly_tin(COST_OPEN);
1586 lesshungry(tin->blessed
1589 ? (400 + rnd(200)) /* uncursed */
1590 : (200 + rnd(400))); /* cursed */
1598 context.tin.tin = (struct obj *) 0;
1599 context.tin.o_id = 0;
1602 /* called during each move whilst opening a tin */
1606 /* perhaps it was stolen (although that should cause interruption) */
1607 if (!carried(context.tin.tin)
1608 && (!obj_here(context.tin.tin, u.ux, u.uy) || !can_reach_floor(TRUE)))
1609 return 0; /* %% probably we should use tinoid */
1610 if (context.tin.usedtime++ >= 50) {
1612 You("give up your attempt to open the tin.");
1614 You("
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82ð
\82 \82«
\82ç
\82ß
\82½
\81D");
1617 if (context.tin.usedtime < context.tin.reqtime)
1618 return 1; /* still busy */
1621 consume_tin("You succeed in opening the tin.");
1623 consume_tin("
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82É
\90¬
\8c÷
\82µ
\82½
\81D");
1627 /* called when starting to open a tin */
1632 const char *mesg = 0;
1635 if (metallivorous(youmonst.data)) {
1637 mesg = "You bite right into the metal tin...";
1639 mesg = "
\8bà
\91®
\82Ì
\8aÊ
\82ð
\8a\9a\82Ý
\82Í
\82¶
\82ß
\82½
\81D
\81D
\81D";
1641 } else if (cantwield(youmonst.data)) { /* nohands || verysmall */
1643 You("cannot handle the tin properly to open it.");
1645 You("
\8aÊ
\82ð
\82¤
\82Ü
\82
\8aJ
\82¯
\82ç
\82ê
\82È
\82¢
\81D");
1647 } else if (otmp->blessed) {
1648 /* 50/50 chance for immediate access vs 1 turn delay (unless
1649 wielding blessed tin opener which always yields immediate
1650 access); 1 turn delay case is non-deterministic: getting
1651 interrupted and retrying might yield another 1 turn delay
1652 or might open immediately on 2nd (or 3rd, 4th, ...) try */
1653 tmp = (uwep && uwep->blessed && uwep->otyp == TIN_OPENER) ? 0 : rn2(2);
1656 mesg = "The tin opens like magic!";
1658 mesg = "
\8aÊ
\82Í
\96\82\96@
\82Ì
\82æ
\82¤
\82É
\8aJ
\82¢
\82½
\81I";
1660 pline_The("tin seems easy to open.");
1662 switch (uwep->otyp) {
1664 mesg = "You easily open the tin."; /* iff tmp==0 */
1665 tmp = rn2(uwep->cursed ? 3 : !uwep->blessed ? 2 : 1);
1683 pline("Using %s you try to open the tin.", yobjnam(uwep, (char *) 0));
1685 You("%s
\82ð
\8eg
\82Á
\82Ä
\8aÊ
\82ð
\8aJ
\82¯
\82æ
\82¤
\82Æ
\82µ
\82½
\81D", xname(uwep));
1689 pline("It is not so easy to open this tin.");
1691 pline("
\82±
\82Ì
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82Í
\97e
\88Õ
\82È
\82±
\82Æ
\82Å
\82Í
\82È
\82¢
\81D");
1694 pline_The("tin slips from your %s.",
1696 pline("
\8aÊ
\82Í
\82 \82È
\82½
\82Ì%s
\82©
\82ç
\8a\8a\82è
\97\8e\82¿
\82½
\81D",
1697 makeplural(body_part(FINGER)));
1698 if (otmp->quan > 1L) {
1699 otmp = splitobj(otmp, 1L);
1707 tmp = rn1(1 + 500 / ((int) (ACURR(A_DEX) + ACURRSTR)), 10);
1710 context.tin.tin = otmp;
1711 context.tin.o_id = otmp->o_id;
1713 consume_tin(mesg); /* begin immediately */
1715 context.tin.reqtime = tmp;
1716 context.tin.usedtime = 0;
1718 set_occupation(opentin, "opening the tin", 0);
1720 set_occupation(opentin, "
\8aÊ
\82ð
\8aJ
\82¯
\82é", 0);
1725 /* called when waking up after fainting */
1727 Hear_again(VOID_ARGS)
1729 /* Chance of deafness going away while fainted/sleeping/etc. */
1731 make_deaf(0L, FALSE);
1735 /* called on the "first bite" of rotten food */
1741 pline("Blecch! Rotten %s!", foodword(obj));
1743 pline("
\83Q
\83F
\81I
\95\85\82Á
\82½%s
\82¾
\81I", foodword(obj));
1747 You_feel("rather trippy.");
1749 You("
\82Ö
\82ë
\82Ö
\82ë
\82µ
\82½
\81D");
1752 You_feel("rather %s.", body_part(LIGHT_HEADED));
1754 You("%s
\81D", body_part(LIGHT_HEADED));
1755 make_confused(HConfusion + d(2, 4), FALSE);
1756 } else if (!rn2(4) && !Blind) {
1758 pline("Everything suddenly goes dark.");
1760 pline("
\93Ë
\91R
\91S
\82Ä
\82ª
\88Ã
\82
\82È
\82Á
\82½
\81D");
1761 make_blinded((long) d(2, 10), FALSE);
1763 Your1(vision_clears);
1764 } else if (!rn2(3)) {
1765 const char *what, *where;
1766 int duration = rnd(10);
1770 what = "goes", where = "dark";
1772 what = "
\82È
\82Á
\82½", where = "
\88Ã
\88Å
\82É";
1773 else if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
1775 what = "you lose control of", where = "yourself";
1777 what = "
\90§
\8cä
\82Å
\82«
\82È
\82
\82È
\82Á
\82½", where = "
\8e©
\95ª
\82ð";
1780 what = "you slap against the",
1782 what = "
\82É
\82Ô
\82Â
\82©
\82Á
\82½",
1784 where = (u.usteed) ? "saddle" : surface(u.ux, u.uy);
1786 where = (u.usteed) ? "
\88Æ" : surface(u.ux, u.uy);
1788 pline_The("world spins and %s %s.", what, where);
1790 pline("
\90¢
\8aE
\82ª
\89ñ
\93]
\82µ
\81C%s%s
\81D", where, what);
1791 incr_itimeout(&HDeaf, duration);
1793 multi_reason = "unconscious from rotten food";
1795 nomovemsg = "You are conscious again.";
1797 nomovemsg = "
\82 \82È
\82½
\82Í
\82Ü
\82½
\90³
\8bC
\82Ã
\82¢
\82½
\81D";
1798 afternmv = Hear_again;
1804 /* called when a corpse is selected as food */
1809 int tp = 0, mnum = otmp->corpsenm;
1812 boolean stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
1813 && !poly_when_stoned(youmonst.data));
1816 if (!vegan(&mons[mnum]))
1817 u.uconduct.unvegan++;
1818 if (!vegetarian(&mons[mnum]))
1819 violated_vegetarian();
1821 if (!nonrotting_corpse(mnum)) {
1822 long age = peek_at_iced_corpse_age(otmp);
1824 rotted = (monstermoves - age) / (10L + rn2(20));
1827 else if (otmp->blessed)
1831 if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
1832 boolean cannibal = maybe_cannibal(mnum, FALSE);
1835 pline("Ulch - that %s was tainted%s!",
1836 mons[mnum].mlet == S_FUNGUS
1837 ? "fungoid vegetation"
1838 : !vegetarian(&mons[mnum]) ? "meat" : "protoplasm",
1839 cannibal ? ", you cannibal" : "");
1841 pline("
\83I
\83F
\81I
\82±
\82Ì%s
\82Í
\95\85\82Á
\82Ä
\82¢
\82é%s
\81I",
1842 mons[mnum].mlet == S_FUNGUS
1843 ? "
\8d×
\8bÛ
\82É
\89\98\90õ
\82³
\82ê
\82½
\90A
\95¨"
1844 : !vegetarian(&mons[mnum]) ? "
\93÷" : "
\90¶
\95¨",
1845 cannibal ? "
\81D
\82µ
\82©
\82à
\8b¤
\90H
\82¢
\82¾" : "");
1847 if (Sick_resistance) {
1849 pline("It doesn't seem at all sickening, though...");
1851 pline("
\82µ
\82©
\82µ
\81C
\82¢
\82½
\82Á
\82Ä
\8c³
\8bC
\82¾
\81D
\81D
\81D");
1855 sick_time = (long) rn1(10, 10);
1856 /* make sure new ill doesn't result in improvement */
1857 if (Sick && (sick_time > Sick))
1858 sick_time = (Sick > 1L) ? Sick - 1L : 1L;
1860 make_sick(sick_time, corpse_xname(otmp, "rotted", CXN_NORMAL),
1861 TRUE, SICK_VOMITABLE);
1863 make_sick(sick_time, corpse_xname(otmp, "
\95\85\82Á
\82½", CXN_NORMAL),
1864 TRUE, SICK_VOMITABLE);
1872 } else if (acidic(&mons[mnum]) && !Acid_resistance) {
1875 You("have a very bad case of stomach acid."); /* not body_part() */
1877 pline("
\88Ý
\8e_
\82Ì
\92²
\8eq
\82ª
\82Æ
\82Ä
\82à
\88«
\82¢
\81D");
1880 losehp(rnd(15), "acidic corpse", KILLED_BY_AN); /* acid damage */
1882 losehp(rnd(15), "
\8e_
\82Ì
\8e\80\91Ì
\82Å", KILLED_BY_AN);
1884 } else if (poisonous(&mons[mnum]) && rn2(5)) {
1887 pline("Ecch - that must have been poisonous!");
1889 pline("
\83E
\83Q
\83F
\81[
\81C
\97L
\93Å
\82¾
\82Á
\82½
\82É
\82¿
\82ª
\82¢
\82È
\82¢
\81I");
1890 if (!Poison_resistance) {
1893 losehp(rnd(15), "poisonous corpse", KILLED_BY_AN);
1895 losehp(rnd(15), "
\93Å
\82Ì
\8e\80\91Ì
\82Å", KILLED_BY_AN);
1898 You("seem unaffected by the poison.");
1900 You("
\93Å
\82Ì
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
1901 /* now any corpse left too long will make you mildly ill */
1902 } else if ((rotted > 5L || (rotted > 3L && rn2(5))) && !Sick_resistance) {
1905 You_feel("%ssick.", (Sick) ? "very " : "");
1907 You("%s
\8bC
\95ª
\82ª
\88«
\82¢
\81D", (Sick) ? "
\82Æ
\82Ä
\82à" : "");
1909 losehp(rnd(8), "cadaver", KILLED_BY_AN);
1911 losehp(rnd(8), "
\95\85\97\90\8e\80\91Ì
\82Å", KILLED_BY_AN);
1914 /* delay is weight dependent */
1915 context.victual.reqtime = 3 + (mons[mnum].cwt >> 6);
1917 if (!tp && !nonrotting_corpse(mnum) && (otmp->orotten || !rn2(7))) {
1918 if (rottenfood(otmp)) {
1919 otmp->orotten = TRUE;
1920 (void) touchfood(otmp);
1924 if (!mons[otmp->corpsenm].cnutrit) {
1925 /* no nutrition: rots away, no message if you passed out */
1928 pline_The("corpse rots away completely.");
1930 pline("
\8e\80\91Ì
\82Í
\8a®
\91S
\82É
\95\85\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
1939 consume_oeaten(otmp, 2); /* oeaten >>= 2 */
1940 } else if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
1941 && (Stone_resistance || Hallucination)) {
1942 pline("This tastes just like chicken!");
1943 } else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) {
1944 You("peck the eyeball with delight.");
1946 /* [is this right? omnivores end up always disliking the taste] */
1947 boolean yummy = vegan(&mons[mnum])
1948 ? (!carnivorous(youmonst.data)
1949 && herbivorous(youmonst.data))
1950 : (carnivorous(youmonst.data)
1951 && !herbivorous(youmonst.data));
1955 type_is_pname(&mons[mnum])
1956 ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
1957 food_xname(otmp, FALSE),
1959 ? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
1962 : (yummy ? "is delicious" : "tastes terrible"));
1964 pline("
\82±
\82Ì%s
\82Í%s
\81I",
1965 food_xname(otmp, FALSE),
1967 ? (yummy ? ((u.umonnum == PM_TIGER) ? "
\83O
\83D
\83\8c\83C
\83g
\83D"
1968 : "
\83C
\83P
\82Ä
\82é")
1969 : "
\83C
\83P
\82Ä
\82È
\82¢")
1970 : (yummy ? "
\82Æ
\82Ä
\82à
\8e|
\82¢" : "
\82Ð
\82Ç
\82¢
\96¡
\82¾"));
1977 /* called as you start to eat */
1982 const char *old_nomovemsg, *save_nomovemsg;
1984 debugpline2("start_eating: %lx (victual = %lx)", (unsigned long) otmp,
1985 (unsigned long) context.victual.piece);
1986 debugpline1("reqtime = %d", context.victual.reqtime);
1987 debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
1988 debugpline1("nmod = %d", context.victual.nmod);
1989 debugpline1("oeaten = %d", otmp->oeaten);
1990 context.victual.fullwarn = context.victual.doreset = FALSE;
1991 context.victual.eating = TRUE;
1993 if (otmp->otyp == CORPSE || otmp->globby) {
1994 cprefx(context.victual.piece->corpsenm);
1995 if (!context.victual.piece || !context.victual.eating) {
1996 /* rider revived, or died and lifesaved */
2001 old_nomovemsg = nomovemsg;
2003 /* survived choking, finish off food that's nearly done;
2004 need this to handle cockatrice eggs, fortune cookies, etc */
2005 if (++context.victual.usedtime >= context.victual.reqtime) {
2006 /* don't want done_eating() to issue nomovemsg if it
2007 is due to vomit() called by bite() */
2008 save_nomovemsg = nomovemsg;
2013 nomovemsg = save_nomovemsg;
2018 if (++context.victual.usedtime >= context.victual.reqtime) {
2019 /* print "finish eating" message if they just resumed -dlc */
2020 done_eating(context.victual.reqtime > 1 ? TRUE : FALSE);
2025 Sprintf(msgbuf, "eating %s", food_xname(otmp, TRUE));
2027 Sprintf(msgbuf, "%s
\82ð
\90H
\82×
\82é", food_xname(otmp, TRUE));
2028 set_occupation(eatfood, msgbuf, 0);
2032 * called on "first bite" of (non-corpse) food.
2033 * used for non-rotten non-tin non-corpse food
2039 switch (otmp->otyp) {
2041 if (u.uhunger <= 200)
2043 pline(Hallucination ? "Oh wow, like, superior, man!"
2045 pline(Hallucination ? "
\82Ü
\82Á
\82½
\82è
\82Æ
\82µ
\82Ä
\81C
\82»
\82ê
\82Å
\82¢
\82Ä
\82µ
\82Â
\82±
\82
\82È
\82¢
\81I
\82±
\82ê
\82¼
\8b\86\8bÉ
\82Ì
\83\81\83j
\83\85\81[
\82¾
\81I"
2047 : "That food really hit the spot!");
2049 : "That food really hit the spot!");
2050 else if (u.uhunger <= 700)
2052 pline("That satiated your %s!", body_part(STOMACH));
2054 pline("
\96\9e\95 \82É
\82È
\82Á
\82½
\81I");
2057 if (carnivorous(youmonst.data) && !humanoid(youmonst.data))
2059 pline("That tripe ration was surprisingly good!");
2061 pline("
\82±
\82Ì
\83\82\83c
\93÷
\82Í
\82¨
\82Ç
\82ë
\82
\82Ù
\82Ç
\8e|
\82¢
\81I");
2062 else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC)))
2064 pline(Hallucination ? "Tastes great! Less filling!"
2066 pline(Hallucination ? "
\82¤
\82Ü
\82¢
\81I
\82à
\82Á
\82Æ
\82Ù
\82µ
\82
\82È
\82é
\82Ë
\81I"
2068 : "Mmm, tripe... not bad!");
2070 : "
\82ñ
\81[
\81C
\83\82\83c
\82©
\81D
\81D
\81D
\88«
\82
\82È
\82¢
\81I");
2073 pline("Yak - dog food!");
2075 pline("
\82¤
\82°
\81C
\83h
\83b
\83O
\83t
\81[
\83h
\82¾
\81I");
2076 more_experienced(1, 0);
2078 /* not cannibalism, but we use similar criteria
2079 for deciding whether to be sickened by this meal */
2080 if (rn2(2) && !CANNIBAL_ALLOWED())
2081 make_vomiting((long) rn1(context.victual.reqtime, 14), FALSE);
2086 case HUGE_CHUNK_OF_MEAT:
2089 case CLOVE_OF_GARLIC:
2090 if (is_undead(youmonst.data)) {
2091 make_vomiting((long) rn1(context.victual.reqtime, 5), FALSE);
2096 if (otmp->otyp == SLIME_MOLD && !otmp->cursed
2097 && otmp->spe == context.current_fruit) {
2099 pline("My, that was a %s %s!",
2100 Hallucination ? "primo" : "yummy",
2101 singular(otmp, xname));
2103 pline("
\82¨
\82â
\81C
\82È
\82ñ
\82Ä%s%s
\82¾
\81I",
2104 Hallucination ? "
\8fã
\95i
\82È" : "
\82¨
\82¢
\82µ
\82¢",
2105 singular(otmp, xname));
2107 } else if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2108 ; /* skip core joke; feedback deferred til fpostfx() */
2110 #if defined(MAC) || defined(MACOSX)
2111 /* KMH -- Why should Unix have all the fun?
2112 We check MACOSX before UNIX to get the Apple-specific apple
2113 message; the '#if UNIX' code will still kick in for pear. */
2114 } else if (otmp->otyp == APPLE) {
2116 pline("Delicious! Must be a Macintosh!");
2118 pline("
\82·
\82Î
\82ç
\82µ
\82¢
\81I
\83}
\83b
\83L
\83\93\83g
\83b
\83V
\83\85\82É
\88á
\82¢
\82È
\82¢
\81I");
2122 } else if (otmp->otyp == APPLE || otmp->otyp == PEAR) {
2123 if (!Hallucination) {
2124 pline("Core dumped.");
2126 /* This is based on an old Usenet joke, a fake a.out manual
2131 pline("%s -- core dumped.",
2133 ? "Segmentation fault"
2139 } else if (otmp->otyp == EGG && stale_egg(otmp)) {
2141 pline("Ugh. Rotten egg."); /* perhaps others like it */
2143 pline("
\83E
\83Q
\83F
\81[
\95\85\82Á
\82½
\97\91\82¾
\81D");
2145 make_vomiting((Vomiting & TIMEOUT) + (long) d(10, 4), TRUE);
2149 pline("This %s is %s", singular(otmp, xname),
2151 ? (Hallucination ? "grody!" : "terrible!")
2152 : (otmp->otyp == CRAM_RATION
2153 || otmp->otyp == K_RATION
2154 || otmp->otyp == C_RATION)
2156 : Hallucination ? "gnarly!" : "delicious!");
2158 pline("
\82±
\82Ì%s
\82Í%s", singular(otmp, xname),
2160 ? (Hallucination ? "
\83C
\83P
\82Ä
\82È
\82¢
\81I" : "
\82Ð
\82Ç
\82¢
\96¡
\82¾
\81I")
2161 : (otmp->otyp == CRAM_RATION
2162 || otmp->otyp == K_RATION
2163 || otmp->otyp == C_RATION)
2164 ? "
\96¡
\8bC
\82È
\82¢
\81D"
2165 : Hallucination ? "
\83C
\83P
\82Ä
\82é
\81I" : "
\82¤
\82Ü
\82¢
\81I");
2168 break; /* default */
2172 /* increment a combat intrinsic with limits on its growth */
2174 bounded_increase(old, inc, typ)
2177 int absold, absinc, sgnold, sgninc;
2179 /* don't include any amount coming from worn rings */
2180 if (uright && uright->otyp == typ)
2182 if (uleft && uleft->otyp == typ)
2184 absold = abs(old), absinc = abs(inc);
2185 sgnold = sgn(old), sgninc = sgn(inc);
2187 if (absinc == 0 || sgnold != sgninc || absold + absinc < 10) {
2188 ; /* use inc as-is */
2189 } else if (absold + absinc < 20) {
2190 absinc = rnd(absinc); /* 1..n */
2191 if (absold + absinc < 10)
2192 absinc = 10 - absold;
2193 inc = sgninc * absinc;
2194 } else if (absold + absinc < 40) {
2195 absinc = rn2(absinc) ? 1 : 0;
2196 if (absold + absinc < 20)
2197 absinc = rnd(20 - absold);
2198 inc = sgninc * absinc;
2200 inc = 0; /* no further increase allowed via this method */
2206 accessory_has_effect(otmp)
2210 pline("Magic spreads through your body as you digest the %s.",
2211 otmp->oclass == RING_CLASS ? "ring" : "amulet");
2213 pline("
\82 \82È
\82½
\82ª%s
\82ð
\8fÁ
\89»
\82·
\82é
\82Æ
\81C
\82»
\82Ì
\96\82\97Í
\82ª
\91Ì
\82É
\82µ
\82Ý
\82±
\82ñ
\82¾
\81D",
2214 otmp->oclass == RING_CLASS ? "
\8ew
\97Ö" : "
\96\82\8f\9c\82¯");
2222 int typ = otmp->otyp;
2225 /* Note: rings are not so common that this is unbalancing. */
2226 /* (How often do you even _find_ 3 rings of polymorph in a game?) */
2227 oldprop = u.uprops[objects[typ].oc_oprop].intrinsic;
2228 if (otmp == uleft || otmp == uright) {
2231 return; /* died from sink fall */
2233 otmp->known = otmp->dknown = 1; /* by taste */
2234 if (!rn2(otmp->oclass == RING_CLASS ? 3 : 5)) {
2235 switch (otmp->otyp) {
2237 if (!objects[typ].oc_oprop)
2238 break; /* should never happen */
2240 if (!(u.uprops[objects[typ].oc_oprop].intrinsic & FROMOUTSIDE))
2241 accessory_has_effect(otmp);
2243 u.uprops[objects[typ].oc_oprop].intrinsic |= FROMOUTSIDE;
2246 case RIN_SEE_INVISIBLE:
2247 set_mimic_blocking();
2249 if (Invis && !oldprop && !ESee_invisible
2250 && !perceives(youmonst.data) && !Blind) {
2253 pline("Suddenly you can see yourself.");
2255 pline("
\93Ë
\91R
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81D");
2259 case RIN_INVISIBILITY:
2260 if (!oldprop && !EInvis && !BInvis && !See_invisible
2264 Your("body takes on a %s transparency...",
2265 Hallucination ? "normal" : "strange");
2267 pline("%s
\82 \82È
\82½
\82Ì
\91Ì
\82Í
\93§
\89ß
\90«
\82ð
\82à
\82Á
\82½
\81D
\81D
\81D",
2268 Hallucination ? "
\82 \82½
\82è
\82Ü
\82¦
\82È
\82±
\82Æ
\82¾
\82ª" : "
\8aï
\96
\82È
\82±
\82Æ
\82É");
2273 case RIN_PROTECTION_FROM_SHAPE_CHAN:
2276 case RIN_LEVITATION:
2277 /* undo the `.intrinsic |= FROMOUTSIDE' done above */
2278 u.uprops[LEVITATION].intrinsic = oldprop;
2281 incr_itimeout(&HLevitation, d(10, 20));
2285 } /* inner switch */
2286 break; /* default case of outer switch */
2289 accessory_has_effect(otmp);
2290 if (adjattrib(A_CHA, otmp->spe, -1))
2293 case RIN_GAIN_STRENGTH:
2294 accessory_has_effect(otmp);
2295 if (adjattrib(A_STR, otmp->spe, -1))
2298 case RIN_GAIN_CONSTITUTION:
2299 accessory_has_effect(otmp);
2300 if (adjattrib(A_CON, otmp->spe, -1))
2303 case RIN_INCREASE_ACCURACY:
2304 accessory_has_effect(otmp);
2305 u.uhitinc = (schar) bounded_increase((int) u.uhitinc, otmp->spe,
2306 RIN_INCREASE_ACCURACY);
2308 case RIN_INCREASE_DAMAGE:
2309 accessory_has_effect(otmp);
2310 u.udaminc = (schar) bounded_increase((int) u.udaminc, otmp->spe,
2311 RIN_INCREASE_DAMAGE);
2313 case RIN_PROTECTION:
2314 accessory_has_effect(otmp);
2315 HProtection |= FROMOUTSIDE;
2316 u.ublessed = bounded_increase(u.ublessed, otmp->spe,
2320 case RIN_FREE_ACTION:
2321 /* Give sleep resistance instead */
2322 if (!(HSleep_resistance & FROMOUTSIDE))
2323 accessory_has_effect(otmp);
2324 if (!Sleep_resistance)
2326 You_feel("wide awake.");
2328 You("
\82Ï
\82Á
\82¿
\82è
\96Ú
\82ª
\82³
\82ß
\82½
\81D");
2329 HSleep_resistance |= FROMOUTSIDE;
2331 case AMULET_OF_CHANGE:
2332 accessory_has_effect(otmp);
2336 You("are suddenly very %s!",
2337 flags.female ? "feminine" : "masculine");
2339 You("
\93Ë
\91R
\82Æ
\82Ä
\82à%s
\82Á
\82Û
\82
\82È
\82Á
\82½
\81I",
2340 flags.female ? "
\8f\97" : "
\92j");
2344 case AMULET_OF_UNCHANGING:
2345 /* un-change: it's a pun */
2346 if (!Unchanging && Upolyd) {
2347 accessory_has_effect(otmp);
2352 case AMULET_OF_STRANGULATION: /* bad idea! */
2353 /* no message--this gives no permanent effect */
2356 case AMULET_OF_RESTFUL_SLEEP: { /* another bad idea! */
2357 long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
2359 if (!(HSleepy & FROMOUTSIDE))
2360 accessory_has_effect(otmp);
2361 HSleepy |= FROMOUTSIDE;
2362 /* might also be wearing one; use shorter of two timeouts */
2363 if (newnap < oldnap || oldnap == 0L)
2364 HSleepy = (HSleepy & ~TIMEOUT) | newnap;
2367 case RIN_SUSTAIN_ABILITY:
2368 case AMULET_OF_LIFE_SAVING:
2369 case AMULET_OF_REFLECTION: /* nice try */
2370 /* can't eat Amulet of Yendor or fakes,
2371 * and no oc_prop even if you could -3.
2378 /* called after eating non-food */
2382 struct obj *otmp = context.victual.piece;
2384 /* lesshungry wants an occupation to handle choke messages correctly */
2386 set_occupation(eatfood, "eating non-food", 0);
2388 set_occupation(eatfood, "
\90H
\82×
\82é", 0);
2389 lesshungry(context.victual.nmod);
2391 context.victual.piece = (struct obj *) 0;
2392 context.victual.o_id = 0;
2393 context.victual.eating = 0;
2394 if (otmp->oclass == COIN_CLASS) {
2398 useupf(otmp, otmp->quan);
2399 vault_gd_watching(GD_EATGOLD);
2403 if (otmp->otyp == SCR_MAIL) {
2405 pline("This junk mail is less than satisfying.");
2408 if (otmp->oclass == POTION_CLASS) {
2409 otmp->quan++; /* dopotion() does a useup() */
2410 (void) dopotion(otmp);
2411 } else if (otmp->oclass == RING_CLASS || otmp->oclass == AMULET_CLASS) {
2413 } else if (otmp->otyp == LEASH && otmp->leashmon) {
2417 /* KMH -- idea by "Tommy the Terrorist" */
2418 if (otmp->otyp == TRIDENT && !otmp->cursed) {
2419 /* sugarless chewing gum which used to be heavily advertised on TV */
2421 pline(Hallucination ? "Four out of five dentists agree."
2422 : "That was pure chewing satisfaction!");
2424 pline(Hallucination ? "
\8cÜ
\90l
\82É
\8el
\90l
\82Ì
\8e\95\88ã
\8eÒ
\82ª
\83g
\83\89\83C
\83f
\83\93\83g
\82ð
\82¨
\91E
\82ß
\82µ
\82Ä
\82¢
\82Ü
\82·
\81D"
2425 : "
\8f\83\90\88\82É
\8a\9a\82Ý
\82½
\82¢
\8bC
\8e\9d\82ð
\96\9e\82½
\82µ
\82½
\81I");
2427 exercise(A_WIS, TRUE);
2429 if (otmp->otyp == FLINT && !otmp->cursed) {
2430 /* chewable vitamin for kids based on "The Flintstones" TV cartoon */
2432 pline("Yabba-dabba delicious!");
2434 pline("
\83\84\83b
\83o
\83_
\83b
\83o
\82¤
\82Ü
\82¢
\81I");
2435 exercise(A_CON, TRUE);
2438 if (otmp == uwep && otmp->quan == 1L)
2440 if (otmp == uquiver && otmp->quan == 1L)
2442 if (otmp == uswapwep && otmp->quan == 1L)
2448 unpunish(); /* but no useup() */
2449 else if (carried(otmp))
2455 /* NOTE: the order of these words exactly corresponds to the
2456 order of oc_material values #define'd in objclass.h. */
2457 static const char *foodwords[] = {
2459 "meal", "liquid", "wax", "food", "meat", "paper",
2460 "cloth", "leather", "wood", "bone", "scale", "metal",
2461 "metal", "metal", "silver", "gold", "platinum", "mithril",
2462 "plastic", "glass", "rich food", "stone"
2464 "
\93÷", "
\89t
\91Ì", "
\96û", "
\90H
\97¿", "
\93÷", "
\8e\86",
2465 "
\95\9e", "
\94ç", "
\96Ø", "
\8d\9c", "
\97Ø", "
\8bà
\91®",
2466 "
\8bà
\91®", "
\8bà
\91®", "
\8bâ", "
\8bà", "
\83v
\83\89\83`
\83i", "
\83~
\83X
\83\8a\83\8b",
2467 "
\83v
\83\89\83X
\83`
\83b
\83N", "
\83K
\83\89\83X", "
\8d\82\8b\89\97¿
\97\9d", "
\90Î"
2471 STATIC_OVL const char *
2475 if (otmp->oclass == FOOD_CLASS)
2480 if (otmp->oclass == GEM_CLASS && objects[otmp->otyp].oc_material == GLASS
2482 makeknown(otmp->otyp);
2483 return foodwords[objects[otmp->otyp].oc_material];
2486 /* called after consuming (non-corpse) food */
2491 switch (otmp->otyp) {
2492 case SPRIG_OF_WOLFSBANE:
2493 if (u.ulycn >= LOW_PM || is_were(youmonst.data))
2498 || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
2499 make_blinded((long) u.ucreamed, TRUE);
2501 case FORTUNE_COOKIE:
2502 outrumor(bcsign(otmp), BY_COOKIE);
2504 u.uconduct.literate++;
2506 case LUMP_OF_ROYAL_JELLY:
2507 /* This stuff seems to be VERY healthy! */
2508 gainstr(otmp, 1, TRUE);
2510 u.mh += otmp->cursed ? -rnd(20) : rnd(20);
2511 if (u.mh > u.mhmax) {
2515 } else if (u.mh <= 0) {
2519 u.uhp += otmp->cursed ? -rnd(20) : rnd(20);
2520 if (u.uhp > u.uhpmax) {
2524 } else if (u.uhp <= 0) {
2525 killer.format = KILLED_BY_AN;
2527 Strcpy(killer.name, "rotten lump of royal jelly");
2530 Strcpy(killer.name, "
\95\85\82Á
\82½
\83\8d\83C
\83\84\83\8b\83[
\83\8a\81[
\82ð
\90H
\82×
\90H
\92\86\93Å
\82Å");
2539 if (flesh_petrifies(&mons[otmp->corpsenm])) {
2540 if (!Stone_resistance
2541 && !(poly_when_stoned(youmonst.data)
2542 && polymon(PM_STONE_GOLEM))) {
2545 Sprintf(killer.name, "%s egg",
2547 Sprintf(killer.name, "%s
\82Ì
\97\91\82Å",
2548 mons[otmp->corpsenm].mname);
2549 make_stoned(5L, (char *) 0, KILLED_BY_AN, killer.name);
2552 /* note: no "tastes like chicken" message for eggs */
2555 case EUCALYPTUS_LEAF:
2556 if (Sick && !otmp->cursed)
2557 make_sick(0L, (char *) 0, TRUE, SICK_ALL);
2558 if (Vomiting && !otmp->cursed)
2559 make_vomiting(0L, TRUE);
2562 if (otmp->cursed && !Sleep_resistance) {
2563 /* Snow White; 'poisoned' applies to [a subset of] weapons,
2564 not food, so we substitute cursed; fortunately our hero
2565 won't have to wait for a prince to be rescued/revived */
2566 if (Race_if(PM_DWARF) && Hallucination)
2567 verbalize("Heigh-ho, ho-hum, I think I'll skip work today.");
2568 else if (Deaf || !flags.acoustics)
2569 You("fall asleep.");
2571 You_hear("sinister laughter as you fall asleep...");
2572 fall_asleep(-rn1(11, 20), TRUE);
2580 /* intended for eating a spellbook while polymorphed, but not used;
2581 "leather" applied to appearance, not composition, and has been
2582 changed to "leathery" to reflect that */
2583 STATIC_DCL boolean FDECL(leather_cover, (struct obj *));
2589 const char *odesc = OBJ_DESCR(objects[otmp->otyp]);
2591 if (odesc && (otmp->oclass == SPBOOK_CLASS)) {
2592 if (!strcmp(odesc, "leather"))
2600 * return 0 if the food was not dangerous.
2601 * return 1 if the food was dangerous and you chose to stop.
2602 * return 2 if the food was dangerous and you chose to eat it anyway.
2605 edibility_prompts(otmp)
2608 /* Blessed food detection grants hero a one-use
2609 * ability to detect food that is unfit for consumption
2610 * or dangerous and avoid it.
2612 char buf[BUFSZ], foodsmell[BUFSZ],
2613 it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
2614 boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
2615 int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
2618 Strcpy(foodsmell, Tobjnam(otmp, "smell"));
2619 Strcpy(it_or_they, (otmp->quan == 1L) ? "it" : "they");
2621 Sprintf(eat_it_anyway, "Eat %s anyway?",
2622 (otmp->quan == 1L) ? "it" : "one");
2624 Strcpy(eat_it_anyway, "
\82»
\82ê
\82Å
\82à
\90H
\82×
\82é
\81H");
2627 if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) {
2628 /* These checks must match those in eatcorpse() */
2629 stoneorslime = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
2630 && !poly_when_stoned(youmonst.data));
2632 if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
2633 stoneorslime = (!Unchanging && !slimeproof(youmonst.data));
2635 if (cadaver && !nonrotting_corpse(mnum)) {
2636 long age = peek_at_iced_corpse_age(otmp);
2637 /* worst case rather than random
2638 in this calculation to force prompt */
2639 rotted = (monstermoves - age) / (10L + 0 /* was rn2(20) */);
2642 else if (otmp->blessed)
2648 * These problems with food should be checked in
2649 * order from most detrimental to least detrimental.
2651 if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
2654 Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2657 Sprintf(buf, "%s
\82Í
\89\98\90õ
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2658 foodsmell, eat_it_anyway);
2660 if (yn_function(buf, ynchars, 'n') == 'n')
2667 Sprintf(buf, "%s like %s could be something very dangerous! %s",
2668 foodsmell, it_or_they, eat_it_anyway);
2670 Sprintf(buf, "%s
\82Í
\82È
\82ñ
\82¾
\82©
\82·
\82²
\82
\8aë
\8c¯
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2671 foodsmell, eat_it_anyway);
2673 if (yn_function(buf, ynchars, 'n') == 'n')
2678 if (otmp->orotten || (cadaver && rotted > 3L)) {
2681 Sprintf(buf, "%s like %s could be rotten! %s", foodsmell, it_or_they,
2684 Sprintf(buf, "%s
\82Í
\95\85\82Á
\82½
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2685 foodsmell, eat_it_anyway);
2687 if (yn_function(buf, ynchars, 'n') == 'n')
2692 if (cadaver && poisonous(&mons[mnum]) && !Poison_resistance) {
2695 Sprintf(buf, "%s like %s might be poisonous! %s", foodsmell,
2696 it_or_they, eat_it_anyway);
2698 Sprintf(buf, "%s
\82Í
\93Å
\82ð
\82à
\82Á
\82Ä
\82¢
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2699 foodsmell, eat_it_anyway);
2701 if (yn_function(buf, ynchars, 'n') == 'n')
2706 if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2707 /* causes sleep, for long enough to be dangerous */
2709 Sprintf(buf, "%s like %s might have been poisoned. %s", foodsmell,
2710 it_or_they, eat_it_anyway);
2712 Sprintf(buf, "%s
\82Í
\93Å
\82ª
\93ü
\82ê
\82ç
\82ê
\82Ä
\82¢
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2713 foodsmell, eat_it_anyway);
2715 return (yn_function(buf, ynchars, 'n') == 'n') ? 1 : 2;
2717 if (cadaver && !vegetarian(&mons[mnum]) && !u.uconduct.unvegetarian
2718 && Role_if(PM_MONK)) {
2720 Sprintf(buf, "%s unhealthy. %s", foodsmell, eat_it_anyway);
2722 Sprintf(buf, "%s
\82Í
\8c\92\8dN
\82É
\88«
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2723 if (yn_function(buf, ynchars, 'n') == 'n')
2728 if (cadaver && acidic(&mons[mnum]) && !Acid_resistance) {
2730 Sprintf(buf, "%s rather acidic. %s", foodsmell, eat_it_anyway);
2732 Sprintf(buf, "%s
\82Í
\8f
\82µ
\8e_
\82Á
\82Ï
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2733 if (yn_function(buf, ynchars, 'n') == 'n')
2738 if (Upolyd && u.umonnum == PM_RUST_MONSTER && is_metallic(otmp)
2739 && otmp->oerodeproof) {
2741 Sprintf(buf, "%s disgusting to you right now. %s", foodsmell,
2744 Sprintf(buf, "%s
\82Í
\8bC
\95ª
\82ª
\88«
\82
\82È
\82é
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell,
2747 if (yn_function(buf, ynchars, 'n') == 'n')
2754 * Breaks conduct, but otherwise safe.
2756 if (!u.uconduct.unvegan
2757 && ((material == LEATHER || material == BONE
2758 || material == DRAGON_HIDE || material == WAX)
2759 || (cadaver && !vegan(&mons[mnum])))) {
2761 Sprintf(buf, "%s foul and unfamiliar to you. %s", foodsmell,
2764 Sprintf(buf, "%s
\82Í
\89\98\82ê
\82Ä
\82¢
\82Ä
\81C
\82 \82È
\82½
\82É
\82È
\82¶
\82Ü
\82È
\82¢
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell,
2767 if (yn_function(buf, ynchars, 'n') == 'n')
2772 if (!u.uconduct.unvegetarian
2773 && ((material == LEATHER || material == BONE
2774 || material == DRAGON_HIDE)
2775 || (cadaver && !vegetarian(&mons[mnum])))) {
2777 Sprintf(buf, "%s unfamiliar to you. %s", foodsmell, eat_it_anyway);
2779 Sprintf(buf, "%s
\82Í
\82 \82È
\82½
\82É
\82È
\82¶
\82Ü
\82È
\82¢
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2780 if (yn_function(buf, ynchars, 'n') == 'n')
2786 if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && Sick_resistance) {
2787 /* Tainted meat with Sick_resistance */
2789 Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2792 Sprintf(buf, "%s
\82Í
\89\98\90õ
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s", foodsmell,
2795 if (yn_function(buf, ynchars, 'n') == 'n')
2808 int basenutrit; /* nutrition of full item */
2809 boolean dont_start = FALSE, nodelicious = FALSE;
2813 pline("If you can't breathe air, how can you consume solids?");
2815 pline("
\91§
\82à
\82Å
\82«
\82È
\82¢
\82Ì
\82É
\81C
\82Ç
\82¤
\82â
\82Á
\82Ä
\90H
\82×
\82½
\82ç
\82¢
\82¢
\82ñ
\82¾
\82¢
\81H");
2818 if (!(otmp = floorfood("eat", 0)))
2820 if (check_capacity((char *) 0))
2824 int res = edibility_prompts(otmp);
2828 "%s stops tingling and your sense of smell returns to normal.",
2831 Your("%s
\82ª
\82¤
\82¸
\82¤
\82¸
\82·
\82é
\82Ì
\82Í
\8e~
\82Ü
\82è
\81C
\9ak
\8ao
\82Í
\95\81\92Ê
\82É
\96ß
\82Á
\82½
\81D",
2840 /* We have to make non-foods take 1 move to eat, unless we want to
2841 * do ridiculous amounts of coding to deal with partly eaten plate
2842 * mails, players who polymorph back to human in the middle of their
2843 * metallic meal, etc....
2845 if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
2846 : touch_artifact(otmp, &youmonst))) {
2848 } else if (!is_edible(otmp)) {
2850 You("cannot eat that!");
2852 You("
\82»
\82ê
\82ð
\90H
\82×
\82ç
\82ê
\82È
\82¢
\81I");
2854 } else if ((otmp->owornmask & (W_ARMOR | W_TOOL | W_AMUL | W_SADDLE))
2856 /* let them eat rings */
2858 You_cant("eat %s you're wearing.", something);
2860 You("
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82é
\8aÔ
\82Í
\90H
\82×
\82ê
\82È
\82¢
\81D");
2863 if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
2864 && otmp->oerodeproof) {
2865 otmp->rknown = TRUE;
2866 if (otmp->quan > 1L) {
2868 (void) splitobj(otmp, otmp->quan - 1L);
2870 otmp = splitobj(otmp, 1L);
2873 pline("Ulch - that %s was rustproofed!", xname(otmp));
2875 pline("
\83E
\83Q
\83F
\81[
\81I%s
\82Í
\96h
\8eK
\82³
\82ê
\82Ä
\82¢
\82é
\81I", xname(otmp));
2876 /* The regurgitated object's rustproofing is gone now */
2877 otmp->oerodeproof = 0;
2878 make_stunned((HStun & TIMEOUT) + (long) rn2(10), TRUE);
2880 You("spit %s out onto the %s.", the(xname(otmp)),
2881 surface(u.ux, u.uy));
2883 You("%s
\82ð%s
\82É
\93f
\82«
\8fo
\82µ
\82½
\81D", the(xname(otmp)),
2884 surface(u.ux, u.uy));
2886 if (carried(otmp)) {
2893 /* KMH -- Slow digestion is... indigestible */
2894 if (otmp->otyp == RIN_SLOW_DIGESTION) {
2896 pline("This ring is indigestible!");
2898 pline("
\82±
\82Ì
\8ew
\97Ö
\82Í
\8fÁ
\89»
\82µ
\82É
\82
\82¢
\81I");
2899 (void) rottenfood(otmp);
2900 if (otmp->dknown && !objects[otmp->otyp].oc_name_known
2901 && !objects[otmp->otyp].oc_uname)
2905 if (otmp->oclass != FOOD_CLASS) {
2908 context.victual.reqtime = 1;
2909 context.victual.piece = otmp;
2910 context.victual.o_id = otmp->o_id;
2911 /* Don't split it, we don't need to if it's 1 move */
2912 context.victual.usedtime = 0;
2913 context.victual.canchoke = (u.uhs == SATIATED);
2914 /* Note: gold weighs 1 pt. for each 1000 pieces (see
2915 pickup.c) so gold and non-gold is consistent. */
2916 if (otmp->oclass == COIN_CLASS)
2917 basenutrit = ((otmp->quan > 200000L)
2919 : (int) (otmp->quan / 100L));
2920 else if (otmp->oclass == BALL_CLASS || otmp->oclass == CHAIN_CLASS)
2921 basenutrit = weight(otmp);
2922 /* oc_nutrition is usually weight anyway */
2924 basenutrit = objects[otmp->otyp].oc_nutrition;
2926 if (otmp->otyp == SCR_MAIL) {
2931 context.victual.nmod = basenutrit;
2932 context.victual.eating = TRUE; /* needed for lesshungry() */
2934 material = objects[otmp->otyp].oc_material;
2935 if (material == LEATHER || material == BONE
2936 || material == DRAGON_HIDE) {
2937 u.uconduct.unvegan++;
2938 violated_vegetarian();
2939 } else if (material == WAX)
2940 u.uconduct.unvegan++;
2944 (void) rottenfood(otmp);
2946 if (otmp->oclass == WEAPON_CLASS && otmp->opoisoned) {
2948 pline("Ecch - that must have been poisonous!");
2950 pline("
\83E
\83Q
\83F
\81[
\81C
\97L
\93Å
\82¾
\82Á
\82½
\82É
\88á
\82¢
\82È
\82¢
\81I");
2951 if (!Poison_resistance) {
2954 losehp(rnd(15), xname(otmp), KILLED_BY_AN);
2958 Sprintf(jbuf, "%s
\82Å", xname(otmp));
2959 losehp(rnd(15), jbuf, KILLED_BY_AN);
2964 You("seem unaffected by the poison.");
2966 You("
\93Å
\82Ì
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
2967 } else if (!otmp->cursed && !nodelicious) {
2969 pline("%s%s is delicious!",
2971 && otmp->oartifact < ART_ORB_OF_DETECTION)
2974 (otmp->oclass == COIN_CLASS)
2976 : singular(otmp, xname));
2978 pline("
\82±
\82Ì%s
\82Í
\8e|
\82¢
\81I",
2979 otmp->oclass == COIN_CLASS
2981 : singular(otmp, xname));
2988 if (otmp == context.victual.piece) {
2989 /* If they weren't able to choke, they don't suddenly become able to
2990 * choke just because they were interrupted. On the other hand, if
2991 * they were able to choke before, if they lost food it's possible
2992 * they shouldn't be able to choke now.
2994 if (u.uhs != SATIATED)
2995 context.victual.canchoke = FALSE;
2996 context.victual.o_id = 0;
2997 context.victual.piece = touchfood(otmp);
2998 if (context.victual.piece)
2999 context.victual.o_id = context.victual.piece->o_id;
3001 You("resume your meal.");
3003 You("
\90H
\8e\96\82ð
\8dÄ
\8aJ
\82µ
\82½
\81D");
3004 start_eating(context.victual.piece);
3008 /* nothing in progress - so try to find something. */
3009 /* tins are a special case */
3010 /* tins must also check conduct separately in case they're discarded */
3011 if (otmp->otyp == TIN) {
3019 context.victual.o_id = 0;
3020 context.victual.piece = otmp = touchfood(otmp);
3021 if (context.victual.piece)
3022 context.victual.o_id = context.victual.piece->o_id;
3023 context.victual.usedtime = 0;
3025 /* Now we need to calculate delay and nutritional info.
3026 * The base nutrition calculated here and in eatcorpse() accounts
3027 * for normal vs. rotten food. The reqtime and nutrit values are
3028 * then adjusted in accordance with the amount of food left.
3030 if (otmp->otyp == CORPSE || otmp->globby) {
3031 int tmp = eatcorpse(otmp);
3035 context.victual.piece = (struct obj *) 0;
3036 context.victual.o_id = 0;
3040 /* if not used up, eatcorpse sets up reqtime and may modify oeaten */
3042 /* No checks for WAX, LEATHER, BONE, DRAGON_HIDE. These are
3043 * all handled in the != FOOD_CLASS case, above.
3045 switch (objects[otmp->otyp].oc_material) {
3047 u.uconduct.unvegan++;
3048 if (otmp->otyp != EGG) {
3049 violated_vegetarian();
3054 if (otmp->otyp == PANCAKE || otmp->otyp == FORTUNE_COOKIE /*eggs*/
3055 || otmp->otyp == CREAM_PIE || otmp->otyp == CANDY_BAR /*milk*/
3056 || otmp->otyp == LUMP_OF_ROYAL_JELLY)
3057 u.uconduct.unvegan++;
3061 context.victual.reqtime = objects[otmp->otyp].oc_delay;
3062 if (otmp->otyp != FORTUNE_COOKIE
3063 && (otmp->cursed || (!nonrotting_food(otmp->otyp)
3064 && (monstermoves - otmp->age)
3065 > (otmp->blessed ? 50L : 30L)
3066 && (otmp->orotten || !rn2(7))))) {
3067 if (rottenfood(otmp)) {
3068 otmp->orotten = TRUE;
3071 consume_oeaten(otmp, 1); /* oeaten >>= 1 */
3076 /* re-calc the nutrition */
3077 if (otmp->otyp == CORPSE)
3078 basenutrit = mons[otmp->corpsenm].cnutrit;
3080 basenutrit = objects[otmp->otyp].oc_nutrition;
3082 debugpline1("before rounddiv: context.victual.reqtime == %d",
3083 context.victual.reqtime);
3084 debugpline2("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
3085 context.victual.reqtime = (basenutrit == 0)
3087 : rounddiv(context.victual.reqtime
3088 * (long) otmp->oeaten,
3090 debugpline1("after rounddiv: context.victual.reqtime == %d",
3091 context.victual.reqtime);
3093 * calculate the modulo value (nutrit. units per round eating)
3094 * note: this isn't exact - you actually lose a little nutrition due
3096 * TODO: add in a "remainder" value to be given at the end of the meal.
3098 if (context.victual.reqtime == 0 || otmp->oeaten == 0)
3099 /* possible if most has been eaten before */
3100 context.victual.nmod = 0;
3101 else if ((int) otmp->oeaten >= context.victual.reqtime)
3102 context.victual.nmod = -((int) otmp->oeaten
3103 / context.victual.reqtime);
3105 context.victual.nmod = context.victual.reqtime % otmp->oeaten;
3106 context.victual.canchoke = (u.uhs == SATIATED);
3113 /* Take a single bite from a piece of food, checking for choking and
3114 * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise.
3119 if (context.victual.canchoke && u.uhunger >= 2000) {
3120 choke(context.victual.piece);
3123 if (context.victual.doreset) {
3127 force_save_hs = TRUE;
3128 if (context.victual.nmod < 0) {
3129 lesshungry(-context.victual.nmod);
3130 consume_oeaten(context.victual.piece,
3131 context.victual.nmod); /* -= -nmod */
3132 } else if (context.victual.nmod > 0
3133 && (context.victual.usedtime % context.victual.nmod)) {
3135 consume_oeaten(context.victual.piece, -1); /* -= 1 */
3137 force_save_hs = FALSE;
3142 /* as time goes by - called by moveloop() and domove() */
3146 if (u.uinvulnerable)
3147 return; /* you don't feel hungrier */
3149 if ((!u.usleep || !rn2(10)) /* slow metabolic rate while asleep */
3150 && (carnivorous(youmonst.data) || herbivorous(youmonst.data))
3152 u.uhunger--; /* ordinary food consumption */
3154 if (moves % 2) { /* odd turns */
3155 /* Regeneration uses up food, unless due to an artifact */
3156 if ((HRegeneration & ~FROMFORM)
3157 || (ERegeneration & ~(W_ARTI | W_WEP)))
3159 if (near_capacity() > SLT_ENCUMBER)
3161 } else { /* even turns */
3164 /* Conflict uses up food too */
3165 if (HConflict || (EConflict & (~W_ARTI)))
3167 /* +0 charged rings don't do anything, so don't affect hunger */
3168 /* Slow digestion still uses ring hunger */
3169 switch ((int) (moves % 20)) { /* note: use even cases only */
3171 if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged))
3179 if (uright && (uright->spe || !objects[uright->otyp].oc_charged))
3193 /* called after vomiting and after performing feats of magic */
3202 /* called after eating (and after drinking fruit juice) */
3207 /* See comments in newuhs() for discussion on force_save_hs */
3208 boolean iseating = (occupation == eatfood) || force_save_hs;
3210 debugpline1("lesshungry(%d)", num);
3212 if (u.uhunger >= 2000) {
3213 if (!iseating || context.victual.canchoke) {
3215 choke(context.victual.piece);
3218 choke(occupation == opentin ? context.tin.tin
3219 : (struct obj *) 0);
3220 /* no reset_eat() */
3223 /* Have lesshungry() report when you're nearly full so all eating
3224 * warns when you're about to choke.
3226 if (u.uhunger >= 1500) {
3227 if (!context.victual.eating
3228 || (context.victual.eating && !context.victual.fullwarn)) {
3230 pline("You're having a hard time getting all of it down.");
3232 pline("
\91S
\82Ä
\82ð
\88ù
\82Ý
\82±
\82Þ
\82É
\82Í
\8e\9e\8aÔ
\82ª
\82©
\82©
\82é
\81D");
3234 nomovemsg = "You're finally finished.";
3236 nomovemsg = "
\82â
\82Á
\82Æ
\90H
\82×
\8fI
\82¦
\82½
\81D";
3237 if (!context.victual.eating) {
3240 context.victual.fullwarn = TRUE;
3241 if (context.victual.canchoke
3242 && context.victual.reqtime > 1) {
3243 /* a one-gulp food will not survive a stop */
3245 if (yn_function("Continue eating?", ynchars, 'n')
3247 if (yn_function("
\90H
\82×
\91±
\82¯
\82Ü
\82·
\82©
\81H", ynchars, 'n')
3250 nomovemsg = (char *) 0;
3264 (void) Hear_again();
3265 if (u.uhs > FAINTING)
3275 return (boolean) (u.uhs == FAINTED);
3278 /* call when a faint must be prematurely terminated */
3282 if (afternmv == unfaint)
3283 unmul("You revive.");
3286 /* compute and comment on your (new?) hunger status */
3292 static unsigned save_hs;
3293 static boolean saved_hs = FALSE;
3298 : (h > 150) ? NOT_HUNGRY
3299 : (h > 50) ? HUNGRY : (h > 0) ? WEAK : FAINTING;
3301 /* While you're eating, you may pass from WEAK to HUNGRY to NOT_HUNGRY.
3302 * This should not produce the message "you only feel hungry now";
3303 * that message should only appear if HUNGRY is an endpoint. Therefore
3304 * we check to see if we're in the middle of eating. If so, we save
3305 * the first hunger status, and at the end of eating we decide what
3306 * message to print based on the _entire_ meal, not on each little bit.
3308 /* It is normally possible to check if you are in the middle of a meal
3309 * by checking occupation == eatfood, but there is one special case:
3310 * start_eating() can call bite() for your first bite before it
3311 * sets the occupation.
3312 * Anyone who wants to get that case to work _without_ an ugly static
3313 * force_save_hs variable, feel free.
3315 /* Note: If you become a certain hunger status in the middle of the
3316 * meal, and still have that same status at the end of the meal,
3317 * this will incorrectly print the associated message at the end of
3318 * the meal instead of the middle. Such a case is currently
3319 * impossible, but could become possible if a message for SATIATED
3320 * were added or if HUNGRY and WEAK were separated by a big enough
3321 * gap to fit two bites.
3323 if (occupation == eatfood || force_save_hs) {
3337 if (newhs == FAINTING) {
3340 if (u.uhs <= WEAK || rn2(20 - u.uhunger / 10) >= 19) {
3341 if (!is_fainted() && multi >= 0 /* %% */) {
3342 int duration = 10 - (u.uhunger / 10);
3344 /* stop what you're doing, then faint */
3347 You("faint from lack of food.");
3349 You("
\95 \82ª
\8c¸
\82Á
\82Ä
\93|
\82ê
\82½
\81D");
3352 selftouch("Falling, you");
3354 selftouch("
\97\8e\82¿
\82È
\82ª
\82ç
\81C
\82 \82È
\82½
\82Í");
3355 incr_itimeout(&HDeaf, duration);
3357 multi_reason = "fainted from lack of food";
3359 nomovemsg = "You regain consciousness.";
3361 nomovemsg = "
\82 \82È
\82½
\82Í
\90³
\8bC
\82Ã
\82¢
\82½
\81D";
3365 } else if (u.uhunger < -(int) (200 + 20 * ACURR(A_CON))) {
3370 You("die from starvation.");
3372 You("
\89ì
\8e\80\82µ
\82½
\81D");
3373 killer.format = KILLED_BY;
3375 Strcpy(killer.name, "starvation");
3377 Strcpy(killer.name, "
\90H
\97¿
\95s
\91«
\82Å
\89ì
\8e\80\82µ
\82½");
3379 /* if we return, we lifesaved, and that calls newuhs */
3384 if (newhs != u.uhs) {
3385 if (newhs >= WEAK && u.uhs < WEAK)
3386 losestr(1); /* this may kill you -- see below */
3387 else if (newhs < WEAK && u.uhs >= WEAK)
3391 if (Hallucination) {
3393 You((!incr) ? "now have a lesser case of the munchies."
3394 : "are getting the munchies.");
3397 You("
\83n
\83\89\83w
\83\8a\82ª
\8c¸
\82Á
\82½
\81D");
3399 pline("
\83n
\83\89\83w
\83\8a\83w
\83\8a\83n
\83\89\81D");
3404 You((!incr) ? "only feel hungry now."
3406 You((!incr) ? "
\92P
\82É
\95 \83y
\83R
\8fó
\91Ô
\82É
\82È
\82Á
\82½
\81D"
3411 ? "
\8bó
\95 \8a´
\82ð
\8a´
\82¶
\82½
\81D"
3413 : "are beginning to feel hungry.");
3415 : "
\8bó
\95 \8a´
\82ð
\82¨
\82Ú
\82¦
\82Í
\82¶
\82ß
\82½
\81D");
3416 if (incr && occupation
3417 && (occupation != eatfood && occupation != opentin))
3419 context.travel = context.travel1 = context.mv = context.run = 0;
3424 pline((!incr) ? "You still have the munchies."
3426 pline((!incr) ? "
\83n
\83\89\83w
\83\8a\82ª
\8c¸
\82ç
\82È
\82¢
\81D"
3428 : "The munchies are interfering with your motor capabilities.");
3430 : "
\83n
\83\89\83w
\83\8a\82ª
\83\82\81[
\83^
\81[
\90«
\94\
\82É
\89e
\8b¿
\82ð
\97^
\82¦
\82Ä
\82¢
\82é
\81D");
3431 else if (incr && (Role_if(PM_WIZARD) || Race_if(PM_ELF)
3432 || Role_if(PM_VALKYRIE)))
3434 pline("%s needs food, badly!",
3436 pline("%s
\82É
\82Í
\8e\8a\8b}
\90H
\97¿
\82ª
\95K
\97v
\82¾
\81I",
3437 (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE))
3442 : "
\83G
\83\8b\83t");
3448 ? "
\90\8a\8eã
\8fó
\91Ô
\82É
\82È
\82Á
\82½
\81D"
3450 : (u.uhunger < 45) ? "feel weak."
3452 : (u.uhunger < 45) ? "
\90\8a\8eã
\82µ
\82Ä
\82«
\82½
\81D"
3454 : "are beginning to feel weak.");
3456 : "
\8eã
\82
\82È
\82Á
\82Ä
\82«
\82½
\82æ
\82¤
\82É
\8a´
\82¶
\82½
\81D");
3457 if (incr && occupation
3458 && (occupation != eatfood && occupation != opentin))
3460 context.travel = context.travel1 = context.mv = context.run = 0;
3466 if ((Upolyd ? u.mh : u.uhp) < 1) {
3468 You("die from hunger and exhaustion.");
3470 You("
\8bó
\95 \82Æ
\90\8a\8eã
\82Å
\8e\80\82ñ
\82¾
\81D");
3471 killer.format = KILLED_BY;
3473 Strcpy(killer.name, "exhaustion");
3475 Strcpy(killer.name, "
\8bó
\95 \82Æ
\90\8a\8eã
\82Å
\8e\80\82ñ
\82¾");
3482 /* Returns an object representing food.
3483 * Object may be either on floor or in inventory.
3485 /*JP CHECK: 3.4.3
\82Å
\82Ì
\8cÄ
\82Ñ
\8fo
\82µ
\8c³
3486 apply.c:1959: if (!(corpse = floorfood("
\8aÊ
\8bl
\82ß
\82É
\82·
\82é", 2))) return;
3487 eat.c:2404: if (!(otmp = floorfood("
\90H
\82×
\82é", 0))) return 0;
3488 pray.c:1478: if (!(otmp = floorfood("
\95ù
\82°
\82é", 1))) return 0;
3491 floorfood(verb, corpsecheck)
3493 int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
3495 register struct obj *otmp;
3498 boolean feeding = !strcmp(verb, "eat"), /* corpsecheck==0 */
3499 offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
3502 const char *jverb = trans_verb(verb)->jp;
3505 /* if we can't touch floor objects then use invent food only */
3506 if (!can_reach_floor(TRUE) || (feeding && u.usteed)
3507 || (is_pool_or_lava(u.ux, u.uy)
3508 && (Wwalking || is_clinger(youmonst.data)
3509 || (Flying && !Breathless))))
3512 if (feeding && metallivorous(youmonst.data)) {
3514 struct trap *ttmp = t_at(u.ux, u.uy);
3516 if (ttmp && ttmp->tseen && ttmp->ttyp == BEAR_TRAP) {
3517 /* If not already stuck in the trap, perhaps there should
3518 be a chance to becoming trapped? Probably not, because
3519 then the trap would just get eaten on the _next_ turn... */
3521 Sprintf(qbuf, "There is a bear trap here (%s); eat it?",
3523 Sprintf(qbuf, "
\82±
\82±
\82É
\82Í
\8cF
\82Ìã©(%s)
\82ª
\82 \82é;
\90H
\82×
\82Ü
\82·
\82©
\81H",
3525 (u.utrap && u.utraptype == TT_BEARTRAP) ? "holding you"
3527 (u.utrap && u.utraptype == TT_BEARTRAP) ? "
\82 \82È
\82½
\82ð
\92Í
\82Ü
\82¦
\82Ä
\82¢
\82é"
3531 : "
\89Ò
\93®
\92\86");
3532 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3533 u.utrap = u.utraptype = 0;
3535 return mksobj(BEARTRAP, TRUE, FALSE);
3536 } else if (c == 'q') {
3537 return (struct obj *) 0;
3541 if (youmonst.data != &mons[PM_RUST_MONSTER]
3542 && (gold = g_at(u.ux, u.uy)) != 0) {
3544 if (gold->quan == 1L)
3545 Sprintf(qbuf, "There is 1 gold piece here; eat it?");
3547 Sprintf(qbuf, "There are %ld gold pieces here; eat them?",
3550 Sprintf(qbuf, "
\82±
\82±
\82É
\82Í%ld
\96\87\82Ì
\8bà
\89Ý
\82ª
\82 \82é
\81D
\90H
\82×
\82Ü
\82·
\82©
\81H", gold->quan);
3552 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3554 } else if (c == 'q') {
3555 return (struct obj *) 0;
3560 /* Is there some food (probably a heavy corpse) here on the ground? */
3561 for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
3563 ? (otmp->otyp == CORPSE
3564 && (corpsecheck == 1 || tinnable(otmp)))
3565 : feeding ? (otmp->oclass != COIN_CLASS && is_edible(otmp))
3566 : otmp->oclass == FOOD_CLASS) {
3568 boolean one = (otmp->quan == 1L);
3570 /* "There is <an object> here; <verb> it?" or
3571 "There are <N objects> here; <verb> one?" */
3573 Sprintf(qbuf, "There %s ", otense(otmp, "are"));
3574 Sprintf(qsfx, " here; %s %s?", verb, one ? "it" : "one");
3575 (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3576 one ? something : (const char *) "things");
3578 Strcpy(qbuf, "
\82±
\82±
\82É");
3579 Sprintf(qsfx, "
\82ª
\82 \82é; %s%s?", one ? "" : "
\88ê
\82Â", jverb);
3580 (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3581 one ? something : (const char *) "
\89½
\82©");
3583 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y')
3586 return (struct obj *) 0;
3591 /* We cannot use ALL_CLASSES since that causes getobj() to skip its
3592 * "ugly checks" and we need to check for inedible items.
3595 getobj(feeding ? allobj : offering ? offerfodder : comestibles, verb);
3596 if (corpsecheck && otmp && !(offering && otmp->oclass == AMULET_CLASS))
3597 if (otmp->otyp != CORPSE || (corpsecheck == 2 && !tinnable(otmp))) {
3599 You_cant("%s that!", verb);
3601 You_cant("
\82»
\82ê
\82ð%s
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81I", jverb);
3602 return (struct obj *) 0;
3607 /* Side effects of vomiting */
3608 /* added nomul (MRS) - it makes sense, you're too busy being sick! */
3610 vomit() /* A good idea from David Neves */
3612 if (cantvomit(youmonst.data))
3613 /* doesn't cure food poisoning; message assumes that we aren't
3614 dealing with some esoteric body_part() */
3615 Your("jaw gapes convulsively.");
3617 make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE);
3619 multi_reason = "vomiting";
3620 nomovemsg = You_can_move_again;
3624 eaten_stat(base, obj)
3628 long uneaten_amt, full_amount;
3630 uneaten_amt = (long) obj->oeaten;
3631 full_amount = (obj->otyp == CORPSE)
3632 ? (long) mons[obj->corpsenm].cnutrit
3633 : (long) objects[obj->otyp].oc_nutrition;
3634 if (uneaten_amt > full_amount) {
3636 "partly eaten food (%ld) more nutritious than untouched food (%ld)",
3637 uneaten_amt, full_amount);
3638 uneaten_amt = full_amount;
3641 base = (int) (full_amount ? (long) base * uneaten_amt / full_amount : 0L);
3642 return (base < 1) ? 1 : base;
3645 /* reduce obj's oeaten field, making sure it never hits or passes 0 */
3647 consume_oeaten(obj, amt)
3652 * This is a hack to try to squelch several long standing mystery
3653 * food bugs. A better solution would be to rewrite the entire
3654 * victual handling mechanism from scratch using a less complex
3655 * model. Alternatively, this routine could call done_eating()
3656 * or food_disappears() but its callers would need revisions to
3657 * cope with context.victual.piece unexpectedly going away.
3659 * Multi-turn eating operates by setting the food's oeaten field
3660 * to its full nutritional value and then running a counter which
3661 * independently keeps track of whether there is any food left.
3662 * The oeaten field can reach exactly zero on the last turn, and
3663 * the object isn't removed from inventory until the next turn
3664 * when the "you finish eating" message gets delivered, so the
3665 * food would be restored to the status of untouched during that
3666 * interval. This resulted in unexpected encumbrance messages
3667 * at the end of a meal (if near enough to a threshold) and would
3668 * yield full food if there was an interruption on the critical
3669 * turn. Also, there have been reports over the years of food
3670 * becoming massively heavy or producing unlimited satiation;
3671 * this would occur if reducing oeaten via subtraction attempted
3672 * to drop it below 0 since its unsigned type would produce a
3673 * huge positive value instead. So far, no one has figured out
3674 * _why_ that inappropriate subtraction might sometimes happen.
3678 /* bit shift to divide the remaining amount of food */
3679 obj->oeaten >>= amt;
3681 /* simple decrement; value is negative so we actually add it */
3682 if ((int) obj->oeaten > -amt)
3688 if (obj->oeaten == 0) {
3689 if (obj == context.victual.piece) /* always true unless wishing... */
3690 context.victual.reqtime =
3691 context.victual.usedtime; /* no bites left */
3692 obj->oeaten = 1; /* smallest possible positive value */
3696 /* called when eatfood occupation has been interrupted,
3697 or in the case of theft, is about to be interrupted */
3699 maybe_finished_meal(stopping)
3702 /* in case consume_oeaten() has decided that the food is all gone */
3703 if (occupation == eatfood
3704 && context.victual.usedtime >= context.victual.reqtime) {
3706 occupation = 0; /* for do_reset_eat */
3707 (void) eatfood(); /* calls done_eating() to use up
3708 context.victual.piece */
3714 /* Tin of <something> to the rescue? Decide whether current occupation
3715 is an attempt to eat a tin of something capable of saving hero's life.
3716 We don't care about consumption of non-tinned food here because special
3717 effects there take place on first bite rather than at end of occupation.
3718 [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */
3726 if (occupation != opentin)
3728 otin = context.tin.tin;
3729 /* make sure hero still has access to tin */
3731 && (!obj_here(otin, u.ux, u.uy) || !can_reach_floor(TRUE)))
3733 /* unknown tin is assumed to be helpful */
3736 /* known tin is helpful if it will stop life-threatening problem */
3737 mndx = otin->corpsenm;
3739 /* note: not used; hunger code bypasses stop_occupation() when eating */
3741 return (boolean) (mndx != NON_PM || otin->spe == 1);
3742 /* flesh from lizards and acidic critters stops petrification */
3744 return (boolean) (mndx >= LOW_PM
3745 && (mndx == PM_LIZARD || acidic(&mons[mndx])));
3746 /* no tins can cure these (yet?) */