OSDN Git Service

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