OSDN Git Service

add translation
[jnethack/source.git] / src / dokick.c
1 /* NetHack 3.6  dokick.c        $NHDT-Date: 1551920353 2019/03/07 00:59:13 $  $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.131 $ */
2 /* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
3 /* NetHack may be freely redistributed.  See license for details. */
4
5 /* JNetHack Copyright */
6 /* (c) Issei Numata, Naoki Hamada, Shigehiro Miyashita, 1994-2000  */
7 /* For 3.4-, Copyright (c) SHIRAKATA Kentaro, 2002-2019            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 #include "hack.h"
11
12 #define is_bigfoot(x) ((x) == &mons[PM_SASQUATCH])
13 #define martial()                                 \
14     (martial_bonus() || is_bigfoot(youmonst.data) \
15      || (uarmf && uarmf->otyp == KICKING_BOOTS))
16
17 static NEARDATA struct rm *maploc, nowhere;
18 static NEARDATA const char *gate_str;
19
20 /* kickedobj (decl.c) tracks a kicked object until placed or destroyed */
21
22 extern boolean notonhead; /* for long worms */
23
24 STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P));
25 STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *,
26                                               XCHAR_P, XCHAR_P));
27 STATIC_DCL void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P));
28 STATIC_DCL int FDECL(kick_object, (XCHAR_P, XCHAR_P, char *));
29 STATIC_DCL int FDECL(really_kick_object, (XCHAR_P, XCHAR_P));
30 STATIC_DCL char *FDECL(kickstr, (char *, const char *));
31 STATIC_DCL void FDECL(otransit_msg, (struct obj *, BOOLEAN_P, long));
32 STATIC_DCL void FDECL(drop_to, (coord *, SCHAR_P));
33
34 /*JP
35 static const char kick_passes_thru[] = "kick passes harmlessly through";
36 */
37 static const char kick_passes_thru[] = "\8fR\82è\82Í\83_\83\81\81[\83W\82ð\97^\82¦\82¸\82É\82·\82è\94²\82¯\82½";
38
39 /* kicking damage when not poly'd into a form with a kick attack */
40 STATIC_OVL void
41 kickdmg(mon, clumsy)
42 struct monst *mon;
43 boolean clumsy;
44 {
45     int mdx, mdy;
46     int dmg = (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 15;
47     int specialdmg, kick_skill = P_NONE;
48     boolean trapkilled = FALSE;
49
50     if (uarmf && uarmf->otyp == KICKING_BOOTS)
51         dmg += 5;
52
53     /* excessive wt affects dex, so it affects dmg */
54     if (clumsy)
55         dmg /= 2;
56
57     /* kicking a dragon or an elephant will not harm it */
58     if (thick_skinned(mon->data))
59         dmg = 0;
60
61     /* attacking a shade is normally useless */
62     if (mon->data == &mons[PM_SHADE])
63         dmg = 0;
64
65     specialdmg = special_dmgval(&youmonst, mon, W_ARMF, (long *) 0);
66
67     if (mon->data == &mons[PM_SHADE] && !specialdmg) {
68 /*JP
69         pline_The("%s.", kick_passes_thru);
70 */
71         pline_The("%s\81D", kick_passes_thru);
72         /* doesn't exercise skill or abuse alignment or frighten pet,
73            and shades have no passive counterattack */
74         return;
75     }
76
77     if (M_AP_TYPE(mon))
78         seemimic(mon);
79
80     check_caitiff(mon);
81
82     /* squeeze some guilt feelings... */
83     if (mon->mtame) {
84         abuse_dog(mon);
85         if (mon->mtame)
86             monflee(mon, (dmg ? rnd(dmg) : 1), FALSE, FALSE);
87         else
88             mon->mflee = 0;
89     }
90
91     if (dmg > 0) {
92         /* convert potential damage to actual damage */
93         dmg = rnd(dmg);
94         if (martial()) {
95             if (dmg > 1)
96                 kick_skill = P_MARTIAL_ARTS;
97             dmg += rn2(ACURR(A_DEX) / 2 + 1);
98         }
99         /* a good kick exercises your dex */
100         exercise(A_DEX, TRUE);
101     }
102     dmg += specialdmg; /* for blessed (or hypothetically, silver) boots */
103     if (uarmf)
104         dmg += uarmf->spe;
105     dmg += u.udaminc; /* add ring(s) of increase damage */
106     if (dmg > 0)
107         mon->mhp -= dmg;
108     if (!DEADMONSTER(mon) && martial() && !bigmonst(mon->data) && !rn2(3)
109         && mon->mcanmove && mon != u.ustuck && !mon->mtrapped) {
110         /* see if the monster has a place to move into */
111         mdx = mon->mx + u.dx;
112         mdy = mon->my + u.dy;
113         if (goodpos(mdx, mdy, mon, 0)) {
114 /*JP
115             pline("%s reels from the blow.", Monnam(mon));
116 */
117             pline("%s\82Í\8b­\91Å\82³\82ê\82æ\82ë\82ß\82¢\82½\81D", Monnam(mon));
118             if (m_in_out_region(mon, mdx, mdy)) {
119                 remove_monster(mon->mx, mon->my);
120                 newsym(mon->mx, mon->my);
121                 place_monster(mon, mdx, mdy);
122                 newsym(mon->mx, mon->my);
123                 set_apparxy(mon);
124                 if (mintrap(mon) == 2)
125                     trapkilled = TRUE;
126             }
127         }
128     }
129
130     (void) passive(mon, uarmf, TRUE, !DEADMONSTER(mon), AT_KICK, FALSE);
131     if (DEADMONSTER(mon) && !trapkilled)
132         killed(mon);
133
134     /* may bring up a dialog, so put this after all messages */
135     if (kick_skill != P_NONE) /* exercise proficiency */
136         use_skill(kick_skill, 1);
137 }
138
139 STATIC_OVL boolean
140 maybe_kick_monster(mon, x, y)
141 struct monst *mon;
142 xchar x, y;
143 {
144     if (mon) {
145         boolean save_forcefight = context.forcefight;
146
147         bhitpos.x = x;
148         bhitpos.y = y;
149         if (!mon->mpeaceful || !canspotmon(mon))
150             context.forcefight = TRUE; /* attack even if invisible */
151         /* kicking might be halted by discovery of hidden monster,
152            by player declining to attack peaceful monster,
153            or by passing out due to encumbrance */
154         if (attack_checks(mon, (struct obj *) 0) || overexertion())
155             mon = 0; /* don't kick after all */
156         context.forcefight = save_forcefight;
157     }
158     return (boolean) (mon != 0);
159 }
160
161 STATIC_OVL void
162 kick_monster(mon, x, y)
163 struct monst *mon;
164 xchar x, y;
165 {
166     boolean clumsy = FALSE;
167     int i, j;
168
169     /* anger target even if wild miss will occur */
170     setmangry(mon, TRUE);
171
172     if (Levitation && !rn2(3) && verysmall(mon->data)
173         && !is_flyer(mon->data)) {
174 /*JP
175         pline("Floating in the air, you miss wildly!");
176 */
177         pline("\8bó\92\86\82É\95\82\82¢\82Ä\82¢\82é\82Ì\82Å\81C\91å\82«\82­\8aO\82µ\82½\81I");
178         exercise(A_DEX, FALSE);
179         (void) passive(mon, uarmf, FALSE, 1, AT_KICK, FALSE);
180         return;
181     }
182
183     /* reveal hidden target even if kick ends up missing (note: being
184        hidden doesn't affect chance to hit so neither does this reveal) */
185     if (mon->mundetected
186         || (M_AP_TYPE(mon) && M_AP_TYPE(mon) != M_AP_MONSTER)) {
187         if (M_AP_TYPE(mon))
188             seemimic(mon);
189         mon->mundetected = 0;
190         if (!canspotmon(mon))
191             map_invisible(x, y);
192         else
193             newsym(x, y);
194 #if 0 /*JP*/
195         There("is %s here.",
196               canspotmon(mon) ? a_monnam(mon) : "something hidden");
197 #else
198         There("%s\82ª\82¢\82é\81D",
199               canspotmon(mon) ? a_monnam(mon) : "\89½\82©\89B\82ê\82Ä\82¢\82é\82à\82Ì");
200 #endif
201     }
202
203     /* Kick attacks by kicking monsters are normal attacks, not special.
204      * This is almost always worthless, since you can either take one turn
205      * and do all your kicks, or else take one turn and attack the monster
206      * normally, getting all your attacks _including_ all your kicks.
207      * If you have >1 kick attack, you get all of them.
208      */
209     if (Upolyd && attacktype(youmonst.data, AT_KICK)) {
210         struct attack *uattk;
211         int sum, kickdieroll, armorpenalty, specialdmg,
212             attknum = 0,
213             tmp = find_roll_to_hit(mon, AT_KICK, (struct obj *) 0, &attknum,
214                                    &armorpenalty);
215
216         for (i = 0; i < NATTK; i++) {
217             /* first of two kicks might have provoked counterattack
218                that has incapacitated the hero (ie, floating eye) */
219             if (multi < 0)
220                 break;
221
222             uattk = &youmonst.data->mattk[i];
223             /* we only care about kicking attacks here */
224             if (uattk->aatyp != AT_KICK)
225                 continue;
226
227             kickdieroll = rnd(20);
228             specialdmg = special_dmgval(&youmonst, mon, W_ARMF, (long *) 0);
229             if (mon->data == &mons[PM_SHADE] && !specialdmg) {
230                 /* doesn't matter whether it would have hit or missed,
231                    and shades have no passive counterattack */
232 /*JP
233                 Your("%s %s.", kick_passes_thru, mon_nam(mon));
234 */
235                 You("%s\82ð\8fR\82Á\82½\82ª\81C%s\81D", mon_nam(mon), kick_passes_thru);
236                 break; /* skip any additional kicks */
237             } else if (tmp > kickdieroll) {
238 /*JP
239                 You("kick %s.", mon_nam(mon));
240 */
241                 You("%s\82ð\8fR\82Á\82½\81D", mon_nam(mon));
242                 sum = damageum(mon, uattk, specialdmg);
243                 (void) passive(mon, uarmf, (boolean) (sum > 0),
244                                (sum != 2), AT_KICK, FALSE);
245                 if (sum == 2)
246                     break; /* Defender died */
247             } else {
248                 missum(mon, uattk, (tmp + armorpenalty > kickdieroll));
249                 (void) passive(mon, uarmf, FALSE, 1, AT_KICK, FALSE);
250             }
251         }
252         return;
253     }
254
255     i = -inv_weight();
256     j = weight_cap();
257
258     if (i < (j * 3) / 10) {
259         if (!rn2((i < j / 10) ? 2 : (i < j / 5) ? 3 : 4)) {
260             if (martial() && !rn2(2))
261                 goto doit;
262 /*JP
263             Your("clumsy kick does no damage.");
264 */
265             Your("\95s\8aí\97p\82È\8fR\82è\82Å\83_\83\81\81[\83W\82ð\97^\82¦\82ç\82ê\82È\82©\82Á\82½\81D");
266             (void) passive(mon, uarmf, FALSE, 1, AT_KICK, FALSE);
267             return;
268         }
269         if (i < j / 10)
270             clumsy = TRUE;
271         else if (!rn2((i < j / 5) ? 2 : 3))
272             clumsy = TRUE;
273     }
274
275     if (Fumbling)
276         clumsy = TRUE;
277
278     else if (uarm && objects[uarm->otyp].oc_bulky && ACURR(A_DEX) < rnd(25))
279         clumsy = TRUE;
280  doit:
281 /*JP
282     You("kick %s.", mon_nam(mon));
283 */
284     You("%s\82ð\8fR\82Á\82½\81D", mon_nam(mon));
285     if (!rn2(clumsy ? 3 : 4) && (clumsy || !bigmonst(mon->data))
286         && mon->mcansee && !mon->mtrapped && !thick_skinned(mon->data)
287         && mon->data->mlet != S_EEL && haseyes(mon->data) && mon->mcanmove
288         && !mon->mstun && !mon->mconf && !mon->msleeping
289         && mon->data->mmove >= 12) {
290         if (!nohands(mon->data) && !rn2(martial() ? 5 : 3)) {
291 #if 0 /*JP:T*/
292             pline("%s blocks your %skick.", Monnam(mon),
293                   clumsy ? "clumsy " : "");
294 #else
295             pline("%s\82Í\82 \82È\82½\82Ì%s\8fR\82è\82ð\96h\82¢\82¾\81D", Monnam(mon),
296                   clumsy ? "\95s\8aí\97p\82È" : "");
297 #endif
298             (void) passive(mon, uarmf, FALSE, 1, AT_KICK, FALSE);
299             return;
300         } else {
301             maybe_mnexto(mon);
302             if (mon->mx != x || mon->my != y) {
303                 (void) unmap_invisible(x, y);
304 #if 0 /*JP:T*/
305                 pline("%s %s, %s evading your %skick.", Monnam(mon),
306                       (!level.flags.noteleport && can_teleport(mon->data))
307                           ? "teleports"
308                           : is_floater(mon->data)
309                                 ? "floats"
310                                 : is_flyer(mon->data) ? "swoops"
311                                                       : (nolimbs(mon->data)
312                                                          || slithy(mon->data))
313                                                             ? "slides"
314                                                             : "jumps",
315                       clumsy ? "easily" : "nimbly", clumsy ? "clumsy " : "");
316 #else
317                 pline("%s\82Í%s\81C%s\82 \82È\82½\82Ì%s\8fR\82è\82ð\82½\82­\82Ý\82É\94ð\82¯\82½\81D", Monnam(mon),
318                       (!level.flags.noteleport && can_teleport(mon->data))
319                           ? "\8fu\8aÔ\88Ú\93®\82µ"
320                           : is_floater(mon->data)
321                                 ? "\95\82\82«"
322                                 : is_flyer(mon->data) ? "\82Í\82Î\82½\82«"
323                                                       : (nolimbs(mon->data)
324                                                          || slithy(mon->data))
325                                                             ? "\89¡\82É\8a\8a\82è"
326                                                             : "\92µ\82Ë",
327                       clumsy ? "\8ay\81X\82Æ" : "\91f\91\81\82­", clumsy ? "\95s\8aí\97p\82È" : "");
328 #endif
329                 (void) passive(mon, uarmf, FALSE, 1, AT_KICK, FALSE);
330                 return;
331             }
332         }
333     }
334     kickdmg(mon, clumsy);
335 }
336
337 /*
338  *  Return TRUE if caught (the gold taken care of), FALSE otherwise.
339  *  The gold object is *not* attached to the fobj chain!
340  */
341 boolean
342 ghitm(mtmp, gold)
343 register struct monst *mtmp;
344 register struct obj *gold;
345 {
346     boolean msg_given = FALSE;
347
348     if (!likes_gold(mtmp->data) && !mtmp->isshk && !mtmp->ispriest
349         && !mtmp->isgd && !is_mercenary(mtmp->data)) {
350         wakeup(mtmp, TRUE);
351     } else if (!mtmp->mcanmove) {
352         /* too light to do real damage */
353         if (canseemon(mtmp)) {
354 #if 0 /*JP:T*/
355             pline_The("%s harmlessly %s %s.", xname(gold),
356                       otense(gold, "hit"), mon_nam(mtmp));
357 #else
358             pline("%s\82Í%s\82É\96½\92\86\82µ\82½\81D", xname(gold),
359                   mon_nam(mtmp));
360 #endif
361             msg_given = TRUE;
362         }
363     } else {
364         long umoney, value = gold->quan * objects[gold->otyp].oc_cost;
365
366         mtmp->msleeping = 0;
367         finish_meating(mtmp);
368         if (!mtmp->isgd && !rn2(4)) /* not always pleasing */
369             setmangry(mtmp, TRUE);
370         /* greedy monsters catch gold */
371         if (cansee(mtmp->mx, mtmp->my))
372 /*JP
373             pline("%s catches the gold.", Monnam(mtmp));
374 */
375             pline("%s\82Í\8bà\89Ý\82ð\83L\83\83\83b\83`\82µ\82½\81D", Monnam(mtmp));
376         (void) mpickobj(mtmp, gold);
377         gold = (struct obj *) 0; /* obj has been freed */
378         if (mtmp->isshk) {
379             long robbed = ESHK(mtmp)->robbed;
380
381             if (robbed) {
382                 robbed -= value;
383                 if (robbed < 0L)
384                     robbed = 0L;
385 #if 0 /*JP*/
386                 pline_The("amount %scovers %s recent losses.",
387                           !robbed ? "" : "partially ", mhis(mtmp));
388 #else
389                 pline("%s%s\91¹\8e¸\82ð\95â\93U\82·\82é\82Ì\82É\8eg\82í\82ê\82½\81D",
390                       !robbed ? "" : "\8bà\82Ì\88ê\95\94\82Í", mhis(mtmp));
391 #endif
392                 ESHK(mtmp)->robbed = robbed;
393                 if (!robbed)
394                     make_happy_shk(mtmp, FALSE);
395             } else {
396                 if (mtmp->mpeaceful) {
397                     ESHK(mtmp)->credit += value;
398 #if 0 /*JP*/
399                     You("have %ld %s in credit.", ESHK(mtmp)->credit,
400                         currency(ESHK(mtmp)->credit));
401 #else
402                     You("%ld%s\82ð\91Ý\82µ\82É\82µ\82½\81D", ESHK(mtmp)->credit,
403                         currency(ESHK(mtmp)->credit));
404 #endif
405                 } else
406 /*JP
407                     verbalize("Thanks, scum!");
408 */
409                     verbalize("\82 \82è\82ª\82Æ\82æ\81I\82­\82»\82Á\82½\82ê\81I");
410             }
411         } else if (mtmp->ispriest) {
412             if (mtmp->mpeaceful)
413 /*JP
414                 verbalize("Thank you for your contribution.");
415 */
416                 verbalize("\8añ\95t\82É\8a´\8eÓ\82µ\82Ü\82·\81D");
417             else
418 /*JP
419                 verbalize("Thanks, scum!");
420 */
421                 verbalize("\82 \82è\82ª\82Æ\82æ\81I\82­\82»\82Á\82½\82ê\81I");
422         } else if (mtmp->isgd) {
423             umoney = money_cnt(invent);
424             /* Some of these are iffy, because a hostile guard
425                won't become peaceful and resume leading hero
426                out of the vault.  If he did do that, player
427                could try fighting, then weasle out of being
428                killed by throwing his/her gold when losing. */
429 #if 0 /*JP*/
430             verbalize(
431                 umoney
432                     ? "Drop the rest and follow me."
433                     : hidden_gold()
434                           ? "You still have hidden gold.  Drop it now."
435                           : mtmp->mpeaceful
436                                 ? "I'll take care of that; please move along."
437                                 : "I'll take that; now get moving.");
438 #else
439             verbalize(
440                 umoney
441                     ? "\8ec\82è\82ð\92u\82¢\82Ä\82Â\82¢\82Ä\82«\82È\82³\82¢\81D"
442                     : hidden_gold()
443                           ? "\82Ü\82¾\8bà\82ð\89B\82µ\82Ä\82¢\82é\82È\81D\92u\82«\82È\82³\82¢\81D"
444                           : mtmp->mpeaceful
445                                 ? "\82»\82ê\82Í\8e\84\82ª\8fE\82Á\82Ä\82¨\82«\82Ü\82·\82©\82ç\82Â\82¢\82Ä\82«\82Ä\82­\82¾\82³\82¢\81D"
446                                 : "\82»\82ê\82Í\8fE\82Á\82Ä\82¨\82­\81D\97\88\82È\82³\82¢\81D");
447 #endif
448         } else if (is_mercenary(mtmp->data)) {
449             long goldreqd = 0L;
450
451             if (rn2(3)) {
452                 if (mtmp->data == &mons[PM_SOLDIER])
453                     goldreqd = 100L;
454                 else if (mtmp->data == &mons[PM_SERGEANT])
455                     goldreqd = 250L;
456                 else if (mtmp->data == &mons[PM_LIEUTENANT])
457                     goldreqd = 500L;
458                 else if (mtmp->data == &mons[PM_CAPTAIN])
459                     goldreqd = 750L;
460
461                 if (goldreqd) {
462                     umoney = money_cnt(invent);
463                     if (value
464                         > goldreqd
465                               + (umoney + u.ulevel * rn2(5)) / ACURR(A_CHA))
466                         mtmp->mpeaceful = TRUE;
467                 }
468             }
469             if (mtmp->mpeaceful)
470 /*JP
471                 verbalize("That should do.  Now beat it!");
472 */
473                 verbalize("\82È\82ñ\82¾\82¢\81H\82±\82ê\82Í\81H");
474             else
475 /*JP
476                 verbalize("That's not enough, coward!");
477 */
478                 verbalize("\82»\82ñ\82È\82à\82Ì\82Å\8dÏ\82Þ\82©\81C\94Ú\8b¯\8eÒ\81I");
479         }
480         return TRUE;
481     }
482
483     if (!msg_given)
484         miss(xname(gold), mtmp);
485     return FALSE;
486 }
487
488 /* container is kicked, dropped, thrown or otherwise impacted by player.
489  * Assumes container is on floor.  Checks contents for possible damage. */
490 void
491 container_impact_dmg(obj, x, y)
492 struct obj *obj;
493 xchar x, y; /* coordinates where object was before the impact, not after */
494 {
495     struct monst *shkp;
496     struct obj *otmp, *otmp2;
497     long loss = 0L;
498     boolean costly, insider, frominv;
499
500     /* only consider normal containers */
501     if (!Is_container(obj) || !Has_contents(obj) || Is_mbag(obj))
502         return;
503
504     costly = ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE)))
505               && costly_spot(x, y));
506     insider = (*u.ushops && inside_shop(u.ux, u.uy)
507                && *in_rooms(x, y, SHOPBASE) == *u.ushops);
508     /* if dropped or thrown, shop ownership flags are set on this obj */
509     frominv = (obj != kickedobj);
510
511     for (otmp = obj->cobj; otmp; otmp = otmp2) {
512         const char *result = (char *) 0;
513
514         otmp2 = otmp->nobj;
515         if (objects[otmp->otyp].oc_material == GLASS
516             && otmp->oclass != GEM_CLASS && !obj_resists(otmp, 33, 100)) {
517 /*JP
518             result = "shatter";
519 */
520             result = "\83K\83`\83\83\83\93";
521         } else if (otmp->otyp == EGG && !rn2(3)) {
522 /*JP
523             result = "cracking";
524 */
525             result = "\83O\83V\83\83\83b";
526         }
527         if (result) {
528             if (otmp->otyp == MIRROR)
529                 change_luck(-2);
530
531             /* eggs laid by you.  penalty is -1 per egg, max 5,
532              * but it's always exactly 1 that breaks */
533             if (otmp->otyp == EGG && otmp->spe && otmp->corpsenm >= LOW_PM)
534                 change_luck(-1);
535 /*JP
536             You_hear("a muffled %s.", result);
537 */
538             You_hear("\82±\82à\82Á\82½%s\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D", result);
539             if (costly) {
540                 if (frominv && !otmp->unpaid)
541                     otmp->no_charge = 1;
542                 loss +=
543                     stolen_value(otmp, x, y, (boolean) shkp->mpeaceful, TRUE);
544             }
545             if (otmp->quan > 1L) {
546                 useup(otmp);
547             } else {
548                 obj_extract_self(otmp);
549                 obfree(otmp, (struct obj *) 0);
550             }
551             /* contents of this container are no longer known */
552             obj->cknown = 0;
553         }
554     }
555     if (costly && loss) {
556         if (!insider) {
557 /*JP
558             You("caused %ld %s worth of damage!", loss, currency(loss));
559 */
560             You("%ld%s\95ª\82Ì\91¹\8aQ\82ð\82Ð\82«\82¨\82±\82µ\82½\81I", loss, currency(loss));
561             make_angry_shk(shkp, x, y);
562         } else {
563 #if 0 /*JP*/
564             You("owe %s %ld %s for objects destroyed.", mon_nam(shkp), loss,
565                 currency(loss));
566 #else
567             You("\8aí\95¨\94j\91¹\82Å%s\82É%ld%s\82Ì\8eØ\82è\82ð\82Â\82­\82Á\82½\81D", mon_nam(shkp), loss,
568                 currency(loss));
569 #endif
570         }
571     }
572 }
573
574 /* jacket around really_kick_object */
575 STATIC_OVL int
576 kick_object(x, y, kickobjnam)
577 xchar x, y;
578 char *kickobjnam;
579 {
580     int res = 0;
581
582     *kickobjnam = '\0';
583     /* if a pile, the "top" object gets kicked */
584     kickedobj = level.objects[x][y];
585     if (kickedobj) {
586         /* kick object; if doing is fatal, done() will clean up kickedobj */
587         Strcpy(kickobjnam, killer_xname(kickedobj)); /* matters iff res==0 */
588         res = really_kick_object(x, y);
589         kickedobj = (struct obj *) 0;
590     }
591     return res;
592 }
593
594 /* guts of kick_object */
595 STATIC_OVL int
596 really_kick_object(x, y)
597 xchar x, y;
598 {
599     int range;
600     struct monst *mon, *shkp = 0;
601     struct trap *trap;
602     char bhitroom;
603     boolean costly, isgold, slide = FALSE;
604
605     /* kickedobj should always be set due to conditions of call */
606     if (!kickedobj || kickedobj->otyp == BOULDER || kickedobj == uball
607         || kickedobj == uchain)
608         return 0;
609
610     if ((trap = t_at(x, y)) != 0) {
611         if ((is_pit(trap->ttyp) && !Passes_walls) || trap->ttyp == WEB) {
612             if (!trap->tseen)
613                 find_trap(trap);
614 #if 0 /*JP:T*/
615             You_cant("kick %s that's in a %s!", something,
616                      Hallucination ? "tizzy"
617                          : (trap->ttyp == WEB) ? "web"
618                              : "pit");
619 #else
620             You("%s\82Å\82Í%s\82ð\8fR\82é\82±\82Æ\82ª\82Å\82«\82È\82¢\81I",
621                 Hallucination ? "\8d¬\97\90\82µ\82½\8fó\91Ô" :
622                 (trap->ttyp == WEB) ? "\82­\82à\82Ì\91\83\82Ì\92\86" : "\97\8e\82µ\8c\8a\82Ì\92\86",
623                 something);
624 #endif
625             return 1;
626         }
627         if (trap->ttyp == STATUE_TRAP) {
628             activate_statue_trap(trap, x,y, FALSE);
629             return 1;
630         }
631     }
632
633     if (Fumbling && !rn2(3)) {
634 /*JP
635         Your("clumsy kick missed.");
636 */
637         Your("\95s\8aí\97p\82È\8fR\82è\82Í\8aO\82ê\82½\81D");
638         return 1;
639     }
640
641     if (!uarmf && kickedobj->otyp == CORPSE
642         && touch_petrifies(&mons[kickedobj->corpsenm]) && !Stone_resistance) {
643 #if 0 /*JP*/
644         You("kick %s with your bare %s.",
645             corpse_xname(kickedobj, (const char *) 0, CXN_PFX_THE),
646             makeplural(body_part(FOOT)));
647 #else
648         You("\91f%s\82Å%s\82ð\8fR\82Á\82½\81D",
649             body_part(FOOT),
650             corpse_xname(kickedobj, (const char *) 0, CXN_PFX_THE));
651 #endif
652         if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) {
653             ; /* hero has been transformed but kick continues */
654         } else {
655             /* normalize body shape here; foot, not body_part(FOOT) */
656 /*JP
657             Sprintf(killer.name, "kicking %s barefoot",
658 */
659             Sprintf(killer.name, "\8cC\96³\82µ\82Å%s\82ð\8fR\82Á\82Ä",
660                     killer_xname(kickedobj));
661             instapetrify(killer.name);
662         }
663     }
664
665     isgold = (kickedobj->oclass == COIN_CLASS);
666     {
667         int k_owt = (int) kickedobj->owt;
668
669         /* for non-gold stack, 1 item will be split off below (unless an
670            early return occurs, so we aren't moving the split to here);
671            calculate the range for that 1 rather than for the whole stack */
672         if (kickedobj->quan > 1L && !isgold) {
673             long save_quan = kickedobj->quan;
674
675             kickedobj->quan = 1L;
676             k_owt = weight(kickedobj);
677             kickedobj->quan = save_quan;
678         }
679
680         /* range < 2 means the object will not move
681            (maybe dexterity should also figure here) */
682         range = ((int) ACURRSTR) / 2 - k_owt / 40;
683     }
684
685     if (martial())
686         range += rnd(3);
687
688     if (is_pool(x, y)) {
689         /* you're in the water too; significantly reduce range */
690         range = range / 3 + 1; /* {1,2}=>1, {3,4,5}=>2, {6,7,8}=>3 */
691     } else if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)) {
692         /* you're in air, since is_pool did not match */
693         range += rnd(3);
694     } else {
695         if (is_ice(x, y))
696             range += rnd(3), slide = TRUE;
697         if (kickedobj->greased)
698             range += rnd(3), slide = TRUE;
699     }
700
701     /* Mjollnir is magically too heavy to kick */
702     if (kickedobj->oartifact == ART_MJOLLNIR)
703         range = 1;
704
705     /* see if the object has a place to move into */
706     if (!ZAP_POS(levl[x + u.dx][y + u.dy].typ)
707         || closed_door(x + u.dx, y + u.dy))
708         range = 1;
709
710     costly = (!(kickedobj->no_charge && !Has_contents(kickedobj))
711               && (shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0
712               && costly_spot(x, y));
713
714     if (IS_ROCK(levl[x][y].typ) || closed_door(x, y)) {
715         if ((!martial() && rn2(20) > ACURR(A_DEX))
716             || IS_ROCK(levl[u.ux][u.uy].typ) || closed_door(u.ux, u.uy)) {
717             if (Blind)
718 /*JP
719                 pline("It doesn't come loose.");
720 */
721                 pline("\82Ñ\82­\82Æ\82à\82µ\82È\82¢\81D");
722             else
723 #if 0 /*JP*/
724                 pline("%s %sn't come loose.",
725                       The(distant_name(kickedobj, xname)),
726                       otense(kickedobj, "do"));
727 #else
728                 pline("%s\82Í\82Ñ\82­\82Æ\82à\82µ\82È\82¢\81D",
729                       distant_name(kickedobj, xname));
730 #endif
731             return (!rn2(3) || martial());
732         }
733         if (Blind)
734 /*JP
735             pline("It comes loose.");
736 */
737             pline("\89½\82©\82ª\8aÉ\82ñ\82Å\82Æ\82ê\82½\81D");
738         else
739 #if 0 /*JP*/
740             pline("%s %s loose.", The(distant_name(kickedobj, xname)),
741                   otense(kickedobj, "come"));
742 #else
743             pline("%s\82Í\8aÉ\82ñ\82Å\82Æ\82ê\82½\81D", distant_name(kickedobj, xname));
744 #endif
745         obj_extract_self(kickedobj);
746         newsym(x, y);
747         if (costly && (!costly_spot(u.ux, u.uy)
748                        || !index(u.urooms, *in_rooms(x, y, SHOPBASE))))
749             addtobill(kickedobj, FALSE, FALSE, FALSE);
750 /*JP
751         if (!flooreffects(kickedobj, u.ux, u.uy, "fall")) {
752 */
753         if (!flooreffects(kickedobj, u.ux, u.uy, "\97\8e\82¿\82é")) {
754             place_object(kickedobj, u.ux, u.uy);
755             stackobj(kickedobj);
756             newsym(u.ux, u.uy);
757         }
758         return 1;
759     }
760
761     /* a box gets a chance of breaking open here */
762     if (Is_box(kickedobj)) {
763         boolean otrp = kickedobj->otrapped;
764
765         if (range < 2)
766 /*JP
767             pline("THUD!");
768 */
769             pline("\83K\83\93\81I");
770         container_impact_dmg(kickedobj, x, y);
771         if (kickedobj->olocked) {
772             if (!rn2(5) || (martial() && !rn2(2))) {
773 /*JP
774                 You("break open the lock!");
775 */
776                 You("\8c®\82ð\89ó\82µ\8aJ\82¯\82½\81I");
777                 breakchestlock(kickedobj, FALSE);
778                 if (otrp)
779                     (void) chest_trap(kickedobj, LEG, FALSE);
780                 return 1;
781             }
782         } else {
783             if (!rn2(3) || (martial() && !rn2(2))) {
784 /*JP
785                 pline_The("lid slams open, then falls shut.");
786 */
787                 pline("\8aW\82ª\82Î\82½\82ñ\82Æ\8aJ\82«\81C\95Â\82\82½\81D");
788                 kickedobj->lknown = 1;
789                 if (otrp)
790                     (void) chest_trap(kickedobj, LEG, FALSE);
791                 return 1;
792             }
793         }
794         if (range < 2)
795             return 1;
796         /* else let it fall through to the next cases... */
797     }
798
799     /* fragile objects should not be kicked */
800     if (hero_breaks(kickedobj, kickedobj->ox, kickedobj->oy, FALSE))
801         return 1;
802
803     /* too heavy to move.  range is calculated as potential distance from
804      * player, so range == 2 means the object may move up to one square
805      * from its current position
806      */
807     if (range < 2) {
808         if (!Is_box(kickedobj))
809 /*JP
810             pline("Thump!");
811 */
812             pline("\83S\83c\83\93\81I");
813         return (!rn2(3) || martial());
814     }
815
816     if (kickedobj->quan > 1L) {
817         if (!isgold) {
818             kickedobj = splitobj(kickedobj, 1L);
819         } else {
820             if (rn2(20)) {
821 #if 0 /*JP*/
822                 static NEARDATA const char *const flyingcoinmsg[] = {
823                     "scatter the coins", "knock coins all over the place",
824                     "send coins flying in all directions",
825                 };
826 #else
827                 static NEARDATA const char *const flyingcoinmsg[] = {
828                     "\8bà\89Ý\82ð\82Ü\82«\8eU\82ç\82µ\82½", "\8bà\89Ý\82ð\82Î\82ç\82Ü\82¢\82½",
829                     "\8bà\89Ý\82ð\82 \82¿\82±\82¿\82É\94ò\82Î\82µ\82½",
830                 };
831 #endif
832
833 /*JP
834                 pline("Thwwpingg!");
835 */
836                 pline("\83K\83V\83\83\81[\83\93\81I");
837 /*JP
838                 You("%s!", flyingcoinmsg[rn2(SIZE(flyingcoinmsg))]);
839 */
840                 You("%s\81I", flyingcoinmsg[rn2(SIZE(flyingcoinmsg))]);
841                 (void) scatter(x, y, rn2(3) + 1, VIS_EFFECTS | MAY_HIT,
842                                kickedobj);
843                 newsym(x, y);
844                 return 1;
845             }
846             if (kickedobj->quan > 300L) {
847 /*JP
848                 pline("Thump!");
849 */
850                 pline("\83S\83c\83\93\81I");
851                 return (!rn2(3) || martial());
852             }
853         }
854     }
855
856     if (slide && !Blind)
857 #if 0 /*JP*/
858         pline("Whee!  %s %s across the %s.", Doname2(kickedobj),
859               otense(kickedobj, "slide"), surface(x, y));
860 #else
861         pline("\83Y\83\8b\83b\81I%s\82Í%s\82Ì\8fã\82ð\8a\8a\82Á\82½\81D", Doname2(kickedobj),
862               surface(x,y));
863 #endif
864
865     if (costly && !isgold)
866         addtobill(kickedobj, FALSE, FALSE, TRUE);
867     obj_extract_self(kickedobj);
868     (void) snuff_candle(kickedobj);
869     newsym(x, y);
870     mon = bhit(u.dx, u.dy, range, KICKED_WEAPON,
871                (int FDECL((*), (MONST_P, OBJ_P))) 0,
872                (int FDECL((*), (OBJ_P, OBJ_P))) 0, &kickedobj);
873     if (!kickedobj)
874         return 1; /* object broken */
875
876     if (mon) {
877         if (mon->isshk && kickedobj->where == OBJ_MINVENT
878             && kickedobj->ocarry == mon)
879             return 1; /* alert shk caught it */
880         notonhead = (mon->mx != bhitpos.x || mon->my != bhitpos.y);
881         if (isgold ? ghitm(mon, kickedobj)      /* caught? */
882                    : thitmonst(mon, kickedobj)) /* hit && used up? */
883             return 1;
884     }
885
886     /* the object might have fallen down a hole;
887        ship_object() will have taken care of shop billing */
888     if (kickedobj->where == OBJ_MIGRATING)
889         return 1;
890
891     bhitroom = *in_rooms(bhitpos.x, bhitpos.y, SHOPBASE);
892     if (costly && (!costly_spot(bhitpos.x, bhitpos.y)
893                    || *in_rooms(x, y, SHOPBASE) != bhitroom)) {
894         if (isgold)
895             costly_gold(x, y, kickedobj->quan);
896         else
897             (void) stolen_value(kickedobj, x, y, (boolean) shkp->mpeaceful,
898                                 FALSE);
899     }
900
901 /*JP
902     if (flooreffects(kickedobj, bhitpos.x, bhitpos.y, "fall"))
903 */
904     if(flooreffects(kickedobj, bhitpos.x, bhitpos.y, "\97\8e\82¿\82é"))
905         return 1;
906     if (kickedobj->unpaid)
907         subfrombill(kickedobj, shkp);
908     place_object(kickedobj, bhitpos.x, bhitpos.y);
909     stackobj(kickedobj);
910     newsym(kickedobj->ox, kickedobj->oy);
911     return 1;
912 }
913
914 /* cause of death if kicking kills kicker */
915 STATIC_OVL char *
916 kickstr(buf, kickobjnam)
917 char *buf;
918 const char *kickobjnam;
919 {
920     const char *what;
921
922     if (*kickobjnam)
923         what = kickobjnam;
924     else if (maploc == &nowhere)
925 /*JP
926         what = "nothing";
927 */
928         what = "\89½\82à\82È\82¢\82Æ\82±\82ë";
929     else if (IS_DOOR(maploc->typ))
930 /*JP
931         what = "a door";
932 */
933         what = "\94à";
934     else if (IS_TREE(maploc->typ))
935 /*JP
936         what = "a tree";
937 */
938         what = "\96Ø";
939     else if (IS_STWALL(maploc->typ))
940 /*JP
941         what = "a wall";
942 */
943         what = "\95Ç";
944     else if (IS_ROCK(maploc->typ))
945 /*JP
946         what = "a rock";
947 */
948         what = "\8aâ";
949     else if (IS_THRONE(maploc->typ))
950 /*JP
951         what = "a throne";
952 */
953         what = "\8bÊ\8dÀ";
954     else if (IS_FOUNTAIN(maploc->typ))
955 /*JP
956         what = "a fountain";
957 */
958         what = "\90ò";
959     else if (IS_GRAVE(maploc->typ))
960 /*JP
961         what = "a headstone";
962 */
963         what = "\95æ\90Î";
964     else if (IS_SINK(maploc->typ))
965 /*JP
966         what = "a sink";
967 */
968         what = "\97¬\82µ\91ä";
969     else if (IS_ALTAR(maploc->typ))
970 /*JP
971         what = "an altar";
972 */
973         what = "\8dÕ\92d";
974     else if (IS_DRAWBRIDGE(maploc->typ))
975 /*JP
976         what = "a drawbridge";
977 */
978         what = "\92µ\82Ë\8b´";
979     else if (maploc->typ == STAIRS)
980 /*JP
981         what = "the stairs";
982 */
983         what = "\8aK\92i";
984     else if (maploc->typ == LADDER)
985 /*JP
986         what = "a ladder";
987 */
988         what = "\82Í\82µ\82²";
989     else if (maploc->typ == IRONBARS)
990 /*JP
991         what = "an iron bar";
992 */
993         what = "\93S\96_";
994     else
995 /*JP
996         what = "something weird";
997 */
998         what = "\89½\82©\96­\82È\82à\82Ì";
999 #if 0 /*JP*/
1000     return strcat(strcpy(buf, "kicking "), what);
1001 #else
1002     Sprintf(buf, "%s\82ð\8fR\82Á\82Ä", what);
1003     return buf;
1004 #endif
1005 }
1006
1007 int
1008 dokick()
1009 {
1010     int x, y;
1011     int avrg_attrib;
1012     int dmg = 0, glyph, oldglyph = -1;
1013     register struct monst *mtmp;
1014     boolean no_kick = FALSE;
1015     char buf[BUFSZ], kickobjnam[BUFSZ];
1016
1017     kickobjnam[0] = '\0';
1018     if (nolimbs(youmonst.data) || slithy(youmonst.data)) {
1019 /*JP
1020         You("have no legs to kick with.");
1021 */
1022         You("\89½\82©\82ð\8fR\82ë\82¤\82É\82à\91«\82ª\82È\82¢\81D");
1023         no_kick = TRUE;
1024     } else if (verysmall(youmonst.data)) {
1025 /*JP
1026         You("are too small to do any kicking.");
1027 */
1028         You("\89½\82©\82ð\8fR\82é\82É\82Í\8f¬\82³\82·\82¬\82é\81D");
1029         no_kick = TRUE;
1030     } else if (u.usteed) {
1031 /*JP
1032         if (yn_function("Kick your steed?", ynchars, 'y') == 'y') {
1033 */
1034         if (yn_function("\94n\82ð\8fR\82é\81H", ynchars, 'y') == 'y') {
1035 /*JP
1036             You("kick %s.", mon_nam(u.usteed));
1037 */
1038             You("%s\82ð\8fR\82Á\82½\81D", mon_nam(u.usteed));
1039             kick_steed();
1040             return 1;
1041         } else {
1042             return 0;
1043         }
1044     } else if (Wounded_legs) {
1045         /* note: jump() has similar code */
1046         long wl = (EWounded_legs & BOTH_SIDES);
1047         const char *bp = body_part(LEG);
1048
1049         if (wl == BOTH_SIDES)
1050             bp = makeplural(bp);
1051 #if 0 /*JP*/
1052         Your("%s%s %s in no shape for kicking.",
1053              (wl == LEFT_SIDE) ? "left " : (wl == RIGHT_SIDE) ? "right " : "",
1054              bp, (wl == BOTH_SIDES) ? "are" : "is");
1055 #else
1056         Your("%s%s\82Í\8fR\82è\82ª\82Å\82«\82é\8fó\91Ô\82\82á\82È\82¢\81D",
1057              (wl == LEFT_SIDE) ? "\8d¶" : (wl == RIGHT_SIDE) ? "\89E" : "",
1058              bp);
1059 #endif
1060         no_kick = TRUE;
1061     } else if (near_capacity() > SLT_ENCUMBER) {
1062 /*JP
1063         Your("load is too heavy to balance yourself for a kick.");
1064 */
1065         You("\82½\82­\82³\82ñ\82à\82Ì\82ð\8e\9d\82¿\82·\82¬\82Ä\8fR\82è\82Ì\82½\82ß\82Ì\83o\83\89\83\93\83X\82ª\82Æ\82ê\82È\82¢\81D");
1066         no_kick = TRUE;
1067     } else if (youmonst.data->mlet == S_LIZARD) {
1068 /*JP
1069         Your("legs cannot kick effectively.");
1070 */
1071         Your("\91«\82Å\82Í\82¤\82Ü\82­\8fR\82ê\82È\82¢\81D");
1072         no_kick = TRUE;
1073     } else if (u.uinwater && !rn2(2)) {
1074 /*JP
1075         Your("slow motion kick doesn't hit anything.");
1076 */
1077         Your("\92x\82¢\93®\82«\82Ì\8fR\82è\82Å\82Í\96½\92\86\82µ\82æ\82¤\82ª\82È\82¢\81D");
1078         no_kick = TRUE;
1079     } else if (u.utrap) {
1080         no_kick = TRUE;
1081         switch (u.utraptype) {
1082         case TT_PIT:
1083             if (!Passes_walls)
1084 /*JP
1085                 pline("There's not enough room to kick down here.");
1086 */
1087                 pline("\97\8e\82µ\8c\8a\82É\82Í\82Ü\82Á\82Ä\82¢\82é\82Ì\82Å\81C\8fR\82ê\82È\82¢\81D");
1088             else
1089                 no_kick = FALSE;
1090             break;
1091         case TT_WEB:
1092         case TT_BEARTRAP:
1093 /*JP
1094             You_cant("move your %s!", body_part(LEG));
1095 */
1096             You("%s\82ð\93®\82©\82·\82±\82Æ\82ª\82Å\82«\82È\82¢\81I", body_part(LEG));
1097             break;
1098         default:
1099             break;
1100         }
1101     }
1102
1103     if (no_kick) {
1104         /* ignore direction typed before player notices kick failed */
1105         display_nhwindow(WIN_MESSAGE, TRUE); /* --More-- */
1106         return 0;
1107     }
1108
1109     if (!getdir((char *) 0))
1110         return 0;
1111     if (!u.dx && !u.dy)
1112         return 0;
1113
1114     x = u.ux + u.dx;
1115     y = u.uy + u.dy;
1116
1117     /* KMH -- Kicking boots always succeed */
1118     if (uarmf && uarmf->otyp == KICKING_BOOTS)
1119         avrg_attrib = 99;
1120     else
1121         avrg_attrib = (ACURRSTR + ACURR(A_DEX) + ACURR(A_CON)) / 3;
1122
1123     if (u.uswallow) {
1124         switch (rn2(3)) {
1125         case 0:
1126 /*JP
1127             You_cant("move your %s!", body_part(LEG));
1128 */
1129             You("%s\82ð\93®\82©\82·\82±\82Æ\82ª\82Å\82«\82È\82¢\81I", body_part(LEG));
1130             break;
1131         case 1:
1132             if (is_animal(u.ustuck->data)) {
1133 /*JP
1134                 pline("%s burps loudly.", Monnam(u.ustuck));
1135 */
1136                 pline("%s\82Í\91å\82«\82È\83Q\83b\83v\82ð\82µ\82½\81D", Monnam(u.ustuck));
1137                 break;
1138             }
1139             /*FALLTHRU*/
1140         default:
1141 /*JP
1142             Your("feeble kick has no effect.");
1143 */
1144             Your("\8eã\81X\82µ\82¢\8fR\82è\82Í\8cø\89Ê\82ª\82È\82¢\81D"); break;
1145             break;
1146         }
1147         return 1;
1148     } else if (u.utrap && u.utraptype == TT_PIT) {
1149         /* must be Passes_walls */
1150 /*JP
1151         You("kick at the side of the pit.");
1152 */
1153         You("\97\8e\82µ\8c\8a\82Ì\95Ç\82ð\8fR\82Á\82½\81D");
1154         return 1;
1155     }
1156     if (Levitation) {
1157         int xx, yy;
1158
1159         xx = u.ux - u.dx;
1160         yy = u.uy - u.dy;
1161         /* doors can be opened while levitating, so they must be
1162          * reachable for bracing purposes
1163          * Possible extension: allow bracing against stuff on the side?
1164          */
1165         if (isok(xx, yy) && !IS_ROCK(levl[xx][yy].typ)
1166             && !IS_DOOR(levl[xx][yy].typ)
1167             && (!Is_airlevel(&u.uz) || !OBJ_AT(xx, yy))) {
1168 /*JP
1169             You("have nothing to brace yourself against.");
1170 */
1171             pline("\8ex\82¦\82É\82Å\82«\82é\82æ\82¤\82È\82à\82Ì\82ª\96³\82¢\81D");
1172             return 0;
1173         }
1174     }
1175
1176     mtmp = isok(x, y) ? m_at(x, y) : 0;
1177     /* might not kick monster if it is hidden and becomes revealed,
1178        if it is peaceful and player declines to attack, or if the
1179        hero passes out due to encumbrance with low hp; context.move
1180        will be 1 unless player declines to kick peaceful monster */
1181     if (mtmp) {
1182         oldglyph = glyph_at(x, y);
1183         if (!maybe_kick_monster(mtmp, x, y))
1184             return context.move;
1185     }
1186
1187     wake_nearby();
1188     u_wipe_engr(2);
1189
1190     if (!isok(x, y)) {
1191         maploc = &nowhere;
1192         goto ouch;
1193     }
1194     maploc = &levl[x][y];
1195
1196     /*
1197      * The next five tests should stay in their present order:
1198      * monsters, pools, objects, non-doors, doors.
1199      *
1200      * [FIXME:  Monsters who are hidden underneath objects or
1201      * in pools should lead to hero kicking the concealment
1202      * rather than the monster, probably exposing the hidden
1203      * monster in the process.  And monsters who are hidden on
1204      * ceiling shouldn't be kickable (unless hero is flying?);
1205      * kicking toward them should just target whatever is on
1206      * the floor at that spot.]
1207      */
1208
1209     if (mtmp) {
1210         /* save mtmp->data (for recoil) in case mtmp gets killed */
1211         struct permonst *mdat = mtmp->data;
1212
1213         kick_monster(mtmp, x, y);
1214         glyph = glyph_at(x, y);
1215         /* see comment in attack_checks() */
1216         if (DEADMONSTER(mtmp)) { /* DEADMONSTER() */
1217             /* if we mapped an invisible monster and immediately
1218                killed it, we don't want to forget what we thought
1219                was there before the kick */
1220             if (glyph != oldglyph && glyph_is_invisible(glyph))
1221                 show_glyph(x, y, oldglyph);
1222         } else if (!canspotmon(mtmp)
1223                    /* check <x,y>; monster that evades kick by jumping
1224                       to an unseen square doesn't leave an I behind */
1225                    && mtmp->mx == x && mtmp->my == y
1226                    && !glyph_is_invisible(glyph)
1227                    && !(u.uswallow && mtmp == u.ustuck)) {
1228             map_invisible(x, y);
1229         }
1230         /* recoil if floating */
1231         if ((Is_airlevel(&u.uz) || Levitation) && context.move) {
1232             int range;
1233
1234             range =
1235                 ((int) youmonst.data->cwt + (weight_cap() + inv_weight()));
1236             if (range < 1)
1237                 range = 1; /* divide by zero avoidance */
1238             range = (3 * (int) mdat->cwt) / range;
1239
1240             if (range < 1)
1241                 range = 1;
1242             hurtle(-u.dx, -u.dy, range, TRUE);
1243         }
1244         return 1;
1245     }
1246     (void) unmap_invisible(x, y);
1247     if (is_pool(x, y) ^ !!u.uinwater) {
1248         /* objects normally can't be removed from water by kicking */
1249 /*JP
1250         You("splash some %s around.", hliquid("water"));
1251 */
1252         You("%s\82ð\89ñ\82è\82É\82Ü\82«\82¿\82ç\82µ\82½\81D", hliquid("\90\85"));
1253         return 1;
1254     }
1255
1256     if (OBJ_AT(x, y) && (!Levitation || Is_airlevel(&u.uz)
1257                          || Is_waterlevel(&u.uz) || sobj_at(BOULDER, x, y))) {
1258         if (kick_object(x, y, kickobjnam)) {
1259             if (Is_airlevel(&u.uz))
1260                 hurtle(-u.dx, -u.dy, 1, TRUE); /* assume it's light */
1261             return 1;
1262         }
1263         goto ouch;
1264     }
1265
1266     if (!IS_DOOR(maploc->typ)) {
1267         if (maploc->typ == SDOOR) {
1268             if (!Levitation && rn2(30) < avrg_attrib) {
1269                 cvt_sdoor_to_door(maploc); /* ->typ = DOOR */
1270 #if 0 /*JP*/
1271                 pline("Crash!  %s a secret door!",
1272                       /* don't "kick open" when it's locked
1273                          unless it also happens to be trapped */
1274                       (maploc->doormask & (D_LOCKED | D_TRAPPED)) == D_LOCKED
1275                           ? "Your kick uncovers"
1276                           : "You kick open");
1277 #else
1278                 pline("\83K\83V\83\83\83\93\81I\82 \82È\82½\82Í\94é\96§\82Ì\94à\82ð%s\82½\81I",
1279                       (maploc->doormask & (D_LOCKED|D_TRAPPED)) == D_LOCKED
1280                           ? "\94­\8c©\82µ"
1281                           : "\8fR\82è\8aJ\82¯");
1282 #endif
1283                 exercise(A_DEX, TRUE);
1284                 if (maploc->doormask & D_TRAPPED) {
1285                     maploc->doormask = D_NODOOR;
1286 /*JP
1287                     b_trapped("door", FOOT);
1288 */
1289                     b_trapped("\94à", FOOT);
1290                 } else if (maploc->doormask != D_NODOOR
1291                            && !(maploc->doormask & D_LOCKED))
1292                     maploc->doormask = D_ISOPEN;
1293                 feel_newsym(x, y); /* we know it's gone */
1294                 if (maploc->doormask == D_ISOPEN
1295                     || maploc->doormask == D_NODOOR)
1296                     unblock_point(x, y); /* vision */
1297                 return 1;
1298             } else
1299                 goto ouch;
1300         }
1301         if (maploc->typ == SCORR) {
1302             if (!Levitation && rn2(30) < avrg_attrib) {
1303 /*JP
1304                 pline("Crash!  You kick open a secret passage!");
1305 */
1306                 pline("\83K\83V\83\83\83\93\81I\82 \82È\82½\82Í\94é\96§\82Ì\92Ê\98H\82ð\8fR\82è\82â\82Ô\82Á\82½\81I");
1307                 exercise(A_DEX, TRUE);
1308                 maploc->typ = CORR;
1309                 feel_newsym(x, y); /* we know it's gone */
1310                 unblock_point(x, y); /* vision */
1311                 return 1;
1312             } else
1313                 goto ouch;
1314         }
1315         if (IS_THRONE(maploc->typ)) {
1316             register int i;
1317             if (Levitation)
1318                 goto dumb;
1319             if ((Luck < 0 || maploc->doormask) && !rn2(3)) {
1320                 maploc->typ = ROOM;
1321                 maploc->doormask = 0; /* don't leave loose ends.. */
1322                 (void) mkgold((long) rnd(200), x, y);
1323                 if (Blind)
1324 /*JP
1325                     pline("CRASH!  You destroy it.");
1326 */
1327                     pline("\83K\83V\83\83\83\93\81I\82 \82È\82½\82Í\89½\82©\82ð\94j\89ó\82µ\82½\81D");
1328                 else {
1329 /*JP
1330                     pline("CRASH!  You destroy the throne.");
1331 */
1332                     pline("\83K\83V\83\83\83\93\81I\82 \82È\82½\82Í\8bÊ\8dÀ\82ð\94j\89ó\82µ\82½\81D");
1333                     newsym(x, y);
1334                 }
1335                 exercise(A_DEX, TRUE);
1336                 return 1;
1337             } else if (Luck > 0 && !rn2(3) && !maploc->looted) {
1338                 (void) mkgold((long) rn1(201, 300), x, y);
1339                 i = Luck + 1;
1340                 if (i > 6)
1341                     i = 6;
1342                 while (i--)
1343                     (void) mksobj_at(
1344                         rnd_class(DILITHIUM_CRYSTAL, LUCKSTONE - 1), x, y,
1345                         FALSE, TRUE);
1346                 if (Blind)
1347 /*JP
1348                     You("kick %s loose!", something);
1349 */
1350                     You("\82È\82É\82©\82ð\8fR\82è\8eU\82ç\82µ\82½\81I");
1351                 else {
1352 /*JP
1353                     You("kick loose some ornamental coins and gems!");
1354 */
1355                     You("\91\95\8fü\97p\82Ì\8bà\89Ý\82â\95ó\90Î\82ð\8fR\82è\8eU\82ç\82µ\82½\81I");
1356                     newsym(x, y);
1357                 }
1358                 /* prevent endless milking */
1359                 maploc->looted = T_LOOTED;
1360                 return 1;
1361             } else if (!rn2(4)) {
1362                 if (dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)) {
1363                     fall_through(FALSE);
1364                     return 1;
1365                 } else
1366                     goto ouch;
1367             }
1368             goto ouch;
1369         }
1370         if (IS_ALTAR(maploc->typ)) {
1371             if (Levitation)
1372                 goto dumb;
1373 /*JP
1374             You("kick %s.", (Blind ? something : "the altar"));
1375 */
1376             You("%s\82ð\8fR\82Á\82½\81D", (Blind ? "\89½\82©" : "\8dÕ\92d"));
1377             if (!rn2(3))
1378                 goto ouch;
1379             altar_wrath(x, y);
1380             exercise(A_DEX, TRUE);
1381             return 1;
1382         }
1383         if (IS_FOUNTAIN(maploc->typ)) {
1384             if (Levitation)
1385                 goto dumb;
1386 /*JP
1387             You("kick %s.", (Blind ? something : "the fountain"));
1388 */
1389             You("%s\82ð\8fR\82Á\82½\81D",(Blind ? "\89½\82©" : "\90ò"));
1390             if (!rn2(3))
1391                 goto ouch;
1392             /* make metal boots rust */
1393             if (uarmf && rn2(3))
1394 /*JP
1395                 if (water_damage(uarmf, "metal boots", TRUE) == ER_NOTHING) {
1396 */
1397                 if (water_damage(uarmf, "\8bà\91®\82Ì\8cC", TRUE) == ER_NOTHING) {
1398 /*JP
1399                     Your("boots get wet.");
1400 */
1401                     Your("\8cC\82Í\94G\82ê\82½\81D");
1402                     /* could cause short-lived fumbling here */
1403                 }
1404             exercise(A_DEX, TRUE);
1405             return 1;
1406         }
1407         if (IS_GRAVE(maploc->typ)) {
1408             if (Levitation)
1409                 goto dumb;
1410             if (rn2(4))
1411                 goto ouch;
1412             exercise(A_WIS, FALSE);
1413             if (Role_if(PM_ARCHEOLOGIST) || Role_if(PM_SAMURAI)
1414                 || ((u.ualign.type == A_LAWFUL) && (u.ualign.record > -10))) {
1415                 adjalign(-sgn(u.ualign.type));
1416             }
1417             maploc->typ = ROOM;
1418             maploc->doormask = 0;
1419             (void) mksobj_at(ROCK, x, y, TRUE, FALSE);
1420             del_engr_at(x, y);
1421             if (Blind)
1422 #if 0 /*JP*/
1423                 pline("Crack!  %s broke!", Something);
1424 #else
1425                 pline("\83S\83c\83\93\81I\89½\82©\82ª\89ó\82ê\82½\81I");
1426 #endif
1427             else {
1428 /*JP
1429                 pline_The("headstone topples over and breaks!");
1430 */
1431                 pline("\95æ\90Î\82Í\93|\82ê\82Ä\89ó\82ê\82½\81I");
1432                 newsym(x, y);
1433             }
1434             return 1;
1435         }
1436         if (maploc->typ == IRONBARS)
1437             goto ouch;
1438         if (IS_TREE(maploc->typ)) {
1439             struct obj *treefruit;
1440
1441             /* nothing, fruit or trouble? 75:23.5:1.5% */
1442             if (rn2(3)) {
1443                 if (!rn2(6) && !(mvitals[PM_KILLER_BEE].mvflags & G_GONE))
1444 #if 0 /*JP*/
1445                     You_hear("a low buzzing."); /* a warning */
1446 #else
1447                     You_hear("\82Ô\81[\82ñ\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D"); /* a warning */
1448 #endif
1449                 goto ouch;
1450             }
1451             if (rn2(15) && !(maploc->looted & TREE_LOOTED)
1452                 && (treefruit = rnd_treefruit_at(x, y))) {
1453                 long nfruit = 8L - rnl(7), nfall;
1454                 short frtype = treefruit->otyp;
1455
1456                 treefruit->quan = nfruit;
1457                 treefruit->owt = weight(treefruit);
1458                 if (is_plural(treefruit))
1459 /*JP
1460                     pline("Some %s fall from the tree!", xname(treefruit));
1461 */
1462                     pline("%s\82ª\89½\8cÂ\82©\96Ø\82©\82ç\97\8e\82¿\82Ä\82«\82½\81I", xname(treefruit));
1463                 else
1464 /*JP
1465                     pline("%s falls from the tree!", An(xname(treefruit)));
1466 */
1467                     pline("%s\82ª\96Ø\82©\82ç\97\8e\82¿\82Ä\82«\82½\81I", xname(treefruit));
1468                 nfall = scatter(x, y, 2, MAY_HIT, treefruit);
1469                 if (nfall != nfruit) {
1470                     /* scatter left some in the tree, but treefruit
1471                      * may not refer to the correct object */
1472                     treefruit = mksobj(frtype, TRUE, FALSE);
1473                     treefruit->quan = nfruit - nfall;
1474 #if 0 /*JP*/
1475                     pline("%ld %s got caught in the branches.",
1476                           nfruit - nfall, xname(treefruit));
1477 #else
1478                     pline("%ld\8cÂ\82Ì%s\82ª\8e}\82É\82Ð\82Á\82©\82©\82Á\82½\81D",
1479                           nfruit - nfall, xname(treefruit));
1480 #endif
1481                     dealloc_obj(treefruit);
1482                 }
1483                 exercise(A_DEX, TRUE);
1484                 exercise(A_WIS, TRUE); /* discovered a new food source! */
1485                 newsym(x, y);
1486                 maploc->looted |= TREE_LOOTED;
1487                 return 1;
1488             } else if (!(maploc->looted & TREE_SWARM)) {
1489                 int cnt = rnl(4) + 2;
1490                 int made = 0;
1491                 coord mm;
1492
1493                 mm.x = x;
1494                 mm.y = y;
1495                 while (cnt--) {
1496                     if (enexto(&mm, mm.x, mm.y, &mons[PM_KILLER_BEE])
1497                         && makemon(&mons[PM_KILLER_BEE], mm.x, mm.y,
1498                                    MM_ANGRY))
1499                         made++;
1500                 }
1501                 if (made)
1502 /*JP
1503                     pline("You've attracted the tree's former occupants!");
1504 */
1505                     pline("\96Ø\82Ì\90æ\8fZ\96¯\82ð\8bN\82±\82µ\82Ä\82µ\82Ü\82Á\82½\81I");
1506                 else
1507 /*JP
1508                     You("smell stale honey.");
1509 */
1510                     pline("\8cÃ\82¢\82Í\82¿\82Ý\82Â\82Ì\82É\82¨\82¢\82ª\82µ\82½\81D");
1511                 maploc->looted |= TREE_SWARM;
1512                 return 1;
1513             }
1514             goto ouch;
1515         }
1516         if (IS_SINK(maploc->typ)) {
1517             int gend = poly_gender();
1518             short washerndx = (gend == 1 || (gend == 2 && rn2(2)))
1519                                   ? PM_INCUBUS
1520                                   : PM_SUCCUBUS;
1521
1522             if (Levitation)
1523                 goto dumb;
1524             if (rn2(5)) {
1525                 if (!Deaf)
1526 /*JP
1527                     pline("Klunk!  The pipes vibrate noisily.");
1528 */
1529                     pline("\83K\83\89\83\93\81I\83p\83C\83v\82Í\82¤\82é\82³\82­\90U\93®\82µ\82½\81D");
1530                 else
1531 /*JP
1532                     pline("Klunk!");
1533 */
1534                     pline("\83K\83\89\83\93\81I");
1535                 exercise(A_DEX, TRUE);
1536                 return 1;
1537             } else if (!(maploc->looted & S_LPUDDING) && !rn2(3)
1538                        && !(mvitals[PM_BLACK_PUDDING].mvflags & G_GONE)) {
1539                 if (Blind)
1540 /*JP
1541                     You_hear("a gushing sound.");
1542 */
1543                     You_hear("\82È\82É\82©\82ª\95¬\8fo\82·\82é\89¹\82ð\95·\82¢\82½\81D");
1544                 else
1545 /*JP
1546                     pline("A %s ooze gushes up from the drain!",
1547 */
1548                     pline("%s\89t\91Ì\82ª\94r\90\85\8cû\82©\82ç\82É\82\82Ý\8fo\82½\81I",
1549                           hcolor(NH_BLACK));
1550                 (void) makemon(&mons[PM_BLACK_PUDDING], x, y, NO_MM_FLAGS);
1551                 exercise(A_DEX, TRUE);
1552                 newsym(x, y);
1553                 maploc->looted |= S_LPUDDING;
1554                 return 1;
1555             } else if (!(maploc->looted & S_LDWASHER) && !rn2(3)
1556                        && !(mvitals[washerndx].mvflags & G_GONE)) {
1557                 /* can't resist... */
1558 /*JP
1559                 pline("%s returns!", (Blind ? Something : "The dish washer"));
1560 */
1561                 pline("%s\82ª\96ß\82Á\82Ä\82«\82½\81I", (Blind ? "\89½\82©" : "\8eM\90ô\82¢"));
1562                 if (makemon(&mons[washerndx], x, y, NO_MM_FLAGS))
1563                     newsym(x, y);
1564                 maploc->looted |= S_LDWASHER;
1565                 exercise(A_DEX, TRUE);
1566                 return 1;
1567             } else if (!rn2(3)) {
1568 #if 0 /*JP*/
1569                 pline("Flupp!  %s.",
1570                       (Blind ? "You hear a sloshing sound"
1571                              : "Muddy waste pops up from the drain"));
1572 #else
1573                 pline("\82¤\82í\81I%s\81D",
1574                       (Blind ? "\82 \82È\82½\82Í\81C\83o\83`\83\83\83o\83`\83\83\82·\82é\89¹\82ð\95·\82¢\82½"
1575                              : "\94r\90\85\8cû\82©\82ç\82Ç\82ë\82Ç\82ë\82Ì\94p\8aü\95¨\82ª\8fo\82Ä\82­\82é"));
1576 #endif
1577                 if (!(maploc->looted & S_LRING)) { /* once per sink */
1578                     if (!Blind)
1579 /*JP
1580                         You_see("a ring shining in its midst.");
1581 */
1582                         You("\82»\82Ì\92\86\82É\8cõ\82é\8ew\97Ö\82ð\8c©\82Â\82¯\82½\81D");
1583                     (void) mkobj_at(RING_CLASS, x, y, TRUE);
1584                     newsym(x, y);
1585                     exercise(A_DEX, TRUE);
1586                     exercise(A_WIS, TRUE); /* a discovery! */
1587                     maploc->looted |= S_LRING;
1588                 }
1589                 return 1;
1590             }
1591             goto ouch;
1592         }
1593         if (maploc->typ == STAIRS || maploc->typ == LADDER
1594             || IS_STWALL(maploc->typ)) {
1595             if (!IS_STWALL(maploc->typ) && maploc->ladder == LA_DOWN)
1596                 goto dumb;
1597  ouch:
1598 /*JP
1599             pline("Ouch!  That hurts!");
1600 */
1601             pline("\82¢\82Ä\82Á\81I\89ö\89ä\82µ\82½\81I");
1602             exercise(A_DEX, FALSE);
1603             exercise(A_STR, FALSE);
1604             if (isok(x, y)) {
1605                 if (Blind)
1606                     feel_location(x, y); /* we know we hit it */
1607                 if (is_drawbridge_wall(x, y) >= 0) {
1608 /*JP
1609                     pline_The("drawbridge is unaffected.");
1610 */
1611                     pline("\92µ\82Ë\8b´\82Í\82Ñ\82­\82Æ\82à\82µ\82È\82¢\81D");
1612                     /* update maploc to refer to the drawbridge */
1613                     (void) find_drawbridge(&x, &y);
1614                     maploc = &levl[x][y];
1615                 }
1616             }
1617             if (!rn2(3))
1618                 set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
1619             dmg = rnd(ACURR(A_CON) > 15 ? 3 : 5);
1620             losehp(Maybe_Half_Phys(dmg), kickstr(buf, kickobjnam), KILLED_BY);
1621             if (Is_airlevel(&u.uz) || Levitation)
1622                 hurtle(-u.dx, -u.dy, rn1(2, 4), TRUE); /* assume it's heavy */
1623             return 1;
1624         }
1625         goto dumb;
1626     }
1627
1628     if (maploc->doormask == D_ISOPEN || maploc->doormask == D_BROKEN
1629         || maploc->doormask == D_NODOOR) {
1630  dumb:
1631         exercise(A_DEX, FALSE);
1632         if (martial() || ACURR(A_DEX) >= 16 || rn2(3)) {
1633 /*JP
1634             You("kick at empty space.");
1635 */
1636             You("\89½\82à\82È\82¢\8bó\8aÔ\82ð\8fR\82Á\82½\81D");
1637             if (Blind)
1638                 feel_location(x, y);
1639         } else {
1640 /*JP
1641             pline("Dumb move!  You strain a muscle.");
1642 */
1643             pline("\82Î\82©\82°\82½\93®\82«\82¾\81I\8bØ\93÷\82ð\92É\82ß\82½\81D");
1644             exercise(A_STR, FALSE);
1645             set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
1646         }
1647         if ((Is_airlevel(&u.uz) || Levitation) && rn2(2))
1648             hurtle(-u.dx, -u.dy, 1, TRUE);
1649         return 1; /* uses a turn */
1650     }
1651
1652     /* not enough leverage to kick open doors while levitating */
1653     if (Levitation)
1654         goto ouch;
1655
1656     exercise(A_DEX, TRUE);
1657     /* door is known to be CLOSED or LOCKED */
1658     if (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX))) {
1659         boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
1660         /* break the door */
1661         if (maploc->doormask & D_TRAPPED) {
1662             if (flags.verbose)
1663 /*JP
1664                 You("kick the door.");
1665 */
1666                 You("\94à\82ð\8fR\82Á\82½\81D");
1667             exercise(A_STR, FALSE);
1668             maploc->doormask = D_NODOOR;
1669 /*JP
1670             b_trapped("door", FOOT);
1671 */
1672             b_trapped("\94à", FOOT);
1673         } else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) {
1674 /*JP
1675             pline("As you kick the door, it shatters to pieces!");
1676 */
1677             pline("\94à\82ð\8fR\82é\82Æ\81C\82±\82È\82²\82È\82É\82­\82¾\82¯\82½\81I");
1678             exercise(A_STR, TRUE);
1679             maploc->doormask = D_NODOOR;
1680         } else {
1681 /*JP
1682             pline("As you kick the door, it crashes open!");
1683 */
1684             pline("\94à\82ð\8fR\82é\82Æ\81C\89ó\82ê\82Ä\8aJ\82¢\82½\81I");
1685             exercise(A_STR, TRUE);
1686             maploc->doormask = D_BROKEN;
1687         }
1688         feel_newsym(x, y); /* we know we broke it */
1689         unblock_point(x, y); /* vision */
1690         if (shopdoor) {
1691             add_damage(x, y, SHOP_DOOR_COST);
1692 /*JP
1693             pay_for_damage("break", FALSE);
1694 */
1695             pay_for_damage("\94j\89ó\82·\82é", FALSE);
1696         }
1697         if (in_town(x, y))
1698             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1699                 if (DEADMONSTER(mtmp))
1700                     continue;
1701                 if (is_watch(mtmp->data) && couldsee(mtmp->mx, mtmp->my)
1702                     && mtmp->mpeaceful) {
1703 /*JP
1704                     mon_yells(mtmp, "Halt, thief!  You're under arrest!");
1705 */
1706                     mon_yells(mtmp, "\8e~\82Ü\82ê\93D\96_\81I\82¨\82Ü\82¦\82ð\91ß\95ß\82·\82é\81I");
1707                     (void) angry_guards(FALSE);
1708                     break;
1709                 }
1710             }
1711     } else {
1712         if (Blind)
1713             feel_location(x, y); /* we know we hit it */
1714         exercise(A_STR, TRUE);
1715 /*JP
1716         pline("WHAMMM!!!");
1717 */
1718         pline("\82®\82\9f\82\9f\82\9f\82ñ\81I");
1719         if (in_town(x, y))
1720             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1721                 if (DEADMONSTER(mtmp))
1722                     continue;
1723                 if (is_watch(mtmp->data) && mtmp->mpeaceful
1724                     && couldsee(mtmp->mx, mtmp->my)) {
1725                     if (levl[x][y].looted & D_WARNED) {
1726                         mon_yells(mtmp,
1727 /*JP
1728                                   "Halt, vandal!  You're under arrest!");
1729 */
1730                                   "\8e~\82Ü\82ê\96ì\94Ø\90l\81I\82¨\82Ü\82¦\82ð\91ß\95ß\82·\82é\81I");
1731                         (void) angry_guards(FALSE);
1732                     } else {
1733 /*JP
1734                         mon_yells(mtmp, "Hey, stop damaging that door!");
1735 */
1736                         mon_yells(mtmp, "\82¨\82¢\81C\94à\82ð\94j\89ó\82·\82é\82Ì\82ð\82â\82ß\82ë\81I");
1737                         levl[x][y].looted |= D_WARNED;
1738                     }
1739                     break;
1740                 }
1741             }
1742     }
1743     return 1;
1744 }
1745
1746 STATIC_OVL void
1747 drop_to(cc, loc)
1748 coord *cc;
1749 schar loc;
1750 {
1751     /* cover all the MIGR_xxx choices generated by down_gate() */
1752     switch (loc) {
1753     case MIGR_RANDOM: /* trap door or hole */
1754         if (Is_stronghold(&u.uz)) {
1755             cc->x = valley_level.dnum;
1756             cc->y = valley_level.dlevel;
1757             break;
1758         } else if (In_endgame(&u.uz) || Is_botlevel(&u.uz)) {
1759             cc->y = cc->x = 0;
1760             break;
1761         }
1762         /*FALLTHRU*/
1763     case MIGR_STAIRS_UP:
1764     case MIGR_LADDER_UP:
1765         cc->x = u.uz.dnum;
1766         cc->y = u.uz.dlevel + 1;
1767         break;
1768     case MIGR_SSTAIRS:
1769         cc->x = sstairs.tolev.dnum;
1770         cc->y = sstairs.tolev.dlevel;
1771         break;
1772     default:
1773     case MIGR_NOWHERE:
1774         /* y==0 means "nowhere", in which case x doesn't matter */
1775         cc->y = cc->x = 0;
1776         break;
1777     }
1778 }
1779
1780 /* player or missile impacts location, causing objects to fall down */
1781 void
1782 impact_drop(missile, x, y, dlev)
1783 struct obj *missile; /* caused impact, won't drop itself */
1784 xchar x, y;          /* location affected */
1785 xchar dlev;          /* if !0 send to dlev near player */
1786 {
1787     schar toloc;
1788     register struct obj *obj, *obj2;
1789     register struct monst *shkp;
1790     long oct, dct, price, debit, robbed;
1791     boolean angry, costly, isrock;
1792     coord cc;
1793
1794     if (!OBJ_AT(x, y))
1795         return;
1796
1797     toloc = down_gate(x, y);
1798     drop_to(&cc, toloc);
1799     if (!cc.y)
1800         return;
1801
1802     if (dlev) {
1803         /* send objects next to player falling through trap door.
1804          * checked in obj_delivery().
1805          */
1806         toloc = MIGR_WITH_HERO;
1807         cc.y = dlev;
1808     }
1809
1810     costly = costly_spot(x, y);
1811     price = debit = robbed = 0L;
1812     angry = FALSE;
1813     shkp = (struct monst *) 0;
1814     /* if 'costly', we must keep a record of ESHK(shkp) before
1815      * it undergoes changes through the calls to stolen_value.
1816      * the angry bit must be reset, if needed, in this fn, since
1817      * stolen_value is called under the 'silent' flag to avoid
1818      * unsavory pline repetitions.
1819      */
1820     if (costly) {
1821         if ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0) {
1822             debit = ESHK(shkp)->debit;
1823             robbed = ESHK(shkp)->robbed;
1824             angry = !shkp->mpeaceful;
1825         }
1826     }
1827
1828     isrock = (missile && missile->otyp == ROCK);
1829     oct = dct = 0L;
1830     for (obj = level.objects[x][y]; obj; obj = obj2) {
1831         obj2 = obj->nexthere;
1832         if (obj == missile)
1833             continue;
1834         /* number of objects in the pile */
1835         oct += obj->quan;
1836         if (obj == uball || obj == uchain)
1837             continue;
1838         /* boulders can fall too, but rarely & never due to rocks */
1839         if ((isrock && obj->otyp == BOULDER)
1840             || rn2(obj->otyp == BOULDER ? 30 : 3))
1841             continue;
1842         obj_extract_self(obj);
1843
1844         if (costly) {
1845             price += stolen_value(obj, x, y,
1846                                   (costly_spot(u.ux, u.uy)
1847                                    && index(u.urooms,
1848                                             *in_rooms(x, y, SHOPBASE))),
1849                                   TRUE);
1850             /* set obj->no_charge to 0 */
1851             if (Has_contents(obj))
1852                 picked_container(obj); /* does the right thing */
1853             if (obj->oclass != COIN_CLASS)
1854                 obj->no_charge = 0;
1855         }
1856
1857         add_to_migration(obj);
1858         obj->ox = cc.x;
1859         obj->oy = cc.y;
1860         obj->owornmask = (long) toloc;
1861
1862         /* number of fallen objects */
1863         dct += obj->quan;
1864     }
1865
1866     if (dct && cansee(x, y)) { /* at least one object fell */
1867 /*JP
1868         const char *what = (dct == 1L ? "object falls" : "objects fall");
1869 */
1870         const char *what = "\95¨";
1871
1872         if (missile)
1873 #if 0 /*JP:T*/
1874             pline("From the impact, %sother %s.",
1875                   dct == oct ? "the " : dct == 1L ? "an" : "", what);
1876 #else
1877             pline("\8fÕ\8c\82\82Å\81C\91¼\82Ì%s\82ª\97\8e\82¿\82½\81D",what);
1878 #endif
1879         else if (oct == dct)
1880 #if 0 /*JP:T*/
1881             pline("%s adjacent %s %s.", dct == 1L ? "The" : "All the", what,
1882                   gate_str);
1883 #else
1884             pline("\8bß\82­\82É\82 \82Á\82½%s\82ª%s\97\8e\82¿\82½\81D", what, gate_str);
1885 #endif
1886         else
1887 #if 0 /*JP*/
1888             pline("%s adjacent %s %s.",
1889                   dct == 1L ? "One of the" : "Some of the",
1890                   dct == 1L ? "objects falls" : what, gate_str);
1891 #else
1892             pline("\8bß\82­\82É\82 \82Á\82½%s%s%s\97\8e\82¿\82½\81D",
1893                   what,
1894                   dct == 1L ? "\82ª" : "\82Ì\82¢\82­\82Â\82©\82ª",
1895                   gate_str);
1896 #endif
1897     }
1898
1899     if (costly && shkp && price) {
1900         if (ESHK(shkp)->robbed > robbed) {
1901 /*JP
1902             You("removed %ld %s worth of goods!", price, currency(price));
1903 */
1904             You("%ld%s\95ª\82Ì\95i\95¨\82ð\8eæ\82è\82³\82Á\82½\81I", price, currency(price));
1905             if (cansee(shkp->mx, shkp->my)) {
1906                 if (ESHK(shkp)->customer[0] == 0)
1907                     (void) strncpy(ESHK(shkp)->customer, plname, PL_NSIZ);
1908                 if (angry)
1909 /*JP
1910                     pline("%s is infuriated!", Monnam(shkp));
1911 */
1912                     pline("%s\82Í\8c\83\93{\82µ\82½\81I", Monnam(shkp));
1913                 else
1914 /*JP
1915                     pline("\"%s, you are a thief!\"", plname);
1916 */
1917                     pline("\81u%s\82ß\81C\82¨\82Ü\82¦\82Í\93D\96_\82¾\82È\81I\81v", plname);
1918             } else
1919 /*JP
1920                 You_hear("a scream, \"Thief!\"");
1921 */
1922                 You_hear("\8bà\90Ø\82è\90º\82ð\95·\82¢\82½\81u\93D\96_\81I\81v");
1923             hot_pursuit(shkp);
1924             (void) angry_guards(FALSE);
1925             return;
1926         }
1927         if (ESHK(shkp)->debit > debit) {
1928             long amt = (ESHK(shkp)->debit - debit);
1929 #if 0 /*JP*/
1930             You("owe %s %ld %s for goods lost.", Monnam(shkp), amt,
1931                 currency(amt));
1932 #else
1933             You("\95i\95¨\8fÁ\8e¸\82Ì\82½\82ß%s\82É%ld%s\82Ì\8eØ\82è\82ð\82Â\82­\82Á\82½\81D", Monnam(shkp), amt,
1934                 currency(amt));
1935 #endif
1936         }
1937     }
1938 }
1939
1940 /* NOTE: ship_object assumes otmp was FREED from fobj or invent.
1941  * <x,y> is the point of drop.  otmp is _not_ an <x,y> resident:
1942  * otmp is either a kicked, dropped, or thrown object.
1943  */
1944 boolean
1945 ship_object(otmp, x, y, shop_floor_obj)
1946 xchar x, y;
1947 struct obj *otmp;
1948 boolean shop_floor_obj;
1949 {
1950     schar toloc;
1951     xchar ox, oy;
1952     coord cc;
1953     struct obj *obj;
1954     struct trap *t;
1955     boolean nodrop, unpaid, container, impact = FALSE;
1956     long n = 0L;
1957
1958     if (!otmp)
1959         return FALSE;
1960     if ((toloc = down_gate(x, y)) == MIGR_NOWHERE)
1961         return FALSE;
1962     drop_to(&cc, toloc);
1963     if (!cc.y)
1964         return FALSE;
1965
1966     /* objects other than attached iron ball always fall down ladder,
1967        but have a chance of staying otherwise */
1968     nodrop = (otmp == uball) || (otmp == uchain)
1969              || (toloc != MIGR_LADDER_UP && rn2(3));
1970
1971     container = Has_contents(otmp);
1972     unpaid = is_unpaid(otmp);
1973
1974     if (OBJ_AT(x, y)) {
1975         for (obj = level.objects[x][y]; obj; obj = obj->nexthere)
1976             if (obj != otmp)
1977                 n += obj->quan;
1978         if (n)
1979             impact = TRUE;
1980     }
1981     /* boulders never fall through trap doors, but they might knock
1982        other things down before plugging the hole */
1983     if (otmp->otyp == BOULDER && ((t = t_at(x, y)) != 0)
1984         && is_hole(t->ttyp)) {
1985         if (impact)
1986             impact_drop(otmp, x, y, 0);
1987         return FALSE; /* let caller finish the drop */
1988     }
1989
1990     if (cansee(x, y))
1991         otransit_msg(otmp, nodrop, n);
1992
1993     if (nodrop) {
1994         if (impact)
1995             impact_drop(otmp, x, y, 0);
1996         return FALSE;
1997     }
1998
1999     if (unpaid || shop_floor_obj) {
2000         if (unpaid) {
2001             (void) stolen_value(otmp, u.ux, u.uy, TRUE, FALSE);
2002         } else {
2003             ox = otmp->ox;
2004             oy = otmp->oy;
2005             (void) stolen_value(
2006                 otmp, ox, oy,
2007                 (costly_spot(u.ux, u.uy)
2008                  && index(u.urooms, *in_rooms(ox, oy, SHOPBASE))),
2009                 FALSE);
2010         }
2011         /* set otmp->no_charge to 0 */
2012         if (container)
2013             picked_container(otmp); /* happens to do the right thing */
2014         if (otmp->oclass != COIN_CLASS)
2015             otmp->no_charge = 0;
2016     }
2017
2018     if (otmp->owornmask)
2019         remove_worn_item(otmp, TRUE);
2020
2021     /* some things break rather than ship */
2022     if (breaktest(otmp)) {
2023         const char *result;
2024
2025         if (objects[otmp->otyp].oc_material == GLASS
2026             || otmp->otyp == EXPENSIVE_CAMERA) {
2027             if (otmp->otyp == MIRROR)
2028                 change_luck(-2);
2029 /*JP
2030             result = "crash";
2031 */
2032             result = "\83O\83V\83\83\83b";
2033         } else {
2034             /* penalty for breaking eggs laid by you */
2035             if (otmp->otyp == EGG && otmp->spe && otmp->corpsenm >= LOW_PM)
2036                 change_luck((schar) -min(otmp->quan, 5L));
2037 /*JP
2038             result = "splat";
2039 */
2040             result = "\83x\83`\83\83\83b";
2041         }
2042 /*JP
2043         You_hear("a muffled %s.", result);
2044 */
2045         You_hear("\82±\82à\82Á\82½%s\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D", result);
2046         obj_extract_self(otmp);
2047         obfree(otmp, (struct obj *) 0);
2048         return TRUE;
2049     }
2050
2051     add_to_migration(otmp);
2052     otmp->ox = cc.x;
2053     otmp->oy = cc.y;
2054     otmp->owornmask = (long) toloc;
2055     /* boulder from rolling boulder trap, no longer part of the trap */
2056     if (otmp->otyp == BOULDER)
2057         otmp->otrapped = 0;
2058
2059     if (impact) {
2060         /* the objs impacted may be in a shop other than
2061          * the one in which the hero is located.  another
2062          * check for a shk is made in impact_drop.  it is, e.g.,
2063          * possible to kick/throw an object belonging to one
2064          * shop into another shop through a gap in the wall,
2065          * and cause objects belonging to the other shop to
2066          * fall down a trap door--thereby getting two shopkeepers
2067          * angry at the hero in one shot.
2068          */
2069         impact_drop(otmp, x, y, 0);
2070         newsym(x, y);
2071     }
2072     return TRUE;
2073 }
2074
2075 void
2076 obj_delivery(near_hero)
2077 boolean near_hero;
2078 {
2079     register struct obj *otmp, *otmp2;
2080     register int nx, ny;
2081     int where;
2082     boolean nobreak, noscatter;
2083
2084     for (otmp = migrating_objs; otmp; otmp = otmp2) {
2085         otmp2 = otmp->nobj;
2086         if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel)
2087             continue;
2088
2089         where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
2090         if ((where & MIGR_TO_SPECIES) != 0)
2091             continue;
2092
2093         nobreak = (where & MIGR_NOBREAK) != 0;
2094         noscatter = (where & MIGR_WITH_HERO) != 0;
2095         where &= ~(MIGR_NOBREAK | MIGR_NOSCATTER);
2096
2097         if (!near_hero ^ (where == MIGR_WITH_HERO))
2098             continue;
2099
2100         obj_extract_self(otmp);
2101         otmp->owornmask = 0L;
2102
2103         switch (where) {
2104         case MIGR_STAIRS_UP:
2105             nx = xupstair, ny = yupstair;
2106             break;
2107         case MIGR_LADDER_UP:
2108             nx = xupladder, ny = yupladder;
2109             break;
2110         case MIGR_SSTAIRS:
2111             nx = sstairs.sx, ny = sstairs.sy;
2112             break;
2113         case MIGR_WITH_HERO:
2114             nx = u.ux, ny = u.uy;
2115             break;
2116         default:
2117         case MIGR_RANDOM:
2118             nx = ny = 0;
2119             break;
2120         }
2121         if (nx > 0) {
2122             place_object(otmp, nx, ny);
2123             if (!nobreak && !IS_SOFT(levl[nx][ny].typ)) {
2124                 if (where == MIGR_WITH_HERO) {
2125                     if (breaks(otmp, nx, ny))
2126                         continue;
2127                 } else if (breaktest(otmp)) {
2128                     /* assume it broke before player arrived, no messages */
2129                     delobj(otmp);
2130                     continue;
2131                 }
2132             }
2133             stackobj(otmp);
2134             if (!noscatter)
2135                 (void) scatter(nx, ny, rnd(2), 0, otmp);
2136             else
2137                 newsym(nx, ny);
2138         } else { /* random location */
2139             /* set dummy coordinates because there's no
2140                current position for rloco() to update */
2141             otmp->ox = otmp->oy = 0;
2142             if (rloco(otmp) && !nobreak && breaktest(otmp)) {
2143                 /* assume it broke before player arrived, no messages */
2144                 delobj(otmp);
2145             }
2146         }
2147     }
2148 }
2149
2150 void
2151 deliver_obj_to_mon(mtmp, cnt, deliverflags)
2152 int cnt;
2153 struct monst *mtmp;
2154 unsigned long deliverflags;
2155 {
2156     struct obj *otmp, *otmp2;
2157     int where, maxobj = 1;
2158     boolean at_crime_scene = In_mines(&u.uz);
2159
2160     if ((deliverflags & DF_RANDOM) && cnt > 1)
2161         maxobj = rnd(cnt);
2162     else if (deliverflags & DF_ALL)
2163         maxobj = 0;
2164     else
2165         maxobj = 1;
2166
2167     cnt = 0;
2168     for (otmp = migrating_objs; otmp; otmp = otmp2) {
2169         otmp2 = otmp->nobj;
2170         where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
2171         if ((where & MIGR_TO_SPECIES) == 0)
2172             continue;
2173
2174         if ((mtmp->data->mflags2 & otmp->corpsenm) != 0) {
2175             obj_extract_self(otmp);
2176             otmp->owornmask = 0L;
2177             otmp->ox = otmp->oy = 0;
2178
2179             /* special treatment for orcs and their kind */
2180             if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) {
2181                 if (!has_mname(mtmp)) {
2182                     if (at_crime_scene || !rn2(2))
2183                         mtmp = christen_orc(mtmp,
2184                                             at_crime_scene ? ONAME(otmp)
2185                                                            : (char *) 0,
2186                                             /* bought the stolen goods */
2187                                             " the Fence");
2188                 }
2189                 free_oname(otmp);
2190             }
2191             otmp->corpsenm = 0;
2192             (void) add_to_minv(mtmp, otmp);
2193             cnt++;
2194             if (maxobj && cnt >= maxobj)
2195                 break;
2196             /* getting here implies DF_ALL */
2197         }
2198     }
2199 }
2200
2201 STATIC_OVL void
2202 otransit_msg(otmp, nodrop, num)
2203 register struct obj *otmp;
2204 register boolean nodrop;
2205 long num;
2206 {
2207     char *optr = 0, obuf[BUFSZ], xbuf[BUFSZ];
2208
2209 #if 0 /*JP*/
2210     if (otmp->otyp == CORPSE) {
2211         /* Tobjnam() calls xname() and would yield "The corpse";
2212            we want more specific "The newt corpse" or "Medusa's corpse" */
2213         optr = upstart(corpse_xname(otmp, (char *) 0, CXN_PFX_THE));
2214     } else {
2215         optr = Tobjnam(otmp, (char *) 0);
2216     }
2217     Strcpy(obuf, optr);
2218 #else
2219     Sprintf(obuf, "%s\82Í", xname(otmp));
2220 #endif
2221
2222     if (num) { /* means: other objects are impacted */
2223         /* 3.6.2: use a separate buffer for the suffix to avoid risk of
2224            overrunning obuf[] (let pline() handle truncation if necessary) */
2225 #if 0 /*JP*/
2226         Sprintf(xbuf, " %s %s object%s", otense(otmp, "hit"),
2227                 (num == 1L) ? "another" : "other", (num > 1L) ? "s" : "");
2228         if (nodrop)
2229             Sprintf(eos(xbuf), ".");
2230         else
2231             Sprintf(eos(xbuf), " and %s %s.", otense(otmp, "fall"), gate_str);
2232 #else
2233         Sprintf(xbuf, "\91¼\82Ì\95¨\91Ì\82É\96½\92\86\82µ\82Ä");
2234         if(nodrop)
2235             Sprintf(eos(xbuf), "\8e~\82Ü\82Á\82½\81D");
2236         else
2237             Sprintf(eos(xbuf), "%s\97\8e\82¿\82½\81D", gate_str);
2238 #endif
2239         pline("%s%s", obuf, xbuf);
2240     } else if (!nodrop)
2241 /*JP
2242         pline("%s %s %s.", obuf, otense(otmp, "fall"), gate_str);
2243 */
2244         pline("%s%s\97\8e\82¿\82½\81D", obuf, gate_str);
2245 }
2246
2247 /* migration destination for objects which fall down to next level */
2248 schar
2249 down_gate(x, y)
2250 xchar x, y;
2251 {
2252     struct trap *ttmp;
2253
2254     gate_str = 0;
2255     /* this matches the player restriction in goto_level() */
2256     if (on_level(&u.uz, &qstart_level) && !ok_to_quest())
2257         return MIGR_NOWHERE;
2258
2259     if ((xdnstair == x && ydnstair == y)
2260         || (sstairs.sx == x && sstairs.sy == y && !sstairs.up)) {
2261 /*JP
2262         gate_str = "down the stairs";
2263 */
2264         gate_str = "\8aK\92i\82©\82ç";
2265         return (xdnstair == x && ydnstair == y) ? MIGR_STAIRS_UP
2266                                                 : MIGR_SSTAIRS;
2267     }
2268     if (xdnladder == x && ydnladder == y) {
2269 /*JP
2270         gate_str = "down the ladder";
2271 */
2272         gate_str = "\82Í\82µ\82²\82©\82ç";
2273         return MIGR_LADDER_UP;
2274     }
2275
2276     if (((ttmp = t_at(x, y)) != 0 && ttmp->tseen)
2277         && is_hole(ttmp->ttyp)) {
2278 #if 0 /*JP*/
2279         gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
2280                                             : "through the hole";
2281 #else
2282         gate_str = (ttmp->ttyp == TRAPDOOR) ? "\97\8e\82µ\94à\82É"
2283                                             : "\8c\8a\82É";
2284 #endif
2285         return MIGR_RANDOM;
2286     }
2287     return MIGR_NOWHERE;
2288 }
2289
2290 /*dokick.c*/