OSDN Git Service

fix #36579
[jnethack/source.git] / src / eat.c
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. */
4
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. */
9
10 #include "hack.h"
11
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);
17
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));
44
45 char msgbuf[BUFSZ];
46
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))
49
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])
52
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]))
57
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)
62
63 STATIC_OVL NEARDATA const char comestibles[] = { FOOD_CLASS, 0 };
64 STATIC_OVL NEARDATA const char offerfodder[] = { FOOD_CLASS, AMULET_CLASS,
65                                                  0 };
66
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
73 };
74
75 STATIC_OVL boolean force_save_hs = FALSE;
76
77 /* see hunger states in hack.h - texts used on bottom line */
78 #if 0 /*JP*/
79 const char *hu_stat[] = { "Satiated", "        ", "Hungry  ", "Weak    ",
80                           "Fainting", "Fainted ", "Starved " };
81 #else
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    " };
84 #endif
85
86 /*
87  * Decide whether a particular object can be eaten by the possibly
88  * polymorphed character.  Not used for monster checks.
89  */
90 boolean
91 is_edible(obj)
92 register struct obj *obj;
93 {
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)
97         return FALSE;
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] */
100
101     if (metallivorous(youmonst.data) && is_metallic(obj)
102         && (youmonst.data != &mons[PM_RUST_MONSTER] || is_rustprone(obj)))
103         return TRUE;
104
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))
109         return TRUE;
110
111     /* return (boolean) !!index(comestibles, obj->oclass); */
112     return (boolean) (obj->oclass == FOOD_CLASS);
113 }
114
115 void
116 init_uhunger()
117 {
118     u.uhunger = 900;
119     u.uhs = NOT_HUNGRY;
120 }
121
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 */
128 #if 0 /*JP*/
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 },
144                 { "", 0, 0, 0 } };
145 #else
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 },
161                 { "", 0, 0, 0 } };
162 #endif
163 #define TTSZ SIZE(tintxts)
164
165 static char *eatmbuf = 0; /* set by cpostfx() */
166
167 /* called after mimicing is over */
168 STATIC_PTR int
169 eatmdone(VOID_ARGS)
170 {
171     /* release `eatmbuf' */
172     if (eatmbuf) {
173         if (nomovemsg == eatmbuf)
174             nomovemsg = 0;
175         free((genericptr_t) eatmbuf), eatmbuf = 0;
176     }
177     /* update display */
178     if (youmonst.m_ap_type) {
179         youmonst.m_ap_type = M_AP_NOTHING;
180         newsym(u.ux, u.uy);
181     }
182     return 0;
183 }
184
185 /* called when hallucination is toggled */
186 void
187 eatmupdate()
188 {
189     const char *altmsg = 0;
190     int altapp = 0; /* lint suppression */
191
192     if (!eatmbuf || nomovemsg != eatmbuf)
193         return;
194
195     if (is_obj_mappear(&youmonst,ORANGE) && !Hallucination) {
196         /* revert from hallucinatory to "normal" mimicking */
197 /*JP
198         altmsg = "You now prefer mimicking yourself.";
199 */
200         altmsg = "\82 \82È\82½\82Í\8e©\95ª\8e©\90g\82Ì\82Ü\82Ë\82ð\82·\82é\82±\82Æ\82ð\91I\82ñ\82¾\81D";
201         altapp = GOLD_PIECE;
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 */
206 /*JP
207         altmsg = "Your rind escaped intact.";
208 */
209         altmsg = "\82 \82È\82½\82Ì\94ç\82ª\82»\82Ì\82Ü\82Ü\82Ì\8c`\82Å\93¦\82°\82Ä\82¢\82Á\82½\81D";
210         altapp = ORANGE;
211     }
212
213     if (altmsg) {
214         /* replace end-of-mimicking message */
215         if (strlen(altmsg) > strlen(eatmbuf)) {
216             free((genericptr_t) eatmbuf);
217             eatmbuf = (char *) alloc(strlen(altmsg) + 1);
218         }
219         nomovemsg = strcpy(eatmbuf, altmsg);
220         /* update current image */
221         youmonst.mappearance = altapp;
222         newsym(u.ux, u.uy);
223     }
224 }
225
226 /* ``[the(] singular(food, xname) [)]'' */
227 STATIC_OVL const char *
228 food_xname(food, the_pfx)
229 struct obj *food;
230 boolean the_pfx;
231 {
232     const char *result;
233
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]))
240             the_pfx = FALSE;
241     } else {
242         /* the ordinary case */
243         result = singular(food, xname);
244     }
245     if (the_pfx)
246         result = the(result);
247     return result;
248 }
249
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.
254  *
255  * To a full belly all food is bad. (It.)
256  */
257 STATIC_OVL void
258 choke(food)
259 struct obj *food;
260 {
261     /* only happens if you were satiated */
262     if (u.uhs != SATIATED) {
263         if (!food || food->otyp != AMULET_OF_STRANGULATION)
264             return;
265     } else if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL) {
266         adjalign(-1); /* gluttony is unchivalrous */
267 /*JP
268         You_feel("like a glutton!");
269 */
270         You("\91å\90H\8a¿\82Ì\82æ\82¤\82È\8bC\82ª\82µ\82½\81I");
271     }
272
273     exercise(A_CON, FALSE);
274
275     if (Breathless || (!Strangled && !rn2(20))) {
276         /* choking by eating AoS doesn't involve stuffing yourself */
277         if (food && food->otyp == AMULET_OF_STRANGULATION) {
278 /*JP
279             You("choke, but recover your composure.");
280 */
281             You("\8eñ\82ð\8di\82ß\82ç\82ê\82½\81D\82µ\82©\82µ\82È\82ñ\82Æ\82à\82È\82©\82Á\82½\81D");
282             return;
283         }
284 /*JP
285         You("stuff yourself and then vomit voluminously.");
286 */
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! */
289         vomit();
290     } else {
291         killer.format = KILLED_BY_AN;
292         /*
293          * Note all "killer"s below read "Choked on %s" on the
294          * high score list & tombstone.  So plan accordingly.
295          */
296         if (food) {
297 /*JP
298             You("choke over your %s.", foodword(food));
299 */
300             You("%s\82ð\8dA\82É\8bl\82Ü\82ç\82¹\82Ä\82µ\82Ü\82Á\82½\81D", foodword(food));
301             if (food->oclass == COIN_CLASS) {
302 /*JP
303                 Strcpy(killer.name, "very rich meal");
304 */
305                 Strcpy(killer.name, "\82Æ\82Ä\82à\8d\82\89¿\82È\97¿\97\9d");
306             } else {
307                 killer.format = KILLED_BY;
308                 Strcpy(killer.name, killer_xname(food));
309             }
310         } else {
311 /*JP
312             You("choke over it.");
313 */
314             pline("\8dA\82É\8bl\82Ü\82ç\82¹\82Ä\82µ\82Ü\82Á\82½\81D");
315 /*JP
316             Strcpy(killer.name, "quick snack");
317 */
318             Strcpy(killer.name, "\91\81\90H\82¢");
319         }
320 /*JP
321         You("die...");
322 */
323         pline("\82 \82È\82½\82Í\8e\80\82É\82Ü\82µ\82½\81D\81D\81D");
324         done(CHOKING);
325     }
326 }
327
328 /* modify object wt. depending on time spent consuming it */
329 STATIC_OVL void
330 recalc_wt()
331 {
332     struct obj *piece = context.victual.piece;
333     if (!piece) {
334         impossible("recalc_wt without piece");
335         return;
336     }
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);
342 }
343
344 /* called when eating interrupted by an event */
345 void
346 reset_eat()
347 {
348     /* we only set a flag here - the actual reset process is done after
349      * the round is spent eating.
350      */
351     if (context.victual.eating && !context.victual.doreset) {
352         debugpline0("reset_eat...");
353         context.victual.doreset = TRUE;
354     }
355     return;
356 }
357
358 STATIC_OVL struct obj *
359 touchfood(otmp)
360 struct obj *otmp;
361 {
362     if (otmp->quan > 1L) {
363         if (!carried(otmp))
364             (void) splitobj(otmp, otmp->quan - 1L);
365         else
366             otmp = splitobj(otmp, 1L);
367         debugpline0("split object,");
368     }
369
370     if (!otmp->oeaten) {
371         costly_alteration(otmp, COST_BITE);
372         otmp->oeaten =
373             (otmp->otyp == CORPSE ? mons[otmp->corpsenm].cnutrit
374                                   : objects[otmp->otyp].oc_nutrition);
375     }
376
377     if (carried(otmp)) {
378         freeinv(otmp);
379         if (inv_cnt(FALSE) >= 52) {
380             sellobj_state(SELL_DONTSELL);
381             dropy(otmp);
382             sellobj_state(SELL_NORMAL);
383         } else {
384             otmp->nomerge = 1; /* used to prevent merge */
385             otmp = addinv(otmp);
386             otmp->nomerge = 0;
387         }
388     }
389     return otmp;
390 }
391
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
395  * in do_reset_eat().
396  */
397 void
398 food_disappears(obj)
399 struct obj *obj;
400 {
401     if (obj == context.victual.piece) {
402         context.victual.piece = (struct obj *) 0;
403         context.victual.o_id = 0;
404     }
405     if (obj->timed)
406         obj_stop_timers(obj);
407 }
408
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 */
412 void
413 food_substitution(old_obj, new_obj)
414 struct obj *old_obj, *new_obj;
415 {
416     if (old_obj == context.victual.piece) {
417         context.victual.piece = new_obj;
418         context.victual.o_id = new_obj->o_id;
419     }
420     if (old_obj == context.tin.tin) {
421         context.tin.tin = new_obj;
422         context.tin.o_id = new_obj->o_id;
423     }
424 }
425
426 STATIC_OVL void
427 do_reset_eat()
428 {
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;
435         recalc_wt();
436     }
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.
443      */
444     stop_occupation();
445     newuhs(FALSE);
446 }
447
448 /* called each move during eating process */
449 STATIC_PTR int
450 eatfood(VOID_ARGS)
451 {
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? */
456         do_reset_eat();
457         return 0;
458     }
459     if (!context.victual.eating)
460         return 0;
461
462     if (++context.victual.usedtime <= context.victual.reqtime) {
463         if (bite())
464             return 0;
465         return 1; /* still busy */
466     } else {        /* done */
467         done_eating(TRUE);
468         return 0;
469     }
470 }
471
472 STATIC_OVL void
473 done_eating(message)
474 boolean message;
475 {
476     context.victual.piece->in_use = TRUE;
477     occupation = 0; /* do this early, so newuhs() knows we're done */
478     newuhs(FALSE);
479     if (nomovemsg) {
480         if (message)
481             pline1(nomovemsg);
482         nomovemsg = 0;
483     } else if (message)
484 /*JP
485         You("finish eating %s.", food_xname(context.victual.piece, TRUE));
486 */
487         You("%s\82ð\90H\82×\8fI\82¦\82½\81D",  food_xname(context.victual.piece, TRUE));
488
489     if (context.victual.piece->otyp == CORPSE)
490         cpostfx(context.victual.piece->corpsenm);
491     else
492         fpostfx(context.victual.piece);
493
494     if (carried(context.victual.piece))
495         useup(context.victual.piece);
496     else
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;
502 }
503
504 void
505 eating_conducts(pd)
506 struct permonst *pd;
507 {
508     u.uconduct.food++;
509     if (!vegan(pd))
510         u.uconduct.unvegan++;
511     if (!vegetarian(pd))
512         violated_vegetarian();
513 }
514
515 /* handle side-effects of mind flayer's tentacle attack */
516 int
517 eat_brains(magr, mdef, visflag, dmg_p)
518 struct monst *magr, *mdef;
519 boolean visflag;
520 int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
521 {
522     struct permonst *pd = mdef->data;
523     boolean give_nutrit = FALSE;
524     int result = MM_HIT, xtra_dmg = rnd(10);
525
526     if (noncorporeal(pd)) {
527         if (visflag)
528 #if 0 /*JP*/
529             pline("%s brain is unharmed.",
530                   (mdef == &youmonst) ? "Your" : s_suffix(Monnam(mdef)));
531 #else
532             pline("%s\82Ì\94]\82Í\96³\8e\96\82¾\82Á\82½\81D",
533                   (mdef == &youmonst) ? "\82 \82È\82½" : Monnam(mdef));
534 #endif
535         return MM_MISS; /* side-effects can't occur */
536     } else if (magr == &youmonst) {
537 /*JP
538         You("eat %s brain!", s_suffix(mon_nam(mdef)));
539 */
540         You("%s\82Ì\94]\82ð\90H\82×\82½\81I", mon_nam(mdef));
541     } else if (mdef == &youmonst) {
542 /*JP
543         Your("brain is eaten!");
544 */
545         Your("\94]\82Í\90H\82×\82ç\82ê\82½\81I");
546     } else { /* monster against monster */
547         if (visflag)
548 /*JP
549             pline("%s brain is eaten!", s_suffix(Monnam(mdef)));
550 */
551             pline("%s\82Ì\94]\82Í\90H\82×\82ç\82ê\82½\81I", Monnam(mdef));
552     }
553
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);
561         } else {
562             /* no need to check for poly_when_stoned or Stone_resistance;
563                mind flayers don't have those capabilities */
564             if (visflag)
565 /*JP
566                 pline("%s turns to stone!", Monnam(magr));
567 */
568                 pline("%s\82Í\90Î\82É\82È\82Á\82½\81I", Monnam(magr));
569             monstone(magr);
570             if (magr->mhp > 0) {
571                 /* life-saved; don't continue eating the brains */
572                 return MM_MISS;
573             } else {
574                 if (magr->mtame && !visflag)
575                     /* parallels mhitm.c's brief_feeling */
576 /*JP
577                     You("have a sad thought for a moment, then is passes.");
578 */
579                     You("\94ß\82µ\82¢\8dl\82¦\82É\82¨\82»\82í\82ê\82½\82ª\81A\82·\82®\82É\89ß\82¬\82³\82Á\82½\81D");
580                 return MM_AGR_DIED;
581             }
582         }
583     }
584
585     if (magr == &youmonst) {
586         /*
587          * player mind flayer is eating something's brain
588          */
589         eating_conducts(pd);
590         if (mindless(pd)) { /* (cannibalism not possible here) */
591 /*JP
592             pline("%s doesn't notice.", Monnam(mdef));
593 */
594             pline("%s\82Í\8bC\82Ã\82¢\82Ä\82¢\82È\82¢\81D", Monnam(mdef));
595             /* all done; no extra harm inflicted upon target */
596             return MM_MISS;
597         } else if (is_rider(pd)) {
598 /*JP
599             pline("Ingesting that is fatal.");
600 */
601             pline("\8eæ\82è\8d\9e\82ñ\82¾\82ç\82·\82®\82É\8e\80\82ñ\82Å\82µ\82Ü\82Á\82½\81D");
602 #if 0 /*JP*/
603             Sprintf(killer.name, "unwisely ate the brain of %s", pd->mname);
604             killer.format = NO_KILLER_PREFIX;
605 #else
606             Sprintf(killer.name, "\8bð\82©\82É\82à%s\82Ì\91Ì\82ð\90H\82×\82Ä", pd->mname);
607             killer.format = KILLED_BY;
608 #endif
609             done(DIED);
610             /* life-saving needed to reach here */
611             exercise(A_WIS, FALSE);
612             *dmg_p += xtra_dmg; /* Rider takes extra damage */
613         } else {
614             morehungry(-rnd(30)); /* cannot choke */
615             if (ABASE(A_INT) < AMAX(A_INT)) {
616                 /* recover lost Int; won't increase current max */
617                 ABASE(A_INT) += rnd(4);
618                 if (ABASE(A_INT) > AMAX(A_INT))
619                     ABASE(A_INT) = AMAX(A_INT);
620                 context.botl = 1;
621             }
622             exercise(A_WIS, TRUE);
623             *dmg_p += xtra_dmg;
624         }
625         /* targetting another mind flayer or your own underlying species
626            is cannibalism */
627         (void) maybe_cannibal(monsndx(pd), TRUE);
628
629     } else if (mdef == &youmonst) {
630         /*
631          * monster mind flayer is eating hero's brain
632          */
633         /* no such thing as mindless players */
634         if (ABASE(A_INT) <= ATTRMIN(A_INT)) {
635 /*JP
636             static NEARDATA const char brainlessness[] = "brainlessness";
637 */
638             static NEARDATA const char brainlessness[] = "\94]\82ð\8e¸\82Á\82Ä";
639
640             if (Lifesaved) {
641                 Strcpy(killer.name, brainlessness);
642                 killer.format = KILLED_BY;
643                 done(DIED);
644                 /* amulet of life saving has now been used up */
645 /*JP
646                 pline("Unfortunately your brain is still gone.");
647 */
648                 pline("\8ec\94O\82È\82ª\82ç\82 \82È\82½\82É\82Í\94]\82ª\82È\82¢\81D");
649                 /* sanity check against adding other forms of life-saving */
650                 u.uprops[LIFESAVED].extrinsic =
651                     u.uprops[LIFESAVED].intrinsic = 0L;
652             } else {
653 /*JP
654                 Your("last thought fades away.");
655 */
656                 Your("\8dÅ\8cã\82Ì\8ev\82¢\82ª\91\96\94n\93\95\82Ì\82æ\82¤\82É\89¡\82¬\82Á\82½\81D");
657             }
658             Strcpy(killer.name, brainlessness);
659             killer.format = KILLED_BY;
660             done(DIED);
661             /* can only get here when in wizard or explore mode and user has
662                explicitly chosen not to die; arbitrarily boost intelligence */
663             ABASE(A_INT) = ATTRMIN(A_INT) + 2;
664 /*JP
665             You_feel("like a scarecrow.");
666 */
667             You("\82©\82©\82µ\82Ì\82æ\82¤\82È\8bC\8e\9d\82ª\82µ\82½\81D");
668         }
669         give_nutrit = TRUE; /* in case a conflicted pet is doing this */
670         exercise(A_WIS, FALSE);
671         /* caller handles Int and memory loss */
672
673     } else { /* mhitm */
674         /*
675          * monster mind flayer is eating another monster's brain
676          */
677         if (mindless(pd)) {
678             if (visflag)
679 /*JP
680                 pline("%s doesn't notice.", Monnam(mdef));
681 */
682                 pline("%s\82Í\8bC\82Ã\82¢\82Ä\82¢\82È\82¢\81D", Monnam(mdef));
683             return MM_MISS;
684         } else if (is_rider(pd)) {
685             mondied(magr);
686             if (magr->mhp <= 0)
687                 result = MM_AGR_DIED;
688             /* Rider takes extra damage regardless of whether attacker dies */
689             *dmg_p += xtra_dmg;
690         } else {
691             *dmg_p += xtra_dmg;
692             give_nutrit = TRUE;
693             if (*dmg_p >= mdef->mhp && visflag)
694 /*JP
695                 pline("%s last thought fades away...",
696 */
697                 pline("%s\82Ì\8dÅ\8cã\82Ì\8ev\82¢\82ª\82æ\82¬\82é\81D\81D\81D",
698                       s_suffix(Monnam(mdef)));
699         }
700     }
701
702     if (give_nutrit && magr->mtame && !magr->isminion) {
703         EDOG(magr)->hungrytime += rnd(60);
704         magr->mconf = 0;
705     }
706
707     return result;
708 }
709
710 /* eating a corpse or egg of one's own species is usually naughty */
711 STATIC_OVL boolean
712 maybe_cannibal(pm, allowmsg)
713 int pm;
714 boolean allowmsg;
715 {
716     static NEARDATA long ate_brains = 0L;
717     struct permonst *fptr = &mons[pm]; /* food type */
718
719     /* when poly'd into a mind flayer, multiple tentacle hits in one
720        turn cause multiple digestion checks to occur; avoid giving
721        multiple luck penalties for the same attack */
722     if (moves == ate_brains)
723         return FALSE;
724     ate_brains = moves; /* ate_anything, not just brains... */
725
726     if (!CANNIBAL_ALLOWED()
727         /* non-cannibalistic heroes shouldn't eat own species ever
728            and also shouldn't eat current species when polymorphed
729            (even if having the form of something which doesn't care
730            about cannibalism--hero's innate traits aren't altered) */
731         && (your_race(fptr) || (Upolyd && same_race(youmonst.data, fptr)))) {
732         if (allowmsg) {
733             if (Upolyd && your_race(fptr))
734 /*JP
735                 You("have a bad feeling deep inside.");
736 */
737                 You("\8c\99\88«\8a´\82É\82¨\82»\82í\82ê\82½\81D");
738 /*JP
739             You("cannibal!  You will regret this!");
740 */
741             pline("\8b¤\8bò\82¢\82¾\81I\8cã\89÷\82·\82é\82¼\81I");
742         }
743         HAggravate_monster |= FROMOUTSIDE;
744         change_luck(-rn1(4, 2)); /* -5..-2 */
745         return TRUE;
746     }
747     return FALSE;
748 }
749
750 STATIC_OVL void
751 cprefx(pm)
752 register int pm;
753 {
754     (void) maybe_cannibal(pm, TRUE);
755     if (flesh_petrifies(&mons[pm])) {
756         if (!Stone_resistance
757             && !(poly_when_stoned(youmonst.data)
758                  && polymon(PM_STONE_GOLEM))) {
759 /*JP
760             Sprintf(killer.name, "tasting %s meat", mons[pm].mname);
761 */
762             Sprintf(killer.name, "%s\82Ì\93÷\82ð\90H\82×", mons[pm].mname);
763             killer.format = KILLED_BY;
764 /*JP
765             You("turn to stone.");
766 */
767             You("\90Î\82É\82È\82Á\82½\81D");
768             done(STONING);
769             if (context.victual.piece)
770                 context.victual.eating = FALSE;
771             return; /* lifesaved */
772         }
773     }
774
775     switch (pm) {
776     case PM_LITTLE_DOG:
777     case PM_DOG:
778     case PM_LARGE_DOG:
779     case PM_KITTEN:
780     case PM_HOUSECAT:
781     case PM_LARGE_CAT:
782         /* cannibals are allowed to eat domestic animals without penalty */
783         if (!CANNIBAL_ALLOWED()) {
784 /*JP
785             You_feel("that eating the %s was a bad idea.", mons[pm].mname);
786 */
787             pline("%s\82ð\90H\82×\82é\82Ì\82Í\82æ\82­\82È\82¢\8bC\82ª\82µ\82½\81D", mons[pm].mname);
788             HAggravate_monster |= FROMOUTSIDE;
789         }
790         break;
791     case PM_LIZARD:
792         if (Stoned)
793             fix_petrification();
794         break;
795     case PM_DEATH:
796     case PM_PESTILENCE:
797     case PM_FAMINE: {
798 /*JP
799         pline("Eating that is instantly fatal.");
800 */
801         pline("\90H\82×\82½\82ç\82·\82®\82É\8e\80\82ñ\82Å\82µ\82Ü\82Á\82½\81D");
802 #if 0 /*JP*/
803         Sprintf(killer.name, "unwisely ate the body of %s", mons[pm].mname);
804         killer.format = NO_KILLER_PREFIX;
805 #else
806         Sprintf(killer.name, "\8bð\82©\82É\82à%s\82Ì\91Ì\82ð\90H\82×\82Ä", mons[pm].mname);
807         killer.format = KILLED_BY;
808 #endif
809         done(DIED);
810         /* life-saving needed to reach here */
811         exercise(A_WIS, FALSE);
812         /* It so happens that since we know these monsters */
813         /* cannot appear in tins, context.victual.piece will always */
814         /* be what we want, which is not generally true. */
815         if (revive_corpse(context.victual.piece)) {
816             context.victual.piece = (struct obj *) 0;
817             context.victual.o_id = 0;
818         }
819         return;
820     }
821     case PM_GREEN_SLIME:
822         if (!Slimed && !Unchanging && !slimeproof(youmonst.data)) {
823 /*JP
824             You("don't feel very well.");
825 */
826             You("\82·\82²\82­\8bC\95ª\82ª\88«\82¢\81D");
827             make_slimed(10L, (char *) 0);
828             delayed_killer(SLIMED, KILLED_BY_AN, "");
829         }
830     /* Fall through */
831     default:
832         if (acidic(&mons[pm]) && Stoned)
833             fix_petrification();
834         break;
835     }
836 }
837
838 void
839 fix_petrification()
840 {
841     char buf[BUFSZ];
842
843     if (Hallucination)
844 #if 0 /*JP*/
845         Sprintf(buf, "What a pity--you just ruined a future piece of %sart!",
846                 ACURR(A_CHA) > 15 ? "fine " : "");
847 #else
848         Sprintf(buf, "\82È\82ñ\82Ä\82±\82Æ\82¾\81I%s\8c|\8fp\8dì\95i\82É\82È\82ê\82½\82©\82à\82µ\82ê\82È\82¢\82Ì\82É\81I",
849                 ACURR(A_CHA) > 15 ? "\8bM\8fd\82È" : "");
850 #endif
851     else
852 /*JP
853         Strcpy(buf, "You feel limber!");
854 */
855         Strcpy(buf, "\91Ì\82ª\93î\82ç\82©\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81I");
856     make_stoned(0L, buf, 0, (char *) 0);
857 }
858
859 /*
860  * If you add an intrinsic that can be gotten by eating a monster, add it
861  * to intrinsic_possible() and givit().  (It must already be in prop.h to
862  * be an intrinsic property.)
863  * It would be very easy to make the intrinsics not try to give you one
864  * that you already had by checking to see if you have it in
865  * intrinsic_possible() instead of givit(), but we're not that nice.
866  */
867
868 /* intrinsic_possible() returns TRUE iff a monster can give an intrinsic. */
869 STATIC_OVL int
870 intrinsic_possible(type, ptr)
871 int type;
872 register struct permonst *ptr;
873 {
874     int res = 0;
875
876 #ifdef DEBUG
877 #define ifdebugresist(Msg)      \
878     do {                        \
879         if (res)                \
880             debugpline0(Msg);   \
881     } while (0)
882 #else
883 #define ifdebugresist(Msg) /*empty*/
884 #endif
885     switch (type) {
886     case FIRE_RES:
887         res = (ptr->mconveys & MR_FIRE) != 0;
888         ifdebugresist("can get fire resistance");
889         break;
890     case SLEEP_RES:
891         res = (ptr->mconveys & MR_SLEEP) != 0;
892         ifdebugresist("can get sleep resistance");
893         break;
894     case COLD_RES:
895         res = (ptr->mconveys & MR_COLD) != 0;
896         ifdebugresist("can get cold resistance");
897         break;
898     case DISINT_RES:
899         res = (ptr->mconveys & MR_DISINT) != 0;
900         ifdebugresist("can get disintegration resistance");
901         break;
902     case SHOCK_RES: /* shock (electricity) resistance */
903         res = (ptr->mconveys & MR_ELEC) != 0;
904         ifdebugresist("can get shock resistance");
905         break;
906     case POISON_RES:
907         res = (ptr->mconveys & MR_POISON) != 0;
908         ifdebugresist("can get poison resistance");
909         break;
910     case TELEPORT:
911         res = can_teleport(ptr);
912         ifdebugresist("can get teleport");
913         break;
914     case TELEPORT_CONTROL:
915         res = control_teleport(ptr);
916         ifdebugresist("can get teleport control");
917         break;
918     case TELEPAT:
919         res = telepathic(ptr);
920         ifdebugresist("can get telepathy");
921         break;
922     default:
923         /* res stays 0 */
924         break;
925     }
926 #undef ifdebugresist
927     return res;
928 }
929
930 /* givit() tries to give you an intrinsic based on the monster's level
931  * and what type of intrinsic it is trying to give you.
932  */
933 STATIC_OVL void
934 givit(type, ptr)
935 int type;
936 register struct permonst *ptr;
937 {
938     register int chance;
939
940     debugpline1("Attempting to give intrinsic %d", type);
941     /* some intrinsics are easier to get than others */
942     switch (type) {
943     case POISON_RES:
944         if ((ptr == &mons[PM_KILLER_BEE] || ptr == &mons[PM_SCORPION])
945             && !rn2(4))
946             chance = 1;
947         else
948             chance = 15;
949         break;
950     case TELEPORT:
951         chance = 10;
952         break;
953     case TELEPORT_CONTROL:
954         chance = 12;
955         break;
956     case TELEPAT:
957         chance = 1;
958         break;
959     default:
960         chance = 15;
961         break;
962     }
963
964     if (ptr->mlevel <= rn2(chance))
965         return; /* failed die roll */
966
967     switch (type) {
968     case FIRE_RES:
969         debugpline0("Trying to give fire resistance");
970         if (!(HFire_resistance & FROMOUTSIDE)) {
971 /*JP
972             You(Hallucination ? "be chillin'." : "feel a momentary chill.");
973 */
974             You(Hallucination ? "\81u\83N\81[\83\8b\91î\94z\95Ö\81v\82³\82ê\82Ä\82¢\82é\82æ\82¤\82¾\81D" : "\88ê\8fu\8a¦\82¯\82ª\82µ\82½\81D");
975             HFire_resistance |= FROMOUTSIDE;
976         }
977         break;
978     case SLEEP_RES:
979         debugpline0("Trying to give sleep resistance");
980         if (!(HSleep_resistance & FROMOUTSIDE)) {
981 /*JP
982             You_feel("wide awake.");
983 */
984             You("\82Ï\82Á\82¿\82è\96Ú\82ª\82³\82ß\82½\81D");
985             HSleep_resistance |= FROMOUTSIDE;
986         }
987         break;
988     case COLD_RES:
989         debugpline0("Trying to give cold resistance");
990         if (!(HCold_resistance & FROMOUTSIDE)) {
991 /*JP
992             You_feel("full of hot air.");
993 */
994             You("\94M\95\97\82ð\91S\90g\82É\8a´\82\82½\81D");
995             HCold_resistance |= FROMOUTSIDE;
996         }
997         break;
998     case DISINT_RES:
999         debugpline0("Trying to give disintegration resistance");
1000         if (!(HDisint_resistance & FROMOUTSIDE)) {
1001 /*JP
1002             You_feel(Hallucination ? "totally together, man." : "very firm.");
1003 */
1004             You_feel(Hallucination ? "\90¢\8aE\90l\97Þ\82Æ\8cZ\92í\82É\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D" : "\82Æ\82Ä\82à\8aæ\8fä\82É\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1005             HDisint_resistance |= FROMOUTSIDE;
1006         }
1007         break;
1008     case SHOCK_RES: /* shock (electricity) resistance */
1009         debugpline0("Trying to give shock resistance");
1010         if (!(HShock_resistance & FROMOUTSIDE)) {
1011             if (Hallucination)
1012 /*JP
1013                 You_feel("grounded in reality.");
1014 */
1015               You("\8eÀ\82Í\83A\81[\83X\82³\82ê\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1016             else
1017 /*JP
1018                 Your("health currently feels amplified!");
1019 */
1020               pline("\8c\92\8dN\82ª\91\9d\95\9d\82³\82ê\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81I");
1021             HShock_resistance |= FROMOUTSIDE;
1022         }
1023         break;
1024     case POISON_RES:
1025         debugpline0("Trying to give poison resistance");
1026         if (!(HPoison_resistance & FROMOUTSIDE)) {
1027 /*JP
1028             You_feel(Poison_resistance ? "especially healthy." : "healthy.");
1029 */
1030             You_feel(Poison_resistance ? "\93Á\82É\8c\92\8dN\82É\82È\82Á\82½\8bC\82ª\82µ\82½\81D" : "\8c\92\8dN\82É\82È\82Á\82½\8bC\82ª\82µ\82½\81D");
1031             HPoison_resistance |= FROMOUTSIDE;
1032         }
1033         break;
1034     case TELEPORT:
1035         debugpline0("Trying to give teleport");
1036         if (!(HTeleportation & FROMOUTSIDE)) {
1037 /*JP
1038             You_feel(Hallucination ? "diffuse." : "very jumpy.");
1039 */
1040             pline(Hallucination ? "\91Ì\82ª\94ò\82Ñ\8eU\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D" : "\92µ\96ô\97Í\82ª\8d\82\82Ü\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1041             HTeleportation |= FROMOUTSIDE;
1042         }
1043         break;
1044     case TELEPORT_CONTROL:
1045         debugpline0("Trying to give teleport control");
1046         if (!(HTeleport_control & FROMOUTSIDE)) {
1047 #if 0 /*JP*/
1048             You_feel(Hallucination ? "centered in your personal space."
1049                                    : "in control of yourself.");
1050 #else
1051             You_feel(Hallucination ? "\8e©\8cÈ\92\86\90S\93I\82É\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D"
1052                                    : "\8e©\95ª\8e©\90g\82ð\90§\8cä\82Å\82«\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1053 #endif
1054             HTeleport_control |= FROMOUTSIDE;
1055         }
1056         break;
1057     case TELEPAT:
1058         debugpline0("Trying to give telepathy");
1059         if (!(HTelepat & FROMOUTSIDE)) {
1060 #if 0 /*JP*/
1061             You_feel(Hallucination ? "in touch with the cosmos."
1062                                    : "a strange mental acuity.");
1063 #else
1064             You_feel(Hallucination ? "\89F\92\88\82Ì\90_\94é\82É\90G\82ê\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D"
1065                                    : "\8aï\96­\82È\90¸\90_\93I\89s\82³\82ð\8a´\82\82½\81D");
1066 #endif
1067             HTelepat |= FROMOUTSIDE;
1068             /* If blind, make sure monsters show up. */
1069             if (Blind)
1070                 see_monsters();
1071         }
1072         break;
1073     default:
1074         debugpline0("Tried to give an impossible intrinsic");
1075         break;
1076     }
1077 }
1078
1079 /* called after completely consuming a corpse */
1080 STATIC_OVL void
1081 cpostfx(pm)
1082 register int pm;
1083 {
1084     register int tmp = 0;
1085     boolean catch_lycanthropy = FALSE;
1086
1087     /* in case `afternmv' didn't get called for previously mimicking
1088        gold, clean up now to avoid `eatmbuf' memory leak */
1089     if (eatmbuf)
1090         (void) eatmdone();
1091
1092     switch (pm) {
1093     case PM_NEWT:
1094         /* MRKR: "eye of newt" may give small magical energy boost */
1095         if (rn2(3) || 3 * u.uen <= 2 * u.uenmax) {
1096             int old_uen = u.uen;
1097             u.uen += rnd(3);
1098             if (u.uen > u.uenmax) {
1099                 if (!rn2(3))
1100                     u.uenmax++;
1101                 u.uen = u.uenmax;
1102             }
1103             if (old_uen != u.uen) {
1104 /*JP
1105                 You_feel("a mild buzz.");
1106 */
1107                 You("\82·\82±\82µ\82Ó\82ç\82Ó\82ç\82µ\82½\81D");
1108                 context.botl = 1;
1109             }
1110         }
1111         break;
1112     case PM_WRAITH:
1113         pluslvl(FALSE);
1114         break;
1115     case PM_HUMAN_WERERAT:
1116         catch_lycanthropy = TRUE;
1117         u.ulycn = PM_WERERAT;
1118         break;
1119     case PM_HUMAN_WEREJACKAL:
1120         catch_lycanthropy = TRUE;
1121         u.ulycn = PM_WEREJACKAL;
1122         break;
1123     case PM_HUMAN_WEREWOLF:
1124         catch_lycanthropy = TRUE;
1125         u.ulycn = PM_WEREWOLF;
1126         break;
1127     case PM_NURSE:
1128         if (Upolyd)
1129             u.mh = u.mhmax;
1130         else
1131             u.uhp = u.uhpmax;
1132         context.botl = 1;
1133         break;
1134     case PM_STALKER:
1135         if (!Invis) {
1136             set_itimeout(&HInvis, (long) rn1(100, 50));
1137             if (!Blind && !BInvis)
1138                 self_invis_message();
1139         } else {
1140             if (!(HInvis & INTRINSIC))
1141 /*JP
1142                 You_feel("hidden!");
1143 */
1144                 Your("\8ep\82Í\89B\82³\82ê\82½\81I");
1145             HInvis |= FROMOUTSIDE;
1146             HSee_invisible |= FROMOUTSIDE;
1147         }
1148         newsym(u.ux, u.uy);
1149         /*FALLTHRU*/
1150     case PM_YELLOW_LIGHT:
1151     case PM_GIANT_BAT:
1152         make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1153         /*FALLTHRU*/
1154     case PM_BAT:
1155         make_stunned((HStun & TIMEOUT) + 30L, FALSE);
1156         break;
1157     case PM_GIANT_MIMIC:
1158         tmp += 10;
1159         /*FALLTHRU*/
1160     case PM_LARGE_MIMIC:
1161         tmp += 20;
1162         /*FALLTHRU*/
1163     case PM_SMALL_MIMIC:
1164         tmp += 20;
1165         if (youmonst.data->mlet != S_MIMIC && !Unchanging) {
1166             char buf[BUFSZ];
1167
1168             u.uconduct.polyselfs++; /* you're changing form */
1169 #if 0 /*JP*/
1170             You_cant("resist the temptation to mimic %s.",
1171                      Hallucination ? "an orange" : "a pile of gold");
1172 #else
1173             You("%s\82ð\90^\8e\97\82µ\82½\82¢\97U\98f\82É\82©\82ç\82ê\82½\81D",
1174                      Hallucination ? "\83I\83\8c\83\93\83W" : "\8bà\89Ý\82Ì\8eR");
1175 #endif
1176             /* A pile of gold can't ride. */
1177             if (u.usteed)
1178                 dismount_steed(DISMOUNT_FELL);
1179             nomul(-tmp);
1180             multi_reason = "pretending to be a pile of gold";
1181             Sprintf(buf,
1182                     Hallucination
1183 /*JP
1184                        ? "You suddenly dread being peeled and mimic %s again!"
1185 */
1186                        ? "\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"
1187 /*JP
1188                        : "You now prefer mimicking %s again.",
1189 */
1190                        : "\82±\82ñ\82Ç\82Í\82Ü\82½%s\82Ì\90^\8e\97\82ª\82µ\82½\82­\82È\82Á\82½\81D",
1191                     an(Upolyd ? youmonst.data->mname : urace.noun));
1192             eatmbuf = dupstr(buf);
1193             nomovemsg = eatmbuf;
1194             afternmv = eatmdone;
1195             /* ??? what if this was set before? */
1196             youmonst.m_ap_type = M_AP_OBJECT;
1197             youmonst.mappearance = Hallucination ? ORANGE : GOLD_PIECE;
1198             newsym(u.ux, u.uy);
1199             curs_on_u();
1200             /* make gold symbol show up now */
1201             display_nhwindow(WIN_MAP, TRUE);
1202         }
1203         break;
1204     case PM_QUANTUM_MECHANIC:
1205 /*JP
1206         Your("velocity suddenly seems very uncertain!");
1207 */
1208         Your("\91¬\93x\82ª\93Ë\91R\81C\95s\8am\92è\82É\82È\82Á\82½\81I");
1209         if (HFast & INTRINSIC) {
1210             HFast &= ~INTRINSIC;
1211 /*JP
1212             You("seem slower.");
1213 */
1214             You("\92x\82­\82È\82Á\82½\82æ\82¤\82¾\81D");
1215         } else {
1216             HFast |= FROMOUTSIDE;
1217 /*JP
1218             You("seem faster.");
1219 */
1220             You("\91¬\82­\82È\82Á\82½\82æ\82¤\82¾\81D");
1221         }
1222         break;
1223     case PM_LIZARD:
1224         if ((HStun & TIMEOUT) > 2)
1225             make_stunned(2L, FALSE);
1226         if ((HConfusion & TIMEOUT) > 2)
1227             make_confused(2L, FALSE);
1228         break;
1229     case PM_CHAMELEON:
1230     case PM_DOPPELGANGER:
1231     case PM_SANDESTIN: /* moot--they don't leave corpses */
1232         if (Unchanging) {
1233 #if 0 /*JP*/
1234             You_feel("\88ê\8fu\88á\82Á\82½\8a´\82\82ª\82µ\82½\81D"); /* same as poly trap */
1235 #else
1236 #endif
1237         } else {
1238 /*JP
1239             You_feel("a change coming over you.");
1240 */
1241             pline("\95Ï\89»\82ª\96K\82ê\82½\81D");
1242             polyself(0);
1243         }
1244         break;
1245     case PM_DISENCHANTER:
1246         /* picks an intrinsic at random and removes it; there's
1247            no feedback if hero already lacks the chosen ability */
1248         debugpline0("using attrcurse to strip an intrinsic");
1249         attrcurse();
1250         break;
1251     case PM_MIND_FLAYER:
1252     case PM_MASTER_MIND_FLAYER:
1253         if (ABASE(A_INT) < ATTRMAX(A_INT)) {
1254             if (!rn2(2)) {
1255 /*JP
1256                 pline("Yum! That was real brain food!");
1257 */
1258                 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");
1259                 (void) adjattrib(A_INT, 1, FALSE);
1260                 break; /* don't give them telepathy, too */
1261             }
1262         } else {
1263 /*JP
1264             pline("For some reason, that tasted bland.");
1265 */
1266             pline("\82Ç\82¤\82µ\82½\82í\82¯\82©\81C\92W\94\92\82È\96¡\82¾\81D");
1267         }
1268     /*FALLTHRU*/
1269     default: {
1270         struct permonst *ptr = &mons[pm];
1271         boolean conveys_STR = is_giant(ptr);
1272         int i, count;
1273
1274         if (dmgtype(ptr, AD_STUN) || dmgtype(ptr, AD_HALU)
1275             || pm == PM_VIOLET_FUNGUS) {
1276 /*JP
1277             pline("Oh wow!  Great stuff!");
1278 */
1279             pline("\83\8f\81[\83H\81I\82±\82è\82á\82·\82²\82¢\81I");
1280             (void) make_hallucinated((HHallucination & TIMEOUT) + 200L, FALSE,
1281                                      0L);
1282         }
1283
1284         /* Check the monster for all of the intrinsics.  If this
1285          * monster can give more than one, pick one to try to give
1286          * from among all it can give.
1287          *
1288          * Strength from giants is now treated like an intrinsic
1289          * rather than being given unconditionally.
1290          */
1291         count = 0; /* number of possible intrinsics */
1292         tmp = 0;   /* which one we will try to give */
1293         if (conveys_STR) {
1294             count = 1;
1295             tmp = -1; /* use -1 as fake prop index for STR */
1296             debugpline1("\"Intrinsic\" strength, %d", tmp);
1297         }
1298         for (i = 1; i <= LAST_PROP; i++) {
1299             if (!intrinsic_possible(i, ptr))
1300                 continue;
1301             ++count;
1302             /* a 1 in count chance of replacing the old choice
1303                with this one, and a count-1 in count chance
1304                of keeping the old choice (note that 1 in 1 and
1305                0 in 1 are what we want for the first candidate) */
1306             if (!rn2(count)) {
1307                 debugpline2("Intrinsic %d replacing %d", i, tmp);
1308                 tmp = i;
1309             }
1310         }
1311         /* if strength is the only candidate, give it 50% chance */
1312         if (conveys_STR && count == 1 && !rn2(2))
1313             tmp = 0;
1314         /* if something was chosen, give it now (givit() might fail) */
1315         if (tmp == -1)
1316             gainstr((struct obj *) 0, 0, TRUE);
1317         else if (tmp > 0)
1318             givit(tmp, ptr);
1319     } break;
1320     }
1321
1322     if (catch_lycanthropy)
1323         retouch_equipment(2);
1324
1325     return;
1326 }
1327
1328 void
1329 violated_vegetarian()
1330 {
1331     u.uconduct.unvegetarian++;
1332     if (Role_if(PM_MONK)) {
1333 /*JP
1334         You_feel("guilty.");
1335 */
1336         pline("\8dß\82ð\8a´\82\82½\81D");
1337         adjalign(-1);
1338     }
1339     return;
1340 }
1341
1342 /* common code to check and possibly charge for 1 context.tin.tin,
1343  * will split() context.tin.tin if necessary */
1344 STATIC_PTR void
1345 costly_tin(alter_type)
1346 int alter_type; /* COST_xxx */
1347 {
1348     struct obj *tin = context.tin.tin;
1349
1350     if (carried(tin) ? tin->unpaid
1351                      : (costly_spot(tin->ox, tin->oy) && !tin->no_charge)) {
1352         if (tin->quan > 1L) {
1353             tin = context.tin.tin = splitobj(tin, 1L);
1354             context.tin.o_id = tin->o_id;
1355         }
1356         costly_alteration(tin, alter_type);
1357     }
1358 }
1359
1360 int
1361 tin_variety_txt(s, tinvariety)
1362 char *s;
1363 int *tinvariety;
1364 {
1365     int k, l;
1366
1367     if (s && tinvariety) {
1368         *tinvariety = -1;
1369         for (k = 0; k < TTSZ - 1; ++k) {
1370             l = (int) strlen(tintxts[k].txt);
1371             if (!strncmpi(s, tintxts[k].txt, l) && ((int) strlen(s) > l)
1372                 && s[l] == ' ') {
1373                 *tinvariety = k;
1374                 return (l + 1);
1375             }
1376         }
1377     }
1378     return 0;
1379 }
1380
1381 /*
1382  * This assumes that buf already contains the word "tin",
1383  * as is the case with caller xname().
1384  */
1385 /*JP:\81u\8aÊ\8bl\81v\82Í\8cã\82Å\95t\82¯\82é */
1386 void
1387 tin_details(obj, mnum, buf)
1388 struct obj *obj;
1389 int mnum;
1390 char *buf;
1391 {
1392     char buf2[BUFSZ];
1393     int r = tin_variety(obj, TRUE);
1394
1395     if (obj && buf) {
1396         if (r == SPINACH_TIN)
1397 /*JP
1398             Strcat(buf, " of spinach");
1399 */
1400             Strcat(buf, "\83z\83E\83\8c\83\93\91\90\82Ì");
1401         else if (mnum == NON_PM)
1402 /*JP
1403             Strcpy(buf, "empty tin");
1404 */
1405             Strcat(buf, "\8bó\82Á\82Û\82Ì");
1406         else {
1407 #if 0 /*JP*//*\93ú\96{\8cê\82Í\8cã\82Å*/
1408             if ((obj->cknown || iflags.override_ID) && obj->spe < 0) {
1409                 if (r == ROTTEN_TIN || r == HOMEMADE_TIN) {
1410                     /* put these before the word tin */
1411                     Sprintf(buf2, "%s %s of ", tintxts[r].txt, buf);
1412                     Strcpy(buf, buf2);
1413                 } else {
1414                     Sprintf(eos(buf), " of %s ", tintxts[r].txt);
1415                 }
1416                 Sprintf(eos(buf), "%s", tintxts[r].txt);
1417             } else {
1418                 Strcpy(eos(buf), " of ");
1419             }
1420 #endif
1421 #if 1 /*JP*//*\81u\82Ì\81v\82Å\8en\82Ü\82é\82È\82ç\8cã\92u\81A\82»\82ê\88È\8aO\82È\82ç\91O\92u*/
1422             if (strstr(tintxts[r].txt, "\82Ì") != tintxts[r].txt) {
1423                 Strcpy(eos(buf), tintxts[r].txt);
1424             }
1425 #endif
1426             if (vegetarian(&mons[mnum]))
1427 /*JP
1428                 Sprintf(eos(buf), "%s", mons[mnum].mname);
1429 */
1430                 Sprintf(eos(buf), "%s", mons[mnum].mname);
1431             else
1432 /*JP
1433                 Sprintf(eos(buf), "%s meat", mons[mnum].mname);
1434 */
1435                 Sprintf(eos(buf), "%s\82Ì\93÷", mons[mnum].mname);
1436 #if 1 /*JP*//*\81u\82Ì\81v\82Å\8en\82Ü\82é\82È\82ç\8cã\92u\81A\82»\82ê\88È\8aO\82È\82ç\91O\92u*/
1437             if (strstr(tintxts[r].txt, "\82Ì") == tintxts[r].txt) {
1438                 Strcpy(eos(buf), tintxts[r].txt);
1439             }
1440             Strcpy(eos(buf), "\82Ì");
1441 #endif
1442         }
1443     }
1444 }
1445
1446 void
1447 set_tin_variety(obj, forcetype)
1448 struct obj *obj;
1449 int forcetype;
1450 {
1451     register int r;
1452
1453     if (forcetype == SPINACH_TIN
1454         || (forcetype == HEALTHY_TIN
1455             && (obj->corpsenm == NON_PM /* empty or already spinach */
1456                 || !vegetarian(&mons[obj->corpsenm])))) { /* replace meat */
1457         obj->corpsenm = NON_PM; /* not based on any monster */
1458         obj->spe = 1;           /* spinach */
1459         return;
1460     } else if (forcetype == HEALTHY_TIN) {
1461         r = tin_variety(obj, FALSE);
1462         if (r < 0 || r >= TTSZ)
1463             r = ROTTEN_TIN; /* shouldn't happen */
1464         while ((r == ROTTEN_TIN && !obj->cursed) || !tintxts[r].fodder)
1465             r = rn2(TTSZ - 1);
1466     } else if (forcetype >= 0 && forcetype < TTSZ - 1) {
1467         r = forcetype;
1468     } else {               /* RANDOM_TIN */
1469         r = rn2(TTSZ - 1); /* take your pick */
1470         if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1471             r = HOMEMADE_TIN; /* lizards don't rot */
1472     }
1473     obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
1474 }
1475
1476 STATIC_OVL int
1477 tin_variety(obj, disp)
1478 struct obj *obj;
1479 boolean disp; /* we're just displaying so leave things alone */
1480 {
1481     register int r;
1482
1483     if (obj->spe == 1) {
1484         r = SPINACH_TIN;
1485     } else if (obj->cursed) {
1486         r = ROTTEN_TIN; /* always rotten if cursed */
1487     } else if (obj->spe < 0) {
1488         r = -(obj->spe);
1489         --r; /* get rid of the offset */
1490     } else
1491         r = rn2(TTSZ - 1);
1492
1493     if (!disp && r == HOMEMADE_TIN && !obj->blessed && !rn2(7))
1494         r = ROTTEN_TIN; /* some homemade tins go bad */
1495
1496     if (r == ROTTEN_TIN && nonrotting_corpse(obj->corpsenm))
1497         r = HOMEMADE_TIN; /* lizards don't rot */
1498     return r;
1499 }
1500
1501 STATIC_OVL void
1502 consume_tin(mesg)
1503 const char *mesg;
1504 {
1505     const char *what;
1506     int which, mnum, r;
1507     struct obj *tin = context.tin.tin;
1508
1509     r = tin_variety(tin, FALSE);
1510     if (tin->otrapped || (tin->cursed && r != HOMEMADE_TIN && !rn2(8))) {
1511 /*JP
1512         b_trapped("tin", 0);
1513 */
1514         b_trapped("\8aÊ", 0);
1515         costly_tin(COST_DSTROY);
1516         goto use_up_tin;
1517     }
1518
1519     pline1(mesg); /* "You succeed in opening the tin." */
1520
1521     if (r != SPINACH_TIN) {
1522         mnum = tin->corpsenm;
1523         if (mnum == NON_PM) {
1524 /*JP
1525             pline("It turns out to be empty.");
1526 */
1527             pline("\8aÊ\82Í\8bó\82Á\82Û\82¾\82Á\82½\81D");
1528             tin->dknown = tin->known = 1;
1529             costly_tin(COST_OPEN);
1530             goto use_up_tin;
1531         }
1532
1533         which = 0; /* 0=>plural, 1=>as-is, 2=>"the" prefix */
1534         if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
1535             && (Stone_resistance || Hallucination)) {
1536 /*JP
1537             what = "chicken";
1538 */
1539             what = "\8c{\93÷";
1540             which = 1; /* suppress pluralization */
1541         } else if (Hallucination) {
1542             what = rndmonnam(NULL);
1543         } else {
1544             what = mons[mnum].mname;
1545             if (the_unique_pm(&mons[mnum]))
1546                 which = 2;
1547             else if (type_is_pname(&mons[mnum]))
1548                 which = 1;
1549         }
1550         if (which == 0)
1551             what = makeplural(what);
1552         else if (which == 2)
1553             what = the(what);
1554
1555 /*JP
1556         pline("It smells like %s.", what);
1557 */
1558         pline("%s\82Ì\82æ\82¤\82È\93õ\82¢\82ª\82µ\82½\81D", what);
1559 /*JP
1560         if (yn("Eat it?") == 'n') {
1561 */
1562         if (yn("\90H\82×\82Ü\82·\82©\81H") == 'n') {
1563             if (flags.verbose)
1564 /*JP
1565                 You("discard the open tin.");
1566 */
1567                 You("\8aJ\82¯\82½\8aÊ\82ð\8eÌ\82Ä\82½\81D");
1568             if (!Hallucination)
1569                 tin->dknown = tin->known = 1;
1570             costly_tin(COST_OPEN);
1571             goto use_up_tin;
1572         }
1573
1574         /* in case stop_occupation() was called on previous meal */
1575         context.victual.piece = (struct obj *) 0;
1576         context.victual.o_id = 0;
1577         context.victual.fullwarn = context.victual.eating =
1578             context.victual.doreset = FALSE;
1579
1580 #if 0 /*JP*/
1581         You("consume %s %s.", tintxts[r].txt, mons[mnum].mname);
1582 #else /*JP: \81u\82Ì\81v\82Å\8en\82Ü\82é\82È\82ç\8cã\92u\81A\82»\82ê\88È\8aO\82È\82ç\91O\92u */
1583         if (strstr(tintxts[r].txt, "\82Ì") == tintxts[r].txt) {
1584             You("%s%s\82Ì\8aÊ\8bl\82ð\82½\82¢\82ç\82°\82½\81D", mons[mnum].mname, tintxts[r].txt);
1585         } else {
1586             You("%s%s\82Ì\8aÊ\8bl\82ð\82½\82¢\82ç\82°\82½\81D", tintxts[r].txt, mons[mnum].mname);
1587         }
1588 #endif
1589
1590         eating_conducts(&mons[mnum]);
1591
1592         tin->dknown = tin->known = 1;
1593         cprefx(mnum);
1594         cpostfx(mnum);
1595
1596         /* charge for one at pre-eating cost */
1597         costly_tin(COST_OPEN);
1598
1599         if (tintxts[r].nut < 0) /* rotten */
1600             make_vomiting((long) rn1(15, 10), FALSE);
1601         else
1602             lesshungry(tintxts[r].nut);
1603
1604         if (tintxts[r].greasy) {
1605             /* Assume !Glib, because you can't open tins when Glib. */
1606             incr_itimeout(&Glib, rnd(15));
1607 #if 0 /*JP*/
1608             pline("Eating %s food made your %s very slippery.",
1609                   tintxts[r].txt, makeplural(body_part(FINGER)));
1610 #else
1611             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",
1612                   body_part(FINGER));
1613 #endif
1614         }
1615
1616     } else { /* spinach... */
1617         if (tin->cursed) {
1618 #if 0 /*JP*/
1619             pline("It contains some decaying%s%s substance.",
1620                   Blind ? "" : " ", Blind ? "" : hcolor(NH_GREEN));
1621 #else
1622             pline("%s\95\85\82Á\82½\95¨\91Ì\82ª\93ü\82Á\82Ä\82¢\82é\81D",
1623                   Blind ? "" : hcolor(NH_GREEN));
1624 #endif
1625         } else {
1626 /*JP
1627             pline("It contains spinach.");
1628 */
1629             pline("\83z\83E\83\8c\83\93\91\90\82ª\93ü\82Á\82Ä\82¢\82é\81D");
1630             tin->dknown = tin->known = 1;
1631         }
1632
1633 /*JP
1634         if (yn("Eat it?") == 'n') {
1635 */
1636         if (yn("\90H\82×\82Ü\82·\82©\81H") == 'n') {
1637             if (flags.verbose)
1638 /*JP
1639                 You("discard the open tin.");
1640 */
1641                 You("\8aJ\82¯\82½\8aÊ\82ð\8eÌ\82Ä\82½\81D");
1642             costly_tin(COST_OPEN);
1643             goto use_up_tin;
1644         }
1645
1646         /*
1647          * Same order as with non-spinach above:
1648          * conduct update, side-effects, shop handling, and nutrition.
1649          */
1650         u.uconduct
1651             .food++; /* don't need vegan/vegetarian checks for spinach */
1652         if (!tin->cursed)
1653 #if 0 /*JP:T*/
1654             pline("This makes you feel like %s!",
1655                   Hallucination ? "Swee'pea" : "Popeye");
1656 #else
1657             pline("%s\82Ì\82æ\82¤\82È\8bC\95ª\82É\82È\82Á\82½\81I",
1658                   Hallucination ? "\83X\83C\81[\83s\81[" : "\83|\83p\83C");
1659 #endif
1660         gainstr(tin, 0, FALSE);
1661
1662         costly_tin(COST_OPEN);
1663
1664         lesshungry(tin->blessed
1665                       ? 600                   /* blessed */
1666                       : !tin->cursed
1667                          ? (400 + rnd(200))   /* uncursed */
1668                          : (200 + rnd(400))); /* cursed */
1669     }
1670
1671 use_up_tin:
1672     if (carried(tin))
1673         useup(tin);
1674     else
1675         useupf(tin, 1L);
1676     context.tin.tin = (struct obj *) 0;
1677     context.tin.o_id = 0;
1678 }
1679
1680 /* called during each move whilst opening a tin */
1681 STATIC_PTR int
1682 opentin(VOID_ARGS)
1683 {
1684     /* perhaps it was stolen (although that should cause interruption) */
1685     if (!carried(context.tin.tin)
1686         && (!obj_here(context.tin.tin, u.ux, u.uy) || !can_reach_floor(TRUE)))
1687         return 0; /* %% probably we should use tinoid */
1688     if (context.tin.usedtime++ >= 50) {
1689 /*JP
1690         You("give up your attempt to open the tin.");
1691 */
1692         You("\8aÊ\82ð\8aJ\82¯\82é\82Ì\82ð\82 \82«\82ç\82ß\82½\81D");
1693         return 0;
1694     }
1695     if (context.tin.usedtime < context.tin.reqtime)
1696         return 1; /* still busy */
1697
1698 /*JP
1699     consume_tin("You succeed in opening the tin.");
1700 */
1701     consume_tin("\8aÊ\82ð\8aJ\82¯\82é\82Ì\82É\90¬\8c÷\82µ\82½\81D");
1702     return 0;
1703 }
1704
1705 /* called when starting to open a tin */
1706 STATIC_OVL void
1707 start_tin(otmp)
1708 struct obj *otmp;
1709 {
1710     const char *mesg = 0;
1711     register int tmp;
1712
1713     if (metallivorous(youmonst.data)) {
1714 /*JP
1715         mesg = "You bite right into the metal tin...";
1716 */
1717         mesg = "\8bà\91®\82Ì\8aÊ\82ð\8a\9a\82Ý\82Í\82\82ß\82½\81D\81D\81D";
1718         tmp = 0;
1719     } else if (cantwield(youmonst.data)) { /* nohands || verysmall */
1720 /*JP
1721         You("cannot handle the tin properly to open it.");
1722 */
1723         You("\8aÊ\82ð\82¤\82Ü\82­\8aJ\82¯\82ç\82ê\82È\82¢\81D");
1724         return;
1725     } else if (otmp->blessed) {
1726         /* 50/50 chance for immediate access vs 1 turn delay (unless
1727            wielding blessed tin opener which always yields immediate
1728            access); 1 turn delay case is non-deterministic:  getting
1729            interrupted and retrying might yield another 1 turn delay
1730            or might open immediately on 2nd (or 3rd, 4th, ...) try */
1731         tmp = (uwep && uwep->blessed && uwep->otyp == TIN_OPENER) ? 0 : rn2(2);
1732         if (!tmp)
1733 /*JP
1734             mesg = "The tin opens like magic!";
1735 */
1736             mesg = "\8aÊ\82Í\96\82\96@\82Ì\82æ\82¤\82É\8aJ\82¢\82½\81I";
1737         else
1738 /*JP
1739             pline_The("tin seems easy to open.");
1740 */
1741             pline_The("\8aÊ\82Í\8aÈ\92P\82É\8aJ\82¯\82ç\82ê\82»\82¤\82¾\81D");
1742     } else if (uwep) {
1743         switch (uwep->otyp) {
1744         case TIN_OPENER:
1745 #if 0 /*JP*/
1746             mesg = "You easily open the tin."; /* iff tmp==0 */
1747 #else
1748             mesg = "\82 \82È\82½\82Í\8aÈ\92P\82É\8aÊ\82ð\8aJ\82¯\82½\81D"; /* iff tmp==0 */
1749 #endif
1750             tmp = rn2(uwep->cursed ? 3 : !uwep->blessed ? 2 : 1);
1751             break;
1752         case DAGGER:
1753         case SILVER_DAGGER:
1754         case ELVEN_DAGGER:
1755         case ORCISH_DAGGER:
1756         case ATHAME:
1757         case CRYSKNIFE:
1758             tmp = 3;
1759             break;
1760         case PICK_AXE:
1761         case AXE:
1762             tmp = 6;
1763             break;
1764         default:
1765             goto no_opener;
1766         }
1767 /*JP
1768         pline("Using %s you try to open the tin.", yobjnam(uwep, (char *) 0));
1769 */
1770         You("%s\82ð\8eg\82Á\82Ä\8aÊ\82ð\8aJ\82¯\82æ\82¤\82Æ\82µ\82½\81D", xname(uwep));
1771     } else {
1772     no_opener:
1773 /*JP
1774         pline("It is not so easy to open this tin.");
1775 */
1776         pline("\82±\82Ì\8aÊ\82ð\8aJ\82¯\82é\82Ì\82Í\97e\88Õ\82È\82±\82Æ\82Å\82Í\82È\82¢\81D");
1777         if (Glib) {
1778 /*JP
1779             pline_The("tin slips from your %s.",
1780 */
1781             pline("\8aÊ\82Í\82 \82È\82½\82Ì%s\82©\82ç\8a\8a\82è\97\8e\82¿\82½\81D",
1782                       makeplural(body_part(FINGER)));
1783             if (otmp->quan > 1L) {
1784                 otmp = splitobj(otmp, 1L);
1785             }
1786             if (carried(otmp))
1787                 dropx(otmp);
1788             else
1789                 stackobj(otmp);
1790             return;
1791         }
1792         tmp = rn1(1 + 500 / ((int) (ACURR(A_DEX) + ACURRSTR)), 10);
1793     }
1794
1795     context.tin.tin = otmp;
1796     context.tin.o_id = otmp->o_id;
1797     if (!tmp) {
1798         consume_tin(mesg); /* begin immediately */
1799     } else {
1800         context.tin.reqtime = tmp;
1801         context.tin.usedtime = 0;
1802 /*JP
1803         set_occupation(opentin, "opening the tin", 0);
1804 */
1805         set_occupation(opentin, "\8aÊ\82ð\8aJ\82¯\82é", 0);
1806     }
1807     return;
1808 }
1809
1810 /* called when waking up after fainting */
1811 int
1812 Hear_again(VOID_ARGS)
1813 {
1814     /* Chance of deafness going away while fainted/sleeping/etc. */
1815     if (!rn2(2))
1816         make_deaf(0L, FALSE);
1817     return 0;
1818 }
1819
1820 /* called on the "first bite" of rotten food */
1821 STATIC_OVL int
1822 rottenfood(obj)
1823 struct obj *obj;
1824 {
1825 /*JP
1826     pline("Blecch!  Rotten %s!", foodword(obj));
1827 */
1828     pline("\83Q\83F\81I\95\85\82Á\82½%s\82¾\81I", foodword(obj));
1829     if (!rn2(4)) {
1830         if (Hallucination)
1831 /*JP
1832             You_feel("rather trippy.");
1833 */
1834             You("\82Ö\82ë\82Ö\82ë\82µ\82½\81D");
1835         else
1836 /*JP
1837             You_feel("rather %s.", body_part(LIGHT_HEADED));
1838 */
1839             You("%s\81D", body_part(LIGHT_HEADED));
1840         make_confused(HConfusion + d(2, 4), FALSE);
1841     } else if (!rn2(4) && !Blind) {
1842 /*JP
1843         pline("Everything suddenly goes dark.");
1844 */
1845         pline("\93Ë\91R\91S\82Ä\82ª\88Ã\82­\82È\82Á\82½\81D");
1846         make_blinded((long) d(2, 10), FALSE);
1847         if (!Blind)
1848             Your1(vision_clears);
1849     } else if (!rn2(3)) {
1850         const char *what, *where;
1851         int duration = rnd(10);
1852
1853         if (!Blind)
1854 /*JP
1855             what = "goes", where = "dark";
1856 */
1857             what = "\82È\82Á\82½", where = "\88Ã\88Å\82É";
1858         else if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
1859 /*JP
1860             what = "you lose control of", where = "yourself";
1861 */
1862             what = "\90§\8cä\82Å\82«\82È\82­\82È\82Á\82½", where = "\8e©\95ª\82ð";
1863         else
1864 /*JP
1865             what = "you slap against the",
1866 */
1867             what = "\82É\82Ô\82Â\82©\82Á\82½",
1868 /*JP
1869             where = (u.usteed) ? "saddle" : surface(u.ux, u.uy);
1870 */
1871             where = (u.usteed) ? "\88Æ" : surface(u.ux, u.uy);
1872 /*JP
1873         pline_The("world spins and %s %s.", what, where);
1874 */
1875         pline("\90¢\8aE\82ª\89ñ\93]\82µ\81C%s%s\81D", where, what);
1876         incr_itimeout(&HDeaf, duration);
1877         nomul(-duration);
1878         multi_reason = "unconscious from rotten food";
1879 /*JP
1880         nomovemsg = "You are conscious again.";
1881 */
1882         nomovemsg = "\82 \82È\82½\82Í\82Ü\82½\90³\8bC\82Ã\82¢\82½\81D";
1883         afternmv = Hear_again;
1884         return 1;
1885     }
1886     return 0;
1887 }
1888
1889 /* called when a corpse is selected as food */
1890 STATIC_OVL int
1891 eatcorpse(otmp)
1892 struct obj *otmp;
1893 {
1894     int tp = 0, mnum = otmp->corpsenm;
1895     long rotted = 0L;
1896     int retcode = 0;
1897     boolean stoneable = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
1898                          && !poly_when_stoned(youmonst.data));
1899
1900     /* KMH, conduct */
1901     if (!vegan(&mons[mnum]))
1902         u.uconduct.unvegan++;
1903     if (!vegetarian(&mons[mnum]))
1904         violated_vegetarian();
1905
1906     if (!nonrotting_corpse(mnum)) {
1907         long age = peek_at_iced_corpse_age(otmp);
1908
1909         rotted = (monstermoves - age) / (10L + rn2(20));
1910         if (otmp->cursed)
1911             rotted += 2L;
1912         else if (otmp->blessed)
1913             rotted -= 2L;
1914     }
1915
1916     if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
1917         boolean cannibal = maybe_cannibal(mnum, FALSE);
1918
1919 #if 0 /*JP*/
1920         pline("Ulch - that %s was tainted%s!",
1921               mons[mnum].mlet == S_FUNGUS
1922                   ? "fungoid vegetation"
1923                   : !vegetarian(&mons[mnum]) ? "meat" : "protoplasm",
1924               cannibal ? ", you cannibal" : "");
1925 #else
1926         pline("\83I\83F\81I\82±\82Ì%s\82Í\95\85\82Á\82Ä\82¢\82é%s\81I", 
1927               mons[mnum].mlet == S_FUNGUS
1928                   ? "\8d×\8bÛ\82É\89\98\90õ\82³\82ê\82½\90A\95¨"
1929                   : !vegetarian(&mons[mnum]) ? "\93÷" : "\90\95¨",
1930               cannibal ? "\81D\82µ\82©\82à\8b¤\90H\82¢\82¾" : "");
1931 #endif
1932         if (Sick_resistance) {
1933 /*JP
1934             pline("It doesn't seem at all sickening, though...");
1935 */
1936             pline("\82µ\82©\82µ\81C\82¢\82½\82Á\82Ä\8c³\8bC\82¾\81D\81D\81D");
1937         } else {
1938             long sick_time;
1939
1940             sick_time = (long) rn1(10, 10);
1941             /* make sure new ill doesn't result in improvement */
1942             if (Sick && (sick_time > Sick))
1943                 sick_time = (Sick > 1L) ? Sick - 1L : 1L;
1944 #if 0 /*JP*/
1945             make_sick(sick_time, corpse_xname(otmp, "rotted", CXN_NORMAL),
1946                       TRUE, SICK_VOMITABLE);
1947 #else
1948             make_sick(sick_time, corpse_xname(otmp, "\95\85\82Á\82½", CXN_NORMAL),
1949                       TRUE, SICK_VOMITABLE);
1950 #endif
1951         }
1952         if (carried(otmp))
1953             useup(otmp);
1954         else
1955             useupf(otmp, 1L);
1956         return 2;
1957     } else if (acidic(&mons[mnum]) && !Acid_resistance) {
1958         tp++;
1959 #if 0 /*JP:T*/
1960         You("have a very bad case of stomach acid.");   /* not body_part() */
1961 #else
1962         pline("\88Ý\8e_\82Ì\92²\8eq\82ª\82Æ\82Ä\82à\88«\82¢\81D");
1963 #endif
1964 #if 0 /*JP*/
1965         losehp(rnd(15), "acidic corpse", KILLED_BY_AN); /* acid damage */
1966 #else
1967         losehp(rnd(15), "\8e_\82Ì\8e\80\91Ì\82Å", KILLED_BY_AN);
1968 #endif
1969     } else if (poisonous(&mons[mnum]) && rn2(5)) {
1970         tp++;
1971 /*JP
1972         pline("Ecch - that must have been poisonous!");
1973 */
1974         pline("\83E\83Q\83F\81[\81C\97L\93Å\82¾\82Á\82½\82É\82¿\82ª\82¢\82È\82¢\81I");  
1975         if (!Poison_resistance) {
1976             losestr(rnd(4));
1977 /*JP
1978             losehp(rnd(15), "poisonous corpse", KILLED_BY_AN);
1979 */
1980             losehp(rnd(15), "\93Å\82Ì\8e\80\91Ì\82Å", KILLED_BY_AN);
1981         } else
1982 /*JP
1983             You("seem unaffected by the poison.");
1984 */
1985             You("\93Å\82Ì\89e\8b¿\82ð\8eó\82¯\82È\82¢\82æ\82¤\82¾\81D");
1986         /* now any corpse left too long will make you mildly ill */
1987     } else if ((rotted > 5L || (rotted > 3L && rn2(5))) && !Sick_resistance) {
1988         tp++;
1989 /*JP
1990         You_feel("%ssick.", (Sick) ? "very " : "");
1991 */
1992         You("%s\8bC\95ª\82ª\88«\82¢\81D", (Sick) ? "\82Æ\82Ä\82à" : "");
1993 /*JP
1994         losehp(rnd(8), "cadaver", KILLED_BY_AN);
1995 */
1996         losehp(rnd(8), "\95\85\97\90\8e\80\91Ì\82Å", KILLED_BY_AN);
1997     }
1998
1999     /* delay is weight dependent */
2000     context.victual.reqtime = 3 + (mons[mnum].cwt >> 6);
2001
2002     if (!tp && !nonrotting_corpse(mnum) && (otmp->orotten || !rn2(7))) {
2003         if (rottenfood(otmp)) {
2004             otmp->orotten = TRUE;
2005             (void) touchfood(otmp);
2006             retcode = 1;
2007         }
2008
2009         if (!mons[otmp->corpsenm].cnutrit) {
2010             /* no nutrition: rots away, no message if you passed out */
2011             if (!retcode)
2012 /*JP
2013                 pline_The("corpse rots away completely.");
2014 */
2015                 pline("\8e\80\91Ì\82Í\8a®\91S\82É\95\85\82Á\82Ä\82µ\82Ü\82Á\82½\81D");
2016             if (carried(otmp))
2017                 useup(otmp);
2018             else
2019                 useupf(otmp, 1L);
2020             retcode = 2;
2021         }
2022
2023         if (!retcode)
2024             consume_oeaten(otmp, 2); /* oeaten >>= 2 */
2025     } else if ((mnum == PM_COCKATRICE || mnum == PM_CHICKATRICE)
2026                && (Stone_resistance || Hallucination)) {
2027 /*JP
2028         pline("This tastes just like chicken!");
2029 */
2030         pline("\82±\82ê\82Í\8c{\93÷\82Ì\96¡\82¾\81I");
2031     } else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) {
2032 /*JP
2033         You("peck the eyeball with delight.");
2034 */
2035         You("\96Ú\8bÊ\82ð\82Â\82ñ\82Â\82ñ\82Â\82Â\82¢\82½\81D");
2036     } else {
2037         /* [is this right?  omnivores end up always disliking the taste] */
2038         boolean yummy = vegan(&mons[mnum])
2039                            ? (!carnivorous(youmonst.data)
2040                               && herbivorous(youmonst.data))
2041                            : (carnivorous(youmonst.data)
2042                               && !herbivorous(youmonst.data));
2043
2044 #if 0 /*JP*/
2045         pline("%s%s %s!",
2046               type_is_pname(&mons[mnum])
2047                  ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
2048               food_xname(otmp, FALSE),
2049               Hallucination
2050                   ? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
2051                                                       : "is gnarly")
2052                            : "is grody")
2053                   : (yummy ? "is delicious" : "tastes terrible"));
2054 #else
2055         pline("\82±\82Ì%s\82Í%s\81I",
2056               food_xname(otmp, FALSE),
2057               Hallucination
2058                   ? (yummy ? ((u.umonnum == PM_TIGER) ? "\83O\83D\83\8c\83C\83g\83D"
2059                                                       : "\83C\83P\82Ä\82é")
2060                            : "\83C\83P\82Ä\82È\82¢")
2061                   : (yummy ? "\82Æ\82Ä\82à\8e|\82¢" : "\82Ð\82Ç\82¢\96¡\82¾"));
2062 #endif
2063     }
2064
2065     return retcode;
2066 }
2067
2068 /* called as you start to eat */
2069 STATIC_OVL void
2070 start_eating(otmp)
2071 struct obj *otmp;
2072 {
2073     const char *old_nomovemsg, *save_nomovemsg;
2074
2075     debugpline2("start_eating: %lx (victual = %lx)", (unsigned long) otmp,
2076                 (unsigned long) context.victual.piece);
2077     debugpline1("reqtime = %d", context.victual.reqtime);
2078     debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
2079     debugpline1("nmod = %d", context.victual.nmod);
2080     debugpline1("oeaten = %d", otmp->oeaten);
2081     context.victual.fullwarn = context.victual.doreset = FALSE;
2082     context.victual.eating = TRUE;
2083
2084     if (otmp->otyp == CORPSE || otmp->globby) {
2085         cprefx(context.victual.piece->corpsenm);
2086         if (!context.victual.piece || !context.victual.eating) {
2087             /* rider revived, or died and lifesaved */
2088             return;
2089         }
2090     }
2091
2092     old_nomovemsg = nomovemsg;
2093     if (bite()) {
2094         /* survived choking, finish off food that's nearly done;
2095            need this to handle cockatrice eggs, fortune cookies, etc */
2096         if (++context.victual.usedtime >= context.victual.reqtime) {
2097             /* don't want done_eating() to issue nomovemsg if it
2098                is due to vomit() called by bite() */
2099             save_nomovemsg = nomovemsg;
2100             if (!old_nomovemsg)
2101                 nomovemsg = 0;
2102             done_eating(FALSE);
2103             if (!old_nomovemsg)
2104                 nomovemsg = save_nomovemsg;
2105         }
2106         return;
2107     }
2108
2109     if (++context.victual.usedtime >= context.victual.reqtime) {
2110         /* print "finish eating" message if they just resumed -dlc */
2111         done_eating(context.victual.reqtime > 1 ? TRUE : FALSE);
2112         return;
2113     }
2114
2115 /*JP
2116     Sprintf(msgbuf, "eating %s", food_xname(otmp, TRUE));
2117 */
2118     Sprintf(msgbuf, "%s\82ð\90H\82×\82é", food_xname(otmp, TRUE));
2119     set_occupation(eatfood, msgbuf, 0);
2120 }
2121
2122 /*
2123  * called on "first bite" of (non-corpse) food.
2124  * used for non-rotten non-tin non-corpse food
2125  */
2126 STATIC_OVL void
2127 fprefx(otmp)
2128 struct obj *otmp;
2129 {
2130     switch (otmp->otyp) {
2131     case FOOD_RATION:
2132         if (u.uhunger <= 200)
2133 /*JP
2134             pline(Hallucination ? "Oh wow, like, superior, man!"
2135 */
2136             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"
2137 /*JP
2138                                 : "That food really hit the spot!");
2139 */
2140                                 : "\82±\82Ì\90H\82×\95¨\82Í\96{\93\96\82É\90\\82µ\95ª\82È\82¢\81I");
2141         else if (u.uhunger <= 700)
2142 /*JP
2143             pline("That satiated your %s!", body_part(STOMACH));
2144 */
2145             pline("\96\9e\95 \82É\82È\82Á\82½\81I");
2146         break;
2147     case TRIPE_RATION:
2148         if (carnivorous(youmonst.data) && !humanoid(youmonst.data))
2149 /*JP
2150             pline("That tripe ration was surprisingly good!");
2151 */
2152             pline("\82±\82Ì\83\82\83c\93÷\82Í\82¨\82Ç\82ë\82­\82Ù\82Ç\8e|\82¢\81I");
2153         else if (maybe_polyd(is_orc(youmonst.data), Race_if(PM_ORC)))
2154 /*JP
2155             pline(Hallucination ? "Tastes great! Less filling!"
2156 */
2157             pline(Hallucination ? "\82¤\82Ü\82¢\81I\82à\82Á\82Æ\82Ù\82µ\82­\82È\82é\82Ë\81I"
2158 /*JP
2159                                 : "Mmm, tripe... not bad!");
2160 */
2161                                 : "\82ñ\81[\81C\83\82\83c\82©\81D\81D\81D\88«\82­\82È\82¢\81I");
2162         else {
2163 /*JP
2164             pline("Yak - dog food!");
2165 */
2166             pline("\82¤\82°\81C\83h\83b\83O\83t\81[\83h\82¾\81I");
2167             more_experienced(1, 0);
2168             newexplevel();
2169             /* not cannibalism, but we use similar criteria
2170                for deciding whether to be sickened by this meal */
2171             if (rn2(2) && !CANNIBAL_ALLOWED())
2172                 make_vomiting((long) rn1(context.victual.reqtime, 14), FALSE);
2173         }
2174         break;
2175     case MEATBALL:
2176     case MEAT_STICK:
2177     case HUGE_CHUNK_OF_MEAT:
2178     case MEAT_RING:
2179         goto give_feedback;
2180     case CLOVE_OF_GARLIC:
2181         if (is_undead(youmonst.data)) {
2182             make_vomiting((long) rn1(context.victual.reqtime, 5), FALSE);
2183             break;
2184         }
2185         /* else FALLTHRU */
2186     default:
2187         if (otmp->otyp == SLIME_MOLD && !otmp->cursed
2188             && otmp->spe == context.current_fruit) {
2189 #if 0 /*JP*/
2190             pline("My, that was a %s %s!",
2191                   Hallucination ? "primo" : "yummy",
2192                   singular(otmp, xname));
2193 #else
2194             pline("\82¨\82â\81C\82È\82ñ\82Ä%s%s\82¾\81I",
2195                   Hallucination ? "\8fã\95i\82È" : "\82¨\82¢\82µ\82¢",
2196                   singular(otmp, xname));
2197 #endif
2198         } else if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2199             ; /* skip core joke; feedback deferred til fpostfx() */
2200
2201 #if defined(MAC) || defined(MACOSX)
2202         /* KMH -- Why should Unix have all the fun?
2203            We check MACOSX before UNIX to get the Apple-specific apple
2204            message; the '#if UNIX' code will still kick in for pear. */
2205         } else if (otmp->otyp == APPLE) {
2206 /*JP
2207             pline("Delicious!  Must be a Macintosh!");
2208 */
2209             pline("\82·\82Î\82ç\82µ\82¢\81I\83}\83b\83L\83\93\83g\83b\83V\83\85\82É\88á\82¢\82È\82¢\81I");
2210 #endif
2211
2212 #ifdef UNIX
2213         } else if (otmp->otyp == APPLE || otmp->otyp == PEAR) {
2214             if (!Hallucination) {
2215                 pline("Core dumped.");
2216             } else {
2217                 /* This is based on an old Usenet joke, a fake a.out manual
2218                  * page
2219                  */
2220                 int x = rnd(100);
2221
2222                 pline("%s -- core dumped.",
2223                       (x <= 75)
2224                          ? "Segmentation fault"
2225                          : (x <= 99)
2226                             ? "Bus error"
2227                             : "Yo' mama");
2228             }
2229 #endif
2230         } else if (otmp->otyp == EGG && stale_egg(otmp)) {
2231 #if 0 /*JP*/
2232             pline("Ugh.  Rotten egg."); /* perhaps others like it */
2233 #else
2234             pline("\83E\83Q\83F\81[\95\85\82Á\82½\97\91\82¾\81D");
2235 #endif
2236             make_vomiting((Vomiting & TIMEOUT) + (long) d(10, 4), TRUE);
2237         } else {
2238         give_feedback:
2239 #if 0 /*JP*/
2240             pline("This %s is %s", singular(otmp, xname),
2241                   otmp->cursed
2242                      ? (Hallucination ? "grody!" : "terrible!")
2243                      : (otmp->otyp == CRAM_RATION
2244                         || otmp->otyp == K_RATION
2245                         || otmp->otyp == C_RATION)
2246                         ? "bland."
2247                         : Hallucination ? "gnarly!" : "delicious!");
2248 #else
2249             pline("\82±\82Ì%s\82Í%s", singular(otmp, xname),
2250                   otmp->cursed
2251                     ? (Hallucination ? "\83C\83P\82Ä\82È\82¢\81I" : "\82Ð\82Ç\82¢\96¡\82¾\81I")
2252                     : (otmp->otyp == CRAM_RATION
2253                         || otmp->otyp == K_RATION
2254                         || otmp->otyp == C_RATION)
2255                         ? "\96¡\8bC\82È\82¢\81D"
2256                         : Hallucination ? "\83C\83P\82Ä\82é\81I" : "\82¤\82Ü\82¢\81I");
2257 #endif
2258         }
2259         break; /* default */
2260     } /* switch */
2261 }
2262
2263 /* increment a combat intrinsic with limits on its growth */
2264 STATIC_OVL int
2265 bounded_increase(old, inc, typ)
2266 int old, inc, typ;
2267 {
2268     int absold, absinc, sgnold, sgninc;
2269
2270     /* don't include any amount coming from worn rings */
2271     if (uright && uright->otyp == typ)
2272         old -= uright->spe;
2273     if (uleft && uleft->otyp == typ)
2274         old -= uleft->spe;
2275     absold = abs(old), absinc = abs(inc);
2276     sgnold = sgn(old), sgninc = sgn(inc);
2277
2278     if (absinc == 0 || sgnold != sgninc || absold + absinc < 10) {
2279         ; /* use inc as-is */
2280     } else if (absold + absinc < 20) {
2281         absinc = rnd(absinc); /* 1..n */
2282         if (absold + absinc < 10)
2283             absinc = 10 - absold;
2284         inc = sgninc * absinc;
2285     } else if (absold + absinc < 40) {
2286         absinc = rn2(absinc) ? 1 : 0;
2287         if (absold + absinc < 20)
2288             absinc = rnd(20 - absold);
2289         inc = sgninc * absinc;
2290     } else {
2291         inc = 0; /* no further increase allowed via this method */
2292     }
2293     return old + inc;
2294 }
2295
2296 STATIC_OVL void
2297 accessory_has_effect(otmp)
2298 struct obj *otmp;
2299 {
2300 #if 0 /*JP*/
2301     pline("Magic spreads through your body as you digest the %s.",
2302           otmp->oclass == RING_CLASS ? "ring" : "amulet");
2303 #else
2304     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",
2305           otmp->oclass == RING_CLASS ? "\8ew\97Ö" : "\96\82\8f\9c\82¯");
2306 #endif
2307 }
2308
2309 STATIC_OVL void
2310 eataccessory(otmp)
2311 struct obj *otmp;
2312 {
2313     int typ = otmp->otyp;
2314     long oldprop;
2315
2316     /* Note: rings are not so common that this is unbalancing. */
2317     /* (How often do you even _find_ 3 rings of polymorph in a game?) */
2318     oldprop = u.uprops[objects[typ].oc_oprop].intrinsic;
2319     if (otmp == uleft || otmp == uright) {
2320         Ring_gone(otmp);
2321         if (u.uhp <= 0)
2322             return; /* died from sink fall */
2323     }
2324     otmp->known = otmp->dknown = 1; /* by taste */
2325     if (!rn2(otmp->oclass == RING_CLASS ? 3 : 5)) {
2326         switch (otmp->otyp) {
2327         default:
2328             if (!objects[typ].oc_oprop)
2329                 break; /* should never happen */
2330
2331             if (!(u.uprops[objects[typ].oc_oprop].intrinsic & FROMOUTSIDE))
2332                 accessory_has_effect(otmp);
2333
2334             u.uprops[objects[typ].oc_oprop].intrinsic |= FROMOUTSIDE;
2335
2336             switch (typ) {
2337             case RIN_SEE_INVISIBLE:
2338                 set_mimic_blocking();
2339                 see_monsters();
2340                 if (Invis && !oldprop && !ESee_invisible
2341                     && !perceives(youmonst.data) && !Blind) {
2342                     newsym(u.ux, u.uy);
2343 /*JP
2344                     pline("Suddenly you can see yourself.");
2345 */
2346                     pline("\93Ë\91R\8e©\95ª\8e©\90g\82ª\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81D");
2347                     makeknown(typ);
2348                 }
2349                 break;
2350             case RIN_INVISIBILITY:
2351                 if (!oldprop && !EInvis && !BInvis && !See_invisible
2352                     && !Blind) {
2353                     newsym(u.ux, u.uy);
2354 #if 0 /*JP*/
2355                     Your("body takes on a %s transparency...",
2356                          Hallucination ? "normal" : "strange");
2357 #else
2358                     pline("%s\82 \82È\82½\82Ì\91Ì\82Í\93§\89ß\90«\82ð\82à\82Á\82½\81D\81D\81D",
2359                           Hallucination ? "\82 \82½\82è\82Ü\82¦\82È\82±\82Æ\82¾\82ª" : "\8aï\96­\82È\82±\82Æ\82É");
2360 #endif
2361                     makeknown(typ);
2362                 }
2363                 break;
2364             case RIN_PROTECTION_FROM_SHAPE_CHAN:
2365                 rescham();
2366                 break;
2367             case RIN_LEVITATION:
2368                 /* undo the `.intrinsic |= FROMOUTSIDE' done above */
2369                 u.uprops[LEVITATION].intrinsic = oldprop;
2370                 if (!Levitation) {
2371                     float_up();
2372                     incr_itimeout(&HLevitation, d(10, 20));
2373                     makeknown(typ);
2374                 }
2375                 break;
2376             } /* inner switch */
2377             break; /* default case of outer switch */
2378
2379         case RIN_ADORNMENT:
2380             accessory_has_effect(otmp);
2381             if (adjattrib(A_CHA, otmp->spe, -1))
2382                 makeknown(typ);
2383             break;
2384         case RIN_GAIN_STRENGTH:
2385             accessory_has_effect(otmp);
2386             if (adjattrib(A_STR, otmp->spe, -1))
2387                 makeknown(typ);
2388             break;
2389         case RIN_GAIN_CONSTITUTION:
2390             accessory_has_effect(otmp);
2391             if (adjattrib(A_CON, otmp->spe, -1))
2392                 makeknown(typ);
2393             break;
2394         case RIN_INCREASE_ACCURACY:
2395             accessory_has_effect(otmp);
2396             u.uhitinc = (schar) bounded_increase((int) u.uhitinc, otmp->spe,
2397                                                  RIN_INCREASE_ACCURACY);
2398             break;
2399         case RIN_INCREASE_DAMAGE:
2400             accessory_has_effect(otmp);
2401             u.udaminc = (schar) bounded_increase((int) u.udaminc, otmp->spe,
2402                                                  RIN_INCREASE_DAMAGE);
2403             break;
2404         case RIN_PROTECTION:
2405             accessory_has_effect(otmp);
2406             HProtection |= FROMOUTSIDE;
2407             u.ublessed = bounded_increase(u.ublessed, otmp->spe,
2408                                           RIN_PROTECTION);
2409             context.botl = 1;
2410             break;
2411         case RIN_FREE_ACTION:
2412             /* Give sleep resistance instead */
2413             if (!(HSleep_resistance & FROMOUTSIDE))
2414                 accessory_has_effect(otmp);
2415             if (!Sleep_resistance)
2416 /*JP
2417                 You_feel("wide awake.");
2418 */
2419                 You("\82Ï\82Á\82¿\82è\96Ú\82ª\82³\82ß\82½\81D");
2420             HSleep_resistance |= FROMOUTSIDE;
2421             break;
2422         case AMULET_OF_CHANGE:
2423             accessory_has_effect(otmp);
2424             makeknown(typ);
2425             change_sex();
2426 #if 0 /*JP*/
2427             You("are suddenly very %s!",
2428                 flags.female ? "feminine" : "masculine");
2429 #else
2430             You("\93Ë\91R\82Æ\82Ä\82à%s\82Á\82Û\82­\82È\82Á\82½\81I", 
2431                 flags.female ? "\8f\97" : "\92j");
2432 #endif
2433             context.botl = 1;
2434             break;
2435         case AMULET_OF_UNCHANGING:
2436             /* un-change: it's a pun */
2437             if (!Unchanging && Upolyd) {
2438                 accessory_has_effect(otmp);
2439                 makeknown(typ);
2440                 rehumanize();
2441             }
2442             break;
2443         case AMULET_OF_STRANGULATION: /* bad idea! */
2444             /* no message--this gives no permanent effect */
2445             choke(otmp);
2446             break;
2447         case AMULET_OF_RESTFUL_SLEEP: { /* another bad idea! */
2448             long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
2449
2450             if (!(HSleepy & FROMOUTSIDE))
2451                 accessory_has_effect(otmp);
2452             HSleepy |= FROMOUTSIDE;
2453             /* might also be wearing one; use shorter of two timeouts */
2454             if (newnap < oldnap || oldnap == 0L)
2455                 HSleepy = (HSleepy & ~TIMEOUT) | newnap;
2456             break;
2457         }
2458         case RIN_SUSTAIN_ABILITY:
2459         case AMULET_OF_LIFE_SAVING:
2460         case AMULET_OF_REFLECTION: /* nice try */
2461             /* can't eat Amulet of Yendor or fakes,
2462              * and no oc_prop even if you could -3.
2463              */
2464             break;
2465         }
2466     }
2467 }
2468
2469 /* called after eating non-food */
2470 STATIC_OVL void
2471 eatspecial()
2472 {
2473     struct obj *otmp = context.victual.piece;
2474
2475     /* lesshungry wants an occupation to handle choke messages correctly */
2476 /*JP
2477     set_occupation(eatfood, "eating non-food", 0);
2478 */
2479     set_occupation(eatfood, "\90H\82×\82é", 0);
2480     lesshungry(context.victual.nmod);
2481     occupation = 0;
2482     context.victual.piece = (struct obj *) 0;
2483     context.victual.o_id = 0;
2484     context.victual.eating = 0;
2485     if (otmp->oclass == COIN_CLASS) {
2486         if (carried(otmp))
2487             useupall(otmp);
2488         else
2489             useupf(otmp, otmp->quan);
2490         vault_gd_watching(GD_EATGOLD);
2491         return;
2492     }
2493 #ifdef MAIL
2494     if (otmp->otyp == SCR_MAIL) {
2495         /* no nutrition */
2496         pline("This junk mail is less than satisfying.");
2497     }
2498 #endif
2499     if (otmp->oclass == POTION_CLASS) {
2500         otmp->quan++; /* dopotion() does a useup() */
2501         (void) dopotion(otmp);
2502     } else if (otmp->oclass == RING_CLASS || otmp->oclass == AMULET_CLASS) {
2503         eataccessory(otmp);
2504     } else if (otmp->otyp == LEASH && otmp->leashmon) {
2505         o_unleash(otmp);
2506     }
2507
2508     /* KMH -- idea by "Tommy the Terrorist" */
2509     if (otmp->otyp == TRIDENT && !otmp->cursed) {
2510         /* sugarless chewing gum which used to be heavily advertised on TV */
2511 #if 0 /*JP*/
2512         pline(Hallucination ? "Four out of five dentists agree."
2513                             : "That was pure chewing satisfaction!");
2514 #else
2515         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"
2516                             : "\8f\83\90\88\82É\8a\9a\82Ý\82½\82¢\8bC\8e\9d\82ð\96\9e\82½\82µ\82½\81I");
2517 #endif
2518         exercise(A_WIS, TRUE);
2519     }
2520     if (otmp->otyp == FLINT && !otmp->cursed) {
2521         /* chewable vitamin for kids based on "The Flintstones" TV cartoon */
2522 /*JP
2523         pline("Yabba-dabba delicious!");
2524 */
2525         pline("\83\84\83b\83o\83_\83b\83o\82¤\82Ü\82¢\81I");
2526         exercise(A_CON, TRUE);
2527     }
2528
2529     if (otmp == uwep && otmp->quan == 1L)
2530         uwepgone();
2531     if (otmp == uquiver && otmp->quan == 1L)
2532         uqwepgone();
2533     if (otmp == uswapwep && otmp->quan == 1L)
2534         uswapwepgone();
2535
2536     if (otmp == uball)
2537         unpunish();
2538     if (otmp == uchain)
2539         unpunish(); /* but no useup() */
2540     else if (carried(otmp))
2541         useup(otmp);
2542     else
2543         useupf(otmp, 1L);
2544 }
2545
2546 /* NOTE: the order of these words exactly corresponds to the
2547    order of oc_material values #define'd in objclass.h. */
2548 static const char *foodwords[] = {
2549 #if 0 /*JP*/
2550     "meal",    "liquid",  "wax",       "food", "meat",     "paper",
2551     "cloth",   "leather", "wood",      "bone", "scale",    "metal",
2552     "metal",   "metal",   "silver",    "gold", "platinum", "mithril",
2553     "plastic", "glass",   "rich food", "stone"
2554 #else
2555     "\93÷",           "\89t\91Ì",   "\96û",       "\90H\97¿", "\93÷",       "\8e\86",
2556     "\95\9e",           "\94ç",     "\96Ø",       "\8d\9c",   "\97Ø",       "\8bà\91®",
2557     "\8bà\91®",         "\8bà\91®",   "\8bâ",       "\8bà",   "\83v\83\89\83`\83i", "\83~\83X\83\8a\83\8b",
2558     "\83v\83\89\83X\83`\83b\83N", "\83K\83\89\83X", "\8d\82\8b\89\97¿\97\9d", "\90Î"
2559 #endif
2560 };
2561
2562 STATIC_OVL const char *
2563 foodword(otmp)
2564 struct obj *otmp;
2565 {
2566     if (otmp->oclass == FOOD_CLASS)
2567 /*JP
2568         return "food";
2569 */
2570         return "\90H\97¿";
2571     if (otmp->oclass == GEM_CLASS && objects[otmp->otyp].oc_material == GLASS
2572         && otmp->dknown)
2573         makeknown(otmp->otyp);
2574     return foodwords[objects[otmp->otyp].oc_material];
2575 }
2576
2577 /* called after consuming (non-corpse) food */
2578 STATIC_OVL void
2579 fpostfx(otmp)
2580 struct obj *otmp;
2581 {
2582     switch (otmp->otyp) {
2583     case SPRIG_OF_WOLFSBANE:
2584         if (u.ulycn >= LOW_PM || is_were(youmonst.data))
2585             you_unwere(TRUE);
2586         break;
2587     case CARROT:
2588         if (!u.uswallow
2589             || !attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND))
2590             make_blinded((long) u.ucreamed, TRUE);
2591         break;
2592     case FORTUNE_COOKIE:
2593         outrumor(bcsign(otmp), BY_COOKIE);
2594         if (!Blind)
2595             u.uconduct.literate++;
2596         break;
2597     case LUMP_OF_ROYAL_JELLY:
2598         /* This stuff seems to be VERY healthy! */
2599         gainstr(otmp, 1, TRUE);
2600         if (Upolyd) {
2601             u.mh += otmp->cursed ? -rnd(20) : rnd(20);
2602             if (u.mh > u.mhmax) {
2603                 if (!rn2(17))
2604                     u.mhmax++;
2605                 u.mh = u.mhmax;
2606             } else if (u.mh <= 0) {
2607                 rehumanize();
2608             }
2609         } else {
2610             u.uhp += otmp->cursed ? -rnd(20) : rnd(20);
2611             if (u.uhp > u.uhpmax) {
2612                 if (!rn2(17))
2613                     u.uhpmax++;
2614                 u.uhp = u.uhpmax;
2615             } else if (u.uhp <= 0) {
2616                 killer.format = KILLED_BY_AN;
2617 #if 0 /*JP*/
2618                 Strcpy(killer.name, "rotten lump of royal jelly");
2619                 done(POISONING);
2620 #else
2621                 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Å");
2622                 done(DIED);
2623 #endif
2624             }
2625         }
2626         if (!otmp->cursed)
2627             heal_legs();
2628         break;
2629     case EGG:
2630         if (flesh_petrifies(&mons[otmp->corpsenm])) {
2631             if (!Stone_resistance
2632                 && !(poly_when_stoned(youmonst.data)
2633                      && polymon(PM_STONE_GOLEM))) {
2634                 if (!Stoned) {
2635 /*JP
2636                     Sprintf(killer.name, "%s egg",
2637 */
2638                     Sprintf(killer.name, "%s\82Ì\97\91\82Å",
2639                             mons[otmp->corpsenm].mname);
2640                     make_stoned(5L, (char *) 0, KILLED_BY_AN, killer.name);
2641                 }
2642             }
2643             /* note: no "tastes like chicken" message for eggs */
2644         }
2645         break;
2646     case EUCALYPTUS_LEAF:
2647         if (Sick && !otmp->cursed)
2648             make_sick(0L, (char *) 0, TRUE, SICK_ALL);
2649         if (Vomiting && !otmp->cursed)
2650             make_vomiting(0L, TRUE);
2651         break;
2652     case APPLE:
2653         if (otmp->cursed && !Sleep_resistance) {
2654             /* Snow White; 'poisoned' applies to [a subset of] weapons,
2655                not food, so we substitute cursed; fortunately our hero
2656                won't have to wait for a prince to be rescued/revived */
2657             if (Race_if(PM_DWARF) && Hallucination)
2658 /*JP
2659                 verbalize("Heigh-ho, ho-hum, I think I'll skip work today.");
2660 */
2661                 verbalize("\83n\83C\83z\81[\81C\83n\83C\83z\81[\81C\8d¡\93ú\82Í\8bx\82Ý\81D");
2662             else if (Deaf || !flags.acoustics)
2663 /*JP
2664                 You("fall asleep.");
2665 */
2666                 You("\96°\82è\82É\97\8e\82¿\82½\81D");
2667             else
2668 /*JP
2669                 You_hear("sinister laughter as you fall asleep...");
2670 */
2671                 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");
2672             fall_asleep(-rn1(11, 20), TRUE);
2673         }
2674         break;
2675     }
2676     return;
2677 }
2678
2679 #if 0
2680 /* intended for eating a spellbook while polymorphed, but not used;
2681    "leather" applied to appearance, not composition, and has been
2682    changed to "leathery" to reflect that */
2683 STATIC_DCL boolean FDECL(leather_cover, (struct obj *));
2684
2685 STATIC_OVL boolean
2686 leather_cover(otmp)
2687 struct obj *otmp;
2688 {
2689     const char *odesc = OBJ_DESCR(objects[otmp->otyp]);
2690
2691     if (odesc && (otmp->oclass == SPBOOK_CLASS)) {
2692         if (!strcmp(odesc, "leather"))
2693             return TRUE;
2694     }
2695     return FALSE;
2696 }
2697 #endif
2698
2699 /*
2700  * return 0 if the food was not dangerous.
2701  * return 1 if the food was dangerous and you chose to stop.
2702  * return 2 if the food was dangerous and you chose to eat it anyway.
2703  */
2704 STATIC_OVL int
2705 edibility_prompts(otmp)
2706 struct obj *otmp;
2707 {
2708     /* Blessed food detection grants hero a one-use
2709      * ability to detect food that is unfit for consumption
2710      * or dangerous and avoid it.
2711      */
2712     char buf[BUFSZ], foodsmell[BUFSZ],
2713          it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
2714     boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
2715     int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
2716     long rotted = 0L;
2717
2718 #if 0 /*JP*/
2719     Strcpy(foodsmell, Tobjnam(otmp, "smell"));
2720 #else
2721     Strcpy(foodsmell, xname(otmp));
2722 #endif
2723     Strcpy(it_or_they, (otmp->quan == 1L) ? "it" : "they");
2724 #if 0 /*JP*/
2725     Sprintf(eat_it_anyway, "Eat %s anyway?",
2726             (otmp->quan == 1L) ? "it" : "one");
2727 #else
2728     Strcpy(eat_it_anyway, "\82»\82ê\82Å\82à\90H\82×\82é\81H");
2729 #endif
2730
2731     if (cadaver || otmp->otyp == EGG || otmp->otyp == TIN) {
2732         /* These checks must match those in eatcorpse() */
2733         stoneorslime = (flesh_petrifies(&mons[mnum]) && !Stone_resistance
2734                         && !poly_when_stoned(youmonst.data));
2735
2736         if (mnum == PM_GREEN_SLIME || otmp->otyp == GLOB_OF_GREEN_SLIME)
2737             stoneorslime = (!Unchanging && !slimeproof(youmonst.data));
2738
2739         if (cadaver && !nonrotting_corpse(mnum)) {
2740             long age = peek_at_iced_corpse_age(otmp);
2741             /* worst case rather than random
2742                in this calculation to force prompt */
2743             rotted = (monstermoves - age) / (10L + 0 /* was rn2(20) */);
2744             if (otmp->cursed)
2745                 rotted += 2L;
2746             else if (otmp->blessed)
2747                 rotted -= 2L;
2748         }
2749     }
2750
2751     /*
2752      * These problems with food should be checked in
2753      * order from most detrimental to least detrimental.
2754      */
2755     if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
2756         /* Tainted meat */
2757 #if 0 /*JP*/
2758         Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2759                 eat_it_anyway);
2760 #else
2761         Sprintf(buf, "%s\82Í\89\98\90õ\82³\82ê\82Ä\82¢\82é\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
2762                 foodsmell, eat_it_anyway);
2763 #endif
2764         if (yn_function(buf, ynchars, 'n') == 'n')
2765             return 1;
2766         else
2767             return 2;
2768     }
2769     if (stoneorslime) {
2770 #if 0 /*JP*/
2771         Sprintf(buf, "%s like %s could be something very dangerous! %s",
2772                 foodsmell, it_or_they, eat_it_anyway);
2773 #else
2774         Sprintf(buf, "%s\82Í\82È\82ñ\82¾\82©\82·\82²\82­\8aë\8c¯\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
2775                 foodsmell, eat_it_anyway);
2776 #endif
2777         if (yn_function(buf, ynchars, 'n') == 'n')
2778             return 1;
2779         else
2780             return 2;
2781     }
2782     if (otmp->orotten || (cadaver && rotted > 3L)) {
2783         /* Rotten */
2784 #if 0 /*JP*/
2785         Sprintf(buf, "%s like %s could be rotten! %s", foodsmell, it_or_they,
2786                 eat_it_anyway);
2787 #else
2788         Sprintf(buf, "%s\82Í\95\85\82Á\82½\82æ\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
2789                 foodsmell, eat_it_anyway);
2790 #endif
2791         if (yn_function(buf, ynchars, 'n') == 'n')
2792             return 1;
2793         else
2794             return 2;
2795     }
2796     if (cadaver && poisonous(&mons[mnum]) && !Poison_resistance) {
2797         /* poisonous */
2798 #if 0 /*JP*/
2799         Sprintf(buf, "%s like %s might be poisonous! %s", foodsmell,
2800                 it_or_they, eat_it_anyway);
2801 #else
2802         Sprintf(buf, "%s\82Í\93Å\82ð\82à\82Á\82Ä\82¢\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
2803                 foodsmell, eat_it_anyway);
2804 #endif
2805         if (yn_function(buf, ynchars, 'n') == 'n')
2806             return 1;
2807         else
2808             return 2;
2809     }
2810     if (otmp->otyp == APPLE && otmp->cursed && !Sleep_resistance) {
2811         /* causes sleep, for long enough to be dangerous */
2812 #if 0 /*JP*/
2813         Sprintf(buf, "%s like %s might have been poisoned. %s", foodsmell,
2814                 it_or_they, eat_it_anyway);
2815 #else
2816         Sprintf(buf, "%s\82Í\93Å\82ª\93ü\82ê\82ç\82ê\82Ä\82¢\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81I%s",
2817                 foodsmell, eat_it_anyway);
2818 #endif
2819         return (yn_function(buf, ynchars, 'n') == 'n') ? 1 : 2;
2820     }
2821     if (cadaver && !vegetarian(&mons[mnum]) && !u.uconduct.unvegetarian
2822         && Role_if(PM_MONK)) {
2823 /*JP
2824         Sprintf(buf, "%s unhealthy. %s", foodsmell, eat_it_anyway);
2825 */
2826         Sprintf(buf, "%s\82Í\8c\92\8dN\82É\88«\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell, eat_it_anyway);
2827         if (yn_function(buf, ynchars, 'n') == 'n')
2828             return 1;
2829         else
2830             return 2;
2831     }
2832     if (cadaver && acidic(&mons[mnum]) && !Acid_resistance) {
2833 /*JP
2834         Sprintf(buf, "%s rather acidic. %s", foodsmell, eat_it_anyway);
2835 */
2836         Sprintf(buf, "%s\82Í\8f­\82µ\8e_\82Á\82Ï\82»\82¤\82È\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell, eat_it_anyway);
2837         if (yn_function(buf, ynchars, 'n') == 'n')
2838             return 1;
2839         else
2840             return 2;
2841     }
2842     if (Upolyd && u.umonnum == PM_RUST_MONSTER && is_metallic(otmp)
2843         && otmp->oerodeproof) {
2844 #if 0 /*JP*/
2845         Sprintf(buf, "%s disgusting to you right now. %s", foodsmell,
2846                 eat_it_anyway);
2847 #else
2848         Sprintf(buf, "%s\82Í\8bC\95ª\82ª\88«\82­\82È\82é\82É\82¨\82¢\82ª\82·\82é\81D%s", foodsmell,
2849                 eat_it_anyway);
2850 #endif
2851         if (yn_function(buf, ynchars, 'n') == 'n')
2852             return 1;
2853         else
2854             return 2;
2855     }
2856
2857     /*
2858      * Breaks conduct, but otherwise safe.
2859      */
2860     if (!u.uconduct.unvegan
2861         && ((material == LEATHER || material == BONE
2862              || material == DRAGON_HIDE || material == WAX)
2863             || (cadaver && !vegan(&mons[mnum])))) {
2864 #if 0 /*JP*/
2865         Sprintf(buf, "%s foul and unfamiliar to you. %s", foodsmell,
2866                 eat_it_anyway);
2867 #else
2868         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                 eat_it_anyway);
2870 #endif
2871         if (yn_function(buf, ynchars, 'n') == 'n')
2872             return 1;
2873         else
2874             return 2;
2875     }
2876     if (!u.uconduct.unvegetarian
2877         && ((material == LEATHER || material == BONE
2878              || material == DRAGON_HIDE)
2879             || (cadaver && !vegetarian(&mons[mnum])))) {
2880 /*JP
2881         Sprintf(buf, "%s unfamiliar to you. %s", foodsmell, eat_it_anyway);
2882 */
2883         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);
2884         if (yn_function(buf, ynchars, 'n') == 'n')
2885             return 1;
2886         else
2887             return 2;
2888     }
2889
2890     if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && Sick_resistance) {
2891         /* Tainted meat with Sick_resistance */
2892 #if 0 /*JP*/
2893         Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
2894                 eat_it_anyway);
2895 #else
2896         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                 eat_it_anyway);
2898 #endif
2899         if (yn_function(buf, ynchars, 'n') == 'n')
2900             return 1;
2901         else
2902             return 2;
2903     }
2904     return 0;
2905 }
2906
2907 /* 'e' command */
2908 int
2909 doeat()
2910 {
2911     struct obj *otmp;
2912     int basenutrit; /* nutrition of full item */
2913     boolean dont_start = FALSE, nodelicious = FALSE;
2914
2915     if (Strangled) {
2916 /*JP
2917         pline("If you can't breathe air, how can you consume solids?");
2918 */
2919         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         return 0;
2921     }
2922 /*JP
2923     if (!(otmp = floorfood("eat", 0)))
2924 */
2925     if (!(otmp = floorfood("\90H\82×\82é", 0)))
2926         return 0;
2927     if (check_capacity((char *) 0))
2928         return 0;
2929
2930     if (u.uedibility) {
2931         int res = edibility_prompts(otmp);
2932         if (res) {
2933 #if 0 /*JP*/
2934             Your(
2935                "%s stops tingling and your sense of smell returns to normal.",
2936                  body_part(NOSE));
2937 #else
2938             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",
2939                  body_part(NOSE));
2940 #endif
2941             u.uedibility = 0;
2942             if (res == 1)
2943                 return 0;
2944         }
2945     }
2946
2947     /* We have to make non-foods take 1 move to eat, unless we want to
2948      * do ridiculous amounts of coding to deal with partly eaten plate
2949      * mails, players who polymorph back to human in the middle of their
2950      * metallic meal, etc....
2951      */
2952     if (!(carried(otmp) ? retouch_object(&otmp, FALSE)
2953                         : touch_artifact(otmp, &youmonst))) {
2954         return 1;
2955     } else if (!is_edible(otmp)) {
2956 /*JP
2957         You("cannot eat that!");
2958 */
2959         You("\82»\82ê\82ð\90H\82×\82ç\82ê\82È\82¢\81I");
2960         return 0;
2961     } else if ((otmp->owornmask & (W_ARMOR | W_TOOL | W_AMUL | W_SADDLE))
2962                != 0) {
2963         /* let them eat rings */
2964 /*JP
2965         You_cant("eat %s you're wearing.", something);
2966 */
2967         You("\90g\82É\82Â\82¯\82Ä\82¢\82é\8aÔ\82Í\90H\82×\82ê\82È\82¢\81D");
2968         return 0;
2969     }
2970     if (is_metallic(otmp) && u.umonnum == PM_RUST_MONSTER
2971         && otmp->oerodeproof) {
2972         otmp->rknown = TRUE;
2973         if (otmp->quan > 1L) {
2974             if (!carried(otmp))
2975                 (void) splitobj(otmp, otmp->quan - 1L);
2976             else
2977                 otmp = splitobj(otmp, 1L);
2978         }
2979 /*JP
2980         pline("Ulch - that %s was rustproofed!", xname(otmp));
2981 */
2982         pline("\83E\83Q\83F\81[\81I%s\82Í\96h\8eK\82³\82ê\82Ä\82¢\82é\81I", xname(otmp));
2983         /* The regurgitated object's rustproofing is gone now */
2984         otmp->oerodeproof = 0;
2985         make_stunned((HStun & TIMEOUT) + (long) rn2(10), TRUE);
2986 #if 0 /*JP*/
2987         You("spit %s out onto the %s.", the(xname(otmp)),
2988             surface(u.ux, u.uy));
2989 #else
2990         You("%s\82ð%s\82É\93f\82«\8fo\82µ\82½\81D", the(xname(otmp)),
2991             surface(u.ux, u.uy));
2992 #endif
2993         if (carried(otmp)) {
2994             freeinv(otmp);
2995             dropy(otmp);
2996         }
2997         stackobj(otmp);
2998         return 1;
2999     }
3000     /* KMH -- Slow digestion is... indigestible */
3001     if (otmp->otyp == RIN_SLOW_DIGESTION) {
3002 /*JP
3003         pline("This ring is indigestible!");
3004 */
3005         pline("\82±\82Ì\8ew\97Ö\82Í\8fÁ\89»\82µ\82É\82­\82¢\81I");
3006         (void) rottenfood(otmp);
3007         if (otmp->dknown && !objects[otmp->otyp].oc_name_known
3008             && !objects[otmp->otyp].oc_uname)
3009             docall(otmp);
3010         return 1;
3011     }
3012     if (otmp->oclass != FOOD_CLASS) {
3013         int material;
3014
3015         context.victual.reqtime = 1;
3016         context.victual.piece = otmp;
3017         context.victual.o_id = otmp->o_id;
3018         /* Don't split it, we don't need to if it's 1 move */
3019         context.victual.usedtime = 0;
3020         context.victual.canchoke = (u.uhs == SATIATED);
3021         /* Note: gold weighs 1 pt. for each 1000 pieces (see
3022            pickup.c) so gold and non-gold is consistent. */
3023         if (otmp->oclass == COIN_CLASS)
3024             basenutrit = ((otmp->quan > 200000L)
3025                              ? 2000
3026                              : (int) (otmp->quan / 100L));
3027         else if (otmp->oclass == BALL_CLASS || otmp->oclass == CHAIN_CLASS)
3028             basenutrit = weight(otmp);
3029         /* oc_nutrition is usually weight anyway */
3030         else
3031             basenutrit = objects[otmp->otyp].oc_nutrition;
3032 #ifdef MAIL
3033         if (otmp->otyp == SCR_MAIL) {
3034             basenutrit = 0;
3035             nodelicious = TRUE;
3036         }
3037 #endif
3038         context.victual.nmod = basenutrit;
3039         context.victual.eating = TRUE; /* needed for lesshungry() */
3040
3041         material = objects[otmp->otyp].oc_material;
3042         if (material == LEATHER || material == BONE
3043             || material == DRAGON_HIDE) {
3044             u.uconduct.unvegan++;
3045             violated_vegetarian();
3046         } else if (material == WAX)
3047             u.uconduct.unvegan++;
3048         u.uconduct.food++;
3049
3050         if (otmp->cursed)
3051             (void) rottenfood(otmp);
3052
3053         if (otmp->oclass == WEAPON_CLASS && otmp->opoisoned) {
3054 /*JP
3055             pline("Ecch - that must have been poisonous!");
3056 */
3057             pline("\83E\83Q\83F\81[\81C\97L\93Å\82¾\82Á\82½\82É\88á\82¢\82È\82¢\81I");  
3058             if (!Poison_resistance) {
3059                 losestr(rnd(4));
3060 #if 0 /*JP*/
3061                 losehp(rnd(15), xname(otmp), KILLED_BY_AN);
3062 #else
3063                 {
3064                     char jbuf[BUFSZ];
3065                     Sprintf(jbuf, "%s\82Å", xname(otmp));
3066                     losehp(rnd(15), jbuf, KILLED_BY_AN);
3067                 }
3068 #endif
3069             } else
3070 /*JP
3071                 You("seem unaffected by the poison.");
3072 */
3073                 You("\93Å\82Ì\89e\8b¿\82ð\8eó\82¯\82È\82¢\82æ\82¤\82¾\81D");
3074         } else if (!otmp->cursed && !nodelicious) {
3075 #if 0 /*JP*/
3076             pline("%s%s is delicious!",
3077                   (obj_is_pname(otmp)
3078                    && otmp->oartifact < ART_ORB_OF_DETECTION)
3079                       ? ""
3080                       : "This ",
3081                   (otmp->oclass == COIN_CLASS)
3082                       ? foodword(otmp)
3083                       : singular(otmp, xname));
3084 #else
3085             pline("\82±\82Ì%s\82Í\8e|\82¢\81I",
3086                   otmp->oclass == COIN_CLASS
3087                       ? foodword(otmp)
3088                       : singular(otmp, xname));
3089 #endif
3090         }
3091         eatspecial();
3092         return 1;
3093     }
3094
3095     if (otmp == context.victual.piece) {
3096         /* If they weren't able to choke, they don't suddenly become able to
3097          * choke just because they were interrupted.  On the other hand, if
3098          * they were able to choke before, if they lost food it's possible
3099          * they shouldn't be able to choke now.
3100          */
3101         if (u.uhs != SATIATED)
3102             context.victual.canchoke = FALSE;
3103         context.victual.o_id = 0;
3104         context.victual.piece = touchfood(otmp);
3105         if (context.victual.piece)
3106             context.victual.o_id = context.victual.piece->o_id;
3107 /*JP
3108         You("resume your meal.");
3109 */
3110         You("\90H\8e\96\82ð\8dÄ\8aJ\82µ\82½\81D");
3111         start_eating(context.victual.piece);
3112         return 1;
3113     }
3114
3115     /* nothing in progress - so try to find something. */
3116     /* tins are a special case */
3117     /* tins must also check conduct separately in case they're discarded */
3118     if (otmp->otyp == TIN) {
3119         start_tin(otmp);
3120         return 1;
3121     }
3122
3123     /* KMH, conduct */
3124     u.uconduct.food++;
3125
3126     context.victual.o_id = 0;
3127     context.victual.piece = otmp = touchfood(otmp);
3128     if (context.victual.piece)
3129         context.victual.o_id = context.victual.piece->o_id;
3130     context.victual.usedtime = 0;
3131
3132     /* Now we need to calculate delay and nutritional info.
3133      * The base nutrition calculated here and in eatcorpse() accounts
3134      * for normal vs. rotten food.  The reqtime and nutrit values are
3135      * then adjusted in accordance with the amount of food left.
3136      */
3137     if (otmp->otyp == CORPSE || otmp->globby) {
3138         int tmp = eatcorpse(otmp);
3139
3140         if (tmp == 2) {
3141             /* used up */
3142             context.victual.piece = (struct obj *) 0;
3143             context.victual.o_id = 0;
3144             return 1;
3145         } else if (tmp)
3146             dont_start = TRUE;
3147         /* if not used up, eatcorpse sets up reqtime and may modify oeaten */
3148     } else {
3149         /* No checks for WAX, LEATHER, BONE, DRAGON_HIDE.  These are
3150          * all handled in the != FOOD_CLASS case, above.
3151          */
3152         switch (objects[otmp->otyp].oc_material) {
3153         case FLESH:
3154             u.uconduct.unvegan++;
3155             if (otmp->otyp != EGG) {
3156                 violated_vegetarian();
3157             }
3158             break;
3159
3160         default:
3161             if (otmp->otyp == PANCAKE || otmp->otyp == FORTUNE_COOKIE /*eggs*/
3162                 || otmp->otyp == CREAM_PIE || otmp->otyp == CANDY_BAR /*milk*/
3163                 || otmp->otyp == LUMP_OF_ROYAL_JELLY)
3164                 u.uconduct.unvegan++;
3165             break;
3166         }
3167
3168         context.victual.reqtime = objects[otmp->otyp].oc_delay;
3169         if (otmp->otyp != FORTUNE_COOKIE
3170             && (otmp->cursed || (!nonrotting_food(otmp->otyp)
3171                                  && (monstermoves - otmp->age)
3172                                         > (otmp->blessed ? 50L : 30L)
3173                                  && (otmp->orotten || !rn2(7))))) {
3174             if (rottenfood(otmp)) {
3175                 otmp->orotten = TRUE;
3176                 dont_start = TRUE;
3177             }
3178             consume_oeaten(otmp, 1); /* oeaten >>= 1 */
3179         } else
3180             fprefx(otmp);
3181     }
3182
3183     /* re-calc the nutrition */
3184     if (otmp->otyp == CORPSE)
3185         basenutrit = mons[otmp->corpsenm].cnutrit;
3186     else
3187         basenutrit = objects[otmp->otyp].oc_nutrition;
3188
3189     debugpline1("before rounddiv: context.victual.reqtime == %d",
3190                 context.victual.reqtime);
3191     debugpline2("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
3192     context.victual.reqtime = (basenutrit == 0)
3193                                  ? 0
3194                                  : rounddiv(context.victual.reqtime
3195                                             * (long) otmp->oeaten,
3196                                             basenutrit);
3197     debugpline1("after rounddiv: context.victual.reqtime == %d",
3198                 context.victual.reqtime);
3199     /*
3200      * calculate the modulo value (nutrit. units per round eating)
3201      * note: this isn't exact - you actually lose a little nutrition due
3202      *       to this method.
3203      * TODO: add in a "remainder" value to be given at the end of the meal.
3204      */
3205     if (context.victual.reqtime == 0 || otmp->oeaten == 0)
3206         /* possible if most has been eaten before */
3207         context.victual.nmod = 0;
3208     else if ((int) otmp->oeaten >= context.victual.reqtime)
3209         context.victual.nmod = -((int) otmp->oeaten
3210                                  / context.victual.reqtime);
3211     else
3212         context.victual.nmod = context.victual.reqtime % otmp->oeaten;
3213     context.victual.canchoke = (u.uhs == SATIATED);
3214
3215     if (!dont_start)
3216         start_eating(otmp);
3217     return 1;
3218 }
3219
3220 /* Take a single bite from a piece of food, checking for choking and
3221  * modifying usedtime.  Returns 1 if they choked and survived, 0 otherwise.
3222  */
3223 STATIC_OVL int
3224 bite()
3225 {
3226     if (context.victual.canchoke && u.uhunger >= 2000) {
3227         choke(context.victual.piece);
3228         return 1;
3229     }
3230     if (context.victual.doreset) {
3231         do_reset_eat();
3232         return 0;
3233     }
3234     force_save_hs = TRUE;
3235     if (context.victual.nmod < 0) {
3236         lesshungry(-context.victual.nmod);
3237         consume_oeaten(context.victual.piece,
3238                        context.victual.nmod); /* -= -nmod */
3239     } else if (context.victual.nmod > 0
3240                && (context.victual.usedtime % context.victual.nmod)) {
3241         lesshungry(1);
3242         consume_oeaten(context.victual.piece, -1); /* -= 1 */
3243     }
3244     force_save_hs = FALSE;
3245     recalc_wt();
3246     return 0;
3247 }
3248
3249 /* as time goes by - called by moveloop() and domove() */
3250 void
3251 gethungry()
3252 {
3253     if (u.uinvulnerable)
3254         return; /* you don't feel hungrier */
3255
3256     if ((!u.usleep || !rn2(10)) /* slow metabolic rate while asleep */
3257         && (carnivorous(youmonst.data) || herbivorous(youmonst.data))
3258         && !Slow_digestion)
3259         u.uhunger--; /* ordinary food consumption */
3260
3261     if (moves % 2) { /* odd turns */
3262         /* Regeneration uses up food, unless due to an artifact */
3263         if ((HRegeneration & ~FROMFORM)
3264             || (ERegeneration & ~(W_ARTI | W_WEP)))
3265             u.uhunger--;
3266         if (near_capacity() > SLT_ENCUMBER)
3267             u.uhunger--;
3268     } else { /* even turns */
3269         if (Hunger)
3270             u.uhunger--;
3271         /* Conflict uses up food too */
3272         if (HConflict || (EConflict & (~W_ARTI)))
3273             u.uhunger--;
3274         /* +0 charged rings don't do anything, so don't affect hunger */
3275         /* Slow digestion still uses ring hunger */
3276         switch ((int) (moves % 20)) { /* note: use even cases only */
3277         case 4:
3278             if (uleft && (uleft->spe || !objects[uleft->otyp].oc_charged))
3279                 u.uhunger--;
3280             break;
3281         case 8:
3282             if (uamul)
3283                 u.uhunger--;
3284             break;
3285         case 12:
3286             if (uright && (uright->spe || !objects[uright->otyp].oc_charged))
3287                 u.uhunger--;
3288             break;
3289         case 16:
3290             if (u.uhave.amulet)
3291                 u.uhunger--;
3292             break;
3293         default:
3294             break;
3295         }
3296     }
3297     newuhs(TRUE);
3298 }
3299
3300 /* called after vomiting and after performing feats of magic */
3301 void
3302 morehungry(num)
3303 int num;
3304 {
3305     u.uhunger -= num;
3306     newuhs(TRUE);
3307 }
3308
3309 /* called after eating (and after drinking fruit juice) */
3310 void
3311 lesshungry(num)
3312 int num;
3313 {
3314     /* See comments in newuhs() for discussion on force_save_hs */
3315     boolean iseating = (occupation == eatfood) || force_save_hs;
3316
3317     debugpline1("lesshungry(%d)", num);
3318     u.uhunger += num;
3319     if (u.uhunger >= 2000) {
3320         if (!iseating || context.victual.canchoke) {
3321             if (iseating) {
3322                 choke(context.victual.piece);
3323                 reset_eat();
3324             } else
3325                 choke(occupation == opentin ? context.tin.tin
3326                                             : (struct obj *) 0);
3327             /* no reset_eat() */
3328         }
3329     } else {
3330         /* Have lesshungry() report when you're nearly full so all eating
3331          * warns when you're about to choke.
3332          */
3333         if (u.uhunger >= 1500) {
3334             if (!context.victual.eating
3335                 || (context.victual.eating && !context.victual.fullwarn)) {
3336 /*JP
3337                 pline("You're having a hard time getting all of it down.");
3338 */
3339                 pline("\91S\82Ä\82ð\88ù\82Ý\82±\82Þ\82É\82Í\8e\9e\8aÔ\82ª\82©\82©\82é\81D");
3340 /*JP
3341                 nomovemsg = "You're finally finished.";
3342 */
3343                 nomovemsg = "\82â\82Á\82Æ\90H\82×\8fI\82¦\82½\81D";
3344                 if (!context.victual.eating) {
3345                     multi = -2;
3346                 } else {
3347                     context.victual.fullwarn = TRUE;
3348                     if (context.victual.canchoke
3349                         && context.victual.reqtime > 1) {
3350                         /* a one-gulp food will not survive a stop */
3351 /*JP
3352                         if (yn_function("Continue eating?", ynchars, 'n')
3353 */
3354                         if (yn_function("\90H\82×\91±\82¯\82Ü\82·\82©\81H", ynchars, 'n')
3355                             != 'y') {
3356                             reset_eat();
3357                             nomovemsg = (char *) 0;
3358                         }
3359                     }
3360                 }
3361             }
3362         }
3363     }
3364     newuhs(FALSE);
3365 }
3366
3367 STATIC_PTR
3368 int
3369 unfaint(VOID_ARGS)
3370 {
3371     (void) Hear_again();
3372     if (u.uhs > FAINTING)
3373         u.uhs = FAINTING;
3374     stop_occupation();
3375     context.botl = 1;
3376     return 0;
3377 }
3378
3379 boolean
3380 is_fainted()
3381 {
3382     return (boolean) (u.uhs == FAINTED);
3383 }
3384
3385 /* call when a faint must be prematurely terminated */
3386 void
3387 reset_faint()
3388 {
3389     if (afternmv == unfaint)
3390 /*JP
3391         unmul("You revive.");
3392 */
3393         unmul("\82 \82È\82½\82Í\8bC\82ª\82Â\82¢\82½\81D");
3394 }
3395
3396 /* compute and comment on your (new?) hunger status */
3397 void
3398 newuhs(incr)
3399 boolean incr;
3400 {
3401     unsigned newhs;
3402     static unsigned save_hs;
3403     static boolean saved_hs = FALSE;
3404     int h = u.uhunger;
3405
3406     newhs = (h > 1000)
3407                 ? SATIATED
3408                 : (h > 150) ? NOT_HUNGRY
3409                             : (h > 50) ? HUNGRY : (h > 0) ? WEAK : FAINTING;
3410
3411     /* While you're eating, you may pass from WEAK to HUNGRY to NOT_HUNGRY.
3412      * This should not produce the message "you only feel hungry now";
3413      * that message should only appear if HUNGRY is an endpoint.  Therefore
3414      * we check to see if we're in the middle of eating.  If so, we save
3415      * the first hunger status, and at the end of eating we decide what
3416      * message to print based on the _entire_ meal, not on each little bit.
3417      */
3418     /* It is normally possible to check if you are in the middle of a meal
3419      * by checking occupation == eatfood, but there is one special case:
3420      * start_eating() can call bite() for your first bite before it
3421      * sets the occupation.
3422      * Anyone who wants to get that case to work _without_ an ugly static
3423      * force_save_hs variable, feel free.
3424      */
3425     /* Note: If you become a certain hunger status in the middle of the
3426      * meal, and still have that same status at the end of the meal,
3427      * this will incorrectly print the associated message at the end of
3428      * the meal instead of the middle.  Such a case is currently
3429      * impossible, but could become possible if a message for SATIATED
3430      * were added or if HUNGRY and WEAK were separated by a big enough
3431      * gap to fit two bites.
3432      */
3433     if (occupation == eatfood || force_save_hs) {
3434         if (!saved_hs) {
3435             save_hs = u.uhs;
3436             saved_hs = TRUE;
3437         }
3438         u.uhs = newhs;
3439         return;
3440     } else {
3441         if (saved_hs) {
3442             u.uhs = save_hs;
3443             saved_hs = FALSE;
3444         }
3445     }
3446
3447     if (newhs == FAINTING) {
3448         if (is_fainted())
3449             newhs = FAINTED;
3450         if (u.uhs <= WEAK || rn2(20 - u.uhunger / 10) >= 19) {
3451             if (!is_fainted() && multi >= 0 /* %% */) {
3452                 int duration = 10 - (u.uhunger / 10);
3453
3454                 /* stop what you're doing, then faint */
3455                 stop_occupation();
3456 /*JP
3457                 You("faint from lack of food.");
3458 */
3459                 You("\95 \82ª\8c¸\82Á\82Ä\93|\82ê\82½\81D");
3460                 if (!Levitation)
3461 /*JP
3462                     selftouch("Falling, you");
3463 */
3464                     selftouch("\97\8e\82¿\82È\82ª\82ç\81C\82 \82È\82½\82Í");
3465                 incr_itimeout(&HDeaf, duration);
3466                 nomul(-duration);
3467                 multi_reason = "fainted from lack of food";
3468 /*JP
3469                 nomovemsg = "You regain consciousness.";
3470 */
3471                 nomovemsg = "\82 \82È\82½\82Í\90³\8bC\82Ã\82¢\82½\81D";
3472                 afternmv = unfaint;
3473                 newhs = FAINTED;
3474             }
3475         } else if (u.uhunger < -(int) (200 + 20 * ACURR(A_CON))) {
3476             u.uhs = STARVED;
3477             context.botl = 1;
3478             bot();
3479 /*JP
3480             You("die from starvation.");
3481 */
3482             You("\89ì\8e\80\82µ\82½\81D");
3483             killer.format = KILLED_BY;
3484 /*JP
3485             Strcpy(killer.name, "starvation");
3486 */
3487             Strcpy(killer.name, "\90H\97¿\95s\91«\82Å\89ì\8e\80\82µ\82½");
3488             done(STARVING);
3489             /* if we return, we lifesaved, and that calls newuhs */
3490             return;
3491         }
3492     }
3493
3494     if (newhs != u.uhs) {
3495         if (newhs >= WEAK && u.uhs < WEAK)
3496             losestr(1); /* this may kill you -- see below */
3497         else if (newhs < WEAK && u.uhs >= WEAK)
3498             losestr(-1);
3499         switch (newhs) {
3500         case HUNGRY:
3501             if (Hallucination) {
3502 #if 0 /*JP:T*/
3503                 You((!incr) ? "now have a lesser case of the munchies."
3504                             : "are getting the munchies.");
3505 #else
3506                 if (!incr) {
3507                     You("\83n\83\89\83w\83\8a\82ª\8c¸\82Á\82½\81D");
3508                 } else {
3509                     pline("\83n\83\89\83w\83\8a\83w\83\8a\83n\83\89\81D");
3510                 }
3511 #endif
3512             } else
3513 /*JP
3514                 You((!incr) ? "only feel hungry now."
3515 */
3516                 You((!incr) ? "\92P\82É\95 \83y\83R\8fó\91Ô\82É\82È\82Á\82½\81D"
3517                             : (u.uhunger < 145)
3518 /*JP
3519                                   ? "feel hungry."
3520 */
3521                                   ? "\8bó\95 \8a´\82ð\8a´\82\82½\81D"
3522 /*JP
3523                                   : "are beginning to feel hungry.");
3524 */
3525                                   : "\8bó\95 \8a´\82ð\82¨\82Ú\82¦\82Í\82\82ß\82½\81D");
3526             if (incr && occupation
3527                 && (occupation != eatfood && occupation != opentin))
3528                 stop_occupation();
3529             context.travel = context.travel1 = context.mv = context.run = 0;
3530             break;
3531         case WEAK:
3532             if (Hallucination)
3533 /*JP
3534                 pline((!incr) ? "You still have the munchies."
3535 */
3536                 pline((!incr) ? "\83n\83\89\83w\83\8a\82ª\8c¸\82ç\82È\82¢\81D"
3537 /*JP
3538               : "The munchies are interfering with your motor capabilities.");
3539 */
3540               : "\83n\83\89\83w\83\8a\82ª\83\82\81[\83^\81[\90«\94\\82É\89e\8b¿\82ð\97^\82¦\82Ä\82¢\82é\81D");
3541             else if (incr && (Role_if(PM_WIZARD) || Race_if(PM_ELF)
3542                               || Role_if(PM_VALKYRIE)))
3543 /*JP
3544                 pline("%s needs food, badly!",
3545 */
3546                 pline("%s\82É\82Í\8e\8a\8b}\90H\97¿\82ª\95K\97v\82¾\81I",
3547                       (Role_if(PM_WIZARD) || Role_if(PM_VALKYRIE))
3548                           ? urole.name.m
3549 /*JP
3550                           : "Elf");
3551 */
3552                           : "\83G\83\8b\83t");
3553             else
3554                 You((!incr)
3555 /*JP
3556                         ? "feel weak now."
3557 */
3558                         ? "\90\8a\8eã\8fó\91Ô\82É\82È\82Á\82½\81D"
3559 /*JP
3560                         : (u.uhunger < 45) ? "feel weak."
3561 */
3562                         : (u.uhunger < 45) ? "\90\8a\8eã\82µ\82Ä\82«\82½\81D"
3563 /*JP
3564                                            : "are beginning to feel weak.");
3565 */
3566                                            : "\8eã\82­\82È\82Á\82Ä\82«\82½\82æ\82¤\82É\8a´\82\82½\81D");
3567             if (incr && occupation
3568                 && (occupation != eatfood && occupation != opentin))
3569                 stop_occupation();
3570             context.travel = context.travel1 = context.mv = context.run = 0;
3571             break;
3572         }
3573         u.uhs = newhs;
3574         context.botl = 1;
3575         bot();
3576         if ((Upolyd ? u.mh : u.uhp) < 1) {
3577 /*JP
3578             You("die from hunger and exhaustion.");
3579 */
3580             You("\8bó\95 \82Æ\90\8a\8eã\82Å\8e\80\82ñ\82¾\81D");
3581             killer.format = KILLED_BY;
3582 /*JP
3583             Strcpy(killer.name, "exhaustion");
3584 */
3585             Strcpy(killer.name, "\8bó\95 \82Æ\90\8a\8eã\82Å\8e\80\82ñ\82¾");
3586             done(STARVING);
3587             return;
3588         }
3589     }
3590 }
3591
3592 /* Returns an object representing food.
3593  * Object may be either on floor or in inventory.
3594  */
3595 /*JP CHECK: 3.4.3 \82Å\82Ì\8cÄ\82Ñ\8fo\82µ\8c³
3596 apply.c:1959:   if (!(corpse = floorfood("\8aÊ\8bl\82ß\82É\82·\82é", 2))) return;
3597 eat.c:2404:     if (!(otmp = floorfood("\90H\82×\82é", 0))) return 0;
3598 pray.c:1478:    if (!(otmp = floorfood("\95ù\82°\82é", 1))) return 0;
3599 */
3600 struct obj *
3601 floorfood(verb, corpsecheck)
3602 const char *verb;
3603 int corpsecheck; /* 0, no check, 1, corpses, 2, tinnable corpses */
3604 {
3605     register struct obj *otmp;
3606     char qbuf[QBUFSZ];
3607     char c;
3608 #if 0 /*JP*/
3609     boolean feeding = !strcmp(verb, "eat"),    /* corpsecheck==0 */
3610         offering = !strcmp(verb, "sacrifice"); /* corpsecheck==1 */
3611 #else
3612     boolean feeding = !strcmp(verb, "\90H\82×\82é"), /* corpsecheck==0 */
3613         offering = !strcmp(verb, "\95ù\82°\82é");    /* corpsecheck==1 */
3614 #endif
3615
3616 #if 1 /*JP*/
3617     const char *jverb = trans_verb(verb)->jp;
3618 #endif
3619
3620     /* if we can't touch floor objects then use invent food only */
3621     if (!can_reach_floor(TRUE) || (feeding && u.usteed)
3622         || (is_pool_or_lava(u.ux, u.uy)
3623             && (Wwalking || is_clinger(youmonst.data)
3624                 || (Flying && !Breathless))))
3625         goto skipfloor;
3626
3627     if (feeding && metallivorous(youmonst.data)) {
3628         struct obj *gold;
3629         struct trap *ttmp = t_at(u.ux, u.uy);
3630
3631         if (ttmp && ttmp->tseen && ttmp->ttyp == BEAR_TRAP) {
3632             /* If not already stuck in the trap, perhaps there should
3633                be a chance to becoming trapped?  Probably not, because
3634                then the trap would just get eaten on the _next_ turn... */
3635 /*JP
3636             Sprintf(qbuf, "There is a bear trap here (%s); eat it?",
3637 */
3638             Sprintf(qbuf, "\82±\82±\82É\82Í\8cF\82Ìã©(%s)\82ª\82 \82é; \90H\82×\82Ü\82·\82©\81H",
3639 /*JP
3640                     (u.utrap && u.utraptype == TT_BEARTRAP) ? "holding you"
3641 */
3642                     (u.utrap && u.utraptype == TT_BEARTRAP) ? "\82 \82È\82½\82ð\92Í\82Ü\82¦\82Ä\82¢\82é"
3643 /*JP
3644                                                             : "armed");
3645 */
3646                                                             : "\89Ò\93®\92\86");
3647             if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3648                 u.utrap = u.utraptype = 0;
3649                 deltrap(ttmp);
3650                 return mksobj(BEARTRAP, TRUE, FALSE);
3651             } else if (c == 'q') {
3652                 return (struct obj *) 0;
3653             }
3654         }
3655
3656         if (youmonst.data != &mons[PM_RUST_MONSTER]
3657             && (gold = g_at(u.ux, u.uy)) != 0) {
3658 #if 0 /*JP*/
3659             if (gold->quan == 1L)
3660                 Sprintf(qbuf, "There is 1 gold piece here; eat it?");
3661             else
3662                 Sprintf(qbuf, "There are %ld gold pieces here; eat them?",
3663                         gold->quan);
3664 #else
3665             Sprintf(qbuf, "\82±\82±\82É\82Í%ld\96\87\82Ì\8bà\89Ý\82ª\82 \82é\81D\90H\82×\82Ü\82·\82©\81H", gold->quan);
3666 #endif
3667             if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y') {
3668                 return gold;
3669             } else if (c == 'q') {
3670                 return (struct obj *) 0;
3671             }
3672         }
3673     }
3674
3675     /* Is there some food (probably a heavy corpse) here on the ground? */
3676     for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp->nexthere) {
3677         if (corpsecheck
3678                 ? (otmp->otyp == CORPSE
3679                    && (corpsecheck == 1 || tinnable(otmp)))
3680                 : feeding ? (otmp->oclass != COIN_CLASS && is_edible(otmp))
3681                           : otmp->oclass == FOOD_CLASS) {
3682             char qsfx[QBUFSZ];
3683             boolean one = (otmp->quan == 1L);
3684
3685             /* "There is <an object> here; <verb> it?" or
3686                "There are <N objects> here; <verb> one?" */
3687 #if 0 /*JP*/
3688             Sprintf(qbuf, "There %s ", otense(otmp, "are"));
3689             Sprintf(qsfx, " here; %s %s?", verb, one ? "it" : "one");
3690             (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3691                              one ? something : (const char *) "things");
3692 #else
3693             Strcpy(qbuf, "\82±\82±\82É");
3694             Sprintf(qsfx, "\82ª\82 \82é; %s%s?", one ? "" : "\88ê\82Â", jverb);
3695             (void) safe_qbuf(qbuf, qbuf, qsfx, otmp, doname, ansimpleoname,
3696                              one ? something : (const char *) "\89½\82©");
3697 #endif
3698             if ((c = yn_function(qbuf, ynqchars, 'n')) == 'y')
3699                 return  otmp;
3700             else if (c == 'q')
3701                 return (struct obj *) 0;
3702         }
3703     }
3704
3705 skipfloor:
3706     /* We cannot use ALL_CLASSES since that causes getobj() to skip its
3707      * "ugly checks" and we need to check for inedible items.
3708      */
3709     otmp =
3710         getobj(feeding ? allobj : offering ? offerfodder : comestibles, verb);
3711     if (corpsecheck && otmp && !(offering && otmp->oclass == AMULET_CLASS))
3712         if (otmp->otyp != CORPSE || (corpsecheck == 2 && !tinnable(otmp))) {
3713 /*JP
3714             You_cant("%s that!", verb);
3715 */
3716             You_cant("\82»\82ê\82ð%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81I", jverb);
3717             return (struct obj *) 0;
3718         }
3719     return otmp;
3720 }
3721
3722 /* Side effects of vomiting */
3723 /* added nomul (MRS) - it makes sense, you're too busy being sick! */
3724 void
3725 vomit() /* A good idea from David Neves */
3726 {
3727     if (cantvomit(youmonst.data))
3728         /* doesn't cure food poisoning; message assumes that we aren't
3729            dealing with some esoteric body_part() */
3730 /*JP
3731         Your("jaw gapes convulsively.");
3732 */
3733         Your("\82 \82²\82Í\94­\8dì\93I\82É\91å\82«\82­\8aJ\82¢\82½\81D");
3734     else
3735         make_sick(0L, (char *) 0, TRUE, SICK_VOMITABLE);
3736     nomul(-2);
3737     multi_reason = "vomiting";
3738     nomovemsg = You_can_move_again;
3739 }
3740
3741 int
3742 eaten_stat(base, obj)
3743 int base;
3744 struct obj *obj;
3745 {
3746     long uneaten_amt, full_amount;
3747
3748     uneaten_amt = (long) obj->oeaten;
3749     full_amount = (obj->otyp == CORPSE)
3750                       ? (long) mons[obj->corpsenm].cnutrit
3751                       : (long) objects[obj->otyp].oc_nutrition;
3752     if (uneaten_amt > full_amount) {
3753         impossible(
3754           "partly eaten food (%ld) more nutritious than untouched food (%ld)",
3755                    uneaten_amt, full_amount);
3756         uneaten_amt = full_amount;
3757     }
3758
3759     base = (int) (full_amount ? (long) base * uneaten_amt / full_amount : 0L);
3760     return (base < 1) ? 1 : base;
3761 }
3762
3763 /* reduce obj's oeaten field, making sure it never hits or passes 0 */
3764 void
3765 consume_oeaten(obj, amt)
3766 struct obj *obj;
3767 int amt;
3768 {
3769     /*
3770      * This is a hack to try to squelch several long standing mystery
3771      * food bugs.  A better solution would be to rewrite the entire
3772      * victual handling mechanism from scratch using a less complex
3773      * model.  Alternatively, this routine could call done_eating()
3774      * or food_disappears() but its callers would need revisions to
3775      * cope with context.victual.piece unexpectedly going away.
3776      *
3777      * Multi-turn eating operates by setting the food's oeaten field
3778      * to its full nutritional value and then running a counter which
3779      * independently keeps track of whether there is any food left.
3780      * The oeaten field can reach exactly zero on the last turn, and
3781      * the object isn't removed from inventory until the next turn
3782      * when the "you finish eating" message gets delivered, so the
3783      * food would be restored to the status of untouched during that
3784      * interval.  This resulted in unexpected encumbrance messages
3785      * at the end of a meal (if near enough to a threshold) and would
3786      * yield full food if there was an interruption on the critical
3787      * turn.  Also, there have been reports over the years of food
3788      * becoming massively heavy or producing unlimited satiation;
3789      * this would occur if reducing oeaten via subtraction attempted
3790      * to drop it below 0 since its unsigned type would produce a
3791      * huge positive value instead.  So far, no one has figured out
3792      * _why_ that inappropriate subtraction might sometimes happen.
3793      */
3794
3795     if (amt > 0) {
3796         /* bit shift to divide the remaining amount of food */
3797         obj->oeaten >>= amt;
3798     } else {
3799         /* simple decrement; value is negative so we actually add it */
3800         if ((int) obj->oeaten > -amt)
3801             obj->oeaten += amt;
3802         else
3803             obj->oeaten = 0;
3804     }
3805
3806     if (obj->oeaten == 0) {
3807         if (obj == context.victual.piece) /* always true unless wishing... */
3808             context.victual.reqtime =
3809                 context.victual.usedtime; /* no bites left */
3810         obj->oeaten = 1; /* smallest possible positive value */
3811     }
3812 }
3813
3814 /* called when eatfood occupation has been interrupted,
3815    or in the case of theft, is about to be interrupted */
3816 boolean
3817 maybe_finished_meal(stopping)
3818 boolean stopping;
3819 {
3820     /* in case consume_oeaten() has decided that the food is all gone */
3821     if (occupation == eatfood
3822         && context.victual.usedtime >= context.victual.reqtime) {
3823         if (stopping)
3824             occupation = 0; /* for do_reset_eat */
3825         (void) eatfood();   /* calls done_eating() to use up
3826                                context.victual.piece */
3827         return TRUE;
3828     }
3829     return FALSE;
3830 }
3831
3832 /* Tin of <something> to the rescue?  Decide whether current occupation
3833    is an attempt to eat a tin of something capable of saving hero's life.
3834    We don't care about consumption of non-tinned food here because special
3835    effects there take place on first bite rather than at end of occupation.
3836    [Popeye the Sailor gets out of trouble by eating tins of spinach. :-] */
3837 boolean
3838 Popeye(threat)
3839 int threat;
3840 {
3841     struct obj *otin;
3842     int mndx;
3843
3844     if (occupation != opentin)
3845         return FALSE;
3846     otin = context.tin.tin;
3847     /* make sure hero still has access to tin */
3848     if (!carried(otin)
3849         && (!obj_here(otin, u.ux, u.uy) || !can_reach_floor(TRUE)))
3850         return FALSE;
3851     /* unknown tin is assumed to be helpful */
3852     if (!otin->known)
3853         return TRUE;
3854     /* known tin is helpful if it will stop life-threatening problem */
3855     mndx = otin->corpsenm;
3856     switch (threat) {
3857     /* note: not used; hunger code bypasses stop_occupation() when eating */
3858     case HUNGER:
3859         return (boolean) (mndx != NON_PM || otin->spe == 1);
3860     /* flesh from lizards and acidic critters stops petrification */
3861     case STONED:
3862         return (boolean) (mndx >= LOW_PM
3863                           && (mndx == PM_LIZARD || acidic(&mons[mndx])));
3864     /* no tins can cure these (yet?) */
3865     case SLIMED:
3866     case SICK:
3867     case VOMITING:
3868         break;
3869     default:
3870         break;
3871     }
3872     return FALSE;
3873 }
3874
3875 /*eat.c*/