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 */
198 altmsg = "You now prefer mimicking yourself.";
200 altmsg = "
\82 \82È
\82½
\82Í
\8e©
\95ª
\8e©
\90g
\82Ì
\82Ü
\82Ë
\82ð
\82·
\82é
\82±
\82Æ
\82ð
\91I
\82ñ
\82¾
\81D";
202 } else if (is_obj_mappear(&youmonst,GOLD_PIECE) && Hallucination) {
203 /* won't happen; anything which might make immobilized
204 hero begin hallucinating (black light attack, theft
205 of Grayswandir) will terminate the mimicry first */
207 altmsg = "Your rind escaped intact.";
209 altmsg = "
\82 \82È
\82½
\82Ì
\94ç
\82ª
\82»
\82Ì
\82Ü
\82Ü
\82Ì
\8c`
\82Å
\93¦
\82°
\82Ä
\82¢
\82Á
\82½
\81D";
214 /* replace end-of-mimicking message */
215 if (strlen(altmsg) > strlen(eatmbuf)) {
216 free((genericptr_t) eatmbuf);
217 eatmbuf = (char *) alloc(strlen(altmsg) + 1);
219 nomovemsg = strcpy(eatmbuf, altmsg);
220 /* update current image */
221 youmonst.mappearance = altapp;
226 /* ``[the(] singular(food, xname) [)]'' */
227 STATIC_OVL const char *
228 food_xname(food, the_pfx)
234 if (food->otyp == CORPSE) {
235 result = corpse_xname(food, (const char *) 0,
236 CXN_SINGULAR | (the_pfx ? CXN_PFX_THE : 0));
237 /* not strictly needed since pname values are capitalized
238 and the() is a no-op for them */
239 if (type_is_pname(&mons[food->corpsenm]))
242 /* the ordinary case */
243 result = singular(food, xname);
246 result = the(result);
250 /* Created by GAN 01/28/87
251 * Amended by AKP 09/22/87: if not hard, don't choke, just vomit.
252 * Amended by 3. 06/12/89: if not hard, sometimes choke anyway, to keep risk.
253 * 11/10/89: if hard, rarely vomit anyway, for slim chance.
255 * To a full belly all food is bad. (It.)
261 /* only happens if you were satiated */
262 if (u.uhs != SATIATED) {
263 if (!food || food->otyp != AMULET_OF_STRANGULATION)
265 } else if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL) {
266 adjalign(-1); /* gluttony is unchivalrous */
268 You_feel("like a glutton!");
270 You("
\91å
\90H
\8a¿
\82Ì
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
273 exercise(A_CON, FALSE);
275 if (Breathless || (!Strangled && !rn2(20))) {
276 /* choking by eating AoS doesn't involve stuffing yourself */
277 if (food && food->otyp == AMULET_OF_STRANGULATION) {
279 You("choke, but recover your composure.");
281 You("
\8eñ
\82ð
\8di
\82ß
\82ç
\82ê
\82½
\81D
\82µ
\82©
\82µ
\82È
\82ñ
\82Æ
\82à
\82È
\82©
\82Á
\82½
\81D");
285 You("stuff yourself and then vomit voluminously.");
287 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");
288 morehungry(1000); /* you just got *very* sick! */
291 killer.format = KILLED_BY_AN;
293 * Note all "killer"s below read "Choked on %s" on the
294 * high score list & tombstone. So plan accordingly.
298 You("choke over your %s.", foodword(food));
300 You("%s
\82ð
\8dA
\82É
\8bl
\82Ü
\82ç
\82¹
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D", foodword(food));
301 if (food->oclass == COIN_CLASS) {
303 Strcpy(killer.name, "very rich meal");
305 Strcpy(killer.name, "
\82Æ
\82Ä
\82à
\8d\82\89¿
\82È
\97¿
\97\9d");
307 killer.format = KILLED_BY;
308 Strcpy(killer.name, killer_xname(food));
312 You("choke over it.");
314 pline("
\8dA
\82É
\8bl
\82Ü
\82ç
\82¹
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
316 Strcpy(killer.name, "quick snack");
318 Strcpy(killer.name, "
\91\81\90H
\82¢");
323 pline("
\82 \82È
\82½
\82Í
\8e\80\82É
\82Ü
\82µ
\82½
\81D
\81D
\81D");
328 /* modify object wt. depending on time spent consuming it */
332 struct obj *piece = context.victual.piece;
334 impossible("recalc_wt without piece");
337 debugpline1("Old weight = %d", piece->owt);
338 debugpline2("Used time = %d, Req'd time = %d", context.victual.usedtime,
339 context.victual.reqtime);
340 piece->owt = weight(piece);
341 debugpline1("New weight = %d", piece->owt);
344 /* called when eating interrupted by an event */
348 /* we only set a flag here - the actual reset process is done after
349 * the round is spent eating.
351 if (context.victual.eating && !context.victual.doreset) {
352 debugpline0("reset_eat...");
353 context.victual.doreset = TRUE;
358 STATIC_OVL struct obj *
362 if (otmp->quan > 1L) {
364 (void) splitobj(otmp, otmp->quan - 1L);
366 otmp = splitobj(otmp, 1L);
367 debugpline0("split object,");
371 costly_alteration(otmp, COST_BITE);
373 (otmp->otyp == CORPSE ? mons[otmp->corpsenm].cnutrit
374 : objects[otmp->otyp].oc_nutrition);
379 if (inv_cnt(FALSE) >= 52) {
380 sellobj_state(SELL_DONTSELL);
382 sellobj_state(SELL_NORMAL);
384 otmp->nomerge = 1; /* used to prevent merge */
392 /* When food decays, in the middle of your meal, we don't want to dereference
393 * any dangling pointers, so set it to null (which should still trigger
394 * do_reset_eat() at the beginning of eatfood()) and check for null pointers
401 if (obj == context.victual.piece) {
402 context.victual.piece = (struct obj *) 0;
403 context.victual.o_id = 0;
406 obj_stop_timers(obj);
409 /* renaming an object used to result in it having a different address,
410 so the sequence start eating/opening, get interrupted, name the food,
411 resume eating/opening would restart from scratch */
413 food_substitution(old_obj, new_obj)
414 struct obj *old_obj, *new_obj;
416 if (old_obj == context.victual.piece) {
417 context.victual.piece = new_obj;
418 context.victual.o_id = new_obj->o_id;
420 if (old_obj == context.tin.tin) {
421 context.tin.tin = new_obj;
422 context.tin.o_id = new_obj->o_id;
429 debugpline0("do_reset_eat...");
430 if (context.victual.piece) {
431 context.victual.o_id = 0;
432 context.victual.piece = touchfood(context.victual.piece);
433 if (context.victual.piece)
434 context.victual.o_id = context.victual.piece->o_id;
437 context.victual.fullwarn = context.victual.eating =
438 context.victual.doreset = FALSE;
439 /* Do not set canchoke to FALSE; if we continue eating the same object
440 * we need to know if canchoke was set when they started eating it the
441 * previous time. And if we don't continue eating the same object
442 * canchoke always gets recalculated anyway.
448 /* called each move during eating process */
452 if (!context.victual.piece
453 || (!carried(context.victual.piece)
454 && !obj_here(context.victual.piece, u.ux, u.uy))) {
455 /* maybe it was stolen? */
459 if (!context.victual.eating)
462 if (++context.victual.usedtime <= context.victual.reqtime) {
465 return 1; /* still busy */
476 context.victual.piece->in_use = TRUE;
477 occupation = 0; /* do this early, so newuhs() knows we're done */
485 You("finish eating %s.", food_xname(context.victual.piece, TRUE));
487 You("%s
\82ð
\90H
\82×
\8fI
\82¦
\82½
\81D", food_xname(context.victual.piece, TRUE));
489 if (context.victual.piece->otyp == CORPSE)
490 cpostfx(context.victual.piece->corpsenm);
492 fpostfx(context.victual.piece);
494 if (carried(context.victual.piece))
495 useup(context.victual.piece);
497 useupf(context.victual.piece, 1L);
498 context.victual.piece = (struct obj *) 0;
499 context.victual.o_id = 0;
500 context.victual.fullwarn = context.victual.eating =
501 context.victual.doreset = FALSE;
510 u.uconduct.unvegan++;
512 violated_vegetarian();
515 /* handle side-effects of mind flayer's tentacle attack */
517 eat_brains(magr, mdef, visflag, dmg_p)
518 struct monst *magr, *mdef;
520 int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
522 struct permonst *pd = mdef->data;
523 boolean give_nutrit = FALSE;
524 int result = MM_HIT, xtra_dmg = rnd(10);
526 if (noncorporeal(pd)) {
529 pline("%s brain is unharmed.",
530 (mdef == &youmonst) ? "Your" : s_suffix(Monnam(mdef)));
532 pline("%s
\82Ì
\94]
\82Í
\96³
\8e\96\82¾
\82Á
\82½
\81D",
533 (mdef == &youmonst) ? "
\82 \82È
\82½" : Monnam(mdef));
535 return MM_MISS; /* side-effects can't occur */
536 } else if (magr == &youmonst) {
538 You("eat %s brain!", s_suffix(mon_nam(mdef)));
540 You("%s
\82Ì
\94]
\82ð
\90H
\82×
\82½
\81I", mon_nam(mdef));
541 } else if (mdef == &youmonst) {
543 Your("brain is eaten!");
545 Your("
\94]
\82Í
\90H
\82×
\82ç
\82ê
\82½
\81I");
546 } else { /* monster against monster */
549 pline("%s brain is eaten!", s_suffix(Monnam(mdef)));
551 pline("%s
\82Ì
\94]
\82Í
\90H
\82×
\82ç
\82ê
\82½
\81I", Monnam(mdef));
554 if (flesh_petrifies(pd)) {
555 /* mind flayer has attempted to eat the brains of a petrification
556 inducing critter (most likely Medusa; attacking a cockatrice via
557 tentacle-touch should have been caught before reaching this far) */
558 if (magr == &youmonst) {
559 if (!Stone_resistance && !Stoned)
560 make_stoned(5L, (char *) 0, KILLED_BY_AN, pd->mname);
562 /* no need to check for poly_when_stoned or Stone_resistance;
563 mind flayers don't have those capabilities */
566 pline("%s turns to stone!", Monnam(magr));
568 pline("%s
\82Í
\90Î
\82É
\82È
\82Á
\82½
\81I", Monnam(magr));
571 /* life-saved; don't continue eating the brains */
574 if (magr->mtame && !visflag)
575 /* parallels mhitm.c's brief_feeling */
577 You("have a sad thought for a moment, then is passes.");
579 You("
\94ß
\82µ
\82¢
\8dl
\82¦
\82É
\82¨
\82»
\82í
\82ê
\82½
\82ª
\81A
\82·
\82®
\82É
\89ß
\82¬
\82³
\82Á
\82½
\81D");
585 if (magr == &youmonst) {
587 * player mind flayer is eating something's brain
590 if (mindless(pd)) { /* (cannibalism not possible here) */
592 pline("%s doesn't notice.", Monnam(mdef));
594 pline("%s
\82Í
\8bC
\82Ã
\82¢
\82Ä
\82¢
\82È
\82¢
\81D", Monnam(mdef));
595 /* all done; no extra harm inflicted upon target */
597 } else if (is_rider(pd)) {
599 pline("Ingesting that is fatal.");
601 pline("
\8eæ
\82è
\8d\9e\82ñ
\82¾
\82ç
\82·
\82®
\82É
\8e\80\82ñ
\82Å
\82µ
\82Ü
\82Á
\82½
\81D");
603 Sprintf(killer.name, "unwisely ate the brain of %s", pd->mname);
604 killer.format = NO_KILLER_PREFIX;
606 Sprintf(killer.name, "
\8bð
\82©
\82É
\82à%s
\82Ì
\91Ì
\82ð
\90H
\82×
\82Ä", pd->mname);
607 killer.format = KILLED_BY;
610 /* life-saving needed to reach here */
611 exercise(A_WIS, FALSE);
612 *dmg_p += xtra_dmg; /* Rider takes extra damage */
614 morehungry(-rnd(30)); /* cannot choke */
615 if (ABASE(A_INT) < AMAX(A_INT)) {
616 /* recover lost Int; won't increase current max */
617 ABASE(A_INT) += rnd(4);
618 if (ABASE(A_INT) > AMAX(A_INT))
619 ABASE(A_INT) = AMAX(A_INT);
622 exercise(A_WIS, TRUE);
625 /* targetting another mind flayer or your own underlying species
627 (void) maybe_cannibal(monsndx(pd), TRUE);
629 } else if (mdef == &youmonst) {
631 * monster mind flayer is eating hero's brain
633 /* no such thing as mindless players */
634 if (ABASE(A_INT) <= ATTRMIN(A_INT)) {
636 static NEARDATA const char brainlessness[] = "brainlessness";
638 static NEARDATA const char brainlessness[] = "
\94]
\82ð
\8e¸
\82Á
\82Ä";
641 Strcpy(killer.name, brainlessness);
642 killer.format = KILLED_BY;
644 /* amulet of life saving has now been used up */
646 pline("Unfortunately your brain is still gone.");
648 pline("
\8ec
\94O
\82È
\82ª
\82ç
\82 \82È
\82½
\82É
\82Í
\94]
\82ª
\82È
\82¢
\81D");
649 /* sanity check against adding other forms of life-saving */
650 u.uprops[LIFESAVED].extrinsic =
651 u.uprops[LIFESAVED].intrinsic = 0L;
654 Your("last thought fades away.");
656 Your("
\8dÅ
\8cã
\82Ì
\8ev
\82¢
\82ª
\91\96\94n
\93\95\82Ì
\82æ
\82¤
\82É
\89¡
\82¬
\82Á
\82½
\81D");
658 Strcpy(killer.name, brainlessness);
659 killer.format = KILLED_BY;
661 /* can only get here when in wizard or explore mode and user has
662 explicitly chosen not to die; arbitrarily boost intelligence */
663 ABASE(A_INT) = ATTRMIN(A_INT) + 2;
665 You_feel("like a scarecrow.");
667 You("
\82©
\82©
\82µ
\82Ì
\82æ
\82¤
\82È
\8bC
\8e\9d\82ª
\82µ
\82½
\81D");
669 give_nutrit = TRUE; /* in case a conflicted pet is doing this */
670 exercise(A_WIS, FALSE);
671 /* caller handles Int and memory loss */
675 * monster mind flayer is eating another monster's brain
680 pline("%s doesn't notice.", Monnam(mdef));
682 pline("%s
\82Í
\8bC
\82Ã
\82¢
\82Ä
\82¢
\82È
\82¢
\81D", Monnam(mdef));
684 } else if (is_rider(pd)) {
687 result = MM_AGR_DIED;
688 /* Rider takes extra damage regardless of whether attacker dies */
693 if (*dmg_p >= mdef->mhp && visflag)
695 pline("%s last thought fades away...",
697 pline("%s
\82Ì
\8dÅ
\8cã
\82Ì
\8ev
\82¢
\82ª
\82æ
\82¬
\82é
\81D
\81D
\81D",
698 s_suffix(Monnam(mdef)));
702 if (give_nutrit && magr->mtame && !magr->isminion) {
703 EDOG(magr)->hungrytime += rnd(60);
710 /* eating a corpse or egg of one's own species is usually naughty */
712 maybe_cannibal(pm, allowmsg)
716 static NEARDATA long ate_brains = 0L;
717 struct permonst *fptr = &mons[pm]; /* food type */
719 /* when poly'd into a mind flayer, multiple tentacle hits in one
720 turn cause multiple digestion checks to occur; avoid giving
721 multiple luck penalties for the same attack */
722 if (moves == ate_brains)
724 ate_brains = moves; /* ate_anything, not just brains... */
726 if (!CANNIBAL_ALLOWED()
727 /* non-cannibalistic heroes shouldn't eat own species ever
728 and also shouldn't eat current species when polymorphed
729 (even if having the form of something which doesn't care
730 about cannibalism--hero's innate traits aren't altered) */
731 && (your_race(fptr) || (Upolyd && same_race(youmonst.data, fptr)))) {
733 if (Upolyd && your_race(fptr))
735 You("have a bad feeling deep inside.");
737 You("
\8c\99\88«
\8a´
\82É
\82¨
\82»
\82í
\82ê
\82½
\81D");
739 You("cannibal! You will regret this!");
741 pline("
\8b¤
\8bò
\82¢
\82¾
\81I
\8cã
\89÷
\82·
\82é
\82¼
\81I");
743 HAggravate_monster |= FROMOUTSIDE;
744 change_luck(-rn1(4, 2)); /* -5..-2 */
754 (void) maybe_cannibal(pm, TRUE);
755 if (flesh_petrifies(&mons[pm])) {
756 if (!Stone_resistance
757 && !(poly_when_stoned(youmonst.data)
758 && polymon(PM_STONE_GOLEM))) {
760 Sprintf(killer.name, "tasting %s meat", mons[pm].mname);
762 Sprintf(killer.name, "%s
\82Ì
\93÷
\82ð
\90H
\82×", mons[pm].mname);
763 killer.format = KILLED_BY;
765 You("turn to stone.");
767 You("
\90Î
\82É
\82È
\82Á
\82½
\81D");
769 if (context.victual.piece)
770 context.victual.eating = FALSE;
771 return; /* lifesaved */
782 /* cannibals are allowed to eat domestic animals without penalty */
783 if (!CANNIBAL_ALLOWED()) {
785 You_feel("that eating the %s was a bad idea.", mons[pm].mname);
787 pline("%s
\82ð
\90H
\82×
\82é
\82Ì
\82Í
\82æ
\82
\82È
\82¢
\8bC
\82ª
\82µ
\82½
\81D", mons[pm].mname);
788 HAggravate_monster |= FROMOUTSIDE;
799 pline("Eating that is instantly fatal.");
801 pline("
\90H
\82×
\82½
\82ç
\82·
\82®
\82É
\8e\80\82ñ
\82Å
\82µ
\82Ü
\82Á
\82½
\81D");
803 Sprintf(killer.name, "unwisely ate the body of %s", mons[pm].mname);
804 killer.format = NO_KILLER_PREFIX;
806 Sprintf(killer.name, "
\8bð
\82©
\82É
\82à%s
\82Ì
\91Ì
\82ð
\90H
\82×
\82Ä", mons[pm].mname);
807 killer.format = KILLED_BY;
810 /* life-saving needed to reach here */
811 exercise(A_WIS, FALSE);
812 /* It so happens that since we know these monsters */
813 /* cannot appear in tins, context.victual.piece will always */
814 /* be what we want, which is not generally true. */
815 if (revive_corpse(context.victual.piece)) {
816 context.victual.piece = (struct obj *) 0;
817 context.victual.o_id = 0;
822 if (!Slimed && !Unchanging && !slimeproof(youmonst.data)) {
824 You("don't feel very well.");
826 You("
\82·
\82²
\82
\8bC
\95ª
\82ª
\88«
\82¢
\81D");
827 make_slimed(10L, (char *) 0);
828 delayed_killer(SLIMED, KILLED_BY_AN, "");
832 if (acidic(&mons[pm]) && Stoned)
845 Sprintf(buf, "What a pity--you just ruined a future piece of %sart!",
846 ACURR(A_CHA) > 15 ? "fine " : "");
848 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",
849 ACURR(A_CHA) > 15 ? "
\8bM
\8fd
\82È" : "");
853 Strcpy(buf, "You feel limber!");
855 Strcpy(buf, "
\91Ì
\82ª
\93î
\82ç
\82©
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
856 make_stoned(0L, buf, 0, (char *) 0);
860 * If you add an intrinsic that can be gotten by eating a monster, add it
861 * to intrinsic_possible() and givit(). (It must already be in prop.h to
862 * be an intrinsic property.)
863 * It would be very easy to make the intrinsics not try to give you one
864 * that you already had by checking to see if you have it in
865 * intrinsic_possible() instead of givit(), but we're not that nice.
868 /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
870 intrinsic_possible(type, ptr)
872 register struct permonst *ptr;
877 #define ifdebugresist(Msg) \
883 #define ifdebugresist(Msg) /*empty*/
887 res = (ptr->mconveys & MR_FIRE) != 0;
888 ifdebugresist("can get fire resistance");
891 res = (ptr->mconveys & MR_SLEEP) != 0;
892 ifdebugresist("can get sleep resistance");
895 res = (ptr->mconveys & MR_COLD) != 0;
896 ifdebugresist("can get cold resistance");
899 res = (ptr->mconveys & MR_DISINT) != 0;
900 ifdebugresist("can get disintegration resistance");
902 case SHOCK_RES: /* shock (electricity) resistance */
903 res = (ptr->mconveys & MR_ELEC) != 0;
904 ifdebugresist("can get shock resistance");
907 res = (ptr->mconveys & MR_POISON) != 0;
908 ifdebugresist("can get poison resistance");
911 res = can_teleport(ptr);
912 ifdebugresist("can get teleport");
914 case TELEPORT_CONTROL:
915 res = control_teleport(ptr);
916 ifdebugresist("can get teleport control");
919 res = telepathic(ptr);
920 ifdebugresist("can get telepathy");
930 /* givit() tries to give you an intrinsic based on the monster's level
931 * and what type of intrinsic it is trying to give you.
936 register struct permonst *ptr;
940 debugpline1("Attempting to give intrinsic %d", type);
941 /* some intrinsics are easier to get than others */
944 if ((ptr == &mons[PM_KILLER_BEE] || ptr == &mons[PM_SCORPION])
953 case TELEPORT_CONTROL:
964 if (ptr->mlevel <= rn2(chance))
965 return; /* failed die roll */
969 debugpline0("Trying to give fire resistance");
970 if (!(HFire_resistance & FROMOUTSIDE)) {
972 You(Hallucination ? "be chillin'." : "feel a momentary chill.");
974 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");
975 HFire_resistance |= FROMOUTSIDE;
979 debugpline0("Trying to give sleep resistance");
980 if (!(HSleep_resistance & FROMOUTSIDE)) {
982 You_feel("wide awake.");
984 You("
\82Ï
\82Á
\82¿
\82è
\96Ú
\82ª
\82³
\82ß
\82½
\81D");
985 HSleep_resistance |= FROMOUTSIDE;
989 debugpline0("Trying to give cold resistance");
990 if (!(HCold_resistance & FROMOUTSIDE)) {
992 You_feel("full of hot air.");
994 You("
\94M
\95\97\82ð
\91S
\90g
\82É
\8a´
\82¶
\82½
\81D");
995 HCold_resistance |= FROMOUTSIDE;
999 debugpline0("Trying to give disintegration resistance");
1000 if (!(HDisint_resistance & FROMOUTSIDE)) {
1002 You_feel(Hallucination ? "totally together, man." : "very firm.");
1004 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");
1005 HDisint_resistance |= FROMOUTSIDE;
1008 case SHOCK_RES: /* shock (electricity) resistance */
1009 debugpline0("Trying to give shock resistance");
1010 if (!(HShock_resistance & FROMOUTSIDE)) {
1013 You_feel("grounded in reality.");
1015 You("
\8eÀ
\82Í
\83A
\81[
\83X
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
1018 Your("health currently feels amplified!");
1020 pline("
\8c\92\8dN
\82ª
\91\9d\95\9d\82³
\82ê
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
1021 HShock_resistance |= FROMOUTSIDE;
1025 debugpline0("Trying to give poison resistance");
1026 if (!(HPoison_resistance & FROMOUTSIDE)) {
1028 You_feel(Poison_resistance ? "especially healthy." : "healthy.");
1030 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");
1031 HPoison_resistance |= FROMOUTSIDE;
1035 debugpline0("Trying to give teleport");
1036 if (!(HTeleportation & FROMOUTSIDE)) {
1038 You_feel(Hallucination ? "diffuse." : "very jumpy.");
1040 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");
1041 HTeleportation |= FROMOUTSIDE;
1044 case TELEPORT_CONTROL:
1045 debugpline0("Trying to give teleport control");
1046 if (!(HTeleport_control & FROMOUTSIDE)) {
1048 You_feel(Hallucination ? "centered in your personal space."
1049 : "in control of yourself.");
1051 You_feel(Hallucination ? "
\8e©
\8cÈ
\92\86\90S
\93I
\82É
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D"
1052 : "
\8e©
\95ª
\8e©
\90g
\82ð
\90§
\8cä
\82Å
\82«
\82é
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
1054 HTeleport_control |= FROMOUTSIDE;
1058 debugpline0("Trying to give telepathy");
1059 if (!(HTelepat & FROMOUTSIDE)) {
1061 You_feel(Hallucination ? "in touch with the cosmos."
1062 : "a strange mental acuity.");
1064 You_feel(Hallucination ? "
\89F
\92\88\82Ì
\90_
\94é
\82É
\90G
\82ê
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D"
1065 : "
\8aï
\96
\82È
\90¸
\90_
\93I
\89s
\82³
\82ð
\8a´
\82¶
\82½
\81D");
1067 HTelepat |= FROMOUTSIDE;
1068 /* If blind, make sure monsters show up. */
1074 debugpline0("Tried to give an impossible intrinsic");
1079 /* called after completely consuming a corpse */
1084 register int tmp = 0;
1085 boolean catch_lycanthropy = FALSE;
1087 /* in case `afternmv' didn't get called for previously mimicking
1088 gold, clean up now to avoid `eatmbuf' memory leak */
1094 /* MRKR: "eye of newt" may give small magical energy boost */
1095 if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
1096 int old_uen = u.uen;
1098 if (u.uen > u.uenmax) {
1103 if (old_uen != u.uen) {
1105 You_feel("a mild buzz.");
1107 You("
\82·
\82±
\82µ
\82Ó
\82ç
\82Ó
\82ç
\82µ
\82½
\81D");
1115 case PM_HUMAN_WERERAT:
1116 catch_lycanthropy = TRUE;
1117 u.ulycn = PM_WERERAT;
1119 case PM_HUMAN_WEREJACKAL:
1120 catch_lycanthropy = TRUE;
1121 u.ulycn = PM_WEREJACKAL;
1123 case PM_HUMAN_WEREWOLF:
1124 catch_lycanthropy = TRUE;
1125 u.ulycn = PM_WEREWOLF;
1136 set_itimeout(&HInvis, (long) rn1(100, 50));
1137 if (!Blind && !BInvis)
1138 self_invis_message();
1140 if (!(HInvis & INTRINSIC))
1142 You_feel("hidden!");
1144 Your("
\8ep
\82Í
\89B
\82³
\82ê
\82½
\81I");
1145 HInvis |= FROMOUTSIDE;
1146 HSee_invisible |= FROMOUTSIDE;
1150 case PM_YELLOW_LIGHT:
1152 make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1155 make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1157 case PM_GIANT_MIMIC:
1160 case PM_LARGE_MIMIC:
1163 case PM_SMALL_MIMIC:
1165 if (youmonst.data->mlet != S_MIMIC && !Unchanging) {
1168 u.uconduct.polyselfs++; /* you're changing form */
1170 You_cant("resist the temptation to mimic %s.",
1171 Hallucination ? "an orange" : "a pile of gold");
1173 You("%s
\82ð
\90^
\8e\97\82µ
\82½
\82¢
\97U
\98f
\82É
\82©
\82ç
\82ê
\82½
\81D",
1174 Hallucination ? "
\83I
\83\8c\83\93\83W" : "
\8bà
\89Ý
\82Ì
\8eR");
1176 /* A pile of gold can't ride. */
1178 dismount_steed(DISMOUNT_FELL);
1181 multi_reason = "pretending to be a pile of gold";
1183 multi_reason = "
\8bà
\89Ý
\82Ì
\8eR
\82Ì
\90^
\8e\97\82ð
\82µ
\82Ä
\82¢
\82é
\8e\9e\82É";
1187 ? "You suddenly dread being peeled and mimic %s again!"
1189 ? "
\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"
1191 : "You now prefer mimicking %s again.",
1193 : "
\82±
\82ñ
\82Ç
\82Í
\82Ü
\82½%s
\82Ì
\90^
\8e\97\82ª
\82µ
\82½
\82
\82È
\82Á
\82½
\81D",
1194 an(Upolyd ? youmonst.data->mname : urace.noun));
1195 eatmbuf = dupstr(buf);
1196 nomovemsg = eatmbuf;
1197 afternmv = eatmdone;
1198 /* ??? what if this was set before? */
1199 youmonst.m_ap_type = M_AP_OBJECT;
1200 youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE;
1203 /* make gold symbol show up now */
1204 display_nhwindow(WIN_MAP, TRUE);
1207 case PM_QUANTUM_MECHANIC:
1209 Your("velocity suddenly seems very uncertain!");
1211 Your("
\91¬
\93x
\82ª
\93Ë
\91R
\81C
\95s
\8am
\92è
\82É
\82È
\82Á
\82½
\81I");
1212 if (HFast & INTRINSIC) {
1213 HFast &= ~INTRINSIC;
1215 You("seem slower.");
1217 You("
\92x
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D");
1219 HFast |= FROMOUTSIDE;
1221 You("seem faster.");
1223 You("
\91¬
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D");
1227 if ((HStun & TIMEOUT) > 2)
1228 make_stunned(2L, FALSE);
1229 if ((HConfusion & TIMEOUT) > 2)
1230 make_confused(2L, FALSE);
1233 case PM_DOPPELGANGER:
1234 case PM_SANDESTIN: /* moot--they don't leave corpses */
1237 You_feel("momentarily different."); /* same as poly trap */
1239 You_feel("
\88ê
\8fu
\88á
\82Á
\82½
\8a´
\82¶
\82ª
\82µ
\82½
\81D"); /* same as poly trap */
1243 You_feel("a change coming over you.");
1245 pline("
\95Ï
\89»
\82ª
\96K
\82ê
\82½
\81D");
1249 case PM_DISENCHANTER:
1250 /* picks an intrinsic at random and removes it; there's
1251 no feedback if hero already lacks the chosen ability */
1252 debugpline0("using attrcurse to strip an intrinsic");
1255 case PM_MIND_FLAYER:
1256 case PM_MASTER_MIND_FLAYER:
1257 if (ABASE(A_INT) < ATTRMAX(A_INT)) {
1260 pline("Yum! That was real brain food!");
1262 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");
1263 (void) adjattrib(A_INT, 1, FALSE);
1264 break; /* don't give them telepathy, too */
1268 pline("For some reason, that tasted bland.");
1270 pline("
\82Ç
\82¤
\82µ
\82½
\82í
\82¯
\82©
\81C
\92W
\94\92\82È
\96¡
\82¾
\81D");
1274 struct permonst *ptr = &mons[pm];
1275 boolean conveys_STR = is_giant(ptr);
1278 if (dmgtype(ptr, AD_STUN) || dmgtype(ptr, AD_HALU)
1279 || pm == PM_VIOLET_FUNGUS) {
1281 pline("Oh wow! Great stuff!");
1283 pline("
\83\8f\81[
\83H
\81I
\82±
\82è
\82á
\82·
\82²
\82¢
\81I");
1284 (void) make_hallucinated((HHallucination & TIMEOUT) + 200L, FALSE,
1288 /* Check the monster for all of the intrinsics. If this
1289 * monster can give more than one, pick one to try to give
1290 * from among all it can give.
1292 * Strength from giants is now treated like an intrinsic
1293 * rather than being given unconditionally.
1295 count = 0; /* number of possible intrinsics */
1296 tmp = 0; /* which one we will try to give */
1299 tmp = -1; /* use -1 as fake prop index for STR */
1300 debugpline1("\"Intrinsic\" strength, %d", tmp);
1302 for (i = 1; i <= LAST_PROP; i++) {
1303 if (!intrinsic_possible(i, ptr))
1306 /* a 1 in count chance of replacing the old choice
1307 with this one, and a count-1 in count chance
1308 of keeping the old choice (note that 1 in 1 and
1309 0 in 1 are what we want for the first candidate) */
1311 debugpline2("Intrinsic %d replacing %d", i, tmp);
1315 /* if strength is the only candidate, give it 50% chance */
1316 if (conveys_STR && count == 1 && !rn2(2))
1318 /* if something was chosen, give it now (givit() might fail) */
1320 gainstr((struct obj *) 0, 0, TRUE);
1326 if (catch_lycanthropy)
1327 retouch_equipment(2);
1333 violated_vegetarian()
1335 u.uconduct.unvegetarian++;
1336 if (Role_if(PM_MONK)) {
1338 You_feel("guilty.");
1340 pline("
\8dß
\82ð
\8a´
\82¶
\82½
\81D");
1346 /* common code to check and possibly charge for 1 context.tin.tin,
1347 * will split() context.tin.tin if necessary */
1349 costly_tin(alter_type)
1350 int alter_type; /* COST_xxx */
1352 struct obj *tin = context.tin.tin;
1354 if (carried(tin) ? tin->unpaid
1355 : (costly_spot(tin->ox, tin->oy) && !tin->no_charge)) {
1356 if (tin->quan > 1L) {
1357 tin = context.tin.tin = splitobj(tin, 1L);
1358 context.tin.o_id = tin->o_id;
1360 costly_alteration(tin, alter_type);
1365 tin_variety_txt(s, tinvariety)
1371 if (s && tinvariety) {
1373 for (k = 0; k < TTSZ - 1; ++k) {
1374 l = (int) strlen(tintxts[k].txt);
1375 if (!strncmpi(s, tintxts[k].txt, l) && ((int) strlen(s) > l)
1386 * This assumes that buf already contains the word "tin",
1387 * as is the case with caller xname().
1389 /*JP:
\81u
\8aÊ
\8bl
\81v
\82Í
\8cã
\82Å
\95t
\82¯
\82é */
1391 tin_details(obj, mnum, buf)
1397 int r = tin_variety(obj, TRUE);
1400 if (r == SPINACH_TIN)
1402 Strcat(buf, " of spinach");
1404 Strcat(buf, "
\83z
\83E
\83\8c\83\93\91\90\82Ì");
1405 else if (mnum == NON_PM)
1407 Strcpy(buf, "empty tin");
1409 Strcat(buf, "
\8bó
\82Á
\82Û
\82Ì");
1411 #if 0 /*JP*//*
\93ú
\96{
\8cê
\82Í
\8cã
\82Å*/
1412 if ((obj->cknown || iflags.override_ID) && obj->spe < 0) {
1413 if (r == ROTTEN_TIN || r == HOMEMADE_TIN) {
1414 /* put these before the word tin */
1415 Sprintf(buf2, "%s %s of ", tintxts[r].txt, buf);
1418 Sprintf(eos(buf), " of %s ", tintxts[r].txt);
1420 Sprintf(eos(buf), "%s", tintxts[r].txt);
1422 Strcpy(eos(buf), " of ");
1425 #if 1 /*JP*//*
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u*/
1426 if (strstr(tintxts[r].txt, "
\82Ì") != tintxts[r].txt) {
1427 Strcpy(eos(buf), tintxts[r].txt);
1430 if (vegetarian(&mons[mnum]))
1432 Sprintf(eos(buf), "%s", mons[mnum].mname);
1434 Sprintf(eos(buf), "%s", mons[mnum].mname);
1437 Sprintf(eos(buf), "%s meat", mons[mnum].mname);
1439 Sprintf(eos(buf), "%s
\82Ì
\93÷", mons[mnum].mname);
1440 #if 1 /*JP*//*
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u*/
1441 if (strstr(tintxts[r].txt, "
\82Ì") == tintxts[r].txt) {
1442 Strcpy(eos(buf), tintxts[r].txt);
1444 Strcpy(eos(buf), "
\82Ì");
1451 set_tin_variety(obj, forcetype)
1457 if (forcetype == SPINACH_TIN
1458 || (forcetype == HEALTHY_TIN
1459 && (obj->corpsenm == NON_PM /* empty or already spinach */
1460 || !vegetarian(&mons[obj->corpsenm])))) { /* replace meat */
1461 obj->corpsenm = NON_PM; /* not based on any monster */
1462 obj->spe = 1; /* spinach */
1464 } else if (forcetype == HEALTHY_TIN) {
1465 r = tin_variety(obj, FALSE);
1466 if (r < 0 || r >= TTSZ)
1467 r = ROTTEN_TIN; /* shouldn't happen */
1468 while ((r == ROTTEN_TIN && !obj->cursed) || !tintxts[r].fodder)
1470 } else if (forcetype >= 0 && forcetype < TTSZ - 1) {
1472 } else { /* RANDOM_TIN */
1473 r = rn2(TTSZ - 1); /* take your pick */
1474 if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1475 r = HOMEMADE_TIN; /* lizards don't rot */
1477 obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
1481 tin_variety(obj, disp)
1483 boolean disp; /* we're just displaying so leave things alone */
1487 if (obj->spe == 1) {
1489 } else if (obj->cursed) {
1490 r = ROTTEN_TIN; /* always rotten if cursed */
1491 } else if (obj->spe < 0) {
1493 --r; /* get rid of the offset */
1497 if (!disp && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
1498 r = ROTTEN_TIN; /* some homemade tins go bad */
1500 if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1501 r = HOMEMADE_TIN; /* lizards don't rot */
1511 struct obj *tin = context.tin.tin;
1513 r = tin_variety(tin, FALSE);
1514 if (tin->otrapped || (tin->cursed && r != HOMEMADE_TIN && !rn2(8))) {
1516 b_trapped("tin", 0);
1518 b_trapped("
\8aÊ", 0);
1519 costly_tin(COST_DSTROY);
1523 pline1(mesg); /* "You succeed in opening the tin." */
1525 if (r != SPINACH_TIN) {
1526 mnum = tin->corpsenm;
1527 if (mnum == NON_PM) {
1529 pline("It turns out to be empty.");
1531 pline("
\8aÊ
\82Í
\8bó
\82Á
\82Û
\82¾
\82Á
\82½
\81D");
1532 tin->dknown = tin->known = 1;
1533 costly_tin(COST_OPEN);
1537 which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */
1538 if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
1539 && (Stone_resistance || Hallucination)) {
1544 which = 1; /* suppress pluralization */
1545 } else if (Hallucination) {
1546 what = rndmonnam(NULL);
1548 what = mons[mnum].mname;
1549 if (the_unique_pm(&mons[mnum]))
1551 else if (type_is_pname(&mons[mnum]))
1555 what = makeplural(what);
1556 else if (which == 2)
1560 pline("It smells like %s.", what);
1562 pline("%s
\82Ì
\82æ
\82¤
\82È
\93õ
\82¢
\82ª
\82µ
\82½
\81D", what);
1564 if (yn("Eat it?") == 'n') {
1566 if (yn("
\90H
\82×
\82Ü
\82·
\82©
\81H") == 'n') {
1569 You("discard the open tin.");
1571 You("
\8aJ
\82¯
\82½
\8aÊ
\82ð
\8eÌ
\82Ä
\82½
\81D");
1573 tin->dknown = tin->known = 1;
1574 costly_tin(COST_OPEN);
1578 /* in case stop_occupation() was called on previous meal */
1579 context.victual.piece = (struct obj *) 0;
1580 context.victual.o_id = 0;
1581 context.victual.fullwarn = context.victual.eating =
1582 context.victual.doreset = FALSE;
1585 You("consume %s %s.", tintxts[r].txt, mons[mnum].mname);
1586 #else /*JP:
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u */
1587 if (strstr(tintxts[r].txt, "
\82Ì") == tintxts[r].txt) {
1588 You("%s%s
\82Ì
\8aÊ
\8bl
\82ð
\82½
\82¢
\82ç
\82°
\82½
\81D", mons[mnum].mname, tintxts[r].txt);
1590 You("%s%s
\82Ì
\8aÊ
\8bl
\82ð
\82½
\82¢
\82ç
\82°
\82½
\81D", tintxts[r].txt, mons[mnum].mname);
1594 eating_conducts(&mons[mnum]);
1596 tin->dknown = tin->known = 1;
1600 /* charge for one at pre-eating cost */
1601 costly_tin(COST_OPEN);
1603 if (tintxts[r].nut < 0) /* rotten */
1604 make_vomiting((long) rn1(15, 10), FALSE);
1606 lesshungry(tintxts[r].nut);
1608 if (tintxts[r].greasy) {
1609 /* Assume !Glib, because you can't open tins when Glib. */
1610 incr_itimeout(&Glib, rnd(15));
1612 pline("Eating %s food made your %s very slippery.",
1613 tintxts[r].txt, makeplural(body_part(FINGER)));
1615 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",
1620 } else { /* spinach... */
1623 pline("It contains some decaying%s%s substance.",
1624 Blind ? "" : " ", Blind ? "" : hcolor(NH_GREEN));
1626 pline("%s
\95\85\82Á
\82½
\95¨
\91Ì
\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\81D",
1627 Blind ? "" : hcolor(NH_GREEN));
1631 pline("It contains spinach.");
1633 pline("
\83z
\83E
\83\8c\83\93\91\90\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\81D");
1634 tin->dknown = tin->known = 1;
1638 if (yn("Eat it?") == 'n') {
1640 if (yn("
\90H
\82×
\82Ü
\82·
\82©
\81H") == 'n') {
1643 You("discard the open tin.");
1645 You("
\8aJ
\82¯
\82½
\8aÊ
\82ð
\8eÌ
\82Ä
\82½
\81D");
1646 costly_tin(COST_OPEN);
1651 * Same order as with non-spinach above:
1652 * conduct update, side-effects, shop handling, and nutrition.
1655 .food++; /* don't need vegan/vegetarian checks for spinach */
1658 pline("This makes you feel like %s!",
1659 Hallucination ? "Swee'pea" : "Popeye");
1661 pline("%s
\82Ì
\82æ
\82¤
\82È
\8bC
\95ª
\82É
\82È
\82Á
\82½
\81I",
1662 Hallucination ? "
\83X
\83C
\81[
\83s
\81[" : "
\83|
\83p
\83C");
1664 gainstr(tin, 0, FALSE);
1666 costly_tin(COST_OPEN);
1668 lesshungry(tin->blessed
1671 ? (400 + rnd(200)) /* uncursed */
1672 : (200 + rnd(400))); /* cursed */
1680 context.tin.tin = (struct obj *) 0;
1681 context.tin.o_id = 0;
1684 /* called during each move whilst opening a tin */
1688 /* perhaps it was stolen (although that should cause interruption) */
1689 if (!carried(context.tin.tin)
1690 && (!obj_here(context.tin.tin, u.ux, u.uy) || !can_reach_floor(TRUE)))
1691 return 0; /* %% probably we should use tinoid */
1692 if (context.tin.usedtime++ >= 50) {
1694 You("give up your attempt to open the tin.");
1696 You("
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82ð
\82 \82«
\82ç
\82ß
\82½
\81D");
1699 if (context.tin.usedtime < context.tin.reqtime)
1700 return 1; /* still busy */
1703 consume_tin("You succeed in opening the tin.");
1705 consume_tin("
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82É
\90¬
\8c÷
\82µ
\82½
\81D");
1709 /* called when starting to open a tin */
1714 const char *mesg = 0;
1717 if (metallivorous(youmonst.data)) {
1719 mesg = "You bite right into the metal tin...";
1721 mesg = "
\8bà
\91®
\82Ì
\8aÊ
\82ð
\8a\9a\82Ý
\82Í
\82¶
\82ß
\82½
\81D
\81D
\81D";
1723 } else if (cantwield(youmonst.data)) { /* nohands || verysmall */
1725 You("cannot handle the tin properly to open it.");
1727 You("
\8aÊ
\82ð
\82¤
\82Ü
\82
\8aJ
\82¯
\82ç
\82ê
\82È
\82¢
\81D");
1729 } else if (otmp->blessed) {
1730 /* 50/50 chance for immediate access vs 1 turn delay (unless
1731 wielding blessed tin opener which always yields immediate
1732 access); 1 turn delay case is non-deterministic: getting
1733 interrupted and retrying might yield another 1 turn delay
1734 or might open immediately on 2nd (or 3rd, 4th, ...) try */
1735 tmp = (uwep && uwep->blessed && uwep->otyp == TIN_OPENER) ? 0 : rn2(2);
1738 mesg = "The tin opens like magic!";
1740 mesg = "
\8aÊ
\82Í
\96\82\96@
\82Ì
\82æ
\82¤
\82É
\8aJ
\82¢
\82½
\81I";
1743 pline_The("tin seems easy to open.");
1745 pline_The("
\8aÊ
\82Í
\8aÈ
\92P
\82É
\8aJ
\82¯
\82ç
\82ê
\82»
\82¤
\82¾
\81D");
1747 switch (uwep->otyp) {
1750 mesg = "You easily open the tin."; /* iff tmp==0 */
1752 mesg = "
\82 \82È
\82½
\82Í
\8aÈ
\92P
\82É
\8aÊ
\82ð
\8aJ
\82¯
\82½
\81D"; /* iff tmp==0 */
1754 tmp = rn2(uwep->cursed ? 3 : !uwep->blessed ? 2 : 1);
1772 pline("Using %s you try to open the tin.", yobjnam(uwep, (char *) 0));
1774 You("%s
\82ð
\8eg
\82Á
\82Ä
\8aÊ
\82ð
\8aJ
\82¯
\82æ
\82¤
\82Æ
\82µ
\82½
\81D", xname(uwep));
1778 pline("It is not so easy to open this tin.");
1780 pline("
\82±
\82Ì
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82Í
\97e
\88Õ
\82È
\82±
\82Æ
\82Å
\82Í
\82È
\82¢
\81D");
1783 pline_The("tin slips from your %s.",
1785 pline("
\8aÊ
\82Í
\82 \82È
\82½
\82Ì%s
\82©
\82ç
\8a\8a\82è
\97\8e\82¿
\82½
\81D",
1786 makeplural(body_part(FINGER)));
1787 if (otmp->quan > 1L) {
1788 otmp = splitobj(otmp, 1L);
1796 tmp = rn1(1 + 500 / ((int) (ACURR(A_DEX) + ACURRSTR)), 10);
1799 context.tin.tin = otmp;
1800 context.tin.o_id = otmp->o_id;
1802 consume_tin(mesg); /* begin immediately */
1804 context.tin.reqtime = tmp;
1805 context.tin.usedtime = 0;
1807 set_occupation(opentin, "opening the tin", 0);
1809 set_occupation(opentin, "
\8aÊ
\82ð
\8aJ
\82¯
\82é", 0);
1814 /* called when waking up after fainting */
1816 Hear_again(VOID_ARGS)
1818 /* Chance of deafness going away while fainted/sleeping/etc. */
1820 make_deaf(0L, FALSE);
1824 /* called on the "first bite" of rotten food */
1830 pline("Blecch! Rotten %s!", foodword(obj));
1832 pline("
\83Q
\83F
\81I
\95\85\82Á
\82½%s
\82¾
\81I", foodword(obj));
1836 You_feel("rather trippy.");
1838 You("
\82Ö
\82ë
\82Ö
\82ë
\82µ
\82½
\81D");
1841 You_feel("rather %s.", body_part(LIGHT_HEADED));
1843 You("%s
\81D", body_part(LIGHT_HEADED));
1844 make_confused(HConfusion + d(2, 4), FALSE);
1845 } else if (!rn2(4) && !Blind) {
1847 pline("Everything suddenly goes dark.");
1849 pline("
\93Ë
\91R
\91S
\82Ä
\82ª
\88Ã
\82
\82È
\82Á
\82½
\81D");
1850 make_blinded((long) d(2, 10), FALSE);
1852 Your1(vision_clears);
1853 } else if (!rn2(3)) {
1854 const char *what, *where;
1855 int duration = rnd(10);
1859 what = "goes", where = "dark";
1861 what = "
\82È
\82Á
\82½", where = "
\88Ã
\88Å
\82É";
1862 else if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
1864 what = "you lose control of", where = "yourself";
1866 what = "
\90§
\8cä
\82Å
\82«
\82È
\82
\82È
\82Á
\82½", where = "
\8e©
\95ª
\82ð";
1869 what = "you slap against the",
1871 what = "
\82É
\82Ô
\82Â
\82©
\82Á
\82½",
1873 where = (u.usteed) ? "saddle" : surface(u.ux, u.uy);
1875 where = (u.usteed) ? "
\88Æ" : surface(u.ux, u.uy);
1877 pline_The("world spins and %s %s.", what, where);
1879 pline("
\90¢
\8aE
\82ª
\89ñ
\93]
\82µ
\81C%s%s
\81D", where, what);
1880 incr_itimeout(&HDeaf, duration);
1883 multi_reason = "unconscious from rotten food";
1885 multi_reason = "
\95\85\82Á
\82½
\90H
\82×
\95¨
\82Å
\88Ó
\8e¯
\82ð
\8e¸
\82Á
\82Ä
\82¢
\82é
\8aÔ
\82É";
1887 nomovemsg = "You are conscious again.";
1889 nomovemsg = "
\82 \82È
\82½
\82Í
\82Ü
\82½
\90³
\8bC
\82Ã
\82¢
\82½
\81D";
1890 afternmv = Hear_again;
1896 /* called when a corpse is selected as food */
1901 int tp = 0, mnum = otmp->corpsenm;
1904 boolean stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
1905 && !poly_when_stoned(youmonst.data));
1908 if (!vegan(&mons[mnum]))
1909 u.uconduct.unvegan++;
1910 if (!vegetarian(&mons[mnum]))
1911 violated_vegetarian();
1913 if (!nonrotting_corpse(mnum)) {
1914 long age = peek_at_iced_corpse_age(otmp);
1916 rotted = (monstermoves - age) / (10L + rn2(20));
1919 else if (otmp->blessed)
1923 if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
1924 boolean cannibal = maybe_cannibal(mnum, FALSE);
1927 pline("Ulch - that %s was tainted%s!",
1928 mons[mnum].mlet == S_FUNGUS
1929 ? "fungoid vegetation"
1930 : !vegetarian(&mons[mnum]) ? "meat" : "protoplasm",
1931 cannibal ? ", you cannibal" : "");
1933 pline("
\83I
\83F
\81I
\82±
\82Ì%s
\82Í
\95\85\82Á
\82Ä
\82¢
\82é%s
\81I",
1934 mons[mnum].mlet == S_FUNGUS
1935 ? "
\8d×
\8bÛ
\82É
\89\98\90õ
\82³
\82ê
\82½
\90A
\95¨"
1936 : !vegetarian(&mons[mnum]) ? "
\93÷" : "
\90¶
\95¨",
1937 cannibal ? "
\81D
\82µ
\82©
\82à
\8b¤
\90H
\82¢
\82¾" : "");
1939 if (Sick_resistance) {
1941 pline("It doesn't seem at all sickening, though...");
1943 pline("
\82µ
\82©
\82µ
\81C
\82¢
\82½
\82Á
\82Ä
\8c³
\8bC
\82¾
\81D
\81D
\81D");
1947 sick_time = (long) rn1(10, 10);
1948 /* make sure new ill doesn't result in improvement */
1949 if (Sick && (sick_time > Sick))
1950 sick_time = (Sick > 1L) ? Sick - 1L : 1L;
1952 make_sick(sick_time, corpse_xname(otmp, "rotted", CXN_NORMAL),
1953 TRUE, SICK_VOMITABLE);
1955 make_sick(sick_time, corpse_xname(otmp, "
\95\85\82Á
\82½", CXN_NORMAL),
1956 TRUE, SICK_VOMITABLE);
1964 } else if (acidic(&mons[mnum]) && !Acid_resistance) {
1967 You("have a very bad case of stomach acid."); /* not body_part() */
1969 pline("
\88Ý
\8e_
\82Ì
\92²
\8eq
\82ª
\82Æ
\82Ä
\82à
\88«
\82¢
\81D");
1972 losehp(rnd(15), "acidic corpse", KILLED_BY_AN); /* acid damage */
1974 losehp(rnd(15), "
\8e_
\82Ì
\8e\80\91Ì
\82Å", KILLED_BY_AN);
1976 } else if (poisonous(&mons[mnum]) && rn2(5)) {
1979 pline("Ecch - that must have been poisonous!");
1981 pline("
\83E
\83Q
\83F
\81[
\81C
\97L
\93Å
\82¾
\82Á
\82½
\82É
\82¿
\82ª
\82¢
\82È
\82¢
\81I");
1982 if (!Poison_resistance) {
1985 losehp(rnd(15), "poisonous corpse", KILLED_BY_AN);
1987 losehp(rnd(15), "
\93Å
\82Ì
\8e\80\91Ì
\82Å", KILLED_BY_AN);
1990 You("seem unaffected by the poison.");
1992 You("
\93Å
\82Ì
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
1993 /* now any corpse left too long will make you mildly ill */
1994 } else if ((rotted > 5L || (rotted > 3L && rn2(5))) && !Sick_resistance) {
1997 You_feel("%ssick.", (Sick) ? "very " : "");
1999 You("%s
\8bC
\95ª
\82ª
\88«
\82¢
\81D", (Sick) ? "
\82Æ
\82Ä
\82à" : "");
2001 losehp(rnd(8), "cadaver", KILLED_BY_AN);
2003 losehp(rnd(8), "
\95\85\97\90\8e\80\91Ì
\82Å", KILLED_BY_AN);
2006 /* delay is weight dependent */
2007 context.victual.reqtime = 3 + (mons[mnum].cwt >> 6);
2009 if (!tp && !nonrotting_corpse(mnum) && (otmp->orotten || !rn2(7))) {
2010 if (rottenfood(otmp)) {
2011 otmp->orotten = TRUE;
2012 (void) touchfood(otmp);
2016 if (!mons[otmp->corpsenm].cnutrit) {
2017 /* no nutrition: rots away, no message if you passed out */
2020 pline_The("corpse rots away completely.");
2022 pline("
\8e\80\91Ì
\82Í
\8a®
\91S
\82É
\95\85\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
2031 consume_oeaten(otmp, 2); /* oeaten >>= 2 */
2032 } else if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
2033 && (Stone_resistance || Hallucination)) {
2035 pline("This tastes just like chicken!");
2037 pline("
\82±
\82ê
\82Í
\8c{
\93÷
\82Ì
\96¡
\82¾
\81I");
2038 } else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) {
2040 You("peck the eyeball with delight.");
2042 You("
\96Ú
\8bÊ
\82ð
\82Â
\82ñ
\82Â
\82ñ
\82Â
\82Â
\82¢
\82½
\81D");
2044 /* [is this right? omnivores end up always disliking the taste] */
2045 boolean yummy = vegan(&mons[mnum])
2046 ? (!carnivorous(youmonst.data)
2047 && herbivorous(youmonst.data))
2048 : (carnivorous(youmonst.data)
2049 && !herbivorous(youmonst.data));
2053 type_is_pname(&mons[mnum])
2054 ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
2055 food_xname(otmp, FALSE),
2057 ? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
2060 : (yummy ? "is delicious" : "tastes terrible"));
2062 pline("
\82±
\82Ì%s
\82Í%s
\81I",
2063 food_xname(otmp, FALSE),
2065 ? (yummy ? ((u.umonnum == PM_TIGER) ? "
\83O
\83D
\83\8c\83C
\83g
\83D"
2066 : "
\83C
\83P
\82Ä
\82é")
2067 : "
\83C
\83P
\82Ä
\82È
\82¢")
2068 : (yummy ? "
\82Æ
\82Ä
\82à
\8e|
\82¢" : "
\82Ð
\82Ç
\82¢
\96¡
\82¾"));
2075 /* called as you start to eat */
2080 const char *old_nomovemsg, *save_nomovemsg;
2082 debugpline2("start_eating: %lx (victual = %lx)", (unsigned long) otmp,
2083 (unsigned long) context.victual.piece);
2084 debugpline1("reqtime = %d", context.victual.reqtime);
2085 debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
2086 debugpline1("nmod = %d", context.victual.nmod);
2087 debugpline1("oeaten = %d", otmp->oeaten);
2088 context.victual.fullwarn = context.victual.doreset = FALSE;
2089 context.victual.eating = TRUE;
2091 if (otmp->otyp == CORPSE || otmp->globby) {
2092 cprefx(context.victual.piece->corpsenm);
2093 if (!context.victual.piece || !context.victual.eating) {
2094 /* rider revived, or died and lifesaved */
2099 old_nomovemsg = nomovemsg;
2101 /* survived choking, finish off food that's nearly done;
2102 need this to handle cockatrice eggs, fortune cookies, etc */
2103 if (++context.victual.usedtime >= context.victual.reqtime) {
2104 /* don't want done_eating() to issue nomovemsg if it
2105 is due to vomit() called by bite() */
2106 save_nomovemsg = nomovemsg;
2111 nomovemsg = save_nomovemsg;
2116 if (++context.victual.usedtime >= context.victual.reqtime) {
2117 /* print "finish eating" message if they just resumed -dlc */
2118 done_eating(context.victual.reqtime > 1 ? TRUE : FALSE);
2123 Sprintf(msgbuf, "eating %s", food_xname(otmp, TRUE));
2125 Sprintf(msgbuf, "%s
\82ð
\90H
\82×
\82é", food_xname(otmp, TRUE));
2126 set_occupation(eatfood, msgbuf, 0);
2130 * called on "first bite" of (non-corpse) food.
2131 * used for non-rotten non-tin non-corpse food
2137 switch (otmp->otyp) {
2139 if (u.uhunger <= 200)
2141 pline(Hallucination ? "Oh wow, like, superior, man!"
2143 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"
2145 : "That food really hit the spot!");
2147 : "
\82±
\82Ì
\90H
\82×
\95¨
\82Í
\96{
\93\96\82É
\90\
\82µ
\95ª
\82È
\82¢
\81I");
2148 else if (u.uhunger <= 700)
2150 pline("That satiated your %s!", body_part(STOMACH));
2152 pline("
\96\9e\95 \82É
\82È
\82Á
\82½
\81I");
2155 if (carnivorous(youmonst.data) && !humanoid(youmonst.data))
2157 pline("That tripe ration was surprisingly good!");
2159 pline("
\82±
\82Ì
\83\82\83c
\93÷
\82Í
\82¨
\82Ç
\82ë
\82
\82Ù
\82Ç
\8e|
\82¢
\81I");
2160 else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC)))
2162 pline(Hallucination ? "Tastes great! Less filling!"
2164 pline(Hallucination ? "
\82¤
\82Ü
\82¢
\81I
\82à
\82Á
\82Æ
\82Ù
\82µ
\82
\82È
\82é
\82Ë
\81I"
2166 : "Mmm, tripe... not bad!");
2168 : "
\82ñ
\81[
\81C
\83\82\83c
\82©
\81D
\81D
\81D
\88«
\82
\82È
\82¢
\81I");
2171 pline("Yak - dog food!");
2173 pline("
\82¤
\82°
\81C
\83h
\83b
\83O
\83t
\81[
\83h
\82¾
\81I");
2174 more_experienced(1, 0);
2176 /* not cannibalism, but we use similar criteria
2177 for deciding whether to be sickened by this meal */
2178 if (rn2(2) && !CANNIBAL_ALLOWED())
2179 make_vomiting((long) rn1(context.victual.reqtime, 14), FALSE);
2184 case HUGE_CHUNK_OF_MEAT:
2187 case CLOVE_OF_GARLIC:
2188 if (is_undead(youmonst.data)) {
2189 make_vomiting((long) rn1(context.victual.reqtime, 5), FALSE);
2194 if (otmp->otyp == SLIME_MOLD && !otmp->cursed
2195 && otmp->spe == context.current_fruit) {
2197 pline("My, that was a %s %s!",
2198 Hallucination ? "primo" : "yummy",
2199 singular(otmp, xname));
2201 pline("
\82¨
\82â
\81C
\82È
\82ñ
\82Ä%s%s
\82¾
\81I",
2202 Hallucination ? "
\8fã
\95i
\82È" : "
\82¨
\82¢
\82µ
\82¢",
2203 singular(otmp, xname));
2205 } else if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2206 ; /* skip core joke; feedback deferred til fpostfx() */
2208 #if defined(MAC) || defined(MACOSX)
2209 /* KMH -- Why should Unix have all the fun?
2210 We check MACOSX before UNIX to get the Apple-specific apple
2211 message; the '#if UNIX' code will still kick in for pear. */
2212 } else if (otmp->otyp == APPLE) {
2214 pline("Delicious! Must be a Macintosh!");
2216 pline("
\82·
\82Î
\82ç
\82µ
\82¢
\81I
\83}
\83b
\83L
\83\93\83g
\83b
\83V
\83\85\82É
\88á
\82¢
\82È
\82¢
\81I");
2220 } else if (otmp->otyp == APPLE || otmp->otyp == PEAR) {
2221 if (!Hallucination) {
2222 pline("Core dumped.");
2224 /* This is based on an old Usenet joke, a fake a.out manual
2229 pline("%s -- core dumped.",
2231 ? "Segmentation fault"
2237 } else if (otmp->otyp == EGG && stale_egg(otmp)) {
2239 pline("Ugh. Rotten egg."); /* perhaps others like it */
2241 pline("
\83E
\83Q
\83F
\81[
\95\85\82Á
\82½
\97\91\82¾
\81D");
2243 make_vomiting((Vomiting & TIMEOUT) + (long) d(10, 4), TRUE);
2247 pline("This %s is %s", singular(otmp, xname),
2249 ? (Hallucination ? "grody!" : "terrible!")
2250 : (otmp->otyp == CRAM_RATION
2251 || otmp->otyp == K_RATION
2252 || otmp->otyp == C_RATION)
2254 : Hallucination ? "gnarly!" : "delicious!");
2256 pline("
\82±
\82Ì%s
\82Í%s", singular(otmp, xname),
2258 ? (Hallucination ? "
\83C
\83P
\82Ä
\82È
\82¢
\81I" : "
\82Ð
\82Ç
\82¢
\96¡
\82¾
\81I")
2259 : (otmp->otyp == CRAM_RATION
2260 || otmp->otyp == K_RATION
2261 || otmp->otyp == C_RATION)
2262 ? "
\96¡
\8bC
\82È
\82¢
\81D"
2263 : Hallucination ? "
\83C
\83P
\82Ä
\82é
\81I" : "
\82¤
\82Ü
\82¢
\81I");
2266 break; /* default */
2270 /* increment a combat intrinsic with limits on its growth */
2272 bounded_increase(old, inc, typ)
2275 int absold, absinc, sgnold, sgninc;
2277 /* don't include any amount coming from worn rings */
2278 if (uright && uright->otyp == typ)
2280 if (uleft && uleft->otyp == typ)
2282 absold = abs(old), absinc = abs(inc);
2283 sgnold = sgn(old), sgninc = sgn(inc);
2285 if (absinc == 0 || sgnold != sgninc || absold + absinc < 10) {
2286 ; /* use inc as-is */
2287 } else if (absold + absinc < 20) {
2288 absinc = rnd(absinc); /* 1..n */
2289 if (absold + absinc < 10)
2290 absinc = 10 - absold;
2291 inc = sgninc * absinc;
2292 } else if (absold + absinc < 40) {
2293 absinc = rn2(absinc) ? 1 : 0;
2294 if (absold + absinc < 20)
2295 absinc = rnd(20 - absold);
2296 inc = sgninc * absinc;
2298 inc = 0; /* no further increase allowed via this method */
2304 accessory_has_effect(otmp)
2308 pline("Magic spreads through your body as you digest the %s.",
2309 otmp->oclass == RING_CLASS ? "ring" : "amulet");
2311 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",
2312 otmp->oclass == RING_CLASS ? "
\8ew
\97Ö" : "
\96\82\8f\9c\82¯");
2320 int typ = otmp->otyp;
2323 /* Note: rings are not so common that this is unbalancing. */
2324 /* (How often do you even _find_ 3 rings of polymorph in a game?) */
2325 oldprop = u.uprops[objects[typ].oc_oprop].intrinsic;
2326 if (otmp == uleft || otmp == uright) {
2329 return; /* died from sink fall */
2331 otmp->known = otmp->dknown = 1; /* by taste */
2332 if (!rn2(otmp->oclass == RING_CLASS ? 3 : 5)) {
2333 switch (otmp->otyp) {
2335 if (!objects[typ].oc_oprop)
2336 break; /* should never happen */
2338 if (!(u.uprops[objects[typ].oc_oprop].intrinsic & FROMOUTSIDE))
2339 accessory_has_effect(otmp);
2341 u.uprops[objects[typ].oc_oprop].intrinsic |= FROMOUTSIDE;
2344 case RIN_SEE_INVISIBLE:
2345 set_mimic_blocking();
2347 if (Invis && !oldprop && !ESee_invisible
2348 && !perceives(youmonst.data) && !Blind) {
2351 pline("Suddenly you can see yourself.");
2353 pline("
\93Ë
\91R
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81D");
2357 case RIN_INVISIBILITY:
2358 if (!oldprop && !EInvis && !BInvis && !See_invisible
2362 Your("body takes on a %s transparency...",
2363 Hallucination ? "normal" : "strange");
2365 pline("%s
\82 \82È
\82½
\82Ì
\91Ì
\82Í
\93§
\89ß
\90«
\82ð
\82à
\82Á
\82½
\81D
\81D
\81D",
2366 Hallucination ? "
\82 \82½
\82è
\82Ü
\82¦
\82È
\82±
\82Æ
\82¾
\82ª" : "
\8aï
\96
\82È
\82±
\82Æ
\82É");
2371 case RIN_PROTECTION_FROM_SHAPE_CHAN:
2374 case RIN_LEVITATION:
2375 /* undo the `.intrinsic |= FROMOUTSIDE' done above */
2376 u.uprops[LEVITATION].intrinsic = oldprop;
2379 incr_itimeout(&HLevitation, d(10, 20));
2383 } /* inner switch */
2384 break; /* default case of outer switch */
2387 accessory_has_effect(otmp);
2388 if (adjattrib(A_CHA, otmp->spe, -1))
2391 case RIN_GAIN_STRENGTH:
2392 accessory_has_effect(otmp);
2393 if (adjattrib(A_STR, otmp->spe, -1))
2396 case RIN_GAIN_CONSTITUTION:
2397 accessory_has_effect(otmp);
2398 if (adjattrib(A_CON, otmp->spe, -1))
2401 case RIN_INCREASE_ACCURACY:
2402 accessory_has_effect(otmp);
2403 u.uhitinc = (schar) bounded_increase((int) u.uhitinc, otmp->spe,
2404 RIN_INCREASE_ACCURACY);
2406 case RIN_INCREASE_DAMAGE:
2407 accessory_has_effect(otmp);
2408 u.udaminc = (schar) bounded_increase((int) u.udaminc, otmp->spe,
2409 RIN_INCREASE_DAMAGE);
2411 case RIN_PROTECTION:
2412 accessory_has_effect(otmp);
2413 HProtection |= FROMOUTSIDE;
2414 u.ublessed = bounded_increase(u.ublessed, otmp->spe,
2418 case RIN_FREE_ACTION:
2419 /* Give sleep resistance instead */
2420 if (!(HSleep_resistance & FROMOUTSIDE))
2421 accessory_has_effect(otmp);
2422 if (!Sleep_resistance)
2424 You_feel("wide awake.");
2426 You("
\82Ï
\82Á
\82¿
\82è
\96Ú
\82ª
\82³
\82ß
\82½
\81D");
2427 HSleep_resistance |= FROMOUTSIDE;
2429 case AMULET_OF_CHANGE:
2430 accessory_has_effect(otmp);
2434 You("are suddenly very %s!",
2435 flags.female ? "feminine" : "masculine");
2437 You("
\93Ë
\91R
\82Æ
\82Ä
\82à%s
\82Á
\82Û
\82
\82È
\82Á
\82½
\81I",
2438 flags.female ? "
\8f\97" : "
\92j");
2442 case AMULET_OF_UNCHANGING:
2443 /* un-change: it's a pun */
2444 if (!Unchanging && Upolyd) {
2445 accessory_has_effect(otmp);
2450 case AMULET_OF_STRANGULATION: /* bad idea! */
2451 /* no message--this gives no permanent effect */
2454 case AMULET_OF_RESTFUL_SLEEP: { /* another bad idea! */
2455 long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
2457 if (!(HSleepy & FROMOUTSIDE))
2458 accessory_has_effect(otmp);
2459 HSleepy |= FROMOUTSIDE;
2460 /* might also be wearing one; use shorter of two timeouts */
2461 if (newnap < oldnap || oldnap == 0L)
2462 HSleepy = (HSleepy & ~TIMEOUT) | newnap;
2465 case RIN_SUSTAIN_ABILITY:
2466 case AMULET_OF_LIFE_SAVING:
2467 case AMULET_OF_REFLECTION: /* nice try */
2468 /* can't eat Amulet of Yendor or fakes,
2469 * and no oc_prop even if you could -3.
2476 /* called after eating non-food */
2480 struct obj *otmp = context.victual.piece;
2482 /* lesshungry wants an occupation to handle choke messages correctly */
2484 set_occupation(eatfood, "eating non-food", 0);
2486 set_occupation(eatfood, "
\90H
\82×
\82é", 0);
2487 lesshungry(context.victual.nmod);
2489 context.victual.piece = (struct obj *) 0;
2490 context.victual.o_id = 0;
2491 context.victual.eating = 0;
2492 if (otmp->oclass == COIN_CLASS) {
2496 useupf(otmp, otmp->quan);
2497 vault_gd_watching(GD_EATGOLD);
2501 if (otmp->otyp == SCR_MAIL) {
2503 pline("This junk mail is less than satisfying.");
2506 if (otmp->oclass == POTION_CLASS) {
2507 otmp->quan++; /* dopotion() does a useup() */
2508 (void) dopotion(otmp);
2509 } else if (otmp->oclass == RING_CLASS || otmp->oclass == AMULET_CLASS) {
2511 } else if (otmp->otyp == LEASH && otmp->leashmon) {
2515 /* KMH -- idea by "Tommy the Terrorist" */
2516 if (otmp->otyp == TRIDENT && !otmp->cursed) {
2517 /* sugarless chewing gum which used to be heavily advertised on TV */
2519 pline(Hallucination ? "Four out of five dentists agree."
2520 : "That was pure chewing satisfaction!");
2522 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"
2523 : "
\8f\83\90\88\82É
\8a\9a\82Ý
\82½
\82¢
\8bC
\8e\9d\82ð
\96\9e\82½
\82µ
\82½
\81I");
2525 exercise(A_WIS, TRUE);
2527 if (otmp->otyp == FLINT && !otmp->cursed) {
2528 /* chewable vitamin for kids based on "The Flintstones" TV cartoon */
2530 pline("Yabba-dabba delicious!");
2532 pline("
\83\84\83b
\83o
\83_
\83b
\83o
\82¤
\82Ü
\82¢
\81I");
2533 exercise(A_CON, TRUE);
2536 if (otmp == uwep && otmp->quan == 1L)
2538 if (otmp == uquiver && otmp->quan == 1L)
2540 if (otmp == uswapwep && otmp->quan == 1L)
2546 unpunish(); /* but no useup() */
2547 else if (carried(otmp))
2553 /* NOTE: the order of these words exactly corresponds to the
2554 order of oc_material values #define'd in objclass.h. */
2555 static const char *foodwords[] = {
2557 "meal", "liquid", "wax", "food", "meat", "paper",
2558 "cloth", "leather", "wood", "bone", "scale", "metal",
2559 "metal", "metal", "silver", "gold", "platinum", "mithril",
2560 "plastic", "glass", "rich food", "stone"
2562 "
\93÷", "
\89t
\91Ì", "
\96û", "
\90H
\97¿", "
\93÷", "
\8e\86",
2563 "
\95\9e", "
\94ç", "
\96Ø", "
\8d\9c", "
\97Ø", "
\8bà
\91®",
2564 "
\8bà
\91®", "
\8bà
\91®", "
\8bâ", "
\8bà", "
\83v
\83\89\83`
\83i", "
\83~
\83X
\83\8a\83\8b",
2565 "
\83v
\83\89\83X
\83`
\83b
\83N", "
\83K
\83\89\83X", "
\8d\82\8b\89\97¿
\97\9d", "
\90Î"
2569 STATIC_OVL const char *
2573 if (otmp->oclass == FOOD_CLASS)
2578 if (otmp->oclass == GEM_CLASS && objects[otmp->otyp].oc_material == GLASS
2580 makeknown(otmp->otyp);
2581 return foodwords[objects[otmp->otyp].oc_material];
2584 /* called after consuming (non-corpse) food */
2589 switch (otmp->otyp) {
2590 case SPRIG_OF_WOLFSBANE:
2591 if (u.ulycn >= LOW_PM || is_were(youmonst.data))
2596 || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
2597 make_blinded((long) u.ucreamed, TRUE);
2599 case FORTUNE_COOKIE:
2600 outrumor(bcsign(otmp), BY_COOKIE);
2602 u.uconduct.literate++;
2604 case LUMP_OF_ROYAL_JELLY:
2605 /* This stuff seems to be VERY healthy! */
2606 gainstr(otmp, 1, TRUE);
2608 u.mh += otmp->cursed ? -rnd(20) : rnd(20);
2609 if (u.mh > u.mhmax) {
2613 } else if (u.mh <= 0) {
2617 u.uhp += otmp->cursed ? -rnd(20) : rnd(20);
2618 if (u.uhp > u.uhpmax) {
2622 } else if (u.uhp <= 0) {
2623 killer.format = KILLED_BY_AN;
2625 Strcpy(killer.name, "rotten lump of royal jelly");
2628 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Å");
2637 if (flesh_petrifies(&mons[otmp->corpsenm])) {
2638 if (!Stone_resistance
2639 && !(poly_when_stoned(youmonst.data)
2640 && polymon(PM_STONE_GOLEM))) {
2643 Sprintf(killer.name, "%s egg",
2645 Sprintf(killer.name, "%s
\82Ì
\97\91\82Å",
2646 mons[otmp->corpsenm].mname);
2647 make_stoned(5L, (char *) 0, KILLED_BY_AN, killer.name);
2650 /* note: no "tastes like chicken" message for eggs */
2653 case EUCALYPTUS_LEAF:
2654 if (Sick && !otmp->cursed)
2655 make_sick(0L, (char *) 0, TRUE, SICK_ALL);
2656 if (Vomiting && !otmp->cursed)
2657 make_vomiting(0L, TRUE);
2660 if (otmp->cursed && !Sleep_resistance) {
2661 /* Snow White; 'poisoned' applies to [a subset of] weapons,
2662 not food, so we substitute cursed; fortunately our hero
2663 won't have to wait for a prince to be rescued/revived */
2664 if (Race_if(PM_DWARF) && Hallucination)
2666 verbalize("Heigh-ho, ho-hum, I think I'll skip work today.");
2668 verbalize("
\83n
\83C
\83z
\81[
\81C
\83n
\83C
\83z
\81[
\81C
\8d¡
\93ú
\82Í
\8bx
\82Ý
\81D");
2669 else if (Deaf || !flags.acoustics)
2671 You("fall asleep.");
2673 You("
\96°
\82è
\82É
\97\8e\82¿
\82½
\81D");
2676 You_hear("sinister laughter as you fall asleep...");
2678 You_hear("
\96°
\82è
\82É
\97\8e\82¿
\82é
\82Æ
\82«
\82É
\8e×
\88«
\82È
\8fÎ
\82¢
\90º
\82ð
\95·
\82¢
\82½
\81D
\81D
\81D");
2679 fall_asleep(-rn1(11, 20), TRUE);
2687 /* intended for eating a spellbook while polymorphed, but not used;
2688 "leather" applied to appearance, not composition, and has been
2689 changed to "leathery" to reflect that */
2690 STATIC_DCL boolean FDECL(leather_cover, (struct obj *));
2696 const char *odesc = OBJ_DESCR(objects[otmp->otyp]);
2698 if (odesc && (otmp->oclass == SPBOOK_CLASS)) {
2699 if (!strcmp(odesc, "leather"))
2707 * return 0 if the food was not dangerous.
2708 * return 1 if the food was dangerous and you chose to stop.
2709 * return 2 if the food was dangerous and you chose to eat it anyway.
2712 edibility_prompts(otmp)
2715 /* Blessed food detection grants hero a one-use
2716 * ability to detect food that is unfit for consumption
2717 * or dangerous and avoid it.
2719 char buf[BUFSZ], foodsmell[BUFSZ],
2720 it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
2721 boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
2722 int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
2726 Strcpy(foodsmell, Tobjnam(otmp, "smell"));
2728 Strcpy(foodsmell, xname(otmp));
2730 Strcpy(it_or_they, (otmp->quan == 1L) ? "it" : "they");
2732 Sprintf(eat_it_anyway, "Eat %s anyway?",
2733 (otmp->quan == 1L) ? "it" : "one");
2735 Strcpy(eat_it_anyway, "
\82»
\82ê
\82Å
\82à
\90H
\82×
\82é
\81H");
2738 if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) {
2739 /* These checks must match those in eatcorpse() */
2740 stoneorslime = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
2741 && !poly_when_stoned(youmonst.data));
2743 if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
2744 stoneorslime = (!Unchanging && !slimeproof(youmonst.data));
2746 if (cadaver && !nonrotting_corpse(mnum)) {
2747 long age = peek_at_iced_corpse_age(otmp);
2748 /* worst case rather than random
2749 in this calculation to force prompt */
2750 rotted = (monstermoves - age) / (10L + 0 /* was rn2(20) */);
2753 else if (otmp->blessed)
2759 * These problems with food should be checked in
2760 * order from most detrimental to least detrimental.
2762 if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
2765 Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2768 Sprintf(buf, "%s
\82Í
\89\98\90õ
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2769 foodsmell, eat_it_anyway);
2771 if (yn_function(buf, ynchars, 'n') == 'n')
2778 Sprintf(buf, "%s like %s could be something very dangerous! %s",
2779 foodsmell, it_or_they, eat_it_anyway);
2781 Sprintf(buf, "%s
\82Í
\82È
\82ñ
\82¾
\82©
\82·
\82²
\82
\8aë
\8c¯
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2782 foodsmell, eat_it_anyway);
2784 if (yn_function(buf, ynchars, 'n') == 'n')
2789 if (otmp->orotten || (cadaver && rotted > 3L)) {
2792 Sprintf(buf, "%s like %s could be rotten! %s", foodsmell, it_or_they,
2795 Sprintf(buf, "%s
\82Í
\95\85\82Á
\82½
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2796 foodsmell, eat_it_anyway);
2798 if (yn_function(buf, ynchars, 'n') == 'n')
2803 if (cadaver && poisonous(&mons[mnum]) && !Poison_resistance) {
2806 Sprintf(buf, "%s like %s might be poisonous! %s", foodsmell,
2807 it_or_they, eat_it_anyway);
2809 Sprintf(buf, "%s
\82Í
\93Å
\82ð
\82à
\82Á
\82Ä
\82¢
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2810 foodsmell, eat_it_anyway);
2812 if (yn_function(buf, ynchars, 'n') == 'n')
2817 if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2818 /* causes sleep, for long enough to be dangerous */
2820 Sprintf(buf, "%s like %s might have been poisoned. %s", foodsmell,
2821 it_or_they, eat_it_anyway);
2823 Sprintf(buf, "%s
\82Í
\93Å
\82ª
\93ü
\82ê
\82ç
\82ê
\82Ä
\82¢
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2824 foodsmell, eat_it_anyway);
2826 return (yn_function(buf, ynchars, 'n') == 'n') ? 1 : 2;
2828 if (cadaver && !vegetarian(&mons[mnum]) && !u.uconduct.unvegetarian
2829 && Role_if(PM_MONK)) {
2831 Sprintf(buf, "%s unhealthy. %s", foodsmell, eat_it_anyway);
2833 Sprintf(buf, "%s
\82Í
\8c\92\8dN
\82É
\88«
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2834 if (yn_function(buf, ynchars, 'n') == 'n')
2839 if (cadaver && acidic(&mons[mnum]) && !Acid_resistance) {
2841 Sprintf(buf, "%s rather acidic. %s", foodsmell, eat_it_anyway);
2843 Sprintf(buf, "%s
\82Í
\8f
\82µ
\8e_
\82Á
\82Ï
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2844 if (yn_function(buf, ynchars, 'n') == 'n')
2849 if (Upolyd && u.umonnum == PM_RUST_MONSTER && is_metallic(otmp)
2850 && otmp->oerodeproof) {
2852 Sprintf(buf, "%s disgusting to you right now. %s", foodsmell,
2855 Sprintf(buf, "%s
\82Í
\8bC
\95ª
\82ª
\88«
\82
\82È
\82é
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell,
2858 if (yn_function(buf, ynchars, 'n') == 'n')
2865 * Breaks conduct, but otherwise safe.
2867 if (!u.uconduct.unvegan
2868 && ((material == LEATHER || material == BONE
2869 || material == DRAGON_HIDE || material == WAX)
2870 || (cadaver && !vegan(&mons[mnum])))) {
2872 Sprintf(buf, "%s foul and unfamiliar to you. %s", foodsmell,
2875 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,
2878 if (yn_function(buf, ynchars, 'n') == 'n')
2883 if (!u.uconduct.unvegetarian
2884 && ((material == LEATHER || material == BONE
2885 || material == DRAGON_HIDE)
2886 || (cadaver && !vegetarian(&mons[mnum])))) {
2888 Sprintf(buf, "%s unfamiliar to you. %s", foodsmell, eat_it_anyway);
2890 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);
2891 if (yn_function(buf, ynchars, 'n') == 'n')
2897 if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && Sick_resistance) {
2898 /* Tainted meat with Sick_resistance */
2900 Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2903 Sprintf(buf, "%s
\82Í
\89\98\90õ
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s", foodsmell,
2906 if (yn_function(buf, ynchars, 'n') == 'n')
2919 int basenutrit; /* nutrition of full item */
2920 boolean dont_start = FALSE, nodelicious = FALSE;
2924 pline("If you can't breathe air, how can you consume solids?");
2926 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");
2930 if (!(otmp = floorfood("eat", 0)))
2932 if (!(otmp = floorfood("
\90H
\82×
\82é", 0)))
2934 if (check_capacity((char *) 0))
2938 int res = edibility_prompts(otmp);
2942 "%s stops tingling and your sense of smell returns to normal.",
2945 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",
2954 /* We have to make non-foods take 1 move to eat, unless we want to
2955 * do ridiculous amounts of coding to deal with partly eaten plate
2956 * mails, players who polymorph back to human in the middle of their
2957 * metallic meal, etc....
2959 if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
2960 : touch_artifact(otmp, &youmonst))) {
2962 } else if (!is_edible(otmp)) {
2964 You("cannot eat that!");
2966 You("
\82»
\82ê
\82ð
\90H
\82×
\82ç
\82ê
\82È
\82¢
\81I");
2968 } else if ((otmp->owornmask & (W_ARMOR | W_TOOL | W_AMUL | W_SADDLE))
2970 /* let them eat rings */
2972 You_cant("eat %s you're wearing.", something);
2974 You("
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82é
\8aÔ
\82Í
\90H
\82×
\82ê
\82È
\82¢
\81D");
2977 if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
2978 && otmp->oerodeproof) {
2979 otmp->rknown = TRUE;
2980 if (otmp->quan > 1L) {
2982 (void) splitobj(otmp, otmp->quan - 1L);
2984 otmp = splitobj(otmp, 1L);
2987 pline("Ulch - that %s was rustproofed!", xname(otmp));
2989 pline("
\83E
\83Q
\83F
\81[
\81I%s
\82Í
\96h
\8eK
\82³
\82ê
\82Ä
\82¢
\82é
\81I", xname(otmp));
2990 /* The regurgitated object's rustproofing is gone now */
2991 otmp->oerodeproof = 0;
2992 make_stunned((HStun & TIMEOUT) + (long) rn2(10), TRUE);
2994 You("spit %s out onto the %s.", the(xname(otmp)),
2995 surface(u.ux, u.uy));
2997 You("%s
\82ð%s
\82É
\93f
\82«
\8fo
\82µ
\82½
\81D", the(xname(otmp)),
2998 surface(u.ux, u.uy));
3000 if (carried(otmp)) {
3007 /* KMH -- Slow digestion is... indigestible */
3008 if (otmp->otyp == RIN_SLOW_DIGESTION) {
3010 pline("This ring is indigestible!");
3012 pline("
\82±
\82Ì
\8ew
\97Ö
\82Í
\8fÁ
\89»
\82µ
\82É
\82
\82¢
\81I");
3013 (void) rottenfood(otmp);
3014 if (otmp->dknown && !objects[otmp->otyp].oc_name_known
3015 && !objects[otmp->otyp].oc_uname)
3019 if (otmp->oclass != FOOD_CLASS) {
3022 context.victual.reqtime = 1;
3023 context.victual.piece = otmp;
3024 context.victual.o_id = otmp->o_id;
3025 /* Don't split it, we don't need to if it's 1 move */
3026 context.victual.usedtime = 0;
3027 context.victual.canchoke = (u.uhs == SATIATED);
3028 /* Note: gold weighs 1 pt. for each 1000 pieces (see
3029 pickup.c) so gold and non-gold is consistent. */
3030 if (otmp->oclass == COIN_CLASS)
3031 basenutrit = ((otmp->quan > 200000L)
3033 : (int) (otmp->quan / 100L));
3034 else if (otmp->oclass == BALL_CLASS || otmp->oclass == CHAIN_CLASS)
3035 basenutrit = weight(otmp);
3036 /* oc_nutrition is usually weight anyway */
3038 basenutrit = objects[otmp->otyp].oc_nutrition;
3040 if (otmp->otyp == SCR_MAIL) {
3045 context.victual.nmod = basenutrit;
3046 context.victual.eating = TRUE; /* needed for lesshungry() */
3048 material = objects[otmp->otyp].oc_material;
3049 if (material == LEATHER || material == BONE
3050 || material == DRAGON_HIDE) {
3051 u.uconduct.unvegan++;
3052 violated_vegetarian();
3053 } else if (material == WAX)
3054 u.uconduct.unvegan++;
3058 (void) rottenfood(otmp);
3060 if (otmp->oclass == WEAPON_CLASS && otmp->opoisoned) {
3062 pline("Ecch - that must have been poisonous!");
3064 pline("
\83E
\83Q
\83F
\81[
\81C
\97L
\93Å
\82¾
\82Á
\82½
\82É
\88á
\82¢
\82È
\82¢
\81I");
3065 if (!Poison_resistance) {
3068 losehp(rnd(15), xname(otmp), KILLED_BY_AN);
3072 Sprintf(jbuf, "%s
\82Å", xname(otmp));
3073 losehp(rnd(15), jbuf, KILLED_BY_AN);
3078 You("seem unaffected by the poison.");
3080 You("
\93Å
\82Ì
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
3081 } else if (!otmp->cursed && !nodelicious) {
3083 pline("%s%s is delicious!",
3085 && otmp->oartifact < ART_ORB_OF_DETECTION)
3088 (otmp->oclass == COIN_CLASS)
3090 : singular(otmp, xname));
3092 pline("
\82±
\82Ì%s
\82Í
\8e|
\82¢
\81I",
3093 otmp->oclass == COIN_CLASS
3095 : singular(otmp, xname));
3102 if (otmp == context.victual.piece) {
3103 /* If they weren't able to choke, they don't suddenly become able to
3104 * choke just because they were interrupted. On the other hand, if
3105 * they were able to choke before, if they lost food it's possible
3106 * they shouldn't be able to choke now.
3108 if (u.uhs != SATIATED)
3109 context.victual.canchoke = FALSE;
3110 context.victual.o_id = 0;
3111 context.victual.piece = touchfood(otmp);
3112 if (context.victual.piece)
3113 context.victual.o_id = context.victual.piece->o_id;
3115 You("resume your meal.");
3117 You("
\90H
\8e\96\82ð
\8dÄ
\8aJ
\82µ
\82½
\81D");
3118 start_eating(context.victual.piece);
3122 /* nothing in progress - so try to find something. */
3123 /* tins are a special case */
3124 /* tins must also check conduct separately in case they're discarded */
3125 if (otmp->otyp == TIN) {
3133 context.victual.o_id = 0;
3134 context.victual.piece = otmp = touchfood(otmp);
3135 if (context.victual.piece)
3136 context.victual.o_id = context.victual.piece->o_id;
3137 context.victual.usedtime = 0;
3139 /* Now we need to calculate delay and nutritional info.
3140 * The base nutrition calculated here and in eatcorpse() accounts
3141 * for normal vs. rotten food. The reqtime and nutrit values are
3142 * then adjusted in accordance with the amount of food left.
3144 if (otmp->otyp == CORPSE || otmp->globby) {
3145 int tmp = eatcorpse(otmp);
3149 context.victual.piece = (struct obj *) 0;
3150 context.victual.o_id = 0;
3154 /* if not used up, eatcorpse sets up reqtime and may modify oeaten */
3156 /* No checks for WAX, LEATHER, BONE, DRAGON_HIDE. These are
3157 * all handled in the != FOOD_CLASS case, above.
3159 switch (objects[otmp->otyp].oc_material) {
3161 u.uconduct.unvegan++;
3162 if (otmp->otyp != EGG) {
3163 violated_vegetarian();
3168 if (otmp->otyp == PANCAKE || otmp->otyp == FORTUNE_COOKIE /*eggs*/
3169 || otmp->otyp == CREAM_PIE || otmp->otyp == CANDY_BAR /*milk*/
3170 || otmp->otyp == LUMP_OF_ROYAL_JELLY)
3171 u.uconduct.unvegan++;
3175 context.victual.reqtime = objects[otmp->otyp].oc_delay;
3176 if (otmp->otyp != FORTUNE_COOKIE
3177 && (otmp->cursed || (!nonrotting_food(otmp->otyp)
3178 && (monstermoves - otmp->age)
3179 > (otmp->blessed ? 50L : 30L)
3180 && (otmp->orotten || !rn2(7))))) {
3181 if (rottenfood(otmp)) {
3182 otmp->orotten = TRUE;
3185 consume_oeaten(otmp, 1); /* oeaten >>= 1 */
3190 /* re-calc the nutrition */
3191 if (otmp->otyp == CORPSE)
3192 basenutrit = mons[otmp->corpsenm].cnutrit;
3194 basenutrit = objects[otmp->otyp].oc_nutrition;
3196 debugpline1("before rounddiv: context.victual.reqtime == %d",
3197 context.victual.reqtime);
3198 debugpline2("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
3199 context.victual.reqtime = (basenutrit == 0)
3201 : rounddiv(context.victual.reqtime
3202 * (long) otmp->oeaten,
3204 debugpline1("after rounddiv: context.victual.reqtime == %d",
3205 context.victual.reqtime);
3207 * calculate the modulo value (nutrit. units per round eating)
3208 * note: this isn't exact - you actually lose a little nutrition due
3210 * TODO: add in a "remainder" value to be given at the end of the meal.
3212 if (context.victual.reqtime == 0 || otmp->oeaten == 0)
3213 /* possible if most has been eaten before */
3214 context.victual.nmod = 0;
3215 else if ((int) otmp->oeaten >= context.victual.reqtime)
3216 context.victual.nmod = -((int) otmp->oeaten
3217 / context.victual.reqtime);
3219 context.victual.nmod = context.victual.reqtime % otmp->oeaten;
3220 context.victual.canchoke = (u.uhs == SATIATED);
3227 /* Take a single bite from a piece of food, checking for choking and
3228 * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise.
3233 if (context.victual.canchoke && u.uhunger >= 2000) {
3234 choke(context.victual.piece);
3237 if (context.victual.doreset) {
3241 force_save_hs = TRUE;
3242 if (context.victual.nmod < 0) {
3243 lesshungry(-context.victual.nmod);
3244 consume_oeaten(context.victual.piece,
3245 context.victual.nmod); /* -= -nmod */
3246 } else if (context.victual.nmod > 0
3247 && (context.victual.usedtime % context.victual.nmod)) {
3249 consume_oeaten(context.victual.piece, -1); /* -= 1 */
3251 force_save_hs = FALSE;
3256 /* as time goes by - called by moveloop() and domove() */
3260 if (u.uinvulnerable)
3261 return; /* you don't feel hungrier */
3263 if ((!u.usleep || !rn2(10)) /* slow metabolic rate while asleep */
3264 && (carnivorous(youmonst.data) || herbivorous(youmonst.data))
3266 u.uhunger--; /* ordinary food consumption */
3268 if (moves % 2) { /* odd turns */
3269 /* Regeneration uses up food, unless due to an artifact */
3270 if ((HRegeneration & ~FROMFORM)
3271 || (ERegeneration & ~(W_ARTI | W_WEP)))
3273 if (near_capacity() > SLT_ENCUMBER)
3275 } else { /* even turns */
3278 /* Conflict uses up food too */
3279 if (HConflict || (EConflict & (~W_ARTI)))
3281 /* +0 charged rings don't do anything, so don't affect hunger */
3282 /* Slow digestion still uses ring hunger */
3283 switch ((int) (moves % 20)) { /* note: use even cases only */
3285 if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged))
3293 if (uright && (uright->spe || !objects[uright->otyp].oc_charged))
3307 /* called after vomiting and after performing feats of magic */
3316 /* called after eating (and after drinking fruit juice) */
3321 /* See comments in newuhs() for discussion on force_save_hs */
3322 boolean iseating = (occupation == eatfood) || force_save_hs;
3324 debugpline1("lesshungry(%d)", num);
3326 if (u.uhunger >= 2000) {
3327 if (!iseating || context.victual.canchoke) {
3329 choke(context.victual.piece);
3332 choke(occupation == opentin ? context.tin.tin
3333 : (struct obj *) 0);
3334 /* no reset_eat() */
3337 /* Have lesshungry() report when you're nearly full so all eating
3338 * warns when you're about to choke.
3340 if (u.uhunger >= 1500) {
3341 if (!context.victual.eating
3342 || (context.victual.eating && !context.victual.fullwarn)) {
3344 pline("You're having a hard time getting all of it down.");
3346 pline("
\91S
\82Ä
\82ð
\88ù
\82Ý
\82±
\82Þ
\82É
\82Í
\8e\9e\8aÔ
\82ª
\82©
\82©
\82é
\81D");
3348 nomovemsg = "You're finally finished.";
3350 nomovemsg = "
\82â
\82Á
\82Æ
\90H
\82×
\8fI
\82¦
\82½
\81D";
3351 if (!context.victual.eating) {
3354 context.victual.fullwarn = TRUE;
3355 if (context.victual.canchoke
3356 && context.victual.reqtime > 1) {
3357 /* a one-gulp food will not survive a stop */
3359 if (yn_function("Continue eating?", ynchars, 'n')
3361 if (yn_function("
\90H
\82×
\91±
\82¯
\82Ü
\82·
\82©
\81H", ynchars, 'n')
3364 nomovemsg = (char *) 0;
3378 (void) Hear_again();
3379 if (u.uhs > FAINTING)
3389 return (boolean) (u.uhs == FAINTED);
3392 /* call when a faint must be prematurely terminated */
3396 if (afternmv == unfaint)
3398 unmul("You revive.");
3400 unmul("
\82 \82È
\82½
\82Í
\8bC
\82ª
\82Â
\82¢
\82½
\81D");
3403 /* compute and comment on your (new?) hunger status */
3409 static unsigned save_hs;
3410 static boolean saved_hs = FALSE;
3415 : (h > 150) ? NOT_HUNGRY
3416 : (h > 50) ? HUNGRY : (h > 0) ? WEAK : FAINTING;
3418 /* While you're eating, you may pass from WEAK to HUNGRY to NOT_HUNGRY.
3419 * This should not produce the message "you only feel hungry now";
3420 * that message should only appear if HUNGRY is an endpoint. Therefore
3421 * we check to see if we're in the middle of eating. If so, we save
3422 * the first hunger status, and at the end of eating we decide what
3423 * message to print based on the _entire_ meal, not on each little bit.
3425 /* It is normally possible to check if you are in the middle of a meal
3426 * by checking occupation == eatfood, but there is one special case:
3427 * start_eating() can call bite() for your first bite before it
3428 * sets the occupation.
3429 * Anyone who wants to get that case to work _without_ an ugly static
3430 * force_save_hs variable, feel free.
3432 /* Note: If you become a certain hunger status in the middle of the
3433 * meal, and still have that same status at the end of the meal,
3434 * this will incorrectly print the associated message at the end of
3435 * the meal instead of the middle. Such a case is currently
3436 * impossible, but could become possible if a message for SATIATED
3437 * were added or if HUNGRY and WEAK were separated by a big enough
3438 * gap to fit two bites.
3440 if (occupation == eatfood || force_save_hs) {
3454 if (newhs == FAINTING) {
3457 if (u.uhs <= WEAK || rn2(20 - u.uhunger / 10) >= 19) {
3458 if (!is_fainted() && multi >= 0 /* %% */) {
3459 int duration = 10 - (u.uhunger / 10);
3461 /* stop what you're doing, then faint */
3464 You("faint from lack of food.");
3466 You("
\95 \82ª
\8c¸
\82Á
\82Ä
\93|
\82ê
\82½
\81D");
3469 selftouch("Falling, you");
3471 selftouch("
\97\8e\82¿
\82È
\82ª
\82ç
\81C
\82 \82È
\82½
\82Í");
3472 incr_itimeout(&HDeaf, duration);
3475 multi_reason = "fainted from lack of food";
3477 multi_reason = "
\8bó
\95 \82Å
\91²
\93|
\82µ
\82Ä
\82¢
\82é
\8aÔ
\82É";
3479 nomovemsg = "You regain consciousness.";
3481 nomovemsg = "
\82 \82È
\82½
\82Í
\90³
\8bC
\82Ã
\82¢
\82½
\81D";
3485 } else if (u.uhunger < -(int) (200 + 20 * ACURR(A_CON))) {
3490 You("die from starvation.");
3492 You("
\89ì
\8e\80\82µ
\82½
\81D");
3493 killer.format = KILLED_BY;
3495 Strcpy(killer.name, "starvation");
3497 Strcpy(killer.name, "
\90H
\97¿
\95s
\91«
\82Å
\89ì
\8e\80\82µ
\82½");
3499 /* if we return, we lifesaved, and that calls newuhs */
3504 if (newhs != u.uhs) {
3505 if (newhs >= WEAK && u.uhs < WEAK)
3506 losestr(1); /* this may kill you -- see below */
3507 else if (newhs < WEAK && u.uhs >= WEAK)
3511 if (Hallucination) {
3513 You((!incr) ? "now have a lesser case of the munchies."
3514 : "are getting the munchies.");
3517 You("
\83n
\83\89\83w
\83\8a\82ª
\8c¸
\82Á
\82½
\81D");
3519 pline("
\83n
\83\89\83w
\83\8a\83w
\83\8a\83n
\83\89\81D");
3524 You((!incr) ? "only feel hungry now."
3526 You((!incr) ? "
\92P
\82É
\95 \83y
\83R
\8fó
\91Ô
\82É
\82È
\82Á
\82½
\81D"
3531 ? "
\8bó
\95 \8a´
\82ð
\8a´
\82¶
\82½
\81D"
3533 : "are beginning to feel hungry.");
3535 : "
\8bó
\95 \8a´
\82ð
\82¨
\82Ú
\82¦
\82Í
\82¶
\82ß
\82½
\81D");
3536 if (incr && occupation
3537 && (occupation != eatfood && occupation != opentin))
3539 context.travel = context.travel1 = context.mv = context.run = 0;
3544 pline((!incr) ? "You still have the munchies."
3546 pline((!incr) ? "
\83n
\83\89\83w
\83\8a\82ª
\8c¸
\82ç
\82È
\82¢
\81D"
3548 : "The munchies are interfering with your motor capabilities.");
3550 : "
\83n
\83\89\83w
\83\8a\82ª
\83\82\81[
\83^
\81[
\90«
\94\
\82É
\89e
\8b¿
\82ð
\97^
\82¦
\82Ä
\82¢
\82é
\81D");
3551 else if (incr && (Role_if(PM_WIZARD) || Race_if(PM_ELF)
3552 || Role_if(PM_VALKYRIE)))
3554 pline("%s needs food, badly!",
3556 pline("%s
\82É
\82Í
\8e\8a\8b}
\90H
\97¿
\82ª
\95K
\97v
\82¾
\81I",
3557 (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE))
3562 : "
\83G
\83\8b\83t");
3568 ? "
\90\8a\8eã
\8fó
\91Ô
\82É
\82È
\82Á
\82½
\81D"
3570 : (u.uhunger < 45) ? "feel weak."
3572 : (u.uhunger < 45) ? "
\90\8a\8eã
\82µ
\82Ä
\82«
\82½
\81D"
3574 : "are beginning to feel weak.");
3576 : "
\8eã
\82
\82È
\82Á
\82Ä
\82«
\82½
\82æ
\82¤
\82É
\8a´
\82¶
\82½
\81D");
3577 if (incr && occupation
3578 && (occupation != eatfood && occupation != opentin))
3580 context.travel = context.travel1 = context.mv = context.run = 0;
3586 if ((Upolyd ? u.mh : u.uhp) < 1) {
3588 You("die from hunger and exhaustion.");
3590 You("
\8bó
\95 \82Æ
\90\8a\8eã
\82Å
\8e\80\82ñ
\82¾
\81D");
3591 killer.format = KILLED_BY;
3593 Strcpy(killer.name, "exhaustion");
3595 Strcpy(killer.name, "
\8bó
\95 \82Æ
\90\8a\8eã
\82Å
\8e\80\82ñ
\82¾");
3602 /* Returns an object representing food.
3603 * Object may be either on floor or in inventory.
3605 /*JP CHECK: 3.4.3
\82Å
\82Ì
\8cÄ
\82Ñ
\8fo
\82µ
\8c³
3606 apply.c:1959: if (!(corpse = floorfood("
\8aÊ
\8bl
\82ß
\82É
\82·
\82é", 2))) return;
3607 eat.c:2404: if (!(otmp = floorfood("
\90H
\82×
\82é", 0))) return 0;
3608 pray.c:1478: if (!(otmp = floorfood("
\95ù
\82°
\82é", 1))) return 0;
3611 floorfood(verb, corpsecheck)
3613 int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
3615 register struct obj *otmp;
3619 boolean feeding = !strcmp(verb, "eat"), /* corpsecheck==0 */
3620 offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
3622 boolean feeding = !strcmp(verb, "
\90H
\82×
\82é"), /* corpsecheck==0 */
3623 offering = !strcmp(verb, "
\95ù
\82°
\82é"); /* corpsecheck==1 */
3627 const char *jverb = trans_verb(verb)->jp;
3630 /* if we can't touch floor objects then use invent food only */
3631 if (!can_reach_floor(TRUE) || (feeding && u.usteed)
3632 || (is_pool_or_lava(u.ux, u.uy)
3633 && (Wwalking || is_clinger(youmonst.data)
3634 || (Flying && !Breathless))))
3637 if (feeding && metallivorous(youmonst.data)) {
3639 struct trap *ttmp = t_at(u.ux, u.uy);
3641 if (ttmp && ttmp->tseen && ttmp->ttyp == BEAR_TRAP) {
3642 /* If not already stuck in the trap, perhaps there should
3643 be a chance to becoming trapped? Probably not, because
3644 then the trap would just get eaten on the _next_ turn... */
3646 Sprintf(qbuf, "There is a bear trap here (%s); eat it?",
3648 Sprintf(qbuf, "
\82±
\82±
\82É
\82Í
\8cF
\82Ìã©(%s)
\82ª
\82 \82é;
\90H
\82×
\82Ü
\82·
\82©
\81H",
3650 (u.utrap && u.utraptype == TT_BEARTRAP) ? "holding you"
3652 (u.utrap && u.utraptype == TT_BEARTRAP) ? "
\82 \82È
\82½
\82ð
\92Í
\82Ü
\82¦
\82Ä
\82¢
\82é"
3656 : "
\89Ò
\93®
\92\86");
3657 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3658 u.utrap = u.utraptype = 0;
3660 return mksobj(BEARTRAP, TRUE, FALSE);
3661 } else if (c == 'q') {
3662 return (struct obj *) 0;
3666 if (youmonst.data != &mons[PM_RUST_MONSTER]
3667 && (gold = g_at(u.ux, u.uy)) != 0) {
3669 if (gold->quan == 1L)
3670 Sprintf(qbuf, "There is 1 gold piece here; eat it?");
3672 Sprintf(qbuf, "There are %ld gold pieces here; eat them?",
3675 Sprintf(qbuf, "
\82±
\82±
\82É
\82Í%ld
\96\87\82Ì
\8bà
\89Ý
\82ª
\82 \82é
\81D
\90H
\82×
\82Ü
\82·
\82©
\81H", gold->quan);
3677 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3679 } else if (c == 'q') {
3680 return (struct obj *) 0;
3685 /* Is there some food (probably a heavy corpse) here on the ground? */
3686 for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
3688 ? (otmp->otyp == CORPSE
3689 && (corpsecheck == 1 || tinnable(otmp)))
3690 : feeding ? (otmp->oclass != COIN_CLASS && is_edible(otmp))
3691 : otmp->oclass == FOOD_CLASS) {
3693 boolean one = (otmp->quan == 1L);
3695 /* "There is <an object> here; <verb> it?" or
3696 "There are <N objects> here; <verb> one?" */
3698 Sprintf(qbuf, "There %s ", otense(otmp, "are"));
3699 Sprintf(qsfx, " here; %s %s?", verb, one ? "it" : "one");
3700 (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3701 one ? something : (const char *) "things");
3703 Strcpy(qbuf, "
\82±
\82±
\82É");
3704 Sprintf(qsfx, "
\82ª
\82 \82é; %s%s?", one ? "" : "
\88ê
\82Â", jverb);
3705 (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3706 one ? something : (const char *) "
\89½
\82©");
3708 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y')
3711 return (struct obj *) 0;
3716 /* We cannot use ALL_CLASSES since that causes getobj() to skip its
3717 * "ugly checks" and we need to check for inedible items.
3720 getobj(feeding ? allobj : offering ? offerfodder : comestibles, verb);
3721 if (corpsecheck && otmp && !(offering && otmp->oclass == AMULET_CLASS))
3722 if (otmp->otyp != CORPSE || (corpsecheck == 2 && !tinnable(otmp))) {
3724 You_cant("%s that!", verb);
3726 You_cant("
\82»
\82ê
\82ð%s
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81I", jverb);
3727 return (struct obj *) 0;
3732 /* Side effects of vomiting */
3733 /* added nomul (MRS) - it makes sense, you're too busy being sick! */
3735 vomit() /* A good idea from David Neves */
3737 if (cantvomit(youmonst.data))
3738 /* doesn't cure food poisoning; message assumes that we aren't
3739 dealing with some esoteric body_part() */
3741 Your("jaw gapes convulsively.");
3743 Your("
\82 \82²
\82Í
\94
\8dì
\93I
\82É
\91å
\82«
\82
\8aJ
\82¢
\82½
\81D");
3745 make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE);
3748 multi_reason = "vomiting";
3750 multi_reason = "
\9aq
\93f
\82µ
\82Ä
\82¢
\82é
\8dÅ
\92\86\82É";
3751 nomovemsg = You_can_move_again;
3755 eaten_stat(base, obj)
3759 long uneaten_amt, full_amount;
3761 uneaten_amt = (long) obj->oeaten;
3762 full_amount = (obj->otyp == CORPSE)
3763 ? (long) mons[obj->corpsenm].cnutrit
3764 : (long) objects[obj->otyp].oc_nutrition;
3765 if (uneaten_amt > full_amount) {
3767 "partly eaten food (%ld) more nutritious than untouched food (%ld)",
3768 uneaten_amt, full_amount);
3769 uneaten_amt = full_amount;
3772 base = (int) (full_amount ? (long) base * uneaten_amt / full_amount : 0L);
3773 return (base < 1) ? 1 : base;
3776 /* reduce obj's oeaten field, making sure it never hits or passes 0 */
3778 consume_oeaten(obj, amt)
3783 * This is a hack to try to squelch several long standing mystery
3784 * food bugs. A better solution would be to rewrite the entire
3785 * victual handling mechanism from scratch using a less complex
3786 * model. Alternatively, this routine could call done_eating()
3787 * or food_disappears() but its callers would need revisions to
3788 * cope with context.victual.piece unexpectedly going away.
3790 * Multi-turn eating operates by setting the food's oeaten field
3791 * to its full nutritional value and then running a counter which
3792 * independently keeps track of whether there is any food left.
3793 * The oeaten field can reach exactly zero on the last turn, and
3794 * the object isn't removed from inventory until the next turn
3795 * when the "you finish eating" message gets delivered, so the
3796 * food would be restored to the status of untouched during that
3797 * interval. This resulted in unexpected encumbrance messages
3798 * at the end of a meal (if near enough to a threshold) and would
3799 * yield full food if there was an interruption on the critical
3800 * turn. Also, there have been reports over the years of food
3801 * becoming massively heavy or producing unlimited satiation;
3802 * this would occur if reducing oeaten via subtraction attempted
3803 * to drop it below 0 since its unsigned type would produce a
3804 * huge positive value instead. So far, no one has figured out
3805 * _why_ that inappropriate subtraction might sometimes happen.
3809 /* bit shift to divide the remaining amount of food */
3810 obj->oeaten >>= amt;
3812 /* simple decrement; value is negative so we actually add it */
3813 if ((int) obj->oeaten > -amt)
3819 if (obj->oeaten == 0) {
3820 if (obj == context.victual.piece) /* always true unless wishing... */
3821 context.victual.reqtime =
3822 context.victual.usedtime; /* no bites left */
3823 obj->oeaten = 1; /* smallest possible positive value */
3827 /* called when eatfood occupation has been interrupted,
3828 or in the case of theft, is about to be interrupted */
3830 maybe_finished_meal(stopping)
3833 /* in case consume_oeaten() has decided that the food is all gone */
3834 if (occupation == eatfood
3835 && context.victual.usedtime >= context.victual.reqtime) {
3837 occupation = 0; /* for do_reset_eat */
3838 (void) eatfood(); /* calls done_eating() to use up
3839 context.victual.piece */
3845 /* Tin of <something> to the rescue? Decide whether current occupation
3846 is an attempt to eat a tin of something capable of saving hero's life.
3847 We don't care about consumption of non-tinned food here because special
3848 effects there take place on first bite rather than at end of occupation.
3849 [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */
3857 if (occupation != opentin)
3859 otin = context.tin.tin;
3860 /* make sure hero still has access to tin */
3862 && (!obj_here(otin, u.ux, u.uy) || !can_reach_floor(TRUE)))
3864 /* unknown tin is assumed to be helpful */
3867 /* known tin is helpful if it will stop life-threatening problem */
3868 mndx = otin->corpsenm;
3870 /* note: not used; hunger code bypasses stop_occupation() when eating */
3872 return (boolean) (mndx != NON_PM || otin->spe == 1);
3873 /* flesh from lizards and acidic critters stops petrification */
3875 return (boolean) (mndx >= LOW_PM
3876 && (mndx == PM_LIZARD || acidic(&mons[mndx])));
3877 /* no tins can cure these (yet?) */