OSDN Git Service

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