OSDN Git Service

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