OSDN Git Service

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