OSDN Git Service

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