OSDN Git Service

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