OSDN Git Service

add translation
[jnethack/source.git] / src / do.c
1 /* NetHack 3.6  do.c    $NHDT-Date: 1548978604 2019/01/31 23:50:04 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.189 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /*-Copyright (c) Derek S. Ray, 2015. */
4 /* NetHack may be freely redistributed.  See license for details. */
5
6 /* Contains code for 'd', 'D' (drop), '>', '<' (up, down) */
7
8 /* JNetHack Copyright */
9 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
10 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019            */
11 /* JNetHack may be freely redistributed.  See license for details. */
12
13 #include "hack.h"
14 #include "lev.h"
15
16 STATIC_DCL void FDECL(trycall, (struct obj *));
17 STATIC_DCL void NDECL(polymorph_sink);
18 STATIC_DCL boolean NDECL(teleport_sink);
19 STATIC_DCL void FDECL(dosinkring, (struct obj *));
20 STATIC_PTR int FDECL(drop, (struct obj *));
21 STATIC_PTR int NDECL(wipeoff);
22 STATIC_DCL int FDECL(menu_drop, (int));
23 STATIC_DCL int NDECL(currentlevel_rewrite);
24 STATIC_DCL void NDECL(final_level);
25 /* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */
26
27 extern int n_dgns; /* number of dungeons, from dungeon.c */
28
29 static NEARDATA const char drop_types[] = { ALLOW_COUNT, COIN_CLASS,
30                                             ALL_CLASSES, 0 };
31
32 /* 'd' command: drop one inventory item */
33 int
34 dodrop()
35 {
36     int result, i = (invent) ? 0 : (SIZE(drop_types) - 1);
37
38     if (*u.ushops)
39         sellobj_state(SELL_DELIBERATE);
40     result = drop(getobj(&drop_types[i], "drop"));
41     if (*u.ushops)
42         sellobj_state(SELL_NORMAL);
43     if (result)
44         reset_occupations();
45
46     return result;
47 }
48
49 /* Called when a boulder is dropped, thrown, or pushed.  If it ends up
50  * in a pool, it either fills the pool up or sinks away.  In either case,
51  * it's gone for good...  If the destination is not a pool, returns FALSE.
52  */
53 boolean
54 boulder_hits_pool(otmp, rx, ry, pushing)
55 struct obj *otmp;
56 register int rx, ry;
57 boolean pushing;
58 {
59     if (!otmp || otmp->otyp != BOULDER) {
60         impossible("Not a boulder?");
61     } else if (!Is_waterlevel(&u.uz) && is_pool_or_lava(rx, ry)) {
62         boolean lava = is_lava(rx, ry), fills_up;
63         const char *what = waterbody_name(rx, ry);
64         schar ltyp = levl[rx][ry].typ;
65         int chance = rn2(10); /* water: 90%; lava: 10% */
66         fills_up = lava ? chance == 0 : chance != 0;
67
68         if (fills_up) {
69             struct trap *ttmp = t_at(rx, ry);
70
71             if (ltyp == DRAWBRIDGE_UP) {
72                 levl[rx][ry].drawbridgemask &= ~DB_UNDER; /* clear lava */
73                 levl[rx][ry].drawbridgemask |= DB_FLOOR;
74             } else
75                 levl[rx][ry].typ = ROOM, levl[rx][ry].flags = 0;
76
77             if (ttmp)
78                 (void) delfloortrap(ttmp);
79             bury_objs(rx, ry);
80
81             newsym(rx, ry);
82             if (pushing) {
83                 char whobuf[BUFSZ];
84
85 /*JP
86                 Strcpy(whobuf, "you");
87 */
88                 Strcpy(whobuf, "\82 \82È\82½");
89                 if (u.usteed)
90                     Strcpy(whobuf, y_monnam(u.usteed));
91 #if 0 /*JP*/
92                 pline("%s %s %s into the %s.", upstart(whobuf),
93                       vtense(whobuf, "push"), the(xname(otmp)), what);
94 #else
95                 pline("%s\82Í%s\82ð%s\82Ì\92\86\82Ö\89\9f\82µ\82±\82ñ\82¾\81D", whobuf,
96                       xname(otmp), what);
97 #endif
98                 if (flags.verbose && !Blind)
99 /*JP
100                     pline("Now you can cross it!");
101 */
102                     pline("\82³\82\9f\93n\82ê\82é\82¼\81I");
103                 /* no splashing in this case */
104             }
105         }
106         if (!fills_up || !pushing) { /* splashing occurs */
107             if (!u.uinwater) {
108                 if (pushing ? !Blind : cansee(rx, ry)) {
109 #if 0 /*JP*/
110                     There("is a large splash as %s %s the %s.",
111                           the(xname(otmp)), fills_up ? "fills" : "falls into",
112                           what);
113 #else
114                     pline("%s\82ð%s\82É%s\82Æ\91å\82«\82È\82µ\82Ô\82«\82ª\82 \82ª\82Á\82½\81D",
115                           xname(otmp), what,
116                           fills_up ? "\96\84\82ß\8d\9e\82Þ" : "\97\8e\82·" );
117 #endif
118                 } else if (!Deaf)
119 /*JP
120                     You_hear("a%s splash.", lava ? " sizzling" : "");
121 */
122                     You_hear("%s\82Æ\8c¾\82¤\89¹\82ð\95·\82¢\82½\81D",lava ? "\83V\83\85\81[\83b" : "\83p\83V\83\83\83b");
123                 wake_nearto(rx, ry, 40);
124             }
125
126             if (fills_up && u.uinwater && distu(rx, ry) == 0) {
127                 u.uinwater = 0;
128                 docrt();
129                 vision_full_recalc = 1;
130 /*JP
131                 You("find yourself on dry land again!");
132 */
133                 You("\82¢\82Â\82Ì\82Ü\82É\82©\8a£\82¢\82½\8fê\8f\8a\82É\82¢\82½\81I");
134             } else if (lava && distu(rx, ry) <= 2) {
135                 int dmg;
136 #if 0 /*JP:T*/
137                 You("are hit by molten %s%c",
138                     hliquid("lava"), Fire_resistance ? '.' : '!');
139 #else
140                 You("\82Ç\82ë\82Ç\82ë\82Ì%s\82Å\83_\83\81\81[\83W\82ð\8eó\82¯\82½%s",
141                     hliquid("\97n\8aâ"), Fire_resistance ? "\81D" : "\81I");
142 #endif
143                 burn_away_slime();
144                 dmg = d((Fire_resistance ? 1 : 3), 6);
145 #if 0 /*JP:T*/
146                 losehp(Maybe_Half_Phys(dmg), /* lava damage */
147                        "molten lava", KILLED_BY);
148 #else
149                 losehp(Maybe_Half_Phys(dmg), /* lava damage */
150                        "\82Ç\82ë\82Ç\82ë\82Ì\97n\8aâ\82Å", KILLED_BY);
151 #endif
152             } else if (!fills_up && flags.verbose
153                        && (pushing ? !Blind : cansee(rx, ry)))
154 /*JP
155                 pline("It sinks without a trace!");
156 */
157                 pline("\82»\82ê\82Í\82 \82Æ\82©\82½\82à\82È\82­\92¾\82ñ\82¾\81I");
158         }
159
160         /* boulder is now gone */
161         if (pushing)
162             delobj(otmp);
163         else
164             obfree(otmp, (struct obj *) 0);
165         return TRUE;
166     }
167     return FALSE;
168 }
169
170 /* Used for objects which sometimes do special things when dropped; must be
171  * called with the object not in any chain.  Returns TRUE if the object goes
172  * away.
173  */
174 boolean
175 flooreffects(obj, x, y, verb)
176 struct obj *obj;
177 int x, y;
178 const char *verb;
179 {
180 #if 1 /*JP*//* trap.c */
181         extern const char *set_you[2];
182 #endif
183     struct trap *t;
184     struct monst *mtmp;
185     struct obj *otmp;
186     boolean tseen;
187     int ttyp = NO_TRAP;
188
189     if (obj->where != OBJ_FREE)
190         panic("flooreffects: obj not free");
191
192     /* make sure things like water_damage() have no pointers to follow */
193     obj->nobj = obj->nexthere = (struct obj *) 0;
194
195     if (obj->otyp == BOULDER && boulder_hits_pool(obj, x, y, FALSE)) {
196         return TRUE;
197     } else if (obj->otyp == BOULDER && (t = t_at(x, y)) != 0
198                && (is_pit(t->ttyp) || is_hole(t->ttyp))) {
199         ttyp = t->ttyp;
200         tseen = t->tseen ? TRUE : FALSE;
201         if (((mtmp = m_at(x, y)) && mtmp->mtrapped)
202             || (u.utrap && u.ux == x && u.uy == y)) {
203             if (*verb && (cansee(x, y) || distu(x, y) == 0))
204 #if 0 /*JP*/
205                 pline("%s boulder %s into the pit%s.",
206                       Blind ? "A" : "The",
207                       vtense((const char *) 0, verb),
208                       mtmp ? "" : " with you");
209 #else
210                 pline("\8aâ\82Í%s\97\8e\82µ\8c\8a\82Ö%s\81D",
211                       mtmp ? "" : "\82 \82È\82½\82Æ\82¢\82Á\82µ\82å\82É",
212                       jpast(verb));
213 #endif
214             if (mtmp) {
215                 if (!passes_walls(mtmp->data) && !throws_rocks(mtmp->data)) {
216                     /* dieroll was rnd(20); 1: maximum chance to hit
217                        since trapped target is a sitting duck */
218                     int damage, dieroll = 1;
219
220                     /* 3.6.2: this was calling hmon() unconditionally
221                        so always credited/blamed the hero but the boulder
222                        might have been thrown by a giant or launched by
223                        a rolling boulder trap triggered by a monster or
224                        dropped by a scroll of earth read by a monster */
225                     if (context.mon_moving) {
226                         /* normally we'd use ohitmon() but it can call
227                            drop_throw() which calls flooreffects() */
228                         damage = dmgval(obj, mtmp);
229                         mtmp->mhp -= damage;
230                         if (DEADMONSTER(mtmp)) {
231                             if (canspotmon(mtmp))
232 #if 0 /*JP*/
233                                 pline("%s is %s!", Monnam(mtmp),
234                                       (nonliving(mtmp->data)
235                                        || is_vampshifter(mtmp))
236                                       ? "destroyed" : "killed");
237 #else
238                                 pline("%s\82Í%s\81I", Monnam(mtmp),
239                                       (nonliving(mtmp->data)
240                                        || is_vampshifter(mtmp))
241                                       ? "\93|\82³\82ê\82½" : "\8eE\82³\82ê\82½");
242 #endif
243                             mondied(mtmp);
244                         }
245                     } else {
246                         (void) hmon(mtmp, obj, HMON_THROWN, dieroll);
247                     }
248                     if (!DEADMONSTER(mtmp) && !is_whirly(mtmp->data))
249                         return FALSE; /* still alive */
250                 }
251                 mtmp->mtrapped = 0;
252             } else {
253                 if (!Passes_walls && !throws_rocks(youmonst.data)) {
254 #if 0 /*JP*/
255                     losehp(Maybe_Half_Phys(rnd(15)),
256                            "squished under a boulder", NO_KILLER_PREFIX);
257 #else
258                     losehp(Maybe_Half_Phys(rnd(15)),
259                            "\8aâ\82Ì\89º\82Å\92×\82³\82ê\82Ä", KILLED_BY);
260 #endif
261                     return FALSE; /* player remains trapped */
262                 } else
263                     reset_utrap(TRUE);
264             }
265         }
266         if (*verb) {
267             if (Blind && (x == u.ux) && (y == u.uy)) {
268 /*JP
269                 You_hear("a CRASH! beneath you.");
270 */
271                 You_hear("\91«\8c³\82Å\89½\82©\82ª\8dÓ\82¯\82é\89¹\82ð\95·\82¢\82½\81D");
272             } else if (!Blind && cansee(x, y)) {
273 #if 0 /*JP*/
274                 pline_The("boulder %s%s.",
275                           (ttyp == TRAPDOOR && !tseen)
276                               ? "triggers and " : "",
277                           (ttyp == TRAPDOOR)
278                               ? "plugs a trap door"
279                               : (ttyp == HOLE) ? "plugs a hole"
280                                                : "fills a pit");
281 #else
282                 pline_The("\8aâ\82Í%s%s\81D", t->tseen ? "" : "ã©\82ð\8bN\93®\82µ\82Ä\81C",
283                           t->ttyp == TRAPDOOR ? "\97\8e\82µ\94à\82ð\96\84\82ß\82½" :
284                           t->ttyp == HOLE ? "\8c\8a\82ð\96\84\82ß\82½" :
285                           "\97\8e\82µ\8c\8a\82ð\96\84\82ß\82½");
286 #endif
287             } else {
288 /*JP
289                 You_hear("a boulder %s.", verb);
290 */
291                 You_hear("\8aâ\82ª%s\89¹\82ð\95·\82¢\82½\81D", verb);
292             }
293         }
294         /*
295          * Note:  trap might have gone away via ((hmon -> killed -> xkilled)
296          *  || mondied) -> mondead -> m_detach -> fill_pit.
297          */
298         if ((t = t_at(x, y)) != 0)
299             deltrap(t);
300         useupf(obj, 1L);
301         bury_objs(x, y);
302         newsym(x, y);
303         return TRUE;
304     } else if (is_lava(x, y)) {
305         return lava_damage(obj, x, y);
306     } else if (is_pool(x, y)) {
307         /* Reasonably bulky objects (arbitrary) splash when dropped.
308          * If you're floating above the water even small things make
309          * noise.  Stuff dropped near fountains always misses */
310         if ((Blind || (Levitation || Flying)) && !Deaf
311             && ((x == u.ux) && (y == u.uy))) {
312             if (!Underwater) {
313                 if (weight(obj) > 9) {
314 /*JP
315                     pline("Splash!");
316 */
317                     pline("\83o\83V\83\83\83b\81I");
318                 } else if (Levitation || Flying) {
319 /*JP
320                     pline("Plop!");
321 */
322                     pline("\83|\83`\83\83\83\93\81I");
323                 }
324             }
325             map_background(x, y, 0);
326             newsym(x, y);
327         }
328         return water_damage(obj, NULL, FALSE) == ER_DESTROYED;
329     } else if (u.ux == x && u.uy == y && (t = t_at(x, y)) != 0
330                && uteetering_at_seen_pit(t)) {
331         if (Blind && !Deaf)
332 /*JP
333             You_hear("%s tumble downwards.", the(xname(obj)));
334 */
335             You_hear("%s\82ª\89º\82Ì\95û\82Ö\93]\82ª\82Á\82Ä\82¢\82­\89¹\82ð\95·\82¢\82½\81D", xname(obj));
336         else
337 #if 0 /*JP*/
338             pline("%s %s into %s pit.", The(xname(obj)),
339                   otense(obj, "tumble"), the_your[t->madeby_u]);
340 #else
341             pline("%s\82Í%s\97\8e\82Æ\82µ\8c\8a\82É\93]\82ª\82è\82¨\82¿\82½\81D", xname(obj),
342                   set_you[t->madeby_u]);
343 #endif
344     } else if (obj->globby) {
345         /* Globby things like puddings might stick together */
346         while (obj && (otmp = obj_nexto_xy(obj, x, y, TRUE)) != 0) {
347             pudding_merge_message(obj, otmp);
348             /* intentionally not getting the melded object; obj_meld may set
349              * obj to null. */
350             (void) obj_meld(&obj, &otmp);
351         }
352         return (boolean) !obj;
353     }
354     return FALSE;
355 }
356
357 /* obj is an object dropped on an altar */
358 void
359 doaltarobj(obj)
360 register struct obj *obj;
361 {
362     if (Blind)
363         return;
364
365     if (obj->oclass != COIN_CLASS) {
366         /* KMH, conduct */
367         u.uconduct.gnostic++;
368     } else {
369         /* coins don't have bless/curse status */
370         obj->blessed = obj->cursed = 0;
371     }
372
373     if (obj->blessed || obj->cursed) {
374 #if 0 /*JP*/
375         There("is %s flash as %s %s the altar.",
376               an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)), doname(obj),
377               otense(obj, "hit"));
378 #else
379         pline("%s\82ª\8dÕ\92d\82É\90G\82ê\82é\82Æ%s\8cõ\82Á\82½\81D",
380               doname(obj),
381               jconj_adj(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)));
382 #endif
383         if (!Hallucination)
384             obj->bknown = 1;
385     } else {
386 /*JP
387         pline("%s %s on the altar.", Doname2(obj), otense(obj, "land"));
388 */
389         pline("%s\82ð\8dÕ\92d\82Ì\8fã\82É\92u\82¢\82½\81D", Doname2(obj));
390         if (obj->oclass != COIN_CLASS)
391             obj->bknown = 1;
392     }
393 }
394
395 STATIC_OVL void
396 trycall(obj)
397 register struct obj *obj;
398 {
399     if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname)
400         docall(obj);
401 }
402
403 /* Transforms the sink at the player's position into
404    a fountain, throne, altar or grave. */
405 STATIC_DCL void
406 polymorph_sink()
407 {
408     uchar sym = S_sink;
409     boolean sinklooted;
410
411     if (levl[u.ux][u.uy].typ != SINK)
412         return;
413
414     sinklooted = levl[u.ux][u.uy].looted != 0;
415     level.flags.nsinks--;
416     levl[u.ux][u.uy].doormask = 0; /* levl[][].flags */
417     switch (rn2(4)) {
418     default:
419     case 0:
420         sym = S_fountain;
421         levl[u.ux][u.uy].typ = FOUNTAIN;
422         levl[u.ux][u.uy].blessedftn = 0;
423         if (sinklooted)
424             SET_FOUNTAIN_LOOTED(u.ux, u.uy);
425         level.flags.nfountains++;
426         break;
427     case 1:
428         sym = S_throne;
429         levl[u.ux][u.uy].typ = THRONE;
430         if (sinklooted)
431             levl[u.ux][u.uy].looted = T_LOOTED;
432         break;
433     case 2:
434         sym = S_altar;
435         levl[u.ux][u.uy].typ = ALTAR;
436         levl[u.ux][u.uy].altarmask = Align2amask(rn2((int) A_LAWFUL + 2) - 1);
437         break;
438     case 3:
439         sym = S_room;
440         levl[u.ux][u.uy].typ = ROOM;
441         make_grave(u.ux, u.uy, (char *) 0);
442         if (levl[u.ux][u.uy].typ == GRAVE)
443             sym = S_grave;
444         break;
445     }
446     /* give message even if blind; we know we're not levitating,
447        so can feel the outcome even if we can't directly see it */
448     if (levl[u.ux][u.uy].typ != ROOM)
449 /*JP
450         pline_The("sink transforms into %s!", an(defsyms[sym].explanation));
451 */
452         pline_The("\97¬\82µ\91ä\82Í%s\82É\95Ï\89»\82µ\82½\81I", defsyms[sym].explanation);
453     else
454 /*JP
455         pline_The("sink vanishes.");
456 */
457         pline("\97¬\82µ\91ä\82Í\8fÁ\82¦\82½\81D");
458     newsym(u.ux, u.uy);
459 }
460
461 /* Teleports the sink at the player's position;
462    return True if sink teleported. */
463 STATIC_DCL boolean
464 teleport_sink()
465 {
466     int cx, cy;
467     int cnt = 0;
468     struct trap *trp;
469     struct engr *eng;
470
471     do {
472         cx = rnd(COLNO - 1);
473         cy = rn2(ROWNO);
474         trp = t_at(cx, cy);
475         eng = engr_at(cx, cy);
476     } while ((levl[cx][cy].typ != ROOM || trp || eng || cansee(cx, cy))
477              && cnt++ < 200);
478
479     if (levl[cx][cy].typ == ROOM && !trp && !eng) {
480         /* create sink at new position */
481         levl[cx][cy].typ = SINK;
482         levl[cx][cy].looted = levl[u.ux][u.uy].looted;
483         newsym(cx, cy);
484         /* remove old sink */
485         levl[u.ux][u.uy].typ = ROOM;
486         levl[u.ux][u.uy].looted = 0;
487         newsym(u.ux, u.uy);
488         return TRUE;
489     }
490     return FALSE;
491 }
492
493 /* obj is a ring being dropped over a kitchen sink */
494 STATIC_OVL void
495 dosinkring(obj)
496 register struct obj *obj;
497 {
498     struct obj *otmp, *otmp2;
499     boolean ideed = TRUE;
500     boolean nosink = FALSE;
501
502 /*JP
503     You("drop %s down the drain.", doname(obj));
504 */
505     You("%s\82ð\94r\90\85\8cû\82É\97\8e\82µ\82½\81D", doname(obj));
506     obj->in_use = TRUE;  /* block free identification via interrupt */
507     switch (obj->otyp) { /* effects that can be noticed without eyes */
508     case RIN_SEARCHING:
509 /*JP
510         You("thought %s got lost in the sink, but there it is!", yname(obj));
511 */
512         You("%s\82ð\8e¸\82Á\82½\8bC\82ª\82µ\82½\82ª\81C\8bC\82Ì\82¹\82¢\82¾\82Á\82½\81I", yname(obj));
513         goto giveback;
514     case RIN_SLOW_DIGESTION:
515 /*JP
516         pline_The("ring is regurgitated!");
517 */
518         pline("\8ew\97Ö\82Í\8bt\97¬\82µ\82½\81I");
519  giveback:
520         obj->in_use = FALSE;
521         dropx(obj);
522         trycall(obj);
523         return;
524     case RIN_LEVITATION:
525 /*JP
526         pline_The("sink quivers upward for a moment.");
527 */
528         pline("\97¬\82µ\91ä\82Í\88ê\8fu\81C\8fã\89º\82É\90k\82¦\82½\81D");
529         break;
530     case RIN_POISON_RESISTANCE:
531 /*JP
532         You("smell rotten %s.", makeplural(fruitname(FALSE)));
533 */
534         pline("\95\85\82Á\82½%s\82Ì\82æ\82¤\82È\93õ\82¢\82ª\82µ\82½\81D", fruitname(FALSE));
535         break;
536     case RIN_AGGRAVATE_MONSTER:
537 #if 0 /*JP:T*/
538         pline("Several %s buzz angrily around the sink.",
539               Hallucination ? makeplural(rndmonnam(NULL)) : "flies");
540 #else
541         pline("\90\94\95C\82Ì%s\82ª\83u\83\93\83u\83\93\97¬\82µ\91ä\82Ì\89ñ\82è\82ð\94ò\82Ñ\82Ü\82í\82Á\82½\81D",
542               Hallucination ? rndmonnam(NULL) : "\83n\83G");
543 #endif
544         break;
545     case RIN_SHOCK_RESISTANCE:
546 /*JP
547         pline("Static electricity surrounds the sink.");
548 */
549         pline("\97¬\82µ\91ä\82ª\83s\83\8a\83s\83\8a\82µ\82Í\82\82ß\82½\81D");
550         break;
551     case RIN_CONFLICT:
552 /*JP
553         You_hear("loud noises coming from the drain.");
554 */
555         You_hear("\94r\90\85\8cû\82©\82ç\82Ì\91å\82«\82È\89¹\82ð\95·\82¢\82½\81D");
556         break;
557     case RIN_SUSTAIN_ABILITY: /* KMH */
558 /*JP
559         pline_The("%s flow seems fixed.", hliquid("water"));
560 */
561         pline("%s\82Ì\97¬\82ê\82ª\88ê\92è\82É\82È\82Á\82½\82æ\82¤\82¾\81D", hliquid("\90\85"));
562         break;
563     case RIN_GAIN_STRENGTH:
564 #if 0 /*JP:T*/
565         pline_The("%s flow seems %ser now.",
566                   hliquid("water"),
567                   (obj->spe < 0) ? "weak" : "strong");
568 #else
569         pline("%s\82Ì\97¬\82ê\82ª%s\82­\82È\82Á\82½\82æ\82¤\82¾\81D",
570                   hliquid("\90\85"),
571                   (obj->spe < 0) ? "\8eã" : "\8b­");
572 #endif
573         break;
574     case RIN_GAIN_CONSTITUTION:
575 #if 0 /*JP:T*/
576         pline_The("%s flow seems %ser now.",
577                   hliquid("water"),
578                   (obj->spe < 0) ? "less" : "great");
579 #else
580         pline("\97¬\82ê\82é%s\82Ì\97Ê\82ª%s\82­\82È\82Á\82½\82æ\82¤\82¾\81D",
581                   hliquid("\90\85"),
582                   (obj->spe < 0) ? "\8f­\82È" : "\91½");
583 #endif
584         break;
585     case RIN_INCREASE_ACCURACY: /* KMH */
586 #if 0 /*JP:T*/
587         pline_The("%s flow %s the drain.",
588                   hliquid("water"),
589                   (obj->spe < 0) ? "misses" : "hits");
590 #else
591         pline("%s\82ª\94r\90\85\8cû%s\82æ\82¤\82É\82È\82Á\82½\81D",
592                   hliquid("\90\85"),
593                   (obj->spe < 0) ? "\82©\82ç\94½\82ê\82é" : "\82ß\82ª\82¯\82Ä\97¬\82ê\82é");
594 #endif
595         break;
596     case RIN_INCREASE_DAMAGE:
597 #if 0 /*JP:T*/
598         pline_The("water's force seems %ser now.",
599                   (obj->spe < 0) ? "small" : "great");
600 #else
601         pline("\90\85\82Ì\90¨\82¢\82ª%s\82­\82È\82Á\82½\82æ\82¤\82¾\81D",
602                   (obj->spe < 0) ? "\8eã" : "\8b­");
603 #endif
604         break;
605     case RIN_HUNGER:
606         ideed = FALSE;
607         for (otmp = level.objects[u.ux][u.uy]; otmp; otmp = otmp2) {
608             otmp2 = otmp->nexthere;
609             if (otmp != uball && otmp != uchain
610                 && !obj_resists(otmp, 1, 99)) {
611                 if (!Blind) {
612 #if 0 /*JP*/
613                     pline("Suddenly, %s %s from the sink!", doname(otmp),
614                           otense(otmp, "vanish"));
615 #else
616                     pline("\93Ë\91R\81C%s\82Í\97¬\82µ\91ä\82©\82ç\8fÁ\82¦\82½\81I", doname(otmp));
617 #endif
618                     ideed = TRUE;
619                 }
620                 delobj(otmp);
621             }
622         }
623         break;
624     case MEAT_RING:
625         /* Not the same as aggravate monster; besides, it's obvious. */
626 /*JP
627         pline("Several flies buzz around the sink.");
628 */
629         pline("\90\94\95C\82Ì\83n\83G\82ª\83u\83\93\83u\83\93\97¬\82µ\91ä\82Ì\89ñ\82è\82ð\94ò\82Ñ\82Ü\82í\82Á\82½\81D");
630         break;
631     case RIN_TELEPORTATION:
632         nosink = teleport_sink();
633         /* give message even if blind; we know we're not levitating,
634            so can feel the outcome even if we can't directly see it */
635 /*JP
636             pline_The("sink %svanishes.", nosink ? "" : "momentarily ");
637 */
638             pline_The("\97¬\82µ\91ä\82Í%s\8fÁ\82¦\82½\81D", nosink ? "" : "\88ê\8fu");
639         ideed = FALSE;
640         break;
641     case RIN_POLYMORPH:
642         polymorph_sink();
643         nosink = TRUE;
644         /* for S_room case, same message as for teleportation is given */
645         ideed = (levl[u.ux][u.uy].typ != ROOM);
646         break;
647     default:
648         ideed = FALSE;
649         break;
650     }
651     if (!Blind && !ideed) {
652         ideed = TRUE;
653         switch (obj->otyp) { /* effects that need eyes */
654         case RIN_ADORNMENT:
655 /*JP
656             pline_The("faucets flash brightly for a moment.");
657 */
658             pline("\8eÖ\8cû\82Í\88ê\8fu\96¾\82é\82­\8bP\82¢\82½\81D");
659             break;
660         case RIN_REGENERATION:
661 /*JP
662             pline_The("sink looks as good as new.");
663 */
664             pline("\97¬\82µ\91ä\82ª\90V\95i\82Ì\82æ\82¤\82É\82È\82Á\82½\81D");
665             break;
666         case RIN_INVISIBILITY:
667 /*JP
668             You("don't see anything happen to the sink.");
669 */
670             pline("\97¬\82µ\91ä\82É\89½\82ª\8bN\82«\82½\82Ì\82©\8c©\82¦\82È\82©\82Á\82½\81D");
671             break;
672         case RIN_FREE_ACTION:
673 /*JP
674             You_see("the ring slide right down the drain!");
675 */
676             pline("\8ew\97Ö\82ª\94r\90\85\8cû\82ð\82·\82é\82è\82Æ\94ð\82¯\82é\82Ì\82ð\8c©\82½\81I");
677             break;
678         case RIN_SEE_INVISIBLE:
679 #if 0 /*JP*/
680             You_see("some %s in the sink.",
681                     Hallucination ? "oxygen molecules" : "air");
682 #else
683             pline("\97¬\82µ\91ä\82Ì\8fã\82Ì%s\82ª\8c©\82¦\82½\81D",
684                   Hallucination ? "\8e_\91f\95ª\8eq" : "\8bó\8bC");
685 #endif
686             break;
687         case RIN_STEALTH:
688 /*JP
689             pline_The("sink seems to blend into the floor for a moment.");
690 */
691             pline("\88ê\8fu\81C\97¬\82µ\91ä\82ª\8f°\82É\97n\82¯\82±\82ñ\82¾\82æ\82¤\82É\8c©\82¦\82½\81D");
692             break;
693         case RIN_FIRE_RESISTANCE:
694 #if 0 /*JP*/
695             pline_The("hot %s faucet flashes brightly for a moment.",
696                       hliquid("water"));
697 #else /*\82Æ\82è\82 \82¦\82¸hliquid()\82Í\8eg\82í\82È\82¢\8c`\82É*/
698             pline("\88ê\8fu\81C\94M\93\92\82Ì\8eÖ\8cû\82ª\96¾\82é\82­\8bP\82¢\82½\81D");
699 #endif
700             break;
701         case RIN_COLD_RESISTANCE:
702 #if 0 /*JP*/
703             pline_The("cold %s faucet flashes brightly for a moment.",
704                       hliquid("water"));
705 #else /*\82Æ\82è\82 \82¦\82¸hliquid()\82Í\8eg\82í\82È\82¢\8c`\82É*/
706             pline("\88ê\8fu\81C\97â\90\85\82Ì\8eÖ\8cû\82ª\96¾\82é\82­\8bP\82¢\82½\81D");
707 #endif
708             break;
709         case RIN_PROTECTION_FROM_SHAPE_CHAN:
710 /*JP
711             pline_The("sink looks nothing like a fountain.");
712 */
713             pline("\97¬\82µ\91ä\82Í\90ò\82Æ\82Í\82Ü\82Á\82½\82­\88á\82¤\82à\82Ì\82Ì\82æ\82¤\82É\8c©\82¦\82½\81D");
714             break;
715         case RIN_PROTECTION:
716 #if 0 /*JP:T*/
717             pline_The("sink glows %s for a moment.",
718                       hcolor((obj->spe < 0) ? NH_BLACK : NH_SILVER));
719 #else
720             pline("\97¬\82µ\91ä\82Í\88ê\8fu%s\8bP\82¢\82½\81D",
721                       jconj_adj(hcolor((obj->spe < 0) ? NH_BLACK : NH_SILVER)));
722 #endif
723             break;
724         case RIN_WARNING:
725 /*JP
726             pline_The("sink glows %s for a moment.", hcolor(NH_WHITE));
727 */
728             pline("\97¬\82µ\91ä\82Í\88ê\8fu%s\8bP\82¢\82½\81D", jconj_adj(hcolor(NH_WHITE)));
729             break;
730         case RIN_TELEPORT_CONTROL:
731 /*JP: "beam aboard" \82Í\83X\83^\81[\83g\83\8c\83b\83N\82Ì\81u\93]\91\97\81v*/
732 /*JP
733             pline_The("sink looks like it is being beamed aboard somewhere.");
734 */
735             pline("\97¬\82µ\91ä\82Í\82Ç\82±\82©\82É\93]\91\97\82³\82ê\82æ\82¤\82Æ\82µ\82Ä\82¢\82é\82æ\82¤\82É\8c©\82¦\82½\81D");
736             break;
737         case RIN_POLYMORPH_CONTROL:
738             pline_The(
739 /*JP
740                 "sink momentarily looks like a regularly erupting geyser.");
741 */
742                 "\97¬\82µ\91ä\82Í\88ê\8fu\8bK\91¥\90³\82µ\82­\95¬\8fo\82·\82é\8aÔ\8c\87\90ò\82Ì\82æ\82¤\82É\8c©\82¦\82½\81D");
743             break;
744         default:
745             break;
746         }
747     }
748     if (ideed)
749         trycall(obj);
750     else if (!nosink)
751 /*JP
752         You_hear("the ring bouncing down the drainpipe.");
753 */
754         You_hear("\8ew\97Ö\82ª\94r\90\85\8cû\82É\93\96\82½\82è\82È\82ª\82ç\97\8e\82¿\82é\89¹\82ð\95·\82¢\82½\81D");
755
756     if (!rn2(20) && !nosink) {
757 /*JP
758         pline_The("sink backs up, leaving %s.", doname(obj));
759 */
760         pline("\97¬\82µ\91ä\82ª\8bt\97¬\82µ\82Ä\81C%s\82ª\96ß\82Á\82Ä\82«\82½\81D", doname(obj));
761         obj->in_use = FALSE;
762         dropx(obj);
763     } else if (!rn2(5)) {
764         freeinv(obj);
765         obj->in_use = FALSE;
766         obj->ox = u.ux;
767         obj->oy = u.uy;
768         add_to_buried(obj);
769     } else
770         useup(obj);
771 }
772
773 /* some common tests when trying to drop or throw items */
774 boolean
775 canletgo(obj, word)
776 struct obj *obj;
777 const char *word;
778 {
779     if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
780         if (*word)
781 /*JP
782             Norep("You cannot %s %s you are wearing.", word, something);
783 */
784             Norep("\82 \82È\82½\82ª\90g\82É\82Â\82¯\82Ä\82¢\82é\82à\82Ì\82ð%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", word);
785         return FALSE;
786     }
787     if (obj->otyp == LOADSTONE && obj->cursed) {
788         /* getobj() kludge sets corpsenm to user's specified count
789            when refusing to split a stack of cursed loadstones */
790         if (*word) {
791 #if 0 /*JP*//*\93ú\96{\8cê\82Å\82Í\95s\97v*/
792             /* getobj() ignores a count for throwing since that is
793                implicitly forced to be 1; replicate its kludge... */
794             if (!strcmp(word, "throw") && obj->quan > 1L)
795                 obj->corpsenm = 1;
796 #endif
797 #if 0 /*JP*/
798             pline("For some reason, you cannot %s%s the stone%s!", word,
799                   obj->corpsenm ? " any of" : "", plur(obj->quan));
800 #else
801             pline("\82Ç\82¤\82¢\82¤\82í\82¯\82©\81C\82 \82È\82½\82Í\90Î\82ð%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81I",
802                   word);
803 #endif
804         }
805         obj->corpsenm = 0; /* reset */
806         obj->bknown = 1;
807         return FALSE;
808     }
809     if (obj->otyp == LEASH && obj->leashmon != 0) {
810         if (*word)
811 /*JP
812             pline_The("leash is tied around your %s.", body_part(HAND));
813 */
814             pline("\95R\82Í\82 \82È\82½\82Ì%s\82É\8c\8b\82Ñ\82Â\82¯\82ç\82ê\82Ä\82¢\82é\81D", body_part(HAND));
815         return FALSE;
816     }
817     if (obj->owornmask & W_SADDLE) {
818         if (*word)
819 /*JP
820             You("cannot %s %s you are sitting on.", word, something);
821 */
822             You("\8fæ\82Á\82Ä\82¢\82é\8aÔ\82Í%s\82±\82Æ\82Í\82Å\82«\82È\82¢\81D", word);
823         return FALSE;
824     }
825     return TRUE;
826 }
827
828 STATIC_PTR int
829 drop(obj)
830 register struct obj *obj;
831 {
832     if (!obj)
833         return 0;
834 /*JP
835     if (!canletgo(obj, "drop"))
836 */
837     if (!canletgo(obj, "\92u\82­"))
838         return 0;
839     if (obj == uwep) {
840         if (welded(uwep)) {
841             weldmsg(obj);
842             return 0;
843         }
844         setuwep((struct obj *) 0);
845     }
846     if (obj == uquiver) {
847         setuqwep((struct obj *) 0);
848     }
849     if (obj == uswapwep) {
850         setuswapwep((struct obj *) 0);
851     }
852
853     if (u.uswallow) {
854         /* barrier between you and the floor */
855         if (flags.verbose) {
856             char *onam_p, monbuf[BUFSZ];
857
858             /* doname can call s_suffix, reusing its buffer */
859             Strcpy(monbuf, s_suffix(mon_nam(u.ustuck)));
860             onam_p = is_unpaid(obj) ? yobjnam(obj, (char *) 0) : doname(obj);
861 #if 0 /*JP*/
862             You("drop %s into %s %s.", onam_p, monbuf,
863                 mbodypart(u.ustuck, STOMACH));
864 #else
865             You("%s\82ð%s%s\82É\92u\82¢\82½\81D", onam_p, monbuf,
866                 mbodypart(u.ustuck, STOMACH));
867 #endif
868         }
869     } else {
870         if ((obj->oclass == RING_CLASS || obj->otyp == MEAT_RING)
871             && IS_SINK(levl[u.ux][u.uy].typ)) {
872             dosinkring(obj);
873             return 1;
874         }
875         if (!can_reach_floor(TRUE)) {
876             /* we might be levitating due to #invoke Heart of Ahriman;
877                if so, levitation would end during call to freeinv()
878                and we want hitfloor() to happen before float_down() */
879             boolean levhack = finesse_ahriman(obj);
880
881             if (levhack)
882                 ELevitation = W_ART; /* other than W_ARTI */
883             if (flags.verbose)
884 /*JP
885                 You("drop %s.", doname(obj));
886 */
887                 You("%s\82ð\92u\82¢\82½\81D", doname(obj));
888             /* Ensure update when we drop gold objects */
889             if (obj->oclass == COIN_CLASS)
890                 context.botl = 1;
891             freeinv(obj);
892             hitfloor(obj, TRUE);
893             if (levhack)
894                 float_down(I_SPECIAL | TIMEOUT, W_ARTI | W_ART);
895             return 1;
896         }
897         if (!IS_ALTAR(levl[u.ux][u.uy].typ) && flags.verbose)
898 /*JP
899             You("drop %s.", doname(obj));
900 */
901             You("%s\82ð\92u\82¢\82½\81D", doname(obj));
902     }
903     dropx(obj);
904     return 1;
905 }
906
907 /* dropx - take dropped item out of inventory;
908    called in several places - may produce output
909    (eg ship_object() and dropy() -> sellobj() both produce output) */
910 void
911 dropx(obj)
912 register struct obj *obj;
913 {
914     /* Ensure update when we drop gold objects */
915     if (obj->oclass == COIN_CLASS)
916         context.botl = 1;
917     freeinv(obj);
918     if (!u.uswallow) {
919         if (ship_object(obj, u.ux, u.uy, FALSE))
920             return;
921         if (IS_ALTAR(levl[u.ux][u.uy].typ))
922             doaltarobj(obj); /* set bknown */
923     }
924     dropy(obj);
925 }
926
927 /* dropy - put dropped object at destination; called from lots of places */
928 void
929 dropy(obj)
930 struct obj *obj;
931 {
932     dropz(obj, FALSE);
933 }
934
935 /* dropz - really put dropped object at its destination... */
936 void
937 dropz(obj, with_impact)
938 struct obj *obj;
939 boolean with_impact;
940 {
941     if (obj == uwep)
942         setuwep((struct obj *) 0);
943     if (obj == uquiver)
944         setuqwep((struct obj *) 0);
945     if (obj == uswapwep)
946         setuswapwep((struct obj *) 0);
947
948 /*JP
949     if (!u.uswallow && flooreffects(obj, u.ux, u.uy, "drop"))
950 */
951     if (!u.uswallow && flooreffects(obj,u.ux,u.uy, "\97\8e\82¿\82é"))
952         return;
953     /* uswallow check done by GAN 01/29/87 */
954     if (u.uswallow) {
955         boolean could_petrify = FALSE;
956         boolean could_poly = FALSE;
957         boolean could_slime = FALSE;
958         boolean could_grow = FALSE;
959         boolean could_heal = FALSE;
960
961         if (obj != uball) { /* mon doesn't pick up ball */
962             if (obj->otyp == CORPSE) {
963                 could_petrify = touch_petrifies(&mons[obj->corpsenm]);
964                 could_poly = polyfodder(obj);
965                 could_slime = (obj->corpsenm == PM_GREEN_SLIME);
966                 could_grow = (obj->corpsenm == PM_WRAITH);
967                 could_heal = (obj->corpsenm == PM_NURSE);
968             }
969             if (is_unpaid(obj))
970                 (void) stolen_value(obj, u.ux, u.uy, TRUE, FALSE);
971             (void) mpickobj(u.ustuck, obj);
972             if (is_animal(u.ustuck->data)) {
973                 if (could_poly || could_slime) {
974                     (void) newcham(u.ustuck,
975                                    could_poly ? (struct permonst *) 0
976                                               : &mons[PM_GREEN_SLIME],
977                                    FALSE, could_slime);
978                     delobj(obj); /* corpse is digested */
979                 } else if (could_petrify) {
980                     minstapetrify(u.ustuck, TRUE);
981                     /* Don't leave a cockatrice corpse in a statue */
982                     if (!u.uswallow)
983                         delobj(obj);
984                 } else if (could_grow) {
985                     (void) grow_up(u.ustuck, (struct monst *) 0);
986                     delobj(obj); /* corpse is digested */
987                 } else if (could_heal) {
988                     u.ustuck->mhp = u.ustuck->mhpmax;
989                     delobj(obj); /* corpse is digested */
990                 }
991             }
992         }
993     } else {
994         place_object(obj, u.ux, u.uy);
995         if (with_impact)
996             container_impact_dmg(obj, u.ux, u.uy);
997         if (obj == uball)
998             drop_ball(u.ux, u.uy);
999         else if (level.flags.has_shop)
1000             sellobj(obj, u.ux, u.uy);
1001         stackobj(obj);
1002         if (Blind && Levitation)
1003             map_object(obj, 0);
1004         newsym(u.ux, u.uy); /* remap location under self */
1005     }
1006 }
1007
1008 /* things that must change when not held; recurse into containers.
1009    Called for both player and monsters */
1010 void
1011 obj_no_longer_held(obj)
1012 struct obj *obj;
1013 {
1014     if (!obj) {
1015         return;
1016     } else if (Has_contents(obj)) {
1017         struct obj *contents;
1018
1019         for (contents = obj->cobj; contents; contents = contents->nobj)
1020             obj_no_longer_held(contents);
1021     }
1022     switch (obj->otyp) {
1023     case CRYSKNIFE:
1024         /* Normal crysknife reverts to worm tooth when not held by hero
1025          * or monster; fixed crysknife has only 10% chance of reverting.
1026          * When a stack of the latter is involved, it could be worthwhile
1027          * to give each individual crysknife its own separate 10% chance,
1028          * but we aren't in any position to handle stack splitting here.
1029          */
1030         if (!obj->oerodeproof || !rn2(10)) {
1031             /* if monsters aren't moving, assume player is responsible */
1032             if (!context.mon_moving && !program_state.gameover)
1033                 costly_alteration(obj, COST_DEGRD);
1034             obj->otyp = WORM_TOOTH;
1035             obj->oerodeproof = 0;
1036         }
1037         break;
1038     }
1039 }
1040
1041 /* 'D' command: drop several things */
1042 int
1043 doddrop()
1044 {
1045     int result = 0;
1046
1047     if (!invent) {
1048 /*JP
1049         You("have nothing to drop.");
1050 */
1051         You("\97\8e\82Æ\82·\82à\82Ì\82ð\89½\82à\8e\9d\82Á\82Ä\82¢\82È\82¢\81D");
1052         return 0;
1053     }
1054     add_valid_menu_class(0); /* clear any classes already there */
1055     if (*u.ushops)
1056         sellobj_state(SELL_DELIBERATE);
1057     if (flags.menu_style != MENU_TRADITIONAL
1058         || (result = ggetobj("drop", drop, 0, FALSE, (unsigned *) 0)) < -1)
1059         result = menu_drop(result);
1060     if (*u.ushops)
1061         sellobj_state(SELL_NORMAL);
1062     if (result)
1063         reset_occupations();
1064
1065     return result;
1066 }
1067
1068 /* Drop things from the hero's inventory, using a menu. */
1069 STATIC_OVL int
1070 menu_drop(retry)
1071 int retry;
1072 {
1073     int n, i, n_dropped = 0;
1074     long cnt;
1075     struct obj *otmp, *otmp2;
1076     menu_item *pick_list;
1077     boolean all_categories = TRUE;
1078     boolean drop_everything = FALSE;
1079
1080     if (retry) {
1081         all_categories = (retry == -2);
1082     } else if (flags.menu_style == MENU_FULL) {
1083         all_categories = FALSE;
1084 /*JP
1085         n = query_category("Drop what type of items?", invent,
1086 */
1087         n = query_category("\82Ç\82Ì\8eí\97Þ\82Ì\83A\83C\83e\83\80\82ð\92u\82«\82Ü\82·\82©\81H", invent,
1088                            UNPAID_TYPES | ALL_TYPES | CHOOSE_ALL | BUC_BLESSED
1089                                | BUC_CURSED | BUC_UNCURSED | BUC_UNKNOWN,
1090                            &pick_list, PICK_ANY);
1091         if (!n)
1092             goto drop_done;
1093         for (i = 0; i < n; i++) {
1094             if (pick_list[i].item.a_int == ALL_TYPES_SELECTED)
1095                 all_categories = TRUE;
1096             else if (pick_list[i].item.a_int == 'A')
1097                 drop_everything = TRUE;
1098             else
1099                 add_valid_menu_class(pick_list[i].item.a_int);
1100         }
1101         free((genericptr_t) pick_list);
1102     } else if (flags.menu_style == MENU_COMBINATION) {
1103         unsigned ggoresults = 0;
1104
1105         all_categories = FALSE;
1106         /* Gather valid classes via traditional NetHack method */
1107         i = ggetobj("drop", drop, 0, TRUE, &ggoresults);
1108         if (i == -2)
1109             all_categories = TRUE;
1110         if (ggoresults & ALL_FINISHED) {
1111             n_dropped = i;
1112             goto drop_done;
1113         }
1114     }
1115
1116     if (drop_everything) {
1117         /*
1118          * Dropping a burning potion of oil while levitating can cause
1119          * an explosion which might destroy some of hero's inventory,
1120          * so the old code
1121          *      for (otmp = invent; otmp; otmp = otmp2) {
1122          *          otmp2 = otmp->nobj;
1123          *          n_dropped += drop(otmp);
1124          *      }
1125          * was unreliable and could lead to an "object lost" panic.
1126          *
1127          * Use the bypass bit to mark items already processed (hence
1128          * not droppable) and rescan inventory until no unbypassed
1129          * items remain.
1130          */
1131         bypass_objlist(invent, FALSE); /* clear bypass bit for invent */
1132         while ((otmp = nxt_unbypassed_obj(invent)) != 0)
1133             n_dropped += drop(otmp);
1134         /* we might not have dropped everything (worn armor, welded weapon,
1135            cursed loadstones), so reset any remaining inventory to normal */
1136         bypass_objlist(invent, FALSE);
1137     } else {
1138         /* should coordinate with perm invent, maybe not show worn items */
1139 #if 0 /*JP*/
1140         n = query_objlist("What would you like to drop?", &invent,
1141                           (USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY,
1142                           all_categories ? allow_all : allow_category);
1143 #else
1144         n = query_objlist("\82Ç\82ê\82ð\92u\82«\82Ü\82·\82©\81H", &invent,
1145                           (USE_INVLET | INVORDER_SORT), &pick_list, PICK_ANY,
1146                           all_categories ? allow_all : allow_category);
1147 #endif
1148         if (n > 0) {
1149             /*
1150              * picklist[] contains a set of pointers into inventory, but
1151              * as soon as something gets dropped, they might become stale
1152              * (see the drop_everything code above for an explanation).
1153              * Just checking to see whether one is still in the invent
1154              * chain is not sufficient validation since destroyed items
1155              * will be freed and items we've split here might have already
1156              * reused that memory and put the same pointer value back into
1157              * invent.  Ditto for using invlet to validate.  So we start
1158              * by setting bypass on all of invent, then check each pointer
1159              * to verify that it is in invent and has that bit set.
1160              */
1161             bypass_objlist(invent, TRUE);
1162             for (i = 0; i < n; i++) {
1163                 otmp = pick_list[i].item.a_obj;
1164                 for (otmp2 = invent; otmp2; otmp2 = otmp2->nobj)
1165                     if (otmp2 == otmp)
1166                         break;
1167                 if (!otmp2 || !otmp2->bypass)
1168                     continue;
1169                 /* found next selected invent item */
1170                 cnt = pick_list[i].count;
1171                 if (cnt < otmp->quan) {
1172                     if (welded(otmp)) {
1173                         ; /* don't split */
1174                     } else if (otmp->otyp == LOADSTONE && otmp->cursed) {
1175                         /* same kludge as getobj(), for canletgo()'s use */
1176                         otmp->corpsenm = (int) cnt; /* don't split */
1177                     } else {
1178                         otmp = splitobj(otmp, cnt);
1179                     }
1180                 }
1181                 n_dropped += drop(otmp);
1182             }
1183             bypass_objlist(invent, FALSE); /* reset invent to normal */
1184             free((genericptr_t) pick_list);
1185         }
1186     }
1187
1188  drop_done:
1189     return n_dropped;
1190 }
1191
1192 /* on a ladder, used in goto_level */
1193 static NEARDATA boolean at_ladder = FALSE;
1194
1195 /* the '>' command */
1196 int
1197 dodown()
1198 {
1199     struct trap *trap = 0;
1200     boolean stairs_down = ((u.ux == xdnstair && u.uy == ydnstair)
1201                            || (u.ux == sstairs.sx && u.uy == sstairs.sy
1202                                && !sstairs.up)),
1203             ladder_down = (u.ux == xdnladder && u.uy == ydnladder);
1204
1205     if (u_rooted())
1206         return 1;
1207
1208     if (stucksteed(TRUE)) {
1209         return 0;
1210     }
1211     /* Levitation might be blocked, but player can still use '>' to
1212        turn off controlled levitation */
1213     if (HLevitation || ELevitation) {
1214         if ((HLevitation & I_SPECIAL) || (ELevitation & W_ARTI)) {
1215             /* end controlled levitation */
1216             if (ELevitation & W_ARTI) {
1217                 struct obj *obj;
1218
1219                 for (obj = invent; obj; obj = obj->nobj) {
1220                     if (obj->oartifact
1221                         && artifact_has_invprop(obj, LEVITATION)) {
1222                         if (obj->age < monstermoves)
1223                             obj->age = monstermoves;
1224                         obj->age += rnz(100);
1225                     }
1226                 }
1227             }
1228             if (float_down(I_SPECIAL | TIMEOUT, W_ARTI)) {
1229                 return 1; /* came down, so moved */
1230             } else if (!HLevitation && !ELevitation) {
1231 /*JP
1232                 Your("latent levitation ceases.");
1233 */
1234                 pline("\90ö\8dÝ\93I\82È\95\82\97V\94\\97Í\82ª\92\86\92f\82µ\82½\81D");
1235                 return 1; /* did something, effectively moved */
1236             }
1237         }
1238         if (BLevitation) {
1239             ; /* weren't actually floating after all */
1240         } else if (Blind) {
1241             /* Avoid alerting player to an unknown stair or ladder.
1242              * Changes the message for a covered, known staircase
1243              * too; staircase knowledge is not stored anywhere.
1244              */
1245             if (stairs_down)
1246                 stairs_down =
1247                     (glyph_to_cmap(levl[u.ux][u.uy].glyph) == S_dnstair);
1248             else if (ladder_down)
1249                 ladder_down =
1250                     (glyph_to_cmap(levl[u.ux][u.uy].glyph) == S_dnladder);
1251         }
1252         if (Is_airlevel(&u.uz))
1253 /*JP
1254             You("are floating in the %s.", surface(u.ux, u.uy));
1255 */
1256             You("%s\82Ì\92\86\82É\95\82\82¢\82Ä\82¢\82é\81D", surface(u.ux, u.uy));
1257         else if (Is_waterlevel(&u.uz))
1258 #if 0 /*JP*/
1259             You("are floating in %s.",
1260                 is_pool(u.ux, u.uy) ? "the water" : "a bubble of air");
1261 #else
1262             You("%s\82Ì\92\86\82É\95\82\82¢\82Ä\82¢\82é\81D",
1263                 is_pool(u.ux, u.uy) ? "\90\85" : "\8bó\8bC\82Ì\96A");
1264 #endif
1265         else
1266 #if 0 /*JP:T*/
1267             floating_above(stairs_down ? "stairs" : ladder_down
1268                                                     ? "ladder"
1269                                                     : surface(u.ux, u.uy));
1270 #else
1271             floating_above(stairs_down ? "\8aK\92i" : ladder_down
1272                                                     ? "\82Í\82µ\82²"
1273                                                     : surface(u.ux, u.uy));
1274 #endif
1275         return 0; /* didn't move */
1276     }
1277     if (!stairs_down && !ladder_down) {
1278         trap = t_at(u.ux, u.uy);
1279         if (trap && uteetering_at_seen_pit(trap)) {
1280             dotrap(trap, TOOKPLUNGE);
1281             return 1;
1282         } else if (!trap || !is_hole(trap->ttyp)
1283                    || !Can_fall_thru(&u.uz) || !trap->tseen) {
1284             if (flags.autodig && !context.nopick && uwep && is_pick(uwep)) {
1285                 return use_pick_axe2(uwep);
1286             } else {
1287 /*JP
1288                 You_cant("go down here.");
1289 */
1290                 pline("\82±\82±\82Å\82Í\8d~\82è\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D");
1291                 return 0;
1292             }
1293         }
1294     }
1295     if (u.ustuck) {
1296 #if 0 /*JP*/
1297         You("are %s, and cannot go down.",
1298             !u.uswallow ? "being held" : is_animal(u.ustuck->data)
1299                                              ? "swallowed"
1300                                              : "engulfed");
1301 #else
1302         You("%s\8d~\82è\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
1303             !u.uswallow ? "\82Â\82©\82Ü\82¦\82ç\82ê\82Ä\82¢\82Ä" : is_animal(u.ustuck->data)
1304                                              ? "\88ù\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82Ä"
1305                                              : "\8aª\82«\8d\9e\82Ü\82ê\82Ä\82¢\82Ä");
1306 #endif
1307         return 1;
1308     }
1309     if (on_level(&valley_level, &u.uz) && !u.uevent.gehennom_entered) {
1310 /*JP
1311         You("are standing at the gate to Gehennom.");
1312 */
1313         You("\83Q\83w\83i\82Ì\96å\82Ì\91O\82É\97§\82Á\82Ä\82¢\82é\81D");
1314 /*JP
1315         pline("Unspeakable cruelty and harm lurk down there.");
1316 */
1317         pline("\8c¾\97t\82É\82·\82ç\82Å\82«\82È\82¢\8ec\8bs\82Æ\8eS\8e\96\82ª\82±\82Ì\89º\82É\90ö\82ñ\82Å\82¢\82é\81D");
1318 /*JP
1319         if (yn("Are you sure you want to enter?") != 'y')
1320 */
1321         if (yn("\96{\93\96\82É\93ü\82è\82Ü\82·\82©\81H") != 'y')
1322             return 0;
1323         else
1324 /*JP
1325             pline("So be it.");
1326 */
1327             pline("\82È\82ç\8dD\82«\82É\82·\82ê\82Î\82æ\82¢\81D");
1328         u.uevent.gehennom_entered = 1; /* don't ask again */
1329     }
1330
1331     if (!next_to_u()) {
1332 /*JP
1333         You("are held back by your pet!");
1334 */
1335         You("\83y\83b\83g\82É\88ø\82«\82à\82Ç\82³\82ê\82½\81I");
1336         return 0;
1337     }
1338
1339     if (trap) {
1340         const char *down_or_thru = trap->ttyp == HOLE ? "down" : "through";
1341 #if 0 /*JP*/
1342         const char *actn = Flying ? "fly" : locomotion(youmonst.data, "jump");
1343 #else
1344         const char *actn = "";
1345 #endif
1346
1347         if (youmonst.data->msize >= MZ_HUGE) {
1348             char qbuf[QBUFSZ];
1349
1350 #if 0 /*JP*/
1351             You("don't fit %s easily.", down_or_thru);
1352             Sprintf(qbuf, "Try to squeeze %s?", down_or_thru);
1353 #else
1354             pline("\82±\82±\82Í\8b·\82­\82Ä\8aÈ\92P\82É\82Í\92Ê\82è\94²\82¯\82ç\82ê\82È\82¢\81D");
1355             Sprintf(qbuf, "\91Ì\82ð\89\9f\82µ\8d\9e\82Ý\82Ü\82·\82©?");
1356 #endif
1357             if (yn(qbuf) == 'y') {
1358                 if (!rn2(3)) {
1359 #if 0 /*JP*/
1360                     actn = "manage to squeeze";
1361 #else
1362                     actn = "\82È\82ñ\82Æ\82©";
1363 #endif
1364 #if 0 /*JP*/
1365                     losehp(Maybe_Half_Phys(rnd(4)),
1366                            "contusion from a small passage", KILLED_BY);
1367 #else
1368                     losehp(Maybe_Half_Phys(rnd(4)),
1369                            "\8b·\82¢\93¹\82Å\82Ì\91Å\82¿\90g\82Å", KILLED_BY);
1370 #endif
1371                 } else {
1372 /*JP
1373                     You("were unable to fit %s.", down_or_thru);
1374 */
1375                     You("\92Ê\82è\94²\82¯\82ç\82ê\82È\82¢\81D");
1376                     return 0;
1377                 }
1378             } else {
1379                 return 0;
1380             }
1381         }
1382 #if 0 /*JP*/
1383         You("%s %s the %s.", actn, down_or_thru,
1384             trap->ttyp == HOLE ? "hole" : "trap door");
1385 #else
1386         You("%s%s\81D", actn,
1387             trap->ttyp == HOLE ? "\8c\8a\82ð\8d~\82è\82½" : "\97\8e\82µ\94à\82ð\92Ê\82è\94²\82¯\82½");
1388 #endif
1389     }
1390     if (trap && Is_stronghold(&u.uz)) {
1391         goto_hell(FALSE, TRUE);
1392     } else {
1393         at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
1394         next_level(!trap);
1395         at_ladder = FALSE;
1396     }
1397     return 1;
1398 }
1399
1400 /* the '<' command */
1401 int
1402 doup()
1403 {
1404     if (u_rooted())
1405         return 1;
1406
1407     /* "up" to get out of a pit... */
1408     if (u.utrap && u.utraptype == TT_PIT) {
1409         climb_pit();
1410         return 1;
1411     }
1412
1413     if ((u.ux != xupstair || u.uy != yupstair)
1414         && (!xupladder || u.ux != xupladder || u.uy != yupladder)
1415         && (!sstairs.sx || u.ux != sstairs.sx || u.uy != sstairs.sy
1416             || !sstairs.up)) {
1417 /*JP
1418         You_cant("go up here.");
1419 */
1420         You("\82±\82±\82Å\82Í\8fã\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D");
1421         return 0;
1422     }
1423     if (stucksteed(TRUE)) {
1424         return 0;
1425     }
1426     if (u.ustuck) {
1427 #if 0 /*JP*/
1428         You("are %s, and cannot go up.",
1429             !u.uswallow ? "being held" : is_animal(u.ustuck->data)
1430                                              ? "swallowed"
1431                                              : "engulfed");
1432 #else
1433         You("%s\8fã\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
1434             !u.uswallow ? "\82Â\82©\82Ü\82¦\82ç\82ê\82Ä\82¢\82Ä" : is_animal(u.ustuck->data)
1435                                                      ? "\88ù\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82Ä"
1436                                                      : "\8aª\82«\8d\9e\82Ü\82ê\82Ä\82¢\82Ä");
1437 #endif
1438         return 1;
1439     }
1440     if (near_capacity() > SLT_ENCUMBER) {
1441         /* No levitation check; inv_weight() already allows for it */
1442 #if 0 /*JP*/
1443         Your("load is too heavy to climb the %s.",
1444              levl[u.ux][u.uy].typ == STAIRS ? "stairs" : "ladder");
1445 #else
1446         You("\95¨\82ð\8e\9d\82¿\82·\82¬\82Ä%s\82ð\8fã\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81D",
1447             levl[u.ux][u.uy].typ == STAIRS ? "\8aK\92i" : "\82Í\82µ\82²");
1448 #endif
1449         return 1;
1450     }
1451     if (ledger_no(&u.uz) == 1) {
1452         if (iflags.debug_fuzzer)
1453             return 0;
1454 /*JP
1455         if (yn("Beware, there will be no return!  Still climb?") != 'y')
1456 */
1457         if (yn("\8bC\82ð\82Â\82¯\82ë\81C\96ß\82ê\82È\82¢\82¼\81I\82»\82ê\82Å\82à\8fã\82é\81H") != 'y')
1458             return 0;
1459     }
1460     if (!next_to_u()) {
1461 /*JP
1462         You("are held back by your pet!");
1463 */
1464         You("\83y\83b\83g\82É\88ø\82«\82à\82Ç\82³\82ê\82½\81I");
1465         return 0;
1466     }
1467     at_ladder = (boolean) (levl[u.ux][u.uy].typ == LADDER);
1468     prev_level(TRUE);
1469     at_ladder = FALSE;
1470     return 1;
1471 }
1472
1473 d_level save_dlevel = { 0, 0 };
1474
1475 /* check that we can write out the current level */
1476 STATIC_OVL int
1477 currentlevel_rewrite()
1478 {
1479     register int fd;
1480     char whynot[BUFSZ];
1481
1482     /* since level change might be a bit slow, flush any buffered screen
1483      *  output (like "you fall through a trap door") */
1484     mark_synch();
1485
1486     fd = create_levelfile(ledger_no(&u.uz), whynot);
1487     if (fd < 0) {
1488         /*
1489          * This is not quite impossible: e.g., we may have
1490          * exceeded our quota. If that is the case then we
1491          * cannot leave this level, and cannot save either.
1492          * Another possibility is that the directory was not
1493          * writable.
1494          */
1495         pline1(whynot);
1496         return -1;
1497     }
1498
1499 #ifdef MFLOPPY
1500     if (!savelev(fd, ledger_no(&u.uz), COUNT_SAVE)) {
1501         (void) nhclose(fd);
1502         delete_levelfile(ledger_no(&u.uz));
1503 /*JP
1504         pline("NetHack is out of disk space for making levels!");
1505 */
1506         pline("\90V\82µ\82¢\83\8c\83x\83\8b\82ð\8dì\82é\82½\82ß\82Ì\83f\83B\83X\83N\97e\97Ê\82ª\91«\82è\82È\82¢\81I");
1507 /*JP
1508         You("can save, quit, or continue playing.");
1509 */
1510         You("\83Z\81[\83u\82·\82é\82©\8fI\97¹\82·\82é\82©\81C\82 \82é\82¢\82Í\83v\83\8c\83C\82ð\91±\8ds\82Å\82«\82é\81D");
1511         return -1;
1512     }
1513 #endif
1514     return fd;
1515 }
1516
1517 #ifdef INSURANCE
1518 void
1519 save_currentstate()
1520 {
1521     int fd;
1522
1523     if (flags.ins_chkpt) {
1524         /* write out just-attained level, with pets and everything */
1525         fd = currentlevel_rewrite();
1526         if (fd < 0)
1527             return;
1528         bufon(fd);
1529         savelev(fd, ledger_no(&u.uz), WRITE_SAVE);
1530         bclose(fd);
1531     }
1532
1533     /* write out non-level state */
1534     savestateinlock();
1535 }
1536 #endif
1537
1538 /*
1539 static boolean
1540 badspot(x, y)
1541 register xchar x, y;
1542 {
1543     return (boolean) ((levl[x][y].typ != ROOM
1544                        && levl[x][y].typ != AIR
1545                        && levl[x][y].typ != CORR)
1546                       || MON_AT(x, y));
1547 }
1548 */
1549
1550 /* when arriving on a level, if hero and a monster are trying to share same
1551    spot, move one; extracted from goto_level(); also used by wiz_makemap() */
1552 void
1553 u_collide_m(mtmp)
1554 struct monst *mtmp;
1555 {
1556     coord cc;
1557
1558     if (!mtmp || mtmp == u.usteed || mtmp != m_at(u.ux, u.uy)) {
1559         impossible("level arrival collision: %s?",
1560                    !mtmp ? "no monster"
1561                      : (mtmp == u.usteed) ? "steed is on map"
1562                        : "monster not co-located");
1563         return;
1564     }
1565
1566     /* There's a monster at your target destination; it might be one
1567        which accompanied you--see mon_arrive(dogmove.c)--or perhaps
1568        it was already here.  Randomly move you to an adjacent spot
1569        or else the monster to any nearby location.  Prior to 3.3.0
1570        the latter was done unconditionally. */
1571     if (!rn2(2) && enexto(&cc, u.ux, u.uy, youmonst.data)
1572         && distu(cc.x, cc.y) <= 2)
1573         u_on_newpos(cc.x, cc.y); /*[maybe give message here?]*/
1574     else
1575         mnexto(mtmp);
1576
1577     if ((mtmp = m_at(u.ux, u.uy)) != 0) {
1578         /* there was an unconditional impossible("mnexto failed")
1579            here, but it's not impossible and we're prepared to cope
1580            with the situation, so only say something when debugging */
1581         if (wizard)
1582             pline("(monster in hero's way)");
1583         if (!rloc(mtmp, TRUE) || (mtmp = m_at(u.ux, u.uy)) != 0)
1584             /* no room to move it; send it away, to return later */
1585             m_into_limbo(mtmp);
1586     }
1587 }
1588
1589 void
1590 goto_level(newlevel, at_stairs, falling, portal)
1591 d_level *newlevel;
1592 boolean at_stairs, falling, portal;
1593 {
1594     int fd, l_idx;
1595     xchar new_ledger;
1596     boolean cant_go_back, great_effort,
1597             up = (depth(newlevel) < depth(&u.uz)),
1598             newdungeon = (u.uz.dnum != newlevel->dnum),
1599             was_in_W_tower = In_W_tower(u.ux, u.uy, &u.uz),
1600             familiar = FALSE,
1601             new = FALSE; /* made a new level? */
1602     struct monst *mtmp;
1603     char whynot[BUFSZ];
1604     char *annotation;
1605
1606     if (dunlev(newlevel) > dunlevs_in_dungeon(newlevel))
1607         newlevel->dlevel = dunlevs_in_dungeon(newlevel);
1608     if (newdungeon && In_endgame(newlevel)) { /* 1st Endgame Level !!! */
1609         if (!u.uhave.amulet)
1610             return;  /* must have the Amulet */
1611         if (!wizard) /* wizard ^V can bypass Earth level */
1612             assign_level(newlevel, &earth_level); /* (redundant) */
1613     }
1614     new_ledger = ledger_no(newlevel);
1615     if (new_ledger <= 0)
1616         done(ESCAPED); /* in fact < 0 is impossible */
1617
1618     /* If you have the amulet and are trying to get out of Gehennom,
1619      * going up a set of stairs sometimes does some very strange things!
1620      * Biased against law and towards chaos.  (The chance to be sent
1621      * down multiple levels when attempting to go up are significantly
1622      * less than the corresponding comment in older versions indicated
1623      * due to overlooking the effect of the call to assign_rnd_lvl().)
1624      *
1625      * Odds for making it to the next level up, or of being sent down:
1626      *  "up"    L      N      C
1627      *   +1   75.0   75.0   75.0
1628      *    0    6.25   8.33  12.5
1629      *   -1   11.46  12.50  12.5
1630      *   -2    5.21   4.17   0.0
1631      *   -3    2.08   0.0    0.0
1632      */
1633     if (Inhell && up && u.uhave.amulet && !newdungeon && !portal
1634         && (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz) - 3)) {
1635         if (!rn2(4)) {
1636             int odds = 3 + (int) u.ualign.type,   /* 2..4 */
1637                 diff = odds <= 1 ? 0 : rn2(odds); /* paranoia */
1638
1639             if (diff != 0) {
1640                 assign_rnd_level(newlevel, &u.uz, diff);
1641                 /* if inside the tower, stay inside */
1642                 if (was_in_W_tower && !On_W_tower_level(newlevel))
1643                     diff = 0;
1644             }
1645             if (diff == 0)
1646                 assign_level(newlevel, &u.uz);
1647
1648             new_ledger = ledger_no(newlevel);
1649
1650 /*JP
1651             pline("A mysterious force momentarily surrounds you...");
1652 */
1653             pline("\88ê\8fu\8aï\96­\82È\97Í\82ª\82 \82È\82½\82ð\95ï\82ñ\82¾\81D\81D\81D");
1654             if (on_level(newlevel, &u.uz)) {
1655                 (void) safe_teleds(FALSE);
1656                 (void) next_to_u();
1657                 return;
1658             } else
1659                 at_stairs = at_ladder = FALSE;
1660         }
1661     }
1662
1663     /* Prevent the player from going past the first quest level unless
1664      * (s)he has been given the go-ahead by the leader.
1665      */
1666     if (on_level(&u.uz, &qstart_level) && !newdungeon && !ok_to_quest()) {
1667 /*JP
1668         pline("A mysterious force prevents you from descending.");
1669 */
1670         pline("\8aï\96­\82È\97Í\82ª\82 \82È\82½\82ª\8d~\82è\82é\82Ì\82ð\96W\82°\82½\81D");
1671         return;
1672     }
1673
1674     if (on_level(newlevel, &u.uz))
1675         return; /* this can happen */
1676
1677     /* tethered movement makes level change while trapped feasible */
1678     if (u.utrap && u.utraptype == TT_BURIEDBALL)
1679         buried_ball_to_punishment(); /* (before we save/leave old level) */
1680
1681     fd = currentlevel_rewrite();
1682     if (fd < 0)
1683         return;
1684
1685     /* discard context which applies to the level we're leaving;
1686        for lock-picking, container may be carried, in which case we
1687        keep context; if on the floor, it's about to be saved+freed and
1688        maybe_reset_pick() needs to do its carried() check before that */
1689     maybe_reset_pick((struct obj *) 0);
1690     reset_trapset(); /* even if to-be-armed trap obj is accompanying hero */
1691     iflags.travelcc.x = iflags.travelcc.y = 0; /* travel destination cache */
1692     context.polearm.hitmon = (struct monst *) 0; /* polearm target */
1693     /* digging context is level-aware and can actually be resumed if
1694        hero returns to the previous level without any intervening dig */
1695
1696     if (falling) /* assuming this is only trap door or hole */
1697         impact_drop((struct obj *) 0, u.ux, u.uy, newlevel->dlevel);
1698
1699     check_special_room(TRUE); /* probably was a trap door */
1700     if (Punished)
1701         unplacebc();
1702     reset_utrap(FALSE); /* needed in level_tele */
1703     fill_pit(u.ux, u.uy);
1704     u.ustuck = 0; /* idem */
1705     u.uinwater = 0;
1706     u.uundetected = 0; /* not hidden, even if means are available */
1707     keepdogs(FALSE);
1708     if (u.uswallow) /* idem */
1709         u.uswldtim = u.uswallow = 0;
1710     recalc_mapseen(); /* recalculate map overview before we leave the level */
1711     /*
1712      *  We no longer see anything on the level.  Make sure that this
1713      *  follows u.uswallow set to null since uswallow overrides all
1714      *  normal vision.
1715      */
1716     vision_recalc(2);
1717
1718     /*
1719      * Save the level we're leaving.  If we're entering the endgame,
1720      * we can get rid of all existing levels because they cannot be
1721      * reached any more.  We still need to use savelev()'s cleanup
1722      * for the level being left, to recover dynamic memory in use and
1723      * to avoid dangling timers and light sources.
1724      */
1725     cant_go_back = (newdungeon && In_endgame(newlevel));
1726     if (!cant_go_back) {
1727         update_mlstmv(); /* current monsters are becoming inactive */
1728         bufon(fd);       /* use buffered output */
1729     }
1730     savelev(fd, ledger_no(&u.uz),
1731             cant_go_back ? FREE_SAVE : (WRITE_SAVE | FREE_SAVE));
1732     bclose(fd);
1733     if (cant_go_back) {
1734         /* discard unreachable levels; keep #0 */
1735         for (l_idx = maxledgerno(); l_idx > 0; --l_idx)
1736             delete_levelfile(l_idx);
1737         /* mark #overview data for all dungeon branches as uninteresting */
1738         for (l_idx = 0; l_idx < n_dgns; ++l_idx)
1739             remdun_mapseen(l_idx);
1740     }
1741
1742     if (Is_rogue_level(newlevel) || Is_rogue_level(&u.uz))
1743         assign_graphics(Is_rogue_level(newlevel) ? ROGUESET : PRIMARY);
1744 #ifdef USE_TILES
1745     substitute_tiles(newlevel);
1746 #endif
1747     check_gold_symbol();
1748     /* record this level transition as a potential seen branch unless using
1749      * some non-standard means of transportation (level teleport).
1750      */
1751     if ((at_stairs || falling || portal) && (u.uz.dnum != newlevel->dnum))
1752         recbranch_mapseen(&u.uz, newlevel);
1753     assign_level(&u.uz0, &u.uz);
1754     assign_level(&u.uz, newlevel);
1755     assign_level(&u.utolev, newlevel);
1756     u.utotype = 0;
1757     if (!builds_up(&u.uz)) { /* usual case */
1758         if (dunlev(&u.uz) > dunlev_reached(&u.uz))
1759             dunlev_reached(&u.uz) = dunlev(&u.uz);
1760     } else {
1761         if (dunlev_reached(&u.uz) == 0
1762             || dunlev(&u.uz) < dunlev_reached(&u.uz))
1763             dunlev_reached(&u.uz) = dunlev(&u.uz);
1764     }
1765     reset_rndmonst(NON_PM); /* u.uz change affects monster generation */
1766
1767     /* set default level change destination areas */
1768     /* the special level code may override these */
1769     (void) memset((genericptr_t) &updest, 0, sizeof updest);
1770     (void) memset((genericptr_t) &dndest, 0, sizeof dndest);
1771
1772     if (!(level_info[new_ledger].flags & LFILE_EXISTS)) {
1773         /* entering this level for first time; make it now */
1774         if (level_info[new_ledger].flags & (FORGOTTEN | VISITED)) {
1775             impossible("goto_level: returning to discarded level?");
1776             level_info[new_ledger].flags &= ~(FORGOTTEN | VISITED);
1777         }
1778         mklev();
1779         new = TRUE; /* made the level */
1780     } else {
1781         /* returning to previously visited level; reload it */
1782         fd = open_levelfile(new_ledger, whynot);
1783         if (tricked_fileremoved(fd, whynot)) {
1784             /* we'll reach here if running in wizard mode */
1785             error("Cannot continue this game.");
1786         }
1787         reseed_random(rn2);
1788         reseed_random(rn2_on_display_rng);
1789         minit(); /* ZEROCOMP */
1790         getlev(fd, hackpid, new_ledger, FALSE);
1791         (void) nhclose(fd);
1792         oinit(); /* reassign level dependent obj probabilities */
1793     }
1794     reglyph_darkroom();
1795     /* do this prior to level-change pline messages */
1796     vision_reset();         /* clear old level's line-of-sight */
1797     vision_full_recalc = 0; /* don't let that reenable vision yet */
1798     flush_screen(-1);       /* ensure all map flushes are postponed */
1799
1800     if (portal && !In_endgame(&u.uz)) {
1801         /* find the portal on the new level */
1802         register struct trap *ttrap;
1803
1804         for (ttrap = ftrap; ttrap; ttrap = ttrap->ntrap)
1805             if (ttrap->ttyp == MAGIC_PORTAL)
1806                 break;
1807
1808         if (!ttrap)
1809             panic("goto_level: no corresponding portal!");
1810         seetrap(ttrap);
1811         u_on_newpos(ttrap->tx, ttrap->ty);
1812     } else if (at_stairs && !In_endgame(&u.uz)) {
1813         if (up) {
1814             if (at_ladder)
1815                 u_on_newpos(xdnladder, ydnladder);
1816             else if (newdungeon)
1817                 u_on_sstairs(1);
1818             else
1819                 u_on_dnstairs();
1820             /* you climb up the {stairs|ladder};
1821                fly up the stairs; fly up along the ladder */
1822             great_effort = (Punished && !Levitation);
1823             if (flags.verbose || great_effort)
1824 #if 0 /*JP*/
1825                 pline("%s %s up%s the %s.",
1826                       great_effort ? "With great effort, you" : "You",
1827                       Levitation ? "float" : Flying ? "fly" : "climb",
1828                       (Flying && at_ladder) ? " along" : "",
1829                       at_ladder ? "ladder" : "stairs");
1830 #else /* \94ò\82ñ\82¾\82è\82µ\82Ä\82¢\82Ä\82à\81u\8fã\82Á\82½\81v */
1831                 pline("%s%s\82ð\8fã\82Á\82½\81D",
1832                       great_effort ? "\82â\82Á\82Æ\82±\82³" : "",
1833                       at_ladder ? "\82Í\82µ\82²" : "\8aK\92i");
1834 #endif
1835         } else { /* down */
1836             if (at_ladder)
1837                 u_on_newpos(xupladder, yupladder);
1838             else if (newdungeon)
1839                 u_on_sstairs(0);
1840             else
1841                 u_on_upstairs();
1842             if (!u.dz) {
1843                 ; /* stayed on same level? (no transit effects) */
1844             } else if (Flying) {
1845                 if (flags.verbose)
1846 #if 0 /*JP:T*/
1847                     You("fly down %s.",
1848                         at_ladder ? "along the ladder" : "the stairs");
1849 #else
1850                     You("%s\94ò\82ñ\82Å\8d~\82è\82½\81D",
1851                         at_ladder ? "\82Í\82µ\82²\82É\89\88\82Á\82Ä" : "\8aK\92i\82ð");
1852 #endif
1853             } else if (near_capacity() > UNENCUMBERED
1854                        || Punished || Fumbling) {
1855 /*JP
1856                 You("fall down the %s.", at_ladder ? "ladder" : "stairs");
1857 */
1858                 You("%s\82ð\93]\82°\97\8e\82¿\82½\81D", at_ladder ? "\82Í\82µ\82²" : "\8aK\92i");
1859                 if (Punished) {
1860                     drag_down();
1861                     ballrelease(FALSE);
1862                 }
1863                 /* falling off steed has its own losehp() call */
1864                 if (u.usteed)
1865                     dismount_steed(DISMOUNT_FELL);
1866                 else
1867                     losehp(Maybe_Half_Phys(rnd(3)),
1868 /*JP
1869                            at_ladder ? "falling off a ladder"
1870 */
1871                            at_ladder ? "\82Í\82µ\82²\82©\82ç\97\8e\82¿\82Ä"
1872 /*JP
1873                                      : "tumbling down a flight of stairs",
1874 */
1875                                      : "\8aK\92i\82ð\93]\82°\97\8e\82¿\82Ä",
1876                            KILLED_BY);
1877 /*JP
1878                 selftouch("Falling, you");
1879 */
1880                 selftouch("\97\8e\82¿\82È\82ª\82ç\81C\82 \82È\82½\82Í");
1881             } else { /* ordinary descent */
1882                 if (flags.verbose)
1883 #if 0 /*JP*/
1884                     You("%s.", at_ladder ? "climb down the ladder"
1885                                          : "descend the stairs");
1886 #else
1887                     You("%s\82ð\8d~\82è\82½\81D", at_ladder ? "\82Í\82µ\82²"
1888                                                   : "\8aK\92i");
1889 #endif
1890             }
1891         }
1892     } else { /* trap door or level_tele or In_endgame */
1893         u_on_rndspot((up ? 1 : 0) | (was_in_W_tower ? 2 : 0));
1894         if (falling) {
1895             if (Punished)
1896                 ballfall();
1897 /*JP
1898             selftouch("Falling, you");
1899 */
1900             selftouch("\97\8e\82¿\82È\82ª\82ç\81C\82 \82È\82½\82Í");
1901         }
1902     }
1903
1904     if (Punished)
1905         placebc();
1906     obj_delivery(FALSE);
1907     losedogs();
1908     kill_genocided_monsters(); /* for those wiped out while in limbo */
1909     /*
1910      * Expire all timers that have gone off while away.  Must be
1911      * after migrating monsters and objects are delivered
1912      * (losedogs and obj_delivery).
1913      */
1914     run_timers();
1915
1916     /* hero might be arriving at a spot containing a monster;
1917        if so, move one or the other to another location */
1918     if ((mtmp = m_at(u.ux, u.uy)) != 0)
1919         u_collide_m(mtmp);
1920
1921     initrack();
1922
1923     /* initial movement of bubbles just before vision_recalc */
1924     if (Is_waterlevel(&u.uz) || Is_airlevel(&u.uz))
1925         movebubbles();
1926     else if (Is_firelevel(&u.uz))
1927         fumaroles();
1928
1929     if (level_info[new_ledger].flags & FORGOTTEN) {
1930         forget_map(ALL_MAP); /* forget the map */
1931         forget_traps();      /* forget all traps too */
1932         familiar = TRUE;
1933         level_info[new_ledger].flags &= ~FORGOTTEN;
1934     }
1935
1936     /* Reset the screen. */
1937     vision_reset(); /* reset the blockages */
1938     docrt();        /* does a full vision recalc */
1939     flush_screen(-1);
1940
1941     /*
1942      *  Move all plines beyond the screen reset.
1943      */
1944
1945     /* special levels can have a custom arrival message */
1946     deliver_splev_message();
1947
1948     /* give room entrance message, if any */
1949     check_special_room(FALSE);
1950
1951     /* deliver objects traveling with player */
1952     obj_delivery(TRUE);
1953
1954     /* Check whether we just entered Gehennom. */
1955     if (!In_hell(&u.uz0) && Inhell) {
1956         if (Is_valley(&u.uz)) {
1957 /*JP
1958             You("arrive at the Valley of the Dead...");
1959 */
1960             You("\8e\80\82Ì\92J\82É\93\9e\92B\82µ\82½\81D\81D\81D");
1961 /*JP
1962             pline_The("odor of burnt flesh and decay pervades the air.");
1963 */
1964             pline("\8fÅ\82°\82é\8e\80\93÷\82â\95\85\93÷\82Ì\88«\8fL\82ª\82½\82¾\82æ\82Á\82Ä\82¢\82é\81D");
1965 #ifdef MICRO
1966             display_nhwindow(WIN_MESSAGE, FALSE);
1967 #endif
1968 /*JP
1969             You_hear("groans and moans everywhere.");
1970 */
1971             You_hear("\82»\82±\82©\82µ\82±\82©\82ç\82Ì\82¤\82ß\82«\90º\82â\82¤\82È\82è\90º\82ð\95·\82¢\82½\81D");
1972         } else
1973 /*JP
1974             pline("It is hot here.  You smell smoke...");
1975 */
1976             pline("\82±\82±\82Í\8f\8b\82¢\81D\89\8c\82Ì\93õ\82¢\82ª\82·\82é\81D\81D\81D");
1977         u.uachieve.enter_gehennom = 1;
1978     }
1979     /* in case we've managed to bypass the Valley's stairway down */
1980     if (Inhell && !Is_valley(&u.uz))
1981         u.uevent.gehennom_entered = 1;
1982
1983     if (familiar) {
1984         static const char *const fam_msgs[4] = {
1985 /*JP
1986             "You have a sense of deja vu.",
1987 */
1988             "\8aù\8e\8b\8a´\82É\82¨\82»\82í\82ê\82½\81D",
1989 /*JP
1990             "You feel like you've been here before.",
1991 */
1992             "\91O\82É\82±\82±\82É\97\88\82½\82±\82Æ\82ª\82 \82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81D",
1993 #if 0 /*JP*/
1994             "This place %s familiar...", 0 /* no message */
1995 #else
1996             "\82±\82Ì\8fê\8f\8a\82Í\89ù\82©\82µ\82¢\81D\81D\81D", 0 /* no message */
1997 #endif
1998         };
1999         static const char *const halu_fam_msgs[4] = {
2000 /*JP
2001             "Whoa!  Everything %s different.",
2002 */
2003             "\83I\83\8f\83b\81I\82Ü\82Á\82½\82­\95Ï\82í\82Á\82¿\82Ü\82Á\82Ä\82é\81D",
2004 /*JP
2005             "You are surrounded by twisty little passages, all alike.",
2006 */
2007             "\82 \82È\82½\82Í\82Ü\82ª\82è\82­\82Ë\82Á\82½\92Ê\98H\82É\82©\82±\82Ü\82ê\82Ä\82¢\82½\81D\81D\81D",
2008 #if 0 /*JP*/
2009             "Gee, this %s like uncle Conan's place...", 0 /* no message */
2010 #else
2011             "\83Q\81[\81I\83R\83i\83\93\82¨\82\82³\82ñ\82Ì\8fê\8f\8a\82É\8e\97\82Ä\82¢\82é\81D\81D\81D", 0 /* no message */
2012 #endif
2013         };
2014         const char *mesg;
2015 #if 0 /*JP*/
2016         char buf[BUFSZ];
2017 #endif
2018         int which = rn2(4);
2019
2020         if (Hallucination)
2021             mesg = halu_fam_msgs[which];
2022         else
2023             mesg = fam_msgs[which];
2024 #if 0 /*JP:\93ú\96{\8cê\82Å\82Í\82»\82±\82Ü\82Å\82µ\82È\82¢*/
2025         if (mesg && index(mesg, '%')) {
2026             Sprintf(buf, mesg, !Blind ? "looks" : "seems");
2027             mesg = buf;
2028         }
2029 #endif
2030         if (mesg)
2031             pline1(mesg);
2032     }
2033
2034     /* special location arrival messages/events */
2035     if (In_endgame(&u.uz)) {
2036         if (new &&on_level(&u.uz, &astral_level))
2037             final_level(); /* guardian angel,&c */
2038         else if (newdungeon && u.uhave.amulet)
2039             resurrect(); /* force confrontation with Wizard */
2040     } else if (In_quest(&u.uz)) {
2041         onquest(); /* might be reaching locate|goal level */
2042     } else if (In_V_tower(&u.uz)) {
2043         if (newdungeon && In_hell(&u.uz0))
2044 /*JP
2045             pline_The("heat and smoke are gone.");
2046 */
2047             pline("\94M\82Æ\89\8c\82è\82Í\8fÁ\82¦\82³\82Á\82½\81D");
2048     } else if (Is_knox(&u.uz)) {
2049         /* alarm stops working once Croesus has died */
2050         if (new || !mvitals[PM_CROESUS].died) {
2051 /*JP
2052             You("have penetrated a high security area!");
2053 */
2054             You("\8dÅ\8d\82\8b@\96§\82Ì\8fê\8f\8a\82Ö\93¥\82Ý\8d\9e\82ñ\82¾\81I");
2055 /*JP
2056             pline("An alarm sounds!");
2057 */
2058             pline("\8cx\95ñ\82ª\82È\82Á\82½\81I");
2059             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
2060                 if (DEADMONSTER(mtmp))
2061                     continue;
2062                 mtmp->msleeping = 0;
2063             }
2064         }
2065     } else {
2066         if (new && Is_rogue_level(&u.uz))
2067 /*JP
2068             You("enter what seems to be an older, more primitive world.");
2069 */
2070             You("\8cÃ\82­\82³\82­\81C\82¸\82¢\82Ô\82ñ\92P\8f\83\82È\90¢\8aE\82É\8c©\82¦\82é\95\94\89®\82É\93ü\82Á\82½\81D");
2071         /* main dungeon message from your quest leader */
2072 /*JP
2073         if (!In_quest(&u.uz0) && at_dgn_entrance("The Quest")
2074 */
2075         if (!In_quest(&u.uz0) && at_dgn_entrance("\83N\83G\83X\83g")
2076             && !(u.uevent.qcompleted || u.uevent.qexpelled
2077                  || quest_status.leader_is_dead)) {
2078             if (!u.uevent.qcalled) {
2079                 u.uevent.qcalled = 1;
2080                 com_pager(2); /* main "leader needs help" message */
2081             } else {          /* reminder message */
2082                 com_pager(Role_if(PM_ROGUE) ? 4 : 3);
2083             }
2084         }
2085     }
2086
2087     assign_level(&u.uz0, &u.uz); /* reset u.uz0 */
2088 #ifdef INSURANCE
2089     save_currentstate();
2090 #endif
2091
2092     if ((annotation = get_annotation(&u.uz)) != 0)
2093 /*JP
2094         You("remember this level as %s.", annotation);
2095 */
2096         You("\82±\82Ì\8aK\82ª%s\82Å\82 \82é\82±\82Æ\82ð\8ev\82¢\8fo\82µ\82½\81D", annotation);
2097
2098     /* assume this will always return TRUE when changing level */
2099     (void) in_out_region(u.ux, u.uy);
2100     (void) pickup(1);
2101 }
2102
2103 STATIC_OVL void
2104 final_level()
2105 {
2106     struct monst *mtmp;
2107
2108     /* reset monster hostility relative to player */
2109     for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
2110         if (DEADMONSTER(mtmp))
2111             continue;
2112         reset_hostility(mtmp);
2113     }
2114
2115     /* create some player-monsters */
2116     create_mplayers(rn1(4, 3), TRUE);
2117
2118     /* create a guardian angel next to player, if worthy */
2119     gain_guardian_angel();
2120 }
2121
2122 static char *dfr_pre_msg = 0,  /* pline() before level change */
2123             *dfr_post_msg = 0; /* pline() after level change */
2124
2125 /* change levels at the end of this turn, after monsters finish moving */
2126 void
2127 schedule_goto(tolev, at_stairs, falling, portal_flag, pre_msg, post_msg)
2128 d_level *tolev;
2129 boolean at_stairs, falling;
2130 int portal_flag;
2131 const char *pre_msg, *post_msg;
2132 {
2133     int typmask = 0100; /* non-zero triggers `deferred_goto' */
2134
2135     /* destination flags (`goto_level' args) */
2136     if (at_stairs)
2137         typmask |= 1;
2138     if (falling)
2139         typmask |= 2;
2140     if (portal_flag)
2141         typmask |= 4;
2142     if (portal_flag < 0)
2143         typmask |= 0200; /* flag for portal removal */
2144     u.utotype = typmask;
2145     /* destination level */
2146     assign_level(&u.utolev, tolev);
2147
2148     if (pre_msg)
2149         dfr_pre_msg = dupstr(pre_msg);
2150     if (post_msg)
2151         dfr_post_msg = dupstr(post_msg);
2152 }
2153
2154 /* handle something like portal ejection */
2155 void
2156 deferred_goto()
2157 {
2158     if (!on_level(&u.uz, &u.utolev)) {
2159         d_level dest;
2160         int typmask = u.utotype; /* save it; goto_level zeroes u.utotype */
2161
2162         assign_level(&dest, &u.utolev);
2163         if (dfr_pre_msg)
2164             pline1(dfr_pre_msg);
2165         goto_level(&dest, !!(typmask & 1), !!(typmask & 2), !!(typmask & 4));
2166         if (typmask & 0200) { /* remove portal */
2167             struct trap *t = t_at(u.ux, u.uy);
2168
2169             if (t) {
2170                 deltrap(t);
2171                 newsym(u.ux, u.uy);
2172             }
2173         }
2174         if (dfr_post_msg)
2175             pline1(dfr_post_msg);
2176     }
2177     u.utotype = 0; /* our caller keys off of this */
2178     if (dfr_pre_msg)
2179         free((genericptr_t) dfr_pre_msg), dfr_pre_msg = 0;
2180     if (dfr_post_msg)
2181         free((genericptr_t) dfr_post_msg), dfr_post_msg = 0;
2182 }
2183
2184 /*
2185  * Return TRUE if we created a monster for the corpse.  If successful, the
2186  * corpse is gone.
2187  */
2188 boolean
2189 revive_corpse(corpse)
2190 struct obj *corpse;
2191 {
2192     struct monst *mtmp, *mcarry;
2193     boolean is_uwep, chewed;
2194     xchar where;
2195     char cname[BUFSZ];
2196     struct obj *container = (struct obj *) 0;
2197     int container_where = 0;
2198
2199     where = corpse->where;
2200     is_uwep = (corpse == uwep);
2201     chewed = (corpse->oeaten != 0);
2202 #if 0 /*JP*/
2203     Strcpy(cname, corpse_xname(corpse,
2204                                chewed ? "bite-covered" : (const char *) 0,
2205                                CXN_SINGULAR));
2206 #else
2207     Strcpy(cname, corpse_xname(corpse,
2208                                chewed ? "\8e\95\8c^\82Ì\82Â\82¢\82½" : (const char *) 0,
2209                                CXN_SINGULAR));
2210 #endif
2211     mcarry = (where == OBJ_MINVENT) ? corpse->ocarry : 0;
2212
2213     if (where == OBJ_CONTAINED) {
2214         struct monst *mtmp2;
2215
2216         container = corpse->ocontainer;
2217         mtmp2 = get_container_location(container, &container_where, (int *) 0);
2218         /* container_where is the outermost container's location even if
2219          * nested */
2220         if (container_where == OBJ_MINVENT && mtmp2)
2221             mcarry = mtmp2;
2222     }
2223     mtmp = revive(corpse, FALSE); /* corpse is gone if successful */
2224
2225     if (mtmp) {
2226         switch (where) {
2227         case OBJ_INVENT:
2228             if (is_uwep)
2229 /*JP
2230                 pline_The("%s writhes out of your grasp!", cname);
2231 */
2232                 pline_The("%s\82Í\82à\82ª\82¢\82½\81I", cname);
2233             else
2234 /*JP
2235                 You_feel("squirming in your backpack!");
2236 */
2237                 pline("\94w\95\89\82¢\91Ü\82Å\89½\82©\82ª\82à\82ª\82¢\82Ä\82¢\82é\82æ\82¤\82È\8bC\82ª\82µ\82½\81I");
2238             break;
2239
2240         case OBJ_FLOOR:
2241             if (cansee(mtmp->mx, mtmp->my))
2242 #if 0 /*JP*/
2243                 pline("%s rises from the dead!",
2244                       chewed ? Adjmonnam(mtmp, "bite-covered")
2245                              : Monnam(mtmp));
2246 #else
2247                 pline("%s\82ª\91h\82Á\82½\81I",
2248                       chewed ? Adjmonnam(mtmp, "\8e\95\8c^\82Ì\82Â\82¢\82½")
2249                              : Monnam(mtmp));
2250 #endif
2251             break;
2252
2253         case OBJ_MINVENT: /* probably a nymph's */
2254             if (cansee(mtmp->mx, mtmp->my)) {
2255                 if (canseemon(mcarry))
2256 #if 0 /*JP*/
2257                     pline("Startled, %s drops %s as it revives!",
2258                           mon_nam(mcarry), an(cname));
2259 #else
2260                     pline("%s\82ª\90\82«\82©\82¦\82Á\82½\82Ì\82É\82Ñ\82Á\82­\82è\82µ\82Ä\81C%s\82Í%s\82ð\97\8e\82µ\82½\81I",
2261                           cname, mon_nam(mcarry), cname);
2262 #endif
2263                 else
2264 #if 0 /*JP*/
2265                     pline("%s suddenly appears!",
2266                           chewed ? Adjmonnam(mtmp, "bite-covered")
2267                                  : Monnam(mtmp));
2268 #else
2269                     pline("%s\82ª\93Ë\91R\8c»\82í\82ê\82½\81I",
2270                           chewed ? Adjmonnam(mtmp, "\8e\95\8c^\82Ì\82Â\82¢\82½")
2271                                  : Monnam(mtmp));
2272 #endif
2273             }
2274             break;
2275         case OBJ_CONTAINED: {
2276             char sackname[BUFSZ];
2277
2278             if (container_where == OBJ_MINVENT && cansee(mtmp->mx, mtmp->my)
2279                 && mcarry && canseemon(mcarry) && container) {
2280 /*JP
2281                 pline("%s writhes out of %s!", Amonnam(mtmp),
2282 */
2283                 pline("%s\82Í%s\82©\82ç\93¦\82ê\82æ\82¤\82Æ\82à\82ª\82¢\82½\81I", Amonnam(mtmp),
2284                       yname(container));
2285             } else if (container_where == OBJ_INVENT && container) {
2286                 Strcpy(sackname, an(xname(container)));
2287 #if 0 /*JP*/
2288                 pline("%s %s out of %s in your pack!",
2289                       Blind ? Something : Amonnam(mtmp),
2290                       locomotion(mtmp->data, "writhes"), sackname);
2291 #else
2292                 pline("%s\82Í\91Ü\82Ì\92\86\82Å%s\82©\82ç\93¦\82ê\82æ\82¤\82Æ\82à\82ª\82¢\82½\81I",
2293                       Blind ? Something : Amonnam(mtmp),
2294                       sackname);
2295 #endif
2296             } else if (container_where == OBJ_FLOOR && container
2297                        && cansee(mtmp->mx, mtmp->my)) {
2298                 Strcpy(sackname, an(xname(container)));
2299 /*JP
2300                 pline("%s escapes from %s!", Amonnam(mtmp), sackname);
2301 */
2302                 pline("%s\82Í%s\82©\82ç\93¦\82ê\82½\81I", Amonnam(mtmp), sackname);
2303             }
2304             break;
2305         }
2306         default:
2307             /* we should be able to handle the other cases... */
2308             impossible("revive_corpse: lost corpse @ %d", where);
2309             break;
2310         }
2311         return TRUE;
2312     }
2313     return FALSE;
2314 }
2315
2316 /* Revive the corpse via a timeout. */
2317 /*ARGSUSED*/
2318 void
2319 revive_mon(arg, timeout)
2320 anything *arg;
2321 long timeout UNUSED;
2322 {
2323     struct obj *body = arg->a_obj;
2324     struct permonst *mptr = &mons[body->corpsenm];
2325     struct monst *mtmp;
2326     xchar x, y;
2327
2328     /* corpse will revive somewhere else if there is a monster in the way;
2329        Riders get a chance to try to bump the obstacle out of their way */
2330     if ((mptr->mflags3 & M3_DISPLACES) != 0 && body->where == OBJ_FLOOR
2331         && get_obj_location(body, &x, &y, 0) && (mtmp = m_at(x, y)) != 0) {
2332         boolean notice_it = canseemon(mtmp); /* before rloc() */
2333         char *monname = Monnam(mtmp);
2334
2335         if (rloc(mtmp, TRUE)) {
2336             if (notice_it && !canseemon(mtmp))
2337 /*JP
2338                 pline("%s vanishes.", monname);
2339 */
2340                 pline("%s\82Í\8fÁ\82¦\82½\81D", monname);
2341             else if (!notice_it && canseemon(mtmp))
2342 #if 0 /*JP*/
2343                 pline("%s appears.", Monnam(mtmp)); /* not pre-rloc monname */
2344 #else
2345                 pline("%s\82ª\8c»\82ê\82½\81D", Monnam(mtmp)); /* not pre-rloc monname */
2346 #endif
2347             else if (notice_it && dist2(mtmp->mx, mtmp->my, x, y) > 2)
2348 #if 0 /*JP*/
2349                 pline("%s teleports.", monname); /* saw it and still see it */
2350 #else
2351                 pline("%s\82Í\8fu\8aÔ\88Ú\93®\82µ\82½\81D", monname); /* saw it and still see it */
2352 #endif
2353         }
2354     }
2355
2356     /* if we succeed, the corpse is gone */
2357     if (!revive_corpse(body)) {
2358         long when;
2359         int action;
2360
2361         if (is_rider(mptr) && rn2(99)) { /* Rider usually tries again */
2362             action = REVIVE_MON;
2363             for (when = 3L; when < 67L; when++)
2364                 if (!rn2(3))
2365                     break;
2366         } else { /* rot this corpse away */
2367 /*JP
2368             You_feel("%sless hassled.", is_rider(mptr) ? "much " : "");
2369 */
2370             You("\94Y\82Ý\8e\96\82ª%s\8c¸\82Á\82½\8bC\82ª\82µ\82½\81D", is_rider(mptr) ? "\82Æ\82Ä\82à" : "");
2371             action = ROT_CORPSE;
2372             when = 250L - (monstermoves - body->age);
2373             if (when < 1L)
2374                 when = 1L;
2375         }
2376         (void) start_timer(when, TIMER_OBJECT, action, arg);
2377     }
2378 }
2379
2380 int
2381 donull()
2382 {
2383     return 1; /* Do nothing, but let other things happen */
2384 }
2385
2386 STATIC_PTR int
2387 wipeoff(VOID_ARGS)
2388 {
2389     if (u.ucreamed < 4)
2390         u.ucreamed = 0;
2391     else
2392         u.ucreamed -= 4;
2393     if (Blinded < 4)
2394         Blinded = 0;
2395     else
2396         Blinded -= 4;
2397     if (!Blinded) {
2398 /*JP
2399         pline("You've got the glop off.");
2400 */
2401         You("%s\82©\82ç\83l\83o\83l\83o\82ª\82Æ\82ê\82½\81D", body_part(FACE));
2402         u.ucreamed = 0;
2403         if (!gulp_blnd_check()) {
2404             Blinded = 1;
2405             make_blinded(0L, TRUE);
2406         }
2407         return 0;
2408     } else if (!u.ucreamed) {
2409 /*JP
2410         Your("%s feels clean now.", body_part(FACE));
2411 */
2412         Your("%s\82Í\82«\82ê\82¢\82É\82È\82Á\82½\81D", body_part(FACE));
2413         return 0;
2414     }
2415     return 1; /* still busy */
2416 }
2417
2418 int
2419 dowipe()
2420 {
2421     if (u.ucreamed) {
2422         static NEARDATA char buf[39];
2423
2424 /*JP
2425         Sprintf(buf, "wiping off your %s", body_part(FACE));
2426 */
2427         Sprintf(buf, "%s\82ð\90@\82¢\82Ä\82¢\82é", body_part(FACE));
2428         set_occupation(wipeoff, buf, 0);
2429         /* Not totally correct; what if they change back after now
2430          * but before they're finished wiping?
2431          */
2432         return 1;
2433     }
2434 /*JP
2435     Your("%s is already clean.", body_part(FACE));
2436 */
2437     Your("%s\82Í\89\98\82ê\82Ä\82¢\82È\82¢\81D", body_part(FACE));
2438     return 1;
2439 }
2440
2441 void
2442 set_wounded_legs(side, timex)
2443 register long side;
2444 register int timex;
2445 {
2446     /* KMH -- STEED
2447      * If you are riding, your steed gets the wounded legs instead.
2448      * You still call this function, but don't lose hp.
2449      * Caller is also responsible for adjusting messages.
2450      */
2451
2452     if (!Wounded_legs) {
2453         ATEMP(A_DEX)--;
2454         context.botl = 1;
2455     }
2456
2457     if (!Wounded_legs || (HWounded_legs & TIMEOUT))
2458         HWounded_legs = timex;
2459     EWounded_legs = side;
2460     (void) encumber_msg();
2461 }
2462
2463 void
2464 heal_legs(how)
2465 int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */
2466 {
2467     if (Wounded_legs) {
2468         if (ATEMP(A_DEX) < 0) {
2469             ATEMP(A_DEX)++;
2470             context.botl = 1;
2471         }
2472
2473         /* when mounted, wounded legs applies to the steed;
2474            during petrification countdown, "your limbs turn to stone"
2475            before the final stages and that calls us (how==2) to cure
2476            wounded legs, but we want to suppress the feel better message */
2477         if (!u.usteed && how != 2) {
2478 #if 0 /*JP*/
2479             const char *legs = body_part(LEG);
2480
2481             if ((EWounded_legs & BOTH_SIDES) == BOTH_SIDES)
2482                 legs = makeplural(legs);
2483             /* this used to say "somewhat better" but that was
2484                misleading since legs are being fully healed */
2485             Your("%s %s better.", legs, vtense(legs, "feel"));
2486 #else
2487             Your("%s\82Í\89ñ\95\9c\82µ\82½\81D", body_part(LEG));
2488 #endif
2489         }
2490
2491         HWounded_legs = EWounded_legs = 0L;
2492
2493         /* Wounded_legs reduces carrying capacity, so we want
2494            an encumbrance check when they're healed.  However,
2495            while dismounting, first steed's legs get healed,
2496            then hero is dropped to floor and a new encumbrance
2497            check is made [in dismount_steed()].  So don't give
2498            encumbrance feedback during the dismount stage
2499            because it could seem to be shown out of order and
2500            it might be immediately contradicted [able to carry
2501            more when steed becomes healthy, then possible floor
2502            feedback, then able to carry less when back on foot]. */
2503         if (how == 0)
2504             (void) encumber_msg();
2505     }
2506 }
2507
2508 /*do.c*/