OSDN Git Service

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