OSDN Git Service

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