OSDN Git Service

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