OSDN Git Service

add translation
[jnethack/source.git] / src / trap.c
1 /* NetHack 3.6  trap.c  $NHDT-Date: 1545259936 2018/12/19 22:52:16 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.313 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Robert Patrick Rankin, 2013. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
6 /* JNetHack Copyright */
7 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
8 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019            */
9 /* JNetHack may be freely redistributed.  See license for details. */
10
11 #include "hack.h"
12
13 extern const char *const destroy_strings[][3]; /* from zap.c */
14
15 STATIC_DCL boolean FDECL(keep_saddle_with_steedcorpse, (unsigned, struct obj *,
16                                                         struct obj *));
17 STATIC_DCL struct obj *FDECL(t_missile, (int, struct trap *));
18 STATIC_DCL char *FDECL(trapnote, (struct trap *, BOOLEAN_P));
19 STATIC_DCL int FDECL(steedintrap, (struct trap *, struct obj *));
20 STATIC_DCL void FDECL(launch_drop_spot, (struct obj *, XCHAR_P, XCHAR_P));
21 STATIC_DCL int FDECL(mkroll_launch, (struct trap *, XCHAR_P, XCHAR_P,
22                                      SHORT_P, long));
23 STATIC_DCL boolean FDECL(isclearpath, (coord *, int, SCHAR_P, SCHAR_P));
24 STATIC_DCL void FDECL(dofiretrap, (struct obj *));
25 STATIC_DCL void NDECL(domagictrap);
26 STATIC_DCL boolean FDECL(emergency_disrobe, (boolean *));
27 STATIC_DCL int FDECL(untrap_prob, (struct trap *));
28 STATIC_DCL void FDECL(move_into_trap, (struct trap *));
29 STATIC_DCL int FDECL(try_disarm, (struct trap *, BOOLEAN_P));
30 STATIC_DCL void FDECL(reward_untrap, (struct trap *, struct monst *));
31 STATIC_DCL int FDECL(disarm_holdingtrap, (struct trap *));
32 STATIC_DCL int FDECL(disarm_landmine, (struct trap *));
33 STATIC_DCL int FDECL(disarm_squeaky_board, (struct trap *));
34 STATIC_DCL int FDECL(disarm_shooting_trap, (struct trap *, int));
35 STATIC_DCL void FDECL(clear_conjoined_pits, (struct trap *));
36 STATIC_DCL boolean FDECL(adj_nonconjoined_pit, (struct trap *));
37 STATIC_DCL int FDECL(try_lift, (struct monst *, struct trap *, int,
38                                 BOOLEAN_P));
39 STATIC_DCL int FDECL(help_monster_out, (struct monst *, struct trap *));
40 #if 0
41 STATIC_DCL void FDECL(join_adjacent_pits, (struct trap *));
42 #endif
43 STATIC_DCL boolean FDECL(thitm, (int, struct monst *, struct obj *, int,
44                                  BOOLEAN_P));
45 STATIC_DCL void NDECL(maybe_finish_sokoban);
46
47 /* mintrap() should take a flags argument, but for time being we use this */
48 STATIC_VAR int force_mintrap = 0;
49
50 #if 0 /*JP*/
51 STATIC_VAR const char *const a_your[2] = { "a", "your" };
52 STATIC_VAR const char *const A_Your[2] = { "A", "Your" };
53 STATIC_VAR const char tower_of_flame[] = "tower of flame";
54 STATIC_VAR const char *const A_gush_of_water_hits = "A gush of water hits";
55 #endif
56 #if 0 /*JP*/
57 STATIC_VAR const char *const blindgas[6] = { "humid",   "odorless",
58                                              "pungent", "chilling",
59                                              "acrid",   "biting" };
60 #else
61 STATIC_VAR const char * const blindgas[6] = {
62     "\82Þ\82µ\82Þ\82µ\82·\82é", "\96³\8fL\82Ì",
63     "\8eh\8c\83\8fL\82Ì\82·\82é", "\97â\82½\82¢",
64     "\83c\83\93\82Æ\82µ\82½\82É\82¨\82¢\82Ì", "\82Ð\82è\82Ð\82è\82·\82é"
65     };
66 #endif
67 #if 1 /*JP*/
68 const char *set_you[2] = { "", "\82 \82È\82½\82Ì\8ed\8a|\82¯\82½" };
69 STATIC_VAR const char *dig_you[2] = { "", "\82 \82È\82½\82ª\8c@\82Á\82½" };
70 STATIC_VAR const char *web_you[2] = { "", "\82 \82È\82½\82ª\92£\82Á\82½" };
71 #endif
72
73 /* called when you're hit by fire (dofiretrap,buzz,zapyourself,explode);
74    returns TRUE if hit on torso */
75 boolean
76 burnarmor(victim)
77 struct monst *victim;
78 {
79     struct obj *item;
80     char buf[BUFSZ];
81     int mat_idx, oldspe;
82     boolean hitting_u;
83
84     if (!victim)
85         return 0;
86     hitting_u = (victim == &youmonst);
87
88     /* burning damage may dry wet towel */
89     item = hitting_u ? carrying(TOWEL) : m_carrying(victim, TOWEL);
90     while (item) {
91         if (is_wet_towel(item)) {
92             oldspe = item->spe;
93             dry_a_towel(item, rn2(oldspe + 1), TRUE);
94             if (item->spe != oldspe)
95                 break; /* stop once one towel has been affected */
96         }
97         item = item->nobj;
98     }
99
100 #define burn_dmg(obj, descr) erode_obj(obj, descr, ERODE_BURN, EF_GREASE)
101     while (1) {
102         switch (rn2(5)) {
103         case 0:
104             item = hitting_u ? uarmh : which_armor(victim, W_ARMH);
105             if (item) {
106                 mat_idx = objects[item->otyp].oc_material;
107 #if 0 /*JP*/
108                 Sprintf(buf, "%s %s", materialnm[mat_idx],
109                         helm_simple_name(item));
110 #else
111                 Sprintf(buf, "%s\82Ì%s", materialnm[mat_idx],
112                         helm_simple_name(item));
113 #endif
114             }
115 /*JP
116             if (!burn_dmg(item, item ? buf : "helmet"))
117 */
118             if (!burn_dmg(item, item ? buf : "\8a\95"))
119                 continue;
120             break;
121         case 1:
122             item = hitting_u ? uarmc : which_armor(victim, W_ARMC);
123             if (item) {
124                 (void) burn_dmg(item, cloak_simple_name(item));
125                 return TRUE;
126             }
127             item = hitting_u ? uarm : which_armor(victim, W_ARM);
128             if (item) {
129                 (void) burn_dmg(item, xname(item));
130                 return TRUE;
131             }
132             item = hitting_u ? uarmu : which_armor(victim, W_ARMU);
133             if (item)
134 /*JP
135                 (void) burn_dmg(item, "shirt");
136 */
137                 (void) burn_dmg(item, "\83V\83\83\83c");
138             return TRUE;
139         case 2:
140             item = hitting_u ? uarms : which_armor(victim, W_ARMS);
141 /*JP
142             if (!burn_dmg(item, "wooden shield"))
143 */
144             if (!burn_dmg(item, "\96Ø\82Ì\8f\82"))
145                 continue;
146             break;
147         case 3:
148             item = hitting_u ? uarmg : which_armor(victim, W_ARMG);
149 /*JP
150             if (!burn_dmg(item, "gloves"))
151 */
152             if (!burn_dmg(item, "\8f¬\8eè"))
153                 continue;
154             break;
155         case 4:
156             item = hitting_u ? uarmf : which_armor(victim, W_ARMF);
157 /*JP
158             if (!burn_dmg(item, "boots"))
159 */
160             if (!burn_dmg(item, "\8cC"))
161                 continue;
162             break;
163         }
164         break; /* Out of while loop */
165     }
166 #undef burn_dmg
167
168     return FALSE;
169 }
170
171 /* Generic erode-item function.
172  * "ostr", if non-null, is an alternate string to print instead of the
173  *   object's name.
174  * "type" is an ERODE_* value for the erosion type
175  * "flags" is an or-ed list of EF_* flags
176  *
177  * Returns an erosion return value (ER_*)
178  */
179 int
180 erode_obj(otmp, ostr, type, ef_flags)
181 register struct obj *otmp;
182 const char *ostr;
183 int type;
184 int ef_flags;
185 {
186     static NEARDATA const char
187 /*JP
188         *const action[] = { "smoulder", "rust", "rot", "corrode" },
189 */
190         *const action[] = { "\82­\82·\82Ô\82Á\82½", "\8eK\82Ñ\82½", "\95\85\82Á\82½", "\95\85\90H\82µ\82½" },
191 /*JP
192         *const msg[] = { "burnt", "rusted", "rotten", "corroded" },
193 */
194         *const msg[] =  { "\8fÅ\82°\82½", "\8eK\82Ñ\82½", "\95\85\82Á\82½", "\95\85\90H\82µ\82½" },
195 /*JP
196         *const bythe[] = { "heat", "oxidation", "decay", "corrosion" };
197 */
198         *const bythe[] = { "\94M", "\8e_\89»", "\95\85\94s", "\95\85\90H" };
199     boolean vulnerable = FALSE, is_primary = TRUE,
200             check_grease = (ef_flags & EF_GREASE) ? TRUE : FALSE,
201             print = (ef_flags & EF_VERBOSE) ? TRUE : FALSE,
202             uvictim, vismon, visobj;
203     int erosion, cost_type;
204     struct monst *victim;
205
206     if (!otmp)
207         return ER_NOTHING;
208
209     victim = carried(otmp) ? &youmonst : mcarried(otmp) ? otmp->ocarry : NULL;
210     uvictim = (victim == &youmonst);
211     vismon = victim && (victim != &youmonst) && canseemon(victim);
212     /* Is bhitpos correct here? Ugh. */
213     visobj = !victim && cansee(bhitpos.x, bhitpos.y);
214
215     switch (type) {
216     case ERODE_BURN:
217         vulnerable = is_flammable(otmp);
218         check_grease = FALSE;
219         cost_type = COST_BURN;
220         break;
221     case ERODE_RUST:
222         vulnerable = is_rustprone(otmp);
223         cost_type = COST_RUST;
224         break;
225     case ERODE_ROT:
226         vulnerable = is_rottable(otmp);
227         check_grease = FALSE;
228         is_primary = FALSE;
229         cost_type = COST_ROT;
230         break;
231     case ERODE_CORRODE:
232         vulnerable = is_corrodeable(otmp);
233         is_primary = FALSE;
234         cost_type = COST_CORRODE;
235         break;
236     default:
237         impossible("Invalid erosion type in erode_obj");
238         return ER_NOTHING;
239     }
240     erosion = is_primary ? otmp->oeroded : otmp->oeroded2;
241
242     if (!ostr)
243         ostr = cxname(otmp);
244     /* 'visobj' messages insert "the"; probably ought to switch to the() */
245     if (visobj && !(uvictim || vismon) && !strncmpi(ostr, "the ", 4))
246         ostr += 4;
247
248     if (check_grease && otmp->greased) {
249         grease_protect(otmp, ostr, victim);
250         return ER_GREASED;
251     } else if (!erosion_matters(otmp)) {
252         return ER_NOTHING;
253     } else if (!vulnerable || (otmp->oerodeproof && otmp->rknown)) {
254         if (flags.verbose && print && (uvictim || vismon))
255 #if 0 /*JP*/
256             pline("%s %s %s not affected by %s.",
257                   uvictim ? "Your" : s_suffix(Monnam(victim)),
258                   ostr, vtense(ostr, "are"), bythe[type]);
259 #else
260             pline("%s%s\82Í%s\82Ì\89e\8b¿\82ð\8eó\82¯\82È\82©\82Á\82½\81D",
261                   uvictim ? "\82 \82È\82½\82Ì" : s_suffix(Monnam(victim)),
262                   ostr, bythe[type]);
263 #endif
264         return ER_NOTHING;
265     } else if (otmp->oerodeproof || (otmp->blessed && !rnl(4))) {
266         if (flags.verbose && (print || otmp->oerodeproof)
267             && (uvictim || vismon || visobj))
268 #if 0 /*JP*/
269             pline("Somehow, %s %s %s not affected by the %s.",
270                   uvictim ? "your"
271                           : !vismon ? "the" /* visobj */
272                                     : s_suffix(mon_nam(victim)),
273                   ostr, vtense(ostr, "are"), bythe[type]);
274 #else
275             pline("\82È\82º\82©\81C%s%s\82Í%s\82Ì\89e\8b¿\82ð\8eó\82¯\82È\82©\82Á\82½\81D",
276                   uvictim ? "\82 \82È\82½\82Ì"
277                           : !vismon ? "" /* visobj */
278                                     : s_suffix(mon_nam(victim)),
279                   ostr, bythe[type]);
280 #endif
281         /* We assume here that if the object is protected because it
282          * is blessed, it still shows some minor signs of wear, and
283          * the hero can distinguish this from an object that is
284          * actually proof against damage.
285          */
286         if (otmp->oerodeproof) {
287             otmp->rknown = TRUE;
288             if (victim == &youmonst)
289                 update_inventory();
290         }
291
292         return ER_NOTHING;
293     } else if (erosion < MAX_ERODE) {
294 #if 0 /*JP:T*/
295         const char *adverb = (erosion + 1 == MAX_ERODE)
296                                  ? " completely"
297                                  : erosion ? " further" : "";
298 #else
299         const char *adverb = (erosion + 1 == MAX_ERODE)
300                                  ? "\8a®\91S\82É"
301                                  : erosion ? "\82³\82ç\82É" : "";
302 #endif
303
304         if (uvictim || vismon || visobj)
305 #if 0 /*JP*/
306             pline("%s %s %s%s!",
307                   uvictim ? "Your"
308                           : !vismon ? "The" /* visobj */
309                                     : s_suffix(Monnam(victim)),
310                   ostr, vtense(ostr, action[type]), adverb);
311 #else
312             pline("%s%s\82Í%s%s!",
313                   uvictim ? "\82 \82È\82½\82Ì"
314                           : !vismon ? "" /* visobj */
315                                     : s_suffix(Monnam(victim)),
316                   ostr, adverb, action[type]);
317 #endif
318
319         if (ef_flags & EF_PAY)
320             costly_alteration(otmp, cost_type);
321
322         if (is_primary)
323             otmp->oeroded++;
324         else
325             otmp->oeroded2++;
326
327         if (victim == &youmonst)
328             update_inventory();
329
330         return ER_DAMAGED;
331     } else if (ef_flags & EF_DESTROY) {
332         if (uvictim || vismon || visobj)
333 #if 0 /*JP*/
334             pline("%s %s %s away!",
335                   uvictim ? "Your"
336                           : !vismon ? "The" /* visobj */
337                                     : s_suffix(Monnam(victim)),
338                   ostr, vtense(ostr, action[type]));
339 #else
340             pline("%s%s\82Í\8a®\91S\82É%s\81I",
341                   uvictim ? "\82 \82È\82½\82Ì"
342                           : !vismon ? "" /* visobj */
343                                     : s_suffix(Monnam(victim)),
344                   ostr, action[type]);
345 #endif
346
347         if (ef_flags & EF_PAY)
348             costly_alteration(otmp, cost_type);
349
350         setnotworn(otmp);
351         delobj(otmp);
352         return ER_DESTROYED;
353     } else {
354         if (flags.verbose && print) {
355             if (uvictim)
356 #if 0 /*JP*/
357                 Your("%s %s completely %s.",
358                      ostr, vtense(ostr, Blind ? "feel" : "look"), msg[type]);
359 #else
360                 Your("%s\82Í\8a®\91S\82É%s%s\81D",
361                      ostr, msg[type], Blind ? "\82æ\82¤\82¾" : "");
362 #endif
363             else if (vismon || visobj)
364 #if 0 /*JP*/
365                 pline("%s %s %s completely %s.",
366                       !vismon ? "The" : s_suffix(Monnam(victim)),
367                       ostr, vtense(ostr, "look"), msg[type]);
368 #else
369                 pline("%s%s\82Í\8a®\91S\82É%s\82æ\82¤\82¾\81D",
370                       !vismon ? "" : s_suffix(Monnam(victim)),
371                       ostr, msg[type]);
372 #endif
373         }
374         return ER_NOTHING;
375     }
376 }
377
378 /* Protect an item from erosion with grease. Returns TRUE if the grease
379  * wears off.
380  */
381 boolean
382 grease_protect(otmp, ostr, victim)
383 register struct obj *otmp;
384 const char *ostr;
385 struct monst *victim;
386 {
387 /*JP
388     static const char txt[] = "protected by the layer of grease!";
389 */
390     static const char txt[] = "\96û\82Ì\93h\82è\82±\82Ý\82É\82æ\82Á\82Ä\8eç\82ç\82ê\82Ä\82¢\82é\81I";
391     boolean vismon = victim && (victim != &youmonst) && canseemon(victim);
392
393     if (ostr) {
394         if (victim == &youmonst)
395 /*JP
396             Your("%s %s %s", ostr, vtense(ostr, "are"), txt);
397 */
398             Your("%s\82Í%s", ostr, txt);
399         else if (vismon)
400 #if 0 /*JP*/
401             pline("%s's %s %s %s", Monnam(victim),
402                   ostr, vtense(ostr, "are"), txt);
403 #else
404             pline("%s\82Ì%s\82Í%s", Monnam(victim), ostr, txt);
405 #endif
406     } else if (victim == &youmonst || vismon) {
407 /*JP
408         pline("%s %s", Yobjnam2(otmp, "are"), txt);
409 */
410         Your("%s\82Í%s",xname(otmp), txt);
411     }
412     if (!rn2(2)) {
413         otmp->greased = 0;
414         if (carried(otmp)) {
415 /*JP
416             pline_The("grease dissolves.");
417 */
418             pline("\96û\82Í\82Í\82°\82Ä\82µ\82Ü\82Á\82½\81D");
419             update_inventory();
420         }
421         return TRUE;
422     }
423     return FALSE;
424 }
425
426 struct trap *
427 maketrap(x, y, typ)
428 int x, y, typ;
429 {
430     static union vlaunchinfo zero_vl;
431     boolean oldplace;
432     struct trap *ttmp;
433     struct rm *lev = &levl[x][y];
434
435     if ((ttmp = t_at(x, y)) != 0) {
436         if (ttmp->ttyp == MAGIC_PORTAL || ttmp->ttyp == VIBRATING_SQUARE)
437             return (struct trap *) 0;
438         oldplace = TRUE;
439         if (u.utrap && x == u.ux && y == u.uy
440             && ((u.utraptype == TT_BEARTRAP && typ != BEAR_TRAP)
441                 || (u.utraptype == TT_WEB && typ != WEB)
442                 || (u.utraptype == TT_PIT && !is_pit(typ))))
443             u.utrap = 0;
444         /* old <tx,ty> remain valid */
445     } else if (IS_FURNITURE(lev->typ)
446                && (!IS_GRAVE(lev->typ) || (typ != PIT && typ != HOLE))) {
447         /* no trap on top of furniture (caller usually screens the
448            location to inhibit this, but wizard mode wishing doesn't) */
449         return (struct trap *) 0;
450     } else {
451         oldplace = FALSE;
452         ttmp = newtrap();
453         (void) memset((genericptr_t)ttmp, 0, sizeof(struct trap));
454         ttmp->ntrap = 0;
455         ttmp->tx = x;
456         ttmp->ty = y;
457     }
458     /* [re-]initialize all fields except ntrap (handled below) and <tx,ty> */
459     ttmp->vl = zero_vl;
460     ttmp->launch.x = ttmp->launch.y = -1; /* force error if used before set */
461     ttmp->dst.dnum = ttmp->dst.dlevel = -1;
462     ttmp->madeby_u = 0;
463     ttmp->once = 0;
464     ttmp->tseen = (typ == HOLE); /* hide non-holes */
465     ttmp->ttyp = typ;
466
467     switch (typ) {
468     case SQKY_BOARD: {
469         int tavail[12], tpick[12], tcnt = 0, k;
470         struct trap *t;
471
472         for (k = 0; k < 12; ++k)
473             tavail[k] = tpick[k] = 0;
474         for (t = ftrap; t; t = t->ntrap)
475             if (t->ttyp == SQKY_BOARD && t != ttmp)
476                 tavail[t->tnote] = 1;
477         /* now populate tpick[] with the available indices */
478         for (k = 0; k < 12; ++k)
479             if (tavail[k] == 0)
480                 tpick[tcnt++] = k;
481         /* choose an unused note; if all are in use, pick a random one */
482         ttmp->tnote = (short) ((tcnt > 0) ? tpick[rn2(tcnt)] : rn2(12));
483         break;
484     }
485     case STATUE_TRAP: { /* create a "living" statue */
486         struct monst *mtmp;
487         struct obj *otmp, *statue;
488         struct permonst *mptr;
489         int trycount = 10;
490
491         do { /* avoid ultimately hostile co-aligned unicorn */
492             mptr = &mons[rndmonnum()];
493         } while (--trycount > 0 && is_unicorn(mptr)
494                  && sgn(u.ualign.type) == sgn(mptr->maligntyp));
495         statue = mkcorpstat(STATUE, (struct monst *) 0, mptr, x, y,
496                             CORPSTAT_NONE);
497         mtmp = makemon(&mons[statue->corpsenm], 0, 0, MM_NOCOUNTBIRTH);
498         if (!mtmp)
499             break; /* should never happen */
500         while (mtmp->minvent) {
501             otmp = mtmp->minvent;
502             otmp->owornmask = 0;
503             obj_extract_self(otmp);
504             (void) add_to_container(statue, otmp);
505         }
506         statue->owt = weight(statue);
507         mongone(mtmp);
508         break;
509     }
510     case ROLLING_BOULDER_TRAP: /* boulder will roll towards trigger */
511         (void) mkroll_launch(ttmp, x, y, BOULDER, 1L);
512         break;
513     case PIT:
514     case SPIKED_PIT:
515         ttmp->conjoined = 0;
516         /*FALLTHRU*/
517     case HOLE:
518     case TRAPDOOR:
519         if (*in_rooms(x, y, SHOPBASE)
520             && (is_hole(typ) || IS_DOOR(lev->typ) || IS_WALL(lev->typ)))
521             add_damage(x, y, /* schedule repair */
522                        ((IS_DOOR(lev->typ) || IS_WALL(lev->typ))
523                         && !context.mon_moving)
524                            ? SHOP_HOLE_COST
525                            : 0L);
526         lev->doormask = 0;     /* subsumes altarmask, icedpool... */
527         if (IS_ROOM(lev->typ)) /* && !IS_AIR(lev->typ) */
528             lev->typ = ROOM;
529         /*
530          * some cases which can happen when digging
531          * down while phazing thru solid areas
532          */
533         else if (lev->typ == STONE || lev->typ == SCORR)
534             lev->typ = CORR;
535         else if (IS_WALL(lev->typ) || lev->typ == SDOOR)
536             lev->typ = level.flags.is_maze_lev
537                            ? ROOM
538                            : level.flags.is_cavernous_lev ? CORR : DOOR;
539
540         unearth_objs(x, y);
541         break;
542     }
543
544     if (!oldplace) {
545         ttmp->ntrap = ftrap;
546         ftrap = ttmp;
547     } else {
548         /* oldplace;
549            it shouldn't be possible to override a sokoban pit or hole
550            with some other trap, but we'll check just to be safe */
551         if (Sokoban)
552             maybe_finish_sokoban();
553     }
554     return ttmp;
555 }
556
557 void
558 fall_through(td)
559 boolean td; /* td == TRUE : trap door or hole */
560 {
561     d_level dtmp;
562     char msgbuf[BUFSZ];
563     const char *dont_fall = 0;
564     int newlevel, bottom;
565
566     /* we'll fall even while levitating in Sokoban; otherwise, if we
567        won't fall and won't be told that we aren't falling, give up now */
568     if (Blind && Levitation && !Sokoban)
569         return;
570
571     bottom = dunlevs_in_dungeon(&u.uz);
572     /* when in the upper half of the quest, don't fall past the
573        middle "quest locate" level if hero hasn't been there yet */
574     if (In_quest(&u.uz)) {
575         int qlocate_depth = qlocate_level.dlevel;
576
577         /* deepest reached < qlocate implies current < qlocate */
578         if (dunlev_reached(&u.uz) < qlocate_depth)
579             bottom = qlocate_depth; /* early cut-off */
580     }
581     newlevel = dunlev(&u.uz); /* current level */
582     do {
583         newlevel++;
584     } while (!rn2(4) && newlevel < bottom);
585
586     if (td) {
587         struct trap *t = t_at(u.ux, u.uy);
588
589         feeltrap(t);
590         if (!Sokoban) {
591             if (t->ttyp == TRAPDOOR)
592 /*JP
593                 pline("A trap door opens up under you!");
594 */
595                 pline("\97\8e\82µ\94à\82ª\82 \82È\82½\82Ì\91«\8c³\82É\8aJ\82¢\82½\81I");
596             else
597 /*JP
598                 pline("There's a gaping hole under you!");
599 */
600                 pline("\82 \82È\82½\82Ì\91«\89º\82É\82Û\82Á\82©\82è\82Æ\8c\8a\82ª\8aJ\82¢\82Ä\82¢\82é\81I");
601         }
602     } else
603 /*JP
604         pline_The("%s opens up under you!", surface(u.ux, u.uy));
605 */
606         pline("\91«\8c³\82Ì%s\82É\8c\8a\82ª\8aJ\82¢\82½\81I", surface(u.ux,u.uy));
607
608     if (Sokoban && Can_fall_thru(&u.uz))
609         ; /* KMH -- You can't escape the Sokoban level traps */
610     else if (Levitation || u.ustuck
611              || (!Can_fall_thru(&u.uz) && !levl[u.ux][u.uy].candig) || Flying
612              || is_clinger(youmonst.data)
613              || (Inhell && !u.uevent.invoked && newlevel == bottom)) {
614 /*JP
615         dont_fall = "don't fall in.";
616 */
617         dont_fall = "\82µ\82©\82µ\82 \82È\82½\82Í\97\8e\82¿\82È\82©\82Á\82½\81D";
618     } else if (youmonst.data->msize >= MZ_HUGE) {
619 /*JP
620         dont_fall = "don't fit through.";
621 */
622         dont_fall = "\92Ê\82è\94²\82¯\82é\82É\82Í\83T\83C\83Y\82ª\8d\87\82í\82È\82¢\81D";
623     } else if (!next_to_u()) {
624 /*JP
625         dont_fall = "are jerked back by your pet!";
626 */
627         dont_fall = "\82 \82È\82½\82Í\83y\83b\83g\82É\82æ\82Á\82Ä\88ø\82Á\82Ï\82è\82à\82Ç\82³\82ê\82½\81I";
628     }
629     if (dont_fall) {
630 #if 0 /*JP*//*\81u\82 \82È\82½\82Í\81v\82Å\8en\82Ü\82ç\82È\82¢\82à\82Ì\82à\82 \82é*/
631         You1(dont_fall);
632 #else
633         pline1(dont_fall);
634 #endif
635         /* hero didn't fall through, but any objects here might */
636         impact_drop((struct obj *) 0, u.ux, u.uy, 0);
637         if (!td) {
638             display_nhwindow(WIN_MESSAGE, FALSE);
639 /*JP
640             pline_The("opening under you closes up.");
641 */
642             pline_The("\91«\89º\82É\8aJ\82¢\82Ä\82¢\82½\82à\82Ì\82Í\95Â\82\82½\81D");
643         }
644         return;
645     }
646
647     if (*u.ushops)
648         shopdig(1);
649     if (Is_stronghold(&u.uz)) {
650         find_hell(&dtmp);
651     } else {
652         int dist = newlevel - dunlev(&u.uz);
653         dtmp.dnum = u.uz.dnum;
654         dtmp.dlevel = newlevel;
655         if (dist > 1)
656 #if 0 /*JP*/
657             You("fall down a %s%sshaft!", dist > 3 ? "very " : "",
658                 dist > 2 ? "deep " : "");
659 #else
660             You("%s%s\8c\8a\82Ì\92\86\82ð\97\8e\82¿\82Ä\82¢\82Á\82½\81I", dist > 3 ? "\82Æ\82Ä\82à" : "",
661                 dist > 2 ? "\90[\82¢" : "");
662 #endif
663     }
664     if (!td)
665 /*JP
666         Sprintf(msgbuf, "The hole in the %s above you closes up.",
667 */
668         Sprintf(msgbuf, "%s\82É\8aJ\82¢\82½\8c\8a\82Í\95Â\82\82½\81D",
669                 ceiling(u.ux, u.uy));
670
671     schedule_goto(&dtmp, FALSE, TRUE, 0, (char *) 0,
672                   !td ? msgbuf : (char *) 0);
673 }
674
675 /*
676  * Animate the given statue.  May have been via shatter attempt, trap,
677  * or stone to flesh spell.  Return a monster if successfully animated.
678  * If the monster is animated, the object is deleted.  If fail_reason
679  * is non-null, then fill in the reason for failure (or success).
680  *
681  * The cause of animation is:
682  *
683  *      ANIMATE_NORMAL  - hero "finds" the monster
684  *      ANIMATE_SHATTER - hero tries to destroy the statue
685  *      ANIMATE_SPELL   - stone to flesh spell hits the statue
686  *
687  * Perhaps x, y is not needed if we can use get_obj_location() to find
688  * the statue's location... ???
689  *
690  * Sequencing matters:
691  *      create monster; if it fails, give up with statue intact;
692  *      give "statue comes to life" message;
693  *      if statue belongs to shop, have shk give "you owe" message;
694  *      transfer statue contents to monster (after stolen_value());
695  *      delete statue.
696  *      [This ordering means that if the statue ends up wearing a cloak of
697  *       invisibility or a mummy wrapping, the visibility checks might be
698  *       wrong, but to avoid that we'd have to clone the statue contents
699  *       first in order to give them to the monster before checking their
700  *       shop status--it's not worth the hassle.]
701  */
702 struct monst *
703 animate_statue(statue, x, y, cause, fail_reason)
704 struct obj *statue;
705 xchar x, y;
706 int cause;
707 int *fail_reason;
708 {
709     int mnum = statue->corpsenm;
710     struct permonst *mptr = &mons[mnum];
711     struct monst *mon = 0, *shkp;
712     struct obj *item;
713     coord cc;
714     boolean historic = (Role_if(PM_ARCHEOLOGIST)
715                         && (statue->spe & STATUE_HISTORIC) != 0),
716             golem_xform = FALSE, use_saved_traits;
717     const char *comes_to_life;
718     char statuename[BUFSZ], tmpbuf[BUFSZ];
719     static const char historic_statue_is_gone[] =
720 /*JP
721         "that the historic statue is now gone";
722 */
723         "\97ð\8ej\93I\82È\92¤\91\9c\82ª\82È\82­\82È\82Á\82Ä\82µ\82Ü\82Á\82½\82±\82Æ";
724
725     if (cant_revive(&mnum, TRUE, statue)) {
726         /* mnum has changed; we won't be animating this statue as itself */
727         if (mnum != PM_DOPPELGANGER)
728             mptr = &mons[mnum];
729         use_saved_traits = FALSE;
730     } else if (is_golem(mptr) && cause == ANIMATE_SPELL) {
731         /* statue of any golem hit by stone-to-flesh becomes flesh golem */
732         golem_xform = (mptr != &mons[PM_FLESH_GOLEM]);
733         mnum = PM_FLESH_GOLEM;
734         mptr = &mons[PM_FLESH_GOLEM];
735         use_saved_traits = (has_omonst(statue) && !golem_xform);
736     } else {
737         use_saved_traits = has_omonst(statue);
738     }
739
740     if (use_saved_traits) {
741         /* restore a petrified monster */
742         cc.x = x, cc.y = y;
743         mon = montraits(statue, &cc, (cause == ANIMATE_SPELL));
744         if (mon && mon->mtame && !mon->isminion)
745             wary_dog(mon, TRUE);
746     } else {
747         /* statues of unique monsters from bones or wishing end
748            up here (cant_revive() sets mnum to be doppelganger;
749            mptr reflects the original form for use by newcham()) */
750         if ((mnum == PM_DOPPELGANGER && mptr != &mons[PM_DOPPELGANGER])
751             /* block quest guards from other roles */
752             || (mptr->msound == MS_GUARDIAN
753                 && quest_info(MS_GUARDIAN) != mnum)) {
754             mon = makemon(&mons[PM_DOPPELGANGER], x, y,
755                           NO_MINVENT | MM_NOCOUNTBIRTH | MM_ADJACENTOK);
756             /* if hero has protection from shape changers, cham field will
757                be NON_PM; otherwise, set form to match the statue */
758             if (mon && mon->cham >= LOW_PM)
759                 (void) newcham(mon, mptr, FALSE, FALSE);
760         } else
761             mon = makemon(mptr, x, y, (cause == ANIMATE_SPELL)
762                                           ? (NO_MINVENT | MM_ADJACENTOK)
763                                           : NO_MINVENT);
764     }
765
766     if (!mon) {
767         if (fail_reason)
768             *fail_reason = unique_corpstat(&mons[statue->corpsenm])
769                                ? AS_MON_IS_UNIQUE
770                                : AS_NO_MON;
771         return (struct monst *) 0;
772     }
773
774     /* a non-montraits() statue might specify gender */
775     if (statue->spe & STATUE_MALE)
776         mon->female = FALSE;
777     else if (statue->spe & STATUE_FEMALE)
778         mon->female = TRUE;
779     /* if statue has been named, give same name to the monster */
780     if (has_oname(statue) && !unique_corpstat(mon->data))
781         mon = christen_monst(mon, ONAME(statue));
782     /* mimic statue becomes seen mimic; other hiders won't be hidden */
783     if (M_AP_TYPE(mon))
784         seemimic(mon);
785     else
786         mon->mundetected = FALSE;
787     mon->msleeping = 0;
788     if (cause == ANIMATE_NORMAL || cause == ANIMATE_SHATTER) {
789         /* trap always releases hostile monster */
790         mon->mtame = 0; /* (might be petrified pet tossed onto trap) */
791         mon->mpeaceful = 0;
792         set_malign(mon);
793     }
794
795 #if 0 /*JP*/
796     comes_to_life = !canspotmon(mon)
797                         ? "disappears"
798                         : golem_xform
799                               ? "turns into flesh"
800                               : (nonliving(mon->data) || is_vampshifter(mon))
801                                     ? "moves"
802                                     : "comes to life";
803 #else
804     comes_to_life = !canspotmon(mon)
805                         ? "\8fÁ\82¦"
806                         : golem_xform
807                               ? "\93÷\91Ì\82É\96ß\82Á"
808                               : (nonliving(mon->data) || is_vampshifter(mon))
809                                     ? "\93®\82¢"
810                                     : "\90\96½\82ð\91Ñ\82Ñ";
811 #endif
812     if ((x == u.ux && y == u.uy) || cause == ANIMATE_SPELL) {
813         /* "the|your|Manlobbi's statue [of a wombat]" */
814         shkp = shop_keeper(*in_rooms(mon->mx, mon->my, SHOPBASE));
815 #if 0 /*JP*/
816         Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
817                 (cause == ANIMATE_SPELL
818                  /* avoid "of a shopkeeper" if it's Manlobbi himself
819                     (if carried, it can't be unpaid--hence won't be
820                     described as "Manlobbi's statue"--because there
821                     wasn't any living shk when statue was picked up) */
822                  && (mon != shkp || carried(statue)))
823                    ? xname(statue)
824                    : "statue");
825 #else
826         Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
827                 (cause == ANIMATE_SPELL
828                  && (mon != shkp || carried(statue)))
829                    ? xname(statue)
830                    : "\92¤\91\9c");
831 #endif
832 /*JP
833         pline("%s %s!", upstart(statuename), comes_to_life);
834 */
835         pline("%s\82Í%s\82½\81I", upstart(statuename), comes_to_life);
836     } else if (Hallucination) { /* They don't know it's a statue */
837 /*JP
838         pline_The("%s suddenly seems more animated.", rndmonnam((char *) 0));
839 */
840         pline_The("%s\82Í\93Ë\91R\82æ\82è\8a\88\93®\93I\82É\82È\82Á\82½\81D", rndmonnam((char *) 0));
841     } else if (cause == ANIMATE_SHATTER) {
842         if (cansee(x, y))
843             Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
844                     xname(statue));
845         else
846 /*JP
847             Strcpy(statuename, "a statue");
848 */
849             Strcpy(statuename, "\92¤\91\9c");
850 #if 0 /*JP*/
851         pline("Instead of shattering, %s suddenly %s!", statuename,
852               comes_to_life);
853 #else
854         pline("%s\82Í\8dÓ\82¯\82¸\82É%s\82½\81I", statuename,
855               comes_to_life);
856 #endif
857     } else { /* cause == ANIMATE_NORMAL */
858 /*JP
859         You("find %s posing as a statue.",
860 */
861         You("%s\82ª\92¤\91\9c\82Ì\82Ó\82è\82ð\82µ\82Ä\82¢\82é\82Ì\82ð\8c©\82Â\82¯\82½\81D",
862             canspotmon(mon) ? a_monnam(mon) : something);
863         if (!canspotmon(mon) && Blind)
864             map_invisible(x, y);
865         stop_occupation();
866     }
867
868     /* if this isn't caused by a monster using a wand of striking,
869        there might be consequences for the hero */
870     if (!context.mon_moving) {
871         /* if statue is owned by a shop, hero will have to pay for it;
872            stolen_value gives a message (about debt or use of credit)
873            which refers to "it" so needs to follow a message describing
874            the object ("the statue comes to life" one above) */
875         if (cause != ANIMATE_NORMAL && costly_spot(x, y)
876             && (carried(statue) ? statue->unpaid : !statue->no_charge)
877             && (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0
878             /* avoid charging for Manlobbi's statue of Manlobbi
879                if stone-to-flesh is used on petrified shopkeep */
880             && mon != shkp)
881             (void) stolen_value(statue, x, y, (boolean) shkp->mpeaceful,
882                                 FALSE);
883
884         if (historic) {
885 /*JP
886             You_feel("guilty %s.", historic_statue_is_gone);
887 */
888             You_feel("%s\82É\8dß\82ð\8a´\82\82½\81D", historic_statue_is_gone);
889             adjalign(-1);
890         }
891     } else {
892         if (historic && cansee(x, y))
893 /*JP
894             You_feel("regret %s.", historic_statue_is_gone);
895 */
896             You_feel("%s\82ð\8cã\89÷\82µ\82½\81D", historic_statue_is_gone);
897         /* no alignment penalty */
898     }
899
900     /* transfer any statue contents to monster's inventory */
901     while ((item = statue->cobj) != 0) {
902         obj_extract_self(item);
903         (void) mpickobj(mon, item);
904     }
905     m_dowear(mon, TRUE);
906     /* in case statue is wielded and hero zaps stone-to-flesh at self */
907     if (statue->owornmask)
908         remove_worn_item(statue, TRUE);
909     /* statue no longer exists */
910     delobj(statue);
911
912     /* avoid hiding under nothing */
913     if (x == u.ux && y == u.uy && Upolyd && hides_under(youmonst.data)
914         && !OBJ_AT(x, y))
915         u.uundetected = 0;
916
917     if (fail_reason)
918         *fail_reason = AS_OK;
919     return mon;
920 }
921
922 /*
923  * You've either stepped onto a statue trap's location or you've triggered a
924  * statue trap by searching next to it or by trying to break it with a wand
925  * or pick-axe.
926  */
927 struct monst *
928 activate_statue_trap(trap, x, y, shatter)
929 struct trap *trap;
930 xchar x, y;
931 boolean shatter;
932 {
933     struct monst *mtmp = (struct monst *) 0;
934     struct obj *otmp = sobj_at(STATUE, x, y);
935     int fail_reason;
936
937     /*
938      * Try to animate the first valid statue.  Stop the loop when we
939      * actually create something or the failure cause is not because
940      * the mon was unique.
941      */
942     deltrap(trap);
943     while (otmp) {
944         mtmp = animate_statue(otmp, x, y,
945                               shatter ? ANIMATE_SHATTER : ANIMATE_NORMAL,
946                               &fail_reason);
947         if (mtmp || fail_reason != AS_MON_IS_UNIQUE)
948             break;
949
950         otmp = nxtobj(otmp, STATUE, TRUE);
951     }
952
953     feel_newsym(x, y);
954     return mtmp;
955 }
956
957 STATIC_OVL boolean
958 keep_saddle_with_steedcorpse(steed_mid, objchn, saddle)
959 unsigned steed_mid;
960 struct obj *objchn, *saddle;
961 {
962     if (!saddle)
963         return FALSE;
964     while (objchn) {
965         if (objchn->otyp == CORPSE && has_omonst(objchn)) {
966             struct monst *mtmp = OMONST(objchn);
967
968             if (mtmp->m_id == steed_mid) {
969                 /* move saddle */
970                 xchar x, y;
971                 if (get_obj_location(objchn, &x, &y, 0)) {
972                     obj_extract_self(saddle);
973                     place_object(saddle, x, y);
974                     stackobj(saddle);
975                 }
976                 return TRUE;
977             }
978         }
979         if (Has_contents(objchn)
980             && keep_saddle_with_steedcorpse(steed_mid, objchn->cobj, saddle))
981             return TRUE;
982         objchn = objchn->nobj;
983     }
984     return FALSE;
985 }
986
987 /* monster or you go through and possibly destroy a web.
988    return TRUE if could go through. */
989 boolean
990 mu_maybe_destroy_web(mtmp, domsg, trap)
991 struct monst *mtmp;
992 boolean domsg;
993 struct trap *trap;
994 {
995     boolean isyou = (mtmp == &youmonst);
996     struct permonst *mptr = mtmp->data;
997
998     if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr)
999         || unsolid(mptr) || mptr == &mons[PM_GELATINOUS_CUBE]) {
1000         xchar x = trap->tx;
1001         xchar y = trap->ty;
1002
1003         if (flaming(mptr) || acidic(mptr)) {
1004             if (domsg) {
1005                 if (isyou)
1006 #if 0 /*JP*/
1007                     You("%s %s spider web!",
1008                         (flaming(mptr)) ? "burn" : "dissolve",
1009                         a_your[trap->madeby_u]);
1010 #else
1011                     You("%s\82­\82à\82Ì\91\83\82ð%s\81I",
1012                         web_you[trap->madeby_u],
1013                         (flaming(mptr)) ? "\8fÄ\82¢\82½" : "\82±\82È\82²\82È\82É\82µ\82½");
1014 #endif
1015                 else
1016 #if 0 /*JP*/
1017                     pline("%s %s %s spider web!", Monnam(mtmp),
1018                           (flaming(mptr)) ? "burns" : "dissolves",
1019                           a_your[trap->madeby_u]);
1020 #else
1021                     pline("%s%s\82­\82à\82Ì\91\83\82ð%s\81I", Monnam(mtmp),
1022                         web_you[trap->madeby_u],
1023                         (flaming(mptr)) ? "\8fÄ\82¢\82½" : "\82±\82È\82²\82È\82É\82µ\82½");
1024 #endif
1025             }
1026             deltrap(trap);
1027             newsym(x, y);
1028             return TRUE;
1029         }
1030         if (domsg) {
1031             if (isyou) {
1032 /*JP
1033                 You("flow through %s spider web.", a_your[trap->madeby_u]);
1034 */
1035                 You("%s\82­\82à\82Ì\91\83\82ð\82·\82é\82è\82Æ\92Ê\82è\94²\82¯\82½\81D", web_you[trap->madeby_u]);
1036             } else {
1037 #if 0 /*JP*/
1038                 pline("%s flows through %s spider web.", Monnam(mtmp),
1039                       a_your[trap->madeby_u]);
1040 #else
1041                 pline("%s\82Í%s\82­\82à\82Ì\91\83\82ð\82·\82é\82è\82Æ\92Ê\82è\94²\82¯\82½\81D", Monnam(mtmp),
1042                       web_you[trap->madeby_u]);
1043 #endif
1044                 seetrap(trap);
1045             }
1046         }
1047         return TRUE;
1048     }
1049     return FALSE;
1050 }
1051
1052 /* make a single arrow/dart/rock for a trap to shoot or drop */
1053 STATIC_OVL struct obj *
1054 t_missile(otyp, trap)
1055 int otyp;
1056 struct trap *trap;
1057 {
1058     struct obj *otmp = mksobj(otyp, TRUE, FALSE);
1059
1060     otmp->quan = 1L;
1061     otmp->owt = weight(otmp);
1062     otmp->opoisoned = 0;
1063     otmp->ox = trap->tx, otmp->oy = trap->ty;
1064     return otmp;
1065 }
1066
1067 void
1068 set_utrap(tim, typ)
1069 unsigned tim, typ;
1070 {
1071     u.utrap = tim;
1072     /* FIXME:
1073      * utraptype==0 is bear trap rather than 'none'; we probably ought
1074      * to change that but can't do so until save file compatability is
1075      * able to be broken.
1076      */
1077     u.utraptype = tim ? typ : 0;
1078
1079     float_vs_flight(); /* maybe block Lev and/or Fly */
1080 }
1081
1082 void
1083 reset_utrap(msg)
1084 boolean msg;
1085 {
1086     boolean was_Lev = (Levitation != 0), was_Fly = (Flying != 0);
1087
1088     set_utrap(0, 0);
1089
1090     if (msg) {
1091         if (!was_Lev && Levitation)
1092             float_up();
1093         if (!was_Fly && Flying)
1094 /*JP
1095             You("can fly.");
1096 */
1097             You("\94ò\82×\82é\82æ\82¤\82É\82È\82Á\82½\81D");
1098     }
1099 }
1100
1101 void
1102 dotrap(trap, trflags)
1103 register struct trap *trap;
1104 unsigned trflags;
1105 {
1106     register int ttype = trap->ttyp;
1107     struct obj *otmp;
1108     boolean already_seen = trap->tseen,
1109             forcetrap = ((trflags & FORCETRAP) != 0
1110                          || (trflags & FAILEDUNTRAP) != 0),
1111             webmsgok = (trflags & NOWEBMSG) == 0,
1112             forcebungle = (trflags & FORCEBUNGLE) != 0,
1113             plunged = (trflags & TOOKPLUNGE) != 0,
1114             viasitting = (trflags & VIASITTING) != 0,
1115             conj_pit = conjoined_pits(trap, t_at(u.ux0, u.uy0), TRUE),
1116             adj_pit = adj_nonconjoined_pit(trap);
1117     int oldumort;
1118     int steed_article = ARTICLE_THE;
1119
1120     nomul(0);
1121
1122     /* KMH -- You can't escape the Sokoban level traps */
1123     if (Sokoban && (is_pit(ttype) || is_hole(ttype))) {
1124         /* The "air currents" message is still appropriate -- even when
1125          * the hero isn't flying or levitating -- because it conveys the
1126          * reason why the player cannot escape the trap with a dexterity
1127          * check, clinging to the ceiling, etc.
1128          */
1129 #if 0 /*JP*/
1130         pline("Air currents pull you down into %s %s!",
1131               a_your[trap->madeby_u],
1132               defsyms[trap_to_defsym(ttype)].explanation);
1133 #else
1134         pline("\8bó\8bC\82Ì\97¬\82ê\82ª\82 \82È\82½\82ð%s\82É\88ø\82«\96ß\82µ\82½\81I",
1135               defsyms[trap_to_defsym(ttype)].explanation);
1136 #endif
1137         /* then proceed to normal trap effect */
1138     } else if (already_seen && !forcetrap) {
1139         if ((Levitation || (Flying && !plunged))
1140             && (is_pit(ttype) || ttype == HOLE || ttype == BEAR_TRAP)) {
1141 #if 0 /*JP*/
1142             You("%s over %s %s.", Levitation ? "float" : "fly",
1143                 a_your[trap->madeby_u],
1144                 defsyms[trap_to_defsym(ttype)].explanation);
1145 #else
1146             You("%s%s\82Ì\8fã%s\81D",
1147                 set_you[trap->madeby_u],
1148                 defsyms[trap_to_defsym(ttype)].explanation,
1149                 Levitation ? "\82ð\8c©\89º\82ë\82µ\82½" : "\82ð\94ò\82ñ\82Å\82¢\82é");
1150 #endif
1151             return;
1152         }
1153         if (!Fumbling && ttype != MAGIC_PORTAL && ttype != VIBRATING_SQUARE
1154             && ttype != ANTI_MAGIC && !forcebungle && !plunged
1155             && !conj_pit && !adj_pit
1156             && (!rn2(5) || (is_pit(ttype)
1157                             && is_clinger(youmonst.data)))) {
1158 #if 0 /*JP*/
1159                 You("escape %s %s.", (ttype == ARROW_TRAP && !trap->madeby_u)
1160                                      ? "an"
1161                                      : a_your[trap->madeby_u],
1162                 defsyms[trap_to_defsym(ttype)].explanation);
1163 #else
1164                 You("%s%s\82ð\82·\82é\82è\82Æ\94ð\82¯\82½\81D",
1165                     set_you[trap->madeby_u],
1166                     defsyms[trap_to_defsym(ttype)].explanation);
1167 #endif
1168             return;
1169         }
1170     }
1171
1172     if (u.usteed) {
1173         u.usteed->mtrapseen |= (1 << (ttype - 1));
1174         /* suppress article in various steed messages when using its
1175            name (which won't occur when hallucinating) */
1176         if (has_mname(u.usteed) && !Hallucination)
1177             steed_article = ARTICLE_NONE;
1178     }
1179
1180     switch (ttype) {
1181     case ARROW_TRAP:
1182         if (trap->once && trap->tseen && !rn2(15)) {
1183 /*JP
1184             You_hear("a loud click!");
1185 */
1186             You_hear("\83K\83`\83\83\83b\82Æ\82¢\82¤\91å\82«\82È\89¹\82ð\95·\82¢\82½\81I");
1187             deltrap(trap);
1188             newsym(u.ux, u.uy);
1189             break;
1190         }
1191         trap->once = 1;
1192         seetrap(trap);
1193 /*JP
1194         pline("An arrow shoots out at you!");
1195 */
1196         pline("\96î\82ª\94ò\82ñ\82Å\82«\82½\81I");
1197         otmp = t_missile(ARROW, trap);
1198         if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
1199             ; /* nothing */
1200 #if 0 /*JP:T*/
1201         } else if (thitu(8, dmgval(otmp, &youmonst), &otmp, "arrow")) {
1202 #else
1203         } else if (thitu(8, dmgval(otmp, &youmonst), &otmp, "\96î")) {
1204 #endif
1205             if (otmp)
1206                 obfree(otmp, (struct obj *) 0);
1207         } else {
1208             place_object(otmp, u.ux, u.uy);
1209             if (!Blind)
1210                 otmp->dknown = 1;
1211             stackobj(otmp);
1212             newsym(u.ux, u.uy);
1213         }
1214         break;
1215
1216     case DART_TRAP:
1217         if (trap->once && trap->tseen && !rn2(15)) {
1218 /*JP
1219             You_hear("a soft click.");
1220 */
1221             You_hear("\83J\83`\83b\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
1222             deltrap(trap);
1223             newsym(u.ux, u.uy);
1224             break;
1225         }
1226         trap->once = 1;
1227         seetrap(trap);
1228 /*JP
1229         pline("A little dart shoots out at you!");
1230 */
1231         pline("\8f¬\82³\82È\93\8a\82°\96î\82ª\94ò\82ñ\82Å\82«\82½\81I");
1232         otmp = t_missile(DART, trap);
1233         if (!rn2(6))
1234             otmp->opoisoned = 1;
1235         oldumort = u.umortality;
1236         if (u.usteed && !rn2(2) && steedintrap(trap, otmp)) {
1237             ; /* nothing */
1238 #if 0 /*JP*/
1239         } else if (thitu(7, dmgval(otmp, &youmonst), &otmp, "little dart")) {
1240 #else
1241         } else if (thitu(7, dmgval(otmp, &youmonst), &otmp, "\93\8a\82°\96î")) {
1242 #endif
1243             if (otmp) {
1244                 if (otmp->opoisoned)
1245 #if 0 /*JP:T*/
1246                     poisoned("dart", A_CON, "little dart",
1247                              /* if damage triggered life-saving,
1248                                 poison is limited to attrib loss */
1249                              (u.umortality > oldumort) ? 0 : 10, TRUE);
1250 #else
1251                     poisoned("\93\8a\82°\96î", A_CON, "\8f¬\82³\82È\93\8a\82°\96î",
1252                              /* if damage triggered life-saving,
1253                                 poison is limited to attrib loss */
1254                              (u.umortality > oldumort) ? 0 : 10, TRUE);
1255 #endif
1256                 obfree(otmp, (struct obj *) 0);
1257             }
1258         } else {
1259             place_object(otmp, u.ux, u.uy);
1260             if (!Blind)
1261                 otmp->dknown = 1;
1262             stackobj(otmp);
1263             newsym(u.ux, u.uy);
1264         }
1265         break;
1266
1267     case ROCKTRAP:
1268         if (trap->once && trap->tseen && !rn2(15)) {
1269 /*JP
1270             pline("A trap door in %s opens, but nothing falls out!",
1271 */
1272             pline("\97\8e\82µ\94à\82ª%s\82É\8aJ\82¢\82½\82ª\81C\89½\82à\97\8e\82¿\82Ä\82±\82È\82©\82Á\82½\81I",
1273                   the(ceiling(u.ux, u.uy)));
1274             deltrap(trap);
1275             newsym(u.ux, u.uy);
1276         } else {
1277             int dmg = d(2, 6); /* should be std ROCK dmg? */
1278
1279             trap->once = 1;
1280             feeltrap(trap);
1281             otmp = t_missile(ROCK, trap);
1282             place_object(otmp, u.ux, u.uy);
1283
1284 #if 0 /*JP*/
1285             pline("A trap door in %s opens and %s falls on your %s!",
1286                   the(ceiling(u.ux, u.uy)), an(xname(otmp)), body_part(HEAD));
1287 #else
1288             pline("\97\8e\82µ\94à\82ª%s\82É\8aJ\82«\81C%s\82ª\82 \82È\82½\82Ì%s\82É\97\8e\82¿\82Ä\82«\82½\81I",
1289                   ceiling(u.ux,u.uy), xname(otmp), body_part(HEAD));
1290 #endif
1291             if (uarmh) {
1292                 if (is_metallic(uarmh)) {
1293 /*JP
1294                     pline("Fortunately, you are wearing a hard helmet.");
1295 */
1296                     pline("\8dK\89^\82É\82à\81C\82 \82È\82½\82Í\8cÅ\82¢\8a\95\82ð\90g\82É\82Â\82¯\82Ä\82¢\82½\81D");
1297                     dmg = 2;
1298                 } else if (flags.verbose) {
1299 /*JP
1300                     pline("%s does not protect you.", Yname2(uarmh));
1301 */
1302                     pline("%s\82Å\82Í\96h\82°\82È\82¢\81D", xname(uarmh));
1303                 }
1304             }
1305             if (!Blind)
1306                 otmp->dknown = 1;
1307             stackobj(otmp);
1308             newsym(u.ux, u.uy); /* map the rock */
1309
1310 /*JP
1311             losehp(Maybe_Half_Phys(dmg), "falling rock", KILLED_BY_AN);
1312 */
1313             losehp(Maybe_Half_Phys(dmg), "\97\8e\8aâ\82Å", KILLED_BY_AN);
1314             exercise(A_STR, FALSE);
1315         }
1316         break;
1317
1318     case SQKY_BOARD: /* stepped on a squeaky board */
1319         if ((Levitation || Flying) && !forcetrap) {
1320             if (!Blind) {
1321                 seetrap(trap);
1322                 if (Hallucination)
1323 /*JP
1324                     You("notice a crease in the linoleum.");
1325 */
1326                     You("\8f°\82Ì\8ed\8fã\8dÞ\82Ì\82µ\82í\82É\8bC\82ª\82Â\82¢\82½\81D");
1327                 else
1328 /*JP
1329                     You("notice a loose board below you.");
1330 */
1331                     You("\91«\8c³\82Ì\8aÉ\82ñ\82¾\94Â\82É\8bC\82ª\82Â\82¢\82½\81D");
1332             }
1333         } else {
1334             seetrap(trap);
1335 #if 0 /*JP*/
1336             pline("A board beneath you %s%s%s.",
1337                   Deaf ? "vibrates" : "squeaks ",
1338                   Deaf ? "" : trapnote(trap, 0), Deaf ? "" : " loudly");
1339 #else
1340             if (Deaf) {
1341                 pline("\91«\8c³\82Ì\94Â\82ª\82ä\82ê\82½\81D");
1342             } else {
1343                 pline("\91«\8c³\82Ì\94Â\82ª\91å\82«\82­%s\82Ì\89¹\82É\82«\82µ\82ñ\82¾\81D", trapnote(trap, 0));
1344             }
1345 #endif
1346             wake_nearby();
1347         }
1348         break;
1349
1350     case BEAR_TRAP: {
1351         int dmg = d(2, 4);
1352
1353         if ((Levitation || Flying) && !forcetrap)
1354             break;
1355         feeltrap(trap);
1356         if (amorphous(youmonst.data) || is_whirly(youmonst.data)
1357             || unsolid(youmonst.data)) {
1358 #if 0 /*JP*/
1359             pline("%s bear trap closes harmlessly through you.",
1360                   A_Your[trap->madeby_u]);
1361 #else
1362             pline("%s\8cF\82Ìã©\82Í\8a\9a\82Ý\82Â\82¢\82½\82ª\81C\82·\82é\82Á\82Æ\92Ê\82è\94²\82¯\82½\81D",
1363                   set_you[trap->madeby_u]);
1364 #endif
1365             break;
1366         }
1367         if (!u.usteed && youmonst.data->msize <= MZ_SMALL) {
1368 #if 0 /*JP*/
1369             pline("%s bear trap closes harmlessly over you.",
1370                   A_Your[trap->madeby_u]);
1371 #else
1372             pline("%s\8cF\82Ìã©\82Í\8a\9a\82Ý\82Â\82¢\82½\82ª\81C\97y\82©\8fã\95û\82¾\82Á\82½\81D",
1373                   set_you[trap->madeby_u]);
1374 #endif
1375             break;
1376         }
1377         set_utrap((unsigned) rn1(4, 4), TT_BEARTRAP);
1378         if (u.usteed) {
1379 #if 0 /*JP*/
1380             pline("%s bear trap closes on %s %s!", A_Your[trap->madeby_u],
1381                   s_suffix(mon_nam(u.usteed)), mbodypart(u.usteed, FOOT));
1382 #else
1383             pline("%s\8cF\82Ìã©\82Í%s\82Ì%s\82É\8a\9a\82Ý\82Â\82¢\82½\81I", set_you[trap->madeby_u],
1384                   mon_nam(u.usteed), mbodypart(u.usteed, FOOT));
1385 #endif
1386             if (thitm(0, u.usteed, (struct obj *) 0, dmg, FALSE))
1387                 reset_utrap(TRUE); /* steed died, hero not trapped */
1388         } else {
1389 #if 0 /*JP*/
1390             pline("%s bear trap closes on your %s!", A_Your[trap->madeby_u],
1391                   body_part(FOOT));
1392 #else
1393             pline("%s\8cF\82Ìã©\82ª\82 \82È\82½\82Ì%s\82É\8a\9a\82Ý\82Â\82¢\82½\81I", set_you[trap->madeby_u],
1394                   body_part(FOOT));
1395 #endif
1396             set_wounded_legs(rn2(2) ? RIGHT_SIDE : LEFT_SIDE, rn1(10, 10));
1397             if (u.umonnum == PM_OWLBEAR || u.umonnum == PM_BUGBEAR)
1398 /*JP
1399                 You("howl in anger!");
1400 */
1401                 You("\93{\82è\82Ì\99ô\9aK\82ð\82 \82°\82½\81I");
1402 /*JP
1403             losehp(Maybe_Half_Phys(dmg), "bear trap", KILLED_BY_AN);
1404 */
1405             losehp(Maybe_Half_Phys(dmg), "\8cF\82Ìã©\82Å", KILLED_BY_AN);
1406         }
1407         exercise(A_DEX, FALSE);
1408         break;
1409     }
1410
1411     case SLP_GAS_TRAP:
1412         seetrap(trap);
1413         if (Sleep_resistance || breathless(youmonst.data)) {
1414 /*JP
1415             You("are enveloped in a cloud of gas!");
1416 */
1417             You("\83K\83X\89_\82É\82Â\82Â\82Ü\82ê\82½\81I");
1418         } else {
1419 /*JP
1420             pline("A cloud of gas puts you to sleep!");
1421 */
1422             pline("\82 \82È\82½\82Í\83K\83X\89_\82Å\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81I");
1423             fall_asleep(-rnd(25), TRUE);
1424         }
1425         (void) steedintrap(trap, (struct obj *) 0);
1426         break;
1427
1428     case RUST_TRAP:
1429         seetrap(trap);
1430
1431         /* Unlike monsters, traps cannot aim their rust attacks at
1432          * you, so instead of looping through and taking either the
1433          * first rustable one or the body, we take whatever we get,
1434          * even if it is not rustable.
1435          */
1436         switch (rn2(5)) {
1437         case 0:
1438 /*JP
1439             pline("%s you on the %s!", A_gush_of_water_hits, body_part(HEAD));
1440 */
1441             pline("\90\85\82ª\95¬\8fo\82µ\82Ä\82 \82È\82½\82Ì%s\82É\96½\92\86\82µ\82½\81I", body_part(HEAD));
1442             (void) water_damage(uarmh, helm_simple_name(uarmh), TRUE);
1443             break;
1444         case 1:
1445 /*JP
1446             pline("%s your left %s!", A_gush_of_water_hits, body_part(ARM));
1447 */
1448             pline("\90\85\82ª\95¬\8fo\82µ\82Ä\82 \82È\82½\82Ì\8d¶%s\82É\96½\92\86\82µ\82½\81I", body_part(ARM));
1449 /*JP
1450             if (water_damage(uarms, "shield", TRUE) != ER_NOTHING)
1451 */
1452             if (water_damage(uarms, "\8f\82", TRUE) != ER_NOTHING)
1453                 break;
1454             if (u.twoweap || (uwep && bimanual(uwep)))
1455                 (void) water_damage(u.twoweap ? uswapwep : uwep, 0, TRUE);
1456         glovecheck:
1457 /*JP
1458             (void) water_damage(uarmg, "gauntlets", TRUE);
1459 */
1460             (void) water_damage(uarmg, "\8f¬\8eè", TRUE);
1461             /* Not "metal gauntlets" since it gets called
1462              * even if it's leather for the message
1463              */
1464             break;
1465         case 2:
1466 /*JP
1467             pline("%s your right %s!", A_gush_of_water_hits, body_part(ARM));
1468 */
1469             pline("\90\85\82ª\95¬\8fo\82µ\82Ä\82 \82È\82½\82Ì\89E%s\82É\96½\92\86\82µ\82½\81I", body_part(ARM));
1470             (void) water_damage(uwep, 0, TRUE);
1471             goto glovecheck;
1472         default:
1473 /*JP
1474             pline("%s you!", A_gush_of_water_hits);
1475 */
1476             pline("\90\85\82ª\95¬\8fo\82µ\82Ä\82 \82È\82½\82É\96½\92\86\82µ\82½\81I");
1477             for (otmp = invent; otmp; otmp = otmp->nobj)
1478                 if (otmp->lamplit && otmp != uwep
1479                     && (otmp != uswapwep || !u.twoweap))
1480                     (void) snuff_lit(otmp);
1481             if (uarmc)
1482                 (void) water_damage(uarmc, cloak_simple_name(uarmc), TRUE);
1483             else if (uarm)
1484                 (void) water_damage(uarm, suit_simple_name(uarm), TRUE);
1485             else if (uarmu)
1486 /*JP
1487                 (void) water_damage(uarmu, "shirt", TRUE);
1488 */
1489                 (void) water_damage(uarmu, "\83V\83\83\83c", TRUE);
1490         }
1491         update_inventory();
1492
1493         if (u.umonnum == PM_IRON_GOLEM) {
1494             int dam = u.mhmax;
1495
1496 /*JP
1497             You("are covered with rust!");
1498 */
1499             You("\8eK\82É\95¢\82í\82ê\82½\81I");
1500 /*JP
1501             losehp(Maybe_Half_Phys(dam), "rusting away", KILLED_BY);
1502 */
1503             losehp(Maybe_Half_Phys(dam), "\8a®\91S\82É\8eK\82Ñ\82Ä", KILLED_BY);
1504         } else if (u.umonnum == PM_GREMLIN && rn2(3)) {
1505             (void) split_mon(&youmonst, (struct monst *) 0);
1506         }
1507
1508         break;
1509
1510     case FIRE_TRAP:
1511         seetrap(trap);
1512         dofiretrap((struct obj *) 0);
1513         break;
1514
1515     case PIT:
1516     case SPIKED_PIT:
1517         /* KMH -- You can't escape the Sokoban level traps */
1518         if (!Sokoban && (Levitation || (Flying && !plunged)))
1519             break;
1520         feeltrap(trap);
1521         if (!Sokoban && is_clinger(youmonst.data) && !plunged) {
1522             if (trap->tseen) {
1523 #if 0 /*JP*/
1524                 You_see("%s %spit below you.", a_your[trap->madeby_u],
1525                         ttype == SPIKED_PIT ? "spiked " : "");
1526 #else
1527                 pline("\91«\8c³\82É%s%s\97\8e\82µ\8c\8a\82ð\94­\8c©\82µ\82½\81D", dig_you[trap->madeby_u],
1528                       ttype == SPIKED_PIT ? "\83g\83Q\82¾\82ç\82¯\82Ì" : "");
1529 #endif
1530             } else {
1531 #if 0 /*JP*/
1532                 pline("%s pit %sopens up under you!", A_Your[trap->madeby_u],
1533                       ttype == SPIKED_PIT ? "full of spikes " : "");
1534 #else
1535                 pline("%s%s\97\8e\82µ\8c\8a\82ª\91«\8c³\82É\8aJ\82¢\82½\81I", dig_you[trap->madeby_u],
1536                       ttype == SPIKED_PIT ? "\83g\83Q\82¾\82ç\82¯\82Ì" : "");
1537 #endif
1538 /*JP
1539                 You("don't fall in!");
1540 */
1541                 pline("\82µ\82©\82µ\81C\82 \82È\82½\82Í\97\8e\82¿\82È\82©\82Á\82½\81I");
1542             }
1543             break;
1544         }
1545         if (!Sokoban) {
1546             char verbbuf[BUFSZ];
1547
1548             *verbbuf = '\0';
1549             if (u.usteed) {
1550                 if ((trflags & RECURSIVETRAP) != 0)
1551 /*JP
1552                     Sprintf(verbbuf, "and %s fall",
1553 */
1554                     Sprintf(verbbuf, "\82Æ%s",
1555                             x_monnam(u.usteed, steed_article, (char *) 0,
1556                                      SUPPRESS_SADDLE, FALSE));
1557                 else
1558 #if 0 /*JP*/
1559                     Sprintf(verbbuf, "lead %s",
1560                             x_monnam(u.usteed, steed_article, "poor",
1561                                      SUPPRESS_SADDLE, FALSE));
1562 #else
1563                     Sprintf(verbbuf, "\82Æ%s",
1564                             x_monnam(u.usteed, steed_article, "\82©\82í\82¢\82»\82¤\82È",
1565                                      SUPPRESS_SADDLE, FALSE));
1566 #endif
1567             } else if (conj_pit) {
1568 /*JP
1569                 You("move into an adjacent pit.");
1570 */
1571                 You("\97×\82Ì\97\8e\82µ\8c\8a\82É\88Ú\93®\82µ\82½\81D");
1572             } else if (adj_pit) {
1573 #if 0 /*JP:T*/
1574                 You("stumble over debris%s.",
1575                     !rn2(5) ? " between the pits" : "");
1576 #else
1577                 You("\82Í%s\82ª\82ç\82­\82½\82Å\82Â\82Ü\82Ã\82¢\82½\81D",
1578                     !rn2(5) ? "\97\8e\82µ\8c\8a\82Ì" : "");
1579 #endif
1580             } else {
1581 #if 0 /*JP*/
1582                 Strcpy(verbbuf,
1583                        !plunged ? "fall" : (Flying ? "dive" : "plunge"));
1584 #else
1585                 Strcpy(verbbuf,
1586                        !plunged ? "\97\8e\82¿\82½" : (Flying ? "\94ò\82Ñ\8d\9e\82ñ\82¾" : "\93Ë\93ü\82µ\82½"));
1587 #endif
1588             }
1589             if (*verbbuf)
1590 /*JP
1591                 You("%s into %s pit!", verbbuf, a_your[trap->madeby_u]);
1592 */
1593                 You("%s\97\8e\82µ\8c\8a\82É%s!", set_you[trap->madeby_u], verbbuf);
1594         }
1595         /* wumpus reference */
1596         if (Role_if(PM_RANGER) && !trap->madeby_u && !trap->once
1597             && In_quest(&u.uz) && Is_qlocate(&u.uz)) {
1598 /*JP
1599             pline("Fortunately it has a bottom after all...");
1600 */
1601             pline("\8dK\82¢\81C\8c\8b\8bÇ\82Í\92ê\82ª\82 \82Á\82½\81D\81D\81D");
1602             trap->once = 1;
1603         } else if (u.umonnum == PM_PIT_VIPER || u.umonnum == PM_PIT_FIEND) {
1604 /*JP
1605             pline("How pitiful.  Isn't that the pits?");
1606 */
1607             pline("\82±\82Ì\97\8e\82µ\8c\8a\82Í\82¢\82¢\8ed\8e\96\82ð\82µ\82Ä\82¢\82é\81D");
1608         }
1609         if (ttype == SPIKED_PIT) {
1610 /*JP
1611             const char *predicament = "on a set of sharp iron spikes";
1612 */
1613             const char *predicament = "\89s\82¢\93S\82Ì\83g\83Q\83g\83Q\82Ì\8fã\82É";
1614
1615             if (u.usteed) {
1616 #if 0 /*JP:T*/
1617                 pline("%s %s %s!",
1618                       upstart(x_monnam(u.usteed, steed_article, "poor",
1619                                        SUPPRESS_SADDLE, FALSE)),
1620                       conj_pit ? "steps" : "lands", predicament);
1621 #else
1622                 pline("%s\82Í%s%s\81I",
1623                       upstart(x_monnam(u.usteed, steed_article, "\82©\82í\82¢\82»\82¤\82È",
1624                                        SUPPRESS_SADDLE, FALSE)),
1625                       predicament, conj_pit ? "\97\8e\82¿\82½" : "\8d~\82è\82½");
1626 #endif
1627             } else
1628 /*JP
1629                 You("%s %s!", conj_pit ? "step" : "land", predicament);
1630 */
1631                 You("%s%s\81I", predicament, conj_pit ? "\97\8e\82¿\82½" : "\8d~\82è\82½");
1632         }
1633         /* FIXME:
1634          * if hero gets killed here, setting u.utrap in advance will
1635          * show "you were trapped in a pit" during disclosure's display
1636          * of enlightenment, but hero is dying *before* becoming trapped.
1637          */
1638         set_utrap((unsigned) rn1(6, 2), TT_PIT);
1639         if (!steedintrap(trap, (struct obj *) 0)) {
1640             if (ttype == SPIKED_PIT) {
1641                 oldumort = u.umortality;
1642 #if 0 /*JP:T*/
1643                 losehp(Maybe_Half_Phys(rnd(conj_pit ? 4 : adj_pit ? 6 : 10)),
1644                        /* note: these don't need locomotion() handling;
1645                           if fatal while poly'd and Unchanging, the
1646                           death reason will be overridden with
1647                           "killed while stuck in creature form" */
1648                        plunged
1649                           ? "deliberately plunged into a pit of iron spikes"
1650                           : conj_pit
1651                              ? "stepped into a pit of iron spikes"
1652                              : adj_pit
1653                                 ? "stumbled into a pit of iron spikes"
1654                                 : "fell into a pit of iron spikes",
1655                        NO_KILLER_PREFIX);
1656 #else
1657                 losehp(Maybe_Half_Phys(rnd(conj_pit ? 4 : adj_pit ? 6 : 10)),
1658                        plunged
1659                           ? "\82í\82´\82í\82´\83g\83Q\82¾\82ç\82¯\82Ì\97\8e\82µ\8c\8a\82É\93Ë\93ü\82µ\82Ä"
1660                           : conj_pit
1661                              ? "\83g\83Q\82¾\82ç\82¯\82Ì\97\8e\82µ\8c\8a\82É\93¥\82Ý\8d\9e\82ñ\82Å"
1662                              : adj_pit
1663                                 ? "\83g\83Q\82¾\82ç\82¯\82Ì\97\8e\82µ\8c\8a\82É\82æ\82ë\82ß\82«\97\8e\82¿\82Ä"
1664                                 : "\83g\83Q\82¾\82ç\82¯\82Ì\97\8e\82µ\8c\8a\82É\97\8e\82¿\82Ä",
1665                        KILLED_BY);
1666 #endif
1667                 if (!rn2(6))
1668 #if 0 /*JP:T*/
1669                     poisoned("spikes", A_STR,
1670                              (conj_pit || adj_pit)
1671                                 ? "stepping on poison spikes"
1672                                 : "fall onto poison spikes",
1673                              /* if damage triggered life-saving,
1674                                 poison is limited to attrib loss */
1675                              (u.umortality > oldumort) ? 0 : 8, FALSE);
1676 #else
1677                     poisoned("\83g\83Q", A_STR,
1678                              (conj_pit || adj_pit)
1679                                 ? "\93Å\82Ì\93h\82ç\82ê\82½\83g\83Q\82ð\93¥\82ñ\82Å"
1680                                 : "\93Å\82Ì\93h\82ç\82ê\82½\83g\83Q\82Ì\8fã\82É\97\8e\82¿\82Ä",
1681                              /* if damage triggered life-saving,
1682                                 poison is limited to attrib loss */
1683                              (u.umortality > oldumort) ? 0 : 8, FALSE);
1684 #endif
1685             } else {
1686                 /* plunging flyers take spike damage but not pit damage */
1687                 if (!conj_pit
1688                     && !(plunged && (Flying || is_clinger(youmonst.data))))
1689 #if 0 /*JP:T*/
1690                     losehp(Maybe_Half_Phys(rnd(adj_pit ? 3 : 6)),
1691                            plunged ? "deliberately plunged into a pit"
1692                                    : "fell into a pit",
1693                            NO_KILLER_PREFIX);
1694 #else
1695                     losehp(Maybe_Half_Phys(rnd(adj_pit ? 3 : 6)),
1696                            plunged ? "\82í\82´\82í\82´\97\8e\82µ\8c\8a\82É\93Ë\93ü\82µ\82Ä"
1697                                    : "\97\8e\82µ\8c\8a\82É\97\8e\82¿\82Ä",
1698                            KILLED_BY);
1699 #endif
1700             }
1701             if (Punished && !carried(uball)) {
1702                 unplacebc();
1703                 ballfall();
1704                 placebc();
1705             }
1706             if (!conj_pit)
1707 /*JP
1708                 selftouch("Falling, you");
1709 */
1710                 selftouch("\97\8e\89º\92\86\81C\82 \82È\82½\82Í");
1711             vision_full_recalc = 1; /* vision limits change */
1712             exercise(A_STR, FALSE);
1713             exercise(A_DEX, FALSE);
1714         }
1715         break;
1716
1717     case HOLE:
1718     case TRAPDOOR:
1719         if (!Can_fall_thru(&u.uz)) {
1720             seetrap(trap); /* normally done in fall_through */
1721             impossible("dotrap: %ss cannot exist on this level.",
1722                        defsyms[trap_to_defsym(ttype)].explanation);
1723             break; /* don't activate it after all */
1724         }
1725         fall_through(TRUE);
1726         break;
1727
1728     case TELEP_TRAP:
1729         seetrap(trap);
1730         tele_trap(trap);
1731         break;
1732
1733     case LEVEL_TELEP:
1734         seetrap(trap);
1735         level_tele_trap(trap, trflags);
1736         break;
1737
1738     case WEB: /* Our luckless player has stumbled into a web. */
1739         feeltrap(trap);
1740         if (mu_maybe_destroy_web(&youmonst, webmsgok, trap))
1741             break;
1742         if (webmaker(youmonst.data)) {
1743             if (webmsgok)
1744 #if 0 /*JP*/
1745                 pline(trap->madeby_u ? "You take a walk on your web."
1746                                      : "There is a spider web here.");
1747 #else
1748                 pline(trap->madeby_u ? "\8e©\95ª\82Å\92£\82Á\82½\82­\82à\82Ì\91\83\82Ì\8fã\82ð\95à\82¢\82½\81D"
1749                                      : "\82±\82±\82É\82Í\82­\82à\82Ì\91\83\82ª\82 \82é\81D");
1750 #endif
1751             break;
1752         }
1753         if (webmsgok) {
1754             char verbbuf[BUFSZ];
1755
1756 #if 0 /*JP*/
1757             if (forcetrap || viasitting) {
1758                 Strcpy(verbbuf, "are caught by");
1759             } else if (u.usteed) {
1760                 Sprintf(verbbuf, "lead %s into",
1761                         x_monnam(u.usteed, steed_article, "poor",
1762                                  SUPPRESS_SADDLE, FALSE));
1763             } else {
1764                 Sprintf(verbbuf, "%s into",
1765                         Levitation ? (const char *) "float"
1766                                    : locomotion(youmonst.data, "stumble"));
1767             }
1768             You("%s %s spider web!", verbbuf, a_your[trap->madeby_u]);
1769 #else
1770             if (forcetrap) {
1771                 Strcpy(verbbuf, "\82 \82È\82½\82Í");
1772             } else if (u.usteed) {
1773                 Sprintf(verbbuf, "\82 \82È\82½\82Æ%s",
1774                         x_monnam(u.usteed, steed_article, "\82©\82í\82¢\82»\82¤\82È",
1775                                  SUPPRESS_SADDLE, FALSE));
1776             } else {
1777                 Sprintf(verbbuf, "\82 \82È\82½\82Í%s",
1778                         Levitation ? (const char *) "\95\82\82«\82È\82ª\82ç"
1779                         : jconj(locomotion(youmonst.data, "\82Â\82Ü\82¸\82­"), "\82Ä"));
1780             }
1781             pline("%s%s\82­\82à\82Ì\91\83\82É\82Ð\82Á\82©\82©\82Á\82½\81I", verbbuf, web_you[trap->madeby_u]);
1782 #endif
1783         }
1784
1785         /* time will be adjusted below */
1786         set_utrap(1, TT_WEB);
1787
1788         /* Time stuck in the web depends on your/steed strength. */
1789         {
1790             int tim, str = ACURR(A_STR);
1791
1792             /* If mounted, the steed gets trapped.  Use mintrap
1793              * to do all the work.  If mtrapped is set as a result,
1794              * unset it and set utrap instead.  In the case of a
1795              * strongmonst and mintrap said it's trapped, use a
1796              * short but non-zero trap time.  Otherwise, monsters
1797              * have no specific strength, so use player strength.
1798              * This gets skipped for webmsgok, which implies that
1799              * the steed isn't a factor.
1800              */
1801             if (u.usteed && webmsgok) {
1802                 /* mtmp location might not be up to date */
1803                 u.usteed->mx = u.ux;
1804                 u.usteed->my = u.uy;
1805
1806                 /* mintrap currently does not return 2(died) for webs */
1807                 if (mintrap(u.usteed)) {
1808                     u.usteed->mtrapped = 0;
1809                     if (strongmonst(u.usteed->data))
1810                         str = 17;
1811                 } else {
1812                     reset_utrap(FALSE);
1813                     break;
1814                 }
1815
1816                 webmsgok = FALSE; /* mintrap printed the messages */
1817             }
1818             if (str <= 3)
1819                 tim = rn1(6, 6);
1820             else if (str < 6)
1821                 tim = rn1(6, 4);
1822             else if (str < 9)
1823                 tim = rn1(4, 4);
1824             else if (str < 12)
1825                 tim = rn1(4, 2);
1826             else if (str < 15)
1827                 tim = rn1(2, 2);
1828             else if (str < 18)
1829                 tim = rnd(2);
1830             else if (str < 69)
1831                 tim = 1;
1832             else {
1833                 tim = 0;
1834                 if (webmsgok)
1835 /*JP
1836                     You("tear through %s web!", a_your[trap->madeby_u]);
1837 */
1838                     You("%s\82­\82à\82Ì\91\83\82ð\90Ø\82è\97ô\82¢\82½\81I", web_you[trap->madeby_u]);
1839                 deltrap(trap);
1840                 newsym(u.ux, u.uy); /* get rid of trap symbol */
1841             }
1842             set_utrap((unsigned) tim, TT_WEB);
1843         }
1844         break;
1845
1846     case STATUE_TRAP:
1847         (void) activate_statue_trap(trap, u.ux, u.uy, FALSE);
1848         break;
1849
1850     case MAGIC_TRAP: /* A magic trap. */
1851         seetrap(trap);
1852         if (!rn2(30)) {
1853             deltrap(trap);
1854             newsym(u.ux, u.uy); /* update position */
1855 /*JP
1856             You("are caught in a magical explosion!");
1857 */
1858             You("\96\82\96@\82Ì\94\9a\94­\82ð\97\81\82Ñ\82½\81I");
1859 /*JP
1860             losehp(rnd(10), "magical explosion", KILLED_BY_AN);
1861 */
1862             losehp(rnd(10), "\96\82\96@\82Ì\94\9a\94­\82ð\97\81\82Ñ\82Ä", KILLED_BY_AN);
1863 /*JP
1864             Your("body absorbs some of the magical energy!");
1865 */
1866             Your("\91Ì\82Í\96\82\96@\82Ì\83G\83l\83\8b\83M\81[\82ð\8f­\82µ\8bz\82¢\82Æ\82Á\82½\81I");
1867             u.uen = (u.uenmax += 2);
1868             break;
1869         } else {
1870             domagictrap();
1871         }
1872         (void) steedintrap(trap, (struct obj *) 0);
1873         break;
1874
1875     case ANTI_MAGIC:
1876         seetrap(trap);
1877         /* hero without magic resistance loses spell energy,
1878            hero with magic resistance takes damage instead;
1879            possibly non-intuitive but useful for play balance */
1880         if (!Antimagic) {
1881             drain_en(rnd(u.ulevel) + 1);
1882         } else {
1883             int dmgval2 = rnd(4), hp = Upolyd ? u.mh : u.uhp;
1884
1885             /* Half_XXX_damage has opposite its usual effect (approx)
1886                but isn't cumulative if hero has more than one */
1887             if (Half_physical_damage || Half_spell_damage)
1888                 dmgval2 += rnd(4);
1889             /* give Magicbane wielder dose of own medicine */
1890             if (uwep && uwep->oartifact == ART_MAGICBANE)
1891                 dmgval2 += rnd(4);
1892             /* having an artifact--other than own quest one--which
1893                confers magic resistance simply by being carried
1894                also increases the effect */
1895             for (otmp = invent; otmp; otmp = otmp->nobj)
1896                 if (otmp->oartifact && !is_quest_artifact(otmp)
1897                     && defends_when_carried(AD_MAGM, otmp))
1898                     break;
1899             if (otmp)
1900                 dmgval2 += rnd(4);
1901             if (Passes_walls)
1902                 dmgval2 = (dmgval2 + 3) / 4;
1903
1904 #if 0 /*JP*/
1905             You_feel((dmgval2 >= hp) ? "unbearably torpid!"
1906                                      : (dmgval2 >= hp / 4) ? "very lethargic."
1907                                                            : "sluggish.");
1908 #else
1909             You_feel((dmgval2 >= hp) ? "\91Ï\82¦\82ç\82ê\82È\82¢\82Ù\82Ç\96³\8bC\97Í\82É\82È\82Á\82½\81I"
1910                                      : (dmgval2 >= hp / 4) ? "\82Æ\82Ä\82à\8bC\82¾\82é\82­\82È\82Á\82½\81D"
1911                                                            : "\82à\82Ì\82®\82³\82È\8bC\95ª\82É\82È\82Á\82½\81D");
1912 #endif
1913             /* opposite of magical explosion */
1914 /*JP
1915             losehp(dmgval2, "anti-magic implosion", KILLED_BY_AN);
1916 */
1917             losehp(dmgval2, "\94½\96\82\96@\82Ì\93à\95\94\94j\97ô\82Å", KILLED_BY_AN);
1918         }
1919         break;
1920
1921     case POLY_TRAP: {
1922         char verbbuf[BUFSZ];
1923
1924         seetrap(trap);
1925         if (viasitting)
1926 #if 0 /*JP*/
1927             Strcpy(verbbuf, "trigger"); /* follows "You sit down." */
1928 #else
1929             Strcpy(verbbuf, "\82ð\88ø\82«\8bN\82±\82µ\82½"); /* follows "You sit down." */
1930 #endif
1931         else if (u.usteed)
1932 #if 0 /*JP*/
1933             Sprintf(verbbuf, "lead %s onto",
1934                     x_monnam(u.usteed, steed_article, (char *) 0,
1935                              SUPPRESS_SADDLE, FALSE));
1936 #else
1937             Sprintf(verbbuf, "\82É%s\82Æ\82Æ\82à\82É\94ò\82Ñ\8d\9e\82ñ\82¾",
1938                     x_monnam(u.usteed, steed_article, (char *) 0,
1939                              SUPPRESS_SADDLE, FALSE));
1940 #endif
1941         else
1942 #if 0 /*JP*/
1943             Sprintf(verbbuf, "%s onto",
1944                     Levitation ? (const char *) "float"
1945                                : locomotion(youmonst.data, "step"));
1946 #else
1947             Sprintf(verbbuf,"\82É%s",
1948                     jpast(Levitation ? (const char *)"\95\82\82«\82È\82ª\82ç\94ò\82Ñ\82±\82Þ"
1949                           : locomotion(youmonst.data, "\93¥\82Ý\8d\9e\82Þ")));
1950 #endif
1951 /*JP
1952         You("%s a polymorph trap!", verbbuf);
1953 */
1954         You("\95Ï\89»\82Ìã©%s\81I", verbbuf);
1955         if (Antimagic || Unchanging) {
1956             shieldeff(u.ux, u.uy);
1957 /*JP
1958             You_feel("momentarily different.");
1959 */
1960             You("\88ê\8fu\88á\82Á\82½\8a´\82\82ª\82µ\82½\81D");
1961             /* Trap did nothing; don't remove it --KAA */
1962         } else {
1963             (void) steedintrap(trap, (struct obj *) 0);
1964             deltrap(trap);      /* delete trap before polymorph */
1965             newsym(u.ux, u.uy); /* get rid of trap symbol */
1966 /*JP
1967             You_feel("a change coming over you.");
1968 */
1969             You("\95Ï\89»\82ª\96K\82ê\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1970             polyself(0);
1971         }
1972         break;
1973     }
1974     case LANDMINE: {
1975         unsigned steed_mid = 0;
1976         struct obj *saddle = 0;
1977
1978         if ((Levitation || Flying) && !forcetrap) {
1979             if (!already_seen && rn2(3))
1980                 break;
1981             feeltrap(trap);
1982 #if 0 /*JP*/
1983             pline("%s %s in a pile of soil below you.",
1984                   already_seen ? "There is" : "You discover",
1985                   trap->madeby_u ? "the trigger of your mine" : "a trigger");
1986 #else
1987             if(already_seen)
1988                 pline("\82±\82±\82É\82Í%s\92n\97\8b\82Ì\8bN\94\9a\83X\83C\83b\83`\82ª\82 \82é\81D",
1989                       set_you[trap->madeby_u]);
1990             else
1991                 You("\91«\89º\82Ì\93y\82Ì\8eR\82É%s\92n\97\8b\82Ì\8bN\94\9a\83X\83C\83b\83`\82ð\82Ý\82Â\82¯\82½\81D",
1992                     set_you[trap->madeby_u]);
1993 #endif
1994             if (already_seen && rn2(3))
1995                 break;
1996 #if 0 /*JP*/
1997             pline("KAABLAMM!!!  %s %s%s off!",
1998                   forcebungle ? "Your inept attempt sets"
1999                               : "The air currents set",
2000                   already_seen ? a_your[trap->madeby_u] : "",
2001                   already_seen ? " land mine" : "it");
2002 #else
2003             pline("\82¿\82ã\82Ç\81[\82ñ\81I\81I%s%s%s\8bN\94\9a\83X\83C\83b\83`\82ª\94­\93®\82µ\82½\81I",
2004                   forcebungle ? "\95s\8aí\97p\82È\82¹\82¢\82Å"
2005                               : "\8bó\8bC\82Ì\97¬\82ê\82Å",
2006                   already_seen ? set_you[trap->madeby_u] : "",
2007                   already_seen ? "\92n\97\8b\82Ì" : "");
2008 #endif
2009         } else {
2010             /* prevent landmine from killing steed, throwing you to
2011              * the ground, and you being affected again by the same
2012              * mine because it hasn't been deleted yet
2013              */
2014             static boolean recursive_mine = FALSE;
2015
2016             if (recursive_mine)
2017                 break;
2018             feeltrap(trap);
2019 #if 0 /*JP*/
2020             pline("KAABLAMM!!!  You triggered %s land mine!",
2021                   a_your[trap->madeby_u]);
2022 #else
2023             pline("\82¿\82ã\82Ç\81[\82ñ\81I\81I%s\92n\97\8b\82Ì\8bN\94\9a\83X\83C\83b\83`\82ð\93¥\82ñ\82¾\81I",
2024                   set_you[trap->madeby_u]);
2025 #endif
2026             if (u.usteed)
2027                 steed_mid = u.usteed->m_id;
2028             recursive_mine = TRUE;
2029             (void) steedintrap(trap, (struct obj *) 0);
2030             recursive_mine = FALSE;
2031             saddle = sobj_at(SADDLE, u.ux, u.uy);
2032             set_wounded_legs(LEFT_SIDE, rn1(35, 41));
2033             set_wounded_legs(RIGHT_SIDE, rn1(35, 41));
2034             exercise(A_DEX, FALSE);
2035         }
2036         blow_up_landmine(trap);
2037         if (steed_mid && saddle && !u.usteed)
2038             (void) keep_saddle_with_steedcorpse(steed_mid, fobj, saddle);
2039         newsym(u.ux, u.uy); /* update trap symbol */
2040 /*JP
2041         losehp(Maybe_Half_Phys(rnd(16)), "land mine", KILLED_BY_AN);
2042 */
2043         losehp(Maybe_Half_Phys(rnd(16)), "\92n\97\8b\82ð\93¥\82ñ\82Å", KILLED_BY_AN);
2044         /* fall recursively into the pit... */
2045         if ((trap = t_at(u.ux, u.uy)) != 0)
2046             dotrap(trap, RECURSIVETRAP);
2047         fill_pit(u.ux, u.uy);
2048         break;
2049     }
2050
2051     case ROLLING_BOULDER_TRAP: {
2052         int style = ROLL | (trap->tseen ? LAUNCH_KNOWN : 0);
2053
2054         feeltrap(trap);
2055 /*JP
2056         pline("Click!  You trigger a rolling boulder trap!");
2057 */
2058         pline("\83J\83`\83b\81I\82 \82È\82½\82Í\8b\90\8aâ\82Ìã©\82Ì\83X\83C\83b\83`\82ð\93¥\82ñ\82¾\81I");
2059         if (!launch_obj(BOULDER, trap->launch.x, trap->launch.y,
2060                         trap->launch2.x, trap->launch2.y, style)) {
2061             deltrap(trap);
2062             newsym(u.ux, u.uy); /* get rid of trap symbol */
2063 /*JP
2064             pline("Fortunately for you, no boulder was released.");
2065 */
2066             pline("\89^\82Ì\82æ\82¢\82±\82Æ\82É\8aâ\82Í\93]\82ª\82Á\82Ä\82±\82È\82©\82Á\82½\81D");
2067         }
2068         break;
2069     }
2070
2071     case MAGIC_PORTAL:
2072         feeltrap(trap);
2073         domagicportal(trap);
2074         break;
2075
2076     case VIBRATING_SQUARE:
2077         feeltrap(trap);
2078         /* messages handled elsewhere; the trap symbol is merely to mark the
2079          * square for future reference */
2080         break;
2081
2082     default:
2083         feeltrap(trap);
2084         impossible("You hit a trap of type %u", trap->ttyp);
2085     }
2086 }
2087
2088 STATIC_OVL char *
2089 trapnote(trap, noprefix)
2090 struct trap *trap;
2091 boolean noprefix;
2092 {
2093     static char tnbuf[12];
2094     const char *tn,
2095 #if 0 /*JP*/
2096         *tnnames[12] = { "C note",  "D flat", "D note",  "E flat",
2097                          "E note",  "F note", "F sharp", "G note",
2098                          "G sharp", "A note", "B flat",  "B note" };
2099 #else
2100         *tnnames[12] = { "\83h",  "\83\8c\81ó", "\83\8c",  "\83~\81ó",
2101                          "\83~",  "\83t\83@", "\83t\83@\81ò", "\83\",
2102                          "\83\\81ò", "\83\89", "\83V\81ó",  "\83V" };
2103 #endif
2104
2105     tnbuf[0] = '\0';
2106     tn = tnnames[trap->tnote];
2107 #if 0 /*JP*/
2108     if (!noprefix)
2109         Sprintf(tnbuf, "%s ",
2110                 (*tn == 'A' || *tn == 'E' || *tn == 'F') ? "an" : "a");
2111     Sprintf(eos(tnbuf), "%s", tn);
2112 #else
2113     Sprintf(tnbuf, "%s\82Ì\89¹", tn);
2114 #endif
2115     return tnbuf;
2116 }
2117
2118 STATIC_OVL int
2119 steedintrap(trap, otmp)
2120 struct trap *trap;
2121 struct obj *otmp;
2122 {
2123     struct monst *steed = u.usteed;
2124     int tt;
2125     boolean trapkilled, steedhit;
2126
2127     if (!steed || !trap)
2128         return 0;
2129     tt = trap->ttyp;
2130     steed->mx = u.ux;
2131     steed->my = u.uy;
2132     trapkilled = steedhit = FALSE;
2133
2134     switch (tt) {
2135     case ARROW_TRAP:
2136         if (!otmp) {
2137             impossible("steed hit by non-existant arrow?");
2138             return 0;
2139         }
2140         trapkilled = thitm(8, steed, otmp, 0, FALSE);
2141         steedhit = TRUE;
2142         break;
2143     case DART_TRAP:
2144         if (!otmp) {
2145             impossible("steed hit by non-existant dart?");
2146             return 0;
2147         }
2148         trapkilled = thitm(7, steed, otmp, 0, FALSE);
2149         steedhit = TRUE;
2150         break;
2151     case SLP_GAS_TRAP:
2152         if (!resists_sleep(steed) && !breathless(steed->data)
2153             && !steed->msleeping && steed->mcanmove) {
2154             if (sleep_monst(steed, rnd(25), -1))
2155                 /* no in_sight check here; you can feel it even if blind */
2156 /*JP
2157                 pline("%s suddenly falls asleep!", Monnam(steed));
2158 */
2159                 pline("%s\82Í\82Æ\82Â\82º\82ñ\96°\82Á\82Ä\82µ\82Ü\82Á\82½\81I", Monnam(steed));
2160         }
2161         steedhit = TRUE;
2162         break;
2163     case LANDMINE:
2164         trapkilled = thitm(0, steed, (struct obj *) 0, rnd(16), FALSE);
2165         steedhit = TRUE;
2166         break;
2167     case PIT:
2168     case SPIKED_PIT:
2169         trapkilled = (DEADMONSTER(steed)
2170                       || thitm(0, steed, (struct obj *) 0,
2171                                rnd((tt == PIT) ? 6 : 10), FALSE));
2172         steedhit = TRUE;
2173         break;
2174     case POLY_TRAP:
2175         if (!resists_magm(steed) && !resist(steed, WAND_CLASS, 0, NOTELL)) {
2176             (void) newcham(steed, (struct permonst *) 0, FALSE, FALSE);
2177             if (!can_saddle(steed) || !can_ride(steed))
2178                 dismount_steed(DISMOUNT_POLY);
2179             else
2180 /*JP
2181                 You("have to adjust yourself in the saddle on %s.",
2182 */
2183                 You("%s\82Ì\88Æ\82Ì\8fã\82Å\8dÀ\82è\82È\82¨\82µ\82½\81D",
2184                     x_monnam(steed, ARTICLE_A, (char *) 0, SUPPRESS_SADDLE,
2185                              FALSE));
2186         }
2187         steedhit = TRUE;
2188         break;
2189     default:
2190         break;
2191     }
2192
2193     if (trapkilled) {
2194         dismount_steed(DISMOUNT_POLY);
2195         return 2;
2196     }
2197     return steedhit ? 1 : 0;
2198 }
2199
2200 /* some actions common to both player and monsters for triggered landmine */
2201 void
2202 blow_up_landmine(trap)
2203 struct trap *trap;
2204 {
2205     int x = trap->tx, y = trap->ty, dbx, dby;
2206     struct rm *lev = &levl[x][y];
2207
2208     (void) scatter(x, y, 4,
2209                    MAY_DESTROY | MAY_HIT | MAY_FRACTURE | VIS_EFFECTS,
2210                    (struct obj *) 0);
2211     del_engr_at(x, y);
2212     wake_nearto(x, y, 400);
2213     if (IS_DOOR(lev->typ))
2214         lev->doormask = D_BROKEN;
2215     /* destroy drawbridge if present */
2216     if (lev->typ == DRAWBRIDGE_DOWN || is_drawbridge_wall(x, y) >= 0) {
2217         dbx = x, dby = y;
2218         /* if under the portcullis, the bridge is adjacent */
2219         if (find_drawbridge(&dbx, &dby))
2220             destroy_drawbridge(dbx, dby);
2221         trap = t_at(x, y); /* expected to be null after destruction */
2222     }
2223     /* convert landmine into pit */
2224     if (trap) {
2225         if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz)) {
2226             /* no pits here */
2227             deltrap(trap);
2228         } else {
2229             trap->ttyp = PIT;       /* explosion creates a pit */
2230             trap->madeby_u = FALSE; /* resulting pit isn't yours */
2231             seetrap(trap);          /* and it isn't concealed */
2232         }
2233     }
2234 }
2235
2236 /*
2237  * The following are used to track launched objects to
2238  * prevent them from vanishing if you are killed. They
2239  * will reappear at the launchplace in bones files.
2240  */
2241 static struct {
2242     struct obj *obj;
2243     xchar x, y;
2244 } launchplace;
2245
2246 STATIC_OVL void
2247 launch_drop_spot(obj, x, y)
2248 struct obj *obj;
2249 xchar x, y;
2250 {
2251     if (!obj) {
2252         launchplace.obj = (struct obj *) 0;
2253         launchplace.x = 0;
2254         launchplace.y = 0;
2255     } else {
2256         launchplace.obj = obj;
2257         launchplace.x = x;
2258         launchplace.y = y;
2259     }
2260 }
2261
2262 boolean
2263 launch_in_progress()
2264 {
2265     if (launchplace.obj)
2266         return TRUE;
2267     return FALSE;
2268 }
2269
2270 void
2271 force_launch_placement()
2272 {
2273     if (launchplace.obj) {
2274         launchplace.obj->otrapped = 0;
2275         place_object(launchplace.obj, launchplace.x, launchplace.y);
2276     }
2277 }
2278
2279 /*
2280  * Move obj from (x1,y1) to (x2,y2)
2281  *
2282  * Return 0 if no object was launched.
2283  *        1 if an object was launched and placed somewhere.
2284  *        2 if an object was launched, but used up.
2285  */
2286 int
2287 launch_obj(otyp, x1, y1, x2, y2, style)
2288 short otyp;
2289 register int x1, y1, x2, y2;
2290 int style;
2291 {
2292     register struct monst *mtmp;
2293     register struct obj *otmp, *otmp2;
2294     register int dx, dy;
2295     struct obj *singleobj;
2296     boolean used_up = FALSE;
2297     boolean otherside = FALSE;
2298     int dist;
2299     int tmp;
2300     int delaycnt = 0;
2301
2302     otmp = sobj_at(otyp, x1, y1);
2303     /* Try the other side too, for rolling boulder traps */
2304     if (!otmp && otyp == BOULDER) {
2305         otherside = TRUE;
2306         otmp = sobj_at(otyp, x2, y2);
2307     }
2308     if (!otmp)
2309         return 0;
2310     if (otherside) { /* swap 'em */
2311         int tx, ty;
2312
2313         tx = x1;
2314         ty = y1;
2315         x1 = x2;
2316         y1 = y2;
2317         x2 = tx;
2318         y2 = ty;
2319     }
2320
2321     if (otmp->quan == 1L) {
2322         obj_extract_self(otmp);
2323         singleobj = otmp;
2324         otmp = (struct obj *) 0;
2325     } else {
2326         singleobj = splitobj(otmp, 1L);
2327         obj_extract_self(singleobj);
2328     }
2329     newsym(x1, y1);
2330     /* in case you're using a pick-axe to chop the boulder that's being
2331        launched (perhaps a monster triggered it), destroy context so that
2332        next dig attempt never thinks you're resuming previous effort */
2333     if ((otyp == BOULDER || otyp == STATUE)
2334         && singleobj->ox == context.digging.pos.x
2335         && singleobj->oy == context.digging.pos.y)
2336         (void) memset((genericptr_t) &context.digging, 0,
2337                       sizeof(struct dig_info));
2338
2339     dist = distmin(x1, y1, x2, y2);
2340     bhitpos.x = x1;
2341     bhitpos.y = y1;
2342     dx = sgn(x2 - x1);
2343     dy = sgn(y2 - y1);
2344     switch (style) {
2345     case ROLL | LAUNCH_UNSEEN:
2346         if (otyp == BOULDER) {
2347 #if 0 /*JP*/
2348             You_hear(Hallucination ? "someone bowling."
2349                                    : "rumbling in the distance.");
2350 #else
2351             You_hear(Hallucination ? "\92N\82©\82ª\83{\81[\83\8a\83\93\83O\82ð\82µ\82Ä\82¢\82é\89¹\82ð\95·\82¢\82½\81D"
2352                                    : "\89\93\82­\82Ì\83S\83\8d\83S\83\8d\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D");
2353 #endif
2354         }
2355         style &= ~LAUNCH_UNSEEN;
2356         goto roll;
2357     case ROLL | LAUNCH_KNOWN:
2358         /* use otrapped as a flag to ohitmon */
2359         singleobj->otrapped = 1;
2360         style &= ~LAUNCH_KNOWN;
2361     /* fall through */
2362     roll:
2363     case ROLL:
2364         delaycnt = 2;
2365     /* fall through */
2366     default:
2367         if (!delaycnt)
2368             delaycnt = 1;
2369         if (!cansee(bhitpos.x, bhitpos.y))
2370             curs_on_u();
2371         tmp_at(DISP_FLASH, obj_to_glyph(singleobj, rn2_on_display_rng));
2372         tmp_at(bhitpos.x, bhitpos.y);
2373     }
2374     /* Mark a spot to place object in bones files to prevent
2375      * loss of object. Use the starting spot to ensure that
2376      * a rolling boulder will still launch, which it wouldn't
2377      * do if left midstream. Unfortunately we can't use the
2378      * target resting spot, because there are some things/situations
2379      * that would prevent it from ever getting there (bars), and we
2380      * can't tell that yet.
2381      */
2382     launch_drop_spot(singleobj, bhitpos.x, bhitpos.y);
2383
2384     /* Set the object in motion */
2385     while (dist-- > 0 && !used_up) {
2386         struct trap *t;
2387         tmp_at(bhitpos.x, bhitpos.y);
2388         tmp = delaycnt;
2389
2390         /* dstage@u.washington.edu -- Delay only if hero sees it */
2391         if (cansee(bhitpos.x, bhitpos.y))
2392             while (tmp-- > 0)
2393                 delay_output();
2394
2395         bhitpos.x += dx;
2396         bhitpos.y += dy;
2397         t = t_at(bhitpos.x, bhitpos.y);
2398
2399         if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) {
2400             if (otyp == BOULDER && throws_rocks(mtmp->data)) {
2401                 if (rn2(3)) {
2402                     if (cansee(bhitpos.x, bhitpos.y))
2403 /*JP
2404                     pline("%s snatches the boulder.", Monnam(mtmp));
2405 */
2406                     pline("%s\82Í\8aâ\82ð\82Â\82©\82Ý\8eæ\82Á\82½\81D", Monnam(mtmp));
2407                     singleobj->otrapped = 0;
2408                     (void) mpickobj(mtmp, singleobj);
2409                     used_up = TRUE;
2410                     launch_drop_spot((struct obj *) 0, 0, 0);
2411                     break;
2412                 }
2413             }
2414             if (ohitmon(mtmp, singleobj, (style == ROLL) ? -1 : dist,
2415                         FALSE)) {
2416                 used_up = TRUE;
2417                 launch_drop_spot((struct obj *) 0, 0, 0);
2418                 break;
2419             }
2420         } else if (bhitpos.x == u.ux && bhitpos.y == u.uy) {
2421             if (multi)
2422                 nomul(0);
2423             if (thitu(9 + singleobj->spe, dmgval(singleobj, &youmonst),
2424                       &singleobj, (char *) 0))
2425                 stop_occupation();
2426         }
2427         if (style == ROLL) {
2428             if (down_gate(bhitpos.x, bhitpos.y) != -1) {
2429                 if (ship_object(singleobj, bhitpos.x, bhitpos.y, FALSE)) {
2430                     used_up = TRUE;
2431                     launch_drop_spot((struct obj *) 0, 0, 0);
2432                     break;
2433                 }
2434             }
2435             if (t && otyp == BOULDER) {
2436                 switch (t->ttyp) {
2437                 case LANDMINE:
2438                     if (rn2(10) > 2) {
2439 #if 0 /*JP*/
2440                         pline(
2441                             "KAABLAMM!!!%s",
2442                             cansee(bhitpos.x, bhitpos.y)
2443                                 ? " The rolling boulder triggers a land mine."
2444                                 : "");
2445 #else
2446                         pline(
2447                             "\82¿\82ã\82Ç\81[\82ñ\81I\81I%s",
2448                             cansee(bhitpos.x, bhitpos.y)
2449                                 ? "\93]\82ª\82Á\82Ä\82«\82½\8aâ\82ª\92n\97\8b\82Ì\8bN\94\9a\83X\83C\83b\83`\82ð\93¥\82ñ\82¾\81D"
2450                                 : "");
2451 #endif
2452                         deltrap(t);
2453                         del_engr_at(bhitpos.x, bhitpos.y);
2454                         place_object(singleobj, bhitpos.x, bhitpos.y);
2455                         singleobj->otrapped = 0;
2456                         fracture_rock(singleobj);
2457                         (void) scatter(bhitpos.x, bhitpos.y, 4,
2458                                        MAY_DESTROY | MAY_HIT | MAY_FRACTURE
2459                                            | VIS_EFFECTS,
2460                                        (struct obj *) 0);
2461                         if (cansee(bhitpos.x, bhitpos.y))
2462                             newsym(bhitpos.x, bhitpos.y);
2463                         used_up = TRUE;
2464                         launch_drop_spot((struct obj *) 0, 0, 0);
2465                     }
2466                     break;
2467                 case LEVEL_TELEP:
2468                 case TELEP_TRAP:
2469                     if (cansee(bhitpos.x, bhitpos.y))
2470 /*JP
2471                         pline("Suddenly the rolling boulder disappears!");
2472 */
2473                         pline("\93]\82ª\82Á\82Ä\82«\82½\8aâ\82ª\82Æ\82Â\82º\82ñ\8fÁ\82¦\82½\81I");
2474                     else
2475 /*JP
2476                         You_hear("a rumbling stop abruptly.");
2477 */
2478                         pline("\83S\83\8d\83S\83\8d\82Æ\82¢\82¤\89¹\82ª\93Ë\91R\8e~\82Ü\82Á\82½\81D");
2479                     singleobj->otrapped = 0;
2480                     if (t->ttyp == TELEP_TRAP)
2481                         (void) rloco(singleobj);
2482                     else {
2483                         int newlev = random_teleport_level();
2484                         d_level dest;
2485
2486                         if (newlev == depth(&u.uz) || In_endgame(&u.uz))
2487                             continue;
2488                         add_to_migration(singleobj);
2489                         get_level(&dest, newlev);
2490                         singleobj->ox = dest.dnum;
2491                         singleobj->oy = dest.dlevel;
2492                         singleobj->owornmask = (long) MIGR_RANDOM;
2493                     }
2494                     seetrap(t);
2495                     used_up = TRUE;
2496                     launch_drop_spot((struct obj *) 0, 0, 0);
2497                     break;
2498                 case PIT:
2499                 case SPIKED_PIT:
2500                 case HOLE:
2501                 case TRAPDOOR:
2502                     /* the boulder won't be used up if there is a
2503                        monster in the trap; stop rolling anyway */
2504                     x2 = bhitpos.x, y2 = bhitpos.y; /* stops here */
2505 /*JP
2506                     if (flooreffects(singleobj, x2, y2, "fall")) {
2507 */
2508                     if (flooreffects(singleobj, x2, y2, "\97\8e\82¿\82é")) {
2509                         used_up = TRUE;
2510                         launch_drop_spot((struct obj *) 0, 0, 0);
2511                     }
2512                     dist = -1; /* stop rolling immediately */
2513                     break;
2514                 }
2515                 if (used_up || dist == -1)
2516                     break;
2517             }
2518 /*JP
2519             if (flooreffects(singleobj, bhitpos.x, bhitpos.y, "fall")) {
2520 */
2521             if (flooreffects(singleobj, bhitpos.x, bhitpos.y, "\97\8e\82¿\82é")) {
2522                 used_up = TRUE;
2523                 launch_drop_spot((struct obj *) 0, 0, 0);
2524                 break;
2525             }
2526             if (otyp == BOULDER
2527                 && (otmp2 = sobj_at(BOULDER, bhitpos.x, bhitpos.y)) != 0) {
2528 /*JP
2529                 const char *bmsg = " as one boulder sets another in motion";
2530 */
2531                 const char *bmsg = "\82Ð\82Æ\82Â\82Ì\8aâ\82ª\91¼\82Ì\8aâ\82ð\93®\82©\82µ\82½\82©\82Ì\82æ\82¤\82È\81C";
2532
2533                 if (!isok(bhitpos.x + dx, bhitpos.y + dy) || !dist
2534                     || IS_ROCK(levl[bhitpos.x + dx][bhitpos.y + dy].typ))
2535 /*JP
2536                     bmsg = " as one boulder hits another";
2537 */
2538                     bmsg = "\82Ð\82Æ\82Â\82Ì\8aâ\82ª\91¼\82Ì\8aâ\82É\93\96\82½\82Á\82½\82æ\82¤\82È";
2539
2540 /*JP
2541                 You_hear("a loud crash%s!",
2542 */
2543                 You_hear("%s\91å\82«\82È\83S\83\93\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81I",
2544                          cansee(bhitpos.x, bhitpos.y) ? bmsg : "");
2545                 obj_extract_self(otmp2);
2546                 /* pass off the otrapped flag to the next boulder */
2547                 otmp2->otrapped = singleobj->otrapped;
2548                 singleobj->otrapped = 0;
2549                 place_object(singleobj, bhitpos.x, bhitpos.y);
2550                 singleobj = otmp2;
2551                 otmp2 = (struct obj *) 0;
2552                 wake_nearto(bhitpos.x, bhitpos.y, 10 * 10);
2553             }
2554         }
2555         if (otyp == BOULDER && closed_door(bhitpos.x, bhitpos.y)) {
2556             if (cansee(bhitpos.x, bhitpos.y))
2557 /*JP
2558                 pline_The("boulder crashes through a door.");
2559 */
2560                 pline("\8aâ\82Í\94à\82ð\94j\89ó\82µ\82½\81D");
2561             levl[bhitpos.x][bhitpos.y].doormask = D_BROKEN;
2562             if (dist)
2563                 unblock_point(bhitpos.x, bhitpos.y);
2564         }
2565
2566         /* if about to hit iron bars, do so now */
2567         if (dist > 0 && isok(bhitpos.x + dx, bhitpos.y + dy)
2568             && levl[bhitpos.x + dx][bhitpos.y + dy].typ == IRONBARS) {
2569             x2 = bhitpos.x, y2 = bhitpos.y; /* object stops here */
2570             if (hits_bars(&singleobj,
2571                           x2, y2, x2+dx, y2+dy,
2572                           !rn2(20), 0)) {
2573                 if (!singleobj) {
2574                     used_up = TRUE;
2575                     launch_drop_spot((struct obj *) 0, 0, 0);
2576                 }
2577                 break;
2578             }
2579         }
2580     }
2581     tmp_at(DISP_END, 0);
2582     launch_drop_spot((struct obj *) 0, 0, 0);
2583     if (!used_up) {
2584         singleobj->otrapped = 0;
2585         place_object(singleobj, x2, y2);
2586         newsym(x2, y2);
2587         return 1;
2588     } else
2589         return 2;
2590 }
2591
2592 void
2593 seetrap(trap)
2594 struct trap *trap;
2595 {
2596     if (!trap->tseen) {
2597         trap->tseen = 1;
2598         newsym(trap->tx, trap->ty);
2599     }
2600 }
2601
2602 /* like seetrap() but overrides vision */
2603 void
2604 feeltrap(trap)
2605 struct trap *trap;
2606 {
2607     trap->tseen = 1;
2608     map_trap(trap, 1);
2609     /* in case it's beneath something, redisplay the something */
2610     newsym(trap->tx, trap->ty);
2611 }
2612
2613 STATIC_OVL int
2614 mkroll_launch(ttmp, x, y, otyp, ocount)
2615 struct trap *ttmp;
2616 xchar x, y;
2617 short otyp;
2618 long ocount;
2619 {
2620     struct obj *otmp;
2621     register int tmp;
2622     schar dx, dy;
2623     int distance;
2624     coord cc;
2625     coord bcc;
2626     int trycount = 0;
2627     boolean success = FALSE;
2628     int mindist = 4;
2629
2630     if (ttmp->ttyp == ROLLING_BOULDER_TRAP)
2631         mindist = 2;
2632     distance = rn1(5, 4); /* 4..8 away */
2633     tmp = rn2(8);         /* randomly pick a direction to try first */
2634     while (distance >= mindist) {
2635         dx = xdir[tmp];
2636         dy = ydir[tmp];
2637         cc.x = x;
2638         cc.y = y;
2639         /* Prevent boulder from being placed on water */
2640         if (ttmp->ttyp == ROLLING_BOULDER_TRAP
2641             && is_pool_or_lava(x + distance * dx, y + distance * dy))
2642             success = FALSE;
2643         else
2644             success = isclearpath(&cc, distance, dx, dy);
2645         if (ttmp->ttyp == ROLLING_BOULDER_TRAP) {
2646             boolean success_otherway;
2647
2648             bcc.x = x;
2649             bcc.y = y;
2650             success_otherway = isclearpath(&bcc, distance, -(dx), -(dy));
2651             if (!success_otherway)
2652                 success = FALSE;
2653         }
2654         if (success)
2655             break;
2656         if (++tmp > 7)
2657             tmp = 0;
2658         if ((++trycount % 8) == 0)
2659             --distance;
2660     }
2661     if (!success) {
2662         /* create the trap without any ammo, launch pt at trap location */
2663         cc.x = bcc.x = x;
2664         cc.y = bcc.y = y;
2665     } else {
2666         otmp = mksobj(otyp, TRUE, FALSE);
2667         otmp->quan = ocount;
2668         otmp->owt = weight(otmp);
2669         place_object(otmp, cc.x, cc.y);
2670         stackobj(otmp);
2671     }
2672     ttmp->launch.x = cc.x;
2673     ttmp->launch.y = cc.y;
2674     if (ttmp->ttyp == ROLLING_BOULDER_TRAP) {
2675         ttmp->launch2.x = bcc.x;
2676         ttmp->launch2.y = bcc.y;
2677     } else
2678         ttmp->launch_otyp = otyp;
2679     newsym(ttmp->launch.x, ttmp->launch.y);
2680     return 1;
2681 }
2682
2683 STATIC_OVL boolean
2684 isclearpath(cc, distance, dx, dy)
2685 coord *cc;
2686 int distance;
2687 schar dx, dy;
2688 {
2689     uchar typ;
2690     xchar x, y;
2691
2692     x = cc->x;
2693     y = cc->y;
2694     while (distance-- > 0) {
2695         x += dx;
2696         y += dy;
2697         typ = levl[x][y].typ;
2698         if (!isok(x, y) || !ZAP_POS(typ) || closed_door(x, y))
2699             return FALSE;
2700     }
2701     cc->x = x;
2702     cc->y = y;
2703     return TRUE;
2704 }
2705
2706 int
2707 mintrap(mtmp)
2708 register struct monst *mtmp;
2709 {
2710     register struct trap *trap = t_at(mtmp->mx, mtmp->my);
2711     boolean trapkilled = FALSE;
2712     struct permonst *mptr = mtmp->data;
2713     struct obj *otmp;
2714
2715     if (!trap) {
2716         mtmp->mtrapped = 0;      /* perhaps teleported? */
2717     } else if (mtmp->mtrapped) { /* is currently in the trap */
2718         if (!trap->tseen && cansee(mtmp->mx, mtmp->my) && canseemon(mtmp)
2719             && (is_pit(trap->ttyp) || trap->ttyp == BEAR_TRAP
2720                 || trap->ttyp == HOLE
2721                 || trap->ttyp == WEB)) {
2722             /* If you come upon an obviously trapped monster, then
2723              * you must be able to see the trap it's in too.
2724              */
2725             seetrap(trap);
2726         }
2727
2728         if (!rn2(40)) {
2729             if (sobj_at(BOULDER, mtmp->mx, mtmp->my)
2730                 && is_pit(trap->ttyp)) {
2731                 if (!rn2(2)) {
2732                     mtmp->mtrapped = 0;
2733                     if (canseemon(mtmp))
2734 /*JP
2735                         pline("%s pulls free...", Monnam(mtmp));
2736 */
2737                         pline("%s\82Í\8f\95\82¯\8fã\82°\82ç\82ê\82½\81D", Monnam(mtmp));
2738                     fill_pit(mtmp->mx, mtmp->my);
2739                 }
2740             } else {
2741                 mtmp->mtrapped = 0;
2742             }
2743         } else if (metallivorous(mptr)) {
2744             if (trap->ttyp == BEAR_TRAP) {
2745                 if (canseemon(mtmp))
2746 /*JP
2747                     pline("%s eats a bear trap!", Monnam(mtmp));
2748 */
2749                     pline("%s\82Í\8cF\82Ìã©\82ð\90H\82×\82½\81I", Monnam(mtmp));
2750                 deltrap(trap);
2751                 mtmp->meating = 5;
2752                 mtmp->mtrapped = 0;
2753             } else if (trap->ttyp == SPIKED_PIT) {
2754                 if (canseemon(mtmp))
2755 /*JP
2756                     pline("%s munches on some spikes!", Monnam(mtmp));
2757 */
2758                     pline("%s\82Í\83g\83Q\83g\83Q\82ð\90H\82×\82½\81I", Monnam(mtmp));
2759                 trap->ttyp = PIT;
2760                 mtmp->meating = 5;
2761             }
2762         }
2763     } else {
2764         register int tt = trap->ttyp;
2765         boolean in_sight, tear_web, see_it,
2766             inescapable = force_mintrap || ((tt == HOLE || tt == PIT)
2767                                             && Sokoban && !trap->madeby_u);
2768         const char *fallverb;
2769
2770         /* true when called from dotrap, inescapable is not an option */
2771         if (mtmp == u.usteed)
2772             inescapable = TRUE;
2773         if (!inescapable && ((mtmp->mtrapseen & (1 << (tt - 1))) != 0
2774                              || (tt == HOLE && !mindless(mptr)))) {
2775             /* it has been in such a trap - perhaps it escapes */
2776             if (rn2(4))
2777                 return 0;
2778         } else {
2779             mtmp->mtrapseen |= (1 << (tt - 1));
2780         }
2781         /* Monster is aggravated by being trapped by you.
2782            Recognizing who made the trap isn't completely
2783            unreasonable; everybody has their own style. */
2784         if (trap->madeby_u && rnl(5))
2785             setmangry(mtmp, TRUE);
2786
2787         in_sight = canseemon(mtmp);
2788         see_it = cansee(mtmp->mx, mtmp->my);
2789         /* assume hero can tell what's going on for the steed */
2790         if (mtmp == u.usteed)
2791             in_sight = TRUE;
2792         switch (tt) {
2793         case ARROW_TRAP:
2794             if (trap->once && trap->tseen && !rn2(15)) {
2795                 if (in_sight && see_it)
2796 #if 0 /*JP:T*/
2797                     pline("%s triggers a trap but nothing happens.",
2798                           Monnam(mtmp));
2799 #else
2800                     pline("%s\82ª\82í\82È\82ð\8bN\93®\82³\82¹\82½\82ª\89½\82à\8bN\82±\82ç\82È\82©\82Á\82½\81D",
2801                           Monnam(mtmp));
2802 #endif
2803                 deltrap(trap);
2804                 newsym(mtmp->mx, mtmp->my);
2805                 break;
2806             }
2807             trap->once = 1;
2808             otmp = t_missile(ARROW, trap);
2809             if (in_sight)
2810                 seetrap(trap);
2811             if (thitm(8, mtmp, otmp, 0, FALSE))
2812                 trapkilled = TRUE;
2813             break;
2814         case DART_TRAP:
2815             if (trap->once && trap->tseen && !rn2(15)) {
2816                 if (in_sight && see_it)
2817 #if 0 /*JP:T*/
2818                     pline("%s triggers a trap but nothing happens.",
2819                           Monnam(mtmp));
2820 #else
2821                     pline("%s\82ª\82í\82È\82ð\8bN\93®\82³\82¹\82½\82ª\89½\82à\8bN\82±\82ç\82È\82©\82Á\82½\81D",
2822                           Monnam(mtmp));
2823 #endif
2824                 deltrap(trap);
2825                 newsym(mtmp->mx, mtmp->my);
2826                 break;
2827             }
2828             trap->once = 1;
2829             otmp = t_missile(DART, trap);
2830             if (!rn2(6))
2831                 otmp->opoisoned = 1;
2832             if (in_sight)
2833                 seetrap(trap);
2834             if (thitm(7, mtmp, otmp, 0, FALSE))
2835                 trapkilled = TRUE;
2836             break;
2837         case ROCKTRAP:
2838             if (trap->once && trap->tseen && !rn2(15)) {
2839                 if (in_sight && see_it)
2840                     pline(
2841 /*JP
2842                         "A trap door above %s opens, but nothing falls out!",
2843 */
2844                         "%s\82Ì\8fã\82Ì\94à\82ª\8aJ\82¢\82½\82ª\81C\89½\82à\97\8e\82¿\82Ä\82±\82È\82©\82Á\82½\81I",
2845                         mon_nam(mtmp));
2846                 deltrap(trap);
2847                 newsym(mtmp->mx, mtmp->my);
2848                 break;
2849             }
2850             trap->once = 1;
2851             otmp = t_missile(ROCK, trap);
2852             if (in_sight)
2853                 seetrap(trap);
2854             if (thitm(0, mtmp, otmp, d(2, 6), FALSE))
2855                 trapkilled = TRUE;
2856             break;
2857         case SQKY_BOARD:
2858             if (is_flyer(mptr))
2859                 break;
2860             /* stepped on a squeaky board */
2861             if (in_sight) {
2862                 if (!Deaf) {
2863 #if 0 /*JP*/
2864                     pline("A board beneath %s squeaks %s loudly.",
2865                           mon_nam(mtmp), trapnote(trap, 0));
2866 #else
2867                     pline("%s\82Ì\91«\8c³\82Ì\94Â\82ª\91å\82«\82­%s\82É\82«\82µ\82ñ\82¾\81D",
2868                           mon_nam(mtmp), trapnote(trap, 0));
2869 #endif
2870                     seetrap(trap);
2871                 } else {
2872 /*JP
2873                     pline("%s stops momentarily and appears to cringe.",
2874 */
2875                     pline("%s\82Í\88ê\8fu\8e~\82Ü\82Á\82Ä\90g\82ð\82·\82­\82ß\82½\82æ\82¤\82¾\81D",
2876                           Monnam(mtmp));
2877                 }
2878             } else {
2879                 /* same near/far threshold as mzapmsg() */
2880                 int range = couldsee(mtmp->mx, mtmp->my) /* 9 or 5 */
2881                                ? (BOLT_LIM + 1) : (BOLT_LIM - 3);
2882
2883 #if 0 /*JP*/
2884                 You_hear("a %s squeak %s.", trapnote(trap, 1),
2885                          (distu(mtmp->mx, mtmp->my) <= range * range)
2886                             ? "nearby" : "in the distance");
2887 #else
2888                 You_hear("%s\82­\82Å%s\82ª\82«\82µ\82Þ\89¹\82ð\95·\82¢\82½\81D",
2889                          (distu(mtmp->mx, mtmp->my) <= range * range)
2890                             ? "\8bß" : "\89\93",
2891                          trapnote(trap, 1));
2892 #endif
2893             }
2894             /* wake up nearby monsters */
2895             wake_nearto(mtmp->mx, mtmp->my, 40);
2896             break;
2897         case BEAR_TRAP:
2898             if (mptr->msize > MZ_SMALL && !amorphous(mptr) && !is_flyer(mptr)
2899                 && !is_whirly(mptr) && !unsolid(mptr)) {
2900                 mtmp->mtrapped = 1;
2901                 if (in_sight) {
2902 #if 0 /*JP*/
2903                     pline("%s is caught in %s bear trap!", Monnam(mtmp),
2904                           a_your[trap->madeby_u]);
2905 #else
2906                     pline("%s\82Í%s\8cF\82Ìã©\82É\82Â\82©\82Ü\82Á\82½\81I", Monnam(mtmp),
2907                           set_you[trap->madeby_u]);
2908 #endif
2909                     seetrap(trap);
2910                 } else {
2911                     if (mptr == &mons[PM_OWLBEAR]
2912                         || mptr == &mons[PM_BUGBEAR])
2913 /*JP
2914                         You_hear("the roaring of an angry bear!");
2915 */
2916                         You_hear("\93{\82è\82Ì\99ô\9aK\82ð\95·\82¢\82½\81I");
2917                 }
2918             } else if (force_mintrap) {
2919                 if (in_sight) {
2920 #if 0 /*JP*/
2921                     pline("%s evades %s bear trap!", Monnam(mtmp),
2922                           a_your[trap->madeby_u]);
2923 #else
2924                     pline("%s\82Í%s\8cF\82Ìã©\82ð\82½\82­\82Ý\82É\94ð\82¯\82½\81I", Monnam(mtmp),
2925                           set_you[trap->madeby_u]);
2926 #endif
2927                     seetrap(trap);
2928                 }
2929             }
2930             if (mtmp->mtrapped)
2931                 trapkilled = thitm(0, mtmp, (struct obj *) 0, d(2, 4), FALSE);
2932             break;
2933         case SLP_GAS_TRAP:
2934             if (!resists_sleep(mtmp) && !breathless(mptr) && !mtmp->msleeping
2935                 && mtmp->mcanmove) {
2936                 if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
2937 /*JP
2938                     pline("%s suddenly falls asleep!", Monnam(mtmp));
2939 */
2940                     pline("%s\82Í\93Ë\91R\96°\82è\82É\97\8e\82¿\82½\81I", Monnam(mtmp));
2941                     seetrap(trap);
2942                 }
2943             }
2944             break;
2945         case RUST_TRAP: {
2946             struct obj *target;
2947
2948             if (in_sight)
2949                 seetrap(trap);
2950             switch (rn2(5)) {
2951             case 0:
2952                 if (in_sight)
2953 #if 0 /*JP*/
2954                     pline("%s %s on the %s!", A_gush_of_water_hits,
2955                           mon_nam(mtmp), mbodypart(mtmp, HEAD));
2956 #else
2957                     pline("\90\85\82ª\95¬\8fo\82µ\82Ä\81C%s\82Ì%s\82É\96½\92\86\82µ\82½\81I", 
2958                           mon_nam(mtmp), mbodypart(mtmp, HEAD));
2959 #endif
2960                 target = which_armor(mtmp, W_ARMH);
2961                 (void) water_damage(target, helm_simple_name(target), TRUE);
2962                 break;
2963             case 1:
2964                 if (in_sight)
2965 #if 0 /*JP*/
2966                     pline("%s %s's left %s!", A_gush_of_water_hits,
2967                           mon_nam(mtmp), mbodypart(mtmp, ARM));
2968 #else
2969                     pline("\90\85\82ª\95¬\8fo\82µ\82Ä\81C%s\82Ì\8d¶%s\82É\96½\92\86\82µ\82½\81I",
2970                           mon_nam(mtmp), mbodypart(mtmp, ARM));
2971 #endif
2972                 target = which_armor(mtmp, W_ARMS);
2973 /*JP
2974                 if (water_damage(target, "shield", TRUE) != ER_NOTHING)
2975 */
2976                 if (water_damage(target, "\8f\82", TRUE) != ER_NOTHING)
2977                     break;
2978                 target = MON_WEP(mtmp);
2979                 if (target && bimanual(target))
2980                     (void) water_damage(target, 0, TRUE);
2981             glovecheck:
2982                 target = which_armor(mtmp, W_ARMG);
2983 /*JP
2984                 (void) water_damage(target, "gauntlets", TRUE);
2985 */
2986                 (void) water_damage(target, "\8f¬\8eè", TRUE);
2987                 break;
2988             case 2:
2989                 if (in_sight)
2990 #if 0 /*JP*/
2991                     pline("%s %s's right %s!", A_gush_of_water_hits,
2992                           mon_nam(mtmp), mbodypart(mtmp, ARM));
2993 #else
2994                     pline("\90\85\82ª\95¬\8fo\82µ\82Ä\81C%s\82Ì\89E%s\82É\96½\92\86\82µ\82½\81I",
2995                           mon_nam(mtmp), mbodypart(mtmp, ARM));
2996 #endif
2997                 (void) water_damage(MON_WEP(mtmp), 0, TRUE);
2998                 goto glovecheck;
2999             default:
3000                 if (in_sight)
3001 /*JP
3002                     pline("%s %s!", A_gush_of_water_hits, mon_nam(mtmp));
3003 */
3004                     pline("\90\85\82ª\95¬\8fo\82µ\82Ä\81C%s\82É\96½\92\86\82µ\82½\81I", mon_nam(mtmp));
3005                 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
3006                     if (otmp->lamplit
3007                         && (otmp->owornmask & (W_WEP | W_SWAPWEP)) == 0)
3008                         (void) snuff_lit(otmp);
3009                 if ((target = which_armor(mtmp, W_ARMC)) != 0)
3010                     (void) water_damage(target, cloak_simple_name(target),
3011                                         TRUE);
3012                 else if ((target = which_armor(mtmp, W_ARM)) != 0)
3013                     (void) water_damage(target, suit_simple_name(target),
3014                                         TRUE);
3015                 else if ((target = which_armor(mtmp, W_ARMU)) != 0)
3016 /*JP
3017                     (void) water_damage(target, "shirt", TRUE);
3018 */
3019                     (void) water_damage(target, "\83V\83\83\83c", TRUE);
3020             }
3021
3022             if (mptr == &mons[PM_IRON_GOLEM]) {
3023                 if (in_sight)
3024 /*JP
3025                     pline("%s falls to pieces!", Monnam(mtmp));
3026 */
3027                     pline("%s\82Í\82­\82¾\82¯\82¿\82Á\82½\81I", Monnam(mtmp));
3028                 else if (mtmp->mtame)
3029 /*JP
3030                     pline("May %s rust in peace.", mon_nam(mtmp));
3031 */
3032                     pline("%s\82æ\81C\88À\82ç\82©\82É\8eK\82Ñ\82ñ\8e\96\82ð\81D", mon_nam(mtmp));
3033                 mondied(mtmp);
3034                 if (DEADMONSTER(mtmp))
3035                     trapkilled = TRUE;
3036             } else if (mptr == &mons[PM_GREMLIN] && rn2(3)) {
3037                 (void) split_mon(mtmp, (struct monst *) 0);
3038             }
3039             break;
3040         } /* RUST_TRAP */
3041         case FIRE_TRAP:
3042         mfiretrap:
3043             if (in_sight)
3044 #if 0 /*JP*/
3045                 pline("A %s erupts from the %s under %s!", tower_of_flame,
3046                       surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
3047 #else
3048                 pline("\89Î\92\8c\82ª%s\82Ì\91«\8c³\82Ì%s\82©\82ç\97§\82¿\82Ì\82Ú\82Á\82½\81I",
3049                       mon_nam(mtmp), surface(mtmp->mx,mtmp->my));
3050 #endif
3051             else if (see_it) /* evidently `mtmp' is invisible */
3052 #if 0 /*JP*/
3053                 You_see("a %s erupt from the %s!", tower_of_flame,
3054                         surface(mtmp->mx, mtmp->my));
3055 #else
3056                 You("\89Î\92\8c\82ª%s\82©\82ç\90\82\82é\82Ì\82ð\8c©\82½\81I",
3057                     surface(mtmp->mx,mtmp->my));
3058 #endif
3059
3060             if (resists_fire(mtmp)) {
3061                 if (in_sight) {
3062                     shieldeff(mtmp->mx, mtmp->my);
3063 /*JP
3064                     pline("%s is uninjured.", Monnam(mtmp));
3065 */
3066                     pline("\82ª\81C%s\82Í\8f\9d\82Â\82©\82È\82¢\81D", Monnam(mtmp));
3067                 }
3068             } else {
3069                 int num = d(2, 4), alt;
3070                 boolean immolate = FALSE;
3071
3072                 /* paper burns very fast, assume straw is tightly
3073                  * packed and burns a bit slower */
3074                 switch (monsndx(mptr)) {
3075                 case PM_PAPER_GOLEM:
3076                     immolate = TRUE;
3077                     alt = mtmp->mhpmax;
3078                     break;
3079                 case PM_STRAW_GOLEM:
3080                     alt = mtmp->mhpmax / 2;
3081                     break;
3082                 case PM_WOOD_GOLEM:
3083                     alt = mtmp->mhpmax / 4;
3084                     break;
3085                 case PM_LEATHER_GOLEM:
3086                     alt = mtmp->mhpmax / 8;
3087                     break;
3088                 default:
3089                     alt = 0;
3090                     break;
3091                 }
3092                 if (alt > num)
3093                     num = alt;
3094
3095                 if (thitm(0, mtmp, (struct obj *) 0, num, immolate))
3096                     trapkilled = TRUE;
3097                 else
3098                     /* we know mhp is at least `num' below mhpmax,
3099                        so no (mhp > mhpmax) check is needed here */
3100                     mtmp->mhpmax -= rn2(num + 1);
3101             }
3102             if (burnarmor(mtmp) || rn2(3)) {
3103                 (void) destroy_mitem(mtmp, SCROLL_CLASS, AD_FIRE);
3104                 (void) destroy_mitem(mtmp, SPBOOK_CLASS, AD_FIRE);
3105                 (void) destroy_mitem(mtmp, POTION_CLASS, AD_FIRE);
3106             }
3107             if (burn_floor_objects(mtmp->mx, mtmp->my, see_it, FALSE)
3108                 && !see_it && distu(mtmp->mx, mtmp->my) <= 3 * 3)
3109 /*JP
3110                 You("smell smoke.");
3111 */
3112                 pline("\89\8c\82Ì\93õ\82¢\82ª\82µ\82½\81D");
3113             if (is_ice(mtmp->mx, mtmp->my))
3114                 melt_ice(mtmp->mx, mtmp->my, (char *) 0);
3115             if (see_it && t_at(mtmp->mx, mtmp->my))
3116                 seetrap(trap);
3117             break;
3118         case PIT:
3119         case SPIKED_PIT:
3120 /*JP
3121             fallverb = "falls";
3122 */
3123             fallverb = "\97\8e\82¿\82½";
3124             if (is_flyer(mptr) || is_floater(mptr)
3125                 || (mtmp->wormno && count_wsegs(mtmp) > 5)
3126                 || is_clinger(mptr)) {
3127                 if (force_mintrap && !Sokoban) {
3128                     /* openfallingtrap; not inescapable here */
3129                     if (in_sight) {
3130                         seetrap(trap);
3131 /*JP
3132                         pline("%s doesn't fall into the pit.", Monnam(mtmp));
3133 */
3134                         pline("%s\82Í\97\8e\82µ\8c\8a\82É\97\8e\82¿\82È\82©\82Á\82½\81D", Monnam(mtmp));
3135                     }
3136                     break; /* inescapable = FALSE; */
3137                 }
3138                 if (!inescapable)
3139                     break;               /* avoids trap */
3140 #if 0 /*JP*/
3141                 fallverb = "is dragged"; /* sokoban pit */
3142 #else
3143                 fallverb = "\82¸\82è\97\8e\82¿\82½"; /* sokoban pit */
3144 #endif
3145             }
3146             if (!passes_walls(mptr))
3147                 mtmp->mtrapped = 1;
3148             if (in_sight) {
3149 #if 0 /*JP*/
3150                 pline("%s %s into %s pit!", Monnam(mtmp), fallverb,
3151                       a_your[trap->madeby_u]);
3152 #else
3153                 pline("%s\82Í%s\97\8e\82µ\8c\8a\82É%s\81I", Monnam(mtmp),
3154                       set_you[trap->madeby_u], fallverb);
3155 #endif
3156                 if (mptr == &mons[PM_PIT_VIPER]
3157                     || mptr == &mons[PM_PIT_FIEND])
3158 /*JP
3159                     pline("How pitiful.  Isn't that the pits?");
3160 */
3161                     pline("\82±\82Ì\97\8e\82µ\8c\8a\82Í\82¢\82¢\8ed\8e\96\82ð\82µ\82Ä\82¢\82é\81D");
3162                 seetrap(trap);
3163             }
3164 /*JP
3165             mselftouch(mtmp, "Falling, ", FALSE);
3166 */
3167             mselftouch(mtmp, "\97\8e\89º\92\86\81C", FALSE);
3168             if (DEADMONSTER(mtmp) || thitm(0, mtmp, (struct obj *) 0,
3169                                         rnd((tt == PIT) ? 6 : 10), FALSE))
3170                 trapkilled = TRUE;
3171             break;
3172         case HOLE:
3173         case TRAPDOOR:
3174             if (!Can_fall_thru(&u.uz)) {
3175                 impossible("mintrap: %ss cannot exist on this level.",
3176                            defsyms[trap_to_defsym(tt)].explanation);
3177                 break; /* don't activate it after all */
3178             }
3179             if (is_flyer(mptr) || is_floater(mptr) || mptr == &mons[PM_WUMPUS]
3180                 || (mtmp->wormno && count_wsegs(mtmp) > 5)
3181                 || mptr->msize >= MZ_HUGE) {
3182                 if (force_mintrap && !Sokoban) {
3183                     /* openfallingtrap; not inescapable here */
3184                     if (in_sight) {
3185                         seetrap(trap);
3186                         if (tt == TRAPDOOR)
3187                             pline(
3188 /*JP
3189                             "A trap door opens, but %s doesn't fall through.",
3190 */
3191                             "\97\8e\82µ\94à\82ª\8aJ\82¢\82½\82ª\81C%s\82Í\97\8e\82¿\82È\82©\82Á\82½\81D",
3192                                   mon_nam(mtmp));
3193                         else /* (tt == HOLE) */
3194 /*JP
3195                             pline("%s doesn't fall through the hole.",
3196 */
3197                             pline("%s\82Í\8c\8a\82É\97\8e\82¿\82È\82©\82Á\82½\81D",
3198                                   Monnam(mtmp));
3199                     }
3200                     break; /* inescapable = FALSE; */
3201                 }
3202                 if (inescapable) { /* sokoban hole */
3203                     if (in_sight) {
3204 /*JP
3205                         pline("%s seems to be yanked down!", Monnam(mtmp));
3206 */
3207                         pline("%s\82Í\88ø\82«\97\8e\82³\82ê\82½\82æ\82¤\82¾\81I", Monnam(mtmp));
3208                         /* suppress message in mlevel_tele_trap() */
3209                         in_sight = FALSE;
3210                         seetrap(trap);
3211                     }
3212                 } else
3213                     break;
3214             }
3215             /*FALLTHRU*/
3216         case LEVEL_TELEP:
3217         case MAGIC_PORTAL: {
3218             int mlev_res;
3219
3220             mlev_res = mlevel_tele_trap(mtmp, trap, inescapable, in_sight);
3221             if (mlev_res)
3222                 return mlev_res;
3223             break;
3224         }
3225         case TELEP_TRAP:
3226             mtele_trap(mtmp, trap, in_sight);
3227             break;
3228         case WEB:
3229             /* Monster in a web. */
3230             if (webmaker(mptr))
3231                 break;
3232             if (mu_maybe_destroy_web(mtmp, in_sight, trap))
3233                 break;
3234             tear_web = FALSE;
3235             switch (monsndx(mptr)) {
3236             case PM_OWLBEAR: /* Eric Backus */
3237             case PM_BUGBEAR:
3238                 if (!in_sight) {
3239 /*JP
3240                     You_hear("the roaring of a confused bear!");
3241 */
3242                     You_hear("\8d¬\97\90\82Ì\99ô\9aK\82ð\95·\82¢\82½\81I");
3243                     mtmp->mtrapped = 1;
3244                     break;
3245                 }
3246                 /*FALLTHRU*/
3247             default:
3248                 if (mptr->mlet == S_GIANT
3249                     /* exclude baby dragons and relatively short worms */
3250                     || (mptr->mlet == S_DRAGON && extra_nasty(mptr))
3251                     || (mtmp->wormno && count_wsegs(mtmp) > 5)) {
3252                     tear_web = TRUE;
3253                 } else if (in_sight) {
3254 #if 0 /*JP*/
3255                     pline("%s is caught in %s spider web.", Monnam(mtmp),
3256                           a_your[trap->madeby_u]);
3257 #else
3258                     pline("%s\82Í%s\82­\82à\82Ì\91\83\82É\82Â\82©\82Ü\82Á\82½\81D", Monnam(mtmp),
3259                           web_you[trap->madeby_u]);
3260 #endif
3261                     seetrap(trap);
3262                 }
3263                 mtmp->mtrapped = tear_web ? 0 : 1;
3264                 break;
3265             /* this list is fairly arbitrary; it deliberately
3266                excludes wumpus & giant/ettin zombies/mummies */
3267             case PM_TITANOTHERE:
3268             case PM_BALUCHITHERIUM:
3269             case PM_PURPLE_WORM:
3270             case PM_JABBERWOCK:
3271             case PM_IRON_GOLEM:
3272             case PM_BALROG:
3273             case PM_KRAKEN:
3274             case PM_MASTODON:
3275             case PM_ORION:
3276             case PM_NORN:
3277             case PM_CYCLOPS:
3278             case PM_LORD_SURTUR:
3279                 tear_web = TRUE;
3280                 break;
3281             }
3282             if (tear_web) {
3283                 if (in_sight)
3284 #if 0 /*JP*/
3285                     pline("%s tears through %s spider web!", Monnam(mtmp),
3286                           a_your[trap->madeby_u]);
3287 #else
3288                     pline("%s\82Í%s\82­\82à\82Ì\91\83\82ð\88ø\82«\97ô\82¢\82½\81I", Monnam(mtmp),
3289                           web_you[trap->madeby_u]);
3290 #endif
3291                 deltrap(trap);
3292                 newsym(mtmp->mx, mtmp->my);
3293             } else if (force_mintrap && !mtmp->mtrapped) {
3294                 if (in_sight) {
3295 #if 0 /*JP*/
3296                     pline("%s avoids %s spider web!", Monnam(mtmp),
3297                           a_your[trap->madeby_u]);
3298 #else
3299                     pline("%s\82Í%s\82­\82à\82Ì\91\83\82ð\94ð\82¯\82½\81I", Monnam(mtmp),
3300                           web_you[trap->madeby_u]);
3301 #endif
3302                     seetrap(trap);
3303                 }
3304             }
3305             break;
3306         case STATUE_TRAP:
3307             break;
3308         case MAGIC_TRAP:
3309             /* A magic trap.  Monsters usually immune. */
3310             if (!rn2(21))
3311                 goto mfiretrap;
3312             break;
3313         case ANTI_MAGIC:
3314             /* similar to hero's case, more or less */
3315             if (!resists_magm(mtmp)) { /* lose spell energy */
3316                 if (!mtmp->mcan && (attacktype(mptr, AT_MAGC)
3317                                     || attacktype(mptr, AT_BREA))) {
3318                     mtmp->mspec_used += d(2, 2);
3319                     if (in_sight) {
3320                         seetrap(trap);
3321 /*JP
3322                         pline("%s seems lethargic.", Monnam(mtmp));
3323 */
3324                         pline("%s\88ê\8fu\96³\8bC\97Í\8a´\82ð\8a´\82\82½\81D", Monnam(mtmp));
3325                     }
3326                 }
3327             } else { /* take some damage */
3328                 int dmgval2 = rnd(4);
3329
3330                 if ((otmp = MON_WEP(mtmp)) != 0
3331                     && otmp->oartifact == ART_MAGICBANE)
3332                     dmgval2 += rnd(4);
3333                 for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
3334                     if (otmp->oartifact
3335                         && defends_when_carried(AD_MAGM, otmp))
3336                         break;
3337                 if (otmp)
3338                     dmgval2 += rnd(4);
3339                 if (passes_walls(mptr))
3340                     dmgval2 = (dmgval2 + 3) / 4;
3341
3342                 if (in_sight)
3343                     seetrap(trap);
3344                 mtmp->mhp -= dmgval2;
3345                 if (DEADMONSTER(mtmp))
3346                     monkilled(mtmp,
3347                               in_sight
3348 /*JP
3349                                   ? "compression from an anti-magic field"
3350 */
3351                                   ? "\94½\96\82\96@\8bó\8aÔ\82Ì\88³\8fk"
3352                                   : (const char *) 0,
3353                               -AD_MAGM);
3354                 if (DEADMONSTER(mtmp))
3355                     trapkilled = TRUE;
3356                 if (see_it)
3357                     newsym(trap->tx, trap->ty);
3358             }
3359             break;
3360         case LANDMINE:
3361             if (rn2(3))
3362                 break; /* monsters usually don't set it off */
3363             if (is_flyer(mptr)) {
3364                 boolean already_seen = trap->tseen;
3365
3366                 if (in_sight && !already_seen) {
3367 /*JP
3368                     pline("A trigger appears in a pile of soil below %s.",
3369 */
3370                     pline("%s\82Ì\91«\8c³\82Ì\93y\82Ì\8eR\82É\8bN\94\9a\83X\83C\83b\83`\82ª\8c»\82í\82ê\82½\81D",
3371                           mon_nam(mtmp));
3372                     seetrap(trap);
3373                 }
3374                 if (rn2(3))
3375                     break;
3376                 if (in_sight) {
3377                     newsym(mtmp->mx, mtmp->my);
3378 #if 0 /*JP*/
3379                     pline_The("air currents set %s off!",
3380                               already_seen ? "a land mine" : "it");
3381 #else
3382                     pline("\8bó\8bC\82Ì\97¬\82ê\82Å\83X\83C\83b\83`\82ª\93ü\82Á\82½\81I");
3383 #endif
3384                 }
3385             } else if (in_sight) {
3386                 newsym(mtmp->mx, mtmp->my);
3387 #if 0 /*JP*/
3388                 pline("%s%s triggers %s land mine!",
3389                       !Deaf ? "KAABLAMM!!!  " : "", Monnam(mtmp),
3390                       a_your[trap->madeby_u]);
3391 #else
3392                 pline("%s%s\82Í%s\92n\97\8b\82Ì\8bN\94\9a\83X\83C\83b\83`\82ð\93¥\82ñ\82¾\81I",
3393                       !Deaf ? "\82¿\82ã\82Ç\81[\82ñ\81I\81I" : "", Monnam(mtmp),
3394                       set_you[trap->madeby_u]);
3395 #endif
3396             }
3397             if (!in_sight && !Deaf)
3398 /*JP
3399                 pline("Kaablamm!  You hear an explosion in the distance!");
3400 */
3401                 pline("\82¿\82ã\82Ç\81[\82ñ\81I\82 \82È\82½\82Í\89\93\95û\82Ì\94\9a\94­\89¹\82ð\95·\82¢\82½\81I");
3402             blow_up_landmine(trap);
3403             /* explosion might have destroyed a drawbridge; don't
3404                dish out more damage if monster is already dead */
3405             if (DEADMONSTER(mtmp)
3406                 || thitm(0, mtmp, (struct obj *) 0, rnd(16), FALSE)) {
3407                 trapkilled = TRUE;
3408             } else {
3409                 /* monsters recursively fall into new pit */
3410                 if (mintrap(mtmp) == 2)
3411                     trapkilled = TRUE;
3412             }
3413             /* a boulder may fill the new pit, crushing monster */
3414             fill_pit(trap->tx, trap->ty);
3415             if (DEADMONSTER(mtmp))
3416                 trapkilled = TRUE;
3417             if (unconscious()) {
3418                 multi = -1;
3419 /*JP
3420                 nomovemsg = "The explosion awakens you!";
3421 */
3422                 nomovemsg = "\94\9a\94­\82Å\82 \82È\82½\82Í\8bN\82«\82½\81I";
3423             }
3424             break;
3425         case POLY_TRAP:
3426             if (resists_magm(mtmp)) {
3427                 shieldeff(mtmp->mx, mtmp->my);
3428             } else if (!resist(mtmp, WAND_CLASS, 0, NOTELL)) {
3429                 if (newcham(mtmp, (struct permonst *) 0, FALSE, FALSE))
3430                     /* we're done with mptr but keep it up to date */
3431                     mptr = mtmp->data;
3432                 if (in_sight)
3433                     seetrap(trap);
3434             }
3435             break;
3436         case ROLLING_BOULDER_TRAP:
3437             if (!is_flyer(mptr)) {
3438                 int style = ROLL | (in_sight ? 0 : LAUNCH_UNSEEN);
3439
3440                 newsym(mtmp->mx, mtmp->my);
3441                 if (in_sight)
3442 #if 0 /*JP*/
3443                     pline("Click!  %s triggers %s.", Monnam(mtmp),
3444                           trap->tseen ? "a rolling boulder trap" : something);
3445 #else
3446                     pline("\83J\83`\83b\81I%s\82Í%s\82Ì\83X\83C\83b\83`\82ð\93¥\82ñ\82¾\81I", Monnam(mtmp),
3447                           trap->tseen ? "\97\8e\8aâ\82Ìã©" : "\89½\82©");
3448 #endif
3449                 if (launch_obj(BOULDER, trap->launch.x, trap->launch.y,
3450                                trap->launch2.x, trap->launch2.y, style)) {
3451                     if (in_sight)
3452                         trap->tseen = TRUE;
3453                     if (DEADMONSTER(mtmp))
3454                         trapkilled = TRUE;
3455                 } else {
3456                     deltrap(trap);
3457                     newsym(mtmp->mx, mtmp->my);
3458                 }
3459             }
3460             break;
3461         case VIBRATING_SQUARE:
3462             if (see_it && !Blind) {
3463                 seetrap(trap); /* before messages */
3464                 if (in_sight) {
3465 #if 0 /*JP*/
3466                     char buf[BUFSZ], *p, *monnm = mon_nam(mtmp);
3467
3468                     if (nolimbs(mtmp->data)
3469                         || is_floater(mtmp->data) || is_flyer(mtmp->data)) {
3470                         /* just "beneath <mon>" */
3471                         Strcpy(buf, monnm);
3472                     } else {
3473                         Strcpy(buf, s_suffix(monnm));
3474                         p = eos(strcat(buf, " "));
3475                         Strcpy(p, makeplural(mbodypart(mtmp, FOOT)));
3476                         /* avoid "beneath 'rear paws'" or 'rear hooves' */
3477                         (void) strsubst(p, "rear ", "");
3478                     }
3479                     You_see("a strange vibration beneath %s.", buf);
3480 #else /* \91«\82ª\82È\82­\82Ä\82à\81u\91«\8c³\81v\82Å\93\9d\88ê */
3481                     You_see("%s\82Ì\91«\8c³\82ª\95s\8ev\8bc\82É\90U\93®\82µ\82Ä\82¢\82é\82Ì\82ð\8c©\82½\81D",
3482                             mon_nam(mtmp));
3483 #endif
3484                 } else {
3485                     /* notice something (hearing uses a larger threshold
3486                        for 'nearby') */
3487 #if 0 /*JP:T*/
3488                     You_see("the ground vibrate %s.",
3489                             (distu(mtmp->mx, mtmp->my) <= 2 * 2)
3490                                ? "nearby" : "in the distance");
3491 #else
3492                     You_see("%s\82­\82Å\92n\96Ê\82ª\90U\93®\82µ\82Ä\82¢\82é\82Ì\82ð\8c©\82½\81D",
3493                             (distu(mtmp->mx, mtmp->my) <= 2 * 2)
3494                                ? "\8bß" : "\89\93");
3495 #endif
3496                 }
3497             }
3498             break;
3499         default:
3500             impossible("Some monster encountered a strange trap of type %d.",
3501                        tt);
3502         }
3503     }
3504     if (trapkilled)
3505         return 2;
3506     return mtmp->mtrapped;
3507 }
3508
3509 /* Combine cockatrice checks into single functions to avoid repeating code. */
3510 void
3511 instapetrify(str)
3512 const char *str;
3513 {
3514     if (Stone_resistance)
3515         return;
3516     if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM))
3517         return;
3518 /*JP
3519     You("turn to stone...");
3520 */
3521     You("\90Î\82É\82È\82Á\82½\81D\81D\81D");
3522     killer.format = KILLED_BY;
3523     if (str != killer.name)
3524         Strcpy(killer.name, str ? str : "");
3525     done(STONING);
3526 }
3527
3528 void
3529 minstapetrify(mon, byplayer)
3530 struct monst *mon;
3531 boolean byplayer;
3532 {
3533     if (resists_ston(mon))
3534         return;
3535     if (poly_when_stoned(mon->data)) {
3536         mon_to_stone(mon);
3537         return;
3538     }
3539     if (!vamp_stone(mon))
3540         return;
3541
3542     /* give a "<mon> is slowing down" message and also remove
3543        intrinsic speed (comparable to similar effect on the hero) */
3544     mon_adjust_speed(mon, -3, (struct obj *) 0);
3545
3546     if (cansee(mon->mx, mon->my))
3547 /*JP
3548         pline("%s turns to stone.", Monnam(mon));
3549 */
3550         pline("%s\82Í\90Î\82É\82È\82Á\82½\81D", Monnam(mon));
3551     if (byplayer) {
3552         stoned = TRUE;
3553         xkilled(mon, XKILL_NOMSG);
3554     } else
3555         monstone(mon);
3556 }
3557
3558 void
3559 selftouch(arg)
3560 const char *arg;
3561 {
3562     char kbuf[BUFSZ];
3563
3564     if (uwep && uwep->otyp == CORPSE && touch_petrifies(&mons[uwep->corpsenm])
3565         && !Stone_resistance) {
3566 /*JP
3567         pline("%s touch the %s corpse.", arg, mons[uwep->corpsenm].mname);
3568 */
3569         pline("%s%s\82Ì\8e\80\91Ì\82É\90G\82Á\82½\81D", arg, mons[uwep->corpsenm].mname);
3570 /*JP
3571         Sprintf(kbuf, "%s corpse", an(mons[uwep->corpsenm].mname));
3572 */
3573         Sprintf(kbuf, "%s\82Ì\8e\80\91Ì\82Å", mons[uwep->corpsenm].mname);
3574         instapetrify(kbuf);
3575         /* life-saved; unwield the corpse if we can't handle it */
3576         if (!uarmg && !Stone_resistance)
3577             uwepgone();
3578     }
3579     /* Or your secondary weapon, if wielded [hypothetical; we don't
3580        allow two-weapon combat when either weapon is a corpse] */
3581     if (u.twoweap && uswapwep && uswapwep->otyp == CORPSE
3582         && touch_petrifies(&mons[uswapwep->corpsenm]) && !Stone_resistance) {
3583 /*JP
3584         pline("%s touch the %s corpse.", arg, mons[uswapwep->corpsenm].mname);
3585 */
3586         pline("%s%s\82Ì\8e\80\91Ì\82É\90G\82Á\82½\81D", arg, mons[uswapwep->corpsenm].mname);
3587 /*JP
3588         Sprintf(kbuf, "%s corpse", an(mons[uswapwep->corpsenm].mname));
3589 */
3590         Sprintf(kbuf, "%s\82Ì\8e\80\91Ì\82Å", mons[uswapwep->corpsenm].mname);
3591         instapetrify(kbuf);
3592         /* life-saved; unwield the corpse */
3593         if (!uarmg && !Stone_resistance)
3594             uswapwepgone();
3595     }
3596 }
3597
3598 void
3599 mselftouch(mon, arg, byplayer)
3600 struct monst *mon;
3601 const char *arg;
3602 boolean byplayer;
3603 {
3604     struct obj *mwep = MON_WEP(mon);
3605
3606     if (mwep && mwep->otyp == CORPSE && touch_petrifies(&mons[mwep->corpsenm])
3607         && !resists_ston(mon)) {
3608         if (cansee(mon->mx, mon->my)) {
3609 #if 0 /*JP*/
3610             pline("%s%s touches %s.", arg ? arg : "",
3611                   arg ? mon_nam(mon) : Monnam(mon),
3612                   corpse_xname(mwep, (const char *) 0, CXN_PFX_THE));
3613 #else
3614             pline("%s%s\82Í%s\82Ì\8e\80\91Ì\82É\90G\82Á\82½\81D", arg ? arg : "",
3615                   arg ? mon_nam(mon) : Monnam(mon),
3616                   corpse_xname(mwep, (const char *) 0, CXN_PFX_THE));
3617 #endif
3618         }
3619         minstapetrify(mon, byplayer);
3620         /* if life-saved, might not be able to continue wielding */
3621         if (!DEADMONSTER(mon) && !which_armor(mon, W_ARMG) && !resists_ston(mon))
3622             mwepgone(mon);
3623     }
3624 }
3625
3626 /* start levitating */
3627 void
3628 float_up()
3629 {
3630     context.botl = TRUE;
3631     if (u.utrap) {
3632         if (u.utraptype == TT_PIT) {
3633             reset_utrap(FALSE);
3634 /*JP
3635             You("float up, out of the pit!");
3636 */
3637             You("\95\82\82«\8fã\82ª\82Á\82Ä\81C\97\8e\82µ\8c\8a\82©\82ç\8fo\82½\81I");
3638             vision_full_recalc = 1; /* vision limits change */
3639             fill_pit(u.ux, u.uy);
3640         } else if (u.utraptype == TT_LAVA /* molten lava */
3641                    || u.utraptype == TT_INFLOOR) { /* solidified lava */
3642 /*JP
3643             Your("body pulls upward, but your %s are still stuck.",
3644 */
3645             Your("\91Ì\82Í\88ø\82«\8fã\82°\82ç\82ê\82½\81D\82µ\82©\82µ%s\82Í\82Ü\82¾\82Í\82Ü\82Á\82Ä\82¢\82é\81D",
3646                  makeplural(body_part(LEG)));
3647         } else if (u.utraptype == TT_BURIEDBALL) { /* tethered */
3648             coord cc;
3649
3650             cc.x = u.ux, cc.y = u.uy;
3651             /* caveat: this finds the first buried iron ball within
3652                one step of the specified location, not necessarily the
3653                buried [former] uball at the original anchor point */
3654             (void) buried_ball(&cc);
3655             /* being chained to the floor blocks levitation from floating
3656                above that floor but not from enhancing carrying capacity */
3657 #if 0 /*JP*/
3658             You("feel lighter, but your %s is still chained to the %s.",
3659                 body_part(LEG),
3660                 IS_ROOM(levl[cc.x][cc.y].typ) ? "floor" : "ground");
3661 #else
3662             You("\82·\82±\82µ\8cy\82­\82È\82Á\82½\82ª\81C\82 \82È\82½\82Ì%s\82Í\82Ü\82¾%s\82É\82Â\82È\82ª\82Á\82Ä\82¢\82é\81D",
3663                 body_part(LEG),
3664                 IS_ROOM(levl[cc.x][cc.y].typ) ? "\8f°" : "\92n\96Ê");
3665 #endif
3666         } else if (u.utraptype == WEB) {
3667 /*JP
3668             You("float up slightly, but you are still stuck in the web.");
3669 */
3670             You("\82·\82±\82µ\95\82\82«\8fã\82ª\82Á\82½\82ª\81C\82Ü\82¾\82­\82à\82Ì\91\83\82É\82Â\82©\82Ü\82Á\82Ä\82¢\82é\81D");
3671         } else { /* bear trap */
3672 /*JP
3673             You("float up slightly, but your %s is still stuck.",
3674 */
3675             You("\8f­\82µ\95\82\82«\8fã\82ª\82Á\82½\82ª%s\82Í\82Ü\82¾\82Í\82Ü\82Á\82Ä\82¢\82é\81D",
3676                 body_part(LEG));
3677         }
3678         /* when still trapped, float_vs_flight() below will block levitation */
3679 #if 0
3680     } else if (Is_waterlevel(&u.uz)) {
3681 /*JP
3682         pline("It feels as though you've lost some weight.");
3683 */
3684         You("\82Ü\82é\82Å\91Ì\8fd\82ª\8c¸\82Á\82½\82æ\82¤\82É\8a´\82\82½\81D");
3685 #endif
3686     } else if (u.uinwater) {
3687         spoteffects(TRUE);
3688     } else if (u.uswallow) {
3689 #if 0 /*JP*/
3690         You(is_animal(u.ustuck->data) ? "float away from the %s."
3691                                       : "spiral up into %s.",
3692             is_animal(u.ustuck->data) ? surface(u.ux, u.uy)
3693                                       : mon_nam(u.ustuck));
3694 #else
3695         You(is_animal(u.ustuck->data) ? "%s\82Ì\92\86\82Å\95\82\82¢\82½\81D"
3696                                       : "%s\82Ì\92\86\82Å\82®\82é\82®\82é\89ñ\93]\82µ\82½\81D",
3697             is_animal(u.ustuck->data) ? surface(u.ux, u.uy)
3698                                       : mon_nam(u.ustuck));
3699 #endif
3700     } else if (Hallucination) {
3701 /*JP
3702         pline("Up, up, and awaaaay!  You're walking on air!");
3703 */
3704         pline("\8fã\82ê\81C\8fã\82ê\81C\8fã\82ê\82¥\82¥\82¥\82¥\81I\82 \82È\82½\82Í\8bó\92\86\82ð\95à\82¢\82Ä\82¢\82é\81I");
3705     } else if (Is_airlevel(&u.uz)) {
3706 /*JP
3707         You("gain control over your movements.");
3708 */
3709         You("\82¤\82Ü\82­\93®\82¯\82é\82æ\82¤\82É\82È\82Á\82½\81D");
3710     } else {
3711 /*JP
3712         You("start to float in the air!");
3713 */
3714         You("\8bó\92\86\82É\95\82\82«\82Í\82\82ß\82½\81I");
3715     }
3716     if (u.usteed && !is_floater(u.usteed->data) && !is_flyer(u.usteed->data)) {
3717         if (Lev_at_will) {
3718 /*JP
3719             pline("%s magically floats up!", Monnam(u.usteed));
3720 */
3721             pline("%s\82Í\96\82\96@\82Ì\97Í\82Å\95\82\82¢\82½\81I", Monnam(u.usteed));
3722         } else {
3723 /*JP
3724             You("cannot stay on %s.", mon_nam(u.usteed));
3725 */
3726             You("%s\82Ì\8fã\82É\8fæ\82Á\82Ä\82¢\82ç\82ê\82È\82¢\81D", mon_nam(u.usteed));
3727             dismount_steed(DISMOUNT_GENERIC);
3728         }
3729     }
3730     if (Flying)
3731 /*JP
3732         You("are no longer able to control your flight.");
3733 */
3734         You("\8bó\92\86\82Å\82¤\82Ü\82­\93®\82¯\82È\82­\82È\82Á\82½\81D");
3735     float_vs_flight(); /* set BFlying, also BLevitation if still trapped */
3736     /* levitation gives maximum carrying capacity, so encumbrance
3737        state might be reduced */
3738     (void) encumber_msg();
3739     return;
3740 }
3741
3742 void
3743 fill_pit(x, y)
3744 int x, y;
3745 {
3746     struct obj *otmp;
3747     struct trap *t;
3748
3749     if ((t = t_at(x, y)) && is_pit(t->ttyp)
3750         && (otmp = sobj_at(BOULDER, x, y))) {
3751         obj_extract_self(otmp);
3752 /*JP
3753         (void) flooreffects(otmp, x, y, "settle");
3754 */
3755         (void) flooreffects(otmp, x, y, "\82Í\82Ü\82é");
3756     }
3757 }
3758
3759 /* stop levitating */
3760 int
3761 float_down(hmask, emask)
3762 long hmask, emask; /* might cancel timeout */
3763 {
3764     register struct trap *trap = (struct trap *) 0;
3765     d_level current_dungeon_level;
3766     boolean no_msg = FALSE;
3767
3768     HLevitation &= ~hmask;
3769     ELevitation &= ~emask;
3770     if (Levitation)
3771         return 0; /* maybe another ring/potion/boots */
3772     if (BLevitation) {
3773         /* if blocked by terrain, we haven't actually been levitating so
3774            we don't give any end-of-levitation feedback or side-effects,
3775            but if blocking is solely due to being trapped in/on floor,
3776            do give some feedback but skip other float_down() effects */
3777         boolean trapped = (BLevitation == I_SPECIAL);
3778
3779         float_vs_flight();
3780         if (trapped && u.utrap) /* u.utrap => paranoia */
3781 #if 0 /*JP*/
3782             You("are no longer trying to float up from the %s.",
3783                 (u.utraptype == TT_BEARTRAP) ? "trap's jaws"
3784                   : (u.utraptype == TT_WEB) ? "web"
3785                       : (u.utraptype == TT_BURIEDBALL) ? "chain"
3786                           : (u.utraptype == TT_LAVA) ? "lava"
3787                               : "ground"); /* TT_INFLOOR */
3788 #else
3789             You("\82à\82Í\82â%s\82©\82ç\95\82\82«\8fã\82ª\82ë\82¤\82Æ\82µ\82È\82­\82È\82Á\82½\81D",
3790                 (u.utraptype == TT_BEARTRAP) ? "ã©\82Ì\8e\95"
3791                   : (u.utraptype == TT_WEB) ? "\82­\82à\82Ì\91\83"
3792                       : (u.utraptype == TT_BURIEDBALL) ? "\8d½"
3793                           : (u.utraptype == TT_LAVA) ? "\97n\8aâ"
3794                               : "\92n\96Ê"); /* TT_INFLOOR */
3795 #endif
3796         (void) encumber_msg(); /* carrying capacity might have changed */
3797         return 0;
3798     }
3799     context.botl = TRUE;
3800     nomul(0); /* stop running or resting */
3801     if (BFlying) {
3802         /* controlled flight no longer overridden by levitation */
3803         float_vs_flight(); /* clears BFlying & I_SPECIAL
3804                             * unless hero is stuck in floor */
3805         if (Flying) {
3806 /*JP
3807             You("have stopped levitating and are now flying.");
3808 */
3809             You("\8bó\92\86\95\82\97V\82ð\8e~\82ß\82Ä\8bó\82ð\94ò\82Ñ\82Í\82\82ß\82½\81D");
3810             (void) encumber_msg(); /* carrying capacity might have changed */
3811             return 1;
3812         }
3813     }
3814     if (u.uswallow) {
3815 #if 0 /*JP*/
3816         You("float down, but you are still %s.",
3817             is_animal(u.ustuck->data) ? "swallowed" : "engulfed");
3818 #else
3819         You("\92\85\92n\82µ\82½\82ª\81C\82Ü\82¾\88ù\82Ý\8d\9e\82Ü\82ê\82½\82Ü\82Ü\82¾\81D");
3820 #endif
3821         (void) encumber_msg();
3822         return 1;
3823     }
3824
3825     if (Punished && !carried(uball)
3826         && (is_pool(uball->ox, uball->oy)
3827             || ((trap = t_at(uball->ox, uball->oy))
3828                 && (is_pit(trap->ttyp) || is_hole(trap->ttyp))))) {
3829         u.ux0 = u.ux;
3830         u.uy0 = u.uy;
3831         u.ux = uball->ox;
3832         u.uy = uball->oy;
3833         movobj(uchain, uball->ox, uball->oy);
3834         newsym(u.ux0, u.uy0);
3835         vision_full_recalc = 1; /* in case the hero moved. */
3836     }
3837     /* check for falling into pool - added by GAN 10/20/86 */
3838     if (!Flying) {
3839         if (!u.uswallow && u.ustuck) {
3840             if (sticks(youmonst.data))
3841 #if 0 /*JP:T*/
3842                 You("aren't able to maintain your hold on %s.",
3843                     mon_nam(u.ustuck));
3844 #else
3845                 You("%s\82ð\82Â\82©\82Ü\82¦\91±\82¯\82Ä\82¢\82ç\82ê\82È\82­\82È\82Á\82½\81D",
3846                     mon_nam(u.ustuck));
3847 #endif
3848             else
3849 #if 0 /*JP:T*/
3850                 pline("Startled, %s can no longer hold you!",
3851                       mon_nam(u.ustuck));
3852 #else
3853                 pline("%s\82Í\8bÁ\82¢\82Ä\82 \82È\82½\82ð\95ú\82µ\82Ä\82µ\82Ü\82Á\82½\81I",
3854                       mon_nam(u.ustuck));
3855 #endif
3856             u.ustuck = 0;
3857         }
3858         /* kludge alert:
3859          * drown() and lava_effects() print various messages almost
3860          * every time they're called which conflict with the "fall
3861          * into" message below.  Thus, we want to avoid printing
3862          * confusing, duplicate or out-of-order messages.
3863          * Use knowledge of the two routines as a hack -- this
3864          * should really be handled differently -dlc
3865          */
3866         if (is_pool(u.ux, u.uy) && !Wwalking && !Swimming && !u.uinwater)
3867             no_msg = drown();
3868
3869         if (is_lava(u.ux, u.uy)) {
3870             (void) lava_effects();
3871             no_msg = TRUE;
3872         }
3873     }
3874     if (!trap) {
3875         trap = t_at(u.ux, u.uy);
3876         if (Is_airlevel(&u.uz)) {
3877 /*JP
3878             You("begin to tumble in place.");
3879 */
3880             You("\82»\82Ì\8fê\82Å\82Ð\82Á\82­\82è\95Ô\82è\82Í\82\82ß\82½\81D");
3881         } else if (Is_waterlevel(&u.uz) && !no_msg) {
3882 /*JP
3883             You_feel("heavier.");
3884 */
3885             You("\8fd\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
3886         /* u.uinwater msgs already in spoteffects()/drown() */
3887         } else if (!u.uinwater && !no_msg) {
3888             if (!(emask & W_SADDLE)) {
3889                 if (Sokoban && trap) {
3890                     /* Justification elsewhere for Sokoban traps is based
3891                      * on air currents.  This is consistent with that.
3892                      * The unexpected additional force of the air currents
3893                      * once levitation ceases knocks you off your feet.
3894                      */
3895                     if (Hallucination)
3896 /*JP
3897                         pline("Bummer!  You've crashed.");
3898 */
3899                         pline("\82â\82ß\82Ä\82¥\81I\82 \82È\82½\82Í\92@\82«\82Â\82¯\82ç\82ê\82½\81D");
3900                     else
3901 /*JP
3902                         You("fall over.");
3903 */
3904                         You("\82Â\82Ü\82Ã\82¢\82½\81D");
3905 /*JP
3906                     losehp(rnd(2), "dangerous winds", KILLED_BY);
3907 */
3908                     losehp(rnd(2), "\8aë\8c¯\82È\95\97\82Å", KILLED_BY);
3909                     if (u.usteed)
3910                         dismount_steed(DISMOUNT_FELL);
3911 /*JP
3912                     selftouch("As you fall, you");
3913 */
3914                     selftouch("\97\8e\82¿\82È\82ª\82ç\81C\82 \82È\82½\82Í");
3915                 } else if (u.usteed && (is_floater(u.usteed->data)
3916                                         || is_flyer(u.usteed->data))) {
3917 /*JP
3918                     You("settle more firmly in the saddle.");
3919 */
3920                     You("\82æ\82è\82µ\82Á\82©\82è\82Æ\88Æ\82É\94[\82Ü\82Á\82½\81D");
3921                 } else if (Hallucination) {
3922 #if 0 /*JP*/
3923                     pline("Bummer!  You've %s.",
3924                           is_pool(u.ux, u.uy)
3925                              ? "splashed down"
3926                              : "hit the ground");
3927 #else
3928                     pline("\82â\82ß\82Ä\82¥\81I\82 \82È\82½\82Í%s\82É\92@\82«\82Â\82¯\82ç\82ê\82½\81D",
3929                           is_pool(u.ux, u.uy)
3930                              ? "\90\85\96Ê"
3931                              : "\92n\96Ê");
3932 #endif
3933                 } else {
3934 /*JP
3935                     You("float gently to the %s.", surface(u.ux, u.uy));
3936 */
3937                     You("\90Ã\82©\82É%s\82Ü\82Å\92H\82è\82Â\82¢\82½\81D", surface(u.ux, u.uy));
3938                 }
3939             }
3940         }
3941     }
3942
3943     /* levitation gives maximum carrying capacity, so having it end
3944        potentially triggers greater encumbrance; do this after
3945        'come down' messages, before trap activation or autopickup */
3946     (void) encumber_msg();
3947
3948     /* can't rely on u.uz0 for detecting trap door-induced level change;
3949        it gets changed to reflect the new level before we can check it */
3950     assign_level(&current_dungeon_level, &u.uz);
3951     if (trap) {
3952         switch (trap->ttyp) {
3953         case STATUE_TRAP:
3954             break;
3955         case HOLE:
3956         case TRAPDOOR:
3957             if (!Can_fall_thru(&u.uz) || u.ustuck)
3958                 break;
3959             /*FALLTHRU*/
3960         default:
3961             if (!u.utrap) /* not already in the trap */
3962                 dotrap(trap, 0);
3963         }
3964     }
3965     if (!Is_airlevel(&u.uz) && !Is_waterlevel(&u.uz) && !u.uswallow
3966         /* falling through trap door calls goto_level,
3967            and goto_level does its own pickup() call */
3968         && on_level(&u.uz, &current_dungeon_level))
3969         (void) pickup(1);
3970     return 1;
3971 }
3972
3973 /* shared code for climbing out of a pit */
3974 void
3975 climb_pit()
3976 {
3977     if (!u.utrap || u.utraptype != TT_PIT)
3978         return;
3979
3980     if (Passes_walls) {
3981         /* marked as trapped so they can pick things up */
3982 /*JP
3983         You("ascend from the pit.");
3984 */
3985         You("\97\8e\82µ\8c\8a\82ð\8fã\82Á\82Ä\82¢\82Á\82½\81D");
3986         reset_utrap(FALSE);
3987         fill_pit(u.ux, u.uy);
3988         vision_full_recalc = 1; /* vision limits change */
3989     } else if (!rn2(2) && sobj_at(BOULDER, u.ux, u.uy)) {
3990 /*JP
3991         Your("%s gets stuck in a crevice.", body_part(LEG));
3992 */
3993         Your("%s\82Í\8a\84\82ê\96Ú\82É\82Í\82Ü\82Á\82½\81D", body_part(LEG));
3994         display_nhwindow(WIN_MESSAGE, FALSE);
3995         clear_nhwindow(WIN_MESSAGE);
3996 /*JP
3997         You("free your %s.", body_part(LEG));
3998 */
3999         Your("%s\82Í\8e©\97R\82É\82È\82Á\82½\81D", body_part(LEG));
4000     } else if ((Flying || is_clinger(youmonst.data)) && !Sokoban) {
4001         /* eg fell in pit, then poly'd to a flying monster;
4002            or used '>' to deliberately enter it */
4003 /*JP
4004         You("%s from the pit.", Flying ? "fly" : "climb");
4005 */
4006         You("\97\8e\82µ\8c\8a\82©\82ç%s\82¢\82Á\82½\81D", Flying ? "\8fã\82Á\82Ä" : "\93o\82Á\82Ä");
4007         reset_utrap(FALSE);
4008         fill_pit(u.ux, u.uy);
4009         vision_full_recalc = 1; /* vision limits change */
4010     } else if (!(--u.utrap)) {
4011         reset_utrap(FALSE);
4012 #if 0 /*JP:T*/
4013         You("%s to the edge of the pit.",
4014             (Sokoban && Levitation)
4015                 ? "struggle against the air currents and float"
4016                 : u.usteed ? "ride" : "crawl");
4017 #else
4018         You("%s\97\8e\82µ\8c\8a\82Ì\92[\82É\82½\82Ç\82è\92\85\82¢\82½\81D",
4019             (Sokoban && Levitation)
4020                 ? "\8bó\8bC\82Ì\97¬\82ê\82Ì\92\86\82Å\82à\82ª\82«\82È\82ª\82ç" : "");
4021 #endif
4022         fill_pit(u.ux, u.uy);
4023         vision_full_recalc = 1; /* vision limits change */
4024     } else if (u.dz || flags.verbose) {
4025         if (u.usteed)
4026 /*JP
4027             Norep("%s is still in a pit.", upstart(y_monnam(u.usteed)));
4028 */
4029             Norep("%s\82Í\82Ü\82¾\97\8e\82µ\8c\8a\82Ì\92\86\82É\82¢\82é\81D", y_monnam(u.usteed));
4030         else
4031 #if 0 /*JP:T*/
4032             Norep((Hallucination && !rn2(5))
4033                       ? "You've fallen, and you can't get up."
4034                       : "You are still in a pit.");
4035 #else
4036             Norep((Hallucination && !rn2(5))
4037                       ? "\82 \82È\82½\82Í\97\8e\82¿\81C\8fã\82ª\82ê\82È\82¢\81D"
4038                       : "\82 \82È\82½\82Í\82Ü\82¾\97\8e\82µ\8c\8a\82Ì\92\86\82É\82¢\82é\81D");
4039 #endif
4040     }
4041 }
4042
4043 STATIC_OVL void
4044 dofiretrap(box)
4045 struct obj *box; /* null for floor trap */
4046 {
4047     boolean see_it = !Blind;
4048     int num, alt;
4049
4050     /* Bug: for box case, the equivalent of burn_floor_objects() ought
4051      * to be done upon its contents.
4052      */
4053
4054     if ((box && !carried(box)) ? is_pool(box->ox, box->oy) : Underwater) {
4055 /*JP
4056         pline("A cascade of steamy bubbles erupts from %s!",
4057 */
4058         pline("\8fö\8bC\82Ì\96A\82ª%s\82©\82ç\82µ\82ã\81[\82Á\82Æ\94­\90\82µ\82½\81I",
4059               the(box ? xname(box) : surface(u.ux, u.uy)));
4060         if (Fire_resistance)
4061 /*JP
4062             You("are uninjured.");
4063 */
4064             You("\8f\9d\82Â\82©\82È\82¢\81D");
4065         else
4066 /*JP
4067             losehp(rnd(3), "boiling water", KILLED_BY);
4068 */
4069             losehp(rnd(3), "\95¦\93«\82µ\82½\90\85\82Å", KILLED_BY);
4070         return;
4071     }
4072 #if 0 /*JP*/
4073     pline("A %s %s from %s!", tower_of_flame, box ? "bursts" : "erupts",
4074           the(box ? xname(box) : surface(u.ux, u.uy)));
4075 #else
4076     pline("\89Î\92\8c\82ª%s\82©\82ç%s\81I", box ? xname(box) : surface(u.ux,u.uy),
4077           box ? "\90\81\82«\8fo\82µ\82½" : "\97§\82¿\82Ì\82Ú\82Á\82½");
4078 #endif
4079     if (Fire_resistance) {
4080         shieldeff(u.ux, u.uy);
4081         num = rn2(2);
4082     } else if (Upolyd) {
4083         num = d(2, 4);
4084         switch (u.umonnum) {
4085         case PM_PAPER_GOLEM:
4086             alt = u.mhmax;
4087             break;
4088         case PM_STRAW_GOLEM:
4089             alt = u.mhmax / 2;
4090             break;
4091         case PM_WOOD_GOLEM:
4092             alt = u.mhmax / 4;
4093             break;
4094         case PM_LEATHER_GOLEM:
4095             alt = u.mhmax / 8;
4096             break;
4097         default:
4098             alt = 0;
4099             break;
4100         }
4101         if (alt > num)
4102             num = alt;
4103         if (u.mhmax > mons[u.umonnum].mlevel)
4104             u.mhmax -= rn2(min(u.mhmax, num + 1)), context.botl = 1;
4105     } else {
4106         num = d(2, 4);
4107         if (u.uhpmax > u.ulevel)
4108             u.uhpmax -= rn2(min(u.uhpmax, num + 1)), context.botl = 1;
4109     }
4110     if (!num)
4111 /*JP
4112         You("are uninjured.");
4113 */
4114         You("\8f\9d\82Â\82©\82È\82¢\81D");
4115     else
4116 #if 0 /*JP*/
4117         losehp(num, tower_of_flame, KILLED_BY_AN); /* fire damage */
4118 #else
4119         losehp(num, "\89Î\92\8c\82Å", KILLED_BY_AN); /* fire damage */
4120 #endif
4121     burn_away_slime();
4122
4123     if (burnarmor(&youmonst) || rn2(3)) {
4124         destroy_item(SCROLL_CLASS, AD_FIRE);
4125         destroy_item(SPBOOK_CLASS, AD_FIRE);
4126         destroy_item(POTION_CLASS, AD_FIRE);
4127     }
4128     if (!box && burn_floor_objects(u.ux, u.uy, see_it, TRUE) && !see_it)
4129 /*JP
4130         You("smell paper burning.");
4131 */
4132         You("\8e\86\82Ì\82±\82°\82é\93õ\82¢\82ª\82µ\82½\81D");
4133     if (is_ice(u.ux, u.uy))
4134         melt_ice(u.ux, u.uy, (char *) 0);
4135 }
4136
4137 STATIC_OVL void
4138 domagictrap()
4139 {
4140     register int fate = rnd(20);
4141
4142     /* What happened to the poor sucker? */
4143
4144     if (fate < 10) {
4145         /* Most of the time, it creates some monsters. */
4146         int cnt = rnd(4);
4147
4148         /* blindness effects */
4149         if (!resists_blnd(&youmonst)) {
4150 /*JP
4151             You("are momentarily blinded by a flash of light!");
4152 */
4153             You("\82Ü\82Î\82ä\82¢\8cõ\82Å\88ê\8fu\96Ú\82ª\82­\82ç\82ñ\82¾\81I");
4154             make_blinded((long) rn1(5, 10), FALSE);
4155             if (!Blind)
4156                 Your1(vision_clears);
4157         } else if (!Blind) {
4158 /*JP
4159             You_see("a flash of light!");
4160 */
4161             You("\82Ü\82Î\82ä\82¢\8cõ\82ð\97\81\82Ñ\82½\81I");
4162         }
4163
4164         /* deafness effects */
4165         if (!Deaf) {
4166 /*JP
4167             You_hear("a deafening roar!");
4168 */
4169             You_hear("\8e¨\82ð\82Â\82ñ\82´\82­\82æ\82¤\82È\99ô\9aK\82ð\95·\82¢\82½\81I");
4170             incr_itimeout(&HDeaf, rn1(20, 30));
4171             context.botl = TRUE;
4172         } else {
4173             /* magic vibrations still hit you */
4174 /*JP
4175             You_feel("rankled.");
4176 */
4177             You_feel("\82¢\82ç\82¢\82ç\82µ\82½\81D");
4178             incr_itimeout(&HDeaf, rn1(5, 15));
4179             context.botl = TRUE;
4180         }
4181         while (cnt--)
4182             (void) makemon((struct permonst *) 0, u.ux, u.uy, NO_MM_FLAGS);
4183         /* roar: wake monsters in vicinity, after placing trap-created ones */
4184         wake_nearto(u.ux, u.uy, 7 * 7);
4185         /* [flash: should probably also hit nearby gremlins with light] */
4186     } else
4187         switch (fate) {
4188         case 10:
4189         case 11:
4190             /* sometimes nothing happens */
4191             break;
4192         case 12: /* a flash of fire */
4193             dofiretrap((struct obj *) 0);
4194             break;
4195
4196         /* odd feelings */
4197         case 13:
4198 /*JP
4199             pline("A shiver runs up and down your %s!", body_part(SPINE));
4200 */
4201             pline("\90k\82¦\82ª\82 \82È\82½\82Ì%s\82ð\91\96\82Á\82½\81I", body_part(SPINE));
4202             break;
4203         case 14:
4204 #if 0 /*JP*/
4205             You_hear(Hallucination ? "the moon howling at you."
4206                                    : "distant howling.");
4207 #else
4208             You_hear(Hallucination ? "\8c\8e\82ª\96i\82¦\82Ä\82¢\82é\82Ì\82ð\95·\82¢\82½\81D"
4209                                    : "\89\93\95û\82Ì\89\93\96i\82ð\95·\82¢\82½\81D");
4210 #endif
4211             break;
4212         case 15:
4213             if (on_level(&u.uz, &qstart_level))
4214 #if 0 /*JP*/
4215                 You_feel(
4216                     "%slike the prodigal son.",
4217                     (flags.female || (Upolyd && is_neuter(youmonst.data)))
4218                         ? "oddly "
4219                         : "");
4220 #else /*JP \90¹\8f\91\82Ì\83\8b\83J\93`\82æ\82è */
4221                 You("%s\95ú\93 \91§\8eq\82Ì\82æ\82¤\82É\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D",
4222                     (flags.female || (Upolyd && is_neuter(youmonst.data)))
4223                     ? "\88Ù\8fí\82É"
4224                     : "");
4225 #endif
4226             else
4227 #if 0 /*JP*/
4228                 You("suddenly yearn for %s.",
4229                     Hallucination
4230                         ? "Cleveland"
4231                         : (In_quest(&u.uz) || at_dgn_entrance("The Quest"))
4232                               ? "your nearby homeland"
4233                               : "your distant homeland");
4234 #else
4235                 You("\93Ë\91R%s\82ª\97ö\82µ\82­\82È\82Á\82½\81D",
4236                     Hallucination ? "\90Â\90X"
4237                         : (In_quest(&u.uz) || at_dgn_entrance("\83N\83G\83X\83g"))
4238                             ? "\82·\82®\82»\82±\82É\82 \82é\8cÌ\8b½"
4239                             : "\82Í\82é\82©\82©\82È\82½\82Ì\8cÌ\8b½");
4240 #endif
4241             break;
4242         case 16:
4243 /*JP
4244             Your("pack shakes violently!");
4245 */
4246             Your("\91Ü\82Í\8c\83\82µ\82­\97h\82ê\82½\81I");
4247             break;
4248         case 17:
4249 /*JP
4250             You(Hallucination ? "smell hamburgers." : "smell charred flesh.");
4251 */
4252             You(Hallucination ? "\83n\83\93\83o\81[\83K\81[\82Ì\93õ\82¢\82ª\82µ\82½\81D" : "\8d\95\8fÅ\82°\82Ì\93÷\82Ì\93õ\82¢\82ª\82µ\82½\81D");
4253             break;
4254         case 18:
4255 /*JP
4256             You_feel("tired.");
4257 */
4258             You("\94æ\82ê\82ð\8a´\82\82½\81D");
4259             break;
4260
4261         /* very occasionally something nice happens. */
4262         case 19: { /* tame nearby monsters */
4263             int i, j;
4264             struct monst *mtmp;
4265
4266             (void) adjattrib(A_CHA, 1, FALSE);
4267             for (i = -1; i <= 1; i++)
4268                 for (j = -1; j <= 1; j++) {
4269                     if (!isok(u.ux + i, u.uy + j))
4270                         continue;
4271                     mtmp = m_at(u.ux + i, u.uy + j);
4272                     if (mtmp)
4273                         (void) tamedog(mtmp, (struct obj *) 0);
4274                 }
4275             break;
4276         }
4277         case 20: { /* uncurse stuff */
4278             struct obj pseudo;
4279             long save_conf = HConfusion;
4280
4281             pseudo = zeroobj; /* neither cursed nor blessed,
4282                                  and zero out oextra */
4283             pseudo.otyp = SCR_REMOVE_CURSE;
4284             HConfusion = 0L;
4285             (void) seffects(&pseudo);
4286             HConfusion = save_conf;
4287             break;
4288         }
4289         default:
4290             break;
4291         }
4292 }
4293
4294 /* Set an item on fire.
4295  *   "force" means not to roll a luck-based protection check for the
4296  *     item.
4297  *   "x" and "y" are the coordinates to dump the contents of a
4298  *     container, if it burns up.
4299  *
4300  * Return whether the object was destroyed.
4301  */
4302 boolean
4303 fire_damage(obj, force, x, y)
4304 struct obj *obj;
4305 boolean force;
4306 xchar x, y;
4307 {
4308     int chance;
4309     struct obj *otmp, *ncobj;
4310     int in_sight = !Blind && couldsee(x, y); /* Don't care if it's lit */
4311     int dindx;
4312
4313     /* object might light in a controlled manner */
4314     if (catch_lit(obj))
4315         return FALSE;
4316
4317     if (Is_container(obj)) {
4318         switch (obj->otyp) {
4319         case ICE_BOX:
4320             return FALSE; /* Immune */
4321         case CHEST:
4322             chance = 40;
4323             break;
4324         case LARGE_BOX:
4325             chance = 30;
4326             break;
4327         default:
4328             chance = 20;
4329             break;
4330         }
4331         if ((!force && (Luck + 5) > rn2(chance))
4332             || (is_flammable(obj) && obj->oerodeproof))
4333             return FALSE;
4334         /* Container is burnt up - dump contents out */
4335         if (in_sight)
4336 /*JP
4337             pline("%s catches fire and burns.", Yname2(obj));
4338 */
4339             pline("%s\82Í\89Î\82ª\82Â\82¢\82Ä\94R\82¦\82½\81D", Yname2(obj));
4340         if (Has_contents(obj)) {
4341             if (in_sight)
4342 /*JP
4343                 pline("Its contents fall out.");
4344 */
4345                 pline("\92\86\90g\82ª\8fo\82Ä\82«\82½\81D");
4346             for (otmp = obj->cobj; otmp; otmp = ncobj) {
4347                 ncobj = otmp->nobj;
4348                 obj_extract_self(otmp);
4349                 if (!flooreffects(otmp, x, y, ""))
4350                     place_object(otmp, x, y);
4351             }
4352         }
4353         setnotworn(obj);
4354         delobj(obj);
4355         return TRUE;
4356     } else if (!force && (Luck + 5) > rn2(20)) {
4357         /*  chance per item of sustaining damage:
4358           *     max luck (Luck==13):    10%
4359           *     avg luck (Luck==0):     75%
4360           *     awful luck (Luck<-4):  100%
4361           */
4362         return FALSE;
4363     } else if (obj->oclass == SCROLL_CLASS || obj->oclass == SPBOOK_CLASS) {
4364         if (obj->otyp == SCR_FIRE || obj->otyp == SPE_FIREBALL)
4365             return FALSE;
4366         if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
4367             if (in_sight)
4368 /*JP
4369                 pline("Smoke rises from %s.", the(xname(obj)));
4370 */
4371                 pline("%s\82©\82ç\89\8c\82ª\82 \82ª\82Á\82½\81D", the(xname(obj)));
4372             return FALSE;
4373         }
4374         dindx = (obj->oclass == SCROLL_CLASS) ? 3 : 4;
4375         if (in_sight)
4376 #if 0 /*JP*/
4377             pline("%s %s.", Yname2(obj),
4378                   destroy_strings[dindx][(obj->quan > 1L)]);
4379 #else
4380             pline("%s\82Í%s\81D", Yname2(obj),
4381                   destroy_strings[dindx][(obj->quan > 1L)]);
4382 #endif
4383         setnotworn(obj);
4384         delobj(obj);
4385         return TRUE;
4386     } else if (obj->oclass == POTION_CLASS) {
4387         dindx = (obj->otyp != POT_OIL) ? 1 : 2;
4388         if (in_sight)
4389 #if 0 /*JP*/
4390             pline("%s %s.", Yname2(obj),
4391                   destroy_strings[dindx][(obj->quan > 1L)]);
4392 #else
4393             pline("%s\82Í%s\81D", Yname2(obj),
4394                   destroy_strings[dindx][(obj->quan > 1L)]);
4395 #endif
4396         setnotworn(obj);
4397         delobj(obj);
4398         return TRUE;
4399     } else if (erode_obj(obj, (char *) 0, ERODE_BURN, EF_DESTROY)
4400                == ER_DESTROYED) {
4401         return TRUE;
4402     }
4403     return FALSE;
4404 }
4405
4406 /*
4407  * Apply fire_damage() to an entire chain.
4408  *
4409  * Return number of objects destroyed. --ALI
4410  */
4411 int
4412 fire_damage_chain(chain, force, here, x, y)
4413 struct obj *chain;
4414 boolean force, here;
4415 xchar x, y;
4416 {
4417     struct obj *obj, *nobj;
4418     int num = 0;
4419
4420     for (obj = chain; obj; obj = nobj) {
4421         nobj = here ? obj->nexthere : obj->nobj;
4422         if (fire_damage(obj, force, x, y))
4423             ++num;
4424     }
4425
4426     if (num && (Blind && !couldsee(x, y)))
4427 /*JP
4428         You("smell smoke.");
4429 */
4430         You("\89\8c\82Ì\82É\82¨\82¢\82ª\82µ\82½\81D");
4431     return num;
4432 }
4433
4434 /* obj has been thrown or dropped into lava; damage is worse than mere fire */
4435 boolean
4436 lava_damage(obj, x, y)
4437 struct obj *obj;
4438 xchar x, y;
4439 {
4440     int otyp = obj->otyp, ocls = obj->oclass;
4441
4442     /* the Amulet, invocation items, and Rider corpses are never destroyed
4443        (let Book of the Dead fall through to fire_damage() to get feedback) */
4444     if (obj_resists(obj, 0, 0) && otyp != SPE_BOOK_OF_THE_DEAD)
4445         return FALSE;
4446     /* destroy liquid (venom), wax, veggy, flesh, paper (except for scrolls
4447        and books--let fire damage deal with them), cloth, leather, wood, bone
4448        unless it's inherently or explicitly fireproof or contains something;
4449        note: potions are glass so fall through to fire_damage() and boil */
4450     if (objects[otyp].oc_material < DRAGON_HIDE
4451         && ocls != SCROLL_CLASS && ocls != SPBOOK_CLASS
4452         && objects[otyp].oc_oprop != FIRE_RES
4453         && otyp != WAN_FIRE && otyp != FIRE_HORN
4454         /* assumes oerodeproof isn't overloaded for some other purpose on
4455            non-eroding items */
4456         && !obj->oerodeproof
4457         /* fire_damage() knows how to deal with containers and contents */
4458         && !Has_contents(obj)) {
4459         if (cansee(x, y)) {
4460             /* this feedback is pretty clunky and can become very verbose
4461                when former contents of a burned container get here via
4462                flooreffects() */
4463             if (obj == thrownobj || obj == kickedobj)
4464 #if 0 /*JP*/
4465                 pline("%s %s up!", is_plural(obj) ? "They" : "It",
4466                       otense(obj, "burn"));
4467 #else
4468                 pline("\82»\82ê\82Í\94R\82¦\82Â\82«\82½\81I");
4469 #endif
4470             else
4471 /*JP
4472                 You_see("%s hit lava and burn up!", doname(obj));
4473 */
4474                 You_see("%s\82Í\97n\8aâ\82É\93\96\82½\82Á\82Ä\94R\82¦\82Â\82«\82½\81I", doname(obj));
4475         }
4476         if (carried(obj)) { /* shouldn't happen */
4477             remove_worn_item(obj, TRUE);
4478             useupall(obj);
4479         } else
4480             delobj(obj);
4481         return TRUE;
4482     }
4483     return fire_damage(obj, TRUE, x, y);
4484 }
4485
4486 void
4487 acid_damage(obj)
4488 struct obj *obj;
4489 {
4490     /* Scrolls but not spellbooks can be erased by acid. */
4491     struct monst *victim;
4492     boolean vismon;
4493
4494     if (!obj)
4495         return;
4496
4497     victim = carried(obj) ? &youmonst : mcarried(obj) ? obj->ocarry : NULL;
4498     vismon = victim && (victim != &youmonst) && canseemon(victim);
4499
4500     if (obj->greased) {
4501         grease_protect(obj, (char *) 0, victim);
4502     } else if (obj->oclass == SCROLL_CLASS && obj->otyp != SCR_BLANK_PAPER) {
4503         if (obj->otyp != SCR_BLANK_PAPER
4504 #ifdef MAIL
4505             && obj->otyp != SCR_MAIL
4506 #endif
4507             ) {
4508             if (!Blind) {
4509                 if (victim == &youmonst)
4510 /*JP
4511                     pline("Your %s.", aobjnam(obj, "fade"));
4512 */
4513                     pline("%s\82Ì\95\8e\9a\82Í\94\96\82ê\82½\81D", xname(obj));
4514                 else if (vismon)
4515 #if 0 /*JP*/
4516                     pline("%s %s.", s_suffix(Monnam(victim)),
4517                           aobjnam(obj, "fade"));
4518 #else
4519                     pline("%s\82Ì%s\82Ì\95\8e\9a\82Í\94\96\82ê\82½\81D", Monnam(victim),
4520                           xname(obj));
4521 #endif
4522             }
4523         }
4524         obj->otyp = SCR_BLANK_PAPER;
4525         obj->spe = 0;
4526         obj->dknown = 0;
4527     } else
4528         erode_obj(obj, (char *) 0, ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
4529 }
4530
4531 /* context for water_damage(), managed by water_damage_chain();
4532    when more than one stack of potions of acid explode while processing
4533    a chain of objects, use alternate phrasing after the first message */
4534 static struct h2o_ctx {
4535     int dkn_boom, unk_boom; /* track dknown, !dknown separately */
4536     boolean ctx_valid;
4537 } acid_ctx = { 0, 0, FALSE };
4538
4539 /* Get an object wet and damage it appropriately.
4540  *   "ostr", if present, is used instead of the object name in some
4541  *     messages.
4542  *   "force" means not to roll luck to protect some objects.
4543  * Returns an erosion return value (ER_*)
4544  */
4545 int
4546 water_damage(obj, ostr, force)
4547 struct obj *obj;
4548 const char *ostr;
4549 boolean force;
4550 {
4551     if (!obj)
4552         return ER_NOTHING;
4553
4554     if (snuff_lit(obj))
4555         return ER_DAMAGED;
4556
4557     if (!ostr)
4558         ostr = cxname(obj);
4559
4560     if (obj->otyp == CAN_OF_GREASE && obj->spe > 0) {
4561         return ER_NOTHING;
4562     } else if (obj->otyp == TOWEL && obj->spe < 7) {
4563         wet_a_towel(obj, rnd(7), TRUE);
4564         return ER_NOTHING;
4565     } else if (obj->greased) {
4566         if (!rn2(2))
4567             obj->greased = 0;
4568         if (carried(obj))
4569             update_inventory();
4570         return ER_GREASED;
4571     } else if (Is_container(obj) && !Is_box(obj)
4572                && (obj->otyp != OILSKIN_SACK || (obj->cursed && !rn2(3)))) {
4573         if (carried(obj))
4574 /*JP
4575             pline("Water gets into your %s!", ostr);
4576 */
4577             pline("\90\85\82ª%s\82Ì\92\86\82É\93ü\82Á\82½\81I", ostr);
4578
4579         water_damage_chain(obj->cobj, FALSE);
4580         return ER_DAMAGED; /* contents were damaged */
4581     } else if (obj->otyp == OILSKIN_SACK) {
4582         if (carried(obj))
4583 /*JP
4584             pline("Some water slides right off your %s.", ostr);
4585 */
4586             pline("%s\82Í\90\85\82ð\92e\82¢\82½\81D", ostr);
4587         makeknown(OILSKIN_SACK);
4588         /* not actually damaged, but because we /didn't/ get the "water
4589            gets into!" message, the player now has more information and
4590            thus we need to waste any potion they may have used (also,
4591            flavourwise the water is now on the floor) */
4592         return ER_DAMAGED;
4593     } else if (!force && (Luck + 5) > rn2(20)) {
4594         /*  chance per item of sustaining damage:
4595             *   max luck:               10%
4596             *   avg luck (Luck==0):     75%
4597             *   awful luck (Luck<-4):  100%
4598             */
4599         return ER_NOTHING;
4600     } else if (obj->oclass == SCROLL_CLASS) {
4601         if (obj->otyp == SCR_BLANK_PAPER
4602 #ifdef MAIL
4603             || obj->otyp == SCR_MAIL
4604 #endif
4605            ) return 0;
4606         if (carried(obj))
4607 /*JP
4608             pline("Your %s %s.", ostr, vtense(ostr, "fade"));
4609 */
4610             pline("%s\82Ì\95\8e\9a\82Í\94\96\82ê\82½\81D", ostr);
4611
4612         obj->otyp = SCR_BLANK_PAPER;
4613         obj->dknown = 0;
4614         obj->spe = 0;
4615         if (carried(obj))
4616             update_inventory();
4617         return ER_DAMAGED;
4618     } else if (obj->oclass == SPBOOK_CLASS) {
4619         if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
4620 /*JP
4621             pline("Steam rises from %s.", the(xname(obj)));
4622 */
4623             pline("\8fö\8bC\82ª%s\82©\82ç\97§\82¿\82Ì\82Ú\82Á\82½\81D", xname(obj));
4624             return 0;
4625         } else if (obj->otyp == SPE_BLANK_PAPER) {
4626             return 0;
4627         }
4628         if (carried(obj))
4629 /*JP
4630             pline("Your %s %s.", ostr, vtense(ostr, "fade"));
4631 */
4632             pline("%s\82Ì\95\8e\9a\82Í\94\96\82ê\82½\81D", ostr);
4633
4634         if (obj->otyp == SPE_NOVEL) {
4635             obj->novelidx = 0;
4636             free_oname(obj);
4637         }
4638
4639         obj->otyp = SPE_BLANK_PAPER;
4640         obj->dknown = 0;
4641         if (carried(obj))
4642             update_inventory();
4643         return ER_DAMAGED;
4644     } else if (obj->oclass == POTION_CLASS) {
4645         if (obj->otyp == POT_ACID) {
4646             char *bufp;
4647 #if 0 /*JP*/
4648             boolean one = (obj->quan == 1L), update = carried(obj),
4649                     exploded = FALSE;
4650 #else
4651             boolean update = carried(obj);
4652 #endif
4653
4654             if (Blind && !carried(obj))
4655                 obj->dknown = 0;
4656 #if 0 /*JP*/
4657             if (acid_ctx.ctx_valid)
4658                 exploded = ((obj->dknown ? acid_ctx.dkn_boom
4659                                          : acid_ctx.unk_boom) > 0);
4660 #endif
4661             /* First message is
4662              * "a [potion|<color> potion|potion of acid] explodes"
4663              * depending on obj->dknown (potion has been seen) and
4664              * objects[POT_ACID].oc_name_known (fully discovered),
4665              * or "some {plural version} explode" when relevant.
4666              * Second and subsequent messages for same chain and
4667              * matching dknown status are
4668              * "another [potion|<color> &c] explodes" or plural
4669              * variant.
4670              */
4671             bufp = simpleonames(obj);
4672 #if 0 /*JP*/
4673             pline("%s %s %s!", /* "A potion explodes!" */
4674                   !exploded ? (one ? "A" : "Some")
4675                             : (one ? "Another" : "More"),
4676                   bufp, vtense(bufp, "explode"));
4677 #else
4678             pline("%s\82Í\94\9a\94­\82µ\82½\81I", bufp);
4679 #endif
4680             if (acid_ctx.ctx_valid) {
4681                 if (obj->dknown)
4682                     acid_ctx.dkn_boom++;
4683                 else
4684                     acid_ctx.unk_boom++;
4685             }
4686             setnotworn(obj);
4687             delobj(obj);
4688             if (update)
4689                 update_inventory();
4690             return ER_DESTROYED;
4691         } else if (obj->odiluted) {
4692             if (carried(obj))
4693 /*JP
4694                 pline("Your %s %s further.", ostr, vtense(ostr, "dilute"));
4695 */
4696                 pline("%s\82Í\82³\82ç\82É\94\96\82Ü\82Á\82½\81D", ostr);
4697
4698             obj->otyp = POT_WATER;
4699             obj->dknown = 0;
4700             obj->blessed = obj->cursed = 0;
4701             obj->odiluted = 0;
4702             if (carried(obj))
4703                 update_inventory();
4704             return ER_DAMAGED;
4705         } else if (obj->otyp != POT_WATER) {
4706             if (carried(obj))
4707 /*JP
4708                 pline("Your %s %s.", ostr, vtense(ostr, "dilute"));
4709 */
4710                 pline("%s\82Í\94\96\82Ü\82Á\82½\81D", ostr);
4711
4712             obj->odiluted++;
4713             if (carried(obj))
4714                 update_inventory();
4715             return ER_DAMAGED;
4716         }
4717     } else {
4718         return erode_obj(obj, ostr, ERODE_RUST, EF_NONE);
4719     }
4720     return ER_NOTHING;
4721 }
4722
4723 void
4724 water_damage_chain(obj, here)
4725 struct obj *obj;
4726 boolean here;
4727 {
4728     struct obj *otmp;
4729
4730     /* initialize acid context: so far, neither seen (dknown) potions of
4731        acid nor unseen have exploded during this water damage sequence */
4732     acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
4733     acid_ctx.ctx_valid = TRUE;
4734
4735     for (; obj; obj = otmp) {
4736         otmp = here ? obj->nexthere : obj->nobj;
4737         water_damage(obj, (char *) 0, FALSE);
4738     }
4739
4740     /* reset acid context */
4741     acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
4742     acid_ctx.ctx_valid = FALSE;
4743 }
4744
4745 /*
4746  * This function is potentially expensive - rolling
4747  * inventory list multiple times.  Luckily it's seldom needed.
4748  * Returns TRUE if disrobing made player unencumbered enough to
4749  * crawl out of the current predicament.
4750  */
4751 STATIC_OVL boolean
4752 emergency_disrobe(lostsome)
4753 boolean *lostsome;
4754 {
4755     int invc = inv_cnt(TRUE);
4756
4757     while (near_capacity() > (Punished ? UNENCUMBERED : SLT_ENCUMBER)) {
4758         register struct obj *obj, *otmp = (struct obj *) 0;
4759         register int i;
4760
4761         /* Pick a random object */
4762         if (invc > 0) {
4763             i = rn2(invc);
4764             for (obj = invent; obj; obj = obj->nobj) {
4765                 /*
4766                  * Undroppables are: body armor, boots, gloves,
4767                  * amulets, and rings because of the time and effort
4768                  * in removing them + loadstone and other cursed stuff
4769                  * for obvious reasons.
4770                  */
4771                 if (!((obj->otyp == LOADSTONE && obj->cursed) || obj == uamul
4772                       || obj == uleft || obj == uright || obj == ublindf
4773                       || obj == uarm || obj == uarmc || obj == uarmg
4774                       || obj == uarmf || obj == uarmu
4775                       || (obj->cursed && (obj == uarmh || obj == uarms))
4776                       || welded(obj)))
4777                     otmp = obj;
4778                 /* reached the mark and found some stuff to drop? */
4779                 if (--i < 0 && otmp)
4780                     break;
4781
4782                 /* else continue */
4783             }
4784         }
4785         if (!otmp)
4786             return FALSE; /* nothing to drop! */
4787         if (otmp->owornmask)
4788             remove_worn_item(otmp, FALSE);
4789         *lostsome = TRUE;
4790         dropx(otmp);
4791         invc--;
4792     }
4793     return TRUE;
4794 }
4795
4796
4797 /*  return TRUE iff player relocated */
4798 boolean
4799 drown()
4800 {
4801     const char *pool_of_water;
4802     boolean inpool_ok = FALSE, crawl_ok;
4803     int i, x, y;
4804
4805     /* happily wading in the same contiguous pool */
4806     if (u.uinwater && is_pool(u.ux - u.dx, u.uy - u.dy)
4807         && (Swimming || Amphibious)) {
4808         /* water effects on objects every now and then */
4809         if (!rn2(5))
4810             inpool_ok = TRUE;
4811         else
4812             return FALSE;
4813     }
4814
4815     if (!u.uinwater) {
4816 #if 0 /*JP:T*/
4817         You("%s into the %s%c", Is_waterlevel(&u.uz) ? "plunge" : "fall",
4818             hliquid("water"),
4819             Amphibious || Swimming ? '.' : '!');
4820 #else
4821         You("%s\82Ì\92\86\82É%s%s", hliquid("\90\85"),
4822             Is_waterlevel(&u.uz) ? "\94ò\82Ñ\82±\82ñ\82¾" : "\97\8e\82¿\82½",
4823             Amphibious || Swimming ? "\81D" : "\81I");
4824 #endif
4825         if (!Swimming && !Is_waterlevel(&u.uz))
4826 /*JP
4827             You("sink like %s.", Hallucination ? "the Titanic" : "a rock");
4828 */
4829             You("%s\82Ì\82æ\82¤\82É\92¾\82ñ\82¾\81D", Hallucination ? "\83^\83C\83^\83j\83b\83N\8d\86" : "\8aâ");
4830     }
4831
4832     water_damage_chain(invent, FALSE);
4833
4834     if (u.umonnum == PM_GREMLIN && rn2(3))
4835         (void) split_mon(&youmonst, (struct monst *) 0);
4836     else if (u.umonnum == PM_IRON_GOLEM) {
4837 /*JP
4838         You("rust!");
4839 */
4840         You("\8eK\82Ñ\82½\81I");
4841         i = Maybe_Half_Phys(d(2, 6));
4842         if (u.mhmax > i)
4843             u.mhmax -= i;
4844 /*JP
4845         losehp(i, "rusting away", KILLED_BY);
4846 */
4847         losehp(i, "\8a®\91S\82É\8eK\82Ñ\82Ä", KILLED_BY);
4848     }
4849     if (inpool_ok)
4850         return FALSE;
4851
4852     if ((i = number_leashed()) > 0) {
4853 #if 0 /*JP*/
4854         pline_The("leash%s slip%s loose.", (i > 1) ? "es" : "",
4855                   (i > 1) ? "" : "s");
4856 #else
4857         pline("\95R\82ª\82ä\82é\82ñ\82¾\81D");
4858 #endif
4859         unleash_all();
4860     }
4861
4862     if (Amphibious || Swimming) {
4863         if (Amphibious) {
4864             if (flags.verbose)
4865 /*JP
4866                 pline("But you aren't drowning.");
4867 */
4868                 pline("\82µ\82©\82µ\81C\82 \82È\82½\82Í\93M\82ê\82È\82©\82Á\82½\81D");
4869             if (!Is_waterlevel(&u.uz)) {
4870                 if (Hallucination)
4871 /*JP
4872                     Your("keel hits the bottom.");
4873 */
4874                     You("\92ê\82É\83j\81[\83h\83\8d\83b\83v\82ð\8c\88\82ß\82½\81D");
4875                 else
4876 /*JP
4877                     You("touch bottom.");
4878 */
4879                     You("\92ê\82É\82Â\82¢\82½\81D");
4880             }
4881         }
4882         if (Punished) {
4883             unplacebc();
4884             placebc();
4885         }
4886         vision_recalc(2); /* unsee old position */
4887         u.uinwater = 1;
4888         under_water(1);
4889         vision_full_recalc = 1;
4890         return FALSE;
4891     }
4892     if ((Teleportation || can_teleport(youmonst.data)) && !Unaware
4893         && (Teleport_control || rn2(3) < Luck + 2)) {
4894 #if 0 /*JP*/
4895         You("attempt a teleport spell."); /* utcsri!carroll */
4896 #else
4897         You("\8fu\8aÔ\88Ú\93®\82Ì\8eô\95\82ð\8f¥\82¦\82Ä\82Ý\82½\81D");
4898 #endif
4899         if (!level.flags.noteleport) {
4900             (void) dotele(FALSE);
4901             if (!is_pool(u.ux, u.uy))
4902                 return TRUE;
4903         } else
4904 /*JP
4905             pline_The("attempted teleport spell fails.");
4906 */
4907             pline("\8fu\8aÔ\88Ú\93®\82Ì\8eô\95\82Í\8e¸\94s\82µ\82½\81D");
4908     }
4909     if (u.usteed) {
4910         dismount_steed(DISMOUNT_GENERIC);
4911         if (!is_pool(u.ux, u.uy))
4912             return TRUE;
4913     }
4914     crawl_ok = FALSE;
4915     x = y = 0; /* lint suppression */
4916     /* if sleeping, wake up now so that we don't crawl out of water
4917        while still asleep; we can't do that the same way that waking
4918        due to combat is handled; note unmul() clears u.usleep */
4919     if (u.usleep)
4920 /*JP
4921         unmul("Suddenly you wake up!");
4922 */
4923         unmul("\93Ë\91R\82 \82È\82½\82Í\96Ú\82ª\8ao\82ß\82½\81I");
4924     /* being doused will revive from fainting */
4925     if (is_fainted())
4926         reset_faint();
4927     /* can't crawl if unable to move (crawl_ok flag stays false) */
4928     if (multi < 0 || (Upolyd && !youmonst.data->mmove))
4929         goto crawl;
4930     /* look around for a place to crawl to */
4931     for (i = 0; i < 100; i++) {
4932         x = rn1(3, u.ux - 1);
4933         y = rn1(3, u.uy - 1);
4934         if (crawl_destination(x, y)) {
4935             crawl_ok = TRUE;
4936             goto crawl;
4937         }
4938     }
4939     /* one more scan */
4940     for (x = u.ux - 1; x <= u.ux + 1; x++)
4941         for (y = u.uy - 1; y <= u.uy + 1; y++)
4942             if (crawl_destination(x, y)) {
4943                 crawl_ok = TRUE;
4944                 goto crawl;
4945             }
4946 crawl:
4947     if (crawl_ok) {
4948         boolean lost = FALSE;
4949         /* time to do some strip-tease... */
4950         boolean succ = Is_waterlevel(&u.uz) ? TRUE : emergency_disrobe(&lost);
4951
4952 /*JP
4953         You("try to crawl out of the %s.", hliquid("water"));
4954 */
4955         You("%s\82©\82ç\82Í\82¢\82 \82ª\82ë\82¤\82Æ\82µ\82½\81D", hliquid("\90\85"));
4956         if (lost)
4957 /*JP
4958             You("dump some of your gear to lose weight...");
4959 */
4960             You("\91Ì\82ð\8cy\82­\82·\82é\82½\82ß\82¢\82­\82Â\82©\95¨\82ð\93\8a\82°\82·\82Ä\82½\81D\81D\81D");
4961         if (succ) {
4962 /*JP
4963             pline("Pheew!  That was close.");
4964 */
4965             pline("\83n\83@\83n\83@\81I\82 \82Ô\82È\82©\82Á\82½\81D");
4966             teleds(x, y, TRUE);
4967             return TRUE;
4968         }
4969         /* still too much weight */
4970 /*JP
4971         pline("But in vain.");
4972 */
4973         pline("\82ª\81C\96³\91Ê\82¾\82Á\82½\81D");
4974     }
4975     u.uinwater = 1;
4976 /*JP
4977     You("drown.");
4978 */
4979     You("\93M\82ê\82½\81D");
4980     for (i = 0; i < 5; i++) { /* arbitrary number of loops */
4981         /* killer format and name are reconstructed every iteration
4982            because lifesaving resets them */
4983         pool_of_water = waterbody_name(u.ux, u.uy);
4984         killer.format = KILLED_BY_AN;
4985 #if 0 /*JP*/
4986         /* avoid "drowned in [a] water" */
4987         if (!strcmp(pool_of_water, "water"))
4988             pool_of_water = "deep water", killer.format = KILLED_BY;
4989 #endif
4990         Strcpy(killer.name, pool_of_water);
4991         done(DROWNING);
4992         /* oops, we're still alive.  better get out of the water. */
4993         if (safe_teleds(TRUE))
4994             break; /* successful life-save */
4995         /* nowhere safe to land; repeat drowning loop... */
4996 /*JP
4997         pline("You're still drowning.");
4998 */
4999         You("\82Ü\82¾\93M\82ê\82Ä\82¢\82é\81D");
5000     }
5001     if (u.uinwater) {
5002         u.uinwater = 0;
5003 #if 0 /*JP*/
5004         You("find yourself back %s.",
5005             Is_waterlevel(&u.uz) ? "in an air bubble" : "on land");
5006 #else
5007         You("\82¢\82Â\82Ì\82Ü\82É\82©%s\82É\82¢\82é\82Ì\82É\8bC\82ª\82Â\82¢\82½\81D",
5008             Is_waterlevel(&u.uz) ? "\8bó\8bC\82Ì\96A\82Ì\92\86" : "\92n\96Ê");
5009 #endif
5010     }
5011     return TRUE;
5012 }
5013
5014 void
5015 drain_en(n)
5016 int n;
5017 {
5018     if (!u.uenmax) {
5019         /* energy is completely gone */
5020 /*JP
5021         You_feel("momentarily lethargic.");
5022 */
5023         You("\88ê\8fu\96³\8bC\97Í\8a´\82ð\8a´\82\82½\81D");
5024     } else {
5025         /* throttle further loss a bit when there's not much left to lose */
5026         if (n > u.uenmax || n > u.ulevel)
5027             n = rnd(n);
5028
5029 /*JP
5030         You_feel("your magical energy drain away%c", (n > u.uen) ? '!' : '.');
5031 */
5032         You("\96\82\96@\82Ì\83G\83l\83\8b\83M\81[\82ª\8bz\82¢\82Æ\82ç\82ê\82½\82æ\82¤\82È\8bC\82ª\82µ\82½%s", (n > u.uen) ? "\81I" : "\81D");
5033         u.uen -= n;
5034         if (u.uen < 0) {
5035             u.uenmax -= rnd(-u.uen);
5036             if (u.uenmax < 0)
5037                 u.uenmax = 0;
5038             u.uen = 0;
5039         }
5040         context.botl = 1;
5041     }
5042 }
5043
5044 /* disarm a trap */
5045 int
5046 dountrap()
5047 {
5048     if (near_capacity() >= HVY_ENCUMBER) {
5049 /*JP
5050         pline("You're too strained to do that.");
5051 */
5052         pline("ã©\82ð\89ð\8f\9c\82µ\82æ\82¤\82É\82à\95¨\82ð\8e\9d\82¿\82·\82¬\82Ä\82¢\82é\81D");
5053         return 0;
5054     }
5055     if ((nohands(youmonst.data) && !webmaker(youmonst.data))
5056         || !youmonst.data->mmove) {
5057 /*JP
5058         pline("And just how do you expect to do that?");
5059 */
5060         pline("\82¢\82Á\82½\82¢\89½\82ð\8aú\91Ò\82µ\82Ä\82¢\82é\82ñ\82¾\82¢\81H");
5061         return 0;
5062     } else if (u.ustuck && sticks(youmonst.data)) {
5063 /*JP
5064         pline("You'll have to let go of %s first.", mon_nam(u.ustuck));
5065 */
5066         pline("%s\82ð\8eè\97£\82³\82È\82¢\82±\82Æ\82É\82Í\82Å\82«\82È\82¢\81D", mon_nam(u.ustuck));
5067         return 0;
5068     }
5069     if (u.ustuck || (welded(uwep) && bimanual(uwep))) {
5070 /*JP
5071         Your("%s seem to be too busy for that.", makeplural(body_part(HAND)));
5072 */
5073         Your("\82»\82ñ\82È\82±\82Æ\82ð\82·\82é\97]\97T\82È\82ñ\82Ä\82È\82¢\81D");
5074         return 0;
5075     }
5076     return untrap(FALSE);
5077 }
5078
5079 /* Probability of disabling a trap.  Helge Hafting */
5080 STATIC_OVL int
5081 untrap_prob(ttmp)
5082 struct trap *ttmp;
5083 {
5084     int chance = 3;
5085
5086     /* Only spiders know how to deal with webs reliably */
5087     if (ttmp->ttyp == WEB && !webmaker(youmonst.data))
5088         chance = 30;
5089     if (Confusion || Hallucination)
5090         chance++;
5091     if (Blind)
5092         chance++;
5093     if (Stunned)
5094         chance += 2;
5095     if (Fumbling)
5096         chance *= 2;
5097     /* Your own traps are better known than others. */
5098     if (ttmp && ttmp->madeby_u)
5099         chance--;
5100     if (Role_if(PM_ROGUE)) {
5101         if (rn2(2 * MAXULEV) < u.ulevel)
5102             chance--;
5103         if (u.uhave.questart && chance > 1)
5104             chance--;
5105     } else if (Role_if(PM_RANGER) && chance > 1)
5106         chance--;
5107     return rn2(chance);
5108 }
5109
5110 /* Replace trap with object(s).  Helge Hafting */
5111 void
5112 cnv_trap_obj(otyp, cnt, ttmp, bury_it)
5113 int otyp;
5114 int cnt;
5115 struct trap *ttmp;
5116 boolean bury_it;
5117 {
5118     struct obj *otmp = mksobj(otyp, TRUE, FALSE);
5119
5120     otmp->quan = cnt;
5121     otmp->owt = weight(otmp);
5122     /* Only dart traps are capable of being poisonous */
5123     if (otyp != DART)
5124         otmp->opoisoned = 0;
5125     place_object(otmp, ttmp->tx, ttmp->ty);
5126     if (bury_it) {
5127         /* magical digging first disarms this trap, then will unearth it */
5128         (void) bury_an_obj(otmp, (boolean *) 0);
5129     } else {
5130         /* Sell your own traps only... */
5131         if (ttmp->madeby_u)
5132             sellobj(otmp, ttmp->tx, ttmp->ty);
5133         stackobj(otmp);
5134     }
5135     newsym(ttmp->tx, ttmp->ty);
5136     if (u.utrap && ttmp->tx == u.ux && ttmp->ty == u.uy)
5137         reset_utrap(TRUE);
5138     deltrap(ttmp);
5139 }
5140
5141 /* while attempting to disarm an adjacent trap, we've fallen into it */
5142 STATIC_OVL void
5143 move_into_trap(ttmp)
5144 struct trap *ttmp;
5145 {
5146     int bc = 0;
5147     xchar x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy;
5148     boolean unused;
5149
5150     bx = by = cx = cy = 0; /* lint suppression */
5151     /* we know there's no monster in the way, and we're not trapped */
5152     if (!Punished
5153         || drag_ball(x, y, &bc, &bx, &by, &cx, &cy, &unused, TRUE)) {
5154         u.ux0 = u.ux, u.uy0 = u.uy;
5155         u.ux = x, u.uy = y;
5156         u.umoved = TRUE;
5157         newsym(u.ux0, u.uy0);
5158         vision_recalc(1);
5159         check_leash(u.ux0, u.uy0);
5160         if (Punished)
5161             move_bc(0, bc, bx, by, cx, cy);
5162         /* marking the trap unseen forces dotrap() to treat it like a new
5163            discovery and prevents pickup() -> look_here() -> check_here()
5164            from giving a redundant "there is a <trap> here" message when
5165            there are objects covering this trap */
5166         ttmp->tseen = 0; /* hack for check_here() */
5167         /* trigger the trap */
5168         iflags.failing_untrap++; /* spoteffects() -> dotrap(,FAILEDUNTRAP) */
5169         spoteffects(TRUE); /* pickup() + dotrap() */
5170         iflags.failing_untrap--;
5171         /* this should no longer be necessary; before the failing_untrap
5172            hack, Flying hero would not trigger an unseen bear trap and
5173            setting it not-yet-seen above resulted in leaving it hidden */
5174         if ((ttmp = t_at(u.ux, u.uy)) != 0)
5175             ttmp->tseen = 1;
5176         exercise(A_WIS, FALSE);
5177     }
5178 }
5179
5180 /* 0: doesn't even try
5181  * 1: tries and fails
5182  * 2: succeeds
5183  */
5184 STATIC_OVL int
5185 try_disarm(ttmp, force_failure)
5186 struct trap *ttmp;
5187 boolean force_failure;
5188 {
5189     struct monst *mtmp = m_at(ttmp->tx, ttmp->ty);
5190     int ttype = ttmp->ttyp;
5191     boolean under_u = (!u.dx && !u.dy);
5192     boolean holdingtrap = (ttype == BEAR_TRAP || ttype == WEB);
5193
5194     /* Test for monster first, monsters are displayed instead of trap. */
5195     if (mtmp && (!mtmp->mtrapped || !holdingtrap)) {
5196 /*JP
5197         pline("%s is in the way.", Monnam(mtmp));
5198 */
5199         pline("\82»\82±\82É\82Í%s\82ª\82¢\82é\81D", Monnam(mtmp));
5200         return 0;
5201     }
5202     /* We might be forced to move onto the trap's location. */
5203     if (sobj_at(BOULDER, ttmp->tx, ttmp->ty) && !Passes_walls && !under_u) {
5204 /*JP
5205         There("is a boulder in your way.");
5206 */
5207         pline("\82»\82±\82É\82Í\8aâ\82ª\82 \82é\81D");
5208         return 0;
5209     }
5210     /* duplicate tight-space checks from test_move */
5211     if (u.dx && u.dy && bad_rock(youmonst.data, u.ux, ttmp->ty)
5212         && bad_rock(youmonst.data, ttmp->tx, u.uy)) {
5213         if ((invent && (inv_weight() + weight_cap() > 600))
5214             || bigmonst(youmonst.data)) {
5215             /* don't allow untrap if they can't get thru to it */
5216 #if 0 /*JP*/
5217             You("are unable to reach the %s!",
5218                 defsyms[trap_to_defsym(ttype)].explanation);
5219 #else
5220             You("%s\82É\93Í\82©\82È\82¢\81I",
5221                 defsyms[trap_to_defsym(ttype)].explanation);
5222 #endif
5223             return 0;
5224         }
5225     }
5226     /* untrappable traps are located on the ground. */
5227     if (!can_reach_floor(under_u)) {
5228         if (u.usteed && P_SKILL(P_RIDING) < P_BASIC)
5229             rider_cant_reach();
5230         else
5231 #if 0 /*JP*/
5232             You("are unable to reach the %s!",
5233                 defsyms[trap_to_defsym(ttype)].explanation);
5234 #else
5235             You("%s\82É\93Í\82©\82È\82¢\81I",
5236                 defsyms[trap_to_defsym(ttype)].explanation);
5237 #endif
5238         return 0;
5239     }
5240
5241     /* Will our hero succeed? */
5242     if (force_failure || untrap_prob(ttmp)) {
5243         if (rnl(5)) {
5244 /*JP
5245             pline("Whoops...");
5246 */
5247             pline("\82¤\82í\82Á\81D\81D\81D");
5248             if (mtmp) { /* must be a trap that holds monsters */
5249                 if (ttype == BEAR_TRAP) {
5250                     if (mtmp->mtame)
5251                         abuse_dog(mtmp);
5252                     mtmp->mhp -= rnd(4);
5253                     if (DEADMONSTER(mtmp))
5254                         killed(mtmp);
5255                 } else if (ttype == WEB) {
5256                     if (!webmaker(youmonst.data)) {
5257                         struct trap *ttmp2 = maketrap(u.ux, u.uy, WEB);
5258
5259                         if (ttmp2) {
5260                             pline_The(
5261 /*JP
5262                                 "webbing sticks to you.  You're caught too!");
5263 */
5264                                 "\82­\82à\82Ì\91\83\82ª\82 \82È\82½\82É\82©\82ç\82ñ\82Å\82«\82½\81D\82Ü\82·\82Ü\82·\95ß\82Ü\82Á\82Ä\82µ\82Ü\82Á\82½\81I");
5265                             dotrap(ttmp2, NOWEBMSG);
5266                             if (u.usteed && u.utrap) {
5267                                 /* you, not steed, are trapped */
5268                                 dismount_steed(DISMOUNT_FELL);
5269                             }
5270                         }
5271                     } else
5272 /*JP
5273                         pline("%s remains entangled.", Monnam(mtmp));
5274 */
5275                         pline("%s\82Í\82©\82ç\82Ü\82Á\82½\82Ü\82Ü\82¾\81D", Monnam(mtmp));
5276                 }
5277             } else if (under_u) {
5278                 /* [don't need the iflags.failing_untrap hack here] */
5279                 dotrap(ttmp, FAILEDUNTRAP);
5280             } else {
5281                 move_into_trap(ttmp);
5282             }
5283         } else {
5284 #if 0 /*JP*/
5285             pline("%s %s is difficult to %s.",
5286                   ttmp->madeby_u ? "Your" : under_u ? "This" : "That",
5287                   defsyms[trap_to_defsym(ttype)].explanation,
5288                   (ttype == WEB) ? "remove" : "disarm");
5289 #else
5290             pline("%s%s\82ð\89ð\8f\9c\82·\82é\82Ì\82Í\8d¢\93ï\82¾\81D",
5291                   ttmp->madeby_u ? "\82 \82È\82½\82Ì\8ed\8a|\82¯\82½" : under_u ? "\82±\82Ì" : "\82»\82Ì",
5292                   defsyms[trap_to_defsym(ttype)].explanation);
5293 #endif
5294         }
5295         return 1;
5296     }
5297     return 2;
5298 }
5299
5300 STATIC_OVL void
5301 reward_untrap(ttmp, mtmp)
5302 struct trap *ttmp;
5303 struct monst *mtmp;
5304 {
5305     if (!ttmp->madeby_u) {
5306         if (rnl(10) < 8 && !mtmp->mpeaceful && !mtmp->msleeping
5307             && !mtmp->mfrozen && !mindless(mtmp->data)
5308             && mtmp->data->mlet != S_HUMAN) {
5309             mtmp->mpeaceful = 1;
5310             set_malign(mtmp); /* reset alignment */
5311 /*JP
5312             pline("%s is grateful.", Monnam(mtmp));
5313 */
5314             pline("%s\82Í\8aì\82ñ\82Å\82¢\82é\81D", Monnam(mtmp));
5315         }
5316         /* Helping someone out of a trap is a nice thing to do,
5317          * A lawful may be rewarded, but not too often.  */
5318         if (!rn2(3) && !rnl(8) && u.ualign.type == A_LAWFUL) {
5319             adjalign(1);
5320 /*JP
5321             You_feel("that you did the right thing.");
5322 */
5323             You("\90³\82µ\82¢\82±\82Æ\82ð\82µ\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
5324         }
5325     }
5326 }
5327
5328 STATIC_OVL int
5329 disarm_holdingtrap(ttmp) /* Helge Hafting */
5330 struct trap *ttmp;
5331 {
5332     struct monst *mtmp;
5333     int fails = try_disarm(ttmp, FALSE);
5334
5335     if (fails < 2)
5336         return fails;
5337
5338     /* ok, disarm it. */
5339
5340     /* untrap the monster, if any.
5341        There's no need for a cockatrice test, only the trap is touched */
5342     if ((mtmp = m_at(ttmp->tx, ttmp->ty)) != 0) {
5343         mtmp->mtrapped = 0;
5344 #if 0 /*JP*/
5345         You("remove %s %s from %s.", the_your[ttmp->madeby_u],
5346             (ttmp->ttyp == BEAR_TRAP) ? "bear trap" : "webbing",
5347             mon_nam(mtmp));
5348 #else
5349         You("%s%s\82ð%s\82©\82ç\82Í\82¸\82µ\82½\81D", set_you[ttmp->madeby_u],
5350             (ttmp->ttyp == BEAR_TRAP) ? "\8cF\82Ìã©" : "\82­\82à\82Ì\91\83",
5351             mon_nam(mtmp));
5352 #endif
5353         reward_untrap(ttmp, mtmp);
5354     } else {
5355         if (ttmp->ttyp == BEAR_TRAP) {
5356 /*JP
5357             You("disarm %s bear trap.", the_your[ttmp->madeby_u]);
5358 */
5359             You("%s\8cF\82Ìã©\82ð\89ð\8f\9c\82µ\82½\81D", set_you[ttmp->madeby_u]);
5360             cnv_trap_obj(BEARTRAP, 1, ttmp, FALSE);
5361         } else /* if (ttmp->ttyp == WEB) */ {
5362 /*JP
5363             You("succeed in removing %s web.", the_your[ttmp->madeby_u]);
5364 */
5365             You("%s\82­\82à\82Ì\91\83\82ð\8eæ\82è\8f\9c\82¢\82½\81D", set_you[ttmp->madeby_u]);
5366             deltrap(ttmp);
5367         }
5368     }
5369     newsym(u.ux + u.dx, u.uy + u.dy);
5370     return 1;
5371 }
5372
5373 STATIC_OVL int
5374 disarm_landmine(ttmp) /* Helge Hafting */
5375 struct trap *ttmp;
5376 {
5377     int fails = try_disarm(ttmp, FALSE);
5378
5379     if (fails < 2)
5380         return fails;
5381 /*JP
5382     You("disarm %s land mine.", the_your[ttmp->madeby_u]);
5383 */
5384     You("%s\92n\97\8b\82ð\89ð\8f\9c\82µ\82½\81D", set_you[ttmp->madeby_u]);
5385     cnv_trap_obj(LAND_MINE, 1, ttmp, FALSE);
5386     return 1;
5387 }
5388
5389 /* getobj will filter down to cans of grease and known potions of oil */
5390 static NEARDATA const char oil[] = { ALL_CLASSES, TOOL_CLASS, POTION_CLASS,
5391                                      0 };
5392
5393 /* it may not make much sense to use grease on floor boards, but so what? */
5394 STATIC_OVL int
5395 disarm_squeaky_board(ttmp)
5396 struct trap *ttmp;
5397 {
5398     struct obj *obj;
5399     boolean bad_tool;
5400     int fails;
5401
5402     obj = getobj(oil, "untrap with");
5403     if (!obj)
5404         return 0;
5405
5406     bad_tool = (obj->cursed
5407                 || ((obj->otyp != POT_OIL || obj->lamplit)
5408                     && (obj->otyp != CAN_OF_GREASE || !obj->spe)));
5409     fails = try_disarm(ttmp, bad_tool);
5410     if (fails < 2)
5411         return fails;
5412
5413     /* successfully used oil or grease to fix squeaky board */
5414     if (obj->otyp == CAN_OF_GREASE) {
5415         consume_obj_charge(obj, TRUE);
5416     } else {
5417         useup(obj); /* oil */
5418         makeknown(POT_OIL);
5419     }
5420 #if 0 /*JP*/
5421     You("repair the squeaky board."); /* no madeby_u */
5422 #else
5423     You("\82«\82µ\82Þ\94Â\82ð\8fC\97\9d\82µ\82½\81D"); /* no madeby_u */
5424 #endif
5425     deltrap(ttmp);
5426     newsym(u.ux + u.dx, u.uy + u.dy);
5427     more_experienced(1, 5);
5428     newexplevel();
5429     return 1;
5430 }
5431
5432 /* removes traps that shoot arrows, darts, etc. */
5433 STATIC_OVL int
5434 disarm_shooting_trap(ttmp, otyp)
5435 struct trap *ttmp;
5436 int otyp;
5437 {
5438     int fails = try_disarm(ttmp, FALSE);
5439
5440     if (fails < 2)
5441         return fails;
5442 /*JP
5443     You("disarm %s trap.", the_your[ttmp->madeby_u]);
5444 */
5445     pline("%sã©\82ð\89ð\8f\9c\82µ\82½\81D", set_you[ttmp->madeby_u]);
5446     cnv_trap_obj(otyp, 50 - rnl(50), ttmp, FALSE);
5447     return 1;
5448 }
5449
5450 /* Is the weight too heavy?
5451  * Formula as in near_capacity() & check_capacity() */
5452 STATIC_OVL int
5453 try_lift(mtmp, ttmp, wt, stuff)
5454 struct monst *mtmp;
5455 struct trap *ttmp;
5456 int wt;
5457 boolean stuff;
5458 {
5459     int wc = weight_cap();
5460
5461     if (((wt * 2) / wc) >= HVY_ENCUMBER) {
5462 #if 0 /*JP*/
5463         pline("%s is %s for you to lift.", Monnam(mtmp),
5464               stuff ? "carrying too much" : "too heavy");
5465 #else
5466         pline("%s\82Í%s\8e\9d\82¿\82 \82°\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D", Monnam(mtmp),
5467               stuff ? "\95¨\82ð\8e\9d\82¿\82·\82¬\82Ä\82¨\82è" : "\8fd\82·\82¬\82Ä");
5468 #endif
5469         if (!ttmp->madeby_u && !mtmp->mpeaceful && mtmp->mcanmove
5470             && !mindless(mtmp->data) && mtmp->data->mlet != S_HUMAN
5471             && rnl(10) < 3) {
5472             mtmp->mpeaceful = 1;
5473             set_malign(mtmp); /* reset alignment */
5474 /*JP
5475             pline("%s thinks it was nice of you to try.", Monnam(mtmp));
5476 */
5477             pline("%s\82Í\82 \82È\82½\82Ì\93w\97Í\82É\8a´\8eÓ\82µ\82Ä\82¢\82é\82æ\82¤\82¾\81D", Monnam(mtmp));
5478         }
5479         return 0;
5480     }
5481     return 1;
5482 }
5483
5484 /* Help trapped monster (out of a (spiked) pit) */
5485 STATIC_OVL int
5486 help_monster_out(mtmp, ttmp)
5487 struct monst *mtmp;
5488 struct trap *ttmp;
5489 {
5490     int wt;
5491     struct obj *otmp;
5492     boolean uprob;
5493
5494     /*
5495      * This works when levitating too -- consistent with the ability
5496      * to hit monsters while levitating.
5497      *
5498      * Should perhaps check that our hero has arms/hands at the
5499      * moment.  Helping can also be done by engulfing...
5500      *
5501      * Test the monster first - monsters are displayed before traps.
5502      */
5503     if (!mtmp->mtrapped) {
5504 /*JP
5505         pline("%s isn't trapped.", Monnam(mtmp));
5506 */
5507         pline("%s\82Íã©\82É\82©\82©\82Á\82Ä\82¢\82È\82¢\81D", Monnam(mtmp));
5508         return 0;
5509     }
5510     /* Do you have the necessary capacity to lift anything? */
5511     if (check_capacity((char *) 0))
5512         return 1;
5513
5514     /* Will our hero succeed? */
5515     if ((uprob = untrap_prob(ttmp)) && !mtmp->msleeping && mtmp->mcanmove) {
5516 #if 0 /*JP*/
5517         You("try to reach out your %s, but %s backs away skeptically.",
5518             makeplural(body_part(ARM)), mon_nam(mtmp));
5519 #else
5520         You("%s\82ð\8d·\82µ\89\84\82×\82æ\82¤\82Æ\82µ\82½\82ª%s\82Í\8cx\89ú\82µ\82Ä\82¢\82é\81D",
5521             body_part(ARM), mon_nam(mtmp));
5522 #endif
5523         return 1;
5524     }
5525
5526     /* is it a cockatrice?... */
5527     if (touch_petrifies(mtmp->data) && !uarmg && !Stone_resistance) {
5528 #if 0 /*JP*/
5529         You("grab the trapped %s using your bare %s.", mtmp->data->mname,
5530             makeplural(body_part(HAND)));
5531 #else
5532         You("ã©\82É\82©\82©\82Á\82Ä\82¢\82é%s\82ð\91f%s\82Å\92Í\82ñ\82¾\81D", mtmp->data->mname,
5533             body_part(HAND));
5534 #endif
5535
5536         if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) {
5537             display_nhwindow(WIN_MESSAGE, FALSE);
5538         } else {
5539             char kbuf[BUFSZ];
5540
5541 #if 0 /*JP*/
5542             Sprintf(kbuf, "trying to help %s out of a pit",
5543                     an(mtmp->data->mname));
5544 #else
5545             Sprintf(kbuf, "ã©\82É\82©\82©\82Á\82Ä\82¢\82é%s\82ð\8f\95\82¯\82æ\82¤\82Æ\82µ\82Ä",
5546                     a_monnam(mtmp));
5547 #endif
5548             instapetrify(kbuf);
5549             return 1;
5550         }
5551     }
5552     /* need to do cockatrice check first if sleeping or paralyzed */
5553     if (uprob) {
5554 /*JP
5555         You("try to grab %s, but cannot get a firm grasp.", mon_nam(mtmp));
5556 */
5557         You("%s\82ð\82Â\82©\82à\82¤\82Æ\82µ\82½\82ª\81C\82µ\82Á\82©\82è\82Æ\88¬\82ê\82È\82©\82Á\82½\81D", mon_nam(mtmp));
5558         if (mtmp->msleeping) {
5559             mtmp->msleeping = 0;
5560 /*JP
5561             pline("%s awakens.", Monnam(mtmp));
5562 */
5563             pline("%s\82Í\96Ú\82ð\8ao\82Ü\82µ\82½\81D", Monnam(mtmp));
5564         }
5565         return 1;
5566     }
5567
5568 #if 0 /*JP*/
5569     You("reach out your %s and grab %s.", makeplural(body_part(ARM)),
5570         mon_nam(mtmp));
5571 #else
5572     You("%s\82ð\90L\82Î\82µ\82Ä%s\82ð\82Â\82©\82ñ\82¾\81D", body_part(ARM),
5573         mon_nam(mtmp));
5574 #endif
5575
5576     if (mtmp->msleeping) {
5577         mtmp->msleeping = 0;
5578 /*JP
5579         pline("%s awakens.", Monnam(mtmp));
5580 */
5581         pline("%s\82Í\96Ú\82ð\8ao\82Ü\82µ\82½\81D", Monnam(mtmp));
5582     } else if (mtmp->mfrozen && !rn2(mtmp->mfrozen)) {
5583         /* After such manhandling, perhaps the effect wears off */
5584         mtmp->mcanmove = 1;
5585         mtmp->mfrozen = 0;
5586 /*JP
5587         pline("%s stirs.", Monnam(mtmp));
5588 */
5589         pline("%s\82Í\93®\82«\8en\82ß\82½\81D", Monnam(mtmp));
5590     }
5591
5592     /* is the monster too heavy? */
5593     wt = inv_weight() + mtmp->data->cwt;
5594     if (!try_lift(mtmp, ttmp, wt, FALSE))
5595         return 1;
5596
5597     /* is the monster with inventory too heavy? */
5598     for (otmp = mtmp->minvent; otmp; otmp = otmp->nobj)
5599         wt += otmp->owt;
5600     if (!try_lift(mtmp, ttmp, wt, TRUE))
5601         return 1;
5602
5603 /*JP
5604     You("pull %s out of the pit.", mon_nam(mtmp));
5605 */
5606     You("%s\82ð\97\8e\82µ\8c\8a\82©\82ç\82Ð\82Á\82Ï\82Á\82½\81D", mon_nam(mtmp));
5607     mtmp->mtrapped = 0;
5608     fill_pit(mtmp->mx, mtmp->my);
5609     reward_untrap(ttmp, mtmp);
5610     return 1;
5611 }
5612
5613 int
5614 untrap(force)
5615 boolean force;
5616 {
5617     register struct obj *otmp;
5618     register int x, y;
5619     int ch;
5620     struct trap *ttmp;
5621     struct monst *mtmp;
5622     const char *trapdescr;
5623 #if 0 /*JP*/
5624     boolean here, useplural, deal_with_floor_trap,
5625             confused = (Confusion || Hallucination),
5626             trap_skipped = FALSE;
5627 #else
5628     boolean here, deal_with_floor_trap,
5629             confused = (Confusion || Hallucination),
5630             trap_skipped = FALSE;
5631 #endif
5632     int boxcnt = 0;
5633     char the_trap[BUFSZ], qbuf[QBUFSZ];
5634
5635     if (!getdir((char *) 0))
5636         return 0;
5637     x = u.ux + u.dx;
5638     y = u.uy + u.dy;
5639     if (!isok(x, y)) {
5640 /*JP
5641         pline_The("perils lurking there are beyond your grasp.");
5642 */
5643         pline_The("\82»\82±\82É\82 \82é\8aë\8c¯\82Í\82 \82È\82½\82Ì\8eè\82É\95\89\82¦\82È\82¢\81D");
5644         return 0;
5645     }
5646     /* 'force' is true for #invoke; make it be true for #untrap if
5647        carrying MKoT */
5648     if (!force && has_magic_key(&youmonst))
5649         force = TRUE;
5650
5651     ttmp = t_at(x, y);
5652     if (ttmp && !ttmp->tseen)
5653         ttmp = 0;
5654     trapdescr = ttmp ? defsyms[trap_to_defsym(ttmp->ttyp)].explanation : 0;
5655     here = (x == u.ux && y == u.uy); /* !u.dx && !u.dy */
5656
5657     if (here) /* are there are one or more containers here? */
5658         for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere)
5659             if (Is_box(otmp)) {
5660                 if (++boxcnt > 1)
5661                     break;
5662             }
5663
5664     deal_with_floor_trap = can_reach_floor(FALSE);
5665     if (!deal_with_floor_trap) {
5666         *the_trap = '\0';
5667         if (ttmp)
5668             Strcat(the_trap, an(trapdescr));
5669         if (ttmp && boxcnt)
5670 /*JP
5671             Strcat(the_trap, " and ");
5672 */
5673             Strcat(the_trap, "\82Æ");
5674         if (boxcnt)
5675 /*JP
5676             Strcat(the_trap, (boxcnt == 1) ? "a container" : "containers");
5677 */
5678             Strcat(the_trap, "\97e\8aí");
5679 #if 0 /*JP*/
5680         useplural = ((ttmp && boxcnt > 0) || boxcnt > 1);
5681 #endif
5682         /* note: boxcnt and useplural will always be 0 for !here case */
5683         if (ttmp || boxcnt)
5684 #if 0 /*JP*/
5685             There("%s %s %s but you can't reach %s%s.",
5686                   useplural ? "are" : "is", the_trap, here ? "here" : "there",
5687                   useplural ? "them" : "it",
5688                   u.usteed ? " while mounted" : "");
5689 #else
5690             pline("%s\82ª\82 \82é\82ª\81C%s\93Í\82©\82È\82¢\81D",
5691                   the_trap,
5692                   u.usteed ? "\8fæ\82Á\82Ä\82¢\82é\82Æ" : "");
5693 #endif
5694         trap_skipped = (ttmp != 0);
5695     } else { /* deal_with_floor_trap */
5696
5697         if (ttmp) {
5698             Strcpy(the_trap, the(trapdescr));
5699             if (boxcnt) {
5700                 if (is_pit(ttmp->ttyp)) {
5701 #if 0 /*JP:T*/
5702                     You_cant("do much about %s%s.", the_trap,
5703                              u.utrap ? " that you're stuck in"
5704                                      : " while standing on the edge of it");
5705 #else
5706                     pline("%s%s\82É\91Î\82µ\82Ä\82Í\82½\82¢\82µ\82½\82±\82Æ\82Í\82Å\82«\82È\82¢\81D",
5707                           u.utrap ? "\8e©\95ª\82ª\82Í\82Ü\82Á\82Ä\82¢\82é"
5708                                   : "\82·\82®\82»\82Î\82Ì",
5709                           the_trap);
5710 #endif
5711                     trap_skipped = TRUE;
5712                     deal_with_floor_trap = FALSE;
5713                 } else {
5714 #if 0 /*JP:T*/
5715                     Sprintf(
5716                         qbuf, "There %s and %s here.  %s %s?",
5717                         (boxcnt == 1) ? "is a container" : "are containers",
5718                         an(trapdescr),
5719                         (ttmp->ttyp == WEB) ? "Remove" : "Disarm", the_trap);
5720 #else
5721                     Sprintf(
5722                         qbuf, "\94 \82Æ%s\82ª\82 \82é\81D%s\81H",
5723                         trapdescr,
5724                         (ttmp->ttyp == WEB) ? "\8eæ\82è\8f\9c\82­" : "\89ð\8f\9c\82·\82é");
5725 #endif
5726                     switch (ynq(qbuf)) {
5727                     case 'q':
5728                         return 0;
5729                     case 'n':
5730                         trap_skipped = TRUE;
5731                         deal_with_floor_trap = FALSE;
5732                         break;
5733                     }
5734                 }
5735             }
5736             if (deal_with_floor_trap) {
5737                 if (u.utrap) {
5738 #if 0 /*JP*/
5739                     You("cannot deal with %s while trapped%s!", the_trap,
5740                         (x == u.ux && y == u.uy) ? " in it" : "");
5741 #else
5742                     pline("ã©\82É\82©\82©\82Á\82Ä\82¢\82é\8aÔ\82Íã©\82ð\89ð\8f\9c\82Å\82«\82È\82¢\81I");
5743 #endif
5744                     return 1;
5745                 }
5746                 if ((mtmp = m_at(x, y)) != 0
5747                     && (M_AP_TYPE(mtmp) == M_AP_FURNITURE
5748                         || M_AP_TYPE(mtmp) == M_AP_OBJECT)) {
5749                     stumble_onto_mimic(mtmp);
5750                     return 1;
5751                 }
5752                 switch (ttmp->ttyp) {
5753                 case BEAR_TRAP:
5754                 case WEB:
5755                     return disarm_holdingtrap(ttmp);
5756                 case LANDMINE:
5757                     return disarm_landmine(ttmp);
5758                 case SQKY_BOARD:
5759                     return disarm_squeaky_board(ttmp);
5760                 case DART_TRAP:
5761                     return disarm_shooting_trap(ttmp, DART);
5762                 case ARROW_TRAP:
5763                     return disarm_shooting_trap(ttmp, ARROW);
5764                 case PIT:
5765                 case SPIKED_PIT:
5766                     if (here) {
5767 /*JP
5768                         You("are already on the edge of the pit.");
5769 */
5770                         You("\82à\82¤\97\8e\82µ\8c\8a\82Ì\92[\82É\82¢\82é\81D");
5771                         return 0;
5772                     }
5773                     if (!mtmp) {
5774 /*JP
5775                         pline("Try filling the pit instead.");
5776 */
5777                         pline("\82È\82ñ\82Æ\82©\96\84\82ß\82é\82±\82Æ\82ð\8dl\82¦\82Ä\82Ý\82½\82ç\81H");
5778                         return 0;
5779                     }
5780                     return help_monster_out(mtmp, ttmp);
5781                 default:
5782 /*JP
5783                     You("cannot disable %s trap.", !here ? "that" : "this");
5784 */
5785                     pline("%sã©\82Í\89ð\8f\9c\82Å\82«\82È\82¢\81D", !here ? "\82»\82Ì" : "\82±\82Ì");
5786                     return 0;
5787                 }
5788             }
5789         } /* end if */
5790
5791         if (boxcnt) {
5792             for (otmp = level.objects[x][y]; otmp; otmp = otmp->nexthere)
5793                 if (Is_box(otmp)) {
5794 #if 0 /*JP*/
5795                     (void) safe_qbuf(qbuf, "There is ",
5796                                      " here.  Check it for traps?", otmp,
5797                                      doname, ansimpleoname, "a box");
5798 #else
5799                     (void) safe_qbuf(qbuf, "",
5800                                      "\82ª\82 \82é\81Dã©\82ð\92²\82×\82Ü\82·\82©\81H", otmp,
5801                                      doname, ansimpleoname, "\94 ");
5802 #endif
5803                     switch (ynq(qbuf)) {
5804                     case 'q':
5805                         return 0;
5806                     case 'n':
5807                         continue;
5808                     }
5809
5810                     if ((otmp->otrapped
5811                          && (force || (!confused
5812                                        && rn2(MAXULEV + 1 - u.ulevel) < 10)))
5813                         || (!force && confused && !rn2(3))) {
5814 /*JP
5815                         You("find a trap on %s!", the(xname(otmp)));
5816 */
5817                         pline("%s\82Éã©\82ð\94­\8c©\82µ\82½\81I", the(xname(otmp)));
5818                         if (!confused)
5819                             exercise(A_WIS, TRUE);
5820
5821 /*JP
5822                         switch (ynq("Disarm it?")) {
5823 */
5824                         switch (ynq("\89ð\8f\9c\82µ\82Ü\82·\82©\81H")) {
5825                         case 'q':
5826                             return 1;
5827                         case 'n':
5828                             trap_skipped = TRUE;
5829                             continue;
5830                         }
5831
5832                         if (otmp->otrapped) {
5833                             exercise(A_DEX, TRUE);
5834                             ch = ACURR(A_DEX) + u.ulevel;
5835                             if (Role_if(PM_ROGUE))
5836                                 ch *= 2;
5837                             if (!force && (confused || Fumbling
5838                                            || rnd(75 + level_difficulty() / 2)
5839                                                   > ch)) {
5840                                 (void) chest_trap(otmp, FINGER, TRUE);
5841                             } else {
5842 /*JP
5843                                 You("disarm it!");
5844 */
5845                                 You("\89ð\8f\9c\82µ\82½\81I");
5846                                 otmp->otrapped = 0;
5847                             }
5848                         } else
5849 /*JP
5850                             pline("That %s was not trapped.", xname(otmp));
5851 */
5852                             pline("\82»\82Ì%s\82Éã©\82Í\82È\82¢\81D", xname(otmp));
5853                         return 1;
5854                     } else {
5855 /*JP
5856                         You("find no traps on %s.", the(xname(otmp)));
5857 */
5858                         pline("ã©\82ð\94­\8c©\82Å\82«\82È\82©\82Á\82½\81D");
5859                         return 1;
5860                     }
5861                 }
5862
5863 #if 0 /*JP*/
5864             You(trap_skipped ? "find no other traps here."
5865                              : "know of no traps here.");
5866 #else
5867             You(trap_skipped ? "\91¼\82Ìã©\82ð\8c©\82Â\82¯\82ç\82ê\82È\82©\82Á\82½\81D"
5868                              : "\82±\82±\82Éã©\82ª\82È\82¢\82±\82Æ\82ð\92m\82Á\82Ä\82¢\82é\81D");
5869 #endif
5870             return 0;
5871         }
5872
5873         if (stumble_on_door_mimic(x, y))
5874             return 1;
5875
5876     } /* deal_with_floor_trap */
5877     /* doors can be manipulated even while levitating/unskilled riding */
5878
5879     if (!IS_DOOR(levl[x][y].typ)) {
5880         if (!trap_skipped)
5881 /*JP
5882             You("know of no traps there.");
5883 */
5884             You("\82»\82±\82Éã©\82ª\82È\82¢\82±\82Æ\82ð\92m\82Á\82Ä\82¢\82é\81D");
5885         return 0;
5886     }
5887
5888     switch (levl[x][y].doormask) {
5889     case D_NODOOR:
5890 /*JP
5891         You("%s no door there.", Blind ? "feel" : "see");
5892 */
5893         pline("\82»\82±\82É\82Í\94à\82ª\82È\82¢%s\81D", Blind ? "\82æ\82¤\82¾" : "\82æ\82¤\82É\8c©\82¦\82é");
5894         return 0;
5895     case D_ISOPEN:
5896 /*JP
5897         pline("This door is safely open.");
5898 */
5899         pline("\82»\82Ì\94à\82Í\88À\91S\82É\8aJ\82¢\82Ä\82¢\82é\81D");
5900         return 0;
5901     case D_BROKEN:
5902 /*JP
5903         pline("This door is broken.");
5904 */
5905         pline("\82»\82Ì\94à\82Í\89ó\82ê\82Ä\82¢\82é\81D");
5906         return 0;
5907     }
5908
5909     if (((levl[x][y].doormask & D_TRAPPED) != 0
5910          && (force || (!confused && rn2(MAXULEV - u.ulevel + 11) < 10)))
5911         || (!force && confused && !rn2(3))) {
5912 /*JP
5913         You("find a trap on the door!");
5914 */
5915         pline("\94à\82Éã©\82ð\94­\8c©\82µ\82½\81I");
5916         exercise(A_WIS, TRUE);
5917 /*JP
5918         if (ynq("Disarm it?") != 'y')
5919 */
5920         if (ynq("\89ð\8f\9c\82µ\82Ü\82·\82©\81H") != 'y')
5921             return 1;
5922         if (levl[x][y].doormask & D_TRAPPED) {
5923             ch = 15 + (Role_if(PM_ROGUE) ? u.ulevel * 3 : u.ulevel);
5924             exercise(A_DEX, TRUE);
5925             if (!force && (confused || Fumbling
5926                            || rnd(75 + level_difficulty() / 2) > ch)) {
5927 /*JP
5928                 You("set it off!");
5929 */
5930                 You("\83X\83C\83b\83`\82ð\93ü\82ê\82Ä\82µ\82Ü\82Á\82½\81I");
5931 /*JP
5932                 b_trapped("door", FINGER);
5933 */
5934                 b_trapped("\94à", FINGER);
5935                 levl[x][y].doormask = D_NODOOR;
5936                 unblock_point(x, y);
5937                 newsym(x, y);
5938                 /* (probably ought to charge for this damage...) */
5939                 if (*in_rooms(x, y, SHOPBASE))
5940                     add_damage(x, y, 0L);
5941             } else {
5942 /*JP
5943                 You("disarm it!");
5944 */
5945                 You("\89ð\8f\9c\82µ\82½\81I");
5946                 levl[x][y].doormask &= ~D_TRAPPED;
5947             }
5948         } else
5949 /*JP
5950             pline("This door was not trapped.");
5951 */
5952             pline("\94à\82Éã©\82Í\82È\82©\82Á\82½\81D");
5953         return 1;
5954     } else {
5955 /*JP
5956         You("find no traps on the door.");
5957 */
5958         pline("\94à\82Éã©\82ð\94­\8c©\82Å\82«\82È\82©\82Á\82½\81D");
5959         return 1;
5960     }
5961 }
5962
5963 /* for magic unlocking; returns true if targetted monster (which might
5964    be hero) gets untrapped; the trap remains intact */
5965 boolean
5966 openholdingtrap(mon, noticed)
5967 struct monst *mon;
5968 boolean *noticed; /* set to true iff hero notices the effect; */
5969 {                 /* otherwise left with its previous value intact */
5970     struct trap *t;
5971     char buf[BUFSZ], whichbuf[20];
5972     const char *trapdescr = 0, *which = 0;
5973     boolean ishero = (mon == &youmonst);
5974
5975     if (!mon)
5976         return FALSE;
5977     if (mon == u.usteed)
5978         ishero = TRUE;
5979
5980     t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
5981
5982     if (ishero && u.utrap) { /* all u.utraptype values are holding traps */
5983         which = "";
5984         switch (u.utraptype) {
5985         case TT_LAVA:
5986 /*JP
5987             trapdescr = "molten lava";
5988 */
5989             trapdescr = "\82Ç\82ë\82Ç\82ë\82Ì\97n\8aâ";
5990             break;
5991         case TT_INFLOOR:
5992             /* solidified lava, so not "floor" even if within a room */
5993 /*JP
5994             trapdescr = "ground";
5995 */
5996             trapdescr = "\92n\96Ê";
5997             break;
5998         case TT_BURIEDBALL:
5999 /*JP
6000             trapdescr = "your anchor";
6001 */
6002             trapdescr = "\82­\82³\82Ñ";
6003             break;
6004         case TT_BEARTRAP:
6005         case TT_PIT:
6006         case TT_WEB:
6007             trapdescr = 0; /* use defsyms[].explanation */
6008             break;
6009         default:
6010             /* lint suppression in case 't' is unexpectedly Null
6011                or u.utraptype has new value we don't know about yet */
6012 /*JP
6013             trapdescr = "trap";
6014 */
6015             trapdescr = "ã©";
6016             break;
6017         }
6018     } else {
6019         /* if no trap here or it's not a holding trap, we're done */
6020         if (!t || (t->ttyp != BEAR_TRAP && t->ttyp != WEB))
6021             return FALSE;
6022     }
6023
6024     if (!trapdescr)
6025         trapdescr = defsyms[trap_to_defsym(t->ttyp)].explanation;
6026     if (!which)
6027 #if 0 /*JP*/
6028         which = t->tseen ? the_your[t->madeby_u]
6029                          : index(vowels, *trapdescr) ? "an" : "a";
6030 #else
6031         which = t->tseen ? set_you[t->madeby_u] : "";
6032 #endif
6033     if (*which)
6034         which = strcat(strcpy(whichbuf, which), " ");
6035
6036     if (ishero) {
6037         if (!u.utrap)
6038             return FALSE;
6039         *noticed = TRUE;
6040         if (u.usteed)
6041 /*JP
6042                 Sprintf(buf, "%s is", noit_Monnam(u.usteed));
6043 */
6044                 Strcpy(buf, noit_Monnam(u.usteed));
6045         else
6046 /*JP
6047                 Strcpy(buf, "You are");
6048 */
6049                 Strcpy(buf, "\82 \82È\82½");
6050 /*JP
6051         pline("%s released from %s%s.", buf, which, trapdescr);
6052 */
6053         pline("%s\82Í%s%s\82©\82ç\89ð\95ú\82³\82ê\82½\81D", buf, which, trapdescr);
6054         reset_utrap(TRUE);
6055     } else {
6056         if (!mon->mtrapped)
6057             return FALSE;
6058         mon->mtrapped = 0;
6059         if (canspotmon(mon)) {
6060             *noticed = TRUE;
6061 #if 0 /*JP*/
6062             pline("%s is released from %s%s.", Monnam(mon), which,
6063                   trapdescr);
6064 #else
6065             pline("%s\82Í%s%s\82©\82ç\89ð\95ú\82³\82ê\82½\81D", Monnam(mon), which,
6066                   trapdescr);
6067 #endif
6068         } else if (cansee(t->tx, t->ty) && t->tseen) {
6069             *noticed = TRUE;
6070             if (t->ttyp == WEB)
6071 #if 0 /*JP:T*/
6072                 pline("%s is released from %s%s.", Something, which,
6073                       trapdescr);
6074 #else
6075                 pline("\89½\8eÒ\82©\82Í%s%s\82©\82ç\89ð\95ú\82³\82ê\82½\81D", which,
6076                       trapdescr);
6077 #endif
6078             else /* BEAR_TRAP */
6079 /*JP
6080                 pline("%s%s opens.", upstart(strcpy(buf, which)), trapdescr);
6081 */
6082                 pline("%s%s\82Í\8aJ\82¢\82½\81D", which, trapdescr);
6083         }
6084         /* might pacify monster if adjacent */
6085         if (rn2(2) && distu(mon->mx, mon->my) <= 2)
6086             reward_untrap(t, mon);
6087     }
6088     return TRUE;
6089 }
6090
6091 /* for magic locking; returns true if targetted monster (which might
6092    be hero) gets hit by a trap (might avoid actually becoming trapped) */
6093 boolean
6094 closeholdingtrap(mon, noticed)
6095 struct monst *mon;
6096 boolean *noticed; /* set to true iff hero notices the effect; */
6097 {                 /* otherwise left with its previous value intact */
6098     struct trap *t;
6099     unsigned dotrapflags;
6100     boolean ishero = (mon == &youmonst), result;
6101
6102     if (!mon)
6103         return FALSE;
6104     if (mon == u.usteed)
6105         ishero = TRUE;
6106     t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
6107     /* if no trap here or it's not a holding trap, we're done */
6108     if (!t || (t->ttyp != BEAR_TRAP && t->ttyp != WEB))
6109         return FALSE;
6110
6111     if (ishero) {
6112         if (u.utrap)
6113             return FALSE; /* already trapped */
6114         *noticed = TRUE;
6115         dotrapflags = FORCETRAP;
6116         /* dotrap calls mintrap when mounted hero encounters a web */
6117         if (u.usteed)
6118             dotrapflags |= NOWEBMSG;
6119         ++force_mintrap;
6120         dotrap(t, dotrapflags);
6121         --force_mintrap;
6122         result = (u.utrap != 0);
6123     } else {
6124         if (mon->mtrapped)
6125             return FALSE; /* already trapped */
6126         /* you notice it if you see the trap close/tremble/whatever
6127            or if you sense the monster who becomes trapped */
6128         *noticed = cansee(t->tx, t->ty) || canspotmon(mon);
6129         ++force_mintrap;
6130         result = (mintrap(mon) != 0);
6131         --force_mintrap;
6132     }
6133     return result;
6134 }
6135
6136 /* for magic unlocking; returns true if targetted monster (which might
6137    be hero) gets hit by a trap (target might avoid its effect) */
6138 boolean
6139 openfallingtrap(mon, trapdoor_only, noticed)
6140 struct monst *mon;
6141 boolean trapdoor_only;
6142 boolean *noticed; /* set to true iff hero notices the effect; */
6143 {                 /* otherwise left with its previous value intact */
6144     struct trap *t;
6145     boolean ishero = (mon == &youmonst), result;
6146
6147     if (!mon)
6148         return FALSE;
6149     if (mon == u.usteed)
6150         ishero = TRUE;
6151     t = t_at(ishero ? u.ux : mon->mx, ishero ? u.uy : mon->my);
6152     /* if no trap here or it's not a falling trap, we're done
6153        (note: falling rock traps have a trapdoor in the ceiling) */
6154     if (!t || ((t->ttyp != TRAPDOOR && t->ttyp != ROCKTRAP)
6155                && (trapdoor_only || (t->ttyp != HOLE && !is_pit(t->ttyp)))))
6156         return FALSE;
6157
6158     if (ishero) {
6159         if (u.utrap)
6160             return FALSE; /* already trapped */
6161         *noticed = TRUE;
6162         dotrap(t, FORCETRAP);
6163         result = (u.utrap != 0);
6164     } else {
6165         if (mon->mtrapped)
6166             return FALSE; /* already trapped */
6167         /* you notice it if you see the trap close/tremble/whatever
6168            or if you sense the monster who becomes trapped */
6169         *noticed = cansee(t->tx, t->ty) || canspotmon(mon);
6170         /* monster will be angered; mintrap doesn't handle that */
6171         wakeup(mon, TRUE);
6172         ++force_mintrap;
6173         result = (mintrap(mon) != 0);
6174         --force_mintrap;
6175         /* mon might now be on the migrating monsters list */
6176     }
6177     return result;
6178 }
6179
6180 /* only called when the player is doing something to the chest directly */
6181 boolean
6182 chest_trap(obj, bodypart, disarm)
6183 register struct obj *obj;
6184 register int bodypart;
6185 boolean disarm;
6186 {
6187     register struct obj *otmp = obj, *otmp2;
6188     char buf[80];
6189     const char *msg;
6190     coord cc;
6191
6192     if (get_obj_location(obj, &cc.x, &cc.y, 0)) /* might be carried */
6193         obj->ox = cc.x, obj->oy = cc.y;
6194
6195     otmp->otrapped = 0; /* trap is one-shot; clear flag first in case
6196                            chest kills you and ends up in bones file */
6197 /*JP
6198     You(disarm ? "set it off!" : "trigger a trap!");
6199 */
6200     You(disarm ? "\83X\83C\83b\83`\82ð\93ü\82ê\82Ä\82µ\82Ü\82Á\82½\81I" : "ã©\82É\82Ð\82Á\82©\82©\82Á\82½\81I");
6201     display_nhwindow(WIN_MESSAGE, FALSE);
6202     if (Luck > -13 && rn2(13 + Luck) > 7) { /* saved by luck */
6203         /* trap went off, but good luck prevents damage */
6204         switch (rn2(13)) {
6205         case 12:
6206         case 11:
6207 /*JP
6208             msg = "explosive charge is a dud";
6209 */
6210             msg = "\94\9a\94­\82Í\95s\94­\82¾\82Á\82½";
6211             break;
6212         case 10:
6213         case 9:
6214 /*JP
6215             msg = "electric charge is grounded";
6216 */
6217             msg = "\93d\8c\82\82ª\95ú\8fo\82³\82ê\82½\82ª\83A\81[\83X\82³\82ê\82Ä\82¢\82½";
6218             break;
6219         case 8:
6220         case 7:
6221 /*JP
6222             msg = "flame fizzles out";
6223 */
6224             msg = "\89\8a\82Í\83V\83\85\81[\82Á\82Æ\8fÁ\82¦\82½";
6225             break;
6226         case 6:
6227         case 5:
6228         case 4:
6229 /*JP
6230             msg = "poisoned needle misses";
6231 */
6232             msg = "\93Å\90j\82Í\8eh\82³\82ç\82È\82©\82Á\82½";
6233             break;
6234         case 3:
6235         case 2:
6236         case 1:
6237         case 0:
6238 /*JP
6239             msg = "gas cloud blows away";
6240 */
6241             msg = "\83K\83X\89_\82Í\90\81\82«\94ò\82ñ\82¾";
6242             break;
6243         default:
6244             impossible("chest disarm bug");
6245             msg = (char *) 0;
6246             break;
6247         }
6248         if (msg)
6249 /*JP
6250             pline("But luckily the %s!", msg);
6251 */
6252             pline("\82µ\82©\82µ\89^\82Ì\82æ\82¢\82±\82Æ\82É%s\81I", msg);
6253     } else {
6254         switch (rn2(20) ? ((Luck >= 13) ? 0 : rn2(13 - Luck)) : rn2(26)) {
6255         case 25:
6256         case 24:
6257         case 23:
6258         case 22:
6259         case 21: {
6260             struct monst *shkp = 0;
6261             long loss = 0L;
6262             boolean costly, insider;
6263             register xchar ox = obj->ox, oy = obj->oy;
6264
6265             /* the obj location need not be that of player */
6266             costly = (costly_spot(ox, oy)
6267                       && (shkp = shop_keeper(*in_rooms(ox, oy, SHOPBASE)))
6268                              != (struct monst *) 0);
6269             insider = (*u.ushops && inside_shop(u.ux, u.uy)
6270                        && *in_rooms(ox, oy, SHOPBASE) == *u.ushops);
6271
6272 /*JP
6273             pline("%s!", Tobjnam(obj, "explode"));
6274 */
6275             pline("%s\82Í\94\9a\94­\82µ\82½\81I", xname(obj));
6276 /*JP
6277             Sprintf(buf, "exploding %s", xname(obj));
6278 */
6279             Sprintf(buf, "%s\82Ì\94\9a\94­\82Å", xname(obj));
6280
6281             if (costly)
6282                 loss += stolen_value(obj, ox, oy, (boolean) shkp->mpeaceful,
6283                                      TRUE);
6284             delete_contents(obj);
6285             /* unpunish() in advance if either ball or chain (or both)
6286                is going to be destroyed */
6287             if (Punished && ((uchain->ox == u.ux && uchain->oy == u.uy)
6288                              || (uball->where == OBJ_FLOOR
6289                                  && uball->ox == u.ux && uball->oy == u.uy)))
6290                 unpunish();
6291
6292             for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
6293                 otmp2 = otmp->nexthere;
6294                 if (costly)
6295                     loss += stolen_value(otmp, otmp->ox, otmp->oy,
6296                                          (boolean) shkp->mpeaceful, TRUE);
6297                 delobj(otmp);
6298             }
6299             wake_nearby();
6300             losehp(Maybe_Half_Phys(d(6, 6)), buf, KILLED_BY_AN);
6301             exercise(A_STR, FALSE);
6302             if (costly && loss) {
6303                 if (insider)
6304 #if 0 /*JP*/
6305                     You("owe %ld %s for objects destroyed.", loss,
6306                         currency(loss));
6307 #else
6308                     You("\8aí\95¨\94j\91¹\82Å%ld%s\82Ì\8eØ\82è\82ð\82Â\82­\82Á\82½\81D", loss,
6309                         currency(loss));
6310 #endif
6311                 else {
6312 #if 0 /*JP*/
6313                     You("caused %ld %s worth of damage!", loss,
6314                         currency(loss));
6315 #else
6316                     You("%ld%s\95ª\82Ì\91¹\8aQ\82ð\88ø\82«\82¨\82±\82µ\82½\81I", loss,
6317                         currency(loss));
6318 #endif
6319                     make_angry_shk(shkp, ox, oy);
6320                 }
6321             }
6322             return TRUE;
6323         } /* case 21 */
6324         case 20:
6325         case 19:
6326         case 18:
6327         case 17:
6328 /*JP
6329             pline("A cloud of noxious gas billows from %s.", the(xname(obj)));
6330 */
6331             pline("\97L\93Å\83K\83X\82ª%s\82©\82ç\89Q\82Ü\82¢\82½\81D", the(xname(obj)));
6332 /*JP
6333             poisoned("gas cloud", A_STR, "cloud of poison gas", 15, FALSE);
6334 */
6335             poisoned("\83K\83X\89_", A_STR, "\83K\83X\89_", 15, FALSE);
6336             exercise(A_CON, FALSE);
6337             break;
6338         case 16:
6339         case 15:
6340         case 14:
6341         case 13:
6342 /*JP
6343             You_feel("a needle prick your %s.", body_part(bodypart));
6344 */
6345             You("%s\83`\83N\83b\82Æ\82¢\82¤\92É\82Ý\82ð\8a´\82\82½\81D", body_part(bodypart));
6346 /*JP
6347             poisoned("needle", A_CON, "poisoned needle", 10, FALSE);
6348 */
6349             poisoned("\90j", A_CON, "\93Å\90j", 10, FALSE);
6350             exercise(A_CON, FALSE);
6351             break;
6352         case 12:
6353         case 11:
6354         case 10:
6355         case 9:
6356             dofiretrap(obj);
6357             break;
6358         case 8:
6359         case 7:
6360         case 6: {
6361             int dmg;
6362
6363 /*JP
6364             You("are jolted by a surge of electricity!");
6365 */
6366             You("\93d\8bC\83V\83\87\83b\83N\82ð\82­\82ç\82Á\82½\81I");
6367             if (Shock_resistance) {
6368                 shieldeff(u.ux, u.uy);
6369 /*JP
6370                 You("don't seem to be affected.");
6371 */
6372                 pline("\82µ\82©\82µ\82 \82È\82½\82Í\89e\8b¿\82ð\8eó\82¯\82È\82¢\81D");
6373                 dmg = 0;
6374             } else
6375                 dmg = d(4, 4);
6376             destroy_item(RING_CLASS, AD_ELEC);
6377             destroy_item(WAND_CLASS, AD_ELEC);
6378             if (dmg)
6379 /*JP
6380                 losehp(dmg, "electric shock", KILLED_BY_AN);
6381 */
6382                 losehp(dmg, "\93d\8bC\83V\83\87\83b\83N\82Å", KILLED_BY_AN);
6383             break;
6384         } /* case 6 */
6385         case 5:
6386         case 4:
6387         case 3:
6388             if (!Free_action) {
6389 /*JP
6390                 pline("Suddenly you are frozen in place!");
6391 */
6392                 pline("\93Ë\91R\82»\82Ì\8fê\82Å\93®\82¯\82È\82­\82È\82Á\82½\81I");
6393                 nomul(-d(5, 6));
6394 /*JP
6395                 multi_reason = "frozen by a trap";
6396 */
6397                 multi_reason = "ã©\82Å\8dd\92¼\82µ\82Ä\82¢\82é\8e\9e\82É";
6398                 exercise(A_DEX, FALSE);
6399                 nomovemsg = You_can_move_again;
6400             } else
6401 /*JP
6402                 You("momentarily stiffen.");
6403 */
6404                 You("\88ê\8fu\8dd\92¼\82µ\82½\81D");
6405             break;
6406         case 2:
6407         case 1:
6408         case 0:
6409 #if 0 /*JP*/
6410             pline("A cloud of %s gas billows from %s.",
6411                   Blind ? blindgas[rn2(SIZE(blindgas))] : rndcolor(),
6412                   the(xname(obj)));
6413 #else
6414             pline("%s\83K\83X\89_\82ª%s\82Ì\92ê\82Å\89Q\82Ü\82¢\82½\81D",
6415                   Blind ? blindgas[rn2(SIZE(blindgas))] :
6416                   jconj_adj(rndcolor()), xname(obj));
6417 #endif
6418             if (!Stunned) {
6419                 if (Hallucination)
6420 /*JP
6421                     pline("What a groovy feeling!");
6422 */
6423                     pline("\82È\82ñ\82Ä\91f\93G\82È\82ñ\82¾\81I");
6424                 else
6425 #if 0 /*JP*/
6426                     You("%s%s...", stagger(youmonst.data, "stagger"),
6427                         Halluc_resistance ? ""
6428                                           : Blind ? " and get dizzy"
6429                                                   : " and your vision blurs");
6430 #else
6431                     You("\82­\82ç\82­\82ç\82µ%s\82½...",
6432                         Halluc_resistance ? ""
6433                                           : Blind ? "\81C\82ß\82Ü\82¢\82ª\82µ"
6434                                                   : "\81C\8ci\90F\82ª\82Ú\82â\82¯\82Ä\82«");
6435 #endif
6436             }
6437             make_stunned((HStun & TIMEOUT) + (long) rn1(7, 16), FALSE);
6438             (void) make_hallucinated(
6439                 (HHallucination & TIMEOUT) + (long) rn1(5, 16), FALSE, 0L);
6440             break;
6441         default:
6442             impossible("bad chest trap");
6443             break;
6444         }
6445         bot(); /* to get immediate botl re-display */
6446     }
6447
6448     return FALSE;
6449 }
6450
6451 struct trap *
6452 t_at(x, y)
6453 register int x, y;
6454 {
6455     register struct trap *trap = ftrap;
6456
6457     while (trap) {
6458         if (trap->tx == x && trap->ty == y)
6459             return trap;
6460         trap = trap->ntrap;
6461     }
6462     return (struct trap *) 0;
6463 }
6464
6465 void
6466 deltrap(trap)
6467 register struct trap *trap;
6468 {
6469     register struct trap *ttmp;
6470
6471     clear_conjoined_pits(trap);
6472     if (trap == ftrap) {
6473         ftrap = ftrap->ntrap;
6474     } else {
6475         for (ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
6476             if (ttmp->ntrap == trap)
6477                 break;
6478         if (!ttmp)
6479             panic("deltrap: no preceding trap!");
6480         ttmp->ntrap = trap->ntrap;
6481     }
6482     if (Sokoban && (trap->ttyp == PIT || trap->ttyp == HOLE))
6483         maybe_finish_sokoban();
6484     dealloc_trap(trap);
6485 }
6486
6487 boolean
6488 conjoined_pits(trap2, trap1, u_entering_trap2)
6489 struct trap *trap2, *trap1;
6490 boolean u_entering_trap2;
6491 {
6492     int dx, dy, diridx, adjidx;
6493
6494     if (!trap1 || !trap2)
6495         return FALSE;
6496     if (!isok(trap2->tx, trap2->ty) || !isok(trap1->tx, trap1->ty)
6497         || !is_pit(trap2->ttyp)
6498         || !is_pit(trap1->ttyp)
6499         || (u_entering_trap2 && !(u.utrap && u.utraptype == TT_PIT)))
6500         return FALSE;
6501     dx = sgn(trap2->tx - trap1->tx);
6502     dy = sgn(trap2->ty - trap1->ty);
6503     for (diridx = 0; diridx < 8; diridx++)
6504         if (xdir[diridx] == dx && ydir[diridx] == dy)
6505             break;
6506     /* diridx is valid if < 8 */
6507     if (diridx < 8) {
6508         adjidx = (diridx + 4) % 8;
6509         if ((trap1->conjoined & (1 << diridx))
6510             && (trap2->conjoined & (1 << adjidx)))
6511             return TRUE;
6512     }
6513     return FALSE;
6514 }
6515
6516 STATIC_OVL void
6517 clear_conjoined_pits(trap)
6518 struct trap *trap;
6519 {
6520     int diridx, adjidx, x, y;
6521     struct trap *t;
6522
6523     if (trap && is_pit(trap->ttyp)) {
6524         for (diridx = 0; diridx < 8; ++diridx) {
6525             if (trap->conjoined & (1 << diridx)) {
6526                 x = trap->tx + xdir[diridx];
6527                 y = trap->ty + ydir[diridx];
6528                 if (isok(x, y)
6529                     && (t = t_at(x, y)) != 0
6530                     && is_pit(t->ttyp)) {
6531                     adjidx = (diridx + 4) % 8;
6532                     t->conjoined &= ~(1 << adjidx);
6533                 }
6534                 trap->conjoined &= ~(1 << diridx);
6535             }
6536         }
6537     }
6538 }
6539
6540 STATIC_OVL boolean
6541 adj_nonconjoined_pit(adjtrap)
6542 struct trap *adjtrap;
6543 {
6544     struct trap *trap_with_u = t_at(u.ux0, u.uy0);
6545
6546     if (trap_with_u && adjtrap && u.utrap && u.utraptype == TT_PIT
6547         && is_pit(trap_with_u->ttyp) && is_pit(adjtrap->ttyp)) {
6548         int idx;
6549
6550         for (idx = 0; idx < 8; idx++) {
6551             if (xdir[idx] == u.dx && ydir[idx] == u.dy)
6552                 return TRUE;
6553         }
6554     }
6555     return FALSE;
6556 }
6557
6558 #if 0
6559 /*
6560  * Mark all neighboring pits as conjoined pits.
6561  * (currently not called from anywhere)
6562  */
6563 STATIC_OVL void
6564 join_adjacent_pits(trap)
6565 struct trap *trap;
6566 {
6567     struct trap *t;
6568     int diridx, x, y;
6569
6570     if (!trap)
6571         return;
6572     for (diridx = 0; diridx < 8; ++diridx) {
6573         x = trap->tx + xdir[diridx];
6574         y = trap->ty + ydir[diridx];
6575         if (isok(x, y)) {
6576             if ((t = t_at(x, y)) != 0 && is_pit(t->ttyp)) {
6577                 trap->conjoined |= (1 << diridx);
6578                 join_adjacent_pits(t);
6579             } else
6580                 trap->conjoined &= ~(1 << diridx);
6581         }
6582     }
6583 }
6584 #endif /*0*/
6585
6586 /*
6587  * Returns TRUE if you escaped a pit and are standing on the precipice.
6588  */
6589 boolean
6590 uteetering_at_seen_pit(trap)
6591 struct trap *trap;
6592 {
6593     if (trap && trap->tseen && (!u.utrap || u.utraptype != TT_PIT)
6594         && is_pit(trap->ttyp))
6595         return TRUE;
6596     else
6597         return FALSE;
6598 }
6599
6600 /* Destroy a trap that emanates from the floor. */
6601 boolean
6602 delfloortrap(ttmp)
6603 register struct trap *ttmp;
6604 {
6605     /* some of these are arbitrary -dlc */
6606     if (ttmp && ((ttmp->ttyp == SQKY_BOARD) || (ttmp->ttyp == BEAR_TRAP)
6607                  || (ttmp->ttyp == LANDMINE) || (ttmp->ttyp == FIRE_TRAP)
6608                  || is_pit(ttmp->ttyp)
6609                  || is_hole(ttmp->ttyp)
6610                  || (ttmp->ttyp == TELEP_TRAP) || (ttmp->ttyp == LEVEL_TELEP)
6611                  || (ttmp->ttyp == WEB) || (ttmp->ttyp == MAGIC_TRAP)
6612                  || (ttmp->ttyp == ANTI_MAGIC))) {
6613         register struct monst *mtmp;
6614
6615         if (ttmp->tx == u.ux && ttmp->ty == u.uy) {
6616             if (u.utraptype != TT_BURIEDBALL)
6617                 reset_utrap(TRUE);
6618         } else if ((mtmp = m_at(ttmp->tx, ttmp->ty)) != 0) {
6619             mtmp->mtrapped = 0;
6620         }
6621         deltrap(ttmp);
6622         return TRUE;
6623     }
6624     return FALSE;
6625 }
6626
6627 /* used for doors (also tins).  can be used for anything else that opens. */
6628 void
6629 b_trapped(item, bodypart)
6630 const char *item;
6631 int bodypart;
6632 {
6633     int lvl = level_difficulty(),
6634         dmg = rnd(5 + (lvl < 5 ? lvl : 2 + lvl / 2));
6635
6636 /*JP
6637     pline("KABOOM!!  %s was booby-trapped!", The(item));
6638 */
6639     pline("\82¿\82ã\82Ç\81[\82ñ\81I\81I%s\82É\83u\81[\83r\81[\83g\83\89\83b\83v\82ª\8ed\8a|\82¯\82ç\82ê\82Ä\82¢\82½\81I", item);
6640     wake_nearby();
6641 /*JP
6642     losehp(Maybe_Half_Phys(dmg), "explosion", KILLED_BY_AN);
6643 */
6644     losehp(Maybe_Half_Phys(dmg), "\83u\81[\83r\81[\83g\83\89\83b\83v\82Ì\94\9a\94­\82Å", KILLED_BY_AN);
6645     exercise(A_STR, FALSE);
6646     if (bodypart)
6647         exercise(A_CON, FALSE);
6648     make_stunned((HStun & TIMEOUT) + (long) dmg, TRUE);
6649 }
6650
6651 /* Monster is hit by trap. */
6652 /* Note: doesn't work if both obj and d_override are null */
6653 STATIC_OVL boolean
6654 thitm(tlev, mon, obj, d_override, nocorpse)
6655 int tlev;
6656 struct monst *mon;
6657 struct obj *obj;
6658 int d_override;
6659 boolean nocorpse;
6660 {
6661     int strike;
6662     boolean trapkilled = FALSE;
6663
6664     if (d_override)
6665         strike = 1;
6666     else if (obj)
6667         strike = (find_mac(mon) + tlev + obj->spe <= rnd(20));
6668     else
6669         strike = (find_mac(mon) + tlev <= rnd(20));
6670
6671     /* Actually more accurate than thitu, which doesn't take
6672      * obj->spe into account.
6673      */
6674     if (!strike) {
6675         if (obj && cansee(mon->mx, mon->my))
6676 /*JP
6677             pline("%s is almost hit by %s!", Monnam(mon), doname(obj));
6678 */
6679             pline("\82à\82¤\8f­\82µ\82Å%s\82ª%s\82É\96½\92\86\82·\82é\82Æ\82±\82ë\82¾\82Á\82½\81I", doname(obj), Monnam(mon));
6680     } else {
6681         int dam = 1;
6682
6683         if (obj && cansee(mon->mx, mon->my))
6684 /*JP
6685             pline("%s is hit by %s!", Monnam(mon), doname(obj));
6686 */
6687             pline("%s\82ª%s\82É\96½\92\86\82µ\82½\81I", doname(obj), Monnam(mon));
6688         if (d_override)
6689             dam = d_override;
6690         else if (obj) {
6691             dam = dmgval(obj, mon);
6692             if (dam < 1)
6693                 dam = 1;
6694         }
6695         mon->mhp -= dam;
6696         if (DEADMONSTER(mon)) {
6697             int xx = mon->mx, yy = mon->my;
6698
6699             monkilled(mon, "", nocorpse ? -AD_RBRE : AD_PHYS);
6700             if (DEADMONSTER(mon)) {
6701                 newsym(xx, yy);
6702                 trapkilled = TRUE;
6703             }
6704         }
6705     }
6706     if (obj && (!strike || d_override)) {
6707         place_object(obj, mon->mx, mon->my);
6708         stackobj(obj);
6709     } else if (obj)
6710         dealloc_obj(obj);
6711
6712     return trapkilled;
6713 }
6714
6715 boolean
6716 unconscious()
6717 {
6718     if (multi >= 0)
6719         return FALSE;
6720
6721 #if 0 /*JP*/
6722     return (boolean) (u.usleep
6723                       || (nomovemsg
6724                           && (!strncmp(nomovemsg, "You awake", 9)
6725                               || !strncmp(nomovemsg, "You regain con", 14)
6726                               || !strncmp(nomovemsg, "You are consci", 14))));
6727 #else
6728 /*JP 3.6.2 \82Å\82Ì\8fo\8c»\88Ê\92u/\89ñ\90\94
6729  "You awake"      : potion.c(1)
6730   "You regain con": eat.c(1)
6731   "You are consci": eat.c(1)
6732 */
6733     return (boolean) (u.usleep
6734                       || (nomovemsg
6735                           && (!strncmp(nomovemsg, "\96Ú\82ª\82³\82ß\82½\82ª\93ª\92É", 18)
6736                               || !strncmp(nomovemsg, "\82 \82È\82½\82Í\90³\8bC\82Ã\82¢\82½", 18)
6737                               || !strncmp(nomovemsg, "\82 \82È\82½\82Í\82Ü\82½\90³\8bC\82Ã", 18))));
6738 #endif
6739 }
6740
6741 /*JP
6742 static const char lava_killer[] = "molten lava";
6743 */
6744 static const char lava_killer[] = "\82Ç\82ë\82Ç\82ë\82Ì\97n\8aâ\82Å";
6745
6746 boolean
6747 lava_effects()
6748 {
6749     register struct obj *obj, *obj2;
6750     int dmg = d(6, 6); /* only applicable for water walking */
6751     boolean usurvive, boil_away;
6752
6753     burn_away_slime();
6754     if (likes_lava(youmonst.data))
6755         return FALSE;
6756
6757     usurvive = Fire_resistance || (Wwalking && dmg < u.uhp);
6758     /*
6759      * A timely interrupt might manage to salvage your life
6760      * but not your gear.  For scrolls and potions this
6761      * will destroy whole stacks, where fire resistant hero
6762      * survivor only loses partial stacks via destroy_item().
6763      *
6764      * Flag items to be destroyed before any messages so
6765      * that player causing hangup at --More-- won't get an
6766      * emergency save file created before item destruction.
6767      */
6768     if (!usurvive)
6769         for (obj = invent; obj; obj = obj->nobj)
6770             if ((is_organic(obj) || obj->oclass == POTION_CLASS)
6771                 && !obj->oerodeproof
6772                 && objects[obj->otyp].oc_oprop != FIRE_RES
6773                 && obj->otyp != SCR_FIRE && obj->otyp != SPE_FIREBALL
6774                 && !obj_resists(obj, 0, 0)) /* for invocation items */
6775                 obj->in_use = 1;
6776
6777     /* Check whether we should burn away boots *first* so we know whether to
6778      * make the player sink into the lava. Assumption: water walking only
6779      * comes from boots.
6780      */
6781     if (uarmf && is_organic(uarmf) && !uarmf->oerodeproof) {
6782         obj = uarmf;
6783 /*JP
6784         pline("%s into flame!", Yobjnam2(obj, "burst"));
6785 */
6786         Your("%s\82Í\94R\82¦\82½\81I", xname(obj));
6787         iflags.in_lava_effects++; /* (see above) */
6788         (void) Boots_off();
6789         useup(obj);
6790         iflags.in_lava_effects--;
6791     }
6792
6793     if (!Fire_resistance) {
6794         if (Wwalking) {
6795 /*JP
6796             pline_The("%s here burns you!", hliquid("lava"));
6797 */
6798             pline("%s\82ª\82 \82È\82½\82ð\8fÄ\82«\82Â\82­\82µ\82½\81I", hliquid("\97n\8aâ"));
6799             if (usurvive) {
6800                 losehp(dmg, lava_killer, KILLED_BY); /* lava damage */
6801                 goto burn_stuff;
6802             }
6803         } else
6804 /*JP
6805             You("fall into the %s!", hliquid("lava"));
6806 */
6807             You("%s\82É\97\8e\82¿\82½\81I", hliquid("\97n\8aâ"));
6808
6809         usurvive = Lifesaved || discover;
6810         if (wizard)
6811             usurvive = TRUE;
6812
6813         /* prevent remove_worn_item() -> Boots_off(WATER_WALKING_BOOTS) ->
6814            spoteffects() -> lava_effects() recursion which would
6815            successfully delete (via useupall) the no-longer-worn boots;
6816            once recursive call returned, we would try to delete them again
6817            here in the outer call (and access stale memory, probably panic) */
6818         iflags.in_lava_effects++;
6819
6820         for (obj = invent; obj; obj = obj2) {
6821             obj2 = obj->nobj;
6822             /* above, we set in_use for objects which are to be destroyed */
6823             if (obj->otyp == SPE_BOOK_OF_THE_DEAD && !Blind) {
6824                 if (usurvive)
6825 #if 0 /*JP*/
6826                     pline("%s glows a strange %s, but remains intact.",
6827                           The(xname(obj)), hcolor("dark red"));
6828 #else
6829                     pline("%s\82Í\95s\8ev\8bc\82É%s\8bP\82¢\82½\82ª\81C\96³\8f\9d\82Ì\82æ\82¤\82¾\81D",
6830                           xname(obj), jconj_adj(hcolor("\88Ã\90Ô\90F\82Ì")));
6831 #endif
6832             } else if (obj->in_use) {
6833                 if (obj->owornmask) {
6834                     if (usurvive)
6835 /*JP
6836                         pline("%s into flame!", Yobjnam2(obj, "burst"));
6837 */
6838                         Your("%s\82Í\94R\82¦\82½\81I", xname(obj));
6839                     remove_worn_item(obj, TRUE);
6840                 }
6841                 useupall(obj);
6842             }
6843         }
6844
6845         iflags.in_lava_effects--;
6846
6847         /* s/he died... */
6848         boil_away = (u.umonnum == PM_WATER_ELEMENTAL
6849                      || u.umonnum == PM_STEAM_VORTEX
6850                      || u.umonnum == PM_FOG_CLOUD);
6851         for (;;) {
6852             u.uhp = -1;
6853             /* killer format and name are reconstructed every iteration
6854                because lifesaving resets them */
6855             killer.format = KILLED_BY;
6856             Strcpy(killer.name, lava_killer);
6857 /*JP
6858             You("%s...", boil_away ? "boil away" : "burn to a crisp");
6859 */
6860             You("%s\81D\81D\81D", boil_away ? "\95¦\93«\82µ\82½" : "\94R\82¦\82Ä\83p\83\8a\83p\83\8a\82É\82È\82Á\82½");
6861             done(BURNING);
6862             if (safe_teleds(TRUE))
6863                 break; /* successful life-save */
6864             /* nowhere safe to land; repeat burning loop */
6865 /*JP
6866             pline("You're still burning.");
6867 */
6868             You("\82Ü\82¾\94R\82¦\82Ä\82¢\82é\81D");
6869         }
6870 /*JP
6871         You("find yourself back on solid %s.", surface(u.ux, u.uy));
6872 */
6873         You("\82¢\82Â\82Ì\82Ü\82É\82©\8cÅ\82¢%s\82É\96ß\82Á\82Ä\82¢\82½\81D", surface(u.ux, u.uy));
6874         return TRUE;
6875     } else if (!Wwalking && (!u.utrap || u.utraptype != TT_LAVA)) {
6876         boil_away = !Fire_resistance;
6877         /* if not fire resistant, sink_into_lava() will quickly be fatal;
6878            hero needs to escape immediately */
6879         set_utrap((unsigned) (rn1(4, 4) + ((boil_away ? 2 : rn1(4, 12)) << 8)),
6880                   TT_LAVA);
6881 #if 0 /*JP:T*/
6882         You("sink into the %s%s!", hliquid("lava"),
6883             !boil_away ? ", but it only burns slightly"
6884                        : " and are about to be immolated");
6885 #else
6886         You("%s\82É\92¾\82ñ%s\82¾\81I", hliquid("\97n\8aâ"),
6887             !boil_away ? "\82¾\82ª\81C\82¿\82å\82Á\82Æ\8fÅ\82°\82½\82¾\82¯"
6888                        : "\82Å\8fÄ\82«\8eE\82³\82ê\82»\82¤");
6889 #endif
6890         if (u.uhp > 1)
6891             losehp(!boil_away ? 1 : (u.uhp / 2), lava_killer,
6892                    KILLED_BY); /* lava damage */
6893     }
6894
6895 burn_stuff:
6896     destroy_item(SCROLL_CLASS, AD_FIRE);
6897     destroy_item(SPBOOK_CLASS, AD_FIRE);
6898     destroy_item(POTION_CLASS, AD_FIRE);
6899     return FALSE;
6900 }
6901
6902 /* called each turn when trapped in lava */
6903 void
6904 sink_into_lava()
6905 {
6906 /*JP
6907     static const char sink_deeper[] = "You sink deeper into the lava.";
6908 */
6909     static const char sink_deeper[] = "\82 \82È\82½\82Í\82æ\82è\90[\82­\97n\8aâ\82É\92¾\82ñ\82¾\81D";
6910
6911     if (!u.utrap || u.utraptype != TT_LAVA) {
6912         ; /* do nothing; this shouldn't happen */
6913     } else if (!is_lava(u.ux, u.uy)) {
6914         reset_utrap(FALSE); /* this shouldn't happen either */
6915     } else if (!u.uinvulnerable) {
6916         /* ordinarily we'd have to be fire resistant to survive long
6917            enough to become stuck in lava, but it can happen without
6918            resistance if water walking boots allow survival and then
6919            get burned up; u.utrap time will be quite short in that case */
6920         if (!Fire_resistance)
6921             u.uhp = (u.uhp + 2) / 3;
6922
6923         u.utrap -= (1 << 8);
6924         if (u.utrap < (1 << 8)) {
6925             killer.format = KILLED_BY;
6926 /*JP
6927             Strcpy(killer.name, "molten lava");
6928 */
6929             Strcpy(killer.name, "\82Ç\82ë\82Ç\82ë\82Ì\97n\8aâ\82Å");
6930 /*JP
6931             You("sink below the surface and die.");
6932 */
6933             You("\8a®\91S\82É\97n\8aâ\82Ì\92\86\82É\92¾\82ñ\82Å\81A\8e\80\82É\82Ü\82µ\82½\81D\81D\81D");
6934             burn_away_slime(); /* add insult to injury? */
6935             done(DISSOLVED);
6936             /* can only get here via life-saving; try to get away from lava */
6937             reset_utrap(TRUE);
6938             /* levitation or flight have become unblocked, otherwise Tport */
6939             if (!Levitation && !Flying)
6940                 (void) safe_teleds(TRUE);
6941         } else if (!u.umoved) {
6942             /* can't fully turn into slime while in lava, but might not
6943                have it be burned away until you've come awfully close */
6944             if (Slimed && rnd(10 - 1) >= (int) (Slimed & TIMEOUT)) {
6945                 pline(sink_deeper);
6946                 burn_away_slime();
6947             } else {
6948                 Norep(sink_deeper);
6949             }
6950             u.utrap += rnd(4);
6951         }
6952     }
6953 }
6954
6955 /* called when something has been done (breaking a boulder, for instance)
6956    which entails a luck penalty if performed on a sokoban level */
6957 void
6958 sokoban_guilt()
6959 {
6960     if (Sokoban) {
6961         change_luck(-1);
6962         /* TODO: issue some feedback so that player can learn that whatever
6963            he/she just did is a naughty thing to do in sokoban and should
6964            probably be avoided in future....
6965            Caveat: doing this might introduce message sequencing issues,
6966            depending upon feedback during the various actions which trigger
6967            Sokoban luck penalties. */
6968     }
6969 }
6970
6971 /* called when a trap has been deleted or had its ttyp replaced */
6972 STATIC_OVL void
6973 maybe_finish_sokoban()
6974 {
6975     struct trap *t;
6976
6977     if (Sokoban && !in_mklev) {
6978         /* scan all remaining traps, ignoring any created by the hero;
6979            if this level has no more pits or holes, the current sokoban
6980            puzzle has been solved */
6981         for (t = ftrap; t; t = t->ntrap) {
6982             if (t->madeby_u)
6983                 continue;
6984             if (t->ttyp == PIT || t->ttyp == HOLE)
6985                 break;
6986         }
6987         if (!t) {
6988             /* we've passed the last trap without finding a pit or hole;
6989                clear the sokoban_rules flag so that luck penalties for
6990                things like breaking boulders or jumping will no longer
6991                be given, and restrictions on diagonal moves are lifted */
6992             Sokoban = 0; /* clear level.flags.sokoban_rules */
6993             /* TODO: give some feedback about solving the sokoban puzzle
6994                (perhaps say "congratulations" in Japanese?) */
6995         }
6996     }
6997 }
6998
6999 /*trap.c*/