OSDN Git Service

GCC says embedding a directive within macro arguments is not portable
[jnethack/source.git] / src / potion.c
1 /* NetHack 3.6  potion.c        $NHDT-Date: 1520797133 2018/03/11 19:38:53 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.144 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2013. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2018            */
9 /* JNetHack may be freely redistributed.  See license for details. */
10
11 #include "hack.h"
12
13 boolean notonhead = FALSE;
14
15 static NEARDATA int nothing, unkn;
16 static NEARDATA const char beverages[] = { POTION_CLASS, 0 };
17
18 STATIC_DCL long FDECL(itimeout, (long));
19 STATIC_DCL long FDECL(itimeout_incr, (long, int));
20 STATIC_DCL void NDECL(ghost_from_bottle);
21 STATIC_DCL boolean
22 FDECL(H2Opotion_dip, (struct obj *, struct obj *, BOOLEAN_P, const char *));
23 STATIC_DCL short FDECL(mixtype, (struct obj *, struct obj *));
24
25 /* force `val' to be within valid range for intrinsic timeout value */
26 STATIC_OVL long
27 itimeout(val)
28 long val;
29 {
30     if (val >= TIMEOUT)
31         val = TIMEOUT;
32     else if (val < 1)
33         val = 0;
34
35     return val;
36 }
37
38 /* increment `old' by `incr' and force result to be valid intrinsic timeout */
39 STATIC_OVL long
40 itimeout_incr(old, incr)
41 long old;
42 int incr;
43 {
44     return itimeout((old & TIMEOUT) + (long) incr);
45 }
46
47 /* set the timeout field of intrinsic `which' */
48 void
49 set_itimeout(which, val)
50 long *which, val;
51 {
52     *which &= ~TIMEOUT;
53     *which |= itimeout(val);
54 }
55
56 /* increment the timeout field of intrinsic `which' */
57 void
58 incr_itimeout(which, incr)
59 long *which;
60 int incr;
61 {
62     set_itimeout(which, itimeout_incr(*which, incr));
63 }
64
65 void
66 make_confused(xtime, talk)
67 long xtime;
68 boolean talk;
69 {
70     long old = HConfusion;
71
72     if (Unaware)
73         talk = FALSE;
74
75     if (!xtime && old) {
76         if (talk)
77 /*JP
78             You_feel("less %s now.", Hallucination ? "trippy" : "confused");
79 */
80             You("%s\82ª\82¨\82³\82Ü\82Á\82½\81D", Hallucination ? "\83w\83\8d\83w\83\8d" : "\8d¬\97\90");
81     }
82     if ((xtime && !old) || (!xtime && old))
83         context.botl = TRUE;
84
85     set_itimeout(&HConfusion, xtime);
86 }
87
88 void
89 make_stunned(xtime, talk)
90 long xtime;
91 boolean talk;
92 {
93     long old = HStun;
94
95     if (Unaware)
96         talk = FALSE;
97
98     if (!xtime && old) {
99         if (talk)
100 #if 0 /*JP*/
101             You_feel("%s now.",
102                      Hallucination ? "less wobbly" : "a bit steadier");
103 #else
104             You_feel("%s\81D",
105                      Hallucination ? "\82Ö\82ë\82è\82ç\82ª\82¨\82³\82Ü\82Á\82½" : "\82¾\82ñ\82¾\82ñ\82µ\82Á\82©\82è\82µ\82Ä\82«\82½");
106 #endif
107     }
108     if (xtime && !old) {
109         if (talk) {
110             if (u.usteed)
111 /*JP
112                 You("wobble in the saddle.");
113 */
114                 You("\88Æ\82Ì\8fã\82Å\82®\82ç\82®\82ç\82µ\82½\81D");
115             else
116 /*JP
117                 You("%s...", stagger(youmonst.data, "stagger"));
118 */
119                 You("\82­\82ç\82­\82ç\82µ\82½\81D\81D\81D");
120         }
121     }
122     if ((!xtime && old) || (xtime && !old))
123         context.botl = TRUE;
124
125     set_itimeout(&HStun, xtime);
126 }
127
128 void
129 make_sick(xtime, cause, talk, type)
130 long xtime;
131 const char *cause; /* sickness cause */
132 boolean talk;
133 int type;
134 {
135     long old = Sick;
136
137 #if 0
138     if (Unaware)
139         talk = FALSE;
140 #endif
141     if (xtime > 0L) {
142         if (Sick_resistance)
143             return;
144         if (!old) {
145             /* newly sick */
146 /*JP
147             You_feel("deathly sick.");
148 */
149             You("\95a\8bC\82Å\8e\80\82É\82»\82¤\82¾\81D");
150         } else {
151             /* already sick */
152             if (talk)
153 /*JP
154                 You_feel("%s worse.", xtime <= Sick / 2L ? "much" : "even");
155 */
156                 You("%s\88«\89»\82µ\82½\82æ\82¤\82È\8bC\82ª\82·\82é\81D", xtime <= Sick/2L ? "\82³\82ç\82É" : "\82à\82Á\82Æ");
157         }
158         set_itimeout(&Sick, xtime);
159         u.usick_type |= type;
160         context.botl = TRUE;
161     } else if (old && (type & u.usick_type)) {
162         /* was sick, now not */
163         u.usick_type &= ~type;
164         if (u.usick_type) { /* only partly cured */
165             if (talk)
166 /*JP
167                 You_feel("somewhat better.");
168 */
169                 You("\82¿\82å\82Á\82Æ\82æ\82­\82È\82Á\82½\81D");
170             set_itimeout(&Sick, Sick * 2); /* approximation */
171         } else {
172             if (talk)
173 /*JP
174                 You_feel("cured.  What a relief!");
175 */
176                 pline("\89ñ\95\9c\82µ\82½\81D\82 \82 \8f\95\82©\82Á\82½\81I");
177             Sick = 0L; /* set_itimeout(&Sick, 0L) */
178         }
179         context.botl = TRUE;
180     }
181
182     if (Sick) {
183         exercise(A_CON, FALSE);
184         delayed_killer(SICK, KILLED_BY_AN, cause);
185     } else
186         dealloc_killer(find_delayed_killer(SICK));
187 }
188
189 void
190 make_slimed(xtime, msg)
191 long xtime;
192 const char *msg;
193 {
194     long old = Slimed;
195
196 #if 0
197     if (Unaware)
198         msg = 0;
199 #endif
200     set_itimeout(&Slimed, xtime);
201     if ((xtime != 0L) ^ (old != 0L)) {
202         context.botl = TRUE;
203         if (msg)
204             pline1(msg);
205     }
206     if (!Slimed)
207         dealloc_killer(find_delayed_killer(SLIMED));
208 }
209
210 /* start or stop petrification */
211 void
212 make_stoned(xtime, msg, killedby, killername)
213 long xtime;
214 const char *msg;
215 int killedby;
216 const char *killername;
217 {
218     long old = Stoned;
219
220 #if 0
221     if (Unaware)
222         msg = 0;
223 #endif
224     set_itimeout(&Stoned, xtime);
225     if ((xtime != 0L) ^ (old != 0L)) {
226         context.botl = TRUE;
227         if (msg)
228             pline1(msg);
229     }
230     if (!Stoned)
231         dealloc_killer(find_delayed_killer(STONED));
232     else if (!old)
233         delayed_killer(STONED, killedby, killername);
234 }
235
236 void
237 make_vomiting(xtime, talk)
238 long xtime;
239 boolean talk;
240 {
241     long old = Vomiting;
242
243     if (Unaware)
244         talk = FALSE;
245
246     set_itimeout(&Vomiting, xtime);
247     context.botl = TRUE;
248     if (!xtime && old)
249         if (talk)
250 /*JP
251             You_feel("much less nauseated now.");
252 */
253             You("\93f\82«\8bC\82ª\82¨\82³\82Ü\82Á\82½\81D");
254 }
255
256 /*JP
257 static const char vismsg[] = "vision seems to %s for a moment but is %s now.";
258 */
259 static const char vismsg[] = "\8e\8b\8aE\82Í\88ê\8fu%s\82È\82Á\82½\82ª\82Ü\82½%s\82È\82Á\82½\81D";
260 /*JP
261 static const char eyemsg[] = "%s momentarily %s.";
262 */
263 static const char eyemsg[] = "%s\82Í\88ê\8fu%s\81D";
264
265 void
266 make_blinded(xtime, talk)
267 long xtime;
268 boolean talk;
269 {
270     long old = Blinded;
271     boolean u_could_see, can_see_now;
272 #if 0 /*JP*/
273     const char *eyes;
274 #endif
275
276     /* we need to probe ahead in case the Eyes of the Overworld
277        are or will be overriding blindness */
278     u_could_see = !Blind;
279     Blinded = xtime ? 1L : 0L;
280     can_see_now = !Blind;
281     Blinded = old; /* restore */
282
283     if (Unaware)
284         talk = FALSE;
285
286     if (can_see_now && !u_could_see) { /* regaining sight */
287         if (talk) {
288             if (Hallucination)
289 /*JP
290                 pline("Far out!  Everything is all cosmic again!");
291 */
292                 pline("\82°\81I\82È\82É\82à\82©\82à\82ª\82Ü\82½\93ø\90F\82É\8c©\82¦\82é\81I");
293             else
294 /*JP
295                 You("can see again.");
296 */
297                 You("\82Ü\82½\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81D");
298         }
299     } else if (old && !xtime) {
300         /* clearing temporary blindness without toggling blindness */
301         if (talk) {
302             if (!haseyes(youmonst.data)) {
303                 strange_feeling((struct obj *) 0, (char *) 0);
304             } else if (Blindfolded) {
305 #if 0 /*JP*/
306                 eyes = body_part(EYE);
307                 if (eyecount(youmonst.data) != 1)
308                     eyes = makeplural(eyes);
309                 Your(eyemsg, eyes, vtense(eyes, "itch"));
310 #else
311                 Your(eyemsg, body_part(EYE), "\82©\82ä\82­\82È\82Á\82½");
312 #endif
313             } else { /* Eyes of the Overworld */
314 /*JP
315                 Your(vismsg, "brighten", Hallucination ? "sadder" : "normal");
316 */
317                 Your(vismsg, "\96¾\82é\82­", Hallucination ? "\8dª\88Ã\82É" : "\95\81\92Ê\82É");
318             }
319         }
320     }
321
322     if (u_could_see && !can_see_now) { /* losing sight */
323         if (talk) {
324             if (Hallucination)
325 /*JP
326                 pline("Oh, bummer!  Everything is dark!  Help!");
327 */
328                 pline("\88Ã\82¢\82æ\81[\81C\8b·\82¢\82æ\81[\81C\8b°\82¢\82æ\81[\81I");
329             else
330 /*JP
331                 pline("A cloud of darkness falls upon you.");
332 */
333                 pline("\88Ã\8d\95\82Ì\89_\82ª\82 \82È\82½\82ð\95¢\82Á\82½\81D");
334         }
335         /* Before the hero goes blind, set the ball&chain variables. */
336         if (Punished)
337             set_bc(0);
338     } else if (!old && xtime) {
339         /* setting temporary blindness without toggling blindness */
340         if (talk) {
341             if (!haseyes(youmonst.data)) {
342                 strange_feeling((struct obj *) 0, (char *) 0);
343             } else if (Blindfolded) {
344 #if 0 /*JP*/
345                 eyes = body_part(EYE);
346                 if (eyecount(youmonst.data) != 1)
347                     eyes = makeplural(eyes);
348                 Your(eyemsg, eyes, vtense(eyes, "twitch"));
349 #else
350                 Your(eyemsg, body_part(EYE), "\83s\83N\83s\83N\82µ\82½");
351 #endif
352             } else { /* Eyes of the Overworld */
353 /*JP
354                 Your(vismsg, "dim", Hallucination ? "happier" : "normal");
355 */
356                 Your(vismsg, "\94\96\88Ã\82­", Hallucination ? "\83n\83b\83s\81[\82É" : "\95\81\92Ê\82É");
357             }
358         }
359     }
360
361     set_itimeout(&Blinded, xtime);
362
363     if (u_could_see ^ can_see_now) { /* one or the other but not both */
364         context.botl = TRUE;
365         vision_full_recalc = 1; /* blindness just got toggled */
366         /* this vision recalculation used to be deferred until
367            moveloop(), but that made it possible for vision
368            irregularities to occur (cited case was force bolt
369            hitting adjacent potion of blindness and then a
370            secret door; hero was blinded by vapors but then
371            got the message "a door appears in the wall") */
372         vision_recalc(0);
373         if (Blind_telepat || Infravision)
374             see_monsters();
375
376         /* avoid either of the sequences
377            "Sting starts glowing", [become blind], "Sting stops quivering" or
378            "Sting starts quivering", [regain sight], "Sting stops glowing"
379            by giving "Sting is quivering" when becoming blind or
380            "Sting is glowing" when regaining sight so that the eventual
381            "stops" message matches */
382         if (warn_obj_cnt && uwep && (EWarn_of_mon & W_WEP) != 0L)
383             Sting_effects(-1);
384         /* update dknown flag for inventory picked up while blind */
385         if (can_see_now)
386             learn_unseen_invent();
387     }
388 }
389
390 boolean
391 make_hallucinated(xtime, talk, mask)
392 long xtime; /* nonzero if this is an attempt to turn on hallucination */
393 boolean talk;
394 long mask; /* nonzero if resistance status should change by mask */
395 {
396     long old = HHallucination;
397     boolean changed = 0;
398     const char *message, *verb;
399
400     if (Unaware)
401         talk = FALSE;
402
403 #if 0 /*JP*/
404     message = (!xtime) ? "Everything %s SO boring now."
405                        : "Oh wow!  Everything %s so cosmic!";
406 #else
407     message = (!xtime) ? "\89½\82à\82©\82à\82ª\81\96\91Þ\8bü\81\96\82É%s\82é\81D"
408                        : "\83\8f\81[\83I\81I\89½\82à\82©\82à\93ø\90F\82É%s\82é\81I";
409 #endif
410 /*JP
411     verb = (!Blind) ? "looks" : "feels";
412 */
413     verb = (!Blind) ? "\8c©\82¦" : "\8a´\82¶";
414
415     if (mask) {
416         if (HHallucination)
417             changed = TRUE;
418
419         if (!xtime)
420             EHalluc_resistance |= mask;
421         else
422             EHalluc_resistance &= ~mask;
423     } else {
424         if (!EHalluc_resistance && (!!HHallucination != !!xtime))
425             changed = TRUE;
426         set_itimeout(&HHallucination, xtime);
427
428         /* clearing temporary hallucination without toggling vision */
429         if (!changed && !HHallucination && old && talk) {
430             if (!haseyes(youmonst.data)) {
431                 strange_feeling((struct obj *) 0, (char *) 0);
432             } else if (Blind) {
433 #if 0 /*JP*/
434                 const char *eyes = body_part(EYE);
435
436                 if (eyecount(youmonst.data) != 1)
437                     eyes = makeplural(eyes);
438                 Your(eyemsg, eyes, vtense(eyes, "itch"));
439 #else
440                 Your(eyemsg, body_part(EYE), "\82©\82ä\82­\82È\82Á\82½");
441 #endif
442             } else { /* Grayswandir */
443 /*JP
444                 Your(vismsg, "flatten", "normal");
445 */
446                 Your(vismsg, "\82¨\82©\82µ\82­", "\95\81\92Ê\82É");
447             }
448         }
449     }
450
451     if (changed) {
452         /* in case we're mimicking an orange (hallucinatory form
453            of mimicking gold) update the mimicking's-over message */
454         if (!Hallucination)
455             eatmupdate();
456
457         if (u.uswallow) {
458             swallowed(0); /* redraw swallow display */
459         } else {
460             /* The see_* routines should be called *before* the pline. */
461             see_monsters();
462             see_objects();
463             see_traps();
464         }
465
466         /* for perm_inv and anything similar
467         (eg. Qt windowport's equipped items display) */
468         update_inventory();
469
470         context.botl = TRUE;
471         if (talk)
472             pline(message, verb);
473     }
474     return changed;
475 }
476
477 void
478 make_deaf(xtime, talk)
479 long xtime;
480 boolean talk;
481 {
482     long old = HDeaf;
483
484     if (Unaware)
485         talk = FALSE;
486
487     set_itimeout(&HDeaf, xtime);
488     if ((xtime != 0L) ^ (old != 0L)) {
489         context.botl = TRUE;
490         if (talk)
491 /*JP
492             You(old ? "can hear again." : "are unable to hear anything.");
493 */
494             You(old ? "\82Ü\82½\95·\82±\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81D" : "\89½\82à\95·\82±\82¦\82È\82­\82È\82Á\82½\81D");
495     }
496 }
497
498 void
499 self_invis_message()
500 {
501 #if 0 /*JP*/
502     pline("%s %s.",
503           Hallucination ? "Far out, man!  You"
504                         : "Gee!  All of a sudden, you",
505           See_invisible ? "can see right through yourself"
506                         : "can't see yourself");
507 #else
508     pline("%s\82 \82È\82½\82Í%s\81D",
509           Hallucination ? "\83\8f\81[\83I\81I" : "\82°\81I\93Ë\91R",
510           See_invisible ? "\8e©\95ª\8e©\90g\82ª\82¿\82á\82ñ\82Æ\8c©\82¦\82È\82­\82È\82Á\82½"
511                         : "\8e©\95ª\8e©\90g\82ª\8c©\82¦\82È\82­\82È\82Á\82½");
512 #endif
513 }
514
515 STATIC_OVL void
516 ghost_from_bottle()
517 {
518     struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, NO_MM_FLAGS);
519
520     if (!mtmp) {
521 /*JP
522         pline("This bottle turns out to be empty.");
523 */
524         pline("\95r\82Í\8bó\82Á\82Û\82¾\82Á\82½\81D");
525         return;
526     }
527     if (Blind) {
528 /*JP
529         pline("As you open the bottle, %s emerges.", something);
530 */
531         pline("\95r\82ð\8aJ\82¯\82é\82Æ\81C\89½\82©\82ª\8fo\82Ä\82«\82½\81D");
532         return;
533     }
534 #if 0 /*JP*/
535     pline("As you open the bottle, an enormous %s emerges!",
536           Hallucination ? rndmonnam(NULL) : (const char *) "ghost");
537 #else
538     pline("\95r\82ð\8aJ\82¯\82é\82Æ\81C\8b\90\91å\82È%s\82ª\8fo\82Ä\82«\82½\81I",
539           Hallucination ? rndmonnam(NULL) : (const char *) "\97H\97ì");
540 #endif
541     if (flags.verbose)
542 /*JP
543         You("are frightened to death, and unable to move.");
544 */
545         You("\82Ü\82Á\82³\82¨\82É\82È\82Á\82Ä\8bÁ\82«\81C\93®\82¯\82È\82­\82È\82Á\82½\81D");
546     nomul(-3);
547 /*JP
548     multi_reason = "being frightened to death";
549 */
550     multi_reason = "\8e\80\82Ê\82Ù\82Ç\8bÁ\82¢\82½\8c\84\82É";
551 /*JP
552     nomovemsg = "You regain your composure.";
553 */
554     nomovemsg = "\82 \82È\82½\82Í\95½\90Ã\82ð\8eæ\82è\96ß\82µ\82½\81D";
555 }
556
557 /* "Quaffing is like drinking, except you spill more." - Terry Pratchett */
558 int
559 dodrink()
560 {
561     register struct obj *otmp;
562     const char *potion_descr;
563
564     if (Strangled) {
565 /*JP
566         pline("If you can't breathe air, how can you drink liquid?");
567 */
568         pline("\91§\82à\82Å\82«\82È\82¢\82Ì\82É\81C\82Ç\82¤\82â\82Á\82Ä\89t\91Ì\82ð\88ù\82Þ\82ñ\82¾\82¢\81H");
569         return 0;
570     }
571     /* Is there a fountain to drink from here? */
572     if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)
573         /* not as low as floor level but similar restrictions apply */
574         && can_reach_floor(FALSE)) {
575 /*JP
576         if (yn("Drink from the fountain?") == 'y') {
577 */
578         if (yn("\90ò\82Ì\90\85\82ð\88ù\82Ý\82Ü\82·\82©\81H") == 'y') {
579             drinkfountain();
580             return 1;
581         }
582     }
583     /* Or a kitchen sink? */
584     if (IS_SINK(levl[u.ux][u.uy].typ)
585         /* not as low as floor level but similar restrictions apply */
586         && can_reach_floor(FALSE)) {
587 /*JP
588         if (yn("Drink from the sink?") == 'y') {
589 */
590         if (yn("\97¬\82µ\91ä\82Ì\90\85\82ð\88ù\82Ý\82Ü\82·\82©\81H") == 'y') {
591             drinksink();
592             return 1;
593         }
594     }
595     /* Or are you surrounded by water? */
596     if (Underwater && !u.uswallow) {
597 /*JP
598         if (yn("Drink the water around you?") == 'y') {
599 */
600         if (yn("\82Ü\82í\82è\82Ì\90\85\82ð\88ù\82Ý\82Ü\82·\82©\81H") == 'y') {
601 /*JP
602             pline("Do you know what lives in this water?");
603 */
604             pline("\82±\82Ì\90\85\92\86\82Å\89½\82ª\90\82«\82Ä\82¢\82é\82Ì\82©\92m\82Á\82Ä\82é\82©\82¢\81H");
605             return 1;
606         }
607     }
608
609     otmp = getobj(beverages, "drink");
610     if (!otmp)
611         return 0;
612
613     /* quan > 1 used to be left to useup(), but we need to force
614        the current potion to be unworn, and don't want to do
615        that for the entire stack when starting with more than 1.
616        [Drinking a wielded potion of polymorph can trigger a shape
617        change which causes hero's weapon to be dropped.  In 3.4.x,
618        that led to an "object lost" panic since subsequent useup()
619        was no longer dealing with an inventory item.  Unwearing
620        the current potion is intended to keep it in inventory.] */
621     if (otmp->quan > 1L) {
622         otmp = splitobj(otmp, 1L);
623         otmp->owornmask = 0L; /* rest of original stuck unaffected */
624     } else if (otmp->owornmask) {
625         remove_worn_item(otmp, FALSE);
626     }
627     otmp->in_use = TRUE; /* you've opened the stopper */
628
629     potion_descr = OBJ_DESCR(objects[otmp->otyp]);
630     if (potion_descr) {
631 /*JP
632         if (!strcmp(potion_descr, "milky")
633 */
634         if (!strcmp(potion_descr, "\83~\83\8b\83N\90F\82Ì")
635             && !(mvitals[PM_GHOST].mvflags & G_GONE)
636             && !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_GHOST].born))) {
637             ghost_from_bottle();
638             useup(otmp);
639             return 1;
640 /*JP
641         } else if (!strcmp(potion_descr, "smoky")
642 */
643         } else if (!strcmp(potion_descr, "\89\8c\82ª\82Å\82Ä\82¢\82é")
644                    && !(mvitals[PM_DJINNI].mvflags & G_GONE)
645                    && !rn2(POTION_OCCUPANT_CHANCE(mvitals[PM_DJINNI].born))) {
646             djinni_from_bottle(otmp);
647             useup(otmp);
648             return 1;
649         }
650     }
651     return dopotion(otmp);
652 }
653
654 int
655 dopotion(otmp)
656 register struct obj *otmp;
657 {
658     int retval;
659
660     otmp->in_use = TRUE;
661     nothing = unkn = 0;
662     if ((retval = peffects(otmp)) >= 0)
663         return retval;
664
665     if (nothing) {
666         unkn++;
667 #if 0 /*JP*/
668         You("have a %s feeling for a moment, then it passes.",
669             Hallucination ? "normal" : "peculiar");
670 #else
671         You("%s\8bC\95ª\82É\82¨\82»\82í\82ê\82½\82ª\81C\82·\82®\82É\8fÁ\82¦\82³\82Á\82½\81D",
672             Hallucination ? "\95\81\92Ê\82Ì" : "\93Æ\93Á\82È");
673 #endif
674     }
675     if (otmp->dknown && !objects[otmp->otyp].oc_name_known) {
676         if (!unkn) {
677             makeknown(otmp->otyp);
678             more_experienced(0, 10);
679         } else if (!objects[otmp->otyp].oc_uname)
680             docall(otmp);
681     }
682     useup(otmp);
683     return 1;
684 }
685
686 int
687 peffects(otmp)
688 register struct obj *otmp;
689 {
690     register int i, ii, lim;
691
692     switch (otmp->otyp) {
693     case POT_RESTORE_ABILITY:
694     case SPE_RESTORE_ABILITY:
695         unkn++;
696         if (otmp->cursed) {
697 /*JP
698             pline("Ulch!  This makes you feel mediocre!");
699 */
700             pline("\82¤\81[\82ñ\81C\82Ç\82¤\82à\82³\82¦\82È\82¢\82È\82 \81D");
701             break;
702         } else {
703             /* unlike unicorn horn, overrides Fixed_abil */
704 #if 0 /*JP*/
705             pline("Wow!  This makes you feel %s!",
706                   (otmp->blessed)
707                       ? (unfixable_trouble_count(FALSE) ? "better" : "great")
708                       : "good");
709 #else
710             pline("\83\8f\81[\83I\81I\8bC\95ª\82ª%s\82È\82Á\82½\81I",
711                   (otmp->blessed)
712                       ? (unfixable_trouble_count(FALSE) ? "\82¾\82¢\82Ô\82æ\82­" : "\82Æ\82Ä\82à\82æ\82­")
713                       : "\82æ\82­");
714 #endif
715             i = rn2(A_MAX); /* start at a random point */
716             for (ii = 0; ii < A_MAX; ii++) {
717                 lim = AMAX(i);
718                 /* this used to adjust 'lim' for A_STR when u.uhs was
719                    WEAK or worse, but that's handled via ATEMP(A_STR) now */
720                 if (ABASE(i) < lim) {
721                     ABASE(i) = lim;
722                     context.botl = 1;
723                     /* only first found if not blessed */
724                     if (!otmp->blessed)
725                         break;
726                 }
727                 if (++i >= A_MAX)
728                     i = 0;
729             }
730
731             /* when using the potion (not the spell) also restore lost levels,
732                to make the potion more worth keeping around for players with
733                the spell or with a unihorn; this is better than full healing
734                in that it can restore all of them, not just half, and a
735                blessed potion restores them all at once */
736             if (otmp->otyp == POT_RESTORE_ABILITY &&
737                 u.ulevel < u.ulevelmax) {
738                 do {
739                     pluslvl(FALSE);
740                 } while (u.ulevel < u.ulevelmax && otmp->blessed);
741             }
742         }
743         break;
744     case POT_HALLUCINATION:
745         if (Hallucination || Halluc_resistance)
746             nothing++;
747         (void) make_hallucinated(
748             itimeout_incr(HHallucination, rn1(200, 600 - 300 * bcsign(otmp))),
749             TRUE, 0L);
750         break;
751     case POT_WATER:
752         if (!otmp->blessed && !otmp->cursed) {
753 /*JP
754             pline("This tastes like %s.", hliquid("water"));
755 */
756             pline("%s\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81D", hliquid("\90\85"));
757             u.uhunger += rnd(10);
758             newuhs(FALSE);
759             break;
760         }
761         unkn++;
762         if (is_undead(youmonst.data) || is_demon(youmonst.data)
763             || u.ualign.type == A_CHAOTIC) {
764             if (otmp->blessed) {
765 /*JP
766                 pline("This burns like %s!", hliquid("acid"));
767 */
768                 pline("%s\82Ì\82æ\82¤\82É\90ã\82ª\82Ð\82è\82Ð\82è\82·\82é\81I", hliquid("\8e_"));
769                 exercise(A_CON, FALSE);
770                 if (u.ulycn >= LOW_PM) {
771 /*JP
772                     Your("affinity to %s disappears!",
773 */
774                     Your("%s\82Ö\82Ì\90e\8bß\8a´\82Í\82È\82­\82È\82Á\82½\81I",
775                          makeplural(mons[u.ulycn].mname));
776                     if (youmonst.data == &mons[u.ulycn])
777                         you_unwere(FALSE);
778                     set_ulycn(NON_PM); /* cure lycanthropy */
779                 }
780 /*JP
781                 losehp(Maybe_Half_Phys(d(2, 6)), "potion of holy water",
782 */
783                 losehp(Maybe_Half_Phys(d(2, 6)), "\90¹\90\85\82Å",
784                        KILLED_BY_AN);
785             } else if (otmp->cursed) {
786 /*JP
787                 You_feel("quite proud of yourself.");
788 */
789                 You("\8e©\91¸\90S\82ð\8a´\82\82½\81D");
790                 healup(d(2, 6), 0, 0, 0);
791                 if (u.ulycn >= LOW_PM && !Upolyd)
792                     you_were();
793                 exercise(A_CON, TRUE);
794             }
795         } else {
796             if (otmp->blessed) {
797 /*JP
798                 You_feel("full of awe.");
799 */
800                 You("\88Ø\95|\82Ì\94O\82É\82©\82ç\82ê\82½\81D");
801                 make_sick(0L, (char *) 0, TRUE, SICK_ALL);
802                 exercise(A_WIS, TRUE);
803                 exercise(A_CON, TRUE);
804                 if (u.ulycn >= LOW_PM)
805                     you_unwere(TRUE); /* "Purified" */
806                 /* make_confused(0L, TRUE); */
807             } else {
808                 if (u.ualign.type == A_LAWFUL) {
809 /*JP
810                     pline("This burns like %s!", hliquid("acid"));
811 */
812                     pline("%s\82Ì\82æ\82¤\82É\90ã\82ª\82Ð\82è\82Ð\82è\82·\82é\81I", hliquid("\8e_"));
813 /*JP
814                     losehp(Maybe_Half_Phys(d(2, 6)), "potion of unholy water",
815 */
816                     losehp(Maybe_Half_Phys(d(2, 6)), "\95s\8fò\82È\90\85\82Å",
817                            KILLED_BY_AN);
818                 } else
819 /*JP
820                     You_feel("full of dread.");
821 */
822                     You("\8b°\95|\82Ì\94O\82É\82©\82ç\82ê\82½\81D");
823                 if (u.ulycn >= LOW_PM && !Upolyd)
824                     you_were();
825                 exercise(A_CON, FALSE);
826             }
827         }
828         break;
829     case POT_BOOZE:
830         unkn++;
831 #if 0 /*JP*/
832         pline("Ooph!  This tastes like %s%s!",
833               otmp->odiluted ? "watered down " : "",
834               Hallucination ? "dandelion wine" : "liquid fire");
835 #else
836         pline("\82¤\82¥\82Á\82Õ\81I\82±\82ê\82Í%s%s\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81I",
837               otmp->odiluted ? "\90\85\82Å\94\96\82ß\82½" : "",
838               Hallucination ? "\83^\83\93\83|\83|\83\8f\83C\83\93" : "\94R\97¿\83I\83C\83\8b");
839 #endif
840         if (!otmp->blessed)
841             make_confused(itimeout_incr(HConfusion, d(3, 8)), FALSE);
842         /* the whiskey makes us feel better */
843         if (!otmp->odiluted)
844             healup(1, 0, FALSE, FALSE);
845         u.uhunger += 10 * (2 + bcsign(otmp));
846         newuhs(FALSE);
847         exercise(A_WIS, FALSE);
848         if (otmp->cursed) {
849 /*JP
850             You("pass out.");
851 */
852             You("\8bC\90â\82µ\82½\81D");
853             multi = -rnd(15);
854 /*JP
855             nomovemsg = "You awake with a headache.";
856 */
857             nomovemsg = "\96Ú\82ª\82³\82ß\82½\82ª\93ª\92É\82ª\82·\82é\81D";
858         }
859         break;
860     case POT_ENLIGHTENMENT:
861         if (otmp->cursed) {
862             unkn++;
863 /*JP
864             You("have an uneasy feeling...");
865 */
866             You("\95s\88À\82È\8bC\8e\9d\82É\82È\82Á\82½\81D\81D\81D");
867             exercise(A_WIS, FALSE);
868         } else {
869             if (otmp->blessed) {
870                 (void) adjattrib(A_INT, 1, FALSE);
871                 (void) adjattrib(A_WIS, 1, FALSE);
872             }
873 /*JP
874             You_feel("self-knowledgeable...");
875 */
876             You("\8e©\95ª\8e©\90g\82ª\94»\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D\81D\81D");
877             display_nhwindow(WIN_MESSAGE, FALSE);
878             enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS);
879 /*JP
880             pline_The("feeling subsides.");
881 */
882             pline("\82»\82Ì\8a´\82\82Í\82È\82­\82È\82Á\82½\81D");
883             exercise(A_WIS, TRUE);
884         }
885         break;
886     case SPE_INVISIBILITY:
887         /* spell cannot penetrate mummy wrapping */
888         if (BInvis && uarmc->otyp == MUMMY_WRAPPING) {
889 /*JP
890             You_feel("rather itchy under %s.", yname(uarmc));
891 */
892             You("%s\82Ì\89º\82ª\83\80\83Y\83\80\83Y\82µ\82½\81D", xname(uarmc));
893             break;
894         }
895         /* FALLTHRU */
896     case POT_INVISIBILITY:
897         if (Invis || Blind || BInvis) {
898             nothing++;
899         } else {
900             self_invis_message();
901         }
902         if (otmp->blessed)
903             HInvis |= FROMOUTSIDE;
904         else
905             incr_itimeout(&HInvis, rn1(15, 31));
906         newsym(u.ux, u.uy); /* update position */
907         if (otmp->cursed) {
908 /*JP
909             pline("For some reason, you feel your presence is known.");
910 */
911             pline("\82È\82º\82©\81C\91\8dÝ\82ª\92m\82ç\82ê\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
912             aggravate();
913         }
914         break;
915     case POT_SEE_INVISIBLE: /* tastes like fruit juice in Rogue */
916     case POT_FRUIT_JUICE: {
917         int msg = Invisible && !Blind;
918
919         unkn++;
920         if (otmp->cursed)
921 #if 0 /*JP*/
922             pline("Yecch!  This tastes %s.",
923                   Hallucination ? "overripe" : "rotten");
924 #else
925             pline("\83I\83F\81[\81I\82±\82ê\82Í%s\83W\83\85\81[\83X\82Ì\96¡\82ª\82·\82é\81D",
926                   Hallucination ? "\8fn\82µ\82·\82¬\82½" : "\95\85\82Á\82½");
927 #endif
928         else
929 #if 0 /*JP*/
930             pline(
931                 Hallucination
932                     ? "This tastes like 10%% real %s%s all-natural beverage."
933                     : "This tastes like %s%s.",
934                 otmp->odiluted ? "reconstituted " : "", fruitname(TRUE));
935 #else
936             pline(
937                 Hallucination
938                     ? "10%%%s\82Ì\8f\83\8e©\91R\88ù\97¿\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81D"
939                     : "%s%s\83W\83\85\81[\83X\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81D",
940                 otmp->odiluted ? "\90¬\95ª\92²\90®\82³\82ê\82½" : "", fruitname(TRUE));
941 #endif
942         if (otmp->otyp == POT_FRUIT_JUICE) {
943             u.uhunger += (otmp->odiluted ? 5 : 10) * (2 + bcsign(otmp));
944             newuhs(FALSE);
945             break;
946         }
947         if (!otmp->cursed) {
948             /* Tell them they can see again immediately, which
949              * will help them identify the potion...
950              */
951             make_blinded(0L, TRUE);
952         }
953         if (otmp->blessed)
954             HSee_invisible |= FROMOUTSIDE;
955         else
956             incr_itimeout(&HSee_invisible, rn1(100, 750));
957         set_mimic_blocking(); /* do special mimic handling */
958         see_monsters();       /* see invisible monsters */
959         newsym(u.ux, u.uy);   /* see yourself! */
960         if (msg && !Blind) {  /* Blind possible if polymorphed */
961 /*JP
962             You("can see through yourself, but you are visible!");
963 */
964             You("\93§\96¾\82Å\82 \82é\81D\82µ\82©\82µ\8c©\82¦\82é\82æ\82¤\82É\82È\82Á\82½\81I");
965             unkn--;
966         }
967         break;
968     }
969     case POT_PARALYSIS:
970         if (Free_action) {
971 /*JP
972             You("stiffen momentarily.");
973 */
974             You("\88ê\8fu\93®\82¯\82È\82­\82È\82Á\82½\81D");
975         } else {
976             if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
977 /*JP
978                 You("are motionlessly suspended.");
979 */
980                 You("\8bó\92\86\82Å\93®\82¯\82È\82­\82È\82Á\82½\81D");
981             else if (u.usteed)
982 /*JP
983                 You("are frozen in place!");
984 */
985                 You("\82»\82Ì\8fê\82Å\93®\82¯\82È\82­\82È\82Á\82½\81I");
986             else
987 #if 0 /*JP*/
988                 Your("%s are frozen to the %s!", makeplural(body_part(FOOT)),
989                      surface(u.ux, u.uy));
990 #else
991                 You("\93®\82¯\82È\82­\82È\82Á\82½\81I");
992 #endif
993             nomul(-(rn1(10, 25 - 12 * bcsign(otmp))));
994 /*JP
995             multi_reason = "frozen by a potion";
996 */
997             multi_reason = "\96ò\82Å\8dd\92¼\82µ\82Ä\82¢\82é\8e\9e\82É";
998             nomovemsg = You_can_move_again;
999             exercise(A_DEX, FALSE);
1000         }
1001         break;
1002     case POT_SLEEPING:
1003         if (Sleep_resistance || Free_action) {
1004 /*JP
1005             You("yawn.");
1006 */
1007             You("\82 \82­\82Ñ\82ð\82µ\82½\81D");
1008         } else {
1009 /*JP
1010             You("suddenly fall asleep!");
1011 */
1012             pline("\93Ë\91R\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81I");
1013             fall_asleep(-rn1(10, 25 - 12 * bcsign(otmp)), TRUE);
1014         }
1015         break;
1016     case POT_MONSTER_DETECTION:
1017     case SPE_DETECT_MONSTERS:
1018         if (otmp->blessed) {
1019             int x, y;
1020
1021             if (Detect_monsters)
1022                 nothing++;
1023             unkn++;
1024             /* after a while, repeated uses become less effective */
1025             if ((HDetect_monsters & TIMEOUT) >= 300L)
1026                 i = 1;
1027             else
1028                 i = rn1(40, 21);
1029             incr_itimeout(&HDetect_monsters, i);
1030             for (x = 1; x < COLNO; x++) {
1031                 for (y = 0; y < ROWNO; y++) {
1032                     if (levl[x][y].glyph == GLYPH_INVISIBLE) {
1033                         unmap_object(x, y);
1034                         newsym(x, y);
1035                     }
1036                     if (MON_AT(x, y))
1037                         unkn = 0;
1038                 }
1039             }
1040             see_monsters();
1041             if (unkn)
1042 /*JP
1043                 You_feel("lonely.");
1044 */
1045                 You("\90S\8d×\82­\82È\82Á\82½\81D");
1046             break;
1047         }
1048         if (monster_detect(otmp, 0))
1049             return 1; /* nothing detected */
1050         exercise(A_WIS, TRUE);
1051         break;
1052     case POT_OBJECT_DETECTION:
1053     case SPE_DETECT_TREASURE:
1054         if (object_detect(otmp, 0))
1055             return 1; /* nothing detected */
1056         exercise(A_WIS, TRUE);
1057         break;
1058     case POT_SICKNESS:
1059 /*JP
1060         pline("Yecch!  This stuff tastes like poison.");
1061 */
1062         pline("\83E\83F\81[\81I\93Å\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81D");
1063         if (otmp->blessed) {
1064 /*JP
1065             pline("(But in fact it was mildly stale %s.)", fruitname(TRUE));
1066 */
1067             pline("(\82µ\82©\82µ\8eÀ\8dÛ\82»\82ê\82Í\8f­\82µ\8cÃ\82­\82È\82Á\82½%s\81D)", fruitname(TRUE));
1068             if (!Role_if(PM_HEALER)) {
1069                 /* NB: blessed otmp->fromsink is not possible */
1070 /*JP
1071                 losehp(1, "mildly contaminated potion", KILLED_BY_AN);
1072 */
1073                 losehp(1, "\95a\8bC\82É\89\98\90õ\82³\82ê\82½\96ò\82Å", KILLED_BY_AN);
1074             }
1075         } else {
1076             if (Poison_resistance)
1077 /*JP
1078                 pline("(But in fact it was biologically contaminated %s.)",
1079 */
1080                 pline("(\82µ\82©\82µ\8eÀ\8dÛ\82»\82ê\82Í\90\95¨\8aw\93I\82É\89\98\90õ\82³\82ê\82½%s\82¾\81D)",
1081                       fruitname(TRUE));
1082             if (Role_if(PM_HEALER)) {
1083 /*JP
1084                 pline("Fortunately, you have been immunized.");
1085 */
1086                 pline("\8dK\89^\82È\82±\82Æ\82É\81C\82 \82È\82½\82Í\96Æ\89u\82ª\82 \82é\81D");
1087             } else {
1088                 char contaminant[BUFSZ];
1089                 int typ = rn2(A_MAX);
1090
1091 #if 0 /*JP*/
1092                 Sprintf(contaminant, "%s%s",
1093                         (Poison_resistance) ? "mildly " : "",
1094                         (otmp->fromsink) ? "contaminated tap water"
1095                                          : "contaminated potion");
1096 #else
1097                 Sprintf(contaminant, "%s\89\98\90õ\82³\82ê\82½%s\82Å",
1098                         (Poison_resistance) ? "\8f­\82µ" : "",
1099                         (otmp->fromsink) ? "\90\85"
1100                                          : "\96ò");
1101 #endif
1102                 if (!Fixed_abil) {
1103                     poisontell(typ, FALSE);
1104                     (void) adjattrib(typ, Poison_resistance ? -1 : -rn1(4, 3),
1105                                      1);
1106                 }
1107                 if (!Poison_resistance) {
1108                     if (otmp->fromsink)
1109                         losehp(rnd(10) + 5 * !!(otmp->cursed), contaminant,
1110                                KILLED_BY);
1111                     else
1112                         losehp(rnd(10) + 5 * !!(otmp->cursed), contaminant,
1113                                KILLED_BY_AN);
1114                 } else {
1115                     /* rnd loss is so that unblessed poorer than blessed */
1116                     losehp(1 + rn2(2), contaminant,
1117                            (otmp->fromsink) ? KILLED_BY : KILLED_BY_AN);
1118                 }
1119                 exercise(A_CON, FALSE);
1120             }
1121         }
1122         if (Hallucination) {
1123 /*JP
1124             You("are shocked back to your senses!");
1125 */
1126             You("\8cÜ\8a´\82É\8fÕ\8c\82\82ð\8eó\82¯\82½\81I");
1127             (void) make_hallucinated(0L, FALSE, 0L);
1128         }
1129         break;
1130     case POT_CONFUSION:
1131         if (!Confusion) {
1132             if (Hallucination) {
1133 /*JP
1134                 pline("What a trippy feeling!");
1135 */
1136                 pline("\82È\82ñ\82©\83w\83\8d\83w\83\8d\82·\82é\81I");
1137                 unkn++;
1138             } else
1139 /*JP
1140                 pline("Huh, What?  Where am I?");
1141 */
1142                 pline("\82Ù\82¦\81H\8e\84\82Í\92N\81H");
1143         } else
1144             nothing++;
1145         make_confused(itimeout_incr(HConfusion,
1146                                     rn1(7, 16 - 8 * bcsign(otmp))),
1147                       FALSE);
1148         break;
1149     case POT_GAIN_ABILITY:
1150         if (otmp->cursed) {
1151 /*JP
1152             pline("Ulch!  That potion tasted foul!");
1153 */
1154             pline("\83E\83F\81I\88«\8fL\82ª\82·\82é\81I");
1155             unkn++;
1156         } else if (Fixed_abil) {
1157             nothing++;
1158         } else {      /* If blessed, increase all; if not, try up to */
1159             int itmp; /* 6 times to find one which can be increased. */
1160
1161             i = -1;   /* increment to 0 */
1162             for (ii = A_MAX; ii > 0; ii--) {
1163                 i = (otmp->blessed ? i + 1 : rn2(A_MAX));
1164                 /* only give "your X is already as high as it can get"
1165                    message on last attempt (except blessed potions) */
1166                 itmp = (otmp->blessed || ii == 1) ? 0 : -1;
1167                 if (adjattrib(i, 1, itmp) && !otmp->blessed)
1168                     break;
1169             }
1170         }
1171         break;
1172     case POT_SPEED:
1173         if (Wounded_legs && !otmp->cursed && !u.usteed) {
1174             /* heal_legs() would heal steeds legs */
1175             heal_legs();
1176             unkn++;
1177             break;
1178         }
1179         /* FALLTHRU */
1180     case SPE_HASTE_SELF:
1181         if (!Very_fast) { /* wwf@doe.carleton.ca */
1182 /*JP
1183             You("are suddenly moving %sfaster.", Fast ? "" : "much ");
1184 */
1185             You("\93Ë\91R%s\91¬\82­\88Ú\93®\82Å\82«\82é\82æ\82¤\82É\82È\82Á\82½\81D", Fast ? "" : "\82Æ\82Ä\82à");
1186         } else {
1187 /*JP
1188             Your("%s get new energy.", makeplural(body_part(LEG)));
1189 */
1190             pline("%s\82É\83G\83l\83\8b\83M\81[\82ª\92\8d\82¬\82±\82Ü\82ê\82é\82æ\82¤\82È\8a´\82\82ª\82µ\82½\81D", body_part(LEG));
1191             unkn++;
1192         }
1193         exercise(A_DEX, TRUE);
1194         incr_itimeout(&HFast, rn1(10, 100 + 60 * bcsign(otmp)));
1195         break;
1196     case POT_BLINDNESS:
1197         if (Blind)
1198             nothing++;
1199         make_blinded(itimeout_incr(Blinded,
1200                                    rn1(200, 250 - 125 * bcsign(otmp))),
1201                      (boolean) !Blind);
1202         break;
1203     case POT_GAIN_LEVEL:
1204         if (otmp->cursed) {
1205             unkn++;
1206             /* they went up a level */
1207             if ((ledger_no(&u.uz) == 1 && u.uhave.amulet)
1208                 || Can_rise_up(u.ux, u.uy, &u.uz)) {
1209 /*JP
1210                 const char *riseup = "rise up, through the %s!";
1211 */
1212                 const char *riseup ="%s\82ð\93Ë\82«\94²\82¯\82½\81I";
1213
1214                 if (ledger_no(&u.uz) == 1) {
1215                     You(riseup, ceiling(u.ux, u.uy));
1216                     goto_level(&earth_level, FALSE, FALSE, FALSE);
1217                 } else {
1218                     register int newlev = depth(&u.uz) - 1;
1219                     d_level newlevel;
1220
1221                     get_level(&newlevel, newlev);
1222                     if (on_level(&newlevel, &u.uz)) {
1223 /*JP
1224                         pline("It tasted bad.");
1225 */
1226                         pline("\82Æ\82Ä\82à\82Ü\82¸\82¢\81D");
1227                         break;
1228                     } else
1229                         You(riseup, ceiling(u.ux, u.uy));
1230                     goto_level(&newlevel, FALSE, FALSE, FALSE);
1231                 }
1232             } else
1233 /*JP
1234                 You("have an uneasy feeling.");
1235 */
1236                 You("\95s\88À\82È\8bC\8e\9d\82É\82È\82Á\82½\81D");
1237             break;
1238         }
1239         pluslvl(FALSE);
1240         /* blessed potions place you at a random spot in the
1241            middle of the new level instead of the low point */
1242         if (otmp->blessed)
1243             u.uexp = rndexp(TRUE);
1244         break;
1245     case POT_HEALING:
1246 /*JP
1247         You_feel("better.");
1248 */
1249         You("\8bC\95ª\82ª\82æ\82­\82È\82Á\82½\81D");
1250         healup(d(6 + 2 * bcsign(otmp), 4), !otmp->cursed ? 1 : 0,
1251                !!otmp->blessed, !otmp->cursed);
1252         exercise(A_CON, TRUE);
1253         break;
1254     case POT_EXTRA_HEALING:
1255 /*JP
1256         You_feel("much better.");
1257 */
1258         You("\8bC\95ª\82ª\82Æ\82Ä\82à\82æ\82­\82È\82Á\82½\81D");
1259         healup(d(6 + 2 * bcsign(otmp), 8),
1260                otmp->blessed ? 5 : !otmp->cursed ? 2 : 0, !otmp->cursed,
1261                TRUE);
1262         (void) make_hallucinated(0L, TRUE, 0L);
1263         exercise(A_CON, TRUE);
1264         exercise(A_STR, TRUE);
1265         break;
1266     case POT_FULL_HEALING:
1267 /*JP
1268         You_feel("completely healed.");
1269 */
1270         You("\8a®\91S\82É\89ñ\95\9c\82µ\82½\81D");
1271         healup(400, 4 + 4 * bcsign(otmp), !otmp->cursed, TRUE);
1272         /* Restore one lost level if blessed */
1273         if (otmp->blessed && u.ulevel < u.ulevelmax) {
1274             /* when multiple levels have been lost, drinking
1275                multiple potions will only get half of them back */
1276             u.ulevelmax -= 1;
1277             pluslvl(FALSE);
1278         }
1279         (void) make_hallucinated(0L, TRUE, 0L);
1280         exercise(A_STR, TRUE);
1281         exercise(A_CON, TRUE);
1282         break;
1283     case POT_LEVITATION:
1284     case SPE_LEVITATION:
1285         /*
1286          * BLevitation will be set if levitation is blocked due to being
1287          * inside rock (currently or formerly in phazing xorn form, perhaps)
1288          * but it doesn't prevent setting or incrementing Levitation timeout
1289          * (which will take effect after escaping from the rock if it hasn't
1290          * expired by then).
1291          */
1292         if (!Levitation && !BLevitation) {
1293             /* kludge to ensure proper operation of float_up() */
1294             set_itimeout(&HLevitation, 1L);
1295             float_up();
1296             /* This used to set timeout back to 0, then increment it below
1297                for blessed and uncursed effects.  But now we leave it so
1298                that cursed effect yields "you float down" on next turn.
1299                Blessed and uncursed get one extra turn duration. */
1300         } else /* already levitating, or can't levitate */
1301             nothing++;
1302
1303         if (otmp->cursed) {
1304             /* 'already levitating' used to block the cursed effect(s)
1305                aside from ~I_SPECIAL; it was not clear whether that was
1306                intentional; either way, it no longer does (as of 3.6.1) */
1307             HLevitation &= ~I_SPECIAL; /* can't descend upon demand */
1308             if (BLevitation) {
1309                 ; /* rising via levitation is blocked */
1310             } else if ((u.ux == xupstair && u.uy == yupstair)
1311                     || (sstairs.up && u.ux == sstairs.sx && u.uy == sstairs.sy)
1312                     || (xupladder && u.ux == xupladder && u.uy == yupladder)) {
1313                 (void) doup();
1314                 /* in case we're already Levitating, which would have
1315                    resulted in incrementing 'nothing' */
1316                 nothing = 0; /* not nothing after all */
1317             } else if (has_ceiling(&u.uz)) {
1318                 int dmg = rnd(!uarmh ? 10 : !is_metallic(uarmh) ? 6 : 3);
1319
1320 #if 0 /*JP:T*/
1321                 You("hit your %s on the %s.", body_part(HEAD),
1322                     ceiling(u.ux, u.uy));
1323 #else
1324                 You("%s\82ð%s\82É\82Ô\82Â\82¯\82½\81D", body_part(HEAD),
1325                     ceiling(u.ux,u.uy));
1326 #endif
1327 /*JP
1328                     losehp(Maybe_Half_Phys(dmg), "colliding with the ceiling",
1329 */
1330                     losehp(Maybe_Half_Phys(dmg), "\93V\88ä\82É\93ª\82ð\82Ô\82Â\82¯\82Ä",
1331                        KILLED_BY);
1332                 nothing = 0; /* not nothing after all */
1333             }
1334         } else if (otmp->blessed) {
1335             /* at this point, timeout is already at least 1 */
1336             incr_itimeout(&HLevitation, rn1(50, 250));
1337             /* can descend at will (stop levitating via '>') provided timeout
1338                is the only factor (ie, not also wearing Lev ring or boots) */
1339             HLevitation |= I_SPECIAL;
1340         } else /* timeout is already at least 1 */
1341             incr_itimeout(&HLevitation, rn1(140, 10));
1342
1343         if (Levitation && IS_SINK(levl[u.ux][u.uy].typ))
1344             spoteffects(FALSE);
1345         /* levitating blocks flying */
1346         float_vs_flight();
1347         break;
1348     case POT_GAIN_ENERGY: { /* M. Stephenson */
1349         int num;
1350
1351         if (otmp->cursed)
1352 /*JP
1353             You_feel("lackluster.");
1354 */
1355             You("\88Ó\8bC\8fÁ\92¾\82µ\82½\81D");
1356         else
1357 /*JP
1358             pline("Magical energies course through your body.");
1359 */
1360             pline("\96\82\96@\82Ì\83G\83l\83\8b\83M\81[\82ª\82 \82È\82½\82Ì\91Ì\82É\96\9e\82¿\82½\81D");
1361
1362         /* old: num = rnd(5) + 5 * otmp->blessed + 1;
1363          *      blessed:  +7..11 max & current (+9 avg)
1364          *      uncursed: +2.. 6 max & current (+4 avg)
1365          *      cursed:   -2.. 6 max & current (-4 avg)
1366          * new: (3.6.0)
1367          *      blessed:  +3..18 max (+10.5 avg), +9..54 current (+31.5 avg)
1368          *      uncursed: +2..12 max (+ 7   avg), +6..36 current (+21   avg)
1369          *      cursed:   -1.. 6 max (- 3.5 avg), -3..18 current (-10.5 avg)
1370          */
1371         num = d(otmp->blessed ? 3 : !otmp->cursed ? 2 : 1, 6);
1372         if (otmp->cursed)
1373             num = -num; /* subtract instead of add when cursed */
1374         u.uenmax += num;
1375         if (u.uenmax <= 0)
1376             u.uenmax = 0;
1377         u.uen += 3 * num;
1378         if (u.uen > u.uenmax)
1379             u.uen = u.uenmax;
1380         else if (u.uen <= 0)
1381             u.uen = 0;
1382         context.botl = 1;
1383         exercise(A_WIS, TRUE);
1384         break;
1385     }
1386     case POT_OIL: { /* P. Winner */
1387         boolean good_for_you = FALSE;
1388
1389         if (otmp->lamplit) {
1390             if (likes_fire(youmonst.data)) {
1391 /*JP
1392                 pline("Ahh, a refreshing drink.");
1393 */
1394                 pline("\82í\81[\82¨\81C\90\82«\95Ô\82é\81D");
1395                 good_for_you = TRUE;
1396             } else {
1397 /*JP
1398                 You("burn your %s.", body_part(FACE));
1399 */
1400                 Your("%s\82Í\8d\95\8fÅ\82°\82É\82È\82Á\82½\81D", body_part(FACE));
1401                 /* fire damage */
1402 /*JP
1403                 losehp(d(Fire_resistance ? 1 : 3, 4), "burning potion of oil",
1404 */
1405                 losehp(d(Fire_resistance ? 1 : 3, 4), "\94R\82¦\82Ä\82¢\82é\96û\82ð\88ù\82ñ\82Å",
1406                        KILLED_BY_AN);
1407             }
1408         } else if (otmp->cursed)
1409 /*JP
1410             pline("This tastes like castor oil.");
1411 */
1412             pline("\82Ð\82Ü\82µ\96û\82Ì\82æ\82¤\82È\96¡\82ª\82·\82é\81D");
1413         else
1414 /*JP
1415             pline("That was smooth!");
1416 */
1417             pline("\8cû\82 \82½\82è\82ª\82æ\82¢\81I");
1418         exercise(A_WIS, good_for_you);
1419         break;
1420     }
1421     case POT_ACID:
1422         if (Acid_resistance) {
1423             /* Not necessarily a creature who _likes_ acid */
1424 /*JP
1425             pline("This tastes %s.", Hallucination ? "tangy" : "sour");
1426 */
1427             pline("%s\96¡\82ª\82·\82é\81D", Hallucination ? "\82Ò\82è\82Á\82Æ\82µ\82½" : "\8e_\82Ì");
1428         } else {
1429             int dmg;
1430
1431 #if 0 /*JP*/
1432             pline("This burns%s!",
1433                   otmp->blessed ? " a little" : otmp->cursed ? " a lot"
1434                                                              : " like acid");
1435 #else
1436             pline("%s\8fÅ\82°\82½\81I",
1437                   otmp->blessed ? "\8f­\82µ" : otmp->cursed ? "\82·\82²\82­"
1438                                                         : "");
1439 #endif
1440             dmg = d(otmp->cursed ? 2 : 1, otmp->blessed ? 4 : 8);
1441 /*JP
1442             losehp(Maybe_Half_Phys(dmg), "potion of acid", KILLED_BY_AN);
1443 */
1444             losehp(Maybe_Half_Phys(dmg), "\8e_\82Ì\96ò\82ð\88ù\82ñ\82Å", KILLED_BY_AN);
1445             exercise(A_CON, FALSE);
1446         }
1447         if (Stoned)
1448             fix_petrification();
1449         unkn++; /* holy/unholy water can burn like acid too */
1450         break;
1451     case POT_POLYMORPH:
1452 /*JP
1453         You_feel("a little %s.", Hallucination ? "normal" : "strange");
1454 */
1455         You("\8f­\82µ%s\82È\8a´\82\82ª\82µ\82½\81D", Hallucination ? "\95\81\92Ê" : "\95Ï");
1456         if (!Unchanging)
1457             polyself(0);
1458         break;
1459     default:
1460         impossible("What a funny potion! (%u)", otmp->otyp);
1461         return 0;
1462     }
1463     return -1;
1464 }
1465
1466 #ifdef  JPEXTENSION
1467 void
1468 make_totter(xtime, talk)
1469 long xtime;     /* nonzero if this is an attempt to turn on hallucination */
1470 boolean talk;
1471 {
1472         const char *message = 0;
1473
1474         if (!xtime)
1475             message = "\95û\8cü\8a´\8ao\82ª\90³\8fí\82É\82È\82Á\82½\81D";
1476         else
1477             message = "\95û\8cü\8a´\8ao\82ª\96\83á\83\82µ\82½\81D";
1478
1479         set_itimeout(&Totter, xtime);
1480         pline(message);
1481 }
1482 #endif
1483
1484 void
1485 healup(nhp, nxtra, curesick, cureblind)
1486 int nhp, nxtra;
1487 register boolean curesick, cureblind;
1488 {
1489     if (nhp) {
1490         if (Upolyd) {
1491             u.mh += nhp;
1492             if (u.mh > u.mhmax)
1493                 u.mh = (u.mhmax += nxtra);
1494         } else {
1495             u.uhp += nhp;
1496             if (u.uhp > u.uhpmax)
1497                 u.uhp = (u.uhpmax += nxtra);
1498         }
1499     }
1500     if (cureblind) {
1501         /* 3.6.1: it's debatible whether healing magic should clean off
1502            mundane 'dirt', but if it doesn't, blindness isn't cured */
1503         u.ucreamed = 0;
1504         make_blinded(0L, TRUE);
1505     }
1506     if (curesick) {
1507         make_vomiting(0L, TRUE);
1508         make_sick(0L, (char *) 0, TRUE, SICK_ALL);
1509     }
1510     context.botl = 1;
1511     return;
1512 }
1513
1514 void
1515 strange_feeling(obj, txt)
1516 struct obj *obj;
1517 const char *txt;
1518 {
1519     if (flags.beginner || !txt)
1520 #if 0 /*JP*/
1521         You("have a %s feeling for a moment, then it passes.",
1522             Hallucination ? "normal" : "strange");
1523 #else
1524         You("%s\8bC\95ª\82É\82¨\82»\82í\82ê\82½\82ª\81C\82·\82®\82É\8fÁ\82¦\82³\82Á\82½\81D",
1525             Hallucination ? "\95\81\92Ê\82Ì" : "\8aï\96­\82È");
1526 #endif
1527     else
1528         pline1(txt);
1529
1530     if (!obj) /* e.g., crystal ball finds no traps */
1531         return;
1532
1533     if (obj->dknown && !objects[obj->otyp].oc_name_known
1534         && !objects[obj->otyp].oc_uname)
1535         docall(obj);
1536
1537     useup(obj);
1538 }
1539
1540 #if 0 /*JP*/
1541 const char *bottlenames[] = { "bottle", "phial", "flagon", "carafe",
1542                               "flask",  "jar",   "vial" };
1543 #else
1544 const char *bottlenames[] = { "\95r", "àÞ\97\9e\95r", "\88ê\8f¡\95r", "\90\85\8d·\82µ",
1545                               "\83t\83\89\83X\83R", "\92Ù", "\83K\83\89\83X\95r" };
1546 #endif
1547
1548 const char *
1549 bottlename()
1550 {
1551     return bottlenames[rn2(SIZE(bottlenames))];
1552 }
1553
1554 /* handle item dipped into water potion or steed saddle splashed by same */
1555 STATIC_OVL boolean
1556 H2Opotion_dip(potion, targobj, useeit, objphrase)
1557 struct obj *potion, *targobj;
1558 boolean useeit;
1559 const char *objphrase; /* "Your widget glows" or "Steed's saddle glows" */
1560 {
1561     void FDECL((*func), (OBJ_P)) = 0;
1562     const char *glowcolor = 0;
1563 #define COST_alter (-2)
1564 #define COST_none (-1)
1565     int costchange = COST_none;
1566     boolean altfmt = FALSE, res = FALSE;
1567
1568     if (!potion || potion->otyp != POT_WATER)
1569         return FALSE;
1570
1571     if (potion->blessed) {
1572         if (targobj->cursed) {
1573             func = uncurse;
1574             glowcolor = NH_AMBER;
1575             costchange = COST_UNCURS;
1576         } else if (!targobj->blessed) {
1577             func = bless;
1578             glowcolor = NH_LIGHT_BLUE;
1579             costchange = COST_alter;
1580             altfmt = TRUE; /* "with a <color> aura" */
1581         }
1582     } else if (potion->cursed) {
1583         if (targobj->blessed) {
1584             func = unbless;
1585 /*JP
1586             glowcolor = "brown";
1587 */
1588             glowcolor = "\92\83\90F\82Ì";
1589             costchange = COST_UNBLSS;
1590         } else if (!targobj->cursed) {
1591             func = curse;
1592             glowcolor = NH_BLACK;
1593             costchange = COST_alter;
1594             altfmt = TRUE;
1595         }
1596     } else {
1597         /* dipping into uncursed water; carried() check skips steed saddle */
1598         if (carried(targobj)) {
1599             if (water_damage(targobj, 0, TRUE) != ER_NOTHING)
1600                 res = TRUE;
1601         }
1602     }
1603     if (func) {
1604         /* give feedback before altering the target object;
1605            this used to set obj->bknown even when not seeing
1606            the effect; now hero has to see the glow, and bknown
1607            is cleared instead of set if perception is distorted */
1608         if (useeit) {
1609             glowcolor = hcolor(glowcolor);
1610             /*JP:3.6.0\8e\9e\93_\82Å\82Í\93®\8e\8c\82Í"glow"\82¾\82¯\82È\82Ì\82Å\8c\88\82ß\8c\82\82¿*/
1611             if (altfmt)
1612 #if 0 /*JP*/
1613                 pline("%s with %s aura.", objphrase, an(glowcolor));
1614 #else
1615                 pline("%s\82Í%s\83I\81[\83\89\82É\82Â\82Â\82Ü\82ê\82½\81D", objphrase, glowcolor);
1616 #endif
1617             else
1618 #if 0 /*JP*/
1619                 pline("%s %s.", objphrase, glowcolor);
1620 #else
1621                 pline("%s\82Í%s\8bP\82¢\82½\81D", objphrase, jconj_adj(glowcolor));
1622 #endif
1623             iflags.last_msg = PLNMSG_OBJ_GLOWS;
1624             targobj->bknown = !Hallucination;
1625         }
1626         /* potions of water are the only shop goods whose price depends
1627            on their curse/bless state */
1628         if (targobj->unpaid && targobj->otyp == POT_WATER) {
1629             if (costchange == COST_alter)
1630                 /* added blessing or cursing; update shop
1631                    bill to reflect item's new higher price */
1632                 alter_cost(targobj, 0L);
1633             else if (costchange != COST_none)
1634                 /* removed blessing or cursing; you
1635                    degraded it, now you'll have to buy it... */
1636                 costly_alteration(targobj, costchange);
1637         }
1638         /* finally, change curse/bless state */
1639         (*func)(targobj);
1640         res = TRUE;
1641     }
1642     return res;
1643 }
1644
1645 /* potion obj hits monster mon, which might be youmonst; obj always used up */
1646 void
1647 potionhit(mon, obj, how)
1648 struct monst *mon;
1649 struct obj *obj;
1650 int how;
1651 {
1652     const char *botlnam = bottlename();
1653     boolean isyou = (mon == &youmonst);
1654     int distance, tx, ty;
1655     struct obj *saddle = (struct obj *) 0;
1656     boolean hit_saddle = FALSE, your_fault = (how <= POTHIT_HERO_THROW);
1657
1658     if (isyou) {
1659         tx = u.ux, ty = u.uy;
1660         distance = 0;
1661 #if 0 /*JP:T*/
1662         pline_The("%s crashes on your %s and breaks into shards.", botlnam,
1663                   body_part(HEAD));
1664 #else
1665         pline("%s\82ª\82 \82È\82½\82Ì%s\82Ì\8fã\82Å\89ó\82ê\94j\95Ð\82Æ\82È\82Á\82½\81D", botlnam,
1666                   body_part(HEAD));
1667 #endif
1668 #if 0 /*JP*/
1669         losehp(Maybe_Half_Phys(rnd(2)),
1670                (how == POTHIT_OTHER_THROW) ? "propelled potion" /* scatter */
1671                                            : "thrown potion",
1672                KILLED_BY_AN);
1673 #else /*\82Ç\82¿\82ç\82à\81u\93\8a\82°\82ç\82ê\82½\81v\82Å\82æ\82¢*/
1674         losehp(Maybe_Half_Phys(rnd(2)), "\93\8a\82°\82ç\82ê\82½\96ò\82Å", KILLED_BY_AN);
1675 #endif
1676     } else {
1677         tx = mon->mx, ty = mon->my;
1678         /* sometimes it hits the saddle */
1679         if (((mon->misc_worn_check & W_SADDLE)
1680              && (saddle = which_armor(mon, W_SADDLE)))
1681             && (!rn2(10)
1682                 || (obj->otyp == POT_WATER
1683                     && ((rnl(10) > 7 && obj->cursed)
1684                         || (rnl(10) < 4 && obj->blessed) || !rn2(3)))))
1685             hit_saddle = TRUE;
1686         distance = distu(tx, ty);
1687         if (!cansee(tx, ty)) {
1688 /*JP
1689             pline("Crash!");
1690 */
1691             pline("\83K\83V\83\83\83\93\81I");
1692         } else {
1693             char *mnam = mon_nam(mon);
1694             char buf[BUFSZ];
1695
1696             if (hit_saddle && saddle) {
1697 #if 0 /*JP*/
1698                 Sprintf(buf, "%s saddle",
1699                         s_suffix(x_monnam(mon, ARTICLE_THE, (char *) 0,
1700                                           (SUPPRESS_IT | SUPPRESS_SADDLE),
1701                                           FALSE)));
1702 #else
1703                 Sprintf(buf, "%s\82Ì\88Æ",
1704                         x_monnam(mon, ARTICLE_THE, (char *) 0,
1705                                           (SUPPRESS_IT | SUPPRESS_SADDLE),
1706                                           FALSE));
1707 #endif
1708             } else if (has_head(mon->data)) {
1709 #if 0 /*JP*/
1710                 Sprintf(buf, "%s %s", s_suffix(mnam),
1711                         (notonhead ? "body" : "head"));
1712 #else
1713                 Sprintf(buf, "%s\82Ì%s", mnam,
1714                         (notonhead ? "\91Ì" : "\93ª"));
1715 #endif
1716             } else {
1717                 Strcpy(buf, mnam);
1718             }
1719 #if 0 /*JP*/
1720             pline_The("%s crashes on %s and breaks into shards.", botlnam,
1721                       buf);
1722 #else
1723             pline("%s\82ª%s\82Ì\8fã\82Å\89ó\82ê\94j\95Ð\82Æ\82È\82Á\82½\81D", botlnam,
1724                       buf);
1725 #endif
1726         }
1727         if (rn2(5) && mon->mhp > 1 && !hit_saddle)
1728             mon->mhp--;
1729     }
1730
1731     /* oil doesn't instantly evaporate; Neither does a saddle hit */
1732     if (obj->otyp != POT_OIL && !hit_saddle && cansee(tx, ty))
1733 /*JP
1734         pline("%s.", Tobjnam(obj, "evaporate"));
1735 */
1736         pline("%s\82Í\8fö\94­\82µ\82½\81D", xname(obj));
1737
1738     if (isyou) {
1739         switch (obj->otyp) {
1740         case POT_OIL:
1741             if (obj->lamplit)
1742                 explode_oil(obj, u.ux, u.uy);
1743             break;
1744         case POT_POLYMORPH:
1745 /*JP
1746             You_feel("a little %s.", Hallucination ? "normal" : "strange");
1747 */
1748             You("%s\82È\8a´\82\82ª\82µ\82½\81D", Hallucination ? "\95\81\92Ê" : "\95Ï");
1749             if (!Unchanging && !Antimagic)
1750                 polyself(0);
1751             break;
1752         case POT_ACID:
1753             if (!Acid_resistance) {
1754                 int dmg;
1755
1756 #if 0 /*JP:T*/
1757                 pline("This burns%s!",
1758                       obj->blessed ? " a little"
1759                                    : obj->cursed ? " a lot" : "");
1760 #else
1761                 pline("%s\94R\82¦\82½\81I",
1762                       obj->blessed ? "\8f­\82µ"
1763                                    : obj->cursed ? "\82Í\82°\82µ\82­" : "");
1764 #endif
1765                 dmg = d(obj->cursed ? 2 : 1, obj->blessed ? 4 : 8);
1766 /*JP
1767                 losehp(Maybe_Half_Phys(dmg), "potion of acid", KILLED_BY_AN);
1768 */
1769                 losehp(Maybe_Half_Phys(dmg), "\8e_\82Ì\96ò\82ð\97\81\82Ñ\82Ä", KILLED_BY_AN);
1770             }
1771             break;
1772         }
1773     } else if (hit_saddle && saddle) {
1774         char *mnam, buf[BUFSZ], saddle_glows[BUFSZ];
1775         boolean affected = FALSE;
1776         boolean useeit = !Blind && canseemon(mon) && cansee(tx, ty);
1777
1778         mnam = x_monnam(mon, ARTICLE_THE, (char *) 0,
1779                         (SUPPRESS_IT | SUPPRESS_SADDLE), FALSE);
1780         Sprintf(buf, "%s", upstart(s_suffix(mnam)));
1781
1782         switch (obj->otyp) {
1783         case POT_WATER:
1784 /*JP
1785             Sprintf(saddle_glows, "%s %s", buf, aobjnam(saddle, "glow"));
1786 */
1787             Sprintf(saddle_glows, "%s", buf);
1788             affected = H2Opotion_dip(obj, saddle, useeit, saddle_glows);
1789             break;
1790         case POT_POLYMORPH:
1791             /* Do we allow the saddle to polymorph? */
1792             break;
1793         }
1794         if (useeit && !affected)
1795 /*JP
1796             pline("%s %s wet.", buf, aobjnam(saddle, "get"));
1797 */
1798             pline("%s\82Í\94G\82ê\82½\81D", buf);
1799     } else {
1800         boolean angermon = your_fault, cureblind = FALSE;
1801
1802         switch (obj->otyp) {
1803         case POT_FULL_HEALING:
1804             cureblind = TRUE;
1805             /*FALLTHRU*/
1806         case POT_EXTRA_HEALING:
1807             if (!obj->cursed)
1808                 cureblind = TRUE;
1809             /*FALLTHRU*/
1810         case POT_HEALING:
1811             if (obj->blessed)
1812                 cureblind = TRUE;
1813             if (mon->data == &mons[PM_PESTILENCE])
1814                 goto do_illness;
1815             /*FALLTHRU*/
1816         case POT_RESTORE_ABILITY:
1817         case POT_GAIN_ABILITY:
1818         do_healing:
1819             angermon = FALSE;
1820             if (mon->mhp < mon->mhpmax) {
1821                 mon->mhp = mon->mhpmax;
1822                 if (canseemon(mon))
1823 /*JP
1824                     pline("%s looks sound and hale again.", Monnam(mon));
1825 */
1826                     pline("%s\82Í\8c³\8bC\82É\82È\82Á\82½\82æ\82¤\82É\8c©\82¦\82é\81D", Monnam(mon));
1827             }
1828             if (cureblind)
1829                 mcureblindness(mon, canseemon(mon));
1830             break;
1831         case POT_SICKNESS:
1832             if (mon->data == &mons[PM_PESTILENCE])
1833                 goto do_healing;
1834             if (dmgtype(mon->data, AD_DISE)
1835                 /* won't happen, see prior goto */
1836                 || dmgtype(mon->data, AD_PEST)
1837                 /* most common case */
1838                 || resists_poison(mon)) {
1839                 if (canseemon(mon))
1840 #if 0 /*JP*/
1841                     pline("%s looks unharmed.", Monnam(mon));
1842 #else
1843                     pline("%s\82Í\82È\82ñ\82Æ\82à\82È\82¢\82æ\82¤\82¾\81D", Monnam(mon));
1844 #endif
1845                 break;
1846             }
1847         do_illness:
1848             if ((mon->mhpmax > 3) && !resist(mon, POTION_CLASS, 0, NOTELL))
1849                 mon->mhpmax /= 2;
1850             if ((mon->mhp > 2) && !resist(mon, POTION_CLASS, 0, NOTELL))
1851                 mon->mhp /= 2;
1852             if (mon->mhp > mon->mhpmax)
1853                 mon->mhp = mon->mhpmax;
1854             if (canseemon(mon))
1855 /*JP
1856                 pline("%s looks rather ill.", Monnam(mon));
1857 */
1858                 pline("%s\82Í\95a\8bC\82Á\82Û\82­\8c©\82¦\82é\81D", Monnam(mon));
1859             break;
1860         case POT_CONFUSION:
1861         case POT_BOOZE:
1862             if (!resist(mon, POTION_CLASS, 0, NOTELL))
1863                 mon->mconf = TRUE;
1864             break;
1865         case POT_INVISIBILITY: {
1866             boolean sawit = canspotmon(mon);
1867
1868             angermon = FALSE;
1869             mon_set_minvis(mon);
1870             if (sawit && !canspotmon(mon) && cansee(mon->mx, mon->my))
1871                 map_invisible(mon->mx, mon->my);
1872             break;
1873         }
1874         case POT_SLEEPING:
1875             /* wakeup() doesn't rouse victims of temporary sleep */
1876             if (sleep_monst(mon, rnd(12), POTION_CLASS)) {
1877 /*JP
1878                 pline("%s falls asleep.", Monnam(mon));
1879 */
1880                 pline("%s\82Í\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81D", Monnam(mon));
1881                 slept_monst(mon);
1882             }
1883             break;
1884         case POT_PARALYSIS:
1885             if (mon->mcanmove) {
1886                 /* really should be rnd(5) for consistency with players
1887                  * breathing potions, but...
1888                  */
1889                 paralyze_monst(mon, rnd(25));
1890             }
1891             break;
1892         case POT_SPEED:
1893             angermon = FALSE;
1894             mon_adjust_speed(mon, 1, obj);
1895             break;
1896         case POT_BLINDNESS:
1897             if (haseyes(mon->data)) {
1898                 int btmp = 64 + rn2(32)
1899                             + rn2(32) * !resist(mon, POTION_CLASS, 0, NOTELL);
1900
1901                 btmp += mon->mblinded;
1902                 mon->mblinded = min(btmp, 127);
1903                 mon->mcansee = 0;
1904             }
1905             break;
1906         case POT_WATER:
1907             if (is_undead(mon->data) || is_demon(mon->data)
1908                 || is_were(mon->data) || is_vampshifter(mon)) {
1909                 if (obj->blessed) {
1910 #if 0 /*JP*/
1911                     pline("%s %s in pain!", Monnam(mon),
1912                           is_silent(mon->data) ? "writhes" : "shrieks");
1913 #else
1914                     pline("%s\82Í\8bê\92É%s\81I", Monnam(mon),
1915                           is_silent(mon->data) ? "\82É\90g\82à\82¾\82¦\82µ\82½" : "\82Ì\8b©\82Ñ\90º\82ð\82 \82°\82½");
1916 #endif
1917                     if (!is_silent(mon->data))
1918                         wake_nearto(tx, ty, mon->data->mlevel * 10);
1919                     mon->mhp -= d(2, 6);
1920                     /* should only be by you */
1921                     if (mon->mhp < 1)
1922                         killed(mon);
1923                     else if (is_were(mon->data) && !is_human(mon->data))
1924                         new_were(mon); /* revert to human */
1925                 } else if (obj->cursed) {
1926                     angermon = FALSE;
1927                     if (canseemon(mon))
1928 /*JP
1929                         pline("%s looks healthier.", Monnam(mon));
1930 */
1931                         pline("%s\82Í\82æ\82è\8c³\8bC\82É\82È\82Á\82½\82æ\82¤\82É\8c©\82¦\82é\81D", Monnam(mon));
1932                     mon->mhp += d(2, 6);
1933                     if (mon->mhp > mon->mhpmax)
1934                         mon->mhp = mon->mhpmax;
1935                     if (is_were(mon->data) && is_human(mon->data)
1936                         && !Protection_from_shape_changers)
1937                         new_were(mon); /* transform into beast */
1938                 }
1939             } else if (mon->data == &mons[PM_GREMLIN]) {
1940                 angermon = FALSE;
1941                 (void) split_mon(mon, (struct monst *) 0);
1942             } else if (mon->data == &mons[PM_IRON_GOLEM]) {
1943                 if (canseemon(mon))
1944 /*JP
1945                     pline("%s rusts.", Monnam(mon));
1946 */
1947                     pline("%s\82Í\8eK\82Ñ\82½\81D", Monnam(mon));
1948                 mon->mhp -= d(1, 6);
1949                 /* should only be by you */
1950                 if (mon->mhp < 1)
1951                     killed(mon);
1952             }
1953             break;
1954         case POT_OIL:
1955             if (obj->lamplit)
1956                 explode_oil(obj, tx, ty);
1957             break;
1958         case POT_ACID:
1959             if (!resists_acid(mon) && !resist(mon, POTION_CLASS, 0, NOTELL)) {
1960 #if 0 /*JP*/
1961                 pline("%s %s in pain!", Monnam(mon),
1962                       is_silent(mon->data) ? "writhes" : "shrieks");
1963 #else
1964                 pline("%s\82Í\8bê\92É%s\81I", Monnam(mon),
1965                       is_silent(mon->data) ? "\82É\90g\82à\82¾\82¦\82µ\82½" : "\82Ì\8b©\82Ñ\90º\82ð\82 \82°\82½");
1966 #endif
1967                 if (!is_silent(mon->data))
1968                     wake_nearto(tx, ty, mon->data->mlevel * 10);
1969                 mon->mhp -= d(obj->cursed ? 2 : 1, obj->blessed ? 4 : 8);
1970                 if (mon->mhp < 1) {
1971                     if (your_fault)
1972                         killed(mon);
1973                     else
1974                         monkilled(mon, "", AD_ACID);
1975                 }
1976             }
1977             break;
1978         case POT_POLYMORPH:
1979             (void) bhitm(mon, obj);
1980             break;
1981         /*
1982         case POT_GAIN_LEVEL:
1983         case POT_LEVITATION:
1984         case POT_FRUIT_JUICE:
1985         case POT_MONSTER_DETECTION:
1986         case POT_OBJECT_DETECTION:
1987             break;
1988         */
1989         }
1990         /* target might have been killed */
1991         if (mon->mhp > 0) {
1992             if (angermon)
1993                 wakeup(mon, TRUE);
1994             else
1995                 mon->msleeping = 0;
1996         }
1997     }
1998
1999     /* Note: potionbreathe() does its own docall() */
2000     if ((distance == 0 || (distance < 3 && rn2(5)))
2001         && (!breathless(youmonst.data) || haseyes(youmonst.data)))
2002         potionbreathe(obj);
2003     else if (obj->dknown && !objects[obj->otyp].oc_name_known
2004              && !objects[obj->otyp].oc_uname && cansee(tx, ty))
2005         docall(obj);
2006
2007     if (*u.ushops && obj->unpaid) {
2008         struct monst *shkp = shop_keeper(*in_rooms(u.ux, u.uy, SHOPBASE));
2009
2010         /* neither of the first two cases should be able to happen;
2011            only the hero should ever have an unpaid item, and only
2012            when inside a tended shop */
2013         if (!shkp) /* if shkp was killed, unpaid ought to cleared already */
2014             obj->unpaid = 0;
2015         else if (context.mon_moving) /* obj thrown by monster */
2016             subfrombill(obj, shkp);
2017         else /* obj thrown by hero */
2018             (void) stolen_value(obj, u.ux, u.uy, (boolean) shkp->mpeaceful,
2019                                 FALSE);
2020     }
2021     obfree(obj, (struct obj *) 0);
2022 }
2023
2024 /* vapors are inhaled or get in your eyes */
2025 void
2026 potionbreathe(obj)
2027 register struct obj *obj;
2028 {
2029     int i, ii, isdone, kn = 0;
2030     boolean cureblind = FALSE;
2031
2032     /* potion of unholy water might be wielded; prevent
2033        you_were() -> drop_weapon() from dropping it so that it
2034        remains in inventory where our caller expects it to be */
2035     obj->in_use = 1;
2036
2037     switch (obj->otyp) {
2038     case POT_RESTORE_ABILITY:
2039     case POT_GAIN_ABILITY:
2040         if (obj->cursed) {
2041             if (!breathless(youmonst.data))
2042 /*JP
2043                 pline("Ulch!  That potion smells terrible!");
2044 */
2045                 pline("\83E\83Q\83F\81I\96ò\82Í\82à\82Ì\82·\82²\82¢\93õ\82¢\82ª\82·\82é\81I");
2046             else if (haseyes(youmonst.data)) {
2047 #if 0 /*JP*/
2048                 const char *eyes = body_part(EYE);
2049
2050                 if (eyecount(youmonst.data) != 1)
2051                     eyes = makeplural(eyes);
2052                 Your("%s %s!", eyes, vtense(eyes, "sting"));
2053 #else
2054                 Your("%s\82ª\82¸\82«\82¸\82«\82·\82é\81I", body_part(EYE));
2055 #endif
2056             }
2057             break;
2058         } else {
2059             i = rn2(A_MAX); /* start at a random point */
2060             for (isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
2061                 if (ABASE(i) < AMAX(i)) {
2062                     ABASE(i)++;
2063                     /* only first found if not blessed */
2064                     isdone = !(obj->blessed);
2065                     context.botl = 1;
2066                 }
2067                 if (++i >= A_MAX)
2068                     i = 0;
2069             }
2070         }
2071         break;
2072     case POT_FULL_HEALING:
2073         if (Upolyd && u.mh < u.mhmax)
2074             u.mh++, context.botl = 1;
2075         if (u.uhp < u.uhpmax)
2076             u.uhp++, context.botl = 1;
2077         cureblind = TRUE;
2078         /*FALLTHRU*/
2079     case POT_EXTRA_HEALING:
2080         if (Upolyd && u.mh < u.mhmax)
2081             u.mh++, context.botl = 1;
2082         if (u.uhp < u.uhpmax)
2083             u.uhp++, context.botl = 1;
2084         if (!obj->cursed)
2085             cureblind = TRUE;
2086         /*FALLTHRU*/
2087     case POT_HEALING:
2088         if (Upolyd && u.mh < u.mhmax)
2089             u.mh++, context.botl = 1;
2090         if (u.uhp < u.uhpmax)
2091             u.uhp++, context.botl = 1;
2092         if (obj->blessed)
2093             cureblind = TRUE;
2094         if (cureblind)
2095             make_blinded(0L, !u.ucreamed);
2096         exercise(A_CON, TRUE);
2097         break;
2098     case POT_SICKNESS:
2099         if (!Role_if(PM_HEALER)) {
2100             if (Upolyd) {
2101                 if (u.mh <= 5)
2102                     u.mh = 1;
2103                 else
2104                     u.mh -= 5;
2105             } else {
2106                 if (u.uhp <= 5)
2107                     u.uhp = 1;
2108                 else
2109                     u.uhp -= 5;
2110             }
2111             context.botl = 1;
2112             exercise(A_CON, FALSE);
2113         }
2114         break;
2115     case POT_HALLUCINATION:
2116 /*JP
2117         You("have a momentary vision.");
2118 */
2119         You("\88ê\8fu\8c\89e\82É\82Â\82Â\82Ü\82ê\82½\81D");
2120         break;
2121     case POT_CONFUSION:
2122     case POT_BOOZE:
2123         if (!Confusion)
2124 /*JP
2125             You_feel("somewhat dizzy.");
2126 */
2127             You("\82ß\82Ü\82¢\82ð\8a´\82\82½\81D");
2128         make_confused(itimeout_incr(HConfusion, rnd(5)), FALSE);
2129         break;
2130     case POT_INVISIBILITY:
2131         if (!Blind && !Invis) {
2132             kn++;
2133 #if 0 /*JP*/
2134             pline("For an instant you %s!",
2135                   See_invisible ? "could see right through yourself"
2136                                 : "couldn't see yourself");
2137 #else
2138             pline("\88ê\8fu\8e©\95ª\8e©\90g\82ª%s\8c©\82¦\82È\82­\82È\82Á\82½\81I",
2139                   See_invisible ? "\90³\82µ\82­"
2140                                 : "");
2141 #endif
2142         }
2143         break;
2144     case POT_PARALYSIS:
2145         kn++;
2146         if (!Free_action) {
2147 /*JP
2148             pline("%s seems to be holding you.", Something);
2149 */
2150             pline("%s\82ª\82 \82È\82½\82ð\82Â\82©\82Ü\82¦\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D", Something);
2151             nomul(-rnd(5));
2152 /*JP
2153             multi_reason = "frozen by a potion";
2154 */
2155             multi_reason = "\96ò\82Å\8dd\92¼\82µ\82Ä\82¢\82é\8e\9e\82É";
2156             nomovemsg = You_can_move_again;
2157             exercise(A_DEX, FALSE);
2158         } else
2159 /*JP
2160             You("stiffen momentarily.");
2161 */
2162             You("\88ê\8fu\8dd\92¼\82µ\82½\81D");
2163         break;
2164     case POT_SLEEPING:
2165         kn++;
2166         if (!Free_action && !Sleep_resistance) {
2167 /*JP
2168             You_feel("rather tired.");
2169 */
2170             You("\82·\82±\82µ\94æ\82ê\82½\81D");
2171             nomul(-rnd(5));
2172 /*JP
2173             multi_reason = "sleeping off a magical draught";
2174 */
2175             multi_reason = "\96\82\96@\93I\82É\96°\82Á\82Ä\82¢\82é\8aÔ\82É";
2176             nomovemsg = You_can_move_again;
2177             exercise(A_DEX, FALSE);
2178         } else
2179 /*JP
2180             You("yawn.");
2181 */
2182             You("\82 \82­\82Ñ\82ð\82µ\82½\81D");
2183         break;
2184     case POT_SPEED:
2185         if (!Fast)
2186 /*JP
2187             Your("knees seem more flexible now.");
2188 */
2189             Your("\95G\82Í\82æ\82è\82·\82Î\82â\82­\93®\82­\82æ\82¤\82É\82È\82Á\82½\81D");
2190         incr_itimeout(&HFast, rnd(5));
2191         exercise(A_DEX, TRUE);
2192         break;
2193     case POT_BLINDNESS:
2194         if (!Blind && !Unaware) {
2195             kn++;
2196 /*JP
2197             pline("It suddenly gets dark.");
2198 */
2199             pline("\93Ë\91R\88Ã\82­\82È\82Á\82½\81D");
2200         }
2201         make_blinded(itimeout_incr(Blinded, rnd(5)), FALSE);
2202         if (!Blind && !Unaware)
2203             Your1(vision_clears);
2204         break;
2205     case POT_WATER:
2206         if (u.umonnum == PM_GREMLIN) {
2207             (void) split_mon(&youmonst, (struct monst *) 0);
2208         } else if (u.ulycn >= LOW_PM) {
2209             /* vapor from [un]holy water will trigger
2210                transformation but won't cure lycanthropy */
2211             if (obj->blessed && youmonst.data == &mons[u.ulycn])
2212                 you_unwere(FALSE);
2213             else if (obj->cursed && !Upolyd)
2214                 you_were();
2215         }
2216         break;
2217     case POT_ACID:
2218     case POT_POLYMORPH:
2219         exercise(A_CON, FALSE);
2220         break;
2221     /*
2222     case POT_GAIN_LEVEL:
2223     case POT_LEVITATION:
2224     case POT_FRUIT_JUICE:
2225     case POT_MONSTER_DETECTION:
2226     case POT_OBJECT_DETECTION:
2227     case POT_OIL:
2228         break;
2229      */
2230     }
2231     /* note: no obfree() -- that's our caller's responsibility */
2232     if (obj->dknown) {
2233         if (kn)
2234             makeknown(obj->otyp);
2235         else if (!objects[obj->otyp].oc_name_known
2236                  && !objects[obj->otyp].oc_uname)
2237             docall(obj);
2238     }
2239 }
2240
2241 /* returns the potion type when o1 is dipped in o2 */
2242 STATIC_OVL short
2243 mixtype(o1, o2)
2244 register struct obj *o1, *o2;
2245 {
2246     /* cut down on the number of cases below */
2247     if (o1->oclass == POTION_CLASS
2248         && (o2->otyp == POT_GAIN_LEVEL || o2->otyp == POT_GAIN_ENERGY
2249             || o2->otyp == POT_HEALING || o2->otyp == POT_EXTRA_HEALING
2250             || o2->otyp == POT_FULL_HEALING || o2->otyp == POT_ENLIGHTENMENT
2251             || o2->otyp == POT_FRUIT_JUICE)) {
2252         struct obj *swp;
2253
2254         swp = o1;
2255         o1 = o2;
2256         o2 = swp;
2257     }
2258
2259     switch (o1->otyp) {
2260     case POT_HEALING:
2261         switch (o2->otyp) {
2262         case POT_SPEED:
2263         case POT_GAIN_LEVEL:
2264         case POT_GAIN_ENERGY:
2265             return POT_EXTRA_HEALING;
2266         }
2267     case POT_EXTRA_HEALING:
2268         switch (o2->otyp) {
2269         case POT_GAIN_LEVEL:
2270         case POT_GAIN_ENERGY:
2271             return POT_FULL_HEALING;
2272         }
2273     case POT_FULL_HEALING:
2274         switch (o2->otyp) {
2275         case POT_GAIN_LEVEL:
2276         case POT_GAIN_ENERGY:
2277             return POT_GAIN_ABILITY;
2278         }
2279     case UNICORN_HORN:
2280         switch (o2->otyp) {
2281         case POT_SICKNESS:
2282             return POT_FRUIT_JUICE;
2283         case POT_HALLUCINATION:
2284         case POT_BLINDNESS:
2285         case POT_CONFUSION:
2286             return POT_WATER;
2287         }
2288         break;
2289     case AMETHYST: /* "a-methyst" == "not intoxicated" */
2290         if (o2->otyp == POT_BOOZE)
2291             return POT_FRUIT_JUICE;
2292         break;
2293     case POT_GAIN_LEVEL:
2294     case POT_GAIN_ENERGY:
2295         switch (o2->otyp) {
2296         case POT_CONFUSION:
2297             return (rn2(3) ? POT_BOOZE : POT_ENLIGHTENMENT);
2298         case POT_HEALING:
2299             return POT_EXTRA_HEALING;
2300         case POT_EXTRA_HEALING:
2301             return POT_FULL_HEALING;
2302         case POT_FULL_HEALING:
2303             return POT_GAIN_ABILITY;
2304         case POT_FRUIT_JUICE:
2305             return POT_SEE_INVISIBLE;
2306         case POT_BOOZE:
2307             return POT_HALLUCINATION;
2308         }
2309         break;
2310     case POT_FRUIT_JUICE:
2311         switch (o2->otyp) {
2312         case POT_SICKNESS:
2313             return POT_SICKNESS;
2314         case POT_ENLIGHTENMENT:
2315         case POT_SPEED:
2316             return POT_BOOZE;
2317         case POT_GAIN_LEVEL:
2318         case POT_GAIN_ENERGY:
2319             return POT_SEE_INVISIBLE;
2320         }
2321         break;
2322     case POT_ENLIGHTENMENT:
2323         switch (o2->otyp) {
2324         case POT_LEVITATION:
2325             if (rn2(3))
2326                 return POT_GAIN_LEVEL;
2327             break;
2328         case POT_FRUIT_JUICE:
2329             return POT_BOOZE;
2330         case POT_BOOZE:
2331             return POT_CONFUSION;
2332         }
2333         break;
2334     }
2335
2336     return STRANGE_OBJECT;
2337 }
2338
2339 /* #dip command */
2340 int
2341 dodip()
2342 {
2343 /*JP
2344     static const char Dip_[] = "Dip ";
2345 */
2346     static const char Dip_[] = "\90Z\82·";
2347     register struct obj *potion, *obj;
2348     struct obj *singlepotion;
2349     uchar here;
2350     char allowall[2];
2351     short mixture;
2352     char qbuf[QBUFSZ], obuf[QBUFSZ];
2353 #if 0 /*JP*/
2354     const char *shortestname; /* last resort obj name for prompt */
2355 #endif
2356
2357     allowall[0] = ALL_CLASSES;
2358     allowall[1] = '\0';
2359     if (!(obj = getobj(allowall, "dip")))
2360         return 0;
2361 /*JP
2362     if (inaccessible_equipment(obj, "dip", FALSE))
2363 */
2364     if (inaccessible_equipment(obj, "\82ð\90Z\82·", FALSE))
2365         return 0;
2366
2367 #if 0 /*JP*/
2368     shortestname = (is_plural(obj) || pair_of(obj)) ? "them" : "it";
2369 #endif
2370     /*
2371      * Bypass safe_qbuf() since it doesn't handle varying suffix without
2372      * an awful lot of support work.  Format the object once, even though
2373      * the fountain and pool prompts offer a lot more room for it.
2374      * 3.6.0 used thesimpleoname() unconditionally, which posed no risk
2375      * of buffer overflow but drew bug reports because it omits user-
2376      * supplied type name.
2377      * getobj: "What do you want to dip <the object> into? [xyz or ?*] "
2378      */
2379     Strcpy(obuf, short_oname(obj, doname, thesimpleoname,
2380                              /* 128 - (24 + 54 + 1) leaves 49 for <object> */
2381                              QBUFSZ - sizeof "What do you want to dip \
2382  into? [abdeghjkmnpqstvwyzBCEFHIKLNOQRTUWXZ#-# or ?*] "));
2383
2384     here = levl[u.ux][u.uy].typ;
2385     /* Is there a fountain to dip into here? */
2386     if (IS_FOUNTAIN(here)) {
2387 #if 0 /*JP*/
2388         Sprintf(qbuf, "%s%s into the fountain?", Dip_,
2389                 flags.verbose ? obuf : shortestname);
2390 #else
2391         Sprintf(qbuf, "\90ò\82É%s\81H", Dip_);
2392 #endif
2393         /* "Dip <the object> into the fountain?" */
2394         if (yn(qbuf) == 'y') {
2395             dipfountain(obj);
2396             return 1;
2397         }
2398     } else if (is_pool(u.ux, u.uy)) {
2399         const char *pooltype = waterbody_name(u.ux, u.uy);
2400
2401 #if 0 /*JP*/
2402         Sprintf(qbuf, "%s%s into the %s?", Dip_,
2403                 flags.verbose ? obuf : shortestname, pooltype);
2404 #else /*JP:\89p\8cê\82Å\82Í\89½\82ð\90Z\82·\82©\82ð\8aÜ\82ß\82Ä\82¢\82é\82ª\93ú\96{\8cê\82Å\82Í\8f\88\97\9d\82Ì\93s\8d\87\82Å\82Æ\82è\82 \82¦\82¸\8fÈ\97ª*/
2405         Sprintf(qbuf, "%s\82É%s\81H", pooltype, Dip_);
2406 #endif
2407         /* "Dip <the object> into the {pool, moat, &c}?" */
2408         if (yn(qbuf) == 'y') {
2409             if (Levitation) {
2410                 floating_above(pooltype);
2411             } else if (u.usteed && !is_swimmer(u.usteed->data)
2412                        && P_SKILL(P_RIDING) < P_BASIC) {
2413                 rider_cant_reach(); /* not skilled enough to reach */
2414             } else {
2415                 if (obj->otyp == POT_ACID)
2416                     obj->in_use = 1;
2417                 if (water_damage(obj, 0, TRUE) != ER_DESTROYED && obj->in_use)
2418                     useup(obj);
2419             }
2420             return 1;
2421         }
2422     }
2423
2424 #if 0 /*JP*/
2425     /* "What do you want to dip <the object> into? [xyz or ?*] " */
2426     Sprintf(qbuf, "dip %s into", flags.verbose ? obuf : shortestname);
2427 #else
2428     /* "What do you want to dip into? [xyz or ?*] " */
2429     Sprintf(qbuf, "dip into");
2430 #endif
2431     potion = getobj(beverages, qbuf);
2432     if (!potion)
2433         return 0;
2434     if (potion == obj && potion->quan == 1L) {
2435 /*JP
2436         pline("That is a potion bottle, not a Klein bottle!");
2437 */
2438         pline("\82±\82ê\82Í\96ò\95r\82¾\81I\83N\83\89\83C\83\93\82Ì\92Ù\82\82á\82È\82¢\81I");
2439         return 0;
2440     }
2441     potion->in_use = TRUE; /* assume it will be used up */
2442     if (potion->otyp == POT_WATER) {
2443         boolean useeit = !Blind || (obj == ublindf && Blindfolded_only);
2444 #if 0 /*JP*/
2445         const char *obj_glows = Yobjnam2(obj, "glow");
2446 #else
2447         const char *obj_glows = cxname(obj);
2448 #endif
2449
2450         if (H2Opotion_dip(potion, obj, useeit, obj_glows))
2451             goto poof;
2452     } else if (obj->otyp == POT_POLYMORPH || potion->otyp == POT_POLYMORPH) {
2453         /* some objects can't be polymorphed */
2454         if (obj->otyp == potion->otyp /* both POT_POLY */
2455             || obj->otyp == WAN_POLYMORPH || obj->otyp == SPE_POLYMORPH
2456             || obj == uball || obj == uskin
2457             || obj_resists(obj->otyp == POT_POLYMORPH ? potion : obj,
2458                            5, 95)) {
2459             pline1(nothing_happens);
2460         } else {
2461             boolean was_wep, was_swapwep, was_quiver;
2462             short save_otyp = obj->otyp;
2463
2464             /* KMH, conduct */
2465             u.uconduct.polypiles++;
2466
2467             was_wep = (obj == uwep);
2468             was_swapwep = (obj == uswapwep);
2469             was_quiver = (obj == uquiver);
2470
2471             obj = poly_obj(obj, STRANGE_OBJECT);
2472
2473             if (was_wep)
2474                 setuwep(obj);
2475             else if (was_swapwep)
2476                 setuswapwep(obj);
2477             else if (was_quiver)
2478                 setuqwep(obj);
2479
2480             if (obj->otyp != save_otyp) {
2481                 makeknown(POT_POLYMORPH);
2482                 useup(potion);
2483                 prinv((char *) 0, obj, 0L);
2484                 return 1;
2485             } else {
2486 /*JP
2487                 pline("Nothing seems to happen.");
2488 */
2489                 pline("\89½\82à\8bN\82±\82ç\82È\82©\82Á\82½\82æ\82¤\82¾\81D");
2490                 goto poof;
2491             }
2492         }
2493         potion->in_use = FALSE; /* didn't go poof */
2494         return 1;
2495     } else if (obj->oclass == POTION_CLASS && obj->otyp != potion->otyp) {
2496         int amt = (int) obj->quan;
2497         boolean magic;
2498
2499         mixture = mixtype(obj, potion);
2500
2501         magic = (mixture != STRANGE_OBJECT) ? objects[mixture].oc_magic
2502             : (objects[obj->otyp].oc_magic || objects[potion->otyp].oc_magic);
2503 #if 0 /*JP*/
2504         Strcpy(qbuf, "The"); /* assume full stack */
2505 #else
2506         Strcpy(qbuf, "");
2507 #endif
2508         if (amt > (magic ? 3 : 7)) {
2509             /* trying to dip multiple potions will usually affect only a
2510                subset; pick an amount between 3 and 8, inclusive, for magic
2511                potion result, between 7 and N for non-magic */
2512             if (magic)
2513                 amt = rnd(min(amt, 8) - (3 - 1)) + (3 - 1); /* 1..6 + 2 */
2514             else
2515                 amt = rnd(amt - (7 - 1)) + (7 - 1); /* 1..(N-6) + 6 */
2516
2517             if ((long) amt < obj->quan) {
2518                 obj = splitobj(obj, (long) amt);
2519 #if 0 /*JP*/
2520                 Sprintf(qbuf, "%ld of the", obj->quan);
2521 #else
2522                 Sprintf(qbuf, "%ld\96{\82Ì", obj->quan);
2523 #endif
2524             }
2525         }
2526         /* [N of] the {obj(s)} mix(es) with [one of] {the potion}... */
2527 #if 0 /*JP*/
2528         pline("%s %s %s with %s%s...", qbuf, simpleonames(obj),
2529               otense(obj, "mix"), (potion->quan > 1L) ? "one of " : "",
2530               thesimpleoname(potion));
2531 #else /* [N\96{\82Ì]{obj}\82ð{the potion}[\82Ì\88ê\82Â]\82Æ\8d¬\82º\82½\81D\81D\81D */
2532         pline("%s%s\82ð%s%s\82Æ\8d¬\82º\82½\81D\81D\81D", qbuf, simpleonames(obj),
2533               thesimpleoname(potion),
2534               (potion->quan > 1L) ? "\82Ì\88ê\82Â" : "");
2535 #endif
2536         /* Mixing potions is dangerous...
2537            KMH, balance patch -- acid is particularly unstable */
2538         if (obj->cursed || obj->otyp == POT_ACID || !rn2(10)) {
2539             /* it would be better to use up the whole stack in advance
2540                of the message, but we can't because we need to keep it
2541                around for potionbreathe() [and we can't set obj->in_use
2542                to 'amt' because that's not implemented] */
2543             obj->in_use = 1;
2544 /*JP
2545             pline("BOOM!  They explode!");
2546 */
2547             pline("\83o\81[\83\93\81I\94\9a\94­\82µ\82½\81I");
2548             wake_nearto(u.ux, u.uy, (BOLT_LIM + 1) * (BOLT_LIM + 1));
2549             exercise(A_STR, FALSE);
2550             if (!breathless(youmonst.data) || haseyes(youmonst.data))
2551                 potionbreathe(obj);
2552             useupall(obj);
2553             useup(potion);
2554             losehp(amt + rnd(9), /* not physical damage */
2555 /*JP
2556                    "alchemic blast", KILLED_BY_AN);
2557 */
2558                    "\92²\8d\87\82Ì\8e¸\94s\82Å", KILLED_BY_AN);
2559             return 1;
2560         }
2561
2562         obj->blessed = obj->cursed = obj->bknown = 0;
2563         if (Blind || Hallucination)
2564             obj->dknown = 0;
2565
2566         if (mixture != STRANGE_OBJECT) {
2567             obj->otyp = mixture;
2568         } else {
2569             switch (obj->odiluted ? 1 : rnd(8)) {
2570             case 1:
2571                 obj->otyp = POT_WATER;
2572                 break;
2573             case 2:
2574             case 3:
2575                 obj->otyp = POT_SICKNESS;
2576                 break;
2577             case 4: {
2578                 struct obj *otmp = mkobj(POTION_CLASS, FALSE);
2579
2580                 obj->otyp = otmp->otyp;
2581                 obfree(otmp, (struct obj *) 0);
2582                 break;
2583             }
2584             default:
2585                 useupall(obj);
2586                 useup(potion);
2587                 if (!Blind)
2588 /*JP
2589                     pline_The("mixture glows brightly and evaporates.");
2590 */
2591                     pline("\8d¬\82º\82é\82Æ\96ò\82Í\96¾\82é\82­\8bP\82«\81C\8fö\94­\82µ\82½\81D");
2592                 return 1;
2593             }
2594         }
2595         obj->odiluted = (obj->otyp != POT_WATER);
2596
2597         if (obj->otyp == POT_WATER && !Hallucination) {
2598 /*JP
2599             pline_The("mixture bubbles%s.", Blind ? "" : ", then clears");
2600 */
2601             pline("\96ò\82ð\8d¬\82º\82é\82Æ%s\96A\82¾\82Á\82½\81D", Blind ? "" : "\82µ\82Î\82ç\82­");
2602         } else if (!Blind) {
2603 /*JP
2604             pline_The("mixture looks %s.",
2605 */
2606             pline("\8d¬\82º\82½\96ò\82Í%s\96ò\82É\8c©\82¦\82é\81D",
2607                       hcolor(OBJ_DESCR(objects[obj->otyp])));
2608         }
2609
2610         useup(potion);
2611         /* this is required when 'obj' was split off from a bigger stack,
2612            so that 'obj' will now be assigned its own inventory slot;
2613            it has a side-effect of merging 'obj' into another compatible
2614            stack if there is one, so we do it even when no split has
2615            been made in order to get the merge result for both cases;
2616            as a consequence, mixing while Fumbling drops the mixture */
2617         freeinv(obj);
2618 #if 0 /*JP*/
2619         (void) hold_another_object(obj, "You drop %s!", doname(obj),
2620                                    (const char *) 0);
2621 #else
2622         (void) hold_another_object(obj, "%s\82ð\97\8e\82µ\82½\81I", doname(obj),
2623                                    (const char *) 0);
2624 #endif
2625         return 1;
2626     }
2627
2628     if (potion->otyp == POT_ACID && obj->otyp == CORPSE
2629         && obj->corpsenm == PM_LICHEN && !Blind) {
2630 #if 0 /*JP*/
2631         pline("%s %s %s around the edges.", The(cxname(obj)),
2632               otense(obj, "turn"),
2633               potion->odiluted ? hcolor(NH_ORANGE) : hcolor(NH_RED));
2634 #else
2635         pline("%s\82Í\82Ó\82¿\82ª%s\82È\82Á\82½\81D", The(cxname(obj)),
2636               jconj_adj(potion->odiluted ? hcolor(NH_ORANGE) : hcolor(NH_RED)));
2637 #endif
2638         potion->in_use = FALSE; /* didn't go poof */
2639         return 1;
2640     }
2641
2642     if (potion->otyp == POT_WATER && obj->otyp == TOWEL) {
2643 /*JP
2644         pline_The("towel soaks it up!");
2645 */
2646         pline_The("\83^\83I\83\8b\82Í\90\85\82ð\8bz\82¢\8d\9e\82ñ\82¾\81I");
2647         /* wetting towel already done via water_damage() in H2Opotion_dip */
2648         goto poof;
2649     }
2650
2651     if (is_poisonable(obj)) {
2652         if (potion->otyp == POT_SICKNESS && !obj->opoisoned) {
2653             char buf[BUFSZ];
2654
2655             if (potion->quan > 1L)
2656 /*JP
2657                 Sprintf(buf, "One of %s", the(xname(potion)));
2658 */
2659                 Sprintf(buf, "%s\82Ì\88ê\82Â", the(xname(potion)));
2660             else
2661                 Strcpy(buf, The(xname(potion)));
2662 /*JP
2663             pline("%s forms a coating on %s.", buf, the(xname(obj)));
2664 */
2665             pline("%s\82ª%s\82É\93h\82ç\82ê\82½\81D", buf, the(xname(obj)));
2666             obj->opoisoned = TRUE;
2667             goto poof;
2668         } else if (obj->opoisoned && (potion->otyp == POT_HEALING
2669                                       || potion->otyp == POT_EXTRA_HEALING
2670                                       || potion->otyp == POT_FULL_HEALING)) {
2671 /*JP
2672             pline("A coating wears off %s.", the(xname(obj)));
2673 */
2674             pline("\93Å\82ª%s\82©\82ç\94\8d\82°\82¨\82¿\82½\81D", the(xname(obj)));
2675             obj->opoisoned = 0;
2676             goto poof;
2677         }
2678     }
2679
2680     if (potion->otyp == POT_ACID) {
2681         if (erode_obj(obj, 0, ERODE_CORRODE, EF_GREASE) != ER_NOTHING)
2682             goto poof;
2683     }
2684
2685     if (potion->otyp == POT_OIL) {
2686         boolean wisx = FALSE;
2687
2688         if (potion->lamplit) { /* burning */
2689             fire_damage(obj, TRUE, u.ux, u.uy);
2690         } else if (potion->cursed) {
2691 /*JP
2692             pline_The("potion spills and covers your %s with oil.",
2693 */
2694             pline("\96û\82Í\94ò\82Ñ\8eU\82è\82 \82È\82½\82Ì%s\82É\82©\82©\82Á\82½\81D",
2695                       makeplural(body_part(FINGER)));
2696             incr_itimeout(&Glib, d(2, 10));
2697         } else if (obj->oclass != WEAPON_CLASS && !is_weptool(obj)) {
2698             /* the following cases apply only to weapons */
2699             goto more_dips;
2700             /* Oil removes rust and corrosion, but doesn't unburn.
2701              * Arrows, etc are classed as metallic due to arrowhead
2702              * material, but dipping in oil shouldn't repair them.
2703              */
2704         } else if ((!is_rustprone(obj) && !is_corrodeable(obj))
2705                    || is_ammo(obj) || (!obj->oeroded && !obj->oeroded2)) {
2706             /* uses up potion, doesn't set obj->greased */
2707 #if 0 /*JP*/
2708             pline("%s %s with an oily sheen.", Yname2(obj),
2709                   otense(obj, "gleam"));
2710 #else
2711                 pline("%s\82Í\96û\82Ì\8cõ\91ò\82Å\82«\82ç\82è\82Æ\8cõ\82Á\82½\81D", Yname2(obj));
2712 #endif
2713         } else {
2714 #if 0 /*JP*/
2715             pline("%s %s less %s.", Yname2(obj), otense(obj, "are"),
2716                   (obj->oeroded && obj->oeroded2)
2717                       ? "corroded and rusty"
2718                       : obj->oeroded ? "rusty" : "corroded");
2719 #else
2720             pline("%s\82Ì%s\82ª\8eæ\82ê\82½\81D", Yname2(obj),
2721                   (obj->oeroded && obj->oeroded2)
2722                       ? "\95\85\90H\82Æ\8eK"
2723                       : obj->oeroded ? "\8eK" : "\95\85\90H");
2724 #endif
2725             if (obj->oeroded > 0)
2726                 obj->oeroded--;
2727             if (obj->oeroded2 > 0)
2728                 obj->oeroded2--;
2729             wisx = TRUE;
2730         }
2731         exercise(A_WIS, wisx);
2732         makeknown(potion->otyp);
2733         useup(potion);
2734         return 1;
2735     }
2736 more_dips:
2737
2738     /* Allow filling of MAGIC_LAMPs to prevent identification by player */
2739     if ((obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP)
2740         && (potion->otyp == POT_OIL)) {
2741         /* Turn off engine before fueling, turn off fuel too :-)  */
2742         if (obj->lamplit || potion->lamplit) {
2743             useup(potion);
2744             explode(u.ux, u.uy, 11, d(6, 6), 0, EXPL_FIERY);
2745             exercise(A_WIS, FALSE);
2746             return 1;
2747         }
2748         /* Adding oil to an empty magic lamp renders it into an oil lamp */
2749         if ((obj->otyp == MAGIC_LAMP) && obj->spe == 0) {
2750             obj->otyp = OIL_LAMP;
2751             obj->age = 0;
2752         }
2753         if (obj->age > 1000L) {
2754 /*JP
2755             pline("%s %s full.", Yname2(obj), otense(obj, "are"));
2756 */
2757             pline("%s\82É\82Í\82½\82Á\82Õ\82è\93ü\82Á\82Ä\82¢\82é\81D", Yname2(obj));
2758             potion->in_use = FALSE; /* didn't go poof */
2759         } else {
2760 /*JP
2761             You("fill %s with oil.", yname(obj));
2762 */
2763             You("%s\82É\96û\82ð\93ü\82ê\82½\81D", yname(obj));
2764             check_unpaid(potion);        /* Yendorian Fuel Tax */
2765             obj->age += 2 * potion->age; /* burns more efficiently */
2766             if (obj->age > 1500L)
2767                 obj->age = 1500L;
2768             useup(potion);
2769             exercise(A_WIS, TRUE);
2770         }
2771         makeknown(POT_OIL);
2772         obj->spe = 1;
2773         update_inventory();
2774         return 1;
2775     }
2776
2777     potion->in_use = FALSE; /* didn't go poof */
2778     if ((obj->otyp == UNICORN_HORN || obj->otyp == AMETHYST)
2779         && (mixture = mixtype(obj, potion)) != STRANGE_OBJECT) {
2780         char oldbuf[BUFSZ], newbuf[BUFSZ];
2781         short old_otyp = potion->otyp;
2782         boolean old_dknown = FALSE;
2783         boolean more_than_one = potion->quan > 1L;
2784
2785         oldbuf[0] = '\0';
2786         if (potion->dknown) {
2787             old_dknown = TRUE;
2788 /*JP
2789             Sprintf(oldbuf, "%s ", hcolor(OBJ_DESCR(objects[potion->otyp])));
2790 */
2791             Sprintf(oldbuf, "%s", hcolor(OBJ_DESCR(objects[potion->otyp])));
2792         }
2793         /* with multiple merged potions, split off one and
2794            just clear it */
2795         if (potion->quan > 1L) {
2796             singlepotion = splitobj(potion, 1L);
2797         } else
2798             singlepotion = potion;
2799
2800         costly_alteration(singlepotion, COST_NUTRLZ);
2801         singlepotion->otyp = mixture;
2802         singlepotion->blessed = 0;
2803         if (mixture == POT_WATER)
2804             singlepotion->cursed = singlepotion->odiluted = 0;
2805         else
2806             singlepotion->cursed = obj->cursed; /* odiluted left as-is */
2807         singlepotion->bknown = FALSE;
2808         if (Blind) {
2809             singlepotion->dknown = FALSE;
2810         } else {
2811             singlepotion->dknown = !Hallucination;
2812 #if 0 /*JP*/
2813             if (mixture == POT_WATER && singlepotion->dknown)
2814                 Sprintf(newbuf, "clears");
2815             else
2816                 Sprintf(newbuf, "turns %s",
2817                         hcolor(OBJ_DESCR(objects[mixture])));
2818             pline_The("%spotion%s %s.", oldbuf,
2819                       more_than_one ? " that you dipped into" : "", newbuf);
2820 #else
2821             if (mixture == POT_WATER && singlepotion->dknown)
2822                 Sprintf(newbuf, "\93§\96¾");
2823             else
2824                 Sprintf(newbuf, "%s\96ò",
2825                         hcolor(OBJ_DESCR(objects[mixture])));
2826             pline_The("%s%s\96ò\82Í%s\82É\82È\82Á\82½\81D.", more_than_one ? "\90Z\82µ\82½" : "",
2827                       oldbuf, newbuf);
2828 #endif
2829             if (!objects[old_otyp].oc_uname
2830                 && !objects[old_otyp].oc_name_known && old_dknown) {
2831                 struct obj fakeobj;
2832                 fakeobj = zeroobj;
2833                 fakeobj.dknown = 1;
2834                 fakeobj.otyp = old_otyp;
2835                 fakeobj.oclass = POTION_CLASS;
2836                 docall(&fakeobj);
2837             }
2838         }
2839         obj_extract_self(singlepotion);
2840         singlepotion =
2841 /*JP
2842             hold_another_object(singlepotion, "You juggle and drop %s!",
2843 */
2844             hold_another_object(singlepotion, "\82¨\8eè\8bÊ\82µ\82Ä%s\82ð\97\8e\82Æ\82µ\82Ä\82µ\82Ü\82Á\82½\81I",
2845                                 doname(singlepotion), (const char *) 0);
2846         update_inventory();
2847         return 1;
2848     }
2849
2850 /*JP
2851     pline("Interesting...");
2852 */
2853     pline("\96Ê\94\92\82¢\81D\81D\81D");
2854     return 1;
2855
2856 poof:
2857     if (!objects[potion->otyp].oc_name_known
2858         && !objects[potion->otyp].oc_uname)
2859         docall(potion);
2860     useup(potion);
2861     return 1;
2862 }
2863
2864 /* *monp grants a wish and then leaves the game */
2865 void
2866 mongrantswish(monp)
2867 struct monst **monp;
2868 {
2869     struct monst *mon = *monp;
2870     int mx = mon->mx, my = mon->my, glyph = glyph_at(mx, my);
2871
2872     /* remove the monster first in case wish proves to be fatal
2873        (blasted by artifact), to keep it out of resulting bones file */
2874     mongone(mon);
2875     *monp = 0; /* inform caller that monster is gone */
2876     /* hide that removal from player--map is visible during wish prompt */
2877     tmp_at(DISP_ALWAYS, glyph);
2878     tmp_at(mx, my);
2879     /* grant the wish */
2880     makewish();
2881     /* clean up */
2882     tmp_at(DISP_END, 0);
2883 }
2884
2885 void
2886 djinni_from_bottle(obj)
2887 struct obj *obj;
2888 {
2889     struct monst *mtmp;
2890     int chance;
2891
2892     if (!(mtmp = makemon(&mons[PM_DJINNI], u.ux, u.uy, NO_MM_FLAGS))) {
2893 #if 0 /*JP*/
2894         pline("It turns out to be empty.");
2895 #else
2896         if (obj->otyp == MAGIC_LAMP) {
2897             pline("\83\89\83\93\83v\82Í\8bó\82Á\82Û\82¾\82Á\82½\81D");
2898         } else {
2899             pline("\96ò\82Í\8bó\82Á\82Û\82¾\82Á\82½\81D");
2900         }
2901 #endif
2902         return;
2903     }
2904
2905     if (!Blind) {
2906 /*JP
2907         pline("In a cloud of smoke, %s emerges!", a_monnam(mtmp));
2908 */
2909         pline("\89\8c\82Ì\92\86\82©\82ç\81C%s\82ª\8c»\82í\82ê\82½\81I", a_monnam(mtmp));
2910 /*JP
2911         pline("%s speaks.", Monnam(mtmp));
2912 */
2913         pline("%s\82Í\98b\82µ\82©\82¯\82½\81D", Monnam(mtmp));
2914     } else {
2915 /*JP
2916         You("smell acrid fumes.");
2917 */
2918         You("\83c\83\93\82Æ\82·\82é\93õ\82¢\82ª\82µ\82½\81D");
2919 /*JP
2920         pline("%s speaks.", Something);
2921 */
2922         pline("%s\82ª\98b\82µ\82©\82¯\82½\81D", Something);
2923     }
2924
2925     chance = rn2(5);
2926     if (obj->blessed)
2927         chance = (chance == 4) ? rnd(4) : 0;
2928     else if (obj->cursed)
2929         chance = (chance == 0) ? rn2(4) : 4;
2930     /* 0,1,2,3,4:  b=80%,5,5,5,5; nc=20%,20,20,20,20; c=5%,5,5,5,80 */
2931
2932     switch (chance) {
2933     case 0:
2934 /*JP
2935         verbalize("I am in your debt.  I will grant one wish!");
2936 */
2937         verbalize("\82¨\91O\82É\82Í\8eØ\82è\82ª\82Å\82«\82½\81D\88ê\82Â\8aè\82¢\82ð\82©\82È\82¦\82Ä\82â\82ë\82¤\81I");
2938         /* give a wish and discard the monster (mtmp set to null) */
2939         mongrantswish(&mtmp);
2940         break;
2941     case 1:
2942 /*JP
2943         verbalize("Thank you for freeing me!");
2944 */
2945         verbalize("\8e\84\82ð\8f\95\82¯\82Ä\82­\82ê\82½\82±\82Æ\82ð\8a´\8eÓ\82·\82é\81I");
2946         (void) tamedog(mtmp, (struct obj *) 0);
2947         break;
2948     case 2:
2949 /*JP
2950         verbalize("You freed me!");
2951 */
2952         verbalize("\89ð\95ú\82µ\82Ä\82­\82ê\82½\82Ì\82Í\82¨\91O\82©\81I");
2953         mtmp->mpeaceful = TRUE;
2954         set_malign(mtmp);
2955         break;
2956     case 3:
2957 /*JP
2958         verbalize("It is about time!");
2959 */
2960         verbalize("\82³\82ç\82Î\82¾\81I");
2961         if (canspotmon(mtmp))
2962 /*JP
2963             pline("%s vanishes.", Monnam(mtmp));
2964 */
2965             pline("%s\82Í\8fÁ\82¦\82½\81D", Monnam(mtmp));
2966         mongone(mtmp);
2967         break;
2968     default:
2969 /*JP
2970         verbalize("You disturbed me, fool!");
2971 */
2972         verbalize("\82¨\82Ü\82¦\82Í\8e\84\82Ì\96°\82è\82ð\96W\82°\82½\81D\82¨\82ë\82©\82à\82Ì\82ß\81I");
2973         mtmp->mpeaceful = FALSE;
2974         set_malign(mtmp);
2975         break;
2976     }
2977 }
2978
2979 /* clone a gremlin or mold (2nd arg non-null implies heat as the trigger);
2980    hit points are cut in half (odd HP stays with original) */
2981 struct monst *
2982 split_mon(mon, mtmp)
2983 struct monst *mon,  /* monster being split */
2984              *mtmp; /* optional attacker whose heat triggered it */
2985 {
2986     struct monst *mtmp2;
2987     char reason[BUFSZ];
2988
2989     reason[0] = '\0';
2990     if (mtmp)
2991 #if 0 /*JP*/
2992         Sprintf(reason, " from %s heat",
2993                 (mtmp == &youmonst) ? the_your[1]
2994                                     : (const char *) s_suffix(mon_nam(mtmp)));
2995 #else
2996         Sprintf(reason, "%s\82Ì\94M\82Å",
2997                 (mtmp == &youmonst) ? the_your[1]
2998                                     : (const char *) mon_nam(mtmp));
2999 #endif
3000
3001     if (mon == &youmonst) {
3002         mtmp2 = cloneu();
3003         if (mtmp2) {
3004             mtmp2->mhpmax = u.mhmax / 2;
3005             u.mhmax -= mtmp2->mhpmax;
3006             context.botl = 1;
3007 /*JP
3008             You("multiply%s!", reason);
3009 */
3010             You("%s\95ª\97ô\82µ\82½\81I", reason);
3011         }
3012     } else {
3013         mtmp2 = clone_mon(mon, 0, 0);
3014         if (mtmp2) {
3015             mtmp2->mhpmax = mon->mhpmax / 2;
3016             mon->mhpmax -= mtmp2->mhpmax;
3017             if (canspotmon(mon))
3018 /*JP
3019                 pline("%s multiplies%s!", Monnam(mon), reason);
3020 */
3021                 pline("%s\82Í%s\95ª\97ô\82µ\82½\81I", Monnam(mon), reason);
3022         }
3023     }
3024     return mtmp2;
3025 }
3026
3027 /*potion.c*/