OSDN Git Service

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