OSDN Git Service

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