OSDN Git Service

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