OSDN Git Service

patch artifact
[jnethack/source.git] / src / apply.c
1 /* NetHack 3.6  apply.c $NHDT-Date: 1446808436 2015/11/06 11:13:56 $  $NHDT-Branch: master $:$NHDT-Revision: 1.210 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2016            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 #include "hack.h"
11
12 extern boolean notonhead; /* for long worms */
13
14 STATIC_DCL int FDECL(use_camera, (struct obj *));
15 STATIC_DCL int FDECL(use_towel, (struct obj *));
16 STATIC_DCL boolean FDECL(its_dead, (int, int, int *));
17 STATIC_DCL int FDECL(use_stethoscope, (struct obj *));
18 STATIC_DCL void FDECL(use_whistle, (struct obj *));
19 STATIC_DCL void FDECL(use_magic_whistle, (struct obj *));
20 STATIC_DCL void FDECL(use_leash, (struct obj *));
21 STATIC_DCL int FDECL(use_mirror, (struct obj *));
22 STATIC_DCL void FDECL(use_bell, (struct obj **));
23 STATIC_DCL void FDECL(use_candelabrum, (struct obj *));
24 STATIC_DCL void FDECL(use_candle, (struct obj **));
25 STATIC_DCL void FDECL(use_lamp, (struct obj *));
26 STATIC_DCL void FDECL(light_cocktail, (struct obj *));
27 STATIC_PTR void FDECL(display_jump_positions, (int));
28 STATIC_DCL void FDECL(use_tinning_kit, (struct obj *));
29 STATIC_DCL void FDECL(use_figurine, (struct obj **));
30 STATIC_DCL void FDECL(use_grease, (struct obj *));
31 STATIC_DCL void FDECL(use_trap, (struct obj *));
32 STATIC_DCL void FDECL(use_stone, (struct obj *));
33 STATIC_PTR int NDECL(set_trap); /* occupation callback */
34 STATIC_DCL int FDECL(use_whip, (struct obj *));
35 STATIC_PTR void FDECL(display_polearm_positions, (int));
36 STATIC_DCL int FDECL(use_pole, (struct obj *));
37 STATIC_DCL int FDECL(use_cream_pie, (struct obj *));
38 STATIC_DCL int FDECL(use_grapple, (struct obj *));
39 STATIC_DCL int FDECL(do_break_wand, (struct obj *));
40 STATIC_DCL boolean FDECL(figurine_location_checks, (struct obj *,
41                                                     coord *, BOOLEAN_P));
42 STATIC_DCL void FDECL(add_class, (char *, CHAR_P));
43 STATIC_DCL void FDECL(setapplyclasses, (char *));
44 STATIC_DCL boolean FDECL(is_valid_jump_pos, (int, int, int, BOOLEAN_P));
45 STATIC_DCL boolean FDECL(find_poleable_mon, (coord *, int, int));
46
47 #ifdef AMIGA
48 void FDECL(amii_speaker, (struct obj *, char *, int));
49 #endif
50
51 static const char no_elbow_room[] =
52 /*JP
53     "don't have enough elbow-room to maneuver.";
54 */
55     "\82»\82ê\82ð\82·\82é\82¾\82¯\82Ì\82ä\82Æ\82è\82ª\82È\82¢\81D";
56
57 STATIC_OVL int
58 use_camera(obj)
59 struct obj *obj;
60 {
61     struct monst *mtmp;
62
63     if (Underwater) {
64 /*JP
65         pline("Using your camera underwater would void the warranty.");
66 */
67         pline("\90\85\96Ê\89º\82Å\82Ì\83J\83\81\83\89\82Ì\8eg\97p\82Í\95Û\8fØ\82Ì\91Î\8fÛ\8aO\82Å\82·\81D");
68         return 0;
69     }
70     if (!getdir((char *) 0))
71         return 0;
72
73     if (obj->spe <= 0) {
74         pline1(nothing_happens);
75         return 1;
76     }
77     consume_obj_charge(obj, TRUE);
78
79     if (obj->cursed && !rn2(2)) {
80         (void) zapyourself(obj, TRUE);
81     } else if (u.uswallow) {
82 #if 0 /*JP*/
83         You("take a picture of %s %s.", s_suffix(mon_nam(u.ustuck)),
84             mbodypart(u.ustuck, STOMACH));
85 #else
86         You("%s\82Ì%s\82Ì\8eÊ\90^\82ð\8eB\82Á\82½\81D", mon_nam(u.ustuck),
87             mbodypart(u.ustuck, STOMACH));
88 #endif
89     } else if (u.dz) {
90 /*JP
91         You("take a picture of the %s.",
92 */
93         You("take a picture of the %s.",
94             (u.dz > 0) ? surface(u.ux, u.uy) : ceiling(u.ux, u.uy));
95     } else if (!u.dx && !u.dy) {
96         (void) zapyourself(obj, TRUE);
97     } else if ((mtmp = bhit(u.dx, u.dy, COLNO, FLASHED_LIGHT,
98                             (int FDECL((*), (MONST_P, OBJ_P))) 0,
99                             (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj)) != 0) {
100         obj->ox = u.ux, obj->oy = u.uy;
101         (void) flash_hits_mon(mtmp, obj);
102     }
103     return 1;
104 }
105
106 STATIC_OVL int
107 use_towel(obj)
108 struct obj *obj;
109 {
110     boolean drying_feedback = (obj == uwep);
111
112     if (!freehand()) {
113 /*JP
114         You("have no free %s!", body_part(HAND));
115 */
116         You("%s\82Ì\8e©\97R\82ª\8cø\82©\82È\82¢\81I", body_part(HAND));
117         return 0;
118     } else if (obj == ublindf) {
119 /*JP
120         You("cannot use it while you're wearing it!");
121 */
122         You("\82»\82ê\82ð\90g\82É\82Â\82¯\82Ä\82¢\82é\82Ì\82Å\8eg\97p\82Å\82«\82È\82¢\81I");
123         return 0;
124     } else if (obj->cursed) {
125         long old;
126
127         switch (rn2(3)) {
128         case 2:
129             old = Glib;
130             incr_itimeout(&Glib, rn1(10, 3));
131 #if 0 /*JP*/
132             Your("%s %s!", makeplural(body_part(HAND)),
133                  (old ? "are filthier than ever" : "get slimy"));
134 #else
135             Your("%s\82Í%s\81I", makeplural(body_part(HAND)),
136                  (old ? "\82Ü\82·\82Ü\82·\89\98\82È\82­\82È\82Á\82½" : "\82Ê\82é\82Ê\82é\82É\82È\82Á\82½"));
137 #endif
138             if (is_wet_towel(obj))
139                 dry_a_towel(obj, -1, drying_feedback);
140             return 1;
141         case 1:
142             if (!ublindf) {
143                 old = u.ucreamed;
144                 u.ucreamed += rn1(10, 3);
145 #if 0 /*JP*/
146                 pline("Yecch! Your %s %s gunk on it!", body_part(FACE),
147                       (old ? "has more" : "now has"));
148 #else
149                 pline("\83Q\83F\81[\81I\82 \82È\82½\82Ì%s\82Í%s\82×\82Æ\82×\82Æ\82É\82È\82Á\82½\81I", body_part(FACE),
150                       (old ? "\82à\82Á\82Æ" : ""));
151 #endif
152                 make_blinded(Blinded + (long) u.ucreamed - old, TRUE);
153             } else {
154                 const char *what;
155
156 #if 0 /*JP*/
157                 what = (ublindf->otyp == LENSES)
158                            ? "lenses"
159                            : (obj->otyp == ublindf->otyp) ? "other towel"
160                                                           : "blindfold";
161 #else
162                 what = (ublindf->otyp == LENSES)
163                            ? "\83\8c\83\93\83Y"
164                            : (obj->otyp == ublindf->otyp) ? "\83^\83I\83\8b"
165                                                           : "\96Ú\89B\82µ";
166 #endif
167                 if (ublindf->cursed) {
168 #if 0 /*JP*/
169                     You("push your %s %s.", what,
170                         rn2(2) ? "cock-eyed" : "crooked");
171 #else
172                     pline("%s\82ª%s\81D", what,
173                         rn2(2) ? "\82¸\82ê\82½" : "\82ä\82ª\82ñ\82¾");
174 #endif
175                 } else {
176                     struct obj *saved_ublindf = ublindf;
177 /*JP
178                     You("push your %s off.", what);
179 */
180                     pline("%s\82ª\82¸\82è\97\8e\82¿\82½\81D", what);
181                     Blindf_off(ublindf);
182                     dropx(saved_ublindf);
183                 }
184             }
185             if (is_wet_towel(obj))
186                 dry_a_towel(obj, -1, drying_feedback);
187             return 1;
188         case 0:
189             break;
190         }
191     }
192
193     if (Glib) {
194         Glib = 0;
195 /*JP
196         You("wipe off your %s.", makeplural(body_part(HAND)));
197 */
198         You("%s\82ð\90@\82¢\82½\81D", makeplural(body_part(HAND)));
199         if (is_wet_towel(obj))
200             dry_a_towel(obj, -1, drying_feedback);
201         return 1;
202     } else if (u.ucreamed) {
203         Blinded -= u.ucreamed;
204         u.ucreamed = 0;
205         if (!Blinded) {
206 /*JP
207             pline("You've got the glop off.");
208 */
209             You("\82³\82Á\82Ï\82è\82µ\82½\81D");
210             if (!gulp_blnd_check()) {
211                 Blinded = 1;
212                 make_blinded(0L, TRUE);
213             }
214         } else {
215 /*JP
216             Your("%s feels clean now.", body_part(FACE));
217 */
218             pline("%s\82Ì\89\98\82ê\82ð\90@\82«\82Æ\82Á\82½\81D", body_part(FACE));
219         }
220         if (is_wet_towel(obj))
221             dry_a_towel(obj, -1, drying_feedback);
222         return 1;
223     }
224
225 #if 0 /*JP*/
226     Your("%s and %s are already clean.", body_part(FACE),
227          makeplural(body_part(HAND)));
228 #else
229     Your("%s\82â%s\82Í\89\98\82ê\82Ä\82¢\82È\82¢\81D", body_part(FACE),
230          makeplural(body_part(HAND)));
231 #endif
232
233     return 0;
234 }
235
236 /* maybe give a stethoscope message based on floor objects */
237 STATIC_OVL boolean
238 its_dead(rx, ry, resp)
239 int rx, ry, *resp;
240 {
241     char buf[BUFSZ];
242     boolean more_corpses;
243     struct permonst *mptr;
244     struct obj *corpse = sobj_at(CORPSE, rx, ry),
245                *statue = sobj_at(STATUE, rx, ry);
246
247     if (!can_reach_floor(TRUE)) { /* levitation or unskilled riding */
248         corpse = 0;               /* can't reach corpse on floor */
249         /* you can't reach tiny statues (even though you can fight
250            tiny monsters while levitating--consistency, what's that?) */
251         while (statue && mons[statue->corpsenm].msize == MZ_TINY)
252             statue = nxtobj(statue, STATUE, TRUE);
253     }
254     /* when both corpse and statue are present, pick the uppermost one */
255     if (corpse && statue) {
256         if (nxtobj(statue, CORPSE, TRUE) == corpse)
257             corpse = 0; /* corpse follows statue; ignore it */
258         else
259             statue = 0; /* corpse precedes statue; ignore statue */
260     }
261     more_corpses = (corpse && nxtobj(corpse, CORPSE, TRUE));
262
263     /* additional stethoscope messages from jyoung@apanix.apana.org.au */
264     if (!corpse && !statue) {
265         ; /* nothing to do */
266
267     } else if (Hallucination) {
268         if (!corpse) {
269             /* it's a statue */
270             Strcpy(buf, "You're both stoned");
271         } else if (corpse->quan == 1L && !more_corpses) {
272             int gndr = 2; /* neuter: "it" */
273             struct monst *mtmp = get_mtraits(corpse, FALSE);
274
275             /* (most corpses don't retain the monster's sex, so
276                we're usually forced to use generic pronoun here) */
277             if (mtmp) {
278                 mptr = &mons[mtmp->mnum];
279                 /* can't use mhe() here; it calls pronoun_gender() which
280                    expects monster to be on the map (visibility check) */
281                 if ((humanoid(mptr) || (mptr->geno & G_UNIQ)
282                      || type_is_pname(mptr)) && !is_neuter(mptr))
283                     gndr = (int) mtmp->female;
284             } else {
285                 mptr = &mons[corpse->corpsenm];
286                 if (is_female(mptr))
287                     gndr = 1;
288                 else if (is_male(mptr))
289                     gndr = 0;
290             }
291             Sprintf(buf, "%s's dead", genders[gndr].he); /* "he"/"she"/"it" */
292             buf[0] = highc(buf[0]);
293         } else { /* plural */
294             Strcpy(buf, "They're dead");
295         }
296         /* variations on "He's dead, Jim." (Star Trek's Dr McCoy) */
297 /*JP
298         You_hear("a voice say, \"%s, Jim.\"", buf);
299 */
300         You_hear("\81u\82»\82¢\82Â\82Í\8e\80\82ñ\82Å\82é\82º\81C\83W\83\80\81v\82Æ\82¢\82¤\90º\82ª\95·\82±\82¦\82½\81D");
301         *resp = 1;
302         return TRUE;
303
304     } else if (corpse) {
305         boolean here = (rx == u.ux && ry == u.uy),
306                 one = (corpse->quan == 1L && !more_corpses), reviver = FALSE;
307
308         if (Role_if(PM_HEALER)) {
309             /* ok to reset `corpse' here; we're done with it */
310             do {
311                 if (obj_has_timer(corpse, REVIVE_MON))
312                     reviver = TRUE;
313                 else
314                     corpse = nxtobj(corpse, CORPSE, TRUE);
315             } while (corpse && !reviver);
316         }
317 #if 0 /*JP*/
318         You("determine that %s unfortunate being%s %s%s dead.",
319             one ? (here ? "this" : "that") : (here ? "these" : "those"),
320             one ? "" : "s", one ? "is" : "are", reviver ? " mostly" : "");
321 #else
322         You("%s\95s\8dK\82È\90\82«\95¨\82Í%s\8e\80\82ñ\82Å\82¢\82é\82Æ\8c\8b\98_\82µ\82½\81D",
323             here ? "\82±\82Ì" : "\82»\82Ì",
324             reviver ? "\82Ù\82Ú" : "");
325 #endif
326         return TRUE;
327
328     } else { /* statue */
329         const char *what, *how;
330
331         mptr = &mons[statue->corpsenm];
332         if (Blind) { /* ignore statue->dknown; it'll always be set */
333             Sprintf(buf, "%s %s",
334                     (rx == u.ux && ry == u.uy) ? "This" : "That",
335                     humanoid(mptr) ? "person" : "creature");
336             what = buf;
337         } else {
338             what = mptr->mname;
339             if (!type_is_pname(mptr))
340                 what = The(what);
341         }
342         how = "fine";
343         if (Role_if(PM_HEALER)) {
344             struct trap *ttmp = t_at(rx, ry);
345
346             if (ttmp && ttmp->ttyp == STATUE_TRAP)
347 /*JP
348                 how = "extraordinary";
349 */
350                 how = "\8c\92\8dN\93I\82È";
351             else if (Has_contents(statue))
352 /*JP
353                 how = "remarkable";
354 */
355                 how = "\96ô\93®\93I\82È";
356         }
357
358 /*JP
359         pline("%s is in %s health for a statue.", what, how);
360 */
361         pline("\92¤\91\9c\82Æ\82µ\82Ä\82Ì%s\82Í%s\8dì\95i\82¾\81D", what, how);
362         return TRUE;
363     }
364     return FALSE; /* no corpse or statue */
365 }
366
367 /*JP
368 static const char hollow_str[] = "a hollow sound.  This must be a secret %s!";
369 */
370 static const char hollow_str[] = "\82¤\82Â\82ë\82È\89¹\82ð\95·\82¢\82½\81D\94é\96§\82Ì%s\82É\88á\82¢\82È\82¢\81I";
371
372 /* Strictly speaking it makes no sense for usage of a stethoscope to
373    not take any time; however, unless it did, the stethoscope would be
374    almost useless.  As a compromise, one use per turn is free, another
375    uses up the turn; this makes curse status have a tangible effect. */
376 STATIC_OVL int
377 use_stethoscope(obj)
378 register struct obj *obj;
379 {
380     struct monst *mtmp;
381     struct rm *lev;
382     int rx, ry, res;
383     boolean interference = (u.uswallow && is_whirly(u.ustuck->data)
384                             && !rn2(Role_if(PM_HEALER) ? 10 : 3));
385
386     if (nohands(youmonst.data)) {
387 #if 0 /*JP*/
388         You("have no hands!"); /* not `body_part(HAND)' */
389 #else
390         pline("\82 \82È\82½\82É\82Í\8eè\82ª\82È\82¢\81I");
391 #endif
392         return 0;
393     } else if (Deaf) {
394 /*JP
395         You_cant("hear anything!");
396 */
397         You("\89½\82à\95·\82±\82¦\82È\82¢\81I");
398         return 0;
399     } else if (!freehand()) {
400 /*JP
401         You("have no free %s.", body_part(HAND));
402 */
403         You("%s\82Ì\8e©\97R\82ª\8cø\82©\82È\82¢\81D", body_part(HAND));
404         return 0;
405     }
406     if (!getdir((char *) 0))
407         return 0;
408
409     res = (moves == context.stethoscope_move)
410           && (youmonst.movement == context.stethoscope_movement);
411     context.stethoscope_move = moves;
412     context.stethoscope_movement = youmonst.movement;
413
414     if (u.usteed && u.dz > 0) {
415         if (interference) {
416 /*JP
417             pline("%s interferes.", Monnam(u.ustuck));
418 */
419             pline("%s\82ª\82\82á\82Ü\82ð\82µ\82½\81D", Monnam(u.ustuck));
420             mstatusline(u.ustuck);
421         } else
422             mstatusline(u.usteed);
423         return res;
424     } else if (u.uswallow && (u.dx || u.dy || u.dz)) {
425         mstatusline(u.ustuck);
426         return res;
427     } else if (u.uswallow && interference) {
428 /*JP
429         pline("%s interferes.", Monnam(u.ustuck));
430 */
431         pline("%s\82ª\82\82á\82Ü\82ð\82µ\82½\81D", Monnam(u.ustuck));
432         mstatusline(u.ustuck);
433         return res;
434     } else if (u.dz) {
435         if (Underwater)
436 /*JP
437             You_hear("faint splashing.");
438 */
439             You_hear("\82©\82·\82©\82É\83o\83V\83\83\83o\83V\83\83\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
440         else if (u.dz < 0 || !can_reach_floor(TRUE))
441             cant_reach_floor(u.ux, u.uy, (u.dz < 0), TRUE);
442         else if (its_dead(u.ux, u.uy, &res))
443             ; /* message already given */
444         else if (Is_stronghold(&u.uz))
445 /*JP
446             You_hear("the crackling of hellfire.");
447 */
448           You_hear("\92n\8d\96\82Ì\89\8a\82ª\83p\83`\83p\83`\94R\82¦\82Ä\82¢\82é\89¹\82ð\95·\82¢\82½\81D");
449         else
450 /*JP
451             pline_The("%s seems healthy enough.", surface(u.ux, u.uy));
452 */
453             pline("%s\82Í\8f[\95ª\8c\92\8dN\82Ì\82æ\82¤\82¾\81D", surface(u.ux,u.uy));
454         return res;
455     } else if (obj->cursed && !rn2(2)) {
456 /*JP
457         You_hear("your heart beat.");
458 */
459         You_hear("\8e©\95ª\82Ì\90S\91\9f\82Ì\8cÛ\93®\82ð\95·\82¢\82½\81D");
460         return res;
461     }
462     if (Stunned || (Confusion && !rn2(5)))
463         confdir();
464     if (!u.dx && !u.dy) {
465         ustatusline();
466         return res;
467     }
468     rx = u.ux + u.dx;
469     ry = u.uy + u.dy;
470     if (!isok(rx, ry)) {
471 /*JP
472         You_hear("a faint typing noise.");
473 */
474         You_hear("\82©\82·\82©\82É\82¾\82ê\82©\82ª\83^\83C\83s\83\93\83O\82µ\82Ä\82¢\82é\89¹\82ð\95·\82¢\82½\81D");
475         return 0;
476     }
477     if ((mtmp = m_at(rx, ry)) != 0) {
478         const char *mnm = x_monnam(mtmp, ARTICLE_A, (const char *) 0,
479                                    SUPPRESS_IT | SUPPRESS_INVISIBLE, FALSE);
480
481         if (mtmp->mundetected) {
482             if (!canspotmon(mtmp))
483                 There("is %s hidden there.", mnm);
484             mtmp->mundetected = 0;
485             newsym(mtmp->mx, mtmp->my);
486         } else if (mtmp->mappearance) {
487             const char *what = "thing";
488
489             switch (mtmp->m_ap_type) {
490             case M_AP_OBJECT:
491                 what = simple_typename(mtmp->mappearance);
492                 break;
493             case M_AP_MONSTER: /* ignore Hallucination here */
494                 what = mons[mtmp->mappearance].mname;
495                 break;
496             case M_AP_FURNITURE:
497                 what = defsyms[mtmp->mappearance].explanation;
498                 break;
499             }
500             seemimic(mtmp);
501             pline("That %s is really %s", what, mnm);
502         } else if (flags.verbose && !canspotmon(mtmp)) {
503             There("is %s there.", mnm);
504         }
505         mstatusline(mtmp);
506         if (!canspotmon(mtmp))
507             map_invisible(rx, ry);
508         return res;
509     }
510     if (glyph_is_invisible(levl[rx][ry].glyph)) {
511         unmap_object(rx, ry);
512         newsym(rx, ry);
513 /*JP
514         pline_The("invisible monster must have moved.");
515 */
516         pline_The("\8c©\82¦\82È\82¢\89ö\95¨\82Í\88Ú\93®\82µ\82Ä\82µ\82Ü\82Á\82½\82æ\82¤\82¾\81D");
517     }
518     lev = &levl[rx][ry];
519     switch (lev->typ) {
520     case SDOOR:
521 /*JP
522         You_hear(hollow_str, "door");
523 */
524         You_hear(hollow_str, "\94à");
525         cvt_sdoor_to_door(lev); /* ->typ = DOOR */
526         feel_newsym(rx, ry);
527         return res;
528     case SCORR:
529 /*JP
530         You_hear(hollow_str, "passage");
531 */
532         You_hear(hollow_str, "\92Ê\98H");
533         lev->typ = CORR;
534         unblock_point(rx, ry);
535         feel_newsym(rx, ry);
536         return res;
537     }
538
539     if (!its_dead(rx, ry, &res))
540 #if 0 /*JP*/
541         You("hear nothing special."); /* not You_hear()  */
542 #else
543         pline("\93Á\82É\89½\82à\95·\82±\82¦\82È\82¢\81D");
544 #endif
545     return res;
546 }
547
548 /*JP
549 static const char whistle_str[] = "produce a %s whistling sound.";
550 */
551 static const char whistle_str[] = "\93J\82ð\90\81\82¢\82Ä%s\89¹\82ð\82½\82Ä\82½\81D";
552
553 STATIC_OVL void
554 use_whistle(obj)
555 struct obj *obj;
556 {
557     if (!can_blow(&youmonst)) {
558 /*JP
559         You("are incapable of using the whistle.");
560 */
561         You("\93J\82ð\8eg\82¤\94\\97Í\82ª\82È\82¢\81D");
562     } else if (Underwater) {
563 /*JP
564         You("blow bubbles through %s.", yname(obj));
565 */
566         You("%s\82ð\92Ê\82µ\82Ä\96A\82ð\8fo\82µ\82½\81D", yname(obj));
567     } else {
568 /*JP
569         You(whistle_str, obj->cursed ? "shrill" : "high");
570 */
571         You(whistle_str, obj->cursed ? "\95s\8bC\96¡\82È" : "\82©\82ñ\8d\82\82¢");
572         wake_nearby();
573     }
574 }
575
576 STATIC_OVL void
577 use_magic_whistle(obj)
578 struct obj *obj;
579 {
580     register struct monst *mtmp, *nextmon;
581
582     if (!can_blow(&youmonst)) {
583 /*JP
584         You("are incapable of using the whistle.");
585 */
586         You("\93J\82ð\8eg\82¤\94\\97Í\82ª\82È\82¢\81D");
587     } else if (obj->cursed && !rn2(2)) {
588 #if 0 /*JP*/
589         You("produce a %shigh-pitched humming noise.",
590             Underwater ? "very " : "");
591 #else
592         You("%s\8d\82\82¢\92²\8eq\82Ì\82¤\82È\82é\82æ\82¤\82È\89¹\82ð\82½\82Ä\82½\81D",
593             Underwater ? "\82Æ\82Ä\82à" : "");
594 #endif
595         wake_nearby();
596     } else {
597         int pet_cnt = 0, omx, omy;
598
599         /* it's magic!  it works underwater too (at a higher pitch) */
600 #if 0 /*JP*/
601         You(whistle_str,
602             Hallucination ? "normal" : Underwater ? "strange, high-pitched"
603                                                   : "strange");
604 #else
605         You(whistle_str,
606             Hallucination ? "\93J\82Ì\82æ\82¤\82È" : Underwater ? "\95s\8ev\8bc\82È\8d\82\82¢\92²\8eq\82Ì"
607                                                   : "\95s\8ev\8bc\82È");
608 #endif
609         for (mtmp = fmon; mtmp; mtmp = nextmon) {
610             nextmon = mtmp->nmon; /* trap might kill mon */
611             if (DEADMONSTER(mtmp))
612                 continue;
613             /* steed is already at your location, so not affected;
614                this avoids trap issues if you're on a trap location */
615             if (mtmp == u.usteed)
616                 continue;
617             if (mtmp->mtame) {
618                 if (mtmp->mtrapped) {
619                     /* no longer in previous trap (affects mintrap) */
620                     mtmp->mtrapped = 0;
621                     fill_pit(mtmp->mx, mtmp->my);
622                 }
623                 /* mimic must be revealed before we know whether it
624                    actually moves because line-of-sight may change */
625                 if (mtmp->m_ap_type)
626                     seemimic(mtmp);
627                 omx = mtmp->mx, omy = mtmp->my;
628                 mnexto(mtmp);
629                 if (mtmp->mx != omx || mtmp->my != omy) {
630                     mtmp->mundetected = 0; /* reveal non-mimic hider */
631                     if (canspotmon(mtmp))
632                         ++pet_cnt;
633                     if (mintrap(mtmp) == 2)
634                         change_luck(-1);
635                 }
636             }
637         }
638         if (pet_cnt > 0)
639             makeknown(obj->otyp);
640     }
641 }
642
643 boolean
644 um_dist(x, y, n)
645 xchar x, y, n;
646 {
647     return (boolean) (abs(u.ux - x) > n || abs(u.uy - y) > n);
648 }
649
650 int
651 number_leashed()
652 {
653     int i = 0;
654     struct obj *obj;
655
656     for (obj = invent; obj; obj = obj->nobj)
657         if (obj->otyp == LEASH && obj->leashmon != 0)
658             i++;
659     return i;
660 }
661
662 /* otmp is about to be destroyed or stolen */
663 void
664 o_unleash(otmp)
665 register struct obj *otmp;
666 {
667     register struct monst *mtmp;
668
669     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
670         if (mtmp->m_id == (unsigned) otmp->leashmon)
671             mtmp->mleashed = 0;
672     otmp->leashmon = 0;
673 }
674
675 /* mtmp is about to die, or become untame */
676 void
677 m_unleash(mtmp, feedback)
678 register struct monst *mtmp;
679 boolean feedback;
680 {
681     register struct obj *otmp;
682
683     if (feedback) {
684         if (canseemon(mtmp))
685 /*JP
686             pline("%s pulls free of %s leash!", Monnam(mtmp), mhis(mtmp));
687 */
688             pline("%s\82Í\95R\82ð\88ø\82Á\82Ï\82Á\82Ä\93¦\82ê\82½\81I", Monnam(mtmp));
689         else
690 /*JP
691             Your("leash falls slack.");
692 */
693             Your("\95R\82ª\82½\82é\82ñ\82Å\97\8e\82¿\82½\81D");
694     }
695     for (otmp = invent; otmp; otmp = otmp->nobj)
696         if (otmp->otyp == LEASH && otmp->leashmon == (int) mtmp->m_id)
697             otmp->leashmon = 0;
698     mtmp->mleashed = 0;
699 }
700
701 /* player is about to die (for bones) */
702 void
703 unleash_all()
704 {
705     register struct obj *otmp;
706     register struct monst *mtmp;
707
708     for (otmp = invent; otmp; otmp = otmp->nobj)
709         if (otmp->otyp == LEASH)
710             otmp->leashmon = 0;
711     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
712         mtmp->mleashed = 0;
713 }
714
715 #define MAXLEASHED 2
716
717 static boolean
718 leashable(mtmp)
719 struct monst *mtmp;
720 {
721     return (boolean) (mtmp->mnum != PM_LONG_WORM);
722 }
723
724 /* ARGSUSED */
725 STATIC_OVL void
726 use_leash(obj)
727 struct obj *obj;
728 {
729     coord cc;
730     register struct monst *mtmp;
731     int spotmon;
732
733     if (!obj->leashmon && number_leashed() >= MAXLEASHED) {
734 /*JP
735         You("cannot leash any more pets.");
736 */
737         You("\82±\82ê\88È\8fã\83y\83b\83g\82É\95R\82ð\82©\82¯\82ç\82ê\82È\82¢\81D");
738         return;
739     }
740
741     if (!get_adjacent_loc((char *) 0, (char *) 0, u.ux, u.uy, &cc))
742         return;
743
744     if ((cc.x == u.ux) && (cc.y == u.uy)) {
745         if (u.usteed && u.dz > 0) {
746             mtmp = u.usteed;
747             spotmon = 1;
748             goto got_target;
749         }
750 /*JP
751         pline("Leash yourself?  Very funny...");
752 */
753         pline("\8e©\95ª\82ð\94\9b\82é\81H\95Ï\82È\82Ì\81D\81D\81D");
754         return;
755     }
756
757     if (!(mtmp = m_at(cc.x, cc.y))) {
758 /*JP
759         There("is no creature there.");
760 */
761         pline("\82»\82±\82É\82Í\90\82«\95¨\82Í\82¢\82È\82¢\81D");
762         return;
763     }
764
765     spotmon = canspotmon(mtmp);
766 got_target:
767
768     if (!mtmp->mtame) {
769         if (!spotmon)
770 /*JP
771             There("is no creature there.");
772 */
773             pline("\82»\82±\82É\82Í\90\82«\95¨\82Í\82¢\82È\82¢\81D");
774         else
775 #if 0 /*JP*/
776             pline("%s %s leashed!", Monnam(mtmp),
777                   (!obj->leashmon) ? "cannot be" : "is not");
778 #else
779           pline("%s\82Í\95R\82Å%s\81I", Monnam(mtmp),
780                   (!obj->leashmon) ? "\8c\8b\82×\82È\82¢" : "\8c\8b\82Î\82ê\82Ä\82¢\82È\82¢");
781 #endif
782         return;
783     }
784     if (!obj->leashmon) {
785         if (mtmp->mleashed) {
786 #if 0 /*JP*/
787             pline("This %s is already leashed.",
788                   spotmon ? l_monnam(mtmp) : "monster");
789 #else
790             pline("%s\82Í\82·\82Å\82É\8c\8b\82Ñ\82Â\82¯\82ç\82ê\82Ä\82¢\82é\81D",
791                   spotmon ? l_monnam(mtmp) : "\89ö\95¨");
792 #endif
793             return;
794         }
795         if (!leashable(mtmp)) {
796 #if 0 /*JP*/
797             pline("The leash won't fit onto %s%s.", spotmon ? "your " : "",
798                   l_monnam(mtmp));
799 #else
800             pline("\95R\82Í%s\82É\8d\87\82í\82È\82¢\81D",
801                   l_monnam(mtmp));
802 #endif
803             return;
804         }
805
806 #if 0 /*JP*/
807         You("slip the leash around %s%s.", spotmon ? "your " : "",
808             l_monnam(mtmp));
809 #else
810         You("%s\82ð\95R\82Å\8c\8b\82Ñ\82Â\82¯\82½\81D",
811             l_monnam(mtmp));
812 #endif
813         mtmp->mleashed = 1;
814         obj->leashmon = (int) mtmp->m_id;
815         mtmp->msleeping = 0;
816         return;
817     }
818     if (obj->leashmon != (int) mtmp->m_id) {
819 /*JP
820         pline("This leash is not attached to that creature.");
821 */
822         pline("\82±\82Ì\95R\82Í\82»\82ê\82É\82Í\8c\8b\82Î\82ê\82Ä\82¢\82È\82¢\81D");
823         return;
824     } else {
825         if (obj->cursed) {
826 /*JP
827             pline_The("leash would not come off!");
828 */
829             pline("\95R\82ª\82Í\82¸\82ê\82È\82¢\81I");
830             obj->bknown = TRUE;
831             return;
832         }
833         mtmp->mleashed = 0;
834         obj->leashmon = 0;
835 #if 0 /*JP*/
836         You("remove the leash from %s%s.", spotmon ? "your " : "",
837             l_monnam(mtmp));
838 #else
839         You("%s\82©\82ç\95R\82ð\82Í\82¸\82µ\82½\81D",
840             l_monnam(mtmp));
841 #endif
842     }
843     return;
844 }
845
846 /* assuming mtmp->mleashed has been checked */
847 struct obj *
848 get_mleash(mtmp)
849 struct monst *mtmp;
850 {
851     struct obj *otmp;
852
853     otmp = invent;
854     while (otmp) {
855         if (otmp->otyp == LEASH && otmp->leashmon == (int) mtmp->m_id)
856             return otmp;
857         otmp = otmp->nobj;
858     }
859     return (struct obj *) 0;
860 }
861
862 boolean
863 next_to_u()
864 {
865     register struct monst *mtmp;
866     register struct obj *otmp;
867
868     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
869         if (DEADMONSTER(mtmp))
870             continue;
871         if (mtmp->mleashed) {
872             if (distu(mtmp->mx, mtmp->my) > 2)
873                 mnexto(mtmp);
874             if (distu(mtmp->mx, mtmp->my) > 2) {
875                 for (otmp = invent; otmp; otmp = otmp->nobj)
876                     if (otmp->otyp == LEASH
877                         && otmp->leashmon == (int) mtmp->m_id) {
878                         if (otmp->cursed)
879                             return FALSE;
880 #if 0 /*JP*/
881                         You_feel("%s leash go slack.",
882                                  (number_leashed() > 1) ? "a" : "the");
883 #else
884                         You("\95R\82ª\82½\82é\82ñ\82¾\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
885 #endif
886                         mtmp->mleashed = 0;
887                         otmp->leashmon = 0;
888                     }
889             }
890         }
891     }
892     /* no pack mules for the Amulet */
893     if (u.usteed && mon_has_amulet(u.usteed))
894         return FALSE;
895     return TRUE;
896 }
897
898 void
899 check_leash(x, y)
900 register xchar x, y;
901 {
902     register struct obj *otmp;
903     register struct monst *mtmp;
904
905     for (otmp = invent; otmp; otmp = otmp->nobj) {
906         if (otmp->otyp != LEASH || otmp->leashmon == 0)
907             continue;
908         for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
909             if (DEADMONSTER(mtmp))
910                 continue;
911             if ((int) mtmp->m_id == otmp->leashmon)
912                 break;
913         }
914         if (!mtmp) {
915             impossible("leash in use isn't attached to anything?");
916             otmp->leashmon = 0;
917             continue;
918         }
919         if (dist2(u.ux, u.uy, mtmp->mx, mtmp->my)
920             > dist2(x, y, mtmp->mx, mtmp->my)) {
921             if (!um_dist(mtmp->mx, mtmp->my, 3)) {
922                 ; /* still close enough */
923             } else if (otmp->cursed && !breathless(mtmp->data)) {
924                 if (um_dist(mtmp->mx, mtmp->my, 5)
925                     || (mtmp->mhp -= rnd(2)) <= 0) {
926                     long save_pacifism = u.uconduct.killer;
927
928 /*JP
929                     Your("leash chokes %s to death!", mon_nam(mtmp));
930 */
931                     pline("%s\82Í\8di\82ß\8eE\82³\82ê\82½\81I",mon_nam(mtmp));
932                     /* hero might not have intended to kill pet, but
933                        that's the result of his actions; gain experience,
934                        lose pacifism, take alignment and luck hit, make
935                        corpse less likely to remain tame after revival */
936                     xkilled(mtmp, 0); /* no "you kill it" message */
937                     /* life-saving doesn't ordinarily reset this */
938                     if (mtmp->mhp > 0)
939                         u.uconduct.killer = save_pacifism;
940                 } else {
941 /*JP
942                     pline("%s is choked by the leash!", Monnam(mtmp));
943 */
944                     pline("%s\82Í\95R\82Å\8eñ\82ð\8di\82ß\82ç\82ê\82½\81I", Monnam(mtmp));
945                     /* tameness eventually drops to 1 here (never 0) */
946                     if (mtmp->mtame && rn2(mtmp->mtame))
947                         mtmp->mtame--;
948                 }
949             } else {
950                 if (um_dist(mtmp->mx, mtmp->my, 5)) {
951 /*JP
952                     pline("%s leash snaps loose!", s_suffix(Monnam(mtmp)));
953 */
954                     pline("%s\82Ì\95R\82Í\83p\83`\83\93\82Æ\8aO\82ê\82½\81I", Monnam(mtmp));
955                     m_unleash(mtmp, FALSE);
956                 } else {
957 /*JP
958                     You("pull on the leash.");
959 */
960                     You("\95R\82ð\88ø\82Á\82Ï\82Á\82½\81D");
961                     if (mtmp->data->msound != MS_SILENT)
962                         switch (rn2(3)) {
963                         case 0:
964                             growl(mtmp);
965                             break;
966                         case 1:
967                             yelp(mtmp);
968                             break;
969                         default:
970                             whimper(mtmp);
971                             break;
972                         }
973                 }
974             }
975         }
976     }
977 }
978
979 const char *
980 beautiful()
981 {
982     return ((ACURR(A_CHA) > 14)
983                ? ((poly_gender() == 1)
984 #if 0 /*JP*/
985                      ? "beautiful"
986                      : "handsome")
987                : "ugly");
988 #else
989 /*JP \8cê\8a²\82Å\8eg\82¤ */
990                      ? "\94ü\82µ"
991                      : "\82è\82è\82µ")
992                : "\8fX");
993 #endif
994 }
995
996 #define WEAK 3 /* from eat.c */
997
998 /*JP
999 static const char look_str[] = "look %s.";
1000 */
1001 static const char look_str[] = "%s\8c©\82¦\82é\81D";
1002
1003 STATIC_OVL int
1004 use_mirror(obj)
1005 struct obj *obj;
1006 {
1007     const char *mirror, *uvisage;
1008     struct monst *mtmp;
1009     unsigned how_seen;
1010     char mlet;
1011     boolean vis, invis_mirror, useeit, monable;
1012
1013     if (!getdir((char *) 0))
1014         return 0;
1015     invis_mirror = Invis;
1016     useeit = !Blind && (!invis_mirror || See_invisible);
1017     uvisage = beautiful();
1018     mirror = simpleonames(obj); /* "mirror" or "looking glass" */
1019     if (obj->cursed && !rn2(2)) {
1020         if (!Blind)
1021 /*JP
1022             pline_The("%s fogs up and doesn't reflect!", mirror);
1023 */
1024             pline("%s\82Í\93Ü\82è\81C\89f\82ç\82È\82­\82È\82Á\82½\81I", mirror);
1025         return 1;
1026     }
1027     if (!u.dx && !u.dy && !u.dz) {
1028         if (!useeit) {
1029 /*JP
1030             You_cant("see your %s %s.", uvisage, body_part(FACE));
1031 */
1032             You_cant("\8e©\95ª\82Ì%s\82¢%s\82ð\8c©\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D", uvisage, body_part(FACE));
1033         } else {
1034             if (u.umonnum == PM_FLOATING_EYE) {
1035                 if (Free_action) {
1036 /*JP
1037                     You("stiffen momentarily under your gaze.");
1038 */
1039                     pline("\88ê\8fu\82 \82È\82½\82Ì\82É\82ç\82Ý\82Å\8dd\92¼\82µ\82½\81D");
1040                 } else {
1041                     if (Hallucination)
1042 /*JP
1043                         pline("Yow!  The %s stares back!", mirror);
1044 */
1045                         pline("\82¨\82ì\81I%s\82ª\82 \82È\82½\82ð\82É\82ç\82Ý\95Ô\82µ\82½\81I", mirror);
1046                     else
1047 /*JP
1048                         pline("Yikes!  You've frozen yourself!");
1049 */
1050                         pline("\82¨\82ì\81I\82 \82È\82½\82Í\93®\82¯\82È\82­\82È\82Á\82½\81I");
1051                     if (!Hallucination || !rn2(4)) {
1052                         nomul(-rnd(MAXULEV + 6 - u.ulevel));
1053                         multi_reason = "gazing into a mirror";
1054                     }
1055                     nomovemsg = 0; /* default, "you can move again" */
1056                 }
1057             } else if (youmonst.data->mlet == S_VAMPIRE)
1058 /*JP
1059                 You("don't have a reflection.");
1060 */
1061                 You("\8b¾\82É\89f\82ç\82È\82©\82Á\82½\81D");
1062             else if (u.umonnum == PM_UMBER_HULK) {
1063 /*JP
1064                 pline("Huh?  That doesn't look like you!");
1065 */
1066                 pline("\82Ù\82¦\81H\8eÊ\82Á\82Ä\82é\82Ì\82Í\82 \82È\82½\82\82á\82È\82¢\82Ý\82½\82¢\82¾\81I");
1067                 make_confused(HConfusion + d(3, 4), FALSE);
1068             } else if (Hallucination)
1069                 You(look_str, hcolor((char *) 0));
1070             else if (Sick)
1071 /*JP
1072                 You(look_str, "peaked");
1073 */
1074                 You(look_str, "\8aç\90F\82ª\88«\82­");
1075             else if (u.uhs >= WEAK)
1076 /*JP
1077                 You(look_str, "undernourished");
1078 */
1079                 You(look_str, "\89h\97{\8e¸\92²\82Ì\82æ\82¤\82É");
1080             else
1081 /*JP
1082                 You("look as %s as ever.", uvisage);
1083 */
1084                 You("\82 \82¢\82©\82í\82ç\82¸%s\82­\8c©\82¦\82é\81D", uvisage);
1085         }
1086         return 1;
1087     }
1088     if (u.uswallow) {
1089         if (useeit)
1090             You("reflect %s %s.", s_suffix(mon_nam(u.ustuck)),
1091                 mbodypart(u.ustuck, STOMACH));
1092         return 1;
1093     }
1094     if (Underwater) {
1095         if (useeit)
1096 #if 0 /*JP*/
1097             You(Hallucination ? "give the fish a chance to fix their makeup."
1098                               : "reflect the murky water.");
1099 #else
1100             You(Hallucination ? "\8b\9b\82É\89»\8fÏ\92¼\82µ\82Ì\8b@\89ï\82ð\97^\82¦\82½\81D"
1101                               : "\82 \82È\82½\82Í\97\84\82ñ\82¾\90\85\82ð\89f\82µ\82½\81D");
1102 #endif
1103         return 1;
1104     }
1105     if (u.dz) {
1106         if (useeit)
1107 /*JP
1108             You("reflect the %s.",
1109 */
1110             You("%s\82ð\89f\82µ\82½\81D",
1111                 (u.dz > 0) ? surface(u.ux, u.uy) : ceiling(u.ux, u.uy));
1112         return 1;
1113     }
1114     mtmp = bhit(u.dx, u.dy, COLNO, INVIS_BEAM,
1115                 (int FDECL((*), (MONST_P, OBJ_P))) 0,
1116                 (int FDECL((*), (OBJ_P, OBJ_P))) 0, &obj);
1117     if (!mtmp || !haseyes(mtmp->data) || notonhead)
1118         return 1;
1119
1120     /* couldsee(mtmp->mx, mtmp->my) is implied by the fact that bhit()
1121        targetted it, so we can ignore possibility of X-ray vision */
1122     vis = canseemon(mtmp);
1123 /* ways to directly see monster (excludes X-ray vision, telepathy,
1124    extended detection, type-specific warning) */
1125 #define SEENMON (MONSEEN_NORMAL | MONSEEN_SEEINVIS | MONSEEN_INFRAVIS)
1126     how_seen = vis ? howmonseen(mtmp) : 0;
1127     /* whether monster is able to use its vision-based capabilities */
1128     monable = !mtmp->mcan && (!mtmp->minvis || perceives(mtmp->data));
1129     mlet = mtmp->data->mlet;
1130     if (mtmp->msleeping) {
1131         if (vis)
1132 /*JP
1133             pline("%s is too tired to look at your %s.", Monnam(mtmp),
1134 */
1135             pline("%s\82Í\82Æ\82Ä\82à\94æ\82ê\82Ä\82¢\82Ä%s\82ð\8c©\82é\82Ç\82±\82ë\82\82á\82È\82¢\81D", Monnam(mtmp),
1136                   mirror);
1137     } else if (!mtmp->mcansee) {
1138         if (vis)
1139 /*JP
1140             pline("%s can't see anything right now.", Monnam(mtmp));
1141 */
1142             pline("%s\82Í\8d¡\82Ì\82Æ\82±\82ë\89½\82à\8c©\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D", Monnam(mtmp));
1143     } else if (invis_mirror && !perceives(mtmp->data)) {
1144         if (vis)
1145 /*JP
1146             pline("%s fails to notice your %s.", Monnam(mtmp), mirror);
1147 */
1148             pline("%s\82Í\82 \82È\82½\82Ì%s\82É\8bC\95t\82©\82È\82©\82Á\82½\81D", Monnam(mtmp), mirror);
1149         /* infravision doesn't produce an image in the mirror */
1150     } else if ((how_seen & SEENMON) == MONSEEN_INFRAVIS) {
1151         if (vis) /* (redundant) */
1152 #if 0 /*JP*/
1153             pline("%s is too far away to see %sself in the dark.",
1154                   Monnam(mtmp), mhim(mtmp));
1155 #else
1156             pline("%s\82Í\88Ã\88Å\82Å\8e©\95ª\8e©\90g\82ð\8c©\82é\82É\82Í\89\93\82·\82¬\82é\81D", Monnam(mtmp));
1157 #endif
1158         /* some monsters do special things */
1159     } else if (mlet == S_VAMPIRE || mlet == S_GHOST || is_vampshifter(mtmp)) {
1160         if (vis)
1161 /*JP
1162             pline("%s doesn't have a reflection.", Monnam(mtmp));
1163 */
1164             pline("%s\82Í%s\82É\89f\82ç\82È\82¢\81D", Monnam(mtmp), mirror);
1165     } else if (monable && mtmp->data == &mons[PM_MEDUSA]) {
1166 /*JP
1167         if (mon_reflects(mtmp, "The gaze is reflected away by %s %s!"))
1168 */
1169         if (mon_reflects(mtmp, "\82É\82ç\82Ý\82Í%s\82Ì%s\82Å\94½\8eË\82µ\82½\81I"))
1170             return 1;
1171         if (vis)
1172 /*JP
1173             pline("%s is turned to stone!", Monnam(mtmp));
1174 */
1175             pline("%s\82Í\90Î\82É\82È\82Á\82½\81I", Monnam(mtmp));
1176         stoned = TRUE;
1177         killed(mtmp);
1178     } else if (monable && mtmp->data == &mons[PM_FLOATING_EYE]) {
1179         int tmp = d((int) mtmp->m_lev, (int) mtmp->data->mattk[0].damd);
1180         if (!rn2(4))
1181             tmp = 120;
1182         if (vis)
1183 /*JP
1184             pline("%s is frozen by its reflection.", Monnam(mtmp));
1185 */
1186             pline("%s\82Í\8e©\95ª\82Ì\8ep\82ð\8c©\82Ä\93®\82¯\82È\82­\82È\82Á\82½\81D", Monnam(mtmp));
1187         else
1188 /*JP
1189             You_hear("%s stop moving.", something);
1190 */
1191             You_hear("\89½\82©\82ª\93®\82«\82ð\82Æ\82ß\82½\89¹\82ð\95·\82¢\82½\81D");
1192         paralyze_monst(mtmp, (int) mtmp->mfrozen + tmp);
1193     } else if (monable && mtmp->data == &mons[PM_UMBER_HULK]) {
1194         if (vis)
1195 /*JP
1196             pline("%s confuses itself!", Monnam(mtmp));
1197 */
1198             pline("%s\82Í\8d¬\97\90\82µ\82½\81I", Monnam(mtmp));
1199         mtmp->mconf = 1;
1200     } else if (monable && (mlet == S_NYMPH || mtmp->data == &mons[PM_SUCCUBUS]
1201                            || mtmp->data == &mons[PM_INCUBUS])) {
1202         if (vis) {
1203             char buf[BUFSZ]; /* "She" or "He" */
1204
1205 #if 0 /*JP*/
1206             pline("%s admires %sself in your %s.", Monnam(mtmp), mhim(mtmp),
1207                   mirror);
1208 #else
1209             pline("%s\82Í\8e©\95ª\82Ì\8ep\82É\82¤\82Á\82Æ\82è\82µ\82½\81D", Monnam(mtmp));
1210 #endif
1211 /*JP
1212             pline("%s takes it!", upstart(strcpy(buf, mhe(mtmp))));
1213 */
1214             pline("%s\82Í\82»\82ê\82ð\92D\82Á\82½\81I", upstart(strcpy(buf, mhe(mtmp))));
1215         } else
1216 /*JP
1217             pline("It steals your %s!", mirror);
1218 */
1219             pline("\89½\8eÒ\82©\82ª\82 \82È\82½\82Ì%s\82ð\93\90\82ñ\82¾\81I", mirror);
1220         setnotworn(obj); /* in case mirror was wielded */
1221         freeinv(obj);
1222         (void) mpickobj(mtmp, obj);
1223         if (!tele_restrict(mtmp))
1224             (void) rloc(mtmp, TRUE);
1225     } else if (!is_unicorn(mtmp->data) && !humanoid(mtmp->data)
1226                && (!mtmp->minvis || perceives(mtmp->data)) && rn2(5)) {
1227         if (vis)
1228 /*JP
1229             pline("%s is frightened by its reflection.", Monnam(mtmp));
1230 */
1231             pline("%s\82Í\8e©\95ª\82Ì\8ep\82ð\8c©\82Ä\95|\82ª\82Á\82½\81D", Monnam(mtmp));
1232         monflee(mtmp, d(2, 4), FALSE, FALSE);
1233     } else if (!Blind) {
1234         if (mtmp->minvis && !See_invisible)
1235             ;
1236         else if ((mtmp->minvis && !perceives(mtmp->data))
1237                  /* redundant: can't get here if these are true */
1238                  || !haseyes(mtmp->data) || notonhead || !mtmp->mcansee)
1239 #if 0 /*JP*/
1240             pline("%s doesn't seem to notice %s reflection.", Monnam(mtmp),
1241                   mhis(mtmp));
1242 #else
1243             pline("%s\82Í\8e©\95ª\82Ì\8ep\82É\8bC\82ª\82Â\82¢\82Ä\82È\82¢\82æ\82¤\82¾\81D", Monnam(mtmp));
1244 #endif
1245         else
1246 /*JP
1247             pline("%s ignores %s reflection.", Monnam(mtmp), mhis(mtmp));
1248 */
1249             pline("%s\82Í\8e©\95ª\82Ì\8ep\82ð\96³\8e\8b\82µ\82½\81D", Monnam(mtmp));
1250     }
1251     return 1;
1252 }
1253
1254 STATIC_OVL void
1255 use_bell(optr)
1256 struct obj **optr;
1257 {
1258     register struct obj *obj = *optr;
1259     struct monst *mtmp;
1260     boolean wakem = FALSE, learno = FALSE,
1261             ordinary = (obj->otyp != BELL_OF_OPENING || !obj->spe),
1262             invoking =
1263                 (obj->otyp == BELL_OF_OPENING && invocation_pos(u.ux, u.uy)
1264                  && !On_stairs(u.ux, u.uy));
1265
1266 /*JP
1267     You("ring %s.", the(xname(obj)));
1268 */
1269     You("%s\82ð\96Â\82ç\82µ\82½\81D", the(xname(obj)));
1270
1271     if (Underwater || (u.uswallow && ordinary)) {
1272 #ifdef AMIGA
1273         amii_speaker(obj, "AhDhGqEqDhEhAqDqFhGw", AMII_MUFFLED_VOLUME);
1274 #endif
1275 /*JP
1276         pline("But the sound is muffled.");
1277 */
1278         pline("\82µ\82©\82µ\89¹\82Í\82©\82«\8fÁ\82³\82ê\82½\81D");
1279
1280     } else if (invoking && ordinary) {
1281         /* needs to be recharged... */
1282 /*JP
1283         pline("But it makes no sound.");
1284 */
1285         pline("\82µ\82©\82µ\81C\89¹\82Í\96Â\82ç\82È\82©\82Á\82½\81D");
1286         learno = TRUE; /* help player figure out why */
1287
1288     } else if (ordinary) {
1289 #ifdef AMIGA
1290         amii_speaker(obj, "ahdhgqeqdhehaqdqfhgw", AMII_MUFFLED_VOLUME);
1291 #endif
1292         if (obj->cursed && !rn2(4)
1293             /* note: once any of them are gone, we stop all of them */
1294             && !(mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
1295             && !(mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
1296             && !(mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
1297             && (mtmp = makemon(mkclass(S_NYMPH, 0), u.ux, u.uy, NO_MINVENT))
1298                    != 0) {
1299 /*JP
1300             You("summon %s!", a_monnam(mtmp));
1301 */
1302             You("%s\82ð\8f¢\8a«\82µ\82½\81I", a_monnam(mtmp));
1303             if (!obj_resists(obj, 93, 100)) {
1304 /*JP
1305                 pline("%s shattered!", Tobjnam(obj, "have"));
1306 */
1307                 pline("%s\82Í\95²\81X\82É\82È\82Á\82½\81I", xname(obj));
1308                 useup(obj);
1309                 *optr = 0;
1310             } else
1311                 switch (rn2(3)) {
1312                 default:
1313                     break;
1314                 case 1:
1315                     mon_adjust_speed(mtmp, 2, (struct obj *) 0);
1316                     break;
1317                 case 2: /* no explanation; it just happens... */
1318                     nomovemsg = "";
1319                     multi_reason = NULL;
1320                     nomul(-rnd(2));
1321                     break;
1322                 }
1323         }
1324         wakem = TRUE;
1325
1326     } else {
1327         /* charged Bell of Opening */
1328         consume_obj_charge(obj, TRUE);
1329
1330         if (u.uswallow) {
1331             if (!obj->cursed)
1332                 (void) openit();
1333             else
1334                 pline1(nothing_happens);
1335
1336         } else if (obj->cursed) {
1337             coord mm;
1338
1339             mm.x = u.ux;
1340             mm.y = u.uy;
1341             mkundead(&mm, FALSE, NO_MINVENT);
1342             wakem = TRUE;
1343
1344         } else if (invoking) {
1345 /*JP
1346             pline("%s an unsettling shrill sound...", Tobjnam(obj, "issue"));
1347 */
1348             pline("%s\82Í\95s\8bC\96¡\82È\89s\82¢\89¹\82ð\8fo\82µ\82½\81D\81D\81D", xname(obj));
1349 #ifdef AMIGA
1350             amii_speaker(obj, "aefeaefeaefeaefeaefe", AMII_LOUDER_VOLUME);
1351 #endif
1352             obj->age = moves;
1353             learno = TRUE;
1354             wakem = TRUE;
1355
1356         } else if (obj->blessed) {
1357             int res = 0;
1358
1359 #ifdef AMIGA
1360             amii_speaker(obj, "ahahahDhEhCw", AMII_SOFT_VOLUME);
1361 #endif
1362             if (uchain) {
1363                 unpunish();
1364                 res = 1;
1365             } else if (u.utrap && u.utraptype == TT_BURIEDBALL) {
1366                 buried_ball_to_freedom();
1367                 res = 1;
1368             }
1369             res += openit();
1370             switch (res) {
1371             case 0:
1372                 pline1(nothing_happens);
1373                 break;
1374             case 1:
1375 /*JP
1376                 pline("%s opens...", Something);
1377 */
1378                 pline("\89½\82©\82ª\8aJ\82¢\82½\81D\81D\81D");
1379                 learno = TRUE;
1380                 break;
1381             default:
1382 /*JP
1383                 pline("Things open around you...");
1384 */
1385                 pline("\82Ü\82í\82è\82Ì\95¨\82ª\8aJ\82¢\82½\81D\81D\81D");
1386                 learno = TRUE;
1387                 break;
1388             }
1389
1390         } else { /* uncursed */
1391 #ifdef AMIGA
1392             amii_speaker(obj, "AeFeaeFeAefegw", AMII_OKAY_VOLUME);
1393 #endif
1394             if (findit() != 0)
1395                 learno = TRUE;
1396             else
1397                 pline1(nothing_happens);
1398         }
1399
1400     } /* charged BofO */
1401
1402     if (learno) {
1403         makeknown(BELL_OF_OPENING);
1404         obj->known = 1;
1405     }
1406     if (wakem)
1407         wake_nearby();
1408 }
1409
1410 STATIC_OVL void
1411 use_candelabrum(obj)
1412 register struct obj *obj;
1413 {
1414 #if 0 /*JP*//* not used */
1415     const char *s = (obj->spe != 1) ? "candles" : "candle";
1416 #endif
1417
1418     if (obj->lamplit) {
1419 /*JP
1420         You("snuff the %s.", s);
1421 */
1422         You("\82ë\82¤\82»\82­\82ð\90\81\82«\8fÁ\82µ\82½\81D");
1423         end_burn(obj, TRUE);
1424         return;
1425     }
1426     if (obj->spe <= 0) {
1427 /*JP
1428         pline("This %s has no %s.", xname(obj), s);
1429 */
1430         pline("\82±\82Ì%s\82É\82Í\82ë\82¤\82»\82­\82ª\82È\82¢\81D", xname(obj));
1431         return;
1432     }
1433     if (Underwater) {
1434 /*JP
1435         You("cannot make fire under water.");
1436 */
1437         You("\90\85\92\86\82Å\89Î\82ð\82¨\82±\82¹\82È\82¢\81D");
1438         return;
1439     }
1440     if (u.uswallow || obj->cursed) {
1441         if (!Blind)
1442 #if 0 /*JP*/
1443             pline_The("%s %s for a moment, then %s.", s, vtense(s, "flicker"),
1444                       vtense(s, "die"));
1445 #else
1446             pline("\82ë\82¤\82»\82­\82Ì\89\8a\82Í\82µ\82Î\82ç\82­\93_\96Å\82µ\81C\8fÁ\82¦\82½\81D");
1447 #endif
1448         return;
1449     }
1450     if (obj->spe < 7) {
1451 #if 0 /*JP*/
1452         There("%s only %d %s in %s.", vtense(s, "are"), obj->spe, s,
1453               the(xname(obj)));
1454 #else
1455         pline("%s\82É\82Í\82½\82Á\82½%d\96{\82Ì\82ë\82¤\82»\82­\82µ\82©\82È\82¢\81D",
1456               xname(obj), obj->spe);
1457 #endif
1458         if (!Blind)
1459 #if 0 /*JP*/
1460             pline("%s lit.  %s dimly.", obj->spe == 1 ? "It is" : "They are",
1461                   Tobjnam(obj, "shine"));
1462 #else
1463             pline("%s\82É\89Î\82ð\82Â\82¯\82½\81D%s\82Í\82Ù\82Ì\82©\82É\8bP\82¢\82½\81D",
1464                   xname(obj), xname(obj));
1465 #endif
1466     } else {
1467 #if 0 /*JP*/
1468         pline("%s's %s burn%s", The(xname(obj)), s,
1469               (Blind ? "." : " brightly!"));
1470 #else
1471         pline("%s\82Ì\82ë\82¤\82»\82­\82Í%s\94R\82¦\82 \82ª\82Á\82½\81I", The(xname(obj)),
1472               (Blind ? "" : "\96¾\82é\82­"));
1473 #endif
1474     }
1475     if (!invocation_pos(u.ux, u.uy) || On_stairs(u.ux, u.uy)) {
1476 /*JP
1477         pline_The("%s %s being rapidly consumed!", s, vtense(s, "are"));
1478 */
1479         pline("\82ë\82¤\82»\82­\82Í\82·\82²\82¢\91¬\82³\82Å\94R\82¦\8en\82ß\82½\81I");
1480         /* this used to be obj->age /= 2, rounding down; an age of
1481            1 would yield 0, confusing begin_burn() and producing an
1482            unlightable, unrefillable candelabrum; round up instead */
1483         obj->age = (obj->age + 1L) / 2L;
1484     } else {
1485         if (obj->spe == 7) {
1486             if (Blind)
1487 /*JP
1488                 pline("%s a strange warmth!", Tobjnam(obj, "radiate"));
1489 */
1490                 pline("\8aï\96­\82È\92g\82©\82³\82ð%s\82É\8a´\82\82½\81I", xname(obj));
1491             else
1492 /*JP
1493                 pline("%s with a strange light!", Tobjnam(obj, "glow"));
1494 */
1495                 pline("%s\82Í\8aï\96­\82È\8cõ\82ð\94­\82µ\82Ä\82¢\82é\81I", xname(obj));
1496         }
1497         obj->known = 1;
1498     }
1499     begin_burn(obj, FALSE);
1500 }
1501
1502 STATIC_OVL void
1503 use_candle(optr)
1504 struct obj **optr;
1505 {
1506     register struct obj *obj = *optr;
1507     register struct obj *otmp;
1508 /*JP
1509     const char *s = (obj->quan != 1) ? "candles" : "candle";
1510 */
1511     const char *s = "\82ë\82¤\82»\82­";
1512     char qbuf[QBUFSZ], qsfx[QBUFSZ], *q;
1513
1514     if (u.uswallow) {
1515         You(no_elbow_room);
1516         return;
1517     }
1518
1519     otmp = carrying(CANDELABRUM_OF_INVOCATION);
1520     if (!otmp || otmp->spe == 7) {
1521         use_lamp(obj);
1522         return;
1523     }
1524
1525     /* first, minimal candelabrum suffix for formatting candles */
1526     Sprintf(qsfx, " to\033%s?", thesimpleoname(otmp));
1527     /* next, format the candles as a prefix for the candelabrum */
1528 /*JP
1529     (void) safe_qbuf(qbuf, "Attach ", qsfx, obj, yname, thesimpleoname, s);
1530 */
1531     (void) safe_qbuf(qbuf, "Attach ", qsfx, obj, yname, thesimpleoname, s);
1532     /* strip temporary candelabrum suffix */
1533     if ((q = strstri(qbuf, " to\033")) != 0)
1534         Strcpy(q, " to ");
1535     /* last, format final "attach candles to candelabrum?" query */
1536     if (yn(safe_qbuf(qbuf, qbuf, "?", otmp, yname, thesimpleoname, "it"))
1537         == 'n') {
1538         use_lamp(obj);
1539         return;
1540     } else {
1541         if ((long) otmp->spe + obj->quan > 7L) {
1542             obj = splitobj(obj, 7L - (long) otmp->spe);
1543             /* avoid a grammatical error if obj->quan gets
1544                reduced to 1 candle from more than one */
1545             s = (obj->quan != 1) ? "candles" : "candle";
1546         } else
1547             *optr = 0;
1548 #if 0 /*JP*/
1549         You("attach %ld%s %s to %s.", obj->quan, !otmp->spe ? "" : " more", s,
1550             the(xname(otmp)));
1551 #else
1552         You("%ld\96{\82Ì\82ë\82¤\82»\82­\82ð%s%s\82Ö\8eæ\82è\82Â\82¯\82½\81D",
1553             obj->quan, !otmp->spe ? "" : "\82³\82ç\82É",
1554             xname(otmp));
1555 #endif
1556         if (!otmp->spe || otmp->age > obj->age)
1557             otmp->age = obj->age;
1558         otmp->spe += (int) obj->quan;
1559         if (otmp->lamplit && !obj->lamplit)
1560 /*JP
1561             pline_The("new %s magically %s!", s, vtense(s, "ignite"));
1562 */
1563             pline("\90V\82µ\82¢\82ë\82¤\82»\82­\82Í\95s\8ev\8bc\82È\89\8a\82ð\82 \82°\82½\81I");
1564         else if (!otmp->lamplit && obj->lamplit)
1565 /*JP
1566             pline("%s out.", (obj->quan > 1L) ? "They go" : "It goes");
1567 */
1568             pline("\89\8a\82Í\8fÁ\82¦\82½\81D");
1569         if (obj->unpaid)
1570 #if 0 /*JP*/
1571             verbalize("You %s %s, you bought %s!",
1572                       otmp->lamplit ? "burn" : "use",
1573                       (obj->quan > 1L) ? "them" : "it",
1574                       (obj->quan > 1L) ? "them" : "it");
1575 #else
1576             verbalize("\89Î\82ð\82Â\82¯\82½\82È\82ç\81C\94\83\82Á\82Ä\82à\82ç\82¨\82¤\81I");
1577 #endif
1578         if (obj->quan < 7L && otmp->spe == 7)
1579 #if 0 /*JP*/
1580             pline("%s now has seven%s candles attached.", The(xname(otmp)),
1581                   otmp->lamplit ? " lit" : "");
1582 #else
1583             pline("%s\82É\82Í\82·\82Å\82É7\96{\82Ì%s\82ë\82¤\82»\82­\82ª\8eæ\82è\82Â\82¯\82ç\82ê\82Ä\82¢\82é\81D",
1584                   The(xname(otmp)), otmp->lamplit ? "\89Î\82Ì\82Â\82¢\82½" : "");
1585 #endif
1586         /* candelabrum's light range might increase */
1587         if (otmp->lamplit)
1588             obj_merge_light_sources(otmp, otmp);
1589         /* candles are no longer a separate light source */
1590         if (obj->lamplit)
1591             end_burn(obj, TRUE);
1592         /* candles are now gone */
1593         useupall(obj);
1594     }
1595 }
1596
1597 /* call in drop, throw, and put in box, etc. */
1598 boolean
1599 snuff_candle(otmp)
1600 struct obj *otmp;
1601 {
1602     boolean candle = Is_candle(otmp);
1603
1604     if ((candle || otmp->otyp == CANDELABRUM_OF_INVOCATION)
1605         && otmp->lamplit) {
1606         char buf[BUFSZ];
1607         xchar x, y;
1608 #if 0 /*JP*//* not used */
1609         boolean many = candle ? (otmp->quan > 1L) : (otmp->spe > 1);
1610 #endif
1611
1612         (void) get_obj_location(otmp, &x, &y, 0);
1613         if (otmp->where == OBJ_MINVENT ? cansee(x, y) : !Blind)
1614 #if 0 /*JP*/
1615             pline("%s%scandle%s flame%s extinguished.", Shk_Your(buf, otmp),
1616                   (candle ? "" : "candelabrum's "), (many ? "s'" : "'s"),
1617                   (many ? "s are" : " is"));
1618 #else
1619             pline("%s%s\82ë\82¤\82»\82­\82Ì\89\8a\82Í\8fÁ\82¦\82½\81D", Shk_Your(buf, otmp),
1620                   candle ? "" : "\90C\91ä\82Ì");
1621 #endif
1622         end_burn(otmp, TRUE);
1623         return TRUE;
1624     }
1625     return FALSE;
1626 }
1627
1628 /* called when lit lamp is hit by water or put into a container or
1629    you've been swallowed by a monster; obj might be in transit while
1630    being thrown or dropped so don't assume that its location is valid */
1631 boolean
1632 snuff_lit(obj)
1633 struct obj *obj;
1634 {
1635     xchar x, y;
1636
1637     if (obj->lamplit) {
1638         if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
1639             || obj->otyp == BRASS_LANTERN || obj->otyp == POT_OIL) {
1640             (void) get_obj_location(obj, &x, &y, 0);
1641             if (obj->where == OBJ_MINVENT ? cansee(x, y) : !Blind)
1642 /*JP
1643                 pline("%s %s out!", Yname2(obj), otense(obj, "go"));
1644 */
1645                 pline("%s\82Í\8fÁ\82¦\82½\81I", Yname2(obj));
1646             end_burn(obj, TRUE);
1647             return TRUE;
1648         }
1649         if (snuff_candle(obj))
1650             return TRUE;
1651     }
1652     return FALSE;
1653 }
1654
1655 /* Called when potentially lightable object is affected by fire_damage().
1656    Return TRUE if object was lit and FALSE otherwise --ALI */
1657 boolean
1658 catch_lit(obj)
1659 struct obj *obj;
1660 {
1661     xchar x, y;
1662
1663     if (!obj->lamplit && (obj->otyp == MAGIC_LAMP || ignitable(obj))) {
1664         if ((obj->otyp == MAGIC_LAMP
1665              || obj->otyp == CANDELABRUM_OF_INVOCATION) && obj->spe == 0)
1666             return FALSE;
1667         else if (obj->otyp != MAGIC_LAMP && obj->age == 0)
1668             return FALSE;
1669         if (!get_obj_location(obj, &x, &y, 0))
1670             return FALSE;
1671         if (obj->otyp == CANDELABRUM_OF_INVOCATION && obj->cursed)
1672             return FALSE;
1673         if ((obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
1674              || obj->otyp == BRASS_LANTERN) && obj->cursed && !rn2(2))
1675             return FALSE;
1676         if (obj->where == OBJ_MINVENT ? cansee(x, y) : !Blind)
1677 /*JP
1678             pline("%s %s light!", Yname2(obj), otense(obj, "catch"));
1679 */
1680             pline("%s\82Ì\96¾\82©\82è\82ª\82Â\82¢\82½\81I", Yname2(obj));
1681         if (obj->otyp == POT_OIL)
1682             makeknown(obj->otyp);
1683         if (carried(obj) && obj->unpaid && costly_spot(u.ux, u.uy)) {
1684             /* if it catches while you have it, then it's your tough luck */
1685             check_unpaid(obj);
1686 #if 0 /*JP:T*/
1687             verbalize("That's in addition to the cost of %s %s, of course.",
1688                       yname(obj), obj->quan == 1L ? "itself" : "themselves");
1689 #else
1690             verbalize("\82±\82ê\82Í\82à\82¿\82ë\82ñ%s\82Ì\92l\92i\82Æ\82Í\95Ê\82¾\82æ\81D", Yname2(obj));
1691 #endif
1692             bill_dummy_object(obj);
1693         }
1694         begin_burn(obj, FALSE);
1695         return TRUE;
1696     }
1697     return FALSE;
1698 }
1699
1700 STATIC_OVL void
1701 use_lamp(obj)
1702 struct obj *obj;
1703 {
1704     char buf[BUFSZ];
1705
1706     if (obj->lamplit) {
1707         if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
1708             || obj->otyp == BRASS_LANTERN)
1709             pline("%slamp is now off.", Shk_Your(buf, obj));
1710         else
1711             You("snuff out %s.", yname(obj));
1712         end_burn(obj, TRUE);
1713         return;
1714     }
1715     if (Underwater) {
1716 #if 0 /*JP*/
1717         pline(!Is_candle(obj) ? "This is not a diving lamp"
1718                               : "Sorry, fire and water don't mix.");
1719 #else
1720         pline(!Is_candle(obj) ? "\82±\82ê\82Í\90ö\90\85\97p\82Ì\83\89\83\93\83v\82\82á\82È\82¢\81D"
1721                               : "\8ec\94O\82È\82ª\82ç\81C\89Î\82Æ\90\85\82Í\82Ü\82´\82ç\82È\82¢\81D");
1722 #endif
1723         return;
1724     }
1725     /* magic lamps with an spe == 0 (wished for) cannot be lit */
1726     if ((!Is_candle(obj) && obj->age == 0)
1727         || (obj->otyp == MAGIC_LAMP && obj->spe == 0)) {
1728         if (obj->otyp == BRASS_LANTERN)
1729 /*JP
1730             Your("lamp has run out of power.");
1731 */
1732             Your("\83\89\83\93\83v\82Ì\93d\97Í\82ð\8eg\82¢\90Ø\82Á\82Ä\82µ\82Ü\82Á\82½\81D");
1733         else
1734 /*JP
1735             pline("This %s has no oil.", xname(obj));
1736 */
1737             pline("\82±\82Ì%s\82É\82Í\82à\82¤\83I\83C\83\8b\82ª\82È\82¢\81D", xname(obj));
1738         return;
1739     }
1740     if (obj->cursed && !rn2(2)) {
1741         if (!Blind)
1742 #if 0 /*JP*/
1743             pline("%s for a moment, then %s.", Tobjnam(obj, "flicker"),
1744                   otense(obj, "die"));
1745 #else
1746             pline("%s\82Í\82µ\82Î\82ç\82­\82Ì\8aÔ\93_\96Å\82µ\81C\8fÁ\82¦\82½\81D",
1747                   xname(obj));
1748 #endif
1749     } else {
1750         if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
1751             || obj->otyp == BRASS_LANTERN) {
1752             check_unpaid(obj);
1753 /*JP
1754             pline("%slamp is now on.", Shk_Your(buf, obj));
1755 */
1756             pline("%s\83\89\83\93\83v\82É\93\94\82ª\93\94\82Á\82½\81D", Shk_Your(buf, obj));
1757         } else { /* candle(s) */
1758 #if 0 /*JP*/
1759             pline("%s flame%s %s%s", s_suffix(Yname2(obj)), plur(obj->quan),
1760                   otense(obj, "burn"), Blind ? "." : " brightly!");
1761 #else
1762             pline("%s\82Í%s\94R\82¦\82 \82ª\82Á\82½\81I",
1763                   Yname2(obj), Blind ? "" : "\96¾\82é\82­");
1764 #endif
1765             if (obj->unpaid && costly_spot(u.ux, u.uy)
1766                 && obj->age == 20L * (long) objects[obj->otyp].oc_cost) {
1767 #if 0 /*JP*/
1768                 const char *ithem = (obj->quan > 1L) ? "them" : "it";
1769
1770                 verbalize("You burn %s, you bought %s!", ithem, ithem);
1771 #else
1772                 verbalize("\93\94\82ð\82Â\82¯\82½\82È\82ç\81C\94\83\82Á\82Ä\82à\82ç\82¨\82¤\81I");
1773 #endif
1774                 bill_dummy_object(obj);
1775             }
1776         }
1777         begin_burn(obj, FALSE);
1778     }
1779 }
1780
1781 STATIC_OVL void
1782 light_cocktail(obj)
1783 struct obj *obj; /* obj is a potion of oil */
1784 {
1785     char buf[BUFSZ];
1786     boolean split1off;
1787
1788     if (u.uswallow) {
1789         You(no_elbow_room);
1790         return;
1791     }
1792
1793     if (obj->lamplit) {
1794 /*JP
1795         You("snuff the lit potion.");
1796 */
1797         You("\96û\95r\82Ì\89Î\82ð\90\81\82«\8fÁ\82µ\82½\81D");
1798         end_burn(obj, TRUE);
1799         /*
1800          * Free & add to re-merge potion.  This will average the
1801          * age of the potions.  Not exactly the best solution,
1802          * but its easy.
1803          */
1804         freeinv(obj);
1805         (void) addinv(obj);
1806         return;
1807     } else if (Underwater) {
1808 /*JP
1809         There("is not enough oxygen to sustain a fire.");
1810 */
1811         pline("\89Î\82ð\82Â\82¯\82é\82Ì\82É\8f\\95ª\82È\8e_\91f\82ª\82È\82¢\81D");
1812         return;
1813     }
1814
1815     split1off = (obj->quan > 1L);
1816     if (split1off)
1817         obj = splitobj(obj, 1L);
1818
1819 #if 0 /*JP*/
1820     You("light %spotion.%s", shk_your(buf, obj),
1821         Blind ? "" : "  It gives off a dim light.");
1822 #else
1823     You("%s\96û\95r\82É\89Î\82ð\82Â\82¯\82½\81D%s", shk_your(buf, obj),
1824         Blind ? "" : "\96û\95r\82Í\88Ã\82¢\8cõ\82ð\82Í\82È\82Á\82½\81D");
1825 #endif
1826
1827     if (obj->unpaid && costly_spot(u.ux, u.uy)) {
1828         /* Normally, we shouldn't both partially and fully charge
1829          * for an item, but (Yendorian Fuel) Taxes are inevitable...
1830          */
1831         check_unpaid(obj);
1832 /*JP
1833         verbalize("That's in addition to the cost of the potion, of course.");
1834 */
1835         verbalize("\82±\82ê\82Í\82à\82¿\82ë\82ñ\96û\95r\82Ì\92l\92i\82Æ\82Í\95Ê\82¾\82æ\81D");
1836         bill_dummy_object(obj);
1837     }
1838     makeknown(obj->otyp);
1839
1840     begin_burn(obj, FALSE); /* after shop billing */
1841     if (split1off) {
1842         obj_extract_self(obj); /* free from inv */
1843         obj->nomerge = 1;
1844 /*JP
1845         obj = hold_another_object(obj, "You drop %s!", doname(obj),
1846 */
1847         obj = hold_another_object(obj, "\82 \82È\82½\82Í%s\82ð\97\8e\82µ\82½\81I", doname(obj),
1848                                   (const char *) 0);
1849         if (obj)
1850             obj->nomerge = 0;
1851     }
1852 }
1853
1854 static NEARDATA const char cuddly[] = { TOOL_CLASS, GEM_CLASS, 0 };
1855
1856 int
1857 dorub()
1858 {
1859     struct obj *obj = getobj(cuddly, "rub");
1860
1861     if (obj && obj->oclass == GEM_CLASS) {
1862         if (is_graystone(obj)) {
1863             use_stone(obj);
1864             return 1;
1865         } else {
1866 /*JP
1867             pline("Sorry, I don't know how to use that.");
1868 */
1869             pline("\8ec\94O\81D\8eg\82¢\95û\82ª\82í\82©\82ç\82È\82¢\81D");
1870             return 0;
1871         }
1872     }
1873
1874     if (!obj || !wield_tool(obj, "rub"))
1875         return 0;
1876
1877     /* now uwep is obj */
1878     if (uwep->otyp == MAGIC_LAMP) {
1879         if (uwep->spe > 0 && !rn2(3)) {
1880             check_unpaid_usage(uwep, TRUE); /* unusual item use */
1881             /* bones preparation:  perform the lamp transformation
1882                before releasing the djinni in case the latter turns out
1883                to be fatal (a hostile djinni has no chance to attack yet,
1884                but an indebted one who grants a wish might bestow an
1885                artifact which blasts the hero with lethal results) */
1886             uwep->otyp = OIL_LAMP;
1887             uwep->spe = 0; /* for safety */
1888             uwep->age = rn1(500, 1000);
1889             if (uwep->lamplit)
1890                 begin_burn(uwep, TRUE);
1891             djinni_from_bottle(uwep);
1892             makeknown(MAGIC_LAMP);
1893             update_inventory();
1894         } else if (rn2(2)) {
1895 /*JP
1896             You("%s smoke.", !Blind ? "see a puff of" : "smell");
1897 */
1898             pline("\82¯\82Þ\82è%s\81D", !Blind ? "\82ª\95\91\82¢\82 \82ª\82Á\82½" : "\82Ì\93õ\82¢\82ª\82µ\82½");
1899         } else
1900             pline1(nothing_happens);
1901     } else if (obj->otyp == BRASS_LANTERN) {
1902         /* message from Adventure */
1903 /*JP
1904         pline("Rubbing the electric lamp is not particularly rewarding.");
1905 */
1906         pline("\93d\8bC\83\89\83\93\83v\82ð\82±\82·\82Á\82Ä\82à\88Ó\96¡\82Í\82È\82¢\82Æ\8ev\82¤\82ª\81D\81D\81D");
1907 /*JP
1908         pline("Anyway, nothing exciting happens.");
1909 */
1910         pline("\82â\82Á\82Ï\82è\81C\89½\82à\8bN\82«\82È\82©\82Á\82½\81D");
1911     } else
1912         pline1(nothing_happens);
1913     return 1;
1914 }
1915
1916 int
1917 dojump()
1918 {
1919     /* Physical jump */
1920     return jump(0);
1921 }
1922
1923 boolean
1924 is_valid_jump_pos(x, y, magic, showmsg)
1925 int x, y, magic;
1926 boolean showmsg;
1927 {
1928     if (!magic && !(HJumping & ~INTRINSIC) && !EJumping && distu(x, y) != 5) {
1929         /* The Knight jumping restriction still applies when riding a
1930          * horse.  After all, what shape is the knight piece in chess?
1931          */
1932         if (showmsg)
1933 /*JP
1934             pline("Illegal move!");
1935 */
1936             pline("\82»\82Ì\88Ú\93®\82Í\8cj\94n\92µ\82Ñ\82\82á\82È\82¢\81I");
1937         return FALSE;
1938     } else if (distu(x, y) > (magic ? 6 + magic * 3 : 9)) {
1939         if (showmsg)
1940 /*JP
1941             pline("Too far!");
1942 */
1943             pline("\89\93\82·\82¬\82é\81I");
1944         return FALSE;
1945     } else if (!cansee(x, y)) {
1946         if (showmsg)
1947 /*JP
1948             You("cannot see where to land!");
1949 */
1950             You("\92\85\92n\93_\82ª\8c©\82¦\82È\82¢\81I");
1951         return FALSE;
1952     } else if (!isok(x, y)) {
1953         if (showmsg)
1954 /*JP
1955             You("cannot jump there!");
1956 */
1957             You("\82»\82±\82É\82Í\94ò\82×\82È\82¢\81I");
1958         return FALSE;
1959     }
1960     return TRUE;
1961 }
1962
1963 static int jumping_is_magic;
1964
1965 void
1966 display_jump_positions(state)
1967 int state;
1968 {
1969     if (state == 0) {
1970         tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
1971     } else if (state == 1) {
1972         int x, y, dx, dy;
1973
1974         for (dx = -4; dx <= 4; dx++)
1975             for (dy = -4; dy <= 4; dy++) {
1976                 x = dx + (int) u.ux;
1977                 y = dy + (int) u.uy;
1978                 if (isok(x, y) && ACCESSIBLE(levl[x][y].typ)
1979                     && is_valid_jump_pos(x, y, jumping_is_magic, FALSE))
1980                     tmp_at(x, y);
1981             }
1982     } else {
1983         tmp_at(DISP_END, 0);
1984     }
1985 }
1986
1987 int
1988 jump(magic)
1989 int magic; /* 0=Physical, otherwise skill level */
1990 {
1991     coord cc;
1992
1993     if (!magic && (nolimbs(youmonst.data) || slithy(youmonst.data))) {
1994         /* normally (nolimbs || slithy) implies !Jumping,
1995            but that isn't necessarily the case for knights */
1996 /*JP
1997         You_cant("jump; you have no legs!");
1998 */
1999         pline("\91«\82ª\96³\82­\82Ä\82Í\92µ\82×\82È\82¢\81I");
2000         return 0;
2001     } else if (!magic && !Jumping) {
2002 /*JP
2003         You_cant("jump very far.");
2004 */
2005         You_cant("\82»\82ñ\82È\89\93\82­\82Ü\82Å\92µ\82×\82È\82¢\81D");
2006         return 0;
2007     /* if steed is immobile, can't do physical jump but can do spell one */
2008     } else if (!magic && u.usteed && stucksteed(FALSE)) {
2009         /* stucksteed gave "<steed> won't move" message */
2010         return 0;
2011     } else if (u.uswallow) {
2012         if (magic) {
2013 /*JP
2014             You("bounce around a little.");
2015 */
2016             pline("\94½\93®\82ð\82Â\82¯\82½\81D");
2017             return 1;
2018         }
2019 /*JP
2020         pline("You've got to be kidding!");
2021 */
2022         pline("\8fç\92k\82Í\82æ\82µ\82±\82³\82ñ\81I");
2023         return 0;
2024     } else if (u.uinwater) {
2025         if (magic) {
2026 /*JP
2027             You("swish around a little.");
2028 */
2029             pline("\83X\83C\83X\83C\82Æ\89j\82¢\82¾\81D");
2030             return 1;
2031         }
2032 /*JP
2033         pline("This calls for swimming, not jumping!");
2034 */
2035         pline("\82»\82ê\82Í\81w\89j\82®\81x\82Å\82 \82Á\82Ä\81C\81w\92µ\82Ô\81x\82\82á\82È\82¢\81I");
2036         return 0;
2037     } else if (u.ustuck) {
2038         if (u.ustuck->mtame && !Conflict && !u.ustuck->mconf) {
2039 /*JP
2040             You("pull free from %s.", mon_nam(u.ustuck));
2041 */
2042             You("%s\82©\82ç\97£\82ê\82½\81D", mon_nam(u.ustuck));
2043             u.ustuck = 0;
2044             return 1;
2045         }
2046         if (magic) {
2047 /*JP
2048             You("writhe a little in the grasp of %s!", mon_nam(u.ustuck));
2049 */
2050             You("%s\82©\82ç\93¦\82ê\82æ\82¤\82Æ\83W\83^\83o\83^\82µ\82½\81I", mon_nam(u.ustuck));
2051             return 1;
2052         }
2053 /*JP
2054         You("cannot escape from %s!", mon_nam(u.ustuck));
2055 */
2056         You("%s\82©\82ç\93¦\82ê\82ç\82ê\82È\82¢\81I", mon_nam(u.ustuck));
2057         return 0;
2058     } else if (Levitation || Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {
2059         if (magic) {
2060 /*JP
2061             You("flail around a little.");
2062 */
2063             You("\83o\83^\83o\83^\92µ\82ñ\82¾\81D");
2064             return 1;
2065         }
2066 /*JP
2067         You("don't have enough traction to jump.");
2068 */
2069         You("\92µ\82Ô\82½\82ß\82Ì\94½\93®\82ª\82Â\82¯\82ç\82ê\82È\82¢\81D");
2070         return 0;
2071     } else if (!magic && near_capacity() > UNENCUMBERED) {
2072 /*JP
2073         You("are carrying too much to jump!");
2074 */
2075         You("\82½\82­\82³\82ñ\95¨\82ð\8e\9d\82¿\82·\82¬\82Ä\92µ\82×\82È\82¢\81I");
2076         return 0;
2077     } else if (!magic && (u.uhunger <= 100 || ACURR(A_STR) < 6)) {
2078 /*JP
2079         You("lack the strength to jump!");
2080 */
2081         You("\92µ\82Ô\82¾\82¯\82Ì\97Í\82ª\82È\82¢\81I");
2082         return 0;
2083     } else if (!magic && Wounded_legs) {
2084         long wl = (Wounded_legs & BOTH_SIDES);
2085         const char *bp = body_part(LEG);
2086
2087         if (wl == BOTH_SIDES)
2088             bp = makeplural(bp);
2089         if (u.usteed)
2090 /*JP
2091             pline("%s is in no shape for jumping.", Monnam(u.usteed));
2092 */
2093             pline("%s\82Í\92µ\82×\82é\8fó\91Ô\82Å\82Í\82È\82¢\81D", Monnam(u.usteed));
2094         else
2095 #if 0 /*JP*/
2096             Your("%s%s %s in no shape for jumping.",
2097                  (wl == LEFT_SIDE) ? "left " : (wl == RIGHT_SIDE) ? "right "
2098                                                                   : "",
2099                  bp, (wl == BOTH_SIDES) ? "are" : "is");
2100 #else
2101           Your("%s%s\82Í\92µ\82×\82é\8fó\91Ô\82Å\82Í\82È\82¢\81D",
2102                  (wl == LEFT_SIDE) ? "\8d¶" :
2103                  (wl == RIGHT_SIDE) ? "\89E" : "", bp);
2104 #endif
2105         return 0;
2106     } else if (u.usteed && u.utrap) {
2107 /*JP
2108         pline("%s is stuck in a trap.", Monnam(u.usteed));
2109 */
2110         pline("%s\82Íã©\82É\82Ð\82Á\82©\82©\82Á\82Ä\82¢\82é\81D", Monnam(u.usteed));
2111         return 0;
2112     }
2113
2114 /*JP
2115     pline("Where do you want to jump?");
2116 */
2117     pline("\82Ç\82±\82É\92µ\82Ñ\82Ü\82·\82©\81H");
2118     cc.x = u.ux;
2119     cc.y = u.uy;
2120     jumping_is_magic = magic;
2121     getpos_sethilite(display_jump_positions);
2122 /*JP
2123     if (getpos(&cc, TRUE, "the desired position") < 0)
2124 */
2125     if (getpos(&cc, TRUE, "\92µ\82Ñ\82½\82¢\8fê\8f\8a") < 0)
2126         return 0; /* user pressed ESC */
2127     if (!is_valid_jump_pos(cc.x, cc.y, magic, TRUE)) {
2128         return 0;
2129     } else {
2130         coord uc;
2131         int range, temp;
2132
2133         if (u.utrap)
2134             switch (u.utraptype) {
2135             case TT_BEARTRAP: {
2136                 long side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE;
2137
2138 /*JP
2139                 You("rip yourself free of the bear trap!  Ouch!");
2140 */
2141                 You("\8e©\95ª\82ð\8cF\82Ìã©\82©\82ç\82Ð\82«\82Í\82ª\82µ\82½\81C\82¢\82Ä\82Á\81I");
2142 /*JP
2143                 losehp(Maybe_Half_Phys(rnd(10)), "jumping out of a bear trap",
2144 */
2145                 losehp(Maybe_Half_Phys(rnd(10)), "\8cF\82Ìã©\82©\82ç\94ò\82Ñ\8fo\82æ\82¤\82Æ\82µ\82Ä",
2146                        KILLED_BY);
2147                 set_wounded_legs(side, rn1(1000, 500));
2148                 break;
2149             }
2150             case TT_PIT:
2151 /*JP
2152                 You("leap from the pit!");
2153 */
2154                 You("\97\8e\82µ\8c\8a\82©\82ç\94ò\82Ñ\8fo\82½\81I");
2155                 break;
2156             case TT_WEB:
2157 /*JP
2158                 You("tear the web apart as you pull yourself free!");
2159 */
2160                 You("\82­\82à\82Ì\91\83\82ð\88ø\82«\97ô\82«\81C\8e©\97R\82É\82È\82Á\82½\81I");
2161                 deltrap(t_at(u.ux, u.uy));
2162                 break;
2163             case TT_LAVA:
2164 /*JP
2165                 You("pull yourself above the lava!");
2166 */
2167                 You("\97n\8aâ\82©\82ç\94ò\82Ñ\8fo\82½\81I");
2168                 u.utrap = 0;
2169                 return 1;
2170             case TT_BURIEDBALL:
2171             case TT_INFLOOR:
2172 #if 0 /*JP*/
2173                 You("strain your %s, but you're still %s.",
2174                     makeplural(body_part(LEG)),
2175                     (u.utraptype == TT_INFLOOR)
2176                         ? "stuck in the floor"
2177                         : "attached to the buried ball");
2178 #else
2179                 You("%s\82ð\88ø\82Á\82Ï\82Á\82½\82ª\81C\82 \82È\82½\82Í\82Ü\82¾%s\81D",
2180                     makeplural(body_part(LEG)),
2181                     (u.utraptype == TT_INFLOOR)
2182                         ? "\8f°\82É\82¤\82Ü\82Á\82Ä\82¢\82é"
2183                         : "\82¤\82Ü\82Á\82½\8b\85\82Æ\82Â\82È\82ª\82Á\82Ä\82¢\82é");
2184 #endif
2185                 set_wounded_legs(LEFT_SIDE, rn1(10, 11));
2186                 set_wounded_legs(RIGHT_SIDE, rn1(10, 11));
2187                 return 1;
2188             }
2189
2190         /*
2191          * Check the path from uc to cc, calling hurtle_step at each
2192          * location.  The final position actually reached will be
2193          * in cc.
2194          */
2195         uc.x = u.ux;
2196         uc.y = u.uy;
2197         /* calculate max(abs(dx), abs(dy)) as the range */
2198         range = cc.x - uc.x;
2199         if (range < 0)
2200             range = -range;
2201         temp = cc.y - uc.y;
2202         if (temp < 0)
2203             temp = -temp;
2204         if (range < temp)
2205             range = temp;
2206         (void) walk_path(&uc, &cc, hurtle_step, (genericptr_t) &range);
2207         teleds(cc.x, cc.y, TRUE);
2208         sokoban_guilt();
2209         nomul(-1);
2210         multi_reason = "jumping around";
2211         nomovemsg = "";
2212         morehungry(rnd(25));
2213         return 1;
2214     }
2215 }
2216
2217 boolean
2218 tinnable(corpse)
2219 struct obj *corpse;
2220 {
2221     if (corpse->oeaten)
2222         return 0;
2223     if (!mons[corpse->corpsenm].cnutrit)
2224         return 0;
2225     return 1;
2226 }
2227
2228 STATIC_OVL void
2229 use_tinning_kit(obj)
2230 struct obj *obj;
2231 {
2232     struct obj *corpse, *can;
2233
2234     /* This takes only 1 move.  If this is to be changed to take many
2235      * moves, we've got to deal with decaying corpses...
2236      */
2237     if (obj->spe <= 0) {
2238 /*JP
2239         You("seem to be out of tins.");
2240 */
2241         pline("\8aÊ\8bl\82ð\8dì\82é\82½\82ß\82Ì\8aÊ\82ª\90Ø\82ê\82½\82æ\82¤\82¾\81D");
2242         return;
2243     }
2244     if (!(corpse = floorfood("tin", 2)))
2245         return;
2246     if (corpse->oeaten) {
2247 /*JP
2248         You("cannot tin %s which is partly eaten.", something);
2249 */
2250         You("\90H\82×\82©\82¯\82Ì\82à\82Ì\82ð\8aÊ\8bl\82É\82·\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D");
2251         return;
2252     }
2253     if (touch_petrifies(&mons[corpse->corpsenm]) && !Stone_resistance
2254         && !uarmg) {
2255         char kbuf[BUFSZ];
2256
2257         if (poly_when_stoned(youmonst.data))
2258 #if 0 /*JP*/
2259             You("tin %s without wearing gloves.",
2260                 an(mons[corpse->corpsenm].mname));
2261 #else
2262             You("\8f¬\8eè\82È\82µ\82Å%s\82ð\8aÊ\8bl\82É\82µ\82æ\82¤\82Æ\82µ\82½\81D",
2263                 mons[corpse->corpsenm].mname);
2264 #endif
2265         else {
2266 #if 0 /*JP*/
2267             pline("Tinning %s without wearing gloves is a fatal mistake...",
2268                   an(mons[corpse->corpsenm].mname));
2269 #else
2270             pline("%s\82ð\8f¬\8eè\82È\82µ\82Å\8aÊ\8bl\82É\82·\82é\82Ì\82Í\92v\96½\93I\82È\8aÔ\88á\82¢\82¾\81D\81D\81D",
2271                   mons[corpse->corpsenm].mname);
2272 #endif
2273 #if 0 /*JP*/
2274             Sprintf(kbuf, "trying to tin %s without gloves",
2275                     an(mons[corpse->corpsenm].mname));
2276 #else
2277             Sprintf(kbuf, "\8f¬\8eè\82ð\82Â\82¯\82¸\82É%s\82ð\8aÊ\8bl\82É\82µ\82æ\82¤\82Æ\82µ\82Ä",
2278                     mons[corpse->corpsenm].mname);
2279 #endif
2280         }
2281         instapetrify(kbuf);
2282     }
2283     if (is_rider(&mons[corpse->corpsenm])) {
2284         if (revive_corpse(corpse))
2285 /*JP
2286             verbalize("Yes...  But War does not preserve its enemies...");
2287 */
2288             verbalize("\82»\82¤\82¾\81D\81D\81D\82µ\82©\82µ\81u\90í\91\88\81v\82Í\93G\82É\88À\82ç\82¬\82ð\97^\82¦\82Ê\81D\81D\81D");
2289         else
2290 /*JP
2291             pline_The("corpse evades your grasp.");
2292 */
2293             pline("\8e\80\91Ì\82Í\82 \82È\82½\82Ì\8eè\82ð\93¦\82ê\82½\81D");
2294         return;
2295     }
2296     if (mons[corpse->corpsenm].cnutrit == 0) {
2297 /*JP
2298         pline("That's too insubstantial to tin.");
2299 */
2300         pline("\8eÀ\91Ì\82ª\82È\82¢\82Ì\82Å\8aÊ\8bl\82É\82Å\82«\82È\82¢\81D");
2301         return;
2302     }
2303     consume_obj_charge(obj, TRUE);
2304
2305     if ((can = mksobj(TIN, FALSE, FALSE)) != 0) {
2306 /*JP
2307         static const char you_buy_it[] = "You tin it, you bought it!";
2308 */
2309         static const char you_buy_it[] = "\8aÊ\8bl\82É\82µ\82½\82Ì\82È\82ç\94\83\82Á\82Ä\82à\82ç\82¤\82æ\81I";
2310
2311         can->corpsenm = corpse->corpsenm;
2312         can->cursed = obj->cursed;
2313         can->blessed = obj->blessed;
2314         can->owt = weight(can);
2315         can->known = 1;
2316         /* Mark tinned tins. No spinach allowed... */
2317         set_tin_variety(can, HOMEMADE_TIN);
2318         if (carried(corpse)) {
2319             if (corpse->unpaid)
2320                 verbalize(you_buy_it);
2321             useup(corpse);
2322         } else {
2323             if (costly_spot(corpse->ox, corpse->oy) && !corpse->no_charge)
2324                 verbalize(you_buy_it);
2325             useupf(corpse, 1L);
2326         }
2327 /*JP
2328         can = hold_another_object(can, "You make, but cannot pick up, %s.",
2329 */
2330         can = hold_another_object(can, "\8aÊ\8bl\82É\82Å\82«\82½\82ª\81C%s\82ð\8e\9d\82Â\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
2331                                   doname(can), (const char *) 0);
2332     } else
2333         impossible("Tinning failed.");
2334 }
2335
2336 void
2337 use_unicorn_horn(obj)
2338 struct obj *obj;
2339 {
2340 #define PROP_COUNT 7           /* number of properties we're dealing with */
2341 #define ATTR_COUNT (A_MAX * 3) /* number of attribute points we might fix */
2342     int idx, val, val_limit, trouble_count, unfixable_trbl, did_prop,
2343         did_attr;
2344     int trouble_list[PROP_COUNT + ATTR_COUNT];
2345
2346     if (obj && obj->cursed) {
2347         long lcount = (long) rn1(90, 10);
2348
2349         switch (rn2(13) / 2) { /* case 6 is half as likely as the others */
2350         case 0:
2351             make_sick((Sick & TIMEOUT) ? (Sick & TIMEOUT) / 3L + 1L
2352                                        : (long) rn1(ACURR(A_CON), 20),
2353                       xname(obj), TRUE, SICK_NONVOMITABLE);
2354             break;
2355         case 1:
2356             make_blinded((Blinded & TIMEOUT) + lcount, TRUE);
2357             break;
2358         case 2:
2359             if (!Confusion)
2360 #if 0 /*JP*/
2361                 You("suddenly feel %s.",
2362                     Hallucination ? "trippy" : "confused");
2363 #else
2364                 You("\93Ë\91R%s\81D",
2365                     Hallucination ? "\82Ö\82ë\82Ö\82ë\82É\82È\82Á\82½" : "\8d¬\97\90\82µ\82½");
2366 #endif
2367             make_confused((HConfusion & TIMEOUT) + lcount, TRUE);
2368             break;
2369         case 3:
2370             make_stunned((HStun & TIMEOUT) + lcount, TRUE);
2371             break;
2372         case 4:
2373             (void) adjattrib(rn2(A_MAX), -1, FALSE);
2374             break;
2375         case 5:
2376             (void) make_hallucinated((HHallucination & TIMEOUT) + lcount,
2377                                      TRUE, 0L);
2378             break;
2379         case 6:
2380             if (Deaf) /* make_deaf() won't give feedback when already deaf */
2381 /*JP
2382                 pline("Nothing seems to happen.");
2383 */
2384                 pline("\89½\82à\8bN\82«\82È\82©\82Á\82½\82æ\82¤\82¾\81D");
2385             make_deaf((HDeaf & TIMEOUT) + lcount, TRUE);
2386             break;
2387         }
2388         return;
2389     }
2390
2391 /*
2392  * Entries in the trouble list use a very simple encoding scheme.
2393  */
2394 #define prop2trbl(X) ((X) + A_MAX)
2395 #define attr2trbl(Y) (Y)
2396 #define prop_trouble(X) trouble_list[trouble_count++] = prop2trbl(X)
2397 #define attr_trouble(Y) trouble_list[trouble_count++] = attr2trbl(Y)
2398 #define TimedTrouble(P) (((P) && !((P) & ~TIMEOUT)) ? ((P) & TIMEOUT) : 0L)
2399
2400     trouble_count = unfixable_trbl = did_prop = did_attr = 0;
2401
2402     /* collect property troubles */
2403     if (TimedTrouble(Sick))
2404         prop_trouble(SICK);
2405     if (TimedTrouble(Blinded) > (long) u.ucreamed
2406         && !(u.uswallow
2407              && attacktype_fordmg(u.ustuck->data, AT_ENGL, AD_BLND)))
2408         prop_trouble(BLINDED);
2409     if (TimedTrouble(HHallucination))
2410         prop_trouble(HALLUC);
2411     if (TimedTrouble(Vomiting))
2412         prop_trouble(VOMITING);
2413     if (TimedTrouble(HConfusion))
2414         prop_trouble(CONFUSION);
2415     if (TimedTrouble(HStun))
2416         prop_trouble(STUNNED);
2417     if (TimedTrouble(HDeaf))
2418         prop_trouble(DEAF);
2419
2420     unfixable_trbl = unfixable_trouble_count(TRUE);
2421
2422     /* collect attribute troubles */
2423     for (idx = 0; idx < A_MAX; idx++) {
2424         if (ABASE(idx) >= AMAX(idx))
2425             continue;
2426         val_limit = AMAX(idx);
2427         /* don't recover strength lost from hunger */
2428         if (idx == A_STR && u.uhs >= WEAK)
2429             val_limit--;
2430         if (Fixed_abil) {
2431             /* potion/spell of restore ability override sustain ability
2432                intrinsic but unicorn horn usage doesn't */
2433             unfixable_trbl += val_limit - ABASE(idx);
2434             continue;
2435         }
2436         /* don't recover more than 3 points worth of any attribute */
2437         if (val_limit > ABASE(idx) + 3)
2438             val_limit = ABASE(idx) + 3;
2439
2440         for (val = ABASE(idx); val < val_limit; val++)
2441             attr_trouble(idx);
2442         /* keep track of unfixed trouble, for message adjustment below */
2443         unfixable_trbl += (AMAX(idx) - val_limit);
2444     }
2445
2446     if (trouble_count == 0) {
2447         pline1(nothing_happens);
2448         return;
2449     } else if (trouble_count > 1) { /* shuffle */
2450         int i, j, k;
2451
2452         for (i = trouble_count - 1; i > 0; i--)
2453             if ((j = rn2(i + 1)) != i) {
2454                 k = trouble_list[j];
2455                 trouble_list[j] = trouble_list[i];
2456                 trouble_list[i] = k;
2457             }
2458     }
2459
2460     /*
2461      *  Chances for number of troubles to be fixed
2462      *               0      1      2      3      4      5      6      7
2463      *   blessed:  22.7%  22.7%  19.5%  15.4%  10.7%   5.7%   2.6%   0.8%
2464      *  uncursed:  35.4%  35.4%  22.9%   6.3%    0      0      0      0
2465      */
2466     val_limit = rn2(d(2, (obj && obj->blessed) ? 4 : 2));
2467     if (val_limit > trouble_count)
2468         val_limit = trouble_count;
2469
2470     /* fix [some of] the troubles */
2471     for (val = 0; val < val_limit; val++) {
2472         idx = trouble_list[val];
2473
2474         switch (idx) {
2475         case prop2trbl(SICK):
2476             make_sick(0L, (char *) 0, TRUE, SICK_ALL);
2477             did_prop++;
2478             break;
2479         case prop2trbl(BLINDED):
2480             make_blinded((long) u.ucreamed, TRUE);
2481             did_prop++;
2482             break;
2483         case prop2trbl(HALLUC):
2484             (void) make_hallucinated(0L, TRUE, 0L);
2485             did_prop++;
2486             break;
2487         case prop2trbl(VOMITING):
2488             make_vomiting(0L, TRUE);
2489             did_prop++;
2490             break;
2491         case prop2trbl(CONFUSION):
2492             make_confused(0L, TRUE);
2493             did_prop++;
2494             break;
2495         case prop2trbl(STUNNED):
2496             make_stunned(0L, TRUE);
2497             did_prop++;
2498             break;
2499         case prop2trbl(DEAF):
2500             make_deaf(0L, TRUE);
2501             did_prop++;
2502             break;
2503         default:
2504             if (idx >= 0 && idx < A_MAX) {
2505                 ABASE(idx) += 1;
2506                 did_attr++;
2507             } else
2508                 panic("use_unicorn_horn: bad trouble? (%d)", idx);
2509             break;
2510         }
2511     }
2512
2513     if (did_attr)
2514 #if 0 /*JP*/
2515         pline("This makes you feel %s!",
2516               (did_prop + did_attr) == (trouble_count + unfixable_trbl)
2517                   ? "great"
2518                   : "better");
2519 #else
2520         pline("\8bC\95ª\82ª%s\82æ\82­\82È\82Á\82½\81I",
2521               (did_prop + did_attr) == (trouble_count + unfixable_trbl)
2522                   ? "\82Æ\82Ä\82à"
2523                   : "\82æ\82è");
2524 #endif
2525     else if (!did_prop)
2526 /*JP
2527         pline("Nothing seems to happen.");
2528 */
2529         pline("\89½\82à\8bN\82«\82È\82©\82Á\82½\82æ\82¤\82¾\81D");
2530
2531     context.botl = (did_attr || did_prop);
2532 #undef PROP_COUNT
2533 #undef ATTR_COUNT
2534 #undef prop2trbl
2535 #undef attr2trbl
2536 #undef prop_trouble
2537 #undef attr_trouble
2538 #undef TimedTrouble
2539 }
2540
2541 /*
2542  * Timer callback routine: turn figurine into monster
2543  */
2544 void
2545 fig_transform(arg, timeout)
2546 anything *arg;
2547 long timeout;
2548 {
2549     struct obj *figurine = arg->a_obj;
2550     struct monst *mtmp;
2551     coord cc;
2552     boolean cansee_spot, silent, okay_spot;
2553     boolean redraw = FALSE;
2554     boolean suppress_see = FALSE;
2555     char monnambuf[BUFSZ], carriedby[BUFSZ];
2556
2557     if (!figurine) {
2558         debugpline0("null figurine in fig_transform()");
2559         return;
2560     }
2561     silent = (timeout != monstermoves); /* happened while away */
2562     okay_spot = get_obj_location(figurine, &cc.x, &cc.y, 0);
2563     if (figurine->where == OBJ_INVENT || figurine->where == OBJ_MINVENT)
2564         okay_spot = enexto(&cc, cc.x, cc.y, &mons[figurine->corpsenm]);
2565     if (!okay_spot || !figurine_location_checks(figurine, &cc, TRUE)) {
2566         /* reset the timer to try again later */
2567         (void) start_timer((long) rnd(5000), TIMER_OBJECT, FIG_TRANSFORM,
2568                            obj_to_any(figurine));
2569         return;
2570     }
2571
2572     cansee_spot = cansee(cc.x, cc.y);
2573     mtmp = make_familiar(figurine, cc.x, cc.y, TRUE);
2574     if (mtmp) {
2575         char and_vanish[BUFSZ];
2576         struct obj *mshelter = level.objects[mtmp->mx][mtmp->my];
2577         Sprintf(monnambuf, "%s", an(m_monnam(mtmp)));
2578
2579         and_vanish[0] = '\0';
2580         if ((mtmp->minvis && !See_invisible)
2581             || (mtmp->data->mlet == S_MIMIC
2582                 && mtmp->m_ap_type != M_AP_NOTHING))
2583             suppress_see = TRUE;
2584
2585         if (mtmp->mundetected) {
2586             if (hides_under(mtmp->data) && mshelter) {
2587                 Sprintf(and_vanish, " and %s under %s",
2588                         locomotion(mtmp->data, "crawl"), doname(mshelter));
2589             } else if (mtmp->data->mlet == S_MIMIC
2590                        || mtmp->data->mlet == S_EEL) {
2591                 suppress_see = TRUE;
2592             } else
2593                 Strcpy(and_vanish, " and vanish");
2594         }
2595
2596         switch (figurine->where) {
2597         case OBJ_INVENT:
2598             if (Blind || suppress_see)
2599 #if 0 /*JP*/
2600                 You_feel("%s %s from your pack!", something,
2601                          locomotion(mtmp->data, "drop"));
2602 #else
2603                 You_feel("%s\82ª\82 \82È\82½\82Ì\8a\93\82©\82ç%s\82æ\82¤\82¾\81I", something,
2604                          jpast(locomotion(mtmp->data, "\97\8e\82¿\82é")));
2605 #endif
2606             else
2607 #if 0 /*JP*/
2608                 You_see("%s %s out of your pack%s!", monnambuf,
2609                         locomotion(mtmp->data, "drop"), and_vanish);
2610 #else
2611                 You("%s\82ª\82 \82È\82½\82Ì\8a\93\82©\82ç%s\82Ì\82ð\8c©\82½\81I", monnambuf,
2612                         jpast(locomotion(mtmp->data,"\97\8e\82¿\82é")));
2613 #endif
2614             break;
2615
2616         case OBJ_FLOOR:
2617             if (cansee_spot && !silent) {
2618                 if (suppress_see)
2619                     pline("%s suddenly vanishes!", an(xname(figurine)));
2620                 else
2621 #if 0 /*JP*/
2622                     You_see("a figurine transform into %s%s!", monnambuf,
2623                             and_vanish);
2624 #else
2625                     You("\90l\8c`\82ª\93Ë\91R%s\82É\82È\82Á\82½\82Ì\82ð\8c©\82½\81I",
2626                             monnambuf);
2627 #endif
2628                 redraw = TRUE; /* update figurine's map location */
2629             }
2630             break;
2631
2632         case OBJ_MINVENT:
2633             if (cansee_spot && !silent && !suppress_see) {
2634                 struct monst *mon;
2635                 mon = figurine->ocarry;
2636                 /* figurine carrying monster might be invisible */
2637                 if (canseemon(figurine->ocarry)) {
2638 /*JP
2639                     Sprintf(carriedby, "%s pack", s_suffix(a_monnam(mon)));
2640 */
2641                     Sprintf(carriedby, "%s\82Ì\8a\93", s_suffix(a_monnam(mon)));
2642                 } else if (is_pool(mon->mx, mon->my))
2643 /*JP
2644                     Strcpy(carriedby, "empty water");
2645 */
2646                     Strcpy(carriedby, "\89½\82à\82È\82¢\90\85\92\86");
2647                 else
2648 /*JP
2649                     Strcpy(carriedby, "thin air");
2650 */
2651                     Strcpy(carriedby, "\89½\82à\82È\82¢\8bó\92\86");
2652 #if 0 /*JP*/
2653                 You_see("%s %s out of %s%s!", monnambuf,
2654                         locomotion(mtmp->data, "drop"), carriedby,
2655                         and_vanish);
2656 #else
2657                 You("%s\82ª%s\82©\82ç%s\82Ì\82ð\8c©\82½\81I", monnambuf,
2658                         carriedby, locomotion(mtmp->data, "\97\8e\82¿\82é"));
2659 #endif
2660             }
2661             break;
2662 #if 0
2663         case OBJ_MIGRATING:
2664             break;
2665 #endif
2666
2667         default:
2668             impossible("figurine came to life where? (%d)",
2669                        (int) figurine->where);
2670             break;
2671         }
2672     }
2673     /* free figurine now */
2674     if (carried(figurine)) {
2675         useup(figurine);
2676     } else {
2677         obj_extract_self(figurine);
2678         obfree(figurine, (struct obj *) 0);
2679     }
2680     if (redraw)
2681         newsym(cc.x, cc.y);
2682 }
2683
2684 STATIC_OVL boolean
2685 figurine_location_checks(obj, cc, quietly)
2686 struct obj *obj;
2687 coord *cc;
2688 boolean quietly;
2689 {
2690     xchar x, y;
2691
2692     if (carried(obj) && u.uswallow) {
2693         if (!quietly)
2694 /*JP
2695             You("don't have enough room in here.");
2696 */
2697             pline("\82±\82±\82É\82Í\8f\\95ª\82È\8fê\8f\8a\82ª\82È\82¢\81D");
2698         return FALSE;
2699     }
2700     x = cc ? cc->x : u.ux;
2701     y = cc ? cc->y : u.uy;
2702     if (!isok(x, y)) {
2703         if (!quietly)
2704 /*JP
2705             You("cannot put the figurine there.");
2706 */
2707             You("\82±\82±\82É\82Í\90l\8c`\82ð\92u\82¯\82È\82¢\81D");
2708         return FALSE;
2709     }
2710     if (IS_ROCK(levl[x][y].typ)
2711         && !(passes_walls(&mons[obj->corpsenm]) && may_passwall(x, y))) {
2712         if (!quietly)
2713 #if 0 /*JP*/
2714             You("cannot place a figurine in %s!",
2715                 IS_TREE(levl[x][y].typ) ? "a tree" : "solid rock");
2716 #else
2717             You("%s\82Ì\92\86\82É\82Í\90l\8c`\82ð\92u\82¯\82È\82¢\81I",
2718                 IS_TREE(levl[x][y].typ) ? "\96Ø" : "\8cÅ\82¢\90Î");
2719 #endif
2720         return FALSE;
2721     }
2722     if (sobj_at(BOULDER, x, y) && !passes_walls(&mons[obj->corpsenm])
2723         && !throws_rocks(&mons[obj->corpsenm])) {
2724         if (!quietly)
2725 /*JP
2726             You("cannot fit the figurine on the boulder.");
2727 */
2728             You("\8aâ\82É\90l\8c`\82ð\89\9f\82µ\8d\9e\82Þ\82±\82Æ\82Í\82Å\82«\82È\82¢\81D");
2729         return FALSE;
2730     }
2731     return TRUE;
2732 }
2733
2734 STATIC_OVL void
2735 use_figurine(optr)
2736 struct obj **optr;
2737 {
2738     register struct obj *obj = *optr;
2739     xchar x, y;
2740     coord cc;
2741
2742     if (u.uswallow) {
2743         /* can't activate a figurine while swallowed */
2744         if (!figurine_location_checks(obj, (coord *) 0, FALSE))
2745             return;
2746     }
2747     if (!getdir((char *) 0)) {
2748         context.move = multi = 0;
2749         return;
2750     }
2751     x = u.ux + u.dx;
2752     y = u.uy + u.dy;
2753     cc.x = x;
2754     cc.y = y;
2755     /* Passing FALSE arg here will result in messages displayed */
2756     if (!figurine_location_checks(obj, &cc, FALSE))
2757         return;
2758 #if 0 /*JP*/
2759     You("%s and it transforms.",
2760         (u.dx || u.dy) ? "set the figurine beside you"
2761                        : (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
2762                           || is_pool(cc.x, cc.y))
2763                              ? "release the figurine"
2764                              : (u.dz < 0 ? "toss the figurine into the air"
2765                                          : "set the figurine on the ground"));
2766 #else
2767     You("%s\81D\82·\82é\82Æ\82»\82ê\82Í\95Ï\8c`\82µ\82½\81D",
2768         (u.dx || u.dy) ? "\82»\82Î\82É\90l\8c`\82ð\92u\82¢\82½"
2769                        : (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)
2770                           || is_pool(cc.x, cc.y))
2771                              ? "\90l\8c`\82ð\95ú\82Á\82½"
2772                              : (u.dz < 0 ?  "\90l\8c`\82ð\8bó\92\86\82É\93\8a\82°\82½"
2773                              : "\90l\8c`\82ð\92n\96Ê\82É\92u\82¢\82½"));
2774 #endif
2775     (void) make_familiar(obj, cc.x, cc.y, FALSE);
2776     (void) stop_timer(FIG_TRANSFORM, obj_to_any(obj));
2777     useup(obj);
2778     *optr = 0;
2779 }
2780
2781 static NEARDATA const char lubricables[] = { ALL_CLASSES, ALLOW_NONE, 0 };
2782
2783 STATIC_OVL void
2784 use_grease(obj)
2785 struct obj *obj;
2786 {
2787     struct obj *otmp;
2788
2789     if (Glib) {
2790 #if 0 /*JP*/
2791         pline("%s from your %s.", Tobjnam(obj, "slip"),
2792               makeplural(body_part(FINGER)));
2793 #else
2794         pline("%s\82Í\82 \82È\82½\82Ì%s\82©\82ç\8a\8a\82è\97\8e\82¿\82½\81D", xname(obj),
2795               body_part(FINGER));
2796 #endif
2797         dropx(obj);
2798         return;
2799     }
2800
2801     if (obj->spe > 0) {
2802         if ((obj->cursed || Fumbling) && !rn2(2)) {
2803             consume_obj_charge(obj, TRUE);
2804
2805 #if 0 /*JP*/
2806             pline("%s from your %s.", Tobjnam(obj, "slip"),
2807                   makeplural(body_part(FINGER)));
2808 #else
2809             pline("%s\82Í\82 \82È\82½\82Ì%s\82©\82ç\8a\8a\82è\97\8e\82¿\82½\81D", xname(obj),
2810                   body_part(FINGER));
2811 #endif
2812             dropx(obj);
2813             return;
2814         }
2815         otmp = getobj(lubricables, "grease");
2816         if (!otmp)
2817             return;
2818         if (inaccessible_equipment(otmp, "grease", FALSE))
2819             return;
2820         consume_obj_charge(obj, TRUE);
2821
2822         if (otmp != &zeroobj) {
2823 /*JP
2824             You("cover %s with a thick layer of grease.", yname(otmp));
2825 */
2826             You("%s\82É\8e\89\82ð\92O\94O\82É\93h\82Á\82½\81D", yname(otmp));
2827             otmp->greased = 1;
2828             if (obj->cursed && !nohands(youmonst.data)) {
2829                 incr_itimeout(&Glib, rnd(15));
2830 /*JP
2831                 pline("Some of the grease gets all over your %s.",
2832 */
2833                 pline("\8e\89\82ª\8f­\82µ%s\82É\82Â\82¢\82½\81D",
2834                       makeplural(body_part(HAND)));
2835             }
2836         } else {
2837             incr_itimeout(&Glib, rnd(15));
2838 /*JP
2839             You("coat your %s with grease.", makeplural(body_part(FINGER)));
2840 */
2841             You("%s\82É\8e\89\82ð\93h\82Á\82½\81D", makeplural(body_part(FINGER)));
2842         }
2843     } else {
2844         if (obj->known)
2845 /*JP
2846             pline("%s empty.", Tobjnam(obj, "are"));
2847 */
2848             pline("%s\82Í\8bó\82Á\82Û\82¾\81D", xname(obj));
2849         else
2850 /*JP
2851             pline("%s to be empty.", Tobjnam(obj, "seem"));
2852 */
2853             pline("%s\82Í\8bó\82Á\82Û\82Ì\82æ\82¤\82¾\81D", xname(obj));
2854     }
2855     update_inventory();
2856 }
2857
2858 static struct trapinfo {
2859     struct obj *tobj;
2860     xchar tx, ty;
2861     int time_needed;
2862     boolean force_bungle;
2863 } trapinfo;
2864
2865 void
2866 reset_trapset()
2867 {
2868     trapinfo.tobj = 0;
2869     trapinfo.force_bungle = 0;
2870 }
2871
2872 /* touchstones - by Ken Arnold */
2873 STATIC_OVL void
2874 use_stone(tstone)
2875 struct obj *tstone;
2876 {
2877     struct obj *obj;
2878     boolean do_scratch;
2879     const char *streak_color, *choices;
2880     char stonebuf[QBUFSZ];
2881 /*JP
2882     static const char scritch[] = "\"scritch, scritch\"";
2883 */
2884     static const char scritch[] = "\81u\83S\83V\81C\83S\83V\81v";
2885     static const char allowall[3] = { COIN_CLASS, ALL_CLASSES, 0 };
2886     static const char coins_gems[3] = { COIN_CLASS, GEM_CLASS, 0 };
2887
2888     /* in case it was acquired while blinded */
2889     if (!Blind)
2890         tstone->dknown = 1;
2891     /* when the touchstone is fully known, don't bother listing extra
2892        junk as likely candidates for rubbing */
2893     choices = (tstone->otyp == TOUCHSTONE && tstone->dknown
2894                && objects[TOUCHSTONE].oc_name_known)
2895                   ? coins_gems
2896                   : allowall;
2897 /*JP
2898     Sprintf(stonebuf, "rub on the stone%s", plur(tstone->quan));
2899 */
2900     Sprintf(stonebuf, "rub on the stone");
2901     if ((obj = getobj(choices, stonebuf)) == 0)
2902         return;
2903
2904     if (obj == tstone && obj->quan == 1L) {
2905 /*JP
2906         You_cant("rub %s on itself.", the(xname(obj)));
2907 */
2908         You("%s\82ð\82»\82ê\8e©\91Ì\82Å\82±\82·\82é\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", the(xname(obj)));
2909         return;
2910     }
2911
2912     if (tstone->otyp == TOUCHSTONE && tstone->cursed
2913         && obj->oclass == GEM_CLASS && !is_graystone(obj)
2914         && !obj_resists(obj, 80, 100)) {
2915         if (Blind)
2916 /*JP
2917             pline("You feel something shatter.");
2918 */
2919             You("\89½\82©\82ª\95²\81X\82É\82È\82é\82Ì\82ð\8a´\82\82½\81D");
2920         else if (Hallucination)
2921 /*JP
2922             pline("Oh, wow, look at the pretty shards.");
2923 */
2924             pline("\83\8f\81[\83H\81I\82È\82ñ\82Ä\82«\82ê\82¢\82È\94j\95Ð\82È\82ñ\82¾\81D");
2925         else
2926 #if 0 /*JP*/
2927             pline("A sharp crack shatters %s%s.",
2928                   (obj->quan > 1L) ? "one of " : "", the(xname(obj)));
2929 #else
2930             pline("\8b­\82­\82±\82·\82è\82·\82¬\82Ä%s%s\82Í\95²\81X\82É\82È\82Á\82Ä\82µ\82Ü\82Á\82½\81D",
2931                   the(xname(obj)), (obj->quan > 1) ? "\82Ì\82Ð\82Æ\82Â" : "");
2932 #endif
2933         useup(obj);
2934         return;
2935     }
2936
2937     if (Blind) {
2938         pline(scritch);
2939         return;
2940     } else if (Hallucination) {
2941 #if 0 /*JP*/
2942         pline("Oh wow, man: Fractals!");
2943 #else
2944         pline("\83\8f\81[\83H\81I\83t\83\89\83N\83^\83\8b\96Í\97l\82¾\81I");
2945 #endif
2946         return;
2947     }
2948
2949     do_scratch = FALSE;
2950     streak_color = 0;
2951
2952     switch (obj->oclass) {
2953     case GEM_CLASS: /* these have class-specific handling below */
2954     case RING_CLASS:
2955         if (tstone->otyp != TOUCHSTONE) {
2956             do_scratch = TRUE;
2957         } else if (obj->oclass == GEM_CLASS
2958                    && (tstone->blessed
2959                        || (!tstone->cursed && (Role_if(PM_ARCHEOLOGIST)
2960                                                || Race_if(PM_GNOME))))) {
2961             makeknown(TOUCHSTONE);
2962             makeknown(obj->otyp);
2963             prinv((char *) 0, obj, 0L);
2964             return;
2965         } else {
2966             /* either a ring or the touchstone was not effective */
2967             if (objects[obj->otyp].oc_material == GLASS) {
2968                 do_scratch = TRUE;
2969                 break;
2970             }
2971         }
2972         streak_color = c_obj_colors[objects[obj->otyp].oc_color];
2973         break; /* gem or ring */
2974
2975     default:
2976         switch (objects[obj->otyp].oc_material) {
2977         case CLOTH:
2978 #if 0 /*JP*/
2979             pline("%s a little more polished now.", Tobjnam(tstone, "look"));
2980 #else
2981             pline("%s\82Í\82³\82ç\82É\82Â\82â\82ª\8fo\82½\82æ\82¤\82É\8c©\82¦\82é\81D", xname(tstone));
2982 #endif
2983             return;
2984         case LIQUID:
2985             if (!obj->known) /* note: not "whetstone" */
2986 #if 0 /*JP*/
2987                 You("must think this is a wetstone, do you?");
2988 #else
2989                 You("\82±\82ê\82Í\93u\90Î\82¾\82Æ\8ev\82Á\82½\81H");
2990 #endif
2991             else
2992 #if 0 /*JP*/
2993                 pline("%s a little wetter now.", Tobjnam(tstone, "are"));
2994 #else
2995                 pline("%s\82Í\8f­\82µ\82Ê\82ê\82½\81D", xname(tstone));
2996 #endif
2997             return;
2998         case WAX:
2999 #if 0 /*JP*/
3000             streak_color = "waxy";
3001 #else
3002             streak_color = "\8e\89\82Á\82Û\82¢";
3003 #endif
3004             break; /* okay even if not touchstone */
3005         case WOOD:
3006 #if 0 /*JP*/
3007             streak_color = "wooden";
3008 #else
3009             streak_color = "\82¨\82ª\82­\82¸\82Ì\82æ\82¤\82È";
3010 #endif
3011             break; /* okay even if not touchstone */
3012         case GOLD:
3013             do_scratch = TRUE; /* scratching and streaks */
3014 #if 0 /*JP*/
3015             streak_color = "golden";
3016 #else
3017             streak_color = "\8bà\90F\82Ì";
3018 #endif
3019             break;
3020         case SILVER:
3021             do_scratch = TRUE; /* scratching and streaks */
3022 #if 0 /*JP*/
3023             streak_color = "silvery";
3024 #else
3025             streak_color = "\8bâ\90F\82Ì";
3026 #endif
3027             break;
3028         default:
3029             /* Objects passing the is_flimsy() test will not
3030                scratch a stone.  They will leave streaks on
3031                non-touchstones and touchstones alike. */
3032             if (is_flimsy(obj))
3033                 streak_color = c_obj_colors[objects[obj->otyp].oc_color];
3034             else
3035                 do_scratch = (tstone->otyp != TOUCHSTONE);
3036             break;
3037         }
3038         break; /* default oclass */
3039     }
3040
3041 #if 0 /*JP*//* not used */
3042     Sprintf(stonebuf, "stone%s", plur(tstone->quan));
3043 #endif
3044     if (do_scratch)
3045 #if 0 /*JP*/
3046         You("make %s%sscratch marks on the %s.",
3047             streak_color ? streak_color : (const char *) "",
3048             streak_color ? " " : "", stonebuf);
3049 #else
3050         You("%s\82±\82·\82è\90Õ\82ð\90Î\82É\82Â\82¯\82½\81D",
3051             streak_color ? streak_color : (const char *)"");
3052 #endif
3053     else if (streak_color)
3054 /*JP
3055         You_see("%s streaks on the %s.", streak_color, stonebuf);
3056 */
3057         pline("\90Î\82É%s\8bØ\82ª\82Â\82¢\82½\81D", streak_color);
3058     else
3059         pline(scritch);
3060     return;
3061 }
3062
3063 /* Place a landmine/bear trap.  Helge Hafting */
3064 STATIC_OVL void
3065 use_trap(otmp)
3066 struct obj *otmp;
3067 {
3068     int ttyp, tmp;
3069     const char *what = (char *) 0;
3070     char buf[BUFSZ];
3071     int levtyp = levl[u.ux][u.uy].typ;
3072 #if 0 /*JP*/
3073     const char *occutext = "setting the trap";
3074 #else
3075     const char *occutext = "ã©\82ð\8ed\8a|\82¯\82Ä\82¢\82é";
3076 #endif
3077
3078     if (nohands(youmonst.data))
3079 /*JP
3080         what = "without hands";
3081 */
3082         what = "\8eè\82ª\82È\82¢\82Ì\82Å";
3083     else if (Stunned)
3084 /*JP
3085         what = "while stunned";
3086 */
3087         what = "\82­\82ç\82­\82ç\82µ\82Ä\82¢\82é\82Ì\82Å";
3088     else if (u.uswallow)
3089         what =
3090 /*JP
3091             is_animal(u.ustuck->data) ? "while swallowed" : "while engulfed";
3092 */
3093             is_animal(u.ustuck->data) ? "\88ù\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82é\8aÔ\82Í" : "\8aª\82«\8d\9e\82Ü\82ê\82Ä\82¢\82é\8aÔ\82Í";
3094     else if (Underwater)
3095 /*JP
3096         what = "underwater";
3097 */
3098         what = "\90\85\96Ê\89º\82Å\82Í";
3099     else if (Levitation)
3100 /*JP
3101         what = "while levitating";
3102 */
3103         what = "\95\82\82¢\82Ä\82¢\82é\8aÔ\82Í";
3104     else if (is_pool(u.ux, u.uy))
3105 /*JP
3106         what = "in water";
3107 */
3108         what = "\90\85\92\86\82Å\82Í";
3109     else if (is_lava(u.ux, u.uy))
3110 /*JP
3111         what = "in lava";
3112 */
3113         what = "\97n\8aâ\82Ì\92\86\82Å\82Í";
3114     else if (On_stairs(u.ux, u.uy))
3115 #if 0 /*JP*/
3116         what = (u.ux == xdnladder || u.ux == xupladder) ? "on the ladder"
3117                                                         : "on the stairs";
3118 #else
3119         what = (u.ux == xdnladder || u.ux == xupladder) ? "\82Í\82µ\82²\82Ì\8fã\82Å\82Í"
3120                                                         : "\8aK\92i\82Ì\8fã\82Å\82Í";
3121 #endif
3122     else if (IS_FURNITURE(levtyp) || IS_ROCK(levtyp)
3123              || closed_door(u.ux, u.uy) || t_at(u.ux, u.uy))
3124 /*JP
3125         what = "here";
3126 */
3127         what = "\82±\82±\82Å\82Í";
3128     else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz))
3129 #if 0 /*JP*/
3130         what = (levtyp == AIR)
3131                    ? "in midair"
3132                    : (levtyp == CLOUD)
3133                          ? "in a cloud"
3134                          : "in this place"; /* Air/Water Plane catch-all */
3135 #else
3136         what = (levtyp == AIR)
3137                    ? "\8bó\92\86\82Å\82Í"
3138                    : (levtyp == CLOUD)
3139                          ? "\89_\82Ì\92\86\82Å\82Í"
3140                          : "\82±\82±\82Å\82Í"; /* Air/Water Plane catch-all */
3141 #endif
3142     if (what) {
3143 /*JP
3144         You_cant("set a trap %s!", what);
3145 */
3146         pline("%sã©\82ð\8ed\8a|\82¯\82ç\82ê\82È\82¢\81I",what);
3147         reset_trapset();
3148         return;
3149     }
3150     ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
3151     if (otmp == trapinfo.tobj && u.ux == trapinfo.tx && u.uy == trapinfo.ty) {
3152 /*JP
3153         You("resume setting %s%s.", shk_your(buf, otmp),
3154 */
3155         You("%s\82ð\8ed\8a|\82¯\82é\82Ì\82ð\8dÄ\8aJ\82µ\82½\81D",
3156             defsyms[trap_to_defsym(what_trap(ttyp))].explanation);
3157         set_occupation(set_trap, occutext, 0);
3158         return;
3159     }
3160     trapinfo.tobj = otmp;
3161     trapinfo.tx = u.ux, trapinfo.ty = u.uy;
3162     tmp = ACURR(A_DEX);
3163     trapinfo.time_needed =
3164         (tmp > 17) ? 2 : (tmp > 12) ? 3 : (tmp > 7) ? 4 : 5;
3165     if (Blind)
3166         trapinfo.time_needed *= 2;
3167     tmp = ACURR(A_STR);
3168     if (ttyp == BEAR_TRAP && tmp < 18)
3169         trapinfo.time_needed += (tmp > 12) ? 1 : (tmp > 7) ? 2 : 4;
3170     /*[fumbling and/or confusion and/or cursed object check(s)
3171        should be incorporated here instead of in set_trap]*/
3172     if (u.usteed && P_SKILL(P_RIDING) < P_BASIC) {
3173         boolean chance;
3174
3175         if (Fumbling || otmp->cursed)
3176             chance = (rnl(10) > 3);
3177         else
3178             chance = (rnl(10) > 5);
3179 /*JP
3180         You("aren't very skilled at reaching from %s.", mon_nam(u.usteed));
3181 */
3182         pline("%s\82Ì\8fã\82©\82ç\82Å\82Í\82¤\82Ü\82­\8ed\8a|\82¯\82ç\82ê\82È\82¢\82©\82à\82µ\82ê\82È\82¢\81D", mon_nam(u.usteed));
3183 /*JP
3184         Sprintf(buf, "Continue your attempt to set %s?",
3185 */
3186         Sprintf(buf, "%s\82Ì\8ed\8a|\82¯\82ð\91±\82¯\82é\81H",
3187                 the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
3188         if (yn(buf) == 'y') {
3189             if (chance) {
3190                 switch (ttyp) {
3191                 case LANDMINE: /* set it off */
3192                     trapinfo.time_needed = 0;
3193                     trapinfo.force_bungle = TRUE;
3194                     break;
3195                 case BEAR_TRAP: /* drop it without arming it */
3196                     reset_trapset();
3197 /*JP
3198                     You("drop %s!",
3199 */
3200                     You("%s\82ð\97\8e\82Æ\82µ\82½\81I",
3201                         the(defsyms[trap_to_defsym(what_trap(ttyp))]
3202                                 .explanation));
3203                     dropx(otmp);
3204                     return;
3205                 }
3206             }
3207         } else {
3208             reset_trapset();
3209             return;
3210         }
3211     }
3212 /*JP
3213     You("begin setting %s%s.", shk_your(buf, otmp),
3214 */
3215     You("%s%s\82ð\8ed\8a|\82¯\82Í\82\82ß\82½\81D", shk_your(buf, otmp),
3216         defsyms[trap_to_defsym(what_trap(ttyp))].explanation);
3217     set_occupation(set_trap, occutext, 0);
3218     return;
3219 }
3220
3221 STATIC_PTR
3222 int
3223 set_trap()
3224 {
3225     struct obj *otmp = trapinfo.tobj;
3226     struct trap *ttmp;
3227     int ttyp;
3228
3229     if (!otmp || !carried(otmp) || u.ux != trapinfo.tx
3230         || u.uy != trapinfo.ty) {
3231         /* ?? */
3232         reset_trapset();
3233         return 0;
3234     }
3235
3236     if (--trapinfo.time_needed > 0)
3237         return 1; /* still busy */
3238
3239     ttyp = (otmp->otyp == LAND_MINE) ? LANDMINE : BEAR_TRAP;
3240     ttmp = maketrap(u.ux, u.uy, ttyp);
3241     if (ttmp) {
3242         ttmp->madeby_u = 1;
3243         feeltrap(ttmp);
3244         if (*in_rooms(u.ux, u.uy, SHOPBASE)) {
3245             add_damage(u.ux, u.uy, 0L); /* schedule removal */
3246         }
3247         if (!trapinfo.force_bungle)
3248 /*JP
3249             You("finish arming %s.",
3250 */
3251             You("%s\82ð\8ed\8a|\82¯\8fI\82¦\82½\81D",
3252                 the(defsyms[trap_to_defsym(what_trap(ttyp))].explanation));
3253         if (((otmp->cursed || Fumbling) && (rnl(10) > 5))
3254             || trapinfo.force_bungle)
3255             dotrap(ttmp,
3256                    (unsigned) (trapinfo.force_bungle ? FORCEBUNGLE : 0));
3257     } else {
3258         /* this shouldn't happen */
3259 /*JP
3260         Your("trap setting attempt fails.");
3261 */
3262         You("ã©\82ð\8ed\8a|\82¯\82é\82Ì\82É\8e¸\94s\82µ\82½\81D");
3263     }
3264     useup(otmp);
3265     reset_trapset();
3266     return 0;
3267 }
3268
3269 STATIC_OVL int
3270 use_whip(obj)
3271 struct obj *obj;
3272 {
3273     char buf[BUFSZ];
3274     struct monst *mtmp;
3275     struct obj *otmp;
3276     int rx, ry, proficient, res = 0;
3277 /*JP
3278     const char *msg_slipsfree = "The bullwhip slips free.";
3279 */
3280     const char *msg_slipsfree = "\95Ú\82Í\82Ù\82Ç\82¯\82½\81D";
3281 /*JP
3282     const char *msg_snap = "Snap!";
3283 */
3284     const char *msg_snap = "\83s\83V\83b\81I";
3285
3286     if (obj != uwep) {
3287         if (!wield_tool(obj, "lash"))
3288             return 0;
3289         else
3290             res = 1;
3291     }
3292     if (!getdir((char *) 0))
3293         return res;
3294
3295     if (u.uswallow) {
3296         mtmp = u.ustuck;
3297         rx = mtmp->mx;
3298         ry = mtmp->my;
3299     } else {
3300         if (Stunned || (Confusion && !rn2(5)))
3301             confdir();
3302         rx = u.ux + u.dx;
3303         ry = u.uy + u.dy;
3304         if (!isok(rx, ry)) {
3305             You("miss.");
3306             return res;
3307         }
3308         mtmp = m_at(rx, ry);
3309     }
3310
3311     /* fake some proficiency checks */
3312     proficient = 0;
3313     if (Role_if(PM_ARCHEOLOGIST))
3314         ++proficient;
3315     if (ACURR(A_DEX) < 6)
3316         proficient--;
3317     else if (ACURR(A_DEX) >= 14)
3318         proficient += (ACURR(A_DEX) - 14);
3319     if (Fumbling)
3320         --proficient;
3321     if (proficient > 3)
3322         proficient = 3;
3323     if (proficient < 0)
3324         proficient = 0;
3325
3326     if (u.uswallow && attack(u.ustuck)) {
3327 /*JP
3328         There("is not enough room to flick your bullwhip.");
3329 */
3330         pline("\95Ú\82ð\91Å\82Â\82Ù\82Ç\8dL\82­\82È\82¢\81D");
3331
3332     } else if (Underwater) {
3333 /*JP
3334         There("is too much resistance to flick your bullwhip.");
3335 */
3336         pline("\90\85\82Ì\92ï\8dR\82ª\82 \82è\82·\82¬\82Ä\95Ú\82ð\91Å\82Â\82±\82Æ\82ª\82Å\82«\82È\82¢\81D");
3337
3338     } else if (u.dz < 0) {
3339 /*JP
3340         You("flick a bug off of the %s.", ceiling(u.ux, u.uy));
3341 */
3342         You("%s\82Ì\92\8e\82ð\91Å\82¿\97\8e\82µ\82½\81D",ceiling(u.ux,u.uy));
3343
3344     } else if ((!u.dx && !u.dy) || (u.dz > 0)) {
3345         int dam;
3346
3347         /* Sometimes you hit your steed by mistake */
3348         if (u.usteed && !rn2(proficient + 2)) {
3349 /*JP
3350             You("whip %s!", mon_nam(u.usteed));
3351 */
3352             You("%s\82ð\95Ú\91Å\82Á\82½\81I", mon_nam(u.usteed));
3353             kick_steed();
3354             return 1;
3355         }
3356         if (Levitation || u.usteed) {
3357             /* Have a shot at snaring something on the floor */
3358             otmp = level.objects[u.ux][u.uy];
3359             if (otmp && otmp->otyp == CORPSE && otmp->corpsenm == PM_HORSE) {
3360 /*JP
3361                 pline("Why beat a dead horse?");
3362 */
3363                 pline("\82Ç\82¤\82µ\82Ä\8e\80\82ñ\82¾\94n\82ð\95Ú\91Å\82Â\82æ\82¤\82È\82±\82Æ\82ð\82·\82é\82Ì\81H");
3364                 return 1;
3365             }
3366             if (otmp && proficient) {
3367 #if 0 /*JP*/
3368                 You("wrap your bullwhip around %s on the %s.",
3369                     an(singular(otmp, xname)), surface(u.ux, u.uy));
3370 #else
3371                 You("\95Ú\82ð%s\82Ì\8fã\82Ì%s\82É\82©\82ç\82Ü\82¹\82½\81D",
3372                     surface(u.ux, u.uy), an(singular(otmp, xname)));
3373 #endif
3374                 if (rnl(6) || pickup_object(otmp, 1L, TRUE) < 1)
3375                     pline1(msg_slipsfree);
3376                 return 1;
3377             }
3378         }
3379         dam = rnd(2) + dbon() + obj->spe;
3380         if (dam <= 0)
3381             dam = 1;
3382 /*JP
3383         You("hit your %s with your bullwhip.", body_part(FOOT));
3384 */
3385         You("\8e©\95ª\82Ì%s\82ð\8e©\95ª\82Å\91Å\82¿\82Â\82¯\82½\81D", body_part(FOOT));
3386 #if 0 /*JP*/
3387         Sprintf(buf, "killed %sself with %s bullwhip", uhim(), uhis());
3388         losehp(Maybe_Half_Phys(dam), buf, NO_KILLER_PREFIX);
3389 #else
3390         Strcpy(buf, "\8e©\95ª\8e©\90g\82ð\95Ú\91Å\82Á\82Ä");
3391         losehp(dam, buf, KILLED_BY);
3392 #endif
3393         context.botl = 1;
3394         return 1;
3395
3396     } else if ((Fumbling || Glib) && !rn2(5)) {
3397 /*JP
3398         pline_The("bullwhip slips out of your %s.", body_part(HAND));
3399 */
3400         pline("\95Ú\82ª%s\82©\82ç\82·\82×\82è\97\8e\82¿\82½\81D", body_part(HAND));
3401         dropx(obj);
3402
3403     } else if (u.utrap && u.utraptype == TT_PIT) {
3404         /*
3405          * Assumptions:
3406          *
3407          * if you're in a pit
3408          *    - you are attempting to get out of the pit
3409          * or, if you are applying it towards a small monster
3410          *    - then it is assumed that you are trying to hit it
3411          * else if the monster is wielding a weapon
3412          *    - you are attempting to disarm a monster
3413          * else
3414          *    - you are attempting to hit the monster.
3415          *
3416          * if you're confused (and thus off the mark)
3417          *    - you only end up hitting.
3418          *
3419          */
3420         const char *wrapped_what = (char *) 0;
3421
3422         if (mtmp) {
3423             if (bigmonst(mtmp->data)) {
3424                 wrapped_what = strcpy(buf, mon_nam(mtmp));
3425             } else if (proficient) {
3426                 if (attack(mtmp))
3427                     return 1;
3428                 else
3429                     pline1(msg_snap);
3430             }
3431         }
3432         if (!wrapped_what) {
3433             if (IS_FURNITURE(levl[rx][ry].typ))
3434                 wrapped_what = something;
3435             else if (sobj_at(BOULDER, rx, ry))
3436 /*JP
3437                 wrapped_what = "a boulder";
3438 */
3439                 wrapped_what = "\8aâ";
3440         }
3441         if (wrapped_what) {
3442             coord cc;
3443
3444             cc.x = rx;
3445             cc.y = ry;
3446 /*JP
3447             You("wrap your bullwhip around %s.", wrapped_what);
3448 */
3449             You("\95Ú\82ð%s\82É\82©\82ç\82Ü\82¹\82½\81D", wrapped_what);
3450             if (proficient && rn2(proficient + 2)) {
3451                 if (!mtmp || enexto(&cc, rx, ry, youmonst.data)) {
3452 /*JP
3453                     You("yank yourself out of the pit!");
3454 */
3455                     You("\82®\82¢\82Æ\88ø\82Á\82Ï\82Á\82Ä\8c\8a\82©\82ç\94²\82¯\8fo\82µ\82½\81I");
3456                     teleds(cc.x, cc.y, TRUE);
3457                     u.utrap = 0;
3458                     vision_full_recalc = 1;
3459                 }
3460             } else {
3461                 pline1(msg_slipsfree);
3462             }
3463             if (mtmp)
3464                 wakeup(mtmp);
3465         } else
3466             pline1(msg_snap);
3467
3468     } else if (mtmp) {
3469         if (!canspotmon(mtmp) && !glyph_is_invisible(levl[rx][ry].glyph)) {
3470 /*JP
3471             pline("A monster is there that you couldn't see.");
3472 */
3473             pline("\8c©\82¦\82È\82¢\89ö\95¨\82ª\82¢\82é\81D");
3474             map_invisible(rx, ry);
3475         }
3476         otmp = MON_WEP(mtmp); /* can be null */
3477         if (otmp) {
3478             char onambuf[BUFSZ];
3479             const char *mon_hand;
3480             boolean gotit = proficient && (!Fumbling || !rn2(10));
3481
3482             Strcpy(onambuf, cxname(otmp));
3483             if (gotit) {
3484                 mon_hand = mbodypart(mtmp, HAND);
3485                 if (bimanual(otmp))
3486                     mon_hand = makeplural(mon_hand);
3487             } else
3488                 mon_hand = 0; /* lint suppression */
3489
3490 /*JP
3491             You("wrap your bullwhip around %s.", yname(otmp));
3492 */
3493             You("\95Ú\82ð%s\82É\82©\82ç\82Ü\82¹\82½\81D", yname(otmp));
3494             if (gotit && mwelded(otmp)) {
3495 #if 0 /*JP*/
3496                 pline("%s welded to %s %s%c",
3497                       (otmp->quan == 1L) ? "It is" : "They are", mhis(mtmp),
3498                       mon_hand, !otmp->bknown ? '!' : '.');
3499 #else
3500                 pline("%s\82Í%s\82Ì%s\82É\82­\82Á\82Â\82¢\82Ä\82µ\82Ü\82Á\82Ä\82¢\82é%s",
3501                       onambuf,
3502                       mon_nam(mtmp), mon_hand,
3503                       !otmp->bknown ? "\81I" : "\81D");
3504 #endif
3505                 otmp->bknown = 1;
3506                 gotit = FALSE; /* can't pull it free */
3507             }
3508             if (gotit) {
3509                 obj_extract_self(otmp);
3510                 possibly_unwield(mtmp, FALSE);
3511                 setmnotwielded(mtmp, otmp);
3512
3513                 switch (rn2(proficient + 1)) {
3514                 case 2:
3515                     /* to floor near you */
3516 /*JP
3517                     You("yank %s to the %s!", yname(otmp),
3518 */
3519                     You("%s\82ð%s\82É\88ø\82«\97\8e\82µ\82½\81I", yname(otmp),
3520                         surface(u.ux, u.uy));
3521                     place_object(otmp, u.ux, u.uy);
3522                     stackobj(otmp);
3523                     break;
3524                 case 3:
3525 #if 0
3526                     /* right to you */
3527                     if (!rn2(25)) {
3528                         /* proficient with whip, but maybe not
3529                            so proficient at catching weapons */
3530                         int hitu, hitvalu;
3531
3532                         hitvalu = 8 + otmp->spe;
3533                         hitu = thitu(hitvalu,
3534                                      dmgval(otmp, &youmonst),
3535                                      otmp, (char *)0);
3536                         if (hitu) {
3537 /*JP
3538                             pline_The("%s hits you as you try to snatch it!",
3539 */
3540                             pline_The("%s\82ð\92D\82¨\82¤\82Æ\82µ\82½\82ç\82 \82È\82½\82É\93\96\82½\82Á\82½\81I",
3541                                       the(onambuf));
3542                         }
3543                         place_object(otmp, u.ux, u.uy);
3544                         stackobj(otmp);
3545                         break;
3546                     }
3547 #endif /* 0 */
3548                     /* right into your inventory */
3549 /*JP
3550                     You("snatch %s!", yname(otmp));
3551 */
3552                     You("%s\82ð\92D\82Á\82½\81I", yname(otmp));
3553                     if (otmp->otyp == CORPSE
3554                         && touch_petrifies(&mons[otmp->corpsenm]) && !uarmg
3555                         && !Stone_resistance
3556                         && !(poly_when_stoned(youmonst.data)
3557                              && polymon(PM_STONE_GOLEM))) {
3558                         char kbuf[BUFSZ];
3559
3560 #if 0 /*JP*/
3561                         Sprintf(kbuf, "%s corpse",
3562                                 an(mons[otmp->corpsenm].mname));
3563                         pline("Snatching %s is a fatal mistake.", kbuf);
3564 #else
3565                         pline("%s\82Ì\8e\80\91Ì\82ð\92D\82Á\82½\82Ì\82Í\92v\96½\93I\82È\8aÔ\88á\82¢\82¾\81D",
3566                                 mons[otmp->corpsenm].mname);
3567                         Sprintf(kbuf, "%s\82Ì\8e\80\91Ì\82É\90G\82ê\82Ä",
3568                                 mons[otmp->corpsenm].mname);
3569 #endif
3570                         instapetrify(kbuf);
3571                     }
3572                     otmp = hold_another_object(
3573 /*JP
3574                         otmp, "You drop %s!", doname(otmp), (const char *) 0);
3575 */
3576                         otmp, "%s\82ð\97\8e\82µ\82½\81I", doname(otmp), (const char *) 0);
3577                     break;
3578                 default:
3579                     /* to floor beneath mon */
3580 /*JP
3581                     You("yank %s from %s %s!", the(onambuf),
3582 */
3583                     You("%s\82ð%s\82Ì%s\82©\82ç\82Ð\82Á\82Ï\82Á\82½\81I", the(xname(otmp)),
3584                         s_suffix(mon_nam(mtmp)), mon_hand);
3585                     obj_no_longer_held(otmp);
3586                     place_object(otmp, mtmp->mx, mtmp->my);
3587                     stackobj(otmp);
3588                     break;
3589                 }
3590             } else {
3591                 pline1(msg_slipsfree);
3592             }
3593             wakeup(mtmp);
3594         } else {
3595             if (mtmp->m_ap_type && !Protection_from_shape_changers
3596                 && !sensemon(mtmp))
3597                 stumble_onto_mimic(mtmp);
3598             else
3599 /*JP
3600                 You("flick your bullwhip towards %s.", mon_nam(mtmp));
3601 */
3602                 You("%s\82É\8cü\82Á\82Ä\95Ú\82ð\91Å\82Á\82½\81D", mon_nam(mtmp));
3603             if (proficient) {
3604                 if (attack(mtmp))
3605                     return 1;
3606                 else
3607                     pline1(msg_snap);
3608             }
3609         }
3610
3611     } else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {
3612         /* it must be air -- water checked above */
3613 /*JP
3614         You("snap your whip through thin air.");
3615 */
3616         You("\89½\82à\82È\82¢\82Æ\82±\82ë\82Å\95Ú\82ð\91Å\82Á\82½\81D");
3617
3618     } else {
3619         pline1(msg_snap);
3620     }
3621     return 1;
3622 }
3623
3624 static const char
3625 /*JP
3626     not_enough_room[] = "There's not enough room here to use that.",
3627 */
3628     not_enough_room[] = "\82»\82ê\82ð\8eg\82¤\82¾\82¯\82Ì\8dL\82³\82ª\82È\82¢\81D",
3629 /*JP
3630     where_to_hit[] = "Where do you want to hit?",
3631 */
3632     where_to_hit[] = "\82Ç\82ê\82ð\91_\82¤\81H",
3633 /*JP
3634     cant_see_spot[] = "won't hit anything if you can't see that spot.",
3635 */
3636     cant_see_spot[] = "\8fê\8f\8a\82ª\8c©\82¦\82È\82¯\82ê\82Î\91_\82¦\82È\82¢\81D",
3637 /*JP
3638     cant_reach[] = "can't reach that spot from here.";
3639 */
3640     cant_reach[] = "\82±\82±\82©\82ç\82»\82±\82Ö\82Í\93Í\82©\82È\82¢\81D";
3641
3642 /* find pos of monster in range, if only one monster */
3643 boolean
3644 find_poleable_mon(pos, min_range, max_range)
3645 coord *pos;
3646 int min_range, max_range;
3647 {
3648     struct monst *mtmp;
3649     struct monst *selmon = (struct monst *) 0;
3650
3651     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
3652         if (mtmp && !DEADMONSTER(mtmp) && !mtmp->mtame
3653             && cansee(mtmp->mx, mtmp->my)
3654             && distu(mtmp->mx, mtmp->my) <= max_range
3655             && distu(mtmp->mx, mtmp->my) >= min_range) {
3656             if (selmon)
3657                 return FALSE;
3658             selmon = mtmp;
3659         }
3660     if (!selmon)
3661         return FALSE;
3662     pos->x = selmon->mx;
3663     pos->y = selmon->my;
3664     return TRUE;
3665 }
3666
3667 static int polearm_range_min = -1;
3668 static int polearm_range_max = -1;
3669
3670 void
3671 display_polearm_positions(state)
3672 int state;
3673 {
3674     if (state == 0) {
3675         tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
3676     } else if (state == 1) {
3677         int x, y, dx, dy;
3678
3679         for (dx = -4; dx <= 4; dx++)
3680             for (dy = -4; dy <= 4; dy++) {
3681                 x = dx + (int) u.ux;
3682                 y = dy + (int) u.uy;
3683                 if (isok(x, y) && ACCESSIBLE(levl[x][y].typ)
3684                     && distu(x, y) >= polearm_range_min
3685                     && distu(x, y) <= polearm_range_max) {
3686                     tmp_at(x, y);
3687                 }
3688             }
3689     } else {
3690         tmp_at(DISP_END, 0);
3691     }
3692 }
3693
3694 /* Distance attacks by pole-weapons */
3695 STATIC_OVL int
3696 use_pole(obj)
3697 struct obj *obj;
3698 {
3699     int res = 0, typ, max_range, min_range, glyph;
3700     coord cc;
3701     struct monst *mtmp;
3702     struct monst *hitm = context.polearm.hitmon;
3703
3704     /* Are you allowed to use the pole? */
3705     if (u.uswallow) {
3706         pline(not_enough_room);
3707         return 0;
3708     }
3709     if (obj != uwep) {
3710         if (!wield_tool(obj, "swing"))
3711             return 0;
3712         else
3713             res = 1;
3714     }
3715     /* assert(obj == uwep); */
3716
3717     /*
3718      * Calculate allowable range (pole's reach is always 2 steps):
3719      *  unskilled and basic: orthogonal direction, 4..4;
3720      *  skilled: as basic, plus knight's jump position, 4..5;
3721      *  expert: as skilled, plus diagonal, 4..8.
3722      *      ...9...
3723      *      .85458.
3724      *      .52125.
3725      *      9410149
3726      *      .52125.
3727      *      .85458.
3728      *      ...9...
3729      *  (Note: no roles in nethack can become expert or better
3730      *  for polearm skill; Yeoman in slash'em can become expert.)
3731      */
3732     min_range = 4;
3733     typ = uwep_skill_type();
3734     if (typ == P_NONE || P_SKILL(typ) <= P_BASIC)
3735         max_range = 4;
3736     else if (P_SKILL(typ) == P_SKILLED)
3737         max_range = 5;
3738     else
3739         max_range = 8; /* (P_SKILL(typ) >= P_EXPERT) */
3740
3741     polearm_range_min = min_range;
3742     polearm_range_max = max_range;
3743
3744     /* Prompt for a location */
3745     pline(where_to_hit);
3746     cc.x = u.ux;
3747     cc.y = u.uy;
3748     if (!find_poleable_mon(&cc, min_range, max_range) && hitm
3749         && !DEADMONSTER(hitm) && cansee(hitm->mx, hitm->my)
3750         && distu(hitm->mx, hitm->my) <= max_range
3751         && distu(hitm->mx, hitm->my) >= min_range) {
3752         cc.x = hitm->mx;
3753         cc.y = hitm->my;
3754     }
3755     getpos_sethilite(display_polearm_positions);
3756 /*JP
3757     if (getpos(&cc, TRUE, "the spot to hit") < 0)
3758 */
3759     if (getpos(&cc, TRUE, "\91_\82¤\8fê\8f\8a") < 0)
3760         return res; /* ESC; uses turn iff polearm became wielded */
3761
3762     glyph = glyph_at(cc.x, cc.y);
3763     if (distu(cc.x, cc.y) > max_range) {
3764 /*JP
3765         pline("Too far!");
3766 */
3767         pline("\89\93\82·\82¬\82é\81I");
3768         return res;
3769     } else if (distu(cc.x, cc.y) < min_range) {
3770 /*JP
3771         pline("Too close!");
3772 */
3773         pline("\8bß\82·\82¬\82é\81I");
3774         return res;
3775     } else if (!cansee(cc.x, cc.y) && !glyph_is_monster(glyph)
3776                && !glyph_is_invisible(glyph) && !glyph_is_statue(glyph)) {
3777         You(cant_see_spot);
3778         return res;
3779     } else if (!couldsee(cc.x, cc.y)) { /* Eyes of the Overworld */
3780         You(cant_reach);
3781         return res;
3782     }
3783
3784     context.polearm.hitmon = NULL;
3785     /* Attack the monster there */
3786     bhitpos = cc;
3787     if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != (struct monst *) 0) {
3788         if (attack_checks(mtmp, uwep))
3789             return res;
3790         if (overexertion())
3791             return 1; /* burn nutrition; maybe pass out */
3792         context.polearm.hitmon = mtmp;
3793         check_caitiff(mtmp);
3794         notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
3795         (void) thitmonst(mtmp, uwep);
3796     } else if (glyph_is_statue(glyph) /* might be hallucinatory */
3797                && sobj_at(STATUE, bhitpos.x, bhitpos.y)) {
3798         struct trap *t = t_at(bhitpos.x, bhitpos.y);
3799
3800         if (t && t->ttyp == STATUE_TRAP
3801             && activate_statue_trap(t, t->tx, t->ty, FALSE)) {
3802             ; /* feedback has been give by animate_statue() */
3803         } else {
3804             /* Since statues look like monsters now, we say something
3805                different from "you miss" or "there's nobody there".
3806                Note:  we only do this when a statue is displayed here,
3807                because the player is probably attempting to attack it;
3808                other statues obscured by anything are just ignored. */
3809 /*JP
3810             pline("Thump!  Your blow bounces harmlessly off the statue.");
3811 */
3812             pline("\83S\83c\83\93\81I\92¤\91\9c\82Í\8f\9d\82Â\82©\82È\82©\82Á\82½\81D");
3813             wake_nearto(bhitpos.x, bhitpos.y, 25);
3814         }
3815     } else {
3816         /* no monster here and no statue seen or remembered here */
3817         if (glyph_is_invisible(glyph)) {
3818             /* now you know that nothing is there... */
3819             unmap_object(bhitpos.x, bhitpos.y);
3820             newsym(bhitpos.x, bhitpos.y);
3821         }
3822 /*JP
3823         You("miss; there is no one there to hit.");
3824 */
3825         You("\8aO\82ê\82½\81D\82»\82±\82É\82Í\89½\82à\82È\82¢\81D");
3826     }
3827     u_wipe_engr(2); /* same as for melee or throwing */
3828     return 1;
3829 }
3830
3831 STATIC_OVL int
3832 use_cream_pie(obj)
3833 struct obj *obj;
3834 {
3835     boolean wasblind = Blind;
3836     boolean wascreamed = u.ucreamed;
3837     boolean several = FALSE;
3838
3839     if (obj->quan > 1L) {
3840         several = TRUE;
3841         obj = splitobj(obj, 1L);
3842     }
3843     if (Hallucination)
3844 /*JP
3845         You("give yourself a facial.");
3846 */
3847         You("\83N\83\8a\81[\83\80\83p\83b\83N\82ð\82µ\82½\81D");
3848     else
3849 #if 0 /*JP*/
3850         pline("You immerse your %s in %s%s.", body_part(FACE),
3851               several ? "one of " : "",
3852               several ? makeplural(the(xname(obj))) : the(xname(obj)));
3853 #else
3854         pline("%s%s\82É%s\82ð\92¾\82ß\82½\81D",
3855               xname(obj),
3856               several ? "\82Ì\82Ð\82Æ\82Â" : "", body_part(FACE));
3857 #endif
3858     if (can_blnd((struct monst *) 0, &youmonst, AT_WEAP, obj)) {
3859         int blindinc = rnd(25);
3860         u.ucreamed += blindinc;
3861         make_blinded(Blinded + (long) blindinc, FALSE);
3862         if (!Blind || (Blind && wasblind))
3863 #if 0 /*JP*/
3864             pline("There's %ssticky goop all over your %s.",
3865                   wascreamed ? "more " : "", body_part(FACE));
3866 #else
3867             pline("\82â\82Á\82©\82¢\82È\82Ë\82Î\82Ë\82Î\82ª%s\91S\91Ì\82É%s\82Â\82¢\82½\81D",
3868                   body_part(FACE), wascreamed ? "\82³\82ç\82É" : "");
3869 #endif
3870         else /* Blind  && !wasblind */
3871 /*JP
3872             You_cant("see through all the sticky goop on your %s.",
3873 */
3874             pline("\82â\82Á\82©\82¢\82È\82Ë\82Î\82Ë\82Î\82ª%s\91S\91Ì\82É\82Â\82¢\82Ä\89½\82à\8c©\82¦\82È\82­\82È\82Á\82½\81D",
3875                      body_part(FACE));
3876     }
3877
3878     setnotworn(obj);
3879     /* useup() is appropriate, but we want costly_alteration()'s message */
3880     costly_alteration(obj, COST_SPLAT);
3881     obj_extract_self(obj);
3882     delobj(obj);
3883     return 0;
3884 }
3885
3886 STATIC_OVL int
3887 use_grapple(obj)
3888 struct obj *obj;
3889 {
3890     int res = 0, typ, max_range = 4, tohit;
3891     boolean save_confirm;
3892     coord cc;
3893     struct monst *mtmp;
3894     struct obj *otmp;
3895
3896     /* Are you allowed to use the hook? */
3897     if (u.uswallow) {
3898         pline(not_enough_room);
3899         return 0;
3900     }
3901     if (obj != uwep) {
3902         if (!wield_tool(obj, "cast"))
3903             return 0;
3904         else
3905             res = 1;
3906     }
3907     /* assert(obj == uwep); */
3908
3909     /* Prompt for a location */
3910     pline(where_to_hit);
3911     cc.x = u.ux;
3912     cc.y = u.uy;
3913 /*JP
3914     if (getpos(&cc, TRUE, "the spot to hit") < 0)
3915 */
3916     if (getpos(&cc, TRUE, "\91_\82¤\8fê\8f\8a") < 0)
3917         return res; /* ESC; uses turn iff grapnel became wielded */
3918
3919     /* Calculate range; unlike use_pole(), there's no minimum for range */
3920     typ = uwep_skill_type();
3921     if (typ == P_NONE || P_SKILL(typ) <= P_BASIC)
3922         max_range = 4;
3923     else if (P_SKILL(typ) == P_SKILLED)
3924         max_range = 5;
3925     else
3926         max_range = 8;
3927     if (distu(cc.x, cc.y) > max_range) {
3928 /*JP
3929         pline("Too far!");
3930 */
3931         pline("\89\93\82·\82¬\82é\81I");
3932         return res;
3933     } else if (!cansee(cc.x, cc.y)) {
3934         You(cant_see_spot);
3935         return res;
3936     } else if (!couldsee(cc.x, cc.y)) { /* Eyes of the Overworld */
3937         You(cant_reach);
3938         return res;
3939     }
3940
3941     /* What do you want to hit? */
3942     tohit = rn2(5);
3943     if (typ != P_NONE && P_SKILL(typ) >= P_SKILLED) {
3944         winid tmpwin = create_nhwindow(NHW_MENU);
3945         anything any;
3946         char buf[BUFSZ];
3947         menu_item *selected;
3948
3949         any = zeroany; /* set all bits to zero */
3950         any.a_int = 1; /* use index+1 (cant use 0) as identifier */
3951         start_menu(tmpwin);
3952         any.a_int++;
3953 /*JP
3954         Sprintf(buf, "an object on the %s", surface(cc.x, cc.y));
3955 */
3956         Sprintf(buf, "%s\82É\82 \82é\95¨\91Ì", surface(cc.x, cc.y));
3957         add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
3958                  MENU_UNSELECTED);
3959         any.a_int++;
3960 #if 0 /*JP*/
3961         add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "a monster",
3962                  MENU_UNSELECTED);
3963 #else
3964         add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "\89ö\95¨",
3965                  MENU_UNSELECTED);
3966 #endif
3967         any.a_int++;
3968 /*JP
3969         Sprintf(buf, "the %s", surface(cc.x, cc.y));
3970 */
3971         Sprintf(buf, "%s", surface(cc.x, cc.y));
3972         add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf,
3973                  MENU_UNSELECTED);
3974 /*JP
3975         end_menu(tmpwin, "Aim for what?");
3976 */
3977         end_menu(tmpwin, "\89½\82ð\91_\82¤\81H");
3978         tohit = rn2(4);
3979         if (select_menu(tmpwin, PICK_ONE, &selected) > 0
3980             && rn2(P_SKILL(typ) > P_SKILLED ? 20 : 2))
3981             tohit = selected[0].item.a_int - 1;
3982         free((genericptr_t) selected);
3983         destroy_nhwindow(tmpwin);
3984     }
3985
3986     /* possibly scuff engraving at your feet;
3987        any engraving at the target location is unaffected */
3988     if (tohit == 2 || !rn2(2))
3989         u_wipe_engr(rnd(2));
3990
3991     /* What did you hit? */
3992     switch (tohit) {
3993     case 0: /* Trap */
3994         /* FIXME -- untrap needs to deal with non-adjacent traps */
3995         break;
3996     case 1: /* Object */
3997         if ((otmp = level.objects[cc.x][cc.y]) != 0) {
3998 /*JP
3999             You("snag an object from the %s!", surface(cc.x, cc.y));
4000 */
4001             You("%s\82Ì\82à\82Ì\82ð\88ø\82Á\8a|\82¯\82½\81I", surface(cc.x, cc.y));
4002             (void) pickup_object(otmp, 1L, FALSE);
4003             /* If pickup fails, leave it alone */
4004             newsym(cc.x, cc.y);
4005             return 1;
4006         }
4007         break;
4008     case 2: /* Monster */
4009         bhitpos = cc;
4010         if ((mtmp = m_at(cc.x, cc.y)) == (struct monst *) 0)
4011             break;
4012         notonhead = (bhitpos.x != mtmp->mx || bhitpos.y != mtmp->my);
4013         save_confirm = flags.confirm;
4014         if (verysmall(mtmp->data) && !rn2(4)
4015             && enexto(&cc, u.ux, u.uy, (struct permonst *) 0)) {
4016             flags.confirm = FALSE;
4017             (void) attack_checks(mtmp, uwep);
4018             flags.confirm = save_confirm;
4019             check_caitiff(mtmp); /* despite fact there's no damage */
4020 /*JP
4021             You("pull in %s!", mon_nam(mtmp));
4022 */
4023             You("%s\82ð\88ø\82Á\92£\82Á\82½\81I", mon_nam(mtmp));
4024             mtmp->mundetected = 0;
4025             rloc_to(mtmp, cc.x, cc.y);
4026             return 1;
4027         } else if ((!bigmonst(mtmp->data) && !strongmonst(mtmp->data))
4028                    || rn2(4)) {
4029             flags.confirm = FALSE;
4030             (void) attack_checks(mtmp, uwep);
4031             flags.confirm = save_confirm;
4032             check_caitiff(mtmp);
4033             (void) thitmonst(mtmp, uwep);
4034             return 1;
4035         }
4036     /* FALL THROUGH */
4037     case 3: /* Surface */
4038         if (IS_AIR(levl[cc.x][cc.y].typ) || is_pool(cc.x, cc.y))
4039 /*JP
4040             pline_The("hook slices through the %s.", surface(cc.x, cc.y));
4041 */
4042             pline("\83t\83b\83N\82Í%s\82ð\82³\82Á\82Æ\90Ø\82Á\82½\81D", surface(cc.x, cc.y));
4043         else {
4044 /*JP
4045             You("are yanked toward the %s!", surface(cc.x, cc.y));
4046 */
4047             You("%s\82Ö\88ø\82Á\82Ï\82ç\82ê\82½\81I", surface(cc.x, cc.y));
4048             hurtle(sgn(cc.x - u.ux), sgn(cc.y - u.uy), 1, FALSE);
4049             spoteffects(TRUE);
4050         }
4051         return 1;
4052     default: /* Yourself (oops!) */
4053         if (P_SKILL(typ) <= P_BASIC) {
4054 /*JP
4055             You("hook yourself!");
4056 */
4057             You("\8e©\95ª\8e©\90g\82ð\88ø\82Á\8a|\82¯\82½\81I");
4058 /*JP
4059             losehp(Maybe_Half_Phys(rn1(10, 10)), "a grappling hook",
4060 */
4061             losehp(Maybe_Half_Phys(rn1(10, 10)), "\8e©\95ª\8e©\90g\82ð\88ø\82Á\8a|\82¯\82Ä",
4062                    KILLED_BY);
4063             return 1;
4064         }
4065         break;
4066     }
4067     pline1(nothing_happens);
4068     return 1;
4069 }
4070
4071 #define BY_OBJECT ((struct monst *) 0)
4072
4073 /* return 1 if the wand is broken, hence some time elapsed */
4074 STATIC_OVL int
4075 do_break_wand(obj)
4076 struct obj *obj;
4077 {
4078 /*JP
4079     static const char nothing_else_happens[] = "But nothing else happens...";
4080 */
4081     static const char nothing_else_happens[] = "\82µ\82©\82µ\81C\89½\82à\8bN\82«\82È\82©\82Á\82½\81D\81D\81D";
4082     register int i, x, y;
4083     register struct monst *mon;
4084     int dmg, damage;
4085     boolean affects_objects;
4086     boolean shop_damage = FALSE;
4087     boolean fillmsg = FALSE;
4088     int expltype = EXPL_MAGICAL;
4089     char confirm[QBUFSZ], buf[BUFSZ];
4090 /*JP
4091     boolean is_fragile = (!strcmp(OBJ_DESCR(objects[obj->otyp]), "balsa"));
4092 */
4093     boolean is_fragile = (!strcmp(OBJ_DESCR(objects[obj->otyp]), "\83o\83\8b\83T"));
4094
4095 #if 0 /*JP*/
4096     if (!paranoid_query(ParanoidBreakwand,
4097                        safe_qbuf(confirm,
4098                                  "Are you really sure you want to break ",
4099                                  "?", obj, yname, ysimple_name, "the wand")))
4100 #else
4101     if (!paranoid_query(ParanoidBreakwand,
4102                        safe_qbuf(confirm,
4103                                  "\96{\93\96\82É", "\82ð\89ó\82·\82Ì\81H",
4104                                  obj, yname, ysimple_name, "\8fñ")))
4105 #endif
4106         return 0;
4107
4108     if (nohands(youmonst.data)) {
4109 /*JP
4110         You_cant("break %s without hands!", yname(obj));
4111 */
4112         You("\8eè\82ª\96³\82¢\82Ì\82Å%s\82ð\89ó\82¹\82È\82¢\81I", yname(obj));
4113         return 0;
4114     } else if (ACURR(A_STR) < (is_fragile ? 5 : 10)) {
4115 /*JP
4116         You("don't have the strength to break %s!", yname(obj));
4117 */
4118         You("%s\82ð\89ó\82·\82¾\82¯\82Ì\97Í\82ª\82È\82¢\81I", yname(obj));
4119         return 0;
4120     }
4121 /*JP
4122     pline("Raising %s high above your %s, you break it in two!", yname(obj),
4123 */
4124     pline("%s\82ð%s\82Ì\8fã\82É\8d\82\82­\8cf\82°\81C\93ñ\82Â\82É\82Ö\82µ\90Ü\82Á\82½\81I", yname(obj),
4125           body_part(HEAD));
4126
4127     /* [ALI] Do this first so that wand is removed from bill. Otherwise,
4128      * the freeinv() below also hides it from setpaid() which causes problems.
4129      */
4130     if (obj->unpaid) {
4131         check_unpaid(obj); /* Extra charge for use */
4132         costly_alteration(obj, COST_DSTROY);
4133     }
4134
4135     current_wand = obj; /* destroy_item might reset this */
4136     freeinv(obj);       /* hide it from destroy_item instead... */
4137     setnotworn(obj);    /* so we need to do this ourselves */
4138
4139     if (!zappable(obj)) {
4140         pline(nothing_else_happens);
4141         goto discard_broken_wand;
4142     }
4143     /* successful call to zappable() consumes a charge; put it back */
4144     obj->spe++;
4145     /* might have "wrested" a final charge, taking it from 0 to -1;
4146        if so, we just brought it back up to 0, which wouldn't do much
4147        below so give it 1..3 charges now, usually making it stronger
4148        than an ordinary last charge (the wand is already gone from
4149        inventory, so perm_invent can't accidentally reveal this) */
4150     if (!obj->spe)
4151         obj->spe = rnd(3);
4152
4153     obj->ox = u.ux;
4154     obj->oy = u.uy;
4155     dmg = obj->spe * 4;
4156     affects_objects = FALSE;
4157
4158     switch (obj->otyp) {
4159     case WAN_WISHING:
4160     case WAN_NOTHING:
4161     case WAN_LOCKING:
4162     case WAN_PROBING:
4163     case WAN_ENLIGHTENMENT:
4164     case WAN_OPENING:
4165     case WAN_SECRET_DOOR_DETECTION:
4166         pline(nothing_else_happens);
4167         goto discard_broken_wand;
4168     case WAN_DEATH:
4169     case WAN_LIGHTNING:
4170         dmg *= 4;
4171         goto wanexpl;
4172     case WAN_FIRE:
4173         expltype = EXPL_FIERY;
4174     case WAN_COLD:
4175         if (expltype == EXPL_MAGICAL)
4176             expltype = EXPL_FROSTY;
4177         dmg *= 2;
4178     case WAN_MAGIC_MISSILE:
4179     wanexpl:
4180         explode(u.ux, u.uy, -(obj->otyp), dmg, WAND_CLASS, expltype);
4181         makeknown(obj->otyp); /* explode describes the effect */
4182         goto discard_broken_wand;
4183     case WAN_STRIKING:
4184         /* we want this before the explosion instead of at the very end */
4185 /*JP
4186         pline("A wall of force smashes down around you!");
4187 */
4188         pline("\82 \82È\82½\82Í\96\82\97Í\82Ì\95Ç\82É\82Â\82Â\82Ü\82ê\82½\81I");
4189         dmg = d(1 + obj->spe, 6); /* normally 2d12 */
4190         /*FALLTHRU*/
4191     case WAN_CANCELLATION:
4192     case WAN_POLYMORPH:
4193     case WAN_TELEPORTATION:
4194     case WAN_UNDEAD_TURNING:
4195         affects_objects = TRUE;
4196         break;
4197     default:
4198         break;
4199     }
4200
4201     /* magical explosion and its visual effect occur before specific effects
4202      */
4203     /* [TODO?  This really ought to prevent the explosion from being
4204        fatal so that we never leave a bones file where none of the
4205        surrounding targets (or underlying objects) got affected yet.] */
4206     explode(obj->ox, obj->oy, -(obj->otyp), rnd(dmg), WAND_CLASS,
4207             EXPL_MAGICAL);
4208
4209     /* prepare for potential feedback from polymorph... */
4210     zapsetup();
4211
4212     /* this makes it hit us last, so that we can see the action first */
4213     for (i = 0; i <= 8; i++) {
4214         bhitpos.x = x = obj->ox + xdir[i];
4215         bhitpos.y = y = obj->oy + ydir[i];
4216         if (!isok(x, y))
4217             continue;
4218
4219         if (obj->otyp == WAN_DIGGING) {
4220             schar typ;
4221
4222             if (dig_check(BY_OBJECT, FALSE, x, y)) {
4223                 if (IS_WALL(levl[x][y].typ) || IS_DOOR(levl[x][y].typ)) {
4224                     /* normally, pits and holes don't anger guards, but they
4225                      * do if it's a wall or door that's being dug */
4226                     watch_dig((struct monst *) 0, x, y, TRUE);
4227                     if (*in_rooms(x, y, SHOPBASE))
4228                         shop_damage = TRUE;
4229                 }
4230                 /*
4231                  * Let liquid flow into the newly created pits.
4232                  * Adjust corresponding code in music.c for
4233                  * drum of earthquake if you alter this sequence.
4234                  */
4235                 typ = fillholetyp(x, y, FALSE);
4236                 if (typ != ROOM) {
4237                     levl[x][y].typ = typ;
4238                     liquid_flow(x, y, typ, t_at(x, y),
4239                                 fillmsg
4240                                   ? (char *) 0
4241 /*JP
4242                                   : "Some holes are quickly filled with %s!");
4243 */
4244                                   : "\8c\8a\82Í\82·\82®\82É%s\82Å\96\84\82Ü\82Á\82½\81I");
4245                     fillmsg = TRUE;
4246                 } else
4247                     digactualhole(x, y, BY_OBJECT, (rn2(obj->spe) < 3
4248                                                     || (!Can_dig_down(&u.uz)
4249                                                         && !levl[x][y].candig))
4250                                                       ? PIT
4251                                                       : HOLE);
4252             }
4253             continue;
4254         } else if (obj->otyp == WAN_CREATE_MONSTER) {
4255             /* u.ux,u.uy creates it near you--x,y might create it in rock */
4256             (void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS);
4257             continue;
4258         } else if (x != u.ux || y != u.uy) {
4259             /*
4260              * Wand breakage is targetting a square adjacent to the hero,
4261              * which might contain a monster or a pile of objects or both.
4262              * Handle objects last; avoids having undead turning raise an
4263              * undead's corpse and then attack resulting undead monster.
4264              * obj->bypass in bhitm() prevents the polymorphing of items
4265              * dropped due to monster's polymorph and prevents undead
4266              * turning that kills an undead from raising resulting corpse.
4267              */
4268             if ((mon = m_at(x, y)) != 0) {
4269                 (void) bhitm(mon, obj);
4270                 /* if (context.botl) bot(); */
4271             }
4272             if (affects_objects && level.objects[x][y]) {
4273                 (void) bhitpile(obj, bhito, x, y, 0);
4274                 if (context.botl)
4275                     bot(); /* potion effects */
4276             }
4277         } else {
4278             /*
4279              * Wand breakage is targetting the hero.  Using xdir[]+ydir[]
4280              * deltas for location selection causes this case to happen
4281              * after all the surrounding squares have been handled.
4282              * Process objects first, in case damage is fatal and leaves
4283              * bones, or teleportation sends one or more of the objects to
4284              * same destination as hero (lookhere/autopickup); also avoids
4285              * the polymorphing of gear dropped due to hero's transformation.
4286              * (Unlike with monsters being hit by zaps, we can't rely on use
4287              * of obj->bypass in the zap code to accomplish that last case
4288              * since it's also used by retouch_equipment() for polyself.)
4289              */
4290             if (affects_objects && level.objects[x][y]) {
4291                 (void) bhitpile(obj, bhito, x, y, 0);
4292                 if (context.botl)
4293                     bot(); /* potion effects */
4294             }
4295             damage = zapyourself(obj, FALSE);
4296             if (damage) {
4297 #if 0 /*JP:T*/
4298                 Sprintf(buf, "killed %sself by breaking a wand", uhim());
4299                 losehp(Maybe_Half_Phys(damage), buf, NO_KILLER_PREFIX);
4300 #else
4301                 Strcpy(buf, "\8e©\95ª\8e©\90g\82Å\8fñ\82ð\89ó\82µ\82Ä\83_\83\81\81[\83W\82ð\8eó\82¯");
4302                 losehp(Maybe_Half_Phys(damage), buf, KILLED_BY);
4303 #endif
4304             }
4305             if (context.botl)
4306                 bot(); /* blindness */
4307         }
4308     }
4309
4310     /* potentially give post zap/break feedback */
4311     zapwrapup();
4312
4313     /* Note: if player fell thru, this call is a no-op.
4314        Damage is handled in digactualhole in that case */
4315     if (shop_damage)
4316 /*JP
4317         pay_for_damage("dig into", FALSE);
4318 */
4319         pay_for_damage("\8c\8a\82ð\82 \82¯\82é", FALSE);
4320
4321     if (obj->otyp == WAN_LIGHT)
4322         litroom(TRUE, obj); /* only needs to be done once */
4323
4324 discard_broken_wand:
4325     obj = current_wand; /* [see dozap() and destroy_item()] */
4326     current_wand = 0;
4327     if (obj)
4328         delobj(obj);
4329     nomul(0);
4330     return 1;
4331 }
4332
4333 STATIC_OVL void
4334 add_class(cl, class)
4335 char *cl;
4336 char class;
4337 {
4338     char tmp[2];
4339
4340     tmp[0] = class;
4341     tmp[1] = '\0';
4342     Strcat(cl, tmp);
4343 }
4344
4345 static const char tools[] = { TOOL_CLASS, WEAPON_CLASS, WAND_CLASS, 0 };
4346
4347 /* augment tools[] if various items are carried */
4348 STATIC_OVL void
4349 setapplyclasses(class_list)
4350 char class_list[];
4351 {
4352     register struct obj *otmp;
4353     int otyp;
4354     boolean knowoil, knowtouchstone, addpotions, addstones, addfood;
4355
4356     knowoil = objects[POT_OIL].oc_name_known;
4357     knowtouchstone = objects[TOUCHSTONE].oc_name_known;
4358     addpotions = addstones = addfood = FALSE;
4359     for (otmp = invent; otmp; otmp = otmp->nobj) {
4360         otyp = otmp->otyp;
4361         if (otyp == POT_OIL
4362             || (otmp->oclass == POTION_CLASS
4363                 && (!otmp->dknown
4364                     || (!knowoil && !objects[otyp].oc_name_known))))
4365             addpotions = TRUE;
4366         if (otyp == TOUCHSTONE
4367             || (is_graystone(otmp)
4368                 && (!otmp->dknown
4369                     || (!knowtouchstone && !objects[otyp].oc_name_known))))
4370             addstones = TRUE;
4371         if (otyp == CREAM_PIE || otyp == EUCALYPTUS_LEAF)
4372             addfood = TRUE;
4373     }
4374
4375     class_list[0] = '\0';
4376     if (addpotions || addstones)
4377         add_class(class_list, ALL_CLASSES);
4378     Strcat(class_list, tools);
4379     if (addpotions)
4380         add_class(class_list, POTION_CLASS);
4381     if (addstones)
4382         add_class(class_list, GEM_CLASS);
4383     if (addfood)
4384         add_class(class_list, FOOD_CLASS);
4385 }
4386
4387 /* the 'a' command */
4388 int
4389 doapply()
4390 {
4391     struct obj *obj;
4392     register int res = 1;
4393     char class_list[MAXOCLASSES + 2];
4394
4395     if (check_capacity((char *) 0))
4396         return 0;
4397
4398     setapplyclasses(class_list); /* tools[] */
4399     obj = getobj(class_list, "use or apply");
4400     if (!obj)
4401         return 0;
4402
4403     if (!retouch_object(&obj, FALSE))
4404         return 1; /* evading your grasp costs a turn; just be
4405                      grateful that you don't drop it as well */
4406
4407     if (obj->oclass == WAND_CLASS)
4408         return do_break_wand(obj);
4409
4410     switch (obj->otyp) {
4411     case BLINDFOLD:
4412     case LENSES:
4413         if (obj == ublindf) {
4414             if (!cursed(obj))
4415                 Blindf_off(obj);
4416         } else if (!ublindf) {
4417             Blindf_on(obj);
4418         } else {
4419 #if 0 /*JP*/
4420             You("are already %s.", ublindf->otyp == TOWEL
4421                                        ? "covered by a towel"
4422                                        : ublindf->otyp == BLINDFOLD
4423                                              ? "wearing a blindfold"
4424                                              : "wearing lenses");
4425 #else
4426             You("\82à\82¤%s\82Ä\82¢\82é\81D", ublindf->otyp == TOWEL
4427                                       ? "\83^\83I\83\8b\82ð\8aª\82¢"
4428                                       : ublindf->otyp == BLINDFOLD
4429                                             ? "\96Ú\89B\82µ\82ð\82Â\82¯"
4430                                             : "\83\8c\83\93\83Y\82ð\82Â\82¯");
4431 #endif
4432         }
4433         break;
4434     case CREAM_PIE:
4435         res = use_cream_pie(obj);
4436         break;
4437     case BULLWHIP:
4438         res = use_whip(obj);
4439         break;
4440     case GRAPPLING_HOOK:
4441         res = use_grapple(obj);
4442         break;
4443     case LARGE_BOX:
4444     case CHEST:
4445     case ICE_BOX:
4446     case SACK:
4447     case BAG_OF_HOLDING:
4448     case OILSKIN_SACK:
4449         res = use_container(&obj, 1);
4450         break;
4451     case BAG_OF_TRICKS:
4452         (void) bagotricks(obj, FALSE, (int *) 0);
4453         break;
4454     case CAN_OF_GREASE:
4455         use_grease(obj);
4456         break;
4457     case LOCK_PICK:
4458     case CREDIT_CARD:
4459     case SKELETON_KEY:
4460         res = (pick_lock(obj) != 0);
4461         break;
4462     case PICK_AXE:
4463     case DWARVISH_MATTOCK:
4464         res = use_pick_axe(obj);
4465         break;
4466     case TINNING_KIT:
4467         use_tinning_kit(obj);
4468         break;
4469     case LEASH:
4470         use_leash(obj);
4471         break;
4472     case SADDLE:
4473         res = use_saddle(obj);
4474         break;
4475     case MAGIC_WHISTLE:
4476         use_magic_whistle(obj);
4477         break;
4478     case TIN_WHISTLE:
4479         use_whistle(obj);
4480         break;
4481     case EUCALYPTUS_LEAF:
4482         /* MRKR: Every Australian knows that a gum leaf makes an excellent
4483          * whistle, especially if your pet is a tame kangaroo named Skippy.
4484          */
4485         if (obj->blessed) {
4486             use_magic_whistle(obj);
4487             /* sometimes the blessing will be worn off */
4488             if (!rn2(49)) {
4489                 if (!Blind) {
4490 /*JP
4491                     pline("%s %s.", Yobjnam2(obj, "glow"), hcolor("brown"));
4492 */
4493                     pline("%s\82Í%s\8bP\82¢\82½\81D", xname(obj), jconj_adj(hcolor("\92\83\90F\82Ì")));
4494                     obj->bknown = 1;
4495                 }
4496                 unbless(obj);
4497             }
4498         } else {
4499             use_whistle(obj);
4500         }
4501         break;
4502     case STETHOSCOPE:
4503         res = use_stethoscope(obj);
4504         break;
4505     case MIRROR:
4506         res = use_mirror(obj);
4507         break;
4508     case BELL:
4509     case BELL_OF_OPENING:
4510         use_bell(&obj);
4511         break;
4512     case CANDELABRUM_OF_INVOCATION:
4513         use_candelabrum(obj);
4514         break;
4515     case WAX_CANDLE:
4516     case TALLOW_CANDLE:
4517         use_candle(&obj);
4518         break;
4519     case OIL_LAMP:
4520     case MAGIC_LAMP:
4521     case BRASS_LANTERN:
4522         use_lamp(obj);
4523         break;
4524     case POT_OIL:
4525         light_cocktail(obj);
4526         break;
4527     case EXPENSIVE_CAMERA:
4528         res = use_camera(obj);
4529         break;
4530     case TOWEL:
4531         res = use_towel(obj);
4532         break;
4533     case CRYSTAL_BALL:
4534         use_crystal_ball(&obj);
4535         break;
4536     case MAGIC_MARKER:
4537         res = dowrite(obj);
4538         break;
4539     case TIN_OPENER:
4540         if (!carrying(TIN)) {
4541 /*JP
4542             You("have no tin to open.");
4543 */
4544             You("\8aÊ\82ð\8e\9d\82Á\82Ä\82¢\82È\82¢\81D");
4545             goto xit;
4546         }
4547 /*JP
4548         You("cannot open a tin without eating or discarding its contents.");
4549 */
4550         pline("\92\86\90g\82ð\90H\82×\82é\82©\81C\8eÌ\82Ä\82é\82©\82µ\82È\82¢\82Æ\8aÊ\82ð\8aJ\82¯\82ç\82ê\82È\82¢\81D");
4551         if (flags.verbose)
4552 /*JP
4553             pline("In order to eat, use the 'e' command.");
4554 */
4555             pline("\90H\82×\82é\82É\82Í\81C'e'\83R\83}\83\93\83h\82ð\8eg\82¦\82Î\82æ\82¢\81D");
4556         if (obj != uwep)
4557             pline(
4558 /*JP
4559           "Opening the tin will be much easier if you wield the tin opener.");
4560 */
4561           "\8aÊ\90Ø\82è\82ð\91\95\94õ\82µ\82Ä\82¢\82ê\82Î\81C\82¸\82Á\82Æ\8aÈ\92P\82É\8aJ\82¯\82é\82±\82Æ\82ª\82Å\82«\82é\81D");
4562         goto xit;
4563
4564     case FIGURINE:
4565         use_figurine(&obj);
4566         break;
4567     case UNICORN_HORN:
4568         use_unicorn_horn(obj);
4569         break;
4570     case WOODEN_FLUTE:
4571     case MAGIC_FLUTE:
4572     case TOOLED_HORN:
4573     case FROST_HORN:
4574     case FIRE_HORN:
4575     case WOODEN_HARP:
4576     case MAGIC_HARP:
4577     case BUGLE:
4578     case LEATHER_DRUM:
4579     case DRUM_OF_EARTHQUAKE:
4580         res = do_play_instrument(obj);
4581         break;
4582     case HORN_OF_PLENTY: /* not a musical instrument */
4583         (void) hornoplenty(obj, FALSE);
4584         break;
4585     case LAND_MINE:
4586     case BEARTRAP:
4587         use_trap(obj);
4588         break;
4589     case FLINT:
4590     case LUCKSTONE:
4591     case LOADSTONE:
4592     case TOUCHSTONE:
4593         use_stone(obj);
4594         break;
4595     default:
4596         /* Pole-weapons can strike at a distance */
4597         if (is_pole(obj)) {
4598             res = use_pole(obj);
4599             break;
4600         } else if (is_pick(obj) || is_axe(obj)) {
4601             res = use_pick_axe(obj);
4602             break;
4603         }
4604 /*JP
4605         pline("Sorry, I don't know how to use that.");
4606 */
4607         pline("\82»\82ê\82ð\82Ç\82¤\82â\82Á\82Ä\8eg\82¤\82ñ\82¾\82¢\81H");
4608     xit:
4609         nomul(0);
4610         return 0;
4611     }
4612     if (res && obj && obj->oartifact)
4613         arti_speak(obj);
4614     nomul(0);
4615     return res;
4616 }
4617
4618 /* Keep track of unfixable troubles for purposes of messages saying you feel
4619  * great.
4620  */
4621 int
4622 unfixable_trouble_count(is_horn)
4623 boolean is_horn;
4624 {
4625     int unfixable_trbl = 0;
4626
4627     if (Stoned)
4628         unfixable_trbl++;
4629     if (Strangled)
4630         unfixable_trbl++;
4631     if (Wounded_legs && !u.usteed)
4632         unfixable_trbl++;
4633     if (Slimed)
4634         unfixable_trbl++;
4635     /* lycanthropy is undesirable, but it doesn't actually make you feel bad */
4636
4637     if (!is_horn || (Confusion & ~TIMEOUT))
4638         unfixable_trbl++;
4639     if (!is_horn || (Sick & ~TIMEOUT))
4640         unfixable_trbl++;
4641     if (!is_horn || (HHallucination & ~TIMEOUT))
4642         unfixable_trbl++;
4643     if (!is_horn || (Vomiting & ~TIMEOUT))
4644         unfixable_trbl++;
4645     if (!is_horn || (HStun & ~TIMEOUT))
4646         unfixable_trbl++;
4647     if (!is_horn || (HDeaf & ~TIMEOUT))
4648         unfixable_trbl++;
4649
4650     return unfixable_trbl;
4651 }
4652
4653 /*apply.c*/