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);
605 Sprintf(killer.name, "
\8bð
\82©
\82É
\82à%s
\82Ì
\91Ì
\82ð
\90H
\82×
\82Ä", pd->mname);
606 killer.format = NO_KILLER_PREFIX;
608 /* life-saving needed to reach here */
609 exercise(A_WIS, FALSE);
610 *dmg_p += xtra_dmg; /* Rider takes extra damage */
612 morehungry(-rnd(30)); /* cannot choke */
613 if (ABASE(A_INT) < AMAX(A_INT)) {
614 /* recover lost Int; won't increase current max */
615 ABASE(A_INT) += rnd(4);
616 if (ABASE(A_INT) > AMAX(A_INT))
617 ABASE(A_INT) = AMAX(A_INT);
620 exercise(A_WIS, TRUE);
623 /* targetting another mind flayer or your own underlying species
625 (void) maybe_cannibal(monsndx(pd), TRUE);
627 } else if (mdef == &youmonst) {
629 * monster mind flayer is eating hero's brain
631 /* no such thing as mindless players */
632 if (ABASE(A_INT) <= ATTRMIN(A_INT)) {
634 static NEARDATA const char brainlessness[] = "brainlessness";
636 static NEARDATA const char brainlessness[] = "
\94]
\82ð
\8e¸
\82Á
\82Ä";
639 Strcpy(killer.name, brainlessness);
640 killer.format = KILLED_BY;
642 /* amulet of life saving has now been used up */
644 pline("Unfortunately your brain is still gone.");
646 pline("
\8ec
\94O
\82È
\82ª
\82ç
\82 \82È
\82½
\82É
\82Í
\94]
\82ª
\82È
\82¢
\81D");
647 /* sanity check against adding other forms of life-saving */
648 u.uprops[LIFESAVED].extrinsic =
649 u.uprops[LIFESAVED].intrinsic = 0L;
652 Your("last thought fades away.");
654 Your("
\8dÅ
\8cã
\82Ì
\8ev
\82¢
\82ª
\91\96\94n
\93\95\82Ì
\82æ
\82¤
\82É
\89¡
\82¬
\82Á
\82½
\81D");
656 Strcpy(killer.name, brainlessness);
657 killer.format = KILLED_BY;
659 /* can only get here when in wizard or explore mode and user has
660 explicitly chosen not to die; arbitrarily boost intelligence */
661 ABASE(A_INT) = ATTRMIN(A_INT) + 2;
663 You_feel("like a scarecrow.");
665 You("
\82©
\82©
\82µ
\82Ì
\82æ
\82¤
\82È
\8bC
\8e\9d\82ª
\82µ
\82½
\81D");
667 give_nutrit = TRUE; /* in case a conflicted pet is doing this */
668 exercise(A_WIS, FALSE);
669 /* caller handles Int and memory loss */
673 * monster mind flayer is eating another monster's brain
678 pline("%s doesn't notice.", Monnam(mdef));
680 pline("%s
\82Í
\8bC
\82Ã
\82¢
\82Ä
\82¢
\82È
\82¢
\81D", Monnam(mdef));
682 } else if (is_rider(pd)) {
685 result = MM_AGR_DIED;
686 /* Rider takes extra damage regardless of whether attacker dies */
691 if (*dmg_p >= mdef->mhp && visflag)
693 pline("%s last thought fades away...",
695 pline("%s
\82Ì
\8dÅ
\8cã
\82Ì
\8ev
\82¢
\82ª
\82æ
\82¬
\82é
\81D
\81D
\81D",
696 s_suffix(Monnam(mdef)));
700 if (give_nutrit && magr->mtame && !magr->isminion) {
701 EDOG(magr)->hungrytime += rnd(60);
708 /* eating a corpse or egg of one's own species is usually naughty */
710 maybe_cannibal(pm, allowmsg)
714 static NEARDATA long ate_brains = 0L;
715 struct permonst *fptr = &mons[pm]; /* food type */
717 /* when poly'd into a mind flayer, multiple tentacle hits in one
718 turn cause multiple digestion checks to occur; avoid giving
719 multiple luck penalties for the same attack */
720 if (moves == ate_brains)
722 ate_brains = moves; /* ate_anything, not just brains... */
724 if (!CANNIBAL_ALLOWED()
725 /* non-cannibalistic heroes shouldn't eat own species ever
726 and also shouldn't eat current species when polymorphed
727 (even if having the form of something which doesn't care
728 about cannibalism--hero's innate traits aren't altered) */
729 && (your_race(fptr) || (Upolyd && same_race(youmonst.data, fptr)))) {
731 if (Upolyd && your_race(fptr))
733 You("have a bad feeling deep inside.");
735 You("
\8c\99\88«
\8a´
\82É
\82¨
\82»
\82í
\82ê
\82½
\81D");
737 You("cannibal! You will regret this!");
739 pline("
\8b¤
\8bò
\82¢
\82¾
\81I
\8cã
\89÷
\82·
\82é
\82¼
\81I");
741 HAggravate_monster |= FROMOUTSIDE;
742 change_luck(-rn1(4, 2)); /* -5..-2 */
752 (void) maybe_cannibal(pm, TRUE);
753 if (flesh_petrifies(&mons[pm])) {
754 if (!Stone_resistance
755 && !(poly_when_stoned(youmonst.data)
756 && polymon(PM_STONE_GOLEM))) {
758 Sprintf(killer.name, "tasting %s meat", mons[pm].mname);
760 Sprintf(killer.name, "%s
\82Ì
\93÷
\82ð
\90H
\82×", mons[pm].mname);
761 killer.format = KILLED_BY;
763 You("turn to stone.");
765 You("
\90Î
\82É
\82È
\82Á
\82½
\81D");
767 if (context.victual.piece)
768 context.victual.eating = FALSE;
769 return; /* lifesaved */
780 /* cannibals are allowed to eat domestic animals without penalty */
781 if (!CANNIBAL_ALLOWED()) {
783 You_feel("that eating the %s was a bad idea.", mons[pm].mname);
785 pline("%s
\82ð
\90H
\82×
\82é
\82Ì
\82Í
\82æ
\82
\82È
\82¢
\8bC
\82ª
\82µ
\82½
\81D", mons[pm].mname);
786 HAggravate_monster |= FROMOUTSIDE;
797 pline("Eating that is instantly fatal.");
799 pline("
\90H
\82×
\82½
\82ç
\82·
\82®
\82É
\8e\80\82ñ
\82Å
\82µ
\82Ü
\82Á
\82½
\81D");
801 Sprintf(killer.name, "unwisely ate the body of %s", mons[pm].mname);
802 killer.format = NO_KILLER_PREFIX;
804 Sprintf(killer.name, "
\8bð
\82©
\82É
\82à%s
\82Ì
\91Ì
\82ð
\90H
\82×
\82Ä", mons[pm].mname);
805 killer.format = KILLED_BY;
808 /* life-saving needed to reach here */
809 exercise(A_WIS, FALSE);
810 /* It so happens that since we know these monsters */
811 /* cannot appear in tins, context.victual.piece will always */
812 /* be what we want, which is not generally true. */
813 if (revive_corpse(context.victual.piece)) {
814 context.victual.piece = (struct obj *) 0;
815 context.victual.o_id = 0;
820 if (!Slimed && !Unchanging && !slimeproof(youmonst.data)) {
822 You("don't feel very well.");
824 You("
\82·
\82²
\82
\8bC
\95ª
\82ª
\88«
\82¢
\81D");
825 make_slimed(10L, (char *) 0);
826 delayed_killer(SLIMED, KILLED_BY_AN, "");
830 if (acidic(&mons[pm]) && Stoned)
843 Sprintf(buf, "What a pity--you just ruined a future piece of %sart!",
844 ACURR(A_CHA) > 15 ? "fine " : "");
846 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",
847 ACURR(A_CHA) > 15 ? "
\8bM
\8fd
\82È" : "");
851 Strcpy(buf, "You feel limber!");
853 Strcpy(buf, "
\91Ì
\82ª
\93î
\82ç
\82©
\82
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
854 make_stoned(0L, buf, 0, (char *) 0);
858 * If you add an intrinsic that can be gotten by eating a monster, add it
859 * to intrinsic_possible() and givit(). (It must already be in prop.h to
860 * be an intrinsic property.)
861 * It would be very easy to make the intrinsics not try to give you one
862 * that you already had by checking to see if you have it in
863 * intrinsic_possible() instead of givit(), but we're not that nice.
866 /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
868 intrinsic_possible(type, ptr)
870 register struct permonst *ptr;
875 #define ifdebugresist(Msg) \
881 #define ifdebugresist(Msg) /*empty*/
885 res = (ptr->mconveys & MR_FIRE) != 0;
886 ifdebugresist("can get fire resistance");
889 res = (ptr->mconveys & MR_SLEEP) != 0;
890 ifdebugresist("can get sleep resistance");
893 res = (ptr->mconveys & MR_COLD) != 0;
894 ifdebugresist("can get cold resistance");
897 res = (ptr->mconveys & MR_DISINT) != 0;
898 ifdebugresist("can get disintegration resistance");
900 case SHOCK_RES: /* shock (electricity) resistance */
901 res = (ptr->mconveys & MR_ELEC) != 0;
902 ifdebugresist("can get shock resistance");
905 res = (ptr->mconveys & MR_POISON) != 0;
906 ifdebugresist("can get poison resistance");
909 res = can_teleport(ptr);
910 ifdebugresist("can get teleport");
912 case TELEPORT_CONTROL:
913 res = control_teleport(ptr);
914 ifdebugresist("can get teleport control");
917 res = telepathic(ptr);
918 ifdebugresist("can get telepathy");
928 /* givit() tries to give you an intrinsic based on the monster's level
929 * and what type of intrinsic it is trying to give you.
934 register struct permonst *ptr;
938 debugpline1("Attempting to give intrinsic %d", type);
939 /* some intrinsics are easier to get than others */
942 if ((ptr == &mons[PM_KILLER_BEE] || ptr == &mons[PM_SCORPION])
951 case TELEPORT_CONTROL:
962 if (ptr->mlevel <= rn2(chance))
963 return; /* failed die roll */
967 debugpline0("Trying to give fire resistance");
968 if (!(HFire_resistance & FROMOUTSIDE)) {
970 You(Hallucination ? "be chillin'." : "feel a momentary chill.");
972 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");
973 HFire_resistance |= FROMOUTSIDE;
977 debugpline0("Trying to give sleep resistance");
978 if (!(HSleep_resistance & FROMOUTSIDE)) {
980 You_feel("wide awake.");
982 You("
\82Ï
\82Á
\82¿
\82è
\96Ú
\82ª
\82³
\82ß
\82½
\81D");
983 HSleep_resistance |= FROMOUTSIDE;
987 debugpline0("Trying to give cold resistance");
988 if (!(HCold_resistance & FROMOUTSIDE)) {
990 You_feel("full of hot air.");
992 You("
\94M
\95\97\82ð
\91S
\90g
\82É
\8a´
\82¶
\82½
\81D");
993 HCold_resistance |= FROMOUTSIDE;
997 debugpline0("Trying to give disintegration resistance");
998 if (!(HDisint_resistance & FROMOUTSIDE)) {
1000 You_feel(Hallucination ? "totally together, man." : "very firm.");
1002 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");
1003 HDisint_resistance |= FROMOUTSIDE;
1006 case SHOCK_RES: /* shock (electricity) resistance */
1007 debugpline0("Trying to give shock resistance");
1008 if (!(HShock_resistance & FROMOUTSIDE)) {
1011 You_feel("grounded in reality.");
1013 You("
\8eÀ
\82Í
\83A
\81[
\83X
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
1016 Your("health currently feels amplified!");
1018 pline("
\8c\92\8dN
\82ª
\91\9d\95\9d\82³
\82ê
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81I");
1019 HShock_resistance |= FROMOUTSIDE;
1023 debugpline0("Trying to give poison resistance");
1024 if (!(HPoison_resistance & FROMOUTSIDE)) {
1026 You_feel(Poison_resistance ? "especially healthy." : "healthy.");
1028 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");
1029 HPoison_resistance |= FROMOUTSIDE;
1033 debugpline0("Trying to give teleport");
1034 if (!(HTeleportation & FROMOUTSIDE)) {
1036 You_feel(Hallucination ? "diffuse." : "very jumpy.");
1038 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");
1039 HTeleportation |= FROMOUTSIDE;
1042 case TELEPORT_CONTROL:
1043 debugpline0("Trying to give teleport control");
1044 if (!(HTeleport_control & FROMOUTSIDE)) {
1046 You_feel(Hallucination ? "centered in your personal space."
1047 : "in control of yourself.");
1049 You_feel(Hallucination ? "
\8e©
\8cÈ
\92\86\90S
\93I
\82É
\82È
\82Á
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D"
1050 : "
\8e©
\95ª
\8e©
\90g
\82ð
\90§
\8cä
\82Å
\82«
\82é
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D");
1052 HTeleport_control |= FROMOUTSIDE;
1056 debugpline0("Trying to give telepathy");
1057 if (!(HTelepat & FROMOUTSIDE)) {
1059 You_feel(Hallucination ? "in touch with the cosmos."
1060 : "a strange mental acuity.");
1062 You_feel(Hallucination ? "
\89F
\92\88\82Ì
\90_
\94é
\82É
\90G
\82ê
\82½
\82æ
\82¤
\82È
\8bC
\82ª
\82µ
\82½
\81D"
1063 : "
\8aï
\96
\82È
\90¸
\90_
\93I
\89s
\82³
\82ð
\8a´
\82¶
\82½
\81D");
1065 HTelepat |= FROMOUTSIDE;
1066 /* If blind, make sure monsters show up. */
1072 debugpline0("Tried to give an impossible intrinsic");
1077 /* called after completely consuming a corpse */
1082 register int tmp = 0;
1083 boolean catch_lycanthropy = FALSE;
1085 /* in case `afternmv' didn't get called for previously mimicking
1086 gold, clean up now to avoid `eatmbuf' memory leak */
1092 /* MRKR: "eye of newt" may give small magical energy boost */
1093 if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
1094 int old_uen = u.uen;
1096 if (u.uen > u.uenmax) {
1101 if (old_uen != u.uen) {
1103 You_feel("a mild buzz.");
1105 You("
\82·
\82±
\82µ
\82Ó
\82ç
\82Ó
\82ç
\82µ
\82½
\81D");
1113 case PM_HUMAN_WERERAT:
1114 catch_lycanthropy = TRUE;
1115 u.ulycn = PM_WERERAT;
1117 case PM_HUMAN_WEREJACKAL:
1118 catch_lycanthropy = TRUE;
1119 u.ulycn = PM_WEREJACKAL;
1121 case PM_HUMAN_WEREWOLF:
1122 catch_lycanthropy = TRUE;
1123 u.ulycn = PM_WEREWOLF;
1134 set_itimeout(&HInvis, (long) rn1(100, 50));
1135 if (!Blind && !BInvis)
1136 self_invis_message();
1138 if (!(HInvis & INTRINSIC))
1140 You_feel("hidden!");
1142 Your("
\8ep
\82Í
\89B
\82³
\82ê
\82½
\81I");
1143 HInvis |= FROMOUTSIDE;
1144 HSee_invisible |= FROMOUTSIDE;
1148 case PM_YELLOW_LIGHT:
1150 make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1153 make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1155 case PM_GIANT_MIMIC:
1158 case PM_LARGE_MIMIC:
1161 case PM_SMALL_MIMIC:
1163 if (youmonst.data->mlet != S_MIMIC && !Unchanging) {
1166 u.uconduct.polyselfs++; /* you're changing form */
1168 You_cant("resist the temptation to mimic %s.",
1169 Hallucination ? "an orange" : "a pile of gold");
1171 You("%s
\82ð
\90^
\8e\97\82µ
\82½
\82¢
\97U
\98f
\82É
\82©
\82ç
\82ê
\82½
\81D",
1172 Hallucination ? "
\83I
\83\8c\83\93\83W" : "
\8bà
\89Ý
\82Ì
\8eR");
1174 /* A pile of gold can't ride. */
1176 dismount_steed(DISMOUNT_FELL);
1178 multi_reason = "pretending to be a pile of gold";
1182 ? "You suddenly dread being peeled and mimic %s again!"
1184 ? "
\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"
1186 : "You now prefer mimicking %s again.",
1188 : "
\82±
\82ñ
\82Ç
\82Í
\82Ü
\82½%s
\82Ì
\90^
\8e\97\82ª
\82µ
\82½
\82
\82È
\82Á
\82½
\81D",
1189 an(Upolyd ? youmonst.data->mname : urace.noun));
1190 eatmbuf = dupstr(buf);
1191 nomovemsg = eatmbuf;
1192 afternmv = eatmdone;
1193 /* ??? what if this was set before? */
1194 youmonst.m_ap_type = M_AP_OBJECT;
1195 youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE;
1198 /* make gold symbol show up now */
1199 display_nhwindow(WIN_MAP, TRUE);
1202 case PM_QUANTUM_MECHANIC:
1204 Your("velocity suddenly seems very uncertain!");
1206 Your("
\91¬
\93x
\82ª
\93Ë
\91R
\81C
\95s
\8am
\92è
\82É
\82È
\82Á
\82½
\81I");
1207 if (HFast & INTRINSIC) {
1208 HFast &= ~INTRINSIC;
1210 You("seem slower.");
1212 You("
\92x
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D");
1214 HFast |= FROMOUTSIDE;
1216 You("seem faster.");
1218 You("
\91¬
\82
\82È
\82Á
\82½
\82æ
\82¤
\82¾
\81D");
1222 if ((HStun & TIMEOUT) > 2)
1223 make_stunned(2L, FALSE);
1224 if ((HConfusion & TIMEOUT) > 2)
1225 make_confused(2L, FALSE);
1228 case PM_DOPPELGANGER:
1229 case PM_SANDESTIN: /* moot--they don't leave corpses */
1232 You_feel("
\88ê
\8fu
\88á
\82Á
\82½
\8a´
\82¶
\82ª
\82µ
\82½
\81D"); /* same as poly trap */
1237 You_feel("a change coming over you.");
1239 pline("
\95Ï
\89»
\82ª
\96K
\82ê
\82½
\81D");
1243 case PM_DISENCHANTER:
1244 /* picks an intrinsic at random and removes it; there's
1245 no feedback if hero already lacks the chosen ability */
1246 debugpline0("using attrcurse to strip an intrinsic");
1249 case PM_MIND_FLAYER:
1250 case PM_MASTER_MIND_FLAYER:
1251 if (ABASE(A_INT) < ATTRMAX(A_INT)) {
1254 pline("Yum! That was real brain food!");
1256 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");
1257 (void) adjattrib(A_INT, 1, FALSE);
1258 break; /* don't give them telepathy, too */
1262 pline("For some reason, that tasted bland.");
1264 pline("
\82Ç
\82¤
\82µ
\82½
\82í
\82¯
\82©
\81C
\92W
\94\92\82È
\96¡
\82¾
\81D");
1268 struct permonst *ptr = &mons[pm];
1269 boolean conveys_STR = is_giant(ptr);
1272 if (dmgtype(ptr, AD_STUN) || dmgtype(ptr, AD_HALU)
1273 || pm == PM_VIOLET_FUNGUS) {
1275 pline("Oh wow! Great stuff!");
1277 pline("
\83\8f\81[
\83H
\81I
\82±
\82è
\82á
\82·
\82²
\82¢
\81I");
1278 (void) make_hallucinated((HHallucination & TIMEOUT) + 200L, FALSE,
1282 /* Check the monster for all of the intrinsics. If this
1283 * monster can give more than one, pick one to try to give
1284 * from among all it can give.
1286 * Strength from giants is now treated like an intrinsic
1287 * rather than being given unconditionally.
1289 count = 0; /* number of possible intrinsics */
1290 tmp = 0; /* which one we will try to give */
1293 tmp = -1; /* use -1 as fake prop index for STR */
1294 debugpline1("\"Intrinsic\" strength, %d", tmp);
1296 for (i = 1; i <= LAST_PROP; i++) {
1297 if (!intrinsic_possible(i, ptr))
1300 /* a 1 in count chance of replacing the old choice
1301 with this one, and a count-1 in count chance
1302 of keeping the old choice (note that 1 in 1 and
1303 0 in 1 are what we want for the first candidate) */
1305 debugpline2("Intrinsic %d replacing %d", i, tmp);
1309 /* if strength is the only candidate, give it 50% chance */
1310 if (conveys_STR && count == 1 && !rn2(2))
1312 /* if something was chosen, give it now (givit() might fail) */
1314 gainstr((struct obj *) 0, 0, TRUE);
1320 if (catch_lycanthropy)
1321 retouch_equipment(2);
1327 violated_vegetarian()
1329 u.uconduct.unvegetarian++;
1330 if (Role_if(PM_MONK)) {
1332 You_feel("guilty.");
1334 pline("
\8dß
\82ð
\8a´
\82¶
\82½
\81D");
1340 /* common code to check and possibly charge for 1 context.tin.tin,
1341 * will split() context.tin.tin if necessary */
1343 costly_tin(alter_type)
1344 int alter_type; /* COST_xxx */
1346 struct obj *tin = context.tin.tin;
1348 if (carried(tin) ? tin->unpaid
1349 : (costly_spot(tin->ox, tin->oy) && !tin->no_charge)) {
1350 if (tin->quan > 1L) {
1351 tin = context.tin.tin = splitobj(tin, 1L);
1352 context.tin.o_id = tin->o_id;
1354 costly_alteration(tin, alter_type);
1359 tin_variety_txt(s, tinvariety)
1365 if (s && tinvariety) {
1367 for (k = 0; k < TTSZ - 1; ++k) {
1368 l = (int) strlen(tintxts[k].txt);
1369 if (!strncmpi(s, tintxts[k].txt, l) && ((int) strlen(s) > l)
1380 * This assumes that buf already contains the word "tin",
1381 * as is the case with caller xname().
1383 /*JP:
\81u
\8aÊ
\8bl
\81v
\82Í
\8cã
\82Å
\95t
\82¯
\82é */
1385 tin_details(obj, mnum, buf)
1391 int r = tin_variety(obj, TRUE);
1394 if (r == SPINACH_TIN)
1396 Strcat(buf, " of spinach");
1398 Strcat(buf, "
\83z
\83E
\83\8c\83\93\91\90\82Ì");
1399 else if (mnum == NON_PM)
1401 Strcpy(buf, "empty tin");
1403 Strcat(buf, "
\8bó
\82Á
\82Û
\82Ì");
1405 #if 0 /*JP*//*
\93ú
\96{
\8cê
\82Í
\8cã
\82Å*/
1406 if ((obj->cknown || iflags.override_ID) && obj->spe < 0) {
1407 if (r == ROTTEN_TIN || r == HOMEMADE_TIN) {
1408 /* put these before the word tin */
1409 Sprintf(buf2, "%s %s of ", tintxts[r].txt, buf);
1412 Sprintf(eos(buf), " of %s ", tintxts[r].txt);
1414 Sprintf(eos(buf), "%s", tintxts[r].txt);
1416 Strcpy(eos(buf), " of ");
1419 #if 1 /*JP*//*
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u*/
1420 if (strstr(tintxts[r].txt, "
\82Ì") != tintxts[r].txt) {
1421 Strcpy(eos(buf), tintxts[r].txt);
1424 if (vegetarian(&mons[mnum]))
1426 Sprintf(eos(buf), "%s", mons[mnum].mname);
1428 Sprintf(eos(buf), "%s", mons[mnum].mname);
1431 Sprintf(eos(buf), "%s meat", mons[mnum].mname);
1433 Sprintf(eos(buf), "%s
\82Ì
\93÷", mons[mnum].mname);
1434 #if 1 /*JP*//*
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u*/
1435 if (strstr(tintxts[r].txt, "
\82Ì") == tintxts[r].txt) {
1436 Strcpy(eos(buf), tintxts[r].txt);
1438 Strcpy(eos(buf), "
\82Ì");
1445 set_tin_variety(obj, forcetype)
1451 if (forcetype == SPINACH_TIN
1452 || (forcetype == HEALTHY_TIN
1453 && (obj->corpsenm == NON_PM /* empty or already spinach */
1454 || !vegetarian(&mons[obj->corpsenm])))) { /* replace meat */
1455 obj->corpsenm = NON_PM; /* not based on any monster */
1456 obj->spe = 1; /* spinach */
1458 } else if (forcetype == HEALTHY_TIN) {
1459 r = tin_variety(obj, FALSE);
1460 if (r < 0 || r >= TTSZ)
1461 r = ROTTEN_TIN; /* shouldn't happen */
1462 while ((r == ROTTEN_TIN && !obj->cursed) || !tintxts[r].fodder)
1464 } else if (forcetype >= 0 && forcetype < TTSZ - 1) {
1466 } else { /* RANDOM_TIN */
1467 r = rn2(TTSZ - 1); /* take your pick */
1468 if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1469 r = HOMEMADE_TIN; /* lizards don't rot */
1471 obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
1475 tin_variety(obj, disp)
1477 boolean disp; /* we're just displaying so leave things alone */
1481 if (obj->spe == 1) {
1483 } else if (obj->cursed) {
1484 r = ROTTEN_TIN; /* always rotten if cursed */
1485 } else if (obj->spe < 0) {
1487 --r; /* get rid of the offset */
1491 if (!disp && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
1492 r = ROTTEN_TIN; /* some homemade tins go bad */
1494 if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1495 r = HOMEMADE_TIN; /* lizards don't rot */
1505 struct obj *tin = context.tin.tin;
1507 r = tin_variety(tin, FALSE);
1508 if (tin->otrapped || (tin->cursed && r != HOMEMADE_TIN && !rn2(8))) {
1510 b_trapped("tin", 0);
1512 b_trapped("
\8aÊ", 0);
1513 costly_tin(COST_DSTROY);
1517 pline1(mesg); /* "You succeed in opening the tin." */
1519 if (r != SPINACH_TIN) {
1520 mnum = tin->corpsenm;
1521 if (mnum == NON_PM) {
1523 pline("It turns out to be empty.");
1525 pline("
\8aÊ
\82Í
\8bó
\82Á
\82Û
\82¾
\82Á
\82½
\81D");
1526 tin->dknown = tin->known = 1;
1527 costly_tin(COST_OPEN);
1531 which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */
1532 if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
1533 && (Stone_resistance || Hallucination)) {
1538 which = 1; /* suppress pluralization */
1539 } else if (Hallucination) {
1540 what = rndmonnam(NULL);
1542 what = mons[mnum].mname;
1543 if (the_unique_pm(&mons[mnum]))
1545 else if (type_is_pname(&mons[mnum]))
1549 what = makeplural(what);
1550 else if (which == 2)
1554 pline("It smells like %s.", what);
1556 pline("%s
\82Ì
\82æ
\82¤
\82È
\93õ
\82¢
\82ª
\82µ
\82½
\81D", what);
1558 if (yn("Eat it?") == 'n') {
1560 if (yn("
\90H
\82×
\82Ü
\82·
\82©
\81H") == 'n') {
1563 You("discard the open tin.");
1565 You("
\8aJ
\82¯
\82½
\8aÊ
\82ð
\8eÌ
\82Ä
\82½
\81D");
1567 tin->dknown = tin->known = 1;
1568 costly_tin(COST_OPEN);
1572 /* in case stop_occupation() was called on previous meal */
1573 context.victual.piece = (struct obj *) 0;
1574 context.victual.o_id = 0;
1575 context.victual.fullwarn = context.victual.eating =
1576 context.victual.doreset = FALSE;
1579 You("consume %s %s.", tintxts[r].txt, mons[mnum].mname);
1580 #else /*JP:
\81u
\82Ì
\81v
\82Å
\8en
\82Ü
\82é
\82È
\82ç
\8cã
\92u
\81A
\82»
\82ê
\88È
\8aO
\82È
\82ç
\91O
\92u */
1581 if (strstr(tintxts[r].txt, "
\82Ì") == tintxts[r].txt) {
1582 You("%s%s
\82Ì
\8aÊ
\8bl
\82ð
\82½
\82¢
\82ç
\82°
\82½
\81D", mons[mnum].mname, tintxts[r].txt);
1584 You("%s%s
\82Ì
\8aÊ
\8bl
\82ð
\82½
\82¢
\82ç
\82°
\82½
\81D", tintxts[r].txt, mons[mnum].mname);
1588 eating_conducts(&mons[mnum]);
1590 tin->dknown = tin->known = 1;
1594 /* charge for one at pre-eating cost */
1595 costly_tin(COST_OPEN);
1597 if (tintxts[r].nut < 0) /* rotten */
1598 make_vomiting((long) rn1(15, 10), FALSE);
1600 lesshungry(tintxts[r].nut);
1602 if (tintxts[r].greasy) {
1603 /* Assume !Glib, because you can't open tins when Glib. */
1604 incr_itimeout(&Glib, rnd(15));
1606 pline("Eating %s food made your %s very slippery.",
1607 tintxts[r].txt, makeplural(body_part(FINGER)));
1609 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",
1614 } else { /* spinach... */
1617 pline("It contains some decaying%s%s substance.",
1618 Blind ? "" : " ", Blind ? "" : hcolor(NH_GREEN));
1620 pline("%s
\95\85\82Á
\82½
\95¨
\91Ì
\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\81D",
1621 Blind ? "" : hcolor(NH_GREEN));
1625 pline("It contains spinach.");
1627 pline("
\83z
\83E
\83\8c\83\93\91\90\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\81D");
1628 tin->dknown = tin->known = 1;
1632 if (yn("Eat it?") == 'n') {
1634 if (yn("
\90H
\82×
\82Ü
\82·
\82©
\81H") == 'n') {
1637 You("discard the open tin.");
1639 You("
\8aJ
\82¯
\82½
\8aÊ
\82ð
\8eÌ
\82Ä
\82½
\81D");
1640 costly_tin(COST_OPEN);
1645 * Same order as with non-spinach above:
1646 * conduct update, side-effects, shop handling, and nutrition.
1649 .food++; /* don't need vegan/vegetarian checks for spinach */
1652 pline("This makes you feel like %s!",
1653 Hallucination ? "Swee'pea" : "Popeye");
1655 pline("%s
\82Ì
\82æ
\82¤
\82È
\8bC
\95ª
\82É
\82È
\82Á
\82½
\81I",
1656 Hallucination ? "
\83X
\83C
\81[
\83s
\81[" : "
\83|
\83p
\83C");
1658 gainstr(tin, 0, FALSE);
1660 costly_tin(COST_OPEN);
1662 lesshungry(tin->blessed
1665 ? (400 + rnd(200)) /* uncursed */
1666 : (200 + rnd(400))); /* cursed */
1674 context.tin.tin = (struct obj *) 0;
1675 context.tin.o_id = 0;
1678 /* called during each move whilst opening a tin */
1682 /* perhaps it was stolen (although that should cause interruption) */
1683 if (!carried(context.tin.tin)
1684 && (!obj_here(context.tin.tin, u.ux, u.uy) || !can_reach_floor(TRUE)))
1685 return 0; /* %% probably we should use tinoid */
1686 if (context.tin.usedtime++ >= 50) {
1688 You("give up your attempt to open the tin.");
1690 You("
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82ð
\82 \82«
\82ç
\82ß
\82½
\81D");
1693 if (context.tin.usedtime < context.tin.reqtime)
1694 return 1; /* still busy */
1697 consume_tin("You succeed in opening the tin.");
1699 consume_tin("
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82É
\90¬
\8c÷
\82µ
\82½
\81D");
1703 /* called when starting to open a tin */
1708 const char *mesg = 0;
1711 if (metallivorous(youmonst.data)) {
1713 mesg = "You bite right into the metal tin...";
1715 mesg = "
\8bà
\91®
\82Ì
\8aÊ
\82ð
\8a\9a\82Ý
\82Í
\82¶
\82ß
\82½
\81D
\81D
\81D";
1717 } else if (cantwield(youmonst.data)) { /* nohands || verysmall */
1719 You("cannot handle the tin properly to open it.");
1721 You("
\8aÊ
\82ð
\82¤
\82Ü
\82
\8aJ
\82¯
\82ç
\82ê
\82È
\82¢
\81D");
1723 } else if (otmp->blessed) {
1724 /* 50/50 chance for immediate access vs 1 turn delay (unless
1725 wielding blessed tin opener which always yields immediate
1726 access); 1 turn delay case is non-deterministic: getting
1727 interrupted and retrying might yield another 1 turn delay
1728 or might open immediately on 2nd (or 3rd, 4th, ...) try */
1729 tmp = (uwep && uwep->blessed && uwep->otyp == TIN_OPENER) ? 0 : rn2(2);
1732 mesg = "The tin opens like magic!";
1734 mesg = "
\8aÊ
\82Í
\96\82\96@
\82Ì
\82æ
\82¤
\82É
\8aJ
\82¢
\82½
\81I";
1737 pline_The("tin seems easy to open.");
1739 pline_The("
\8aÊ
\82Í
\8aÈ
\92P
\82É
\8aJ
\82¯
\82ç
\82ê
\82»
\82¤
\82¾
\81D");
1741 switch (uwep->otyp) {
1744 mesg = "You easily open the tin."; /* iff tmp==0 */
1746 mesg = "
\82 \82È
\82½
\82Í
\8aÈ
\92P
\82É
\8aÊ
\82ð
\8aJ
\82¯
\82½
\81D"; /* iff tmp==0 */
1748 tmp = rn2(uwep->cursed ? 3 : !uwep->blessed ? 2 : 1);
1766 pline("Using %s you try to open the tin.", yobjnam(uwep, (char *) 0));
1768 You("%s
\82ð
\8eg
\82Á
\82Ä
\8aÊ
\82ð
\8aJ
\82¯
\82æ
\82¤
\82Æ
\82µ
\82½
\81D", xname(uwep));
1772 pline("It is not so easy to open this tin.");
1774 pline("
\82±
\82Ì
\8aÊ
\82ð
\8aJ
\82¯
\82é
\82Ì
\82Í
\97e
\88Õ
\82È
\82±
\82Æ
\82Å
\82Í
\82È
\82¢
\81D");
1777 pline_The("tin slips from your %s.",
1779 pline("
\8aÊ
\82Í
\82 \82È
\82½
\82Ì%s
\82©
\82ç
\8a\8a\82è
\97\8e\82¿
\82½
\81D",
1780 makeplural(body_part(FINGER)));
1781 if (otmp->quan > 1L) {
1782 otmp = splitobj(otmp, 1L);
1790 tmp = rn1(1 + 500 / ((int) (ACURR(A_DEX) + ACURRSTR)), 10);
1793 context.tin.tin = otmp;
1794 context.tin.o_id = otmp->o_id;
1796 consume_tin(mesg); /* begin immediately */
1798 context.tin.reqtime = tmp;
1799 context.tin.usedtime = 0;
1801 set_occupation(opentin, "opening the tin", 0);
1803 set_occupation(opentin, "
\8aÊ
\82ð
\8aJ
\82¯
\82é", 0);
1808 /* called when waking up after fainting */
1810 Hear_again(VOID_ARGS)
1812 /* Chance of deafness going away while fainted/sleeping/etc. */
1814 make_deaf(0L, FALSE);
1818 /* called on the "first bite" of rotten food */
1824 pline("Blecch! Rotten %s!", foodword(obj));
1826 pline("
\83Q
\83F
\81I
\95\85\82Á
\82½%s
\82¾
\81I", foodword(obj));
1830 You_feel("rather trippy.");
1832 You("
\82Ö
\82ë
\82Ö
\82ë
\82µ
\82½
\81D");
1835 You_feel("rather %s.", body_part(LIGHT_HEADED));
1837 You("%s
\81D", body_part(LIGHT_HEADED));
1838 make_confused(HConfusion + d(2, 4), FALSE);
1839 } else if (!rn2(4) && !Blind) {
1841 pline("Everything suddenly goes dark.");
1843 pline("
\93Ë
\91R
\91S
\82Ä
\82ª
\88Ã
\82
\82È
\82Á
\82½
\81D");
1844 make_blinded((long) d(2, 10), FALSE);
1846 Your1(vision_clears);
1847 } else if (!rn2(3)) {
1848 const char *what, *where;
1849 int duration = rnd(10);
1853 what = "goes", where = "dark";
1855 what = "
\82È
\82Á
\82½", where = "
\88Ã
\88Å
\82É";
1856 else if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
1858 what = "you lose control of", where = "yourself";
1860 what = "
\90§
\8cä
\82Å
\82«
\82È
\82
\82È
\82Á
\82½", where = "
\8e©
\95ª
\82ð";
1863 what = "you slap against the",
1865 what = "
\82É
\82Ô
\82Â
\82©
\82Á
\82½",
1867 where = (u.usteed) ? "saddle" : surface(u.ux, u.uy);
1869 where = (u.usteed) ? "
\88Æ" : surface(u.ux, u.uy);
1871 pline_The("world spins and %s %s.", what, where);
1873 pline("
\90¢
\8aE
\82ª
\89ñ
\93]
\82µ
\81C%s%s
\81D", where, what);
1874 incr_itimeout(&HDeaf, duration);
1876 multi_reason = "unconscious from rotten food";
1878 nomovemsg = "You are conscious again.";
1880 nomovemsg = "
\82 \82È
\82½
\82Í
\82Ü
\82½
\90³
\8bC
\82Ã
\82¢
\82½
\81D";
1881 afternmv = Hear_again;
1887 /* called when a corpse is selected as food */
1892 int tp = 0, mnum = otmp->corpsenm;
1895 boolean stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
1896 && !poly_when_stoned(youmonst.data));
1899 if (!vegan(&mons[mnum]))
1900 u.uconduct.unvegan++;
1901 if (!vegetarian(&mons[mnum]))
1902 violated_vegetarian();
1904 if (!nonrotting_corpse(mnum)) {
1905 long age = peek_at_iced_corpse_age(otmp);
1907 rotted = (monstermoves - age) / (10L + rn2(20));
1910 else if (otmp->blessed)
1914 if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
1915 boolean cannibal = maybe_cannibal(mnum, FALSE);
1918 pline("Ulch - that %s was tainted%s!",
1919 mons[mnum].mlet == S_FUNGUS
1920 ? "fungoid vegetation"
1921 : !vegetarian(&mons[mnum]) ? "meat" : "protoplasm",
1922 cannibal ? ", you cannibal" : "");
1924 pline("
\83I
\83F
\81I
\82±
\82Ì%s
\82Í
\95\85\82Á
\82Ä
\82¢
\82é%s
\81I",
1925 mons[mnum].mlet == S_FUNGUS
1926 ? "
\8d×
\8bÛ
\82É
\89\98\90õ
\82³
\82ê
\82½
\90A
\95¨"
1927 : !vegetarian(&mons[mnum]) ? "
\93÷" : "
\90¶
\95¨",
1928 cannibal ? "
\81D
\82µ
\82©
\82à
\8b¤
\90H
\82¢
\82¾" : "");
1930 if (Sick_resistance) {
1932 pline("It doesn't seem at all sickening, though...");
1934 pline("
\82µ
\82©
\82µ
\81C
\82¢
\82½
\82Á
\82Ä
\8c³
\8bC
\82¾
\81D
\81D
\81D");
1938 sick_time = (long) rn1(10, 10);
1939 /* make sure new ill doesn't result in improvement */
1940 if (Sick && (sick_time > Sick))
1941 sick_time = (Sick > 1L) ? Sick - 1L : 1L;
1943 make_sick(sick_time, corpse_xname(otmp, "rotted", CXN_NORMAL),
1944 TRUE, SICK_VOMITABLE);
1946 make_sick(sick_time, corpse_xname(otmp, "
\95\85\82Á
\82½", CXN_NORMAL),
1947 TRUE, SICK_VOMITABLE);
1955 } else if (acidic(&mons[mnum]) && !Acid_resistance) {
1958 You("have a very bad case of stomach acid."); /* not body_part() */
1960 pline("
\88Ý
\8e_
\82Ì
\92²
\8eq
\82ª
\82Æ
\82Ä
\82à
\88«
\82¢
\81D");
1963 losehp(rnd(15), "acidic corpse", KILLED_BY_AN); /* acid damage */
1965 losehp(rnd(15), "
\8e_
\82Ì
\8e\80\91Ì
\82Å", KILLED_BY_AN);
1967 } else if (poisonous(&mons[mnum]) && rn2(5)) {
1970 pline("Ecch - that must have been poisonous!");
1972 pline("
\83E
\83Q
\83F
\81[
\81C
\97L
\93Å
\82¾
\82Á
\82½
\82É
\82¿
\82ª
\82¢
\82È
\82¢
\81I");
1973 if (!Poison_resistance) {
1976 losehp(rnd(15), "poisonous corpse", KILLED_BY_AN);
1978 losehp(rnd(15), "
\93Å
\82Ì
\8e\80\91Ì
\82Å", KILLED_BY_AN);
1981 You("seem unaffected by the poison.");
1983 You("
\93Å
\82Ì
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
1984 /* now any corpse left too long will make you mildly ill */
1985 } else if ((rotted > 5L || (rotted > 3L && rn2(5))) && !Sick_resistance) {
1988 You_feel("%ssick.", (Sick) ? "very " : "");
1990 You("%s
\8bC
\95ª
\82ª
\88«
\82¢
\81D", (Sick) ? "
\82Æ
\82Ä
\82à" : "");
1992 losehp(rnd(8), "cadaver", KILLED_BY_AN);
1994 losehp(rnd(8), "
\95\85\97\90\8e\80\91Ì
\82Å", KILLED_BY_AN);
1997 /* delay is weight dependent */
1998 context.victual.reqtime = 3 + (mons[mnum].cwt >> 6);
2000 if (!tp && !nonrotting_corpse(mnum) && (otmp->orotten || !rn2(7))) {
2001 if (rottenfood(otmp)) {
2002 otmp->orotten = TRUE;
2003 (void) touchfood(otmp);
2007 if (!mons[otmp->corpsenm].cnutrit) {
2008 /* no nutrition: rots away, no message if you passed out */
2011 pline_The("corpse rots away completely.");
2013 pline("
\8e\80\91Ì
\82Í
\8a®
\91S
\82É
\95\85\82Á
\82Ä
\82µ
\82Ü
\82Á
\82½
\81D");
2022 consume_oeaten(otmp, 2); /* oeaten >>= 2 */
2023 } else if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
2024 && (Stone_resistance || Hallucination)) {
2026 pline("This tastes just like chicken!");
2028 pline("
\82±
\82ê
\82Í
\8c{
\93÷
\82Ì
\96¡
\82¾
\81I");
2029 } else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) {
2031 You("peck the eyeball with delight.");
2033 You("
\96Ú
\8bÊ
\82ð
\82Â
\82ñ
\82Â
\82ñ
\82Â
\82Â
\82¢
\82½
\81D");
2035 /* [is this right? omnivores end up always disliking the taste] */
2036 boolean yummy = vegan(&mons[mnum])
2037 ? (!carnivorous(youmonst.data)
2038 && herbivorous(youmonst.data))
2039 : (carnivorous(youmonst.data)
2040 && !herbivorous(youmonst.data));
2044 type_is_pname(&mons[mnum])
2045 ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
2046 food_xname(otmp, FALSE),
2048 ? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
2051 : (yummy ? "is delicious" : "tastes terrible"));
2053 pline("
\82±
\82Ì%s
\82Í%s
\81I",
2054 food_xname(otmp, FALSE),
2056 ? (yummy ? ((u.umonnum == PM_TIGER) ? "
\83O
\83D
\83\8c\83C
\83g
\83D"
2057 : "
\83C
\83P
\82Ä
\82é")
2058 : "
\83C
\83P
\82Ä
\82È
\82¢")
2059 : (yummy ? "
\82Æ
\82Ä
\82à
\8e|
\82¢" : "
\82Ð
\82Ç
\82¢
\96¡
\82¾"));
2066 /* called as you start to eat */
2071 const char *old_nomovemsg, *save_nomovemsg;
2073 debugpline2("start_eating: %lx (victual = %lx)", (unsigned long) otmp,
2074 (unsigned long) context.victual.piece);
2075 debugpline1("reqtime = %d", context.victual.reqtime);
2076 debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
2077 debugpline1("nmod = %d", context.victual.nmod);
2078 debugpline1("oeaten = %d", otmp->oeaten);
2079 context.victual.fullwarn = context.victual.doreset = FALSE;
2080 context.victual.eating = TRUE;
2082 if (otmp->otyp == CORPSE || otmp->globby) {
2083 cprefx(context.victual.piece->corpsenm);
2084 if (!context.victual.piece || !context.victual.eating) {
2085 /* rider revived, or died and lifesaved */
2090 old_nomovemsg = nomovemsg;
2092 /* survived choking, finish off food that's nearly done;
2093 need this to handle cockatrice eggs, fortune cookies, etc */
2094 if (++context.victual.usedtime >= context.victual.reqtime) {
2095 /* don't want done_eating() to issue nomovemsg if it
2096 is due to vomit() called by bite() */
2097 save_nomovemsg = nomovemsg;
2102 nomovemsg = save_nomovemsg;
2107 if (++context.victual.usedtime >= context.victual.reqtime) {
2108 /* print "finish eating" message if they just resumed -dlc */
2109 done_eating(context.victual.reqtime > 1 ? TRUE : FALSE);
2114 Sprintf(msgbuf, "eating %s", food_xname(otmp, TRUE));
2116 Sprintf(msgbuf, "%s
\82ð
\90H
\82×
\82é", food_xname(otmp, TRUE));
2117 set_occupation(eatfood, msgbuf, 0);
2121 * called on "first bite" of (non-corpse) food.
2122 * used for non-rotten non-tin non-corpse food
2128 switch (otmp->otyp) {
2130 if (u.uhunger <= 200)
2132 pline(Hallucination ? "Oh wow, like, superior, man!"
2134 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"
2136 : "That food really hit the spot!");
2138 : "
\82±
\82Ì
\90H
\82×
\95¨
\82Í
\96{
\93\96\82É
\90\
\82µ
\95ª
\82È
\82¢
\81I");
2139 else if (u.uhunger <= 700)
2141 pline("That satiated your %s!", body_part(STOMACH));
2143 pline("
\96\9e\95 \82É
\82È
\82Á
\82½
\81I");
2146 if (carnivorous(youmonst.data) && !humanoid(youmonst.data))
2148 pline("That tripe ration was surprisingly good!");
2150 pline("
\82±
\82Ì
\83\82\83c
\93÷
\82Í
\82¨
\82Ç
\82ë
\82
\82Ù
\82Ç
\8e|
\82¢
\81I");
2151 else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC)))
2153 pline(Hallucination ? "Tastes great! Less filling!"
2155 pline(Hallucination ? "
\82¤
\82Ü
\82¢
\81I
\82à
\82Á
\82Æ
\82Ù
\82µ
\82
\82È
\82é
\82Ë
\81I"
2157 : "Mmm, tripe... not bad!");
2159 : "
\82ñ
\81[
\81C
\83\82\83c
\82©
\81D
\81D
\81D
\88«
\82
\82È
\82¢
\81I");
2162 pline("Yak - dog food!");
2164 pline("
\82¤
\82°
\81C
\83h
\83b
\83O
\83t
\81[
\83h
\82¾
\81I");
2165 more_experienced(1, 0);
2167 /* not cannibalism, but we use similar criteria
2168 for deciding whether to be sickened by this meal */
2169 if (rn2(2) && !CANNIBAL_ALLOWED())
2170 make_vomiting((long) rn1(context.victual.reqtime, 14), FALSE);
2175 case HUGE_CHUNK_OF_MEAT:
2178 case CLOVE_OF_GARLIC:
2179 if (is_undead(youmonst.data)) {
2180 make_vomiting((long) rn1(context.victual.reqtime, 5), FALSE);
2185 if (otmp->otyp == SLIME_MOLD && !otmp->cursed
2186 && otmp->spe == context.current_fruit) {
2188 pline("My, that was a %s %s!",
2189 Hallucination ? "primo" : "yummy",
2190 singular(otmp, xname));
2192 pline("
\82¨
\82â
\81C
\82È
\82ñ
\82Ä%s%s
\82¾
\81I",
2193 Hallucination ? "
\8fã
\95i
\82È" : "
\82¨
\82¢
\82µ
\82¢",
2194 singular(otmp, xname));
2196 } else if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2197 ; /* skip core joke; feedback deferred til fpostfx() */
2199 #if defined(MAC) || defined(MACOSX)
2200 /* KMH -- Why should Unix have all the fun?
2201 We check MACOSX before UNIX to get the Apple-specific apple
2202 message; the '#if UNIX' code will still kick in for pear. */
2203 } else if (otmp->otyp == APPLE) {
2205 pline("Delicious! Must be a Macintosh!");
2207 pline("
\82·
\82Î
\82ç
\82µ
\82¢
\81I
\83}
\83b
\83L
\83\93\83g
\83b
\83V
\83\85\82É
\88á
\82¢
\82È
\82¢
\81I");
2211 } else if (otmp->otyp == APPLE || otmp->otyp == PEAR) {
2212 if (!Hallucination) {
2213 pline("Core dumped.");
2215 /* This is based on an old Usenet joke, a fake a.out manual
2220 pline("%s -- core dumped.",
2222 ? "Segmentation fault"
2228 } else if (otmp->otyp == EGG && stale_egg(otmp)) {
2230 pline("Ugh. Rotten egg."); /* perhaps others like it */
2232 pline("
\83E
\83Q
\83F
\81[
\95\85\82Á
\82½
\97\91\82¾
\81D");
2234 make_vomiting((Vomiting & TIMEOUT) + (long) d(10, 4), TRUE);
2238 pline("This %s is %s", singular(otmp, xname),
2240 ? (Hallucination ? "grody!" : "terrible!")
2241 : (otmp->otyp == CRAM_RATION
2242 || otmp->otyp == K_RATION
2243 || otmp->otyp == C_RATION)
2245 : Hallucination ? "gnarly!" : "delicious!");
2247 pline("
\82±
\82Ì%s
\82Í%s", singular(otmp, xname),
2249 ? (Hallucination ? "
\83C
\83P
\82Ä
\82È
\82¢
\81I" : "
\82Ð
\82Ç
\82¢
\96¡
\82¾
\81I")
2250 : (otmp->otyp == CRAM_RATION
2251 || otmp->otyp == K_RATION
2252 || otmp->otyp == C_RATION)
2253 ? "
\96¡
\8bC
\82È
\82¢
\81D"
2254 : Hallucination ? "
\83C
\83P
\82Ä
\82é
\81I" : "
\82¤
\82Ü
\82¢
\81I");
2257 break; /* default */
2261 /* increment a combat intrinsic with limits on its growth */
2263 bounded_increase(old, inc, typ)
2266 int absold, absinc, sgnold, sgninc;
2268 /* don't include any amount coming from worn rings */
2269 if (uright && uright->otyp == typ)
2271 if (uleft && uleft->otyp == typ)
2273 absold = abs(old), absinc = abs(inc);
2274 sgnold = sgn(old), sgninc = sgn(inc);
2276 if (absinc == 0 || sgnold != sgninc || absold + absinc < 10) {
2277 ; /* use inc as-is */
2278 } else if (absold + absinc < 20) {
2279 absinc = rnd(absinc); /* 1..n */
2280 if (absold + absinc < 10)
2281 absinc = 10 - absold;
2282 inc = sgninc * absinc;
2283 } else if (absold + absinc < 40) {
2284 absinc = rn2(absinc) ? 1 : 0;
2285 if (absold + absinc < 20)
2286 absinc = rnd(20 - absold);
2287 inc = sgninc * absinc;
2289 inc = 0; /* no further increase allowed via this method */
2295 accessory_has_effect(otmp)
2299 pline("Magic spreads through your body as you digest the %s.",
2300 otmp->oclass == RING_CLASS ? "ring" : "amulet");
2302 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",
2303 otmp->oclass == RING_CLASS ? "
\8ew
\97Ö" : "
\96\82\8f\9c\82¯");
2311 int typ = otmp->otyp;
2314 /* Note: rings are not so common that this is unbalancing. */
2315 /* (How often do you even _find_ 3 rings of polymorph in a game?) */
2316 oldprop = u.uprops[objects[typ].oc_oprop].intrinsic;
2317 if (otmp == uleft || otmp == uright) {
2320 return; /* died from sink fall */
2322 otmp->known = otmp->dknown = 1; /* by taste */
2323 if (!rn2(otmp->oclass == RING_CLASS ? 3 : 5)) {
2324 switch (otmp->otyp) {
2326 if (!objects[typ].oc_oprop)
2327 break; /* should never happen */
2329 if (!(u.uprops[objects[typ].oc_oprop].intrinsic & FROMOUTSIDE))
2330 accessory_has_effect(otmp);
2332 u.uprops[objects[typ].oc_oprop].intrinsic |= FROMOUTSIDE;
2335 case RIN_SEE_INVISIBLE:
2336 set_mimic_blocking();
2338 if (Invis && !oldprop && !ESee_invisible
2339 && !perceives(youmonst.data) && !Blind) {
2342 pline("Suddenly you can see yourself.");
2344 pline("
\93Ë
\91R
\8e©
\95ª
\8e©
\90g
\82ª
\8c©
\82¦
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
\81D");
2348 case RIN_INVISIBILITY:
2349 if (!oldprop && !EInvis && !BInvis && !See_invisible
2353 Your("body takes on a %s transparency...",
2354 Hallucination ? "normal" : "strange");
2356 pline("%s
\82 \82È
\82½
\82Ì
\91Ì
\82Í
\93§
\89ß
\90«
\82ð
\82à
\82Á
\82½
\81D
\81D
\81D",
2357 Hallucination ? "
\82 \82½
\82è
\82Ü
\82¦
\82È
\82±
\82Æ
\82¾
\82ª" : "
\8aï
\96
\82È
\82±
\82Æ
\82É");
2362 case RIN_PROTECTION_FROM_SHAPE_CHAN:
2365 case RIN_LEVITATION:
2366 /* undo the `.intrinsic |= FROMOUTSIDE' done above */
2367 u.uprops[LEVITATION].intrinsic = oldprop;
2370 incr_itimeout(&HLevitation, d(10, 20));
2374 } /* inner switch */
2375 break; /* default case of outer switch */
2378 accessory_has_effect(otmp);
2379 if (adjattrib(A_CHA, otmp->spe, -1))
2382 case RIN_GAIN_STRENGTH:
2383 accessory_has_effect(otmp);
2384 if (adjattrib(A_STR, otmp->spe, -1))
2387 case RIN_GAIN_CONSTITUTION:
2388 accessory_has_effect(otmp);
2389 if (adjattrib(A_CON, otmp->spe, -1))
2392 case RIN_INCREASE_ACCURACY:
2393 accessory_has_effect(otmp);
2394 u.uhitinc = (schar) bounded_increase((int) u.uhitinc, otmp->spe,
2395 RIN_INCREASE_ACCURACY);
2397 case RIN_INCREASE_DAMAGE:
2398 accessory_has_effect(otmp);
2399 u.udaminc = (schar) bounded_increase((int) u.udaminc, otmp->spe,
2400 RIN_INCREASE_DAMAGE);
2402 case RIN_PROTECTION:
2403 accessory_has_effect(otmp);
2404 HProtection |= FROMOUTSIDE;
2405 u.ublessed = bounded_increase(u.ublessed, otmp->spe,
2409 case RIN_FREE_ACTION:
2410 /* Give sleep resistance instead */
2411 if (!(HSleep_resistance & FROMOUTSIDE))
2412 accessory_has_effect(otmp);
2413 if (!Sleep_resistance)
2415 You_feel("wide awake.");
2417 You("
\82Ï
\82Á
\82¿
\82è
\96Ú
\82ª
\82³
\82ß
\82½
\81D");
2418 HSleep_resistance |= FROMOUTSIDE;
2420 case AMULET_OF_CHANGE:
2421 accessory_has_effect(otmp);
2425 You("are suddenly very %s!",
2426 flags.female ? "feminine" : "masculine");
2428 You("
\93Ë
\91R
\82Æ
\82Ä
\82à%s
\82Á
\82Û
\82
\82È
\82Á
\82½
\81I",
2429 flags.female ? "
\8f\97" : "
\92j");
2433 case AMULET_OF_UNCHANGING:
2434 /* un-change: it's a pun */
2435 if (!Unchanging && Upolyd) {
2436 accessory_has_effect(otmp);
2441 case AMULET_OF_STRANGULATION: /* bad idea! */
2442 /* no message--this gives no permanent effect */
2445 case AMULET_OF_RESTFUL_SLEEP: { /* another bad idea! */
2446 long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
2448 if (!(HSleepy & FROMOUTSIDE))
2449 accessory_has_effect(otmp);
2450 HSleepy |= FROMOUTSIDE;
2451 /* might also be wearing one; use shorter of two timeouts */
2452 if (newnap < oldnap || oldnap == 0L)
2453 HSleepy = (HSleepy & ~TIMEOUT) | newnap;
2456 case RIN_SUSTAIN_ABILITY:
2457 case AMULET_OF_LIFE_SAVING:
2458 case AMULET_OF_REFLECTION: /* nice try */
2459 /* can't eat Amulet of Yendor or fakes,
2460 * and no oc_prop even if you could -3.
2467 /* called after eating non-food */
2471 struct obj *otmp = context.victual.piece;
2473 /* lesshungry wants an occupation to handle choke messages correctly */
2475 set_occupation(eatfood, "eating non-food", 0);
2477 set_occupation(eatfood, "
\90H
\82×
\82é", 0);
2478 lesshungry(context.victual.nmod);
2480 context.victual.piece = (struct obj *) 0;
2481 context.victual.o_id = 0;
2482 context.victual.eating = 0;
2483 if (otmp->oclass == COIN_CLASS) {
2487 useupf(otmp, otmp->quan);
2488 vault_gd_watching(GD_EATGOLD);
2492 if (otmp->otyp == SCR_MAIL) {
2494 pline("This junk mail is less than satisfying.");
2497 if (otmp->oclass == POTION_CLASS) {
2498 otmp->quan++; /* dopotion() does a useup() */
2499 (void) dopotion(otmp);
2500 } else if (otmp->oclass == RING_CLASS || otmp->oclass == AMULET_CLASS) {
2502 } else if (otmp->otyp == LEASH && otmp->leashmon) {
2506 /* KMH -- idea by "Tommy the Terrorist" */
2507 if (otmp->otyp == TRIDENT && !otmp->cursed) {
2508 /* sugarless chewing gum which used to be heavily advertised on TV */
2510 pline(Hallucination ? "Four out of five dentists agree."
2511 : "That was pure chewing satisfaction!");
2513 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"
2514 : "
\8f\83\90\88\82É
\8a\9a\82Ý
\82½
\82¢
\8bC
\8e\9d\82ð
\96\9e\82½
\82µ
\82½
\81I");
2516 exercise(A_WIS, TRUE);
2518 if (otmp->otyp == FLINT && !otmp->cursed) {
2519 /* chewable vitamin for kids based on "The Flintstones" TV cartoon */
2521 pline("Yabba-dabba delicious!");
2523 pline("
\83\84\83b
\83o
\83_
\83b
\83o
\82¤
\82Ü
\82¢
\81I");
2524 exercise(A_CON, TRUE);
2527 if (otmp == uwep && otmp->quan == 1L)
2529 if (otmp == uquiver && otmp->quan == 1L)
2531 if (otmp == uswapwep && otmp->quan == 1L)
2537 unpunish(); /* but no useup() */
2538 else if (carried(otmp))
2544 /* NOTE: the order of these words exactly corresponds to the
2545 order of oc_material values #define'd in objclass.h. */
2546 static const char *foodwords[] = {
2548 "meal", "liquid", "wax", "food", "meat", "paper",
2549 "cloth", "leather", "wood", "bone", "scale", "metal",
2550 "metal", "metal", "silver", "gold", "platinum", "mithril",
2551 "plastic", "glass", "rich food", "stone"
2553 "
\93÷", "
\89t
\91Ì", "
\96û", "
\90H
\97¿", "
\93÷", "
\8e\86",
2554 "
\95\9e", "
\94ç", "
\96Ø", "
\8d\9c", "
\97Ø", "
\8bà
\91®",
2555 "
\8bà
\91®", "
\8bà
\91®", "
\8bâ", "
\8bà", "
\83v
\83\89\83`
\83i", "
\83~
\83X
\83\8a\83\8b",
2556 "
\83v
\83\89\83X
\83`
\83b
\83N", "
\83K
\83\89\83X", "
\8d\82\8b\89\97¿
\97\9d", "
\90Î"
2560 STATIC_OVL const char *
2564 if (otmp->oclass == FOOD_CLASS)
2569 if (otmp->oclass == GEM_CLASS && objects[otmp->otyp].oc_material == GLASS
2571 makeknown(otmp->otyp);
2572 return foodwords[objects[otmp->otyp].oc_material];
2575 /* called after consuming (non-corpse) food */
2580 switch (otmp->otyp) {
2581 case SPRIG_OF_WOLFSBANE:
2582 if (u.ulycn >= LOW_PM || is_were(youmonst.data))
2587 || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
2588 make_blinded((long) u.ucreamed, TRUE);
2590 case FORTUNE_COOKIE:
2591 outrumor(bcsign(otmp), BY_COOKIE);
2593 u.uconduct.literate++;
2595 case LUMP_OF_ROYAL_JELLY:
2596 /* This stuff seems to be VERY healthy! */
2597 gainstr(otmp, 1, TRUE);
2599 u.mh += otmp->cursed ? -rnd(20) : rnd(20);
2600 if (u.mh > u.mhmax) {
2604 } else if (u.mh <= 0) {
2608 u.uhp += otmp->cursed ? -rnd(20) : rnd(20);
2609 if (u.uhp > u.uhpmax) {
2613 } else if (u.uhp <= 0) {
2614 killer.format = KILLED_BY_AN;
2616 Strcpy(killer.name, "rotten lump of royal jelly");
2619 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Å");
2628 if (flesh_petrifies(&mons[otmp->corpsenm])) {
2629 if (!Stone_resistance
2630 && !(poly_when_stoned(youmonst.data)
2631 && polymon(PM_STONE_GOLEM))) {
2634 Sprintf(killer.name, "%s egg",
2636 Sprintf(killer.name, "%s
\82Ì
\97\91\82Å",
2637 mons[otmp->corpsenm].mname);
2638 make_stoned(5L, (char *) 0, KILLED_BY_AN, killer.name);
2641 /* note: no "tastes like chicken" message for eggs */
2644 case EUCALYPTUS_LEAF:
2645 if (Sick && !otmp->cursed)
2646 make_sick(0L, (char *) 0, TRUE, SICK_ALL);
2647 if (Vomiting && !otmp->cursed)
2648 make_vomiting(0L, TRUE);
2651 if (otmp->cursed && !Sleep_resistance) {
2652 /* Snow White; 'poisoned' applies to [a subset of] weapons,
2653 not food, so we substitute cursed; fortunately our hero
2654 won't have to wait for a prince to be rescued/revived */
2655 if (Race_if(PM_DWARF) && Hallucination)
2657 verbalize("Heigh-ho, ho-hum, I think I'll skip work today.");
2659 verbalize("
\83n
\83C
\83z
\81[
\81C
\83n
\83C
\83z
\81[
\81C
\8d¡
\93ú
\82Í
\8bx
\82Ý
\81D");
2660 else if (Deaf || !flags.acoustics)
2662 You("fall asleep.");
2664 You("
\96°
\82è
\82É
\97\8e\82¿
\82½
\81D");
2667 You_hear("sinister laughter as you fall asleep...");
2669 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");
2670 fall_asleep(-rn1(11, 20), TRUE);
2678 /* intended for eating a spellbook while polymorphed, but not used;
2679 "leather" applied to appearance, not composition, and has been
2680 changed to "leathery" to reflect that */
2681 STATIC_DCL boolean FDECL(leather_cover, (struct obj *));
2687 const char *odesc = OBJ_DESCR(objects[otmp->otyp]);
2689 if (odesc && (otmp->oclass == SPBOOK_CLASS)) {
2690 if (!strcmp(odesc, "leather"))
2698 * return 0 if the food was not dangerous.
2699 * return 1 if the food was dangerous and you chose to stop.
2700 * return 2 if the food was dangerous and you chose to eat it anyway.
2703 edibility_prompts(otmp)
2706 /* Blessed food detection grants hero a one-use
2707 * ability to detect food that is unfit for consumption
2708 * or dangerous and avoid it.
2710 char buf[BUFSZ], foodsmell[BUFSZ],
2711 it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
2712 boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
2713 int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
2717 Strcpy(foodsmell, Tobjnam(otmp, "smell"));
2719 Strcpy(foodsmell, xname(otmp));
2721 Strcpy(it_or_they, (otmp->quan == 1L) ? "it" : "they");
2723 Sprintf(eat_it_anyway, "Eat %s anyway?",
2724 (otmp->quan == 1L) ? "it" : "one");
2726 Strcpy(eat_it_anyway, "
\82»
\82ê
\82Å
\82à
\90H
\82×
\82é
\81H");
2729 if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) {
2730 /* These checks must match those in eatcorpse() */
2731 stoneorslime = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
2732 && !poly_when_stoned(youmonst.data));
2734 if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
2735 stoneorslime = (!Unchanging && !slimeproof(youmonst.data));
2737 if (cadaver && !nonrotting_corpse(mnum)) {
2738 long age = peek_at_iced_corpse_age(otmp);
2739 /* worst case rather than random
2740 in this calculation to force prompt */
2741 rotted = (monstermoves - age) / (10L + 0 /* was rn2(20) */);
2744 else if (otmp->blessed)
2750 * These problems with food should be checked in
2751 * order from most detrimental to least detrimental.
2753 if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
2756 Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2759 Sprintf(buf, "%s
\82Í
\89\98\90õ
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2760 foodsmell, eat_it_anyway);
2762 if (yn_function(buf, ynchars, 'n') == 'n')
2769 Sprintf(buf, "%s like %s could be something very dangerous! %s",
2770 foodsmell, it_or_they, eat_it_anyway);
2772 Sprintf(buf, "%s
\82Í
\82È
\82ñ
\82¾
\82©
\82·
\82²
\82
\8aë
\8c¯
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2773 foodsmell, eat_it_anyway);
2775 if (yn_function(buf, ynchars, 'n') == 'n')
2780 if (otmp->orotten || (cadaver && rotted > 3L)) {
2783 Sprintf(buf, "%s like %s could be rotten! %s", foodsmell, it_or_they,
2786 Sprintf(buf, "%s
\82Í
\95\85\82Á
\82½
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2787 foodsmell, eat_it_anyway);
2789 if (yn_function(buf, ynchars, 'n') == 'n')
2794 if (cadaver && poisonous(&mons[mnum]) && !Poison_resistance) {
2797 Sprintf(buf, "%s like %s might be poisonous! %s", foodsmell,
2798 it_or_they, eat_it_anyway);
2800 Sprintf(buf, "%s
\82Í
\93Å
\82ð
\82à
\82Á
\82Ä
\82¢
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2801 foodsmell, eat_it_anyway);
2803 if (yn_function(buf, ynchars, 'n') == 'n')
2808 if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2809 /* causes sleep, for long enough to be dangerous */
2811 Sprintf(buf, "%s like %s might have been poisoned. %s", foodsmell,
2812 it_or_they, eat_it_anyway);
2814 Sprintf(buf, "%s
\82Í
\93Å
\82ª
\93ü
\82ê
\82ç
\82ê
\82Ä
\82¢
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s",
2815 foodsmell, eat_it_anyway);
2817 return (yn_function(buf, ynchars, 'n') == 'n') ? 1 : 2;
2819 if (cadaver && !vegetarian(&mons[mnum]) && !u.uconduct.unvegetarian
2820 && Role_if(PM_MONK)) {
2822 Sprintf(buf, "%s unhealthy. %s", foodsmell, eat_it_anyway);
2824 Sprintf(buf, "%s
\82Í
\8c\92\8dN
\82É
\88«
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2825 if (yn_function(buf, ynchars, 'n') == 'n')
2830 if (cadaver && acidic(&mons[mnum]) && !Acid_resistance) {
2832 Sprintf(buf, "%s rather acidic. %s", foodsmell, eat_it_anyway);
2834 Sprintf(buf, "%s
\82Í
\8f
\82µ
\8e_
\82Á
\82Ï
\82»
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell, eat_it_anyway);
2835 if (yn_function(buf, ynchars, 'n') == 'n')
2840 if (Upolyd && u.umonnum == PM_RUST_MONSTER && is_metallic(otmp)
2841 && otmp->oerodeproof) {
2843 Sprintf(buf, "%s disgusting to you right now. %s", foodsmell,
2846 Sprintf(buf, "%s
\82Í
\8bC
\95ª
\82ª
\88«
\82
\82È
\82é
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81D%s", foodsmell,
2849 if (yn_function(buf, ynchars, 'n') == 'n')
2856 * Breaks conduct, but otherwise safe.
2858 if (!u.uconduct.unvegan
2859 && ((material == LEATHER || material == BONE
2860 || material == DRAGON_HIDE || material == WAX)
2861 || (cadaver && !vegan(&mons[mnum])))) {
2863 Sprintf(buf, "%s foul and unfamiliar to you. %s", foodsmell,
2866 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,
2869 if (yn_function(buf, ynchars, 'n') == 'n')
2874 if (!u.uconduct.unvegetarian
2875 && ((material == LEATHER || material == BONE
2876 || material == DRAGON_HIDE)
2877 || (cadaver && !vegetarian(&mons[mnum])))) {
2879 Sprintf(buf, "%s unfamiliar to you. %s", foodsmell, eat_it_anyway);
2881 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);
2882 if (yn_function(buf, ynchars, 'n') == 'n')
2888 if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && Sick_resistance) {
2889 /* Tainted meat with Sick_resistance */
2891 Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2894 Sprintf(buf, "%s
\82Í
\89\98\90õ
\82³
\82ê
\82Ä
\82¢
\82é
\82æ
\82¤
\82È
\82É
\82¨
\82¢
\82ª
\82·
\82é
\81I%s", foodsmell,
2897 if (yn_function(buf, ynchars, 'n') == 'n')
2910 int basenutrit; /* nutrition of full item */
2911 boolean dont_start = FALSE, nodelicious = FALSE;
2915 pline("If you can't breathe air, how can you consume solids?");
2917 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");
2920 if (!(otmp = floorfood("eat", 0)))
2922 if (check_capacity((char *) 0))
2926 int res = edibility_prompts(otmp);
2930 "%s stops tingling and your sense of smell returns to normal.",
2933 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",
2942 /* We have to make non-foods take 1 move to eat, unless we want to
2943 * do ridiculous amounts of coding to deal with partly eaten plate
2944 * mails, players who polymorph back to human in the middle of their
2945 * metallic meal, etc....
2947 if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
2948 : touch_artifact(otmp, &youmonst))) {
2950 } else if (!is_edible(otmp)) {
2952 You("cannot eat that!");
2954 You("
\82»
\82ê
\82ð
\90H
\82×
\82ç
\82ê
\82È
\82¢
\81I");
2956 } else if ((otmp->owornmask & (W_ARMOR | W_TOOL | W_AMUL | W_SADDLE))
2958 /* let them eat rings */
2960 You_cant("eat %s you're wearing.", something);
2962 You("
\90g
\82É
\82Â
\82¯
\82Ä
\82¢
\82é
\8aÔ
\82Í
\90H
\82×
\82ê
\82È
\82¢
\81D");
2965 if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
2966 && otmp->oerodeproof) {
2967 otmp->rknown = TRUE;
2968 if (otmp->quan > 1L) {
2970 (void) splitobj(otmp, otmp->quan - 1L);
2972 otmp = splitobj(otmp, 1L);
2975 pline("Ulch - that %s was rustproofed!", xname(otmp));
2977 pline("
\83E
\83Q
\83F
\81[
\81I%s
\82Í
\96h
\8eK
\82³
\82ê
\82Ä
\82¢
\82é
\81I", xname(otmp));
2978 /* The regurgitated object's rustproofing is gone now */
2979 otmp->oerodeproof = 0;
2980 make_stunned((HStun & TIMEOUT) + (long) rn2(10), TRUE);
2982 You("spit %s out onto the %s.", the(xname(otmp)),
2983 surface(u.ux, u.uy));
2985 You("%s
\82ð%s
\82É
\93f
\82«
\8fo
\82µ
\82½
\81D", the(xname(otmp)),
2986 surface(u.ux, u.uy));
2988 if (carried(otmp)) {
2995 /* KMH -- Slow digestion is... indigestible */
2996 if (otmp->otyp == RIN_SLOW_DIGESTION) {
2998 pline("This ring is indigestible!");
3000 pline("
\82±
\82Ì
\8ew
\97Ö
\82Í
\8fÁ
\89»
\82µ
\82É
\82
\82¢
\81I");
3001 (void) rottenfood(otmp);
3002 if (otmp->dknown && !objects[otmp->otyp].oc_name_known
3003 && !objects[otmp->otyp].oc_uname)
3007 if (otmp->oclass != FOOD_CLASS) {
3010 context.victual.reqtime = 1;
3011 context.victual.piece = otmp;
3012 context.victual.o_id = otmp->o_id;
3013 /* Don't split it, we don't need to if it's 1 move */
3014 context.victual.usedtime = 0;
3015 context.victual.canchoke = (u.uhs == SATIATED);
3016 /* Note: gold weighs 1 pt. for each 1000 pieces (see
3017 pickup.c) so gold and non-gold is consistent. */
3018 if (otmp->oclass == COIN_CLASS)
3019 basenutrit = ((otmp->quan > 200000L)
3021 : (int) (otmp->quan / 100L));
3022 else if (otmp->oclass == BALL_CLASS || otmp->oclass == CHAIN_CLASS)
3023 basenutrit = weight(otmp);
3024 /* oc_nutrition is usually weight anyway */
3026 basenutrit = objects[otmp->otyp].oc_nutrition;
3028 if (otmp->otyp == SCR_MAIL) {
3033 context.victual.nmod = basenutrit;
3034 context.victual.eating = TRUE; /* needed for lesshungry() */
3036 material = objects[otmp->otyp].oc_material;
3037 if (material == LEATHER || material == BONE
3038 || material == DRAGON_HIDE) {
3039 u.uconduct.unvegan++;
3040 violated_vegetarian();
3041 } else if (material == WAX)
3042 u.uconduct.unvegan++;
3046 (void) rottenfood(otmp);
3048 if (otmp->oclass == WEAPON_CLASS && otmp->opoisoned) {
3050 pline("Ecch - that must have been poisonous!");
3052 pline("
\83E
\83Q
\83F
\81[
\81C
\97L
\93Å
\82¾
\82Á
\82½
\82É
\88á
\82¢
\82È
\82¢
\81I");
3053 if (!Poison_resistance) {
3056 losehp(rnd(15), xname(otmp), KILLED_BY_AN);
3060 Sprintf(jbuf, "%s
\82Å", xname(otmp));
3061 losehp(rnd(15), jbuf, KILLED_BY_AN);
3066 You("seem unaffected by the poison.");
3068 You("
\93Å
\82Ì
\89e
\8b¿
\82ð
\8eó
\82¯
\82È
\82¢
\82æ
\82¤
\82¾
\81D");
3069 } else if (!otmp->cursed && !nodelicious) {
3071 pline("%s%s is delicious!",
3073 && otmp->oartifact < ART_ORB_OF_DETECTION)
3076 (otmp->oclass == COIN_CLASS)
3078 : singular(otmp, xname));
3080 pline("
\82±
\82Ì%s
\82Í
\8e|
\82¢
\81I",
3081 otmp->oclass == COIN_CLASS
3083 : singular(otmp, xname));
3090 if (otmp == context.victual.piece) {
3091 /* If they weren't able to choke, they don't suddenly become able to
3092 * choke just because they were interrupted. On the other hand, if
3093 * they were able to choke before, if they lost food it's possible
3094 * they shouldn't be able to choke now.
3096 if (u.uhs != SATIATED)
3097 context.victual.canchoke = FALSE;
3098 context.victual.o_id = 0;
3099 context.victual.piece = touchfood(otmp);
3100 if (context.victual.piece)
3101 context.victual.o_id = context.victual.piece->o_id;
3103 You("resume your meal.");
3105 You("
\90H
\8e\96\82ð
\8dÄ
\8aJ
\82µ
\82½
\81D");
3106 start_eating(context.victual.piece);
3110 /* nothing in progress - so try to find something. */
3111 /* tins are a special case */
3112 /* tins must also check conduct separately in case they're discarded */
3113 if (otmp->otyp == TIN) {
3121 context.victual.o_id = 0;
3122 context.victual.piece = otmp = touchfood(otmp);
3123 if (context.victual.piece)
3124 context.victual.o_id = context.victual.piece->o_id;
3125 context.victual.usedtime = 0;
3127 /* Now we need to calculate delay and nutritional info.
3128 * The base nutrition calculated here and in eatcorpse() accounts
3129 * for normal vs. rotten food. The reqtime and nutrit values are
3130 * then adjusted in accordance with the amount of food left.
3132 if (otmp->otyp == CORPSE || otmp->globby) {
3133 int tmp = eatcorpse(otmp);
3137 context.victual.piece = (struct obj *) 0;
3138 context.victual.o_id = 0;
3142 /* if not used up, eatcorpse sets up reqtime and may modify oeaten */
3144 /* No checks for WAX, LEATHER, BONE, DRAGON_HIDE. These are
3145 * all handled in the != FOOD_CLASS case, above.
3147 switch (objects[otmp->otyp].oc_material) {
3149 u.uconduct.unvegan++;
3150 if (otmp->otyp != EGG) {
3151 violated_vegetarian();
3156 if (otmp->otyp == PANCAKE || otmp->otyp == FORTUNE_COOKIE /*eggs*/
3157 || otmp->otyp == CREAM_PIE || otmp->otyp == CANDY_BAR /*milk*/
3158 || otmp->otyp == LUMP_OF_ROYAL_JELLY)
3159 u.uconduct.unvegan++;
3163 context.victual.reqtime = objects[otmp->otyp].oc_delay;
3164 if (otmp->otyp != FORTUNE_COOKIE
3165 && (otmp->cursed || (!nonrotting_food(otmp->otyp)
3166 && (monstermoves - otmp->age)
3167 > (otmp->blessed ? 50L : 30L)
3168 && (otmp->orotten || !rn2(7))))) {
3169 if (rottenfood(otmp)) {
3170 otmp->orotten = TRUE;
3173 consume_oeaten(otmp, 1); /* oeaten >>= 1 */
3178 /* re-calc the nutrition */
3179 if (otmp->otyp == CORPSE)
3180 basenutrit = mons[otmp->corpsenm].cnutrit;
3182 basenutrit = objects[otmp->otyp].oc_nutrition;
3184 debugpline1("before rounddiv: context.victual.reqtime == %d",
3185 context.victual.reqtime);
3186 debugpline2("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
3187 context.victual.reqtime = (basenutrit == 0)
3189 : rounddiv(context.victual.reqtime
3190 * (long) otmp->oeaten,
3192 debugpline1("after rounddiv: context.victual.reqtime == %d",
3193 context.victual.reqtime);
3195 * calculate the modulo value (nutrit. units per round eating)
3196 * note: this isn't exact - you actually lose a little nutrition due
3198 * TODO: add in a "remainder" value to be given at the end of the meal.
3200 if (context.victual.reqtime == 0 || otmp->oeaten == 0)
3201 /* possible if most has been eaten before */
3202 context.victual.nmod = 0;
3203 else if ((int) otmp->oeaten >= context.victual.reqtime)
3204 context.victual.nmod = -((int) otmp->oeaten
3205 / context.victual.reqtime);
3207 context.victual.nmod = context.victual.reqtime % otmp->oeaten;
3208 context.victual.canchoke = (u.uhs == SATIATED);
3215 /* Take a single bite from a piece of food, checking for choking and
3216 * modifying usedtime. Returns 1 if they choked and survived, 0 otherwise.
3221 if (context.victual.canchoke && u.uhunger >= 2000) {
3222 choke(context.victual.piece);
3225 if (context.victual.doreset) {
3229 force_save_hs = TRUE;
3230 if (context.victual.nmod < 0) {
3231 lesshungry(-context.victual.nmod);
3232 consume_oeaten(context.victual.piece,
3233 context.victual.nmod); /* -= -nmod */
3234 } else if (context.victual.nmod > 0
3235 && (context.victual.usedtime % context.victual.nmod)) {
3237 consume_oeaten(context.victual.piece, -1); /* -= 1 */
3239 force_save_hs = FALSE;
3244 /* as time goes by - called by moveloop() and domove() */
3248 if (u.uinvulnerable)
3249 return; /* you don't feel hungrier */
3251 if ((!u.usleep || !rn2(10)) /* slow metabolic rate while asleep */
3252 && (carnivorous(youmonst.data) || herbivorous(youmonst.data))
3254 u.uhunger--; /* ordinary food consumption */
3256 if (moves % 2) { /* odd turns */
3257 /* Regeneration uses up food, unless due to an artifact */
3258 if ((HRegeneration & ~FROMFORM)
3259 || (ERegeneration & ~(W_ARTI | W_WEP)))
3261 if (near_capacity() > SLT_ENCUMBER)
3263 } else { /* even turns */
3266 /* Conflict uses up food too */
3267 if (HConflict || (EConflict & (~W_ARTI)))
3269 /* +0 charged rings don't do anything, so don't affect hunger */
3270 /* Slow digestion still uses ring hunger */
3271 switch ((int) (moves % 20)) { /* note: use even cases only */
3273 if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged))
3281 if (uright && (uright->spe || !objects[uright->otyp].oc_charged))
3295 /* called after vomiting and after performing feats of magic */
3304 /* called after eating (and after drinking fruit juice) */
3309 /* See comments in newuhs() for discussion on force_save_hs */
3310 boolean iseating = (occupation == eatfood) || force_save_hs;
3312 debugpline1("lesshungry(%d)", num);
3314 if (u.uhunger >= 2000) {
3315 if (!iseating || context.victual.canchoke) {
3317 choke(context.victual.piece);
3320 choke(occupation == opentin ? context.tin.tin
3321 : (struct obj *) 0);
3322 /* no reset_eat() */
3325 /* Have lesshungry() report when you're nearly full so all eating
3326 * warns when you're about to choke.
3328 if (u.uhunger >= 1500) {
3329 if (!context.victual.eating
3330 || (context.victual.eating && !context.victual.fullwarn)) {
3332 pline("You're having a hard time getting all of it down.");
3334 pline("
\91S
\82Ä
\82ð
\88ù
\82Ý
\82±
\82Þ
\82É
\82Í
\8e\9e\8aÔ
\82ª
\82©
\82©
\82é
\81D");
3336 nomovemsg = "You're finally finished.";
3338 nomovemsg = "
\82â
\82Á
\82Æ
\90H
\82×
\8fI
\82¦
\82½
\81D";
3339 if (!context.victual.eating) {
3342 context.victual.fullwarn = TRUE;
3343 if (context.victual.canchoke
3344 && context.victual.reqtime > 1) {
3345 /* a one-gulp food will not survive a stop */
3347 if (yn_function("Continue eating?", ynchars, 'n')
3349 if (yn_function("
\90H
\82×
\91±
\82¯
\82Ü
\82·
\82©
\81H", ynchars, 'n')
3352 nomovemsg = (char *) 0;
3366 (void) Hear_again();
3367 if (u.uhs > FAINTING)
3377 return (boolean) (u.uhs == FAINTED);
3380 /* call when a faint must be prematurely terminated */
3384 if (afternmv == unfaint)
3386 unmul("You revive.");
3388 unmul("
\82 \82È
\82½
\82Í
\8bC
\82ª
\82Â
\82¢
\82½
\81D");
3391 /* compute and comment on your (new?) hunger status */
3397 static unsigned save_hs;
3398 static boolean saved_hs = FALSE;
3403 : (h > 150) ? NOT_HUNGRY
3404 : (h > 50) ? HUNGRY : (h > 0) ? WEAK : FAINTING;
3406 /* While you're eating, you may pass from WEAK to HUNGRY to NOT_HUNGRY.
3407 * This should not produce the message "you only feel hungry now";
3408 * that message should only appear if HUNGRY is an endpoint. Therefore
3409 * we check to see if we're in the middle of eating. If so, we save
3410 * the first hunger status, and at the end of eating we decide what
3411 * message to print based on the _entire_ meal, not on each little bit.
3413 /* It is normally possible to check if you are in the middle of a meal
3414 * by checking occupation == eatfood, but there is one special case:
3415 * start_eating() can call bite() for your first bite before it
3416 * sets the occupation.
3417 * Anyone who wants to get that case to work _without_ an ugly static
3418 * force_save_hs variable, feel free.
3420 /* Note: If you become a certain hunger status in the middle of the
3421 * meal, and still have that same status at the end of the meal,
3422 * this will incorrectly print the associated message at the end of
3423 * the meal instead of the middle. Such a case is currently
3424 * impossible, but could become possible if a message for SATIATED
3425 * were added or if HUNGRY and WEAK were separated by a big enough
3426 * gap to fit two bites.
3428 if (occupation == eatfood || force_save_hs) {
3442 if (newhs == FAINTING) {
3445 if (u.uhs <= WEAK || rn2(20 - u.uhunger / 10) >= 19) {
3446 if (!is_fainted() && multi >= 0 /* %% */) {
3447 int duration = 10 - (u.uhunger / 10);
3449 /* stop what you're doing, then faint */
3452 You("faint from lack of food.");
3454 You("
\95 \82ª
\8c¸
\82Á
\82Ä
\93|
\82ê
\82½
\81D");
3457 selftouch("Falling, you");
3459 selftouch("
\97\8e\82¿
\82È
\82ª
\82ç
\81C
\82 \82È
\82½
\82Í");
3460 incr_itimeout(&HDeaf, duration);
3462 multi_reason = "fainted from lack of food";
3464 nomovemsg = "You regain consciousness.";
3466 nomovemsg = "
\82 \82È
\82½
\82Í
\90³
\8bC
\82Ã
\82¢
\82½
\81D";
3470 } else if (u.uhunger < -(int) (200 + 20 * ACURR(A_CON))) {
3475 You("die from starvation.");
3477 You("
\89ì
\8e\80\82µ
\82½
\81D");
3478 killer.format = KILLED_BY;
3480 Strcpy(killer.name, "starvation");
3482 Strcpy(killer.name, "
\90H
\97¿
\95s
\91«
\82Å
\89ì
\8e\80\82µ
\82½");
3484 /* if we return, we lifesaved, and that calls newuhs */
3489 if (newhs != u.uhs) {
3490 if (newhs >= WEAK && u.uhs < WEAK)
3491 losestr(1); /* this may kill you -- see below */
3492 else if (newhs < WEAK && u.uhs >= WEAK)
3496 if (Hallucination) {
3498 You((!incr) ? "now have a lesser case of the munchies."
3499 : "are getting the munchies.");
3502 You("
\83n
\83\89\83w
\83\8a\82ª
\8c¸
\82Á
\82½
\81D");
3504 pline("
\83n
\83\89\83w
\83\8a\83w
\83\8a\83n
\83\89\81D");
3509 You((!incr) ? "only feel hungry now."
3511 You((!incr) ? "
\92P
\82É
\95 \83y
\83R
\8fó
\91Ô
\82É
\82È
\82Á
\82½
\81D"
3516 ? "
\8bó
\95 \8a´
\82ð
\8a´
\82¶
\82½
\81D"
3518 : "are beginning to feel hungry.");
3520 : "
\8bó
\95 \8a´
\82ð
\82¨
\82Ú
\82¦
\82Í
\82¶
\82ß
\82½
\81D");
3521 if (incr && occupation
3522 && (occupation != eatfood && occupation != opentin))
3524 context.travel = context.travel1 = context.mv = context.run = 0;
3529 pline((!incr) ? "You still have the munchies."
3531 pline((!incr) ? "
\83n
\83\89\83w
\83\8a\82ª
\8c¸
\82ç
\82È
\82¢
\81D"
3533 : "The munchies are interfering with your motor capabilities.");
3535 : "
\83n
\83\89\83w
\83\8a\82ª
\83\82\81[
\83^
\81[
\90«
\94\
\82É
\89e
\8b¿
\82ð
\97^
\82¦
\82Ä
\82¢
\82é
\81D");
3536 else if (incr && (Role_if(PM_WIZARD) || Race_if(PM_ELF)
3537 || Role_if(PM_VALKYRIE)))
3539 pline("%s needs food, badly!",
3541 pline("%s
\82É
\82Í
\8e\8a\8b}
\90H
\97¿
\82ª
\95K
\97v
\82¾
\81I",
3542 (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE))
3547 : "
\83G
\83\8b\83t");
3553 ? "
\90\8a\8eã
\8fó
\91Ô
\82É
\82È
\82Á
\82½
\81D"
3555 : (u.uhunger < 45) ? "feel weak."
3557 : (u.uhunger < 45) ? "
\90\8a\8eã
\82µ
\82Ä
\82«
\82½
\81D"
3559 : "are beginning to feel weak.");
3561 : "
\8eã
\82
\82È
\82Á
\82Ä
\82«
\82½
\82æ
\82¤
\82É
\8a´
\82¶
\82½
\81D");
3562 if (incr && occupation
3563 && (occupation != eatfood && occupation != opentin))
3565 context.travel = context.travel1 = context.mv = context.run = 0;
3571 if ((Upolyd ? u.mh : u.uhp) < 1) {
3573 You("die from hunger and exhaustion.");
3575 You("
\8bó
\95 \82Æ
\90\8a\8eã
\82Å
\8e\80\82ñ
\82¾
\81D");
3576 killer.format = KILLED_BY;
3578 Strcpy(killer.name, "exhaustion");
3580 Strcpy(killer.name, "
\8bó
\95 \82Æ
\90\8a\8eã
\82Å
\8e\80\82ñ
\82¾");
3587 /* Returns an object representing food.
3588 * Object may be either on floor or in inventory.
3590 /*JP CHECK: 3.4.3
\82Å
\82Ì
\8cÄ
\82Ñ
\8fo
\82µ
\8c³
3591 apply.c:1959: if (!(corpse = floorfood("
\8aÊ
\8bl
\82ß
\82É
\82·
\82é", 2))) return;
3592 eat.c:2404: if (!(otmp = floorfood("
\90H
\82×
\82é", 0))) return 0;
3593 pray.c:1478: if (!(otmp = floorfood("
\95ù
\82°
\82é", 1))) return 0;
3596 floorfood(verb, corpsecheck)
3598 int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
3600 register struct obj *otmp;
3603 boolean feeding = !strcmp(verb, "eat"), /* corpsecheck==0 */
3604 offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
3607 const char *jverb = trans_verb(verb)->jp;
3610 /* if we can't touch floor objects then use invent food only */
3611 if (!can_reach_floor(TRUE) || (feeding && u.usteed)
3612 || (is_pool_or_lava(u.ux, u.uy)
3613 && (Wwalking || is_clinger(youmonst.data)
3614 || (Flying && !Breathless))))
3617 if (feeding && metallivorous(youmonst.data)) {
3619 struct trap *ttmp = t_at(u.ux, u.uy);
3621 if (ttmp && ttmp->tseen && ttmp->ttyp == BEAR_TRAP) {
3622 /* If not already stuck in the trap, perhaps there should
3623 be a chance to becoming trapped? Probably not, because
3624 then the trap would just get eaten on the _next_ turn... */
3626 Sprintf(qbuf, "There is a bear trap here (%s); eat it?",
3628 Sprintf(qbuf, "
\82±
\82±
\82É
\82Í
\8cF
\82Ìã©(%s)
\82ª
\82 \82é;
\90H
\82×
\82Ü
\82·
\82©
\81H",
3630 (u.utrap && u.utraptype == TT_BEARTRAP) ? "holding you"
3632 (u.utrap && u.utraptype == TT_BEARTRAP) ? "
\82 \82È
\82½
\82ð
\92Í
\82Ü
\82¦
\82Ä
\82¢
\82é"
3636 : "
\89Ò
\93®
\92\86");
3637 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3638 u.utrap = u.utraptype = 0;
3640 return mksobj(BEARTRAP, TRUE, FALSE);
3641 } else if (c == 'q') {
3642 return (struct obj *) 0;
3646 if (youmonst.data != &mons[PM_RUST_MONSTER]
3647 && (gold = g_at(u.ux, u.uy)) != 0) {
3649 if (gold->quan == 1L)
3650 Sprintf(qbuf, "There is 1 gold piece here; eat it?");
3652 Sprintf(qbuf, "There are %ld gold pieces here; eat them?",
3655 Sprintf(qbuf, "
\82±
\82±
\82É
\82Í%ld
\96\87\82Ì
\8bà
\89Ý
\82ª
\82 \82é
\81D
\90H
\82×
\82Ü
\82·
\82©
\81H", gold->quan);
3657 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3659 } else if (c == 'q') {
3660 return (struct obj *) 0;
3665 /* Is there some food (probably a heavy corpse) here on the ground? */
3666 for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
3668 ? (otmp->otyp == CORPSE
3669 && (corpsecheck == 1 || tinnable(otmp)))
3670 : feeding ? (otmp->oclass != COIN_CLASS && is_edible(otmp))
3671 : otmp->oclass == FOOD_CLASS) {
3673 boolean one = (otmp->quan == 1L);
3675 /* "There is <an object> here; <verb> it?" or
3676 "There are <N objects> here; <verb> one?" */
3678 Sprintf(qbuf, "There %s ", otense(otmp, "are"));
3679 Sprintf(qsfx, " here; %s %s?", verb, one ? "it" : "one");
3680 (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3681 one ? something : (const char *) "things");
3683 Strcpy(qbuf, "
\82±
\82±
\82É");
3684 Sprintf(qsfx, "
\82ª
\82 \82é; %s%s?", one ? "" : "
\88ê
\82Â", jverb);
3685 (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3686 one ? something : (const char *) "
\89½
\82©");
3688 if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y')
3691 return (struct obj *) 0;
3696 /* We cannot use ALL_CLASSES since that causes getobj() to skip its
3697 * "ugly checks" and we need to check for inedible items.
3700 getobj(feeding ? allobj : offering ? offerfodder : comestibles, verb);
3701 if (corpsecheck && otmp && !(offering && otmp->oclass == AMULET_CLASS))
3702 if (otmp->otyp != CORPSE || (corpsecheck == 2 && !tinnable(otmp))) {
3704 You_cant("%s that!", verb);
3706 You_cant("
\82»
\82ê
\82ð%s
\82±
\82Æ
\82Í
\82Å
\82«
\82È
\82¢
\81I", jverb);
3707 return (struct obj *) 0;
3712 /* Side effects of vomiting */
3713 /* added nomul (MRS) - it makes sense, you're too busy being sick! */
3715 vomit() /* A good idea from David Neves */
3717 if (cantvomit(youmonst.data))
3718 /* doesn't cure food poisoning; message assumes that we aren't
3719 dealing with some esoteric body_part() */
3721 Your("jaw gapes convulsively.");
3723 Your("
\82 \82²
\82Í
\94
\8dì
\93I
\82É
\91å
\82«
\82
\8aJ
\82¢
\82½
\81D");
3725 make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE);
3727 multi_reason = "vomiting";
3728 nomovemsg = You_can_move_again;
3732 eaten_stat(base, obj)
3736 long uneaten_amt, full_amount;
3738 uneaten_amt = (long) obj->oeaten;
3739 full_amount = (obj->otyp == CORPSE)
3740 ? (long) mons[obj->corpsenm].cnutrit
3741 : (long) objects[obj->otyp].oc_nutrition;
3742 if (uneaten_amt > full_amount) {
3744 "partly eaten food (%ld) more nutritious than untouched food (%ld)",
3745 uneaten_amt, full_amount);
3746 uneaten_amt = full_amount;
3749 base = (int) (full_amount ? (long) base * uneaten_amt / full_amount : 0L);
3750 return (base < 1) ? 1 : base;
3753 /* reduce obj's oeaten field, making sure it never hits or passes 0 */
3755 consume_oeaten(obj, amt)
3760 * This is a hack to try to squelch several long standing mystery
3761 * food bugs. A better solution would be to rewrite the entire
3762 * victual handling mechanism from scratch using a less complex
3763 * model. Alternatively, this routine could call done_eating()
3764 * or food_disappears() but its callers would need revisions to
3765 * cope with context.victual.piece unexpectedly going away.
3767 * Multi-turn eating operates by setting the food's oeaten field
3768 * to its full nutritional value and then running a counter which
3769 * independently keeps track of whether there is any food left.
3770 * The oeaten field can reach exactly zero on the last turn, and
3771 * the object isn't removed from inventory until the next turn
3772 * when the "you finish eating" message gets delivered, so the
3773 * food would be restored to the status of untouched during that
3774 * interval. This resulted in unexpected encumbrance messages
3775 * at the end of a meal (if near enough to a threshold) and would
3776 * yield full food if there was an interruption on the critical
3777 * turn. Also, there have been reports over the years of food
3778 * becoming massively heavy or producing unlimited satiation;
3779 * this would occur if reducing oeaten via subtraction attempted
3780 * to drop it below 0 since its unsigned type would produce a
3781 * huge positive value instead. So far, no one has figured out
3782 * _why_ that inappropriate subtraction might sometimes happen.
3786 /* bit shift to divide the remaining amount of food */
3787 obj->oeaten >>= amt;
3789 /* simple decrement; value is negative so we actually add it */
3790 if ((int) obj->oeaten > -amt)
3796 if (obj->oeaten == 0) {
3797 if (obj == context.victual.piece) /* always true unless wishing... */
3798 context.victual.reqtime =
3799 context.victual.usedtime; /* no bites left */
3800 obj->oeaten = 1; /* smallest possible positive value */
3804 /* called when eatfood occupation has been interrupted,
3805 or in the case of theft, is about to be interrupted */
3807 maybe_finished_meal(stopping)
3810 /* in case consume_oeaten() has decided that the food is all gone */
3811 if (occupation == eatfood
3812 && context.victual.usedtime >= context.victual.reqtime) {
3814 occupation = 0; /* for do_reset_eat */
3815 (void) eatfood(); /* calls done_eating() to use up
3816 context.victual.piece */
3822 /* Tin of <something> to the rescue? Decide whether current occupation
3823 is an attempt to eat a tin of something capable of saving hero's life.
3824 We don't care about consumption of non-tinned food here because special
3825 effects there take place on first bite rather than at end of occupation.
3826 [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */
3834 if (occupation != opentin)
3836 otin = context.tin.tin;
3837 /* make sure hero still has access to tin */
3839 && (!obj_here(otin, u.ux, u.uy) || !can_reach_floor(TRUE)))
3841 /* unknown tin is assumed to be helpful */
3844 /* known tin is helpful if it will stop life-threatening problem */
3845 mndx = otin->corpsenm;
3847 /* note: not used; hunger code bypasses stop_occupation() when eating */
3849 return (boolean) (mndx != NON_PM || otin->spe == 1);
3850 /* flesh from lizards and acidic critters stops petrification */
3852 return (boolean) (mndx >= LOW_PM
3853 && (mndx == PM_LIZARD || acidic(&mons[mndx])));
3854 /* no tins can cure these (yet?) */