OSDN Git Service

update year to 2020
[jnethack/source.git] / src / dokick.c
1 /* NetHack 3.6  dokick.c        $NHDT-Date: 1575245057 2019/12/02 00:04:17 $  $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.136 $ */
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-2020            */
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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:T*/
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, 0);
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             altar_wrath(x, y);
1378             if (!rn2(3))
1379                 goto ouch;
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:T*/
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:T*/
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:T*/
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 (Blind && Deaf)
1569                     Sprintf(buf, " %s", body_part(FACE));
1570                 else
1571                     buf[0] = '\0';
1572 #if 0 /*JP:T*/
1573                 pline("%s%s%s.", !Deaf ? "Flupp! " : "",
1574                       !Blind
1575                           ? "Muddy waste pops up from the drain"
1576                           : !Deaf
1577                               ? "You hear a sloshing sound"  /* Deaf-aware */
1578                               : "Something splashes you in the", buf);
1579 #else
1580                 /*JP:TODO:\81u\8aç\82É\82©\82©\82Á\82½\81v\82Ì\8cê\8f\87\92²\90® */
1581                 pline("%s%s\81D", !Deaf ? "\82¤\82í\81I" : "",
1582                       !Blind
1583                           ? "\94r\90\85\8cû\82©\82ç\82Ç\82ë\82Ç\82ë\82Ì\94p\8aü\95¨\82ª\8fo\82Ä\82­\82é"
1584                           : !Deaf
1585                               ? "\82 \82È\82½\82Í\81C\83o\83`\83\83\83o\83`\83\83\82·\82é\89¹\82ð\95·\82¢\82½"  /* Deaf-aware */
1586                               : "\89½\82©\82ª\82 \82È\82½\82É\82©\82©\82Á\82½");
1587 #endif
1588                 if (!(maploc->looted & S_LRING)) { /* once per sink */
1589                     if (!Blind)
1590 /*JP
1591                         You_see("a ring shining in its midst.");
1592 */
1593                         You("\82»\82Ì\92\86\82É\8cõ\82é\8ew\97Ö\82ð\8c©\82Â\82¯\82½\81D");
1594                     (void) mkobj_at(RING_CLASS, x, y, TRUE);
1595                     newsym(x, y);
1596                     exercise(A_DEX, TRUE);
1597                     exercise(A_WIS, TRUE); /* a discovery! */
1598                     maploc->looted |= S_LRING;
1599                 }
1600                 return 1;
1601             }
1602             goto ouch;
1603         }
1604         if (maploc->typ == STAIRS || maploc->typ == LADDER
1605             || IS_STWALL(maploc->typ)) {
1606             if (!IS_STWALL(maploc->typ) && maploc->ladder == LA_DOWN)
1607                 goto dumb;
1608  ouch:
1609 /*JP
1610             pline("Ouch!  That hurts!");
1611 */
1612             pline("\82¢\82Ä\82Á\81I\89ö\89ä\82µ\82½\81I");
1613             exercise(A_DEX, FALSE);
1614             exercise(A_STR, FALSE);
1615             if (isok(x, y)) {
1616                 if (Blind)
1617                     feel_location(x, y); /* we know we hit it */
1618                 if (is_drawbridge_wall(x, y) >= 0) {
1619 /*JP
1620                     pline_The("drawbridge is unaffected.");
1621 */
1622                     pline("\92µ\82Ë\8b´\82Í\82Ñ\82­\82Æ\82à\82µ\82È\82¢\81D");
1623                     /* update maploc to refer to the drawbridge */
1624                     (void) find_drawbridge(&x, &y);
1625                     maploc = &levl[x][y];
1626                 }
1627             }
1628             if (!rn2(3))
1629                 set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
1630             dmg = rnd(ACURR(A_CON) > 15 ? 3 : 5);
1631             losehp(Maybe_Half_Phys(dmg), kickstr(buf, kickobjnam), KILLED_BY);
1632             if (Is_airlevel(&u.uz) || Levitation)
1633                 hurtle(-u.dx, -u.dy, rn1(2, 4), TRUE); /* assume it's heavy */
1634             return 1;
1635         }
1636         goto dumb;
1637     }
1638
1639     if (maploc->doormask == D_ISOPEN || maploc->doormask == D_BROKEN
1640         || maploc->doormask == D_NODOOR) {
1641  dumb:
1642         exercise(A_DEX, FALSE);
1643         if (martial() || ACURR(A_DEX) >= 16 || rn2(3)) {
1644 /*JP
1645             You("kick at empty space.");
1646 */
1647             You("\89½\82à\82È\82¢\8bó\8aÔ\82ð\8fR\82Á\82½\81D");
1648             if (Blind)
1649                 feel_location(x, y);
1650         } else {
1651 /*JP
1652             pline("Dumb move!  You strain a muscle.");
1653 */
1654             pline("\82Î\82©\82°\82½\93®\82«\82¾\81I\8bØ\93÷\82ð\92É\82ß\82½\81D");
1655             exercise(A_STR, FALSE);
1656             set_wounded_legs(RIGHT_SIDE, 5 + rnd(5));
1657         }
1658         if ((Is_airlevel(&u.uz) || Levitation) && rn2(2))
1659             hurtle(-u.dx, -u.dy, 1, TRUE);
1660         return 1; /* uses a turn */
1661     }
1662
1663     /* not enough leverage to kick open doors while levitating */
1664     if (Levitation)
1665         goto ouch;
1666
1667     exercise(A_DEX, TRUE);
1668     /* door is known to be CLOSED or LOCKED */
1669     if (rnl(35) < avrg_attrib + (!martial() ? 0 : ACURR(A_DEX))) {
1670         boolean shopdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
1671         /* break the door */
1672         if (maploc->doormask & D_TRAPPED) {
1673             if (flags.verbose)
1674 /*JP
1675                 You("kick the door.");
1676 */
1677                 You("\94à\82ð\8fR\82Á\82½\81D");
1678             exercise(A_STR, FALSE);
1679             maploc->doormask = D_NODOOR;
1680 /*JP
1681             b_trapped("door", FOOT);
1682 */
1683             b_trapped("\94à", FOOT);
1684         } else if (ACURR(A_STR) > 18 && !rn2(5) && !shopdoor) {
1685 /*JP
1686             pline("As you kick the door, it shatters to pieces!");
1687 */
1688             pline("\94à\82ð\8fR\82é\82Æ\81C\82±\82È\82²\82È\82É\82­\82¾\82¯\82½\81I");
1689             exercise(A_STR, TRUE);
1690             maploc->doormask = D_NODOOR;
1691         } else {
1692 /*JP
1693             pline("As you kick the door, it crashes open!");
1694 */
1695             pline("\94à\82ð\8fR\82é\82Æ\81C\89ó\82ê\82Ä\8aJ\82¢\82½\81I");
1696             exercise(A_STR, TRUE);
1697             maploc->doormask = D_BROKEN;
1698         }
1699         feel_newsym(x, y); /* we know we broke it */
1700         unblock_point(x, y); /* vision */
1701         if (shopdoor) {
1702             add_damage(x, y, SHOP_DOOR_COST);
1703 /*JP
1704             pay_for_damage("break", FALSE);
1705 */
1706             pay_for_damage("\94j\89ó\82·\82é", FALSE);
1707         }
1708         if (in_town(x, y))
1709             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1710                 if (DEADMONSTER(mtmp))
1711                     continue;
1712                 if (is_watch(mtmp->data) && couldsee(mtmp->mx, mtmp->my)
1713                     && mtmp->mpeaceful) {
1714 /*JP
1715                     mon_yells(mtmp, "Halt, thief!  You're under arrest!");
1716 */
1717                     mon_yells(mtmp, "\8e~\82Ü\82ê\93D\96_\81I\82¨\82Ü\82¦\82ð\91ß\95ß\82·\82é\81I");
1718                     (void) angry_guards(FALSE);
1719                     break;
1720                 }
1721             }
1722     } else {
1723         if (Blind)
1724             feel_location(x, y); /* we know we hit it */
1725         exercise(A_STR, TRUE);
1726 /*JP
1727         pline("WHAMMM!!!");
1728 */
1729         pline("\82®\82\9f\82\9f\82\9f\82ñ\81I");
1730         if (in_town(x, y))
1731             for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
1732                 if (DEADMONSTER(mtmp))
1733                     continue;
1734                 if (is_watch(mtmp->data) && mtmp->mpeaceful
1735                     && couldsee(mtmp->mx, mtmp->my)) {
1736                     if (levl[x][y].looted & D_WARNED) {
1737                         mon_yells(mtmp,
1738 /*JP
1739                                   "Halt, vandal!  You're under arrest!");
1740 */
1741                                   "\8e~\82Ü\82ê\96ì\94Ø\90l\81I\82¨\82Ü\82¦\82ð\91ß\95ß\82·\82é\81I");
1742                         (void) angry_guards(FALSE);
1743                     } else {
1744 /*JP
1745                         mon_yells(mtmp, "Hey, stop damaging that door!");
1746 */
1747                         mon_yells(mtmp, "\82¨\82¢\81C\94à\82ð\94j\89ó\82·\82é\82Ì\82ð\82â\82ß\82ë\81I");
1748                         levl[x][y].looted |= D_WARNED;
1749                     }
1750                     break;
1751                 }
1752             }
1753     }
1754     return 1;
1755 }
1756
1757 STATIC_OVL void
1758 drop_to(cc, loc)
1759 coord *cc;
1760 schar loc;
1761 {
1762     /* cover all the MIGR_xxx choices generated by down_gate() */
1763     switch (loc) {
1764     case MIGR_RANDOM: /* trap door or hole */
1765         if (Is_stronghold(&u.uz)) {
1766             cc->x = valley_level.dnum;
1767             cc->y = valley_level.dlevel;
1768             break;
1769         } else if (In_endgame(&u.uz) || Is_botlevel(&u.uz)) {
1770             cc->y = cc->x = 0;
1771             break;
1772         }
1773         /*FALLTHRU*/
1774     case MIGR_STAIRS_UP:
1775     case MIGR_LADDER_UP:
1776         cc->x = u.uz.dnum;
1777         cc->y = u.uz.dlevel + 1;
1778         break;
1779     case MIGR_SSTAIRS:
1780         cc->x = sstairs.tolev.dnum;
1781         cc->y = sstairs.tolev.dlevel;
1782         break;
1783     default:
1784     case MIGR_NOWHERE:
1785         /* y==0 means "nowhere", in which case x doesn't matter */
1786         cc->y = cc->x = 0;
1787         break;
1788     }
1789 }
1790
1791 /* player or missile impacts location, causing objects to fall down */
1792 void
1793 impact_drop(missile, x, y, dlev)
1794 struct obj *missile; /* caused impact, won't drop itself */
1795 xchar x, y;          /* location affected */
1796 xchar dlev;          /* if !0 send to dlev near player */
1797 {
1798     schar toloc;
1799     register struct obj *obj, *obj2;
1800     register struct monst *shkp;
1801     long oct, dct, price, debit, robbed;
1802     boolean angry, costly, isrock;
1803     coord cc;
1804
1805     if (!OBJ_AT(x, y))
1806         return;
1807
1808     toloc = down_gate(x, y);
1809     drop_to(&cc, toloc);
1810     if (!cc.y)
1811         return;
1812
1813     if (dlev) {
1814         /* send objects next to player falling through trap door.
1815          * checked in obj_delivery().
1816          */
1817         toloc = MIGR_WITH_HERO;
1818         cc.y = dlev;
1819     }
1820
1821     costly = costly_spot(x, y);
1822     price = debit = robbed = 0L;
1823     angry = FALSE;
1824     shkp = (struct monst *) 0;
1825     /* if 'costly', we must keep a record of ESHK(shkp) before
1826      * it undergoes changes through the calls to stolen_value.
1827      * the angry bit must be reset, if needed, in this fn, since
1828      * stolen_value is called under the 'silent' flag to avoid
1829      * unsavory pline repetitions.
1830      */
1831     if (costly) {
1832         if ((shkp = shop_keeper(*in_rooms(x, y, SHOPBASE))) != 0) {
1833             debit = ESHK(shkp)->debit;
1834             robbed = ESHK(shkp)->robbed;
1835             angry = !shkp->mpeaceful;
1836         }
1837     }
1838
1839     isrock = (missile && missile->otyp == ROCK);
1840     oct = dct = 0L;
1841     for (obj = level.objects[x][y]; obj; obj = obj2) {
1842         obj2 = obj->nexthere;
1843         if (obj == missile)
1844             continue;
1845         /* number of objects in the pile */
1846         oct += obj->quan;
1847         if (obj == uball || obj == uchain)
1848             continue;
1849         /* boulders can fall too, but rarely & never due to rocks */
1850         if ((isrock && obj->otyp == BOULDER)
1851             || rn2(obj->otyp == BOULDER ? 30 : 3))
1852             continue;
1853         obj_extract_self(obj);
1854
1855         if (costly) {
1856             price += stolen_value(obj, x, y,
1857                                   (costly_spot(u.ux, u.uy)
1858                                    && index(u.urooms,
1859                                             *in_rooms(x, y, SHOPBASE))),
1860                                   TRUE);
1861             /* set obj->no_charge to 0 */
1862             if (Has_contents(obj))
1863                 picked_container(obj); /* does the right thing */
1864             if (obj->oclass != COIN_CLASS)
1865                 obj->no_charge = 0;
1866         }
1867
1868         add_to_migration(obj);
1869         obj->ox = cc.x;
1870         obj->oy = cc.y;
1871         obj->owornmask = (long) toloc;
1872
1873         /* number of fallen objects */
1874         dct += obj->quan;
1875     }
1876
1877     if (dct && cansee(x, y)) { /* at least one object fell */
1878 /*JP
1879         const char *what = (dct == 1L ? "object falls" : "objects fall");
1880 */
1881         const char *what = "\95¨";
1882
1883         if (missile)
1884 #if 0 /*JP:T*/
1885             pline("From the impact, %sother %s.",
1886                   dct == oct ? "the " : dct == 1L ? "an" : "", what);
1887 #else
1888             pline("\8fÕ\8c\82\82Å\81C\91¼\82Ì%s\82ª\97\8e\82¿\82½\81D",what);
1889 #endif
1890         else if (oct == dct)
1891 #if 0 /*JP:T*/
1892             pline("%s adjacent %s %s.", dct == 1L ? "The" : "All the", what,
1893                   gate_str);
1894 #else
1895             pline("\8bß\82­\82É\82 \82Á\82½%s\82ª%s\97\8e\82¿\82½\81D", what, gate_str);
1896 #endif
1897         else
1898 #if 0 /*JP:T*/
1899             pline("%s adjacent %s %s.",
1900                   dct == 1L ? "One of the" : "Some of the",
1901                   dct == 1L ? "objects falls" : what, gate_str);
1902 #else
1903             pline("\8bß\82­\82É\82 \82Á\82½%s%s%s\97\8e\82¿\82½\81D",
1904                   what,
1905                   dct == 1L ? "\82ª" : "\82Ì\82¢\82­\82Â\82©\82ª",
1906                   gate_str);
1907 #endif
1908     }
1909
1910     if (costly && shkp && price) {
1911         if (ESHK(shkp)->robbed > robbed) {
1912 /*JP
1913             You("removed %ld %s worth of goods!", price, currency(price));
1914 */
1915             You("%ld%s\95ª\82Ì\95i\95¨\82ð\8eæ\82è\82³\82Á\82½\81I", price, currency(price));
1916             if (cansee(shkp->mx, shkp->my)) {
1917                 if (ESHK(shkp)->customer[0] == 0)
1918                     (void) strncpy(ESHK(shkp)->customer, plname, PL_NSIZ);
1919                 if (angry)
1920 /*JP
1921                     pline("%s is infuriated!", Monnam(shkp));
1922 */
1923                     pline("%s\82Í\8c\83\93{\82µ\82½\81I", Monnam(shkp));
1924                 else
1925 /*JP
1926                     pline("\"%s, you are a thief!\"", plname);
1927 */
1928                     pline("\81u%s\82ß\81C\82¨\82Ü\82¦\82Í\93D\96_\82¾\82È\81I\81v", plname);
1929             } else
1930 /*JP
1931                 You_hear("a scream, \"Thief!\"");
1932 */
1933                 You_hear("\8bà\90Ø\82è\90º\82ð\95·\82¢\82½\81u\93D\96_\81I\81v");
1934             hot_pursuit(shkp);
1935             (void) angry_guards(FALSE);
1936             return;
1937         }
1938         if (ESHK(shkp)->debit > debit) {
1939             long amt = (ESHK(shkp)->debit - debit);
1940 #if 0 /*JP:T*/
1941             You("owe %s %ld %s for goods lost.", Monnam(shkp), amt,
1942                 currency(amt));
1943 #else
1944             You("\95i\95¨\8fÁ\8e¸\82Ì\82½\82ß%s\82É%ld%s\82Ì\8eØ\82è\82ð\82Â\82­\82Á\82½\81D", Monnam(shkp), amt,
1945                 currency(amt));
1946 #endif
1947         }
1948     }
1949 }
1950
1951 /* NOTE: ship_object assumes otmp was FREED from fobj or invent.
1952  * <x,y> is the point of drop.  otmp is _not_ an <x,y> resident:
1953  * otmp is either a kicked, dropped, or thrown object.
1954  */
1955 boolean
1956 ship_object(otmp, x, y, shop_floor_obj)
1957 xchar x, y;
1958 struct obj *otmp;
1959 boolean shop_floor_obj;
1960 {
1961     schar toloc;
1962     xchar ox, oy;
1963     coord cc;
1964     struct obj *obj;
1965     struct trap *t;
1966     boolean nodrop, unpaid, container, impact = FALSE;
1967     long n = 0L;
1968
1969     if (!otmp)
1970         return FALSE;
1971     if ((toloc = down_gate(x, y)) == MIGR_NOWHERE)
1972         return FALSE;
1973     drop_to(&cc, toloc);
1974     if (!cc.y)
1975         return FALSE;
1976
1977     /* objects other than attached iron ball always fall down ladder,
1978        but have a chance of staying otherwise */
1979     nodrop = (otmp == uball) || (otmp == uchain)
1980              || (toloc != MIGR_LADDER_UP && rn2(3));
1981
1982     container = Has_contents(otmp);
1983     unpaid = is_unpaid(otmp);
1984
1985     if (OBJ_AT(x, y)) {
1986         for (obj = level.objects[x][y]; obj; obj = obj->nexthere)
1987             if (obj != otmp)
1988                 n += obj->quan;
1989         if (n)
1990             impact = TRUE;
1991     }
1992     /* boulders never fall through trap doors, but they might knock
1993        other things down before plugging the hole */
1994     if (otmp->otyp == BOULDER && ((t = t_at(x, y)) != 0)
1995         && is_hole(t->ttyp)) {
1996         if (impact)
1997             impact_drop(otmp, x, y, 0);
1998         return FALSE; /* let caller finish the drop */
1999     }
2000
2001     if (cansee(x, y))
2002         otransit_msg(otmp, nodrop, n);
2003
2004     if (nodrop) {
2005         if (impact)
2006             impact_drop(otmp, x, y, 0);
2007         return FALSE;
2008     }
2009
2010     if (unpaid || shop_floor_obj) {
2011         if (unpaid) {
2012             (void) stolen_value(otmp, u.ux, u.uy, TRUE, FALSE);
2013         } else {
2014             ox = otmp->ox;
2015             oy = otmp->oy;
2016             (void) stolen_value(
2017                 otmp, ox, oy,
2018                 (costly_spot(u.ux, u.uy)
2019                  && index(u.urooms, *in_rooms(ox, oy, SHOPBASE))),
2020                 FALSE);
2021         }
2022         /* set otmp->no_charge to 0 */
2023         if (container)
2024             picked_container(otmp); /* happens to do the right thing */
2025         if (otmp->oclass != COIN_CLASS)
2026             otmp->no_charge = 0;
2027     }
2028
2029     if (otmp->owornmask)
2030         remove_worn_item(otmp, TRUE);
2031
2032     /* some things break rather than ship */
2033     if (breaktest(otmp)) {
2034         const char *result;
2035
2036         if (objects[otmp->otyp].oc_material == GLASS
2037             || otmp->otyp == EXPENSIVE_CAMERA) {
2038             if (otmp->otyp == MIRROR)
2039                 change_luck(-2);
2040 /*JP
2041             result = "crash";
2042 */
2043             result = "\83O\83V\83\83\83b";
2044         } else {
2045             /* penalty for breaking eggs laid by you */
2046             if (otmp->otyp == EGG && otmp->spe && otmp->corpsenm >= LOW_PM)
2047                 change_luck((schar) -min(otmp->quan, 5L));
2048 /*JP
2049             result = "splat";
2050 */
2051             result = "\83x\83`\83\83\83b";
2052         }
2053 /*JP
2054         You_hear("a muffled %s.", result);
2055 */
2056         You_hear("\82±\82à\82Á\82½%s\82Æ\82¢\82¤\89¹\82ð\95·\82¢\82½\81D", result);
2057         obj_extract_self(otmp);
2058         obfree(otmp, (struct obj *) 0);
2059         return TRUE;
2060     }
2061
2062     add_to_migration(otmp);
2063     otmp->ox = cc.x;
2064     otmp->oy = cc.y;
2065     otmp->owornmask = (long) toloc;
2066     /* boulder from rolling boulder trap, no longer part of the trap */
2067     if (otmp->otyp == BOULDER)
2068         otmp->otrapped = 0;
2069
2070     if (impact) {
2071         /* the objs impacted may be in a shop other than
2072          * the one in which the hero is located.  another
2073          * check for a shk is made in impact_drop.  it is, e.g.,
2074          * possible to kick/throw an object belonging to one
2075          * shop into another shop through a gap in the wall,
2076          * and cause objects belonging to the other shop to
2077          * fall down a trap door--thereby getting two shopkeepers
2078          * angry at the hero in one shot.
2079          */
2080         impact_drop(otmp, x, y, 0);
2081         newsym(x, y);
2082     }
2083     return TRUE;
2084 }
2085
2086 void
2087 obj_delivery(near_hero)
2088 boolean near_hero;
2089 {
2090     register struct obj *otmp, *otmp2;
2091     register int nx, ny;
2092     int where;
2093     boolean nobreak, noscatter;
2094
2095     for (otmp = migrating_objs; otmp; otmp = otmp2) {
2096         otmp2 = otmp->nobj;
2097         if (otmp->ox != u.uz.dnum || otmp->oy != u.uz.dlevel)
2098             continue;
2099
2100         where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
2101         if ((where & MIGR_TO_SPECIES) != 0)
2102             continue;
2103
2104         nobreak = (where & MIGR_NOBREAK) != 0;
2105         noscatter = (where & MIGR_WITH_HERO) != 0;
2106         where &= ~(MIGR_NOBREAK | MIGR_NOSCATTER);
2107
2108         if (!near_hero ^ (where == MIGR_WITH_HERO))
2109             continue;
2110
2111         obj_extract_self(otmp);
2112         otmp->owornmask = 0L;
2113
2114         switch (where) {
2115         case MIGR_STAIRS_UP:
2116             nx = xupstair, ny = yupstair;
2117             break;
2118         case MIGR_LADDER_UP:
2119             nx = xupladder, ny = yupladder;
2120             break;
2121         case MIGR_SSTAIRS:
2122             nx = sstairs.sx, ny = sstairs.sy;
2123             break;
2124         case MIGR_WITH_HERO:
2125             nx = u.ux, ny = u.uy;
2126             break;
2127         default:
2128         case MIGR_RANDOM:
2129             nx = ny = 0;
2130             break;
2131         }
2132         if (nx > 0) {
2133             place_object(otmp, nx, ny);
2134             if (!nobreak && !IS_SOFT(levl[nx][ny].typ)) {
2135                 if (where == MIGR_WITH_HERO) {
2136                     if (breaks(otmp, nx, ny))
2137                         continue;
2138                 } else if (breaktest(otmp)) {
2139                     /* assume it broke before player arrived, no messages */
2140                     delobj(otmp);
2141                     continue;
2142                 }
2143             }
2144             stackobj(otmp);
2145             if (!noscatter)
2146                 (void) scatter(nx, ny, rnd(2), 0, otmp);
2147             else
2148                 newsym(nx, ny);
2149         } else { /* random location */
2150             /* set dummy coordinates because there's no
2151                current position for rloco() to update */
2152             otmp->ox = otmp->oy = 0;
2153             if (rloco(otmp) && !nobreak && breaktest(otmp)) {
2154                 /* assume it broke before player arrived, no messages */
2155                 delobj(otmp);
2156             }
2157         }
2158     }
2159 }
2160
2161 void
2162 deliver_obj_to_mon(mtmp, cnt, deliverflags)
2163 int cnt;
2164 struct monst *mtmp;
2165 unsigned long deliverflags;
2166 {
2167     struct obj *otmp, *otmp2;
2168     int where, maxobj = 1;
2169     boolean at_crime_scene = In_mines(&u.uz);
2170
2171     if ((deliverflags & DF_RANDOM) && cnt > 1)
2172         maxobj = rnd(cnt);
2173     else if (deliverflags & DF_ALL)
2174         maxobj = 0;
2175     else
2176         maxobj = 1;
2177
2178     cnt = 0;
2179     for (otmp = migrating_objs; otmp; otmp = otmp2) {
2180         otmp2 = otmp->nobj;
2181         where = (int) (otmp->owornmask & 0x7fffL); /* destination code */
2182         if ((where & MIGR_TO_SPECIES) == 0)
2183             continue;
2184
2185         if ((mtmp->data->mflags2 & otmp->corpsenm) != 0) {
2186             obj_extract_self(otmp);
2187             otmp->owornmask = 0L;
2188             otmp->ox = otmp->oy = 0;
2189
2190             /* special treatment for orcs and their kind */
2191             if ((otmp->corpsenm & M2_ORC) != 0 && has_oname(otmp)) {
2192                 if (!has_mname(mtmp)) {
2193                     if (at_crime_scene || !rn2(2))
2194                         mtmp = christen_orc(mtmp,
2195                                             at_crime_scene ? ONAME(otmp)
2196                                                            : (char *) 0,
2197                                             /* bought the stolen goods */
2198                                             " the Fence");
2199                 }
2200                 free_oname(otmp);
2201             }
2202             otmp->corpsenm = 0;
2203             (void) add_to_minv(mtmp, otmp);
2204             cnt++;
2205             if (maxobj && cnt >= maxobj)
2206                 break;
2207             /* getting here implies DF_ALL */
2208         }
2209     }
2210 }
2211
2212 STATIC_OVL void
2213 otransit_msg(otmp, nodrop, num)
2214 register struct obj *otmp;
2215 register boolean nodrop;
2216 long num;
2217 {
2218 #if 0 /*JP*/
2219     char *optr = 0, obuf[BUFSZ], xbuf[BUFSZ];
2220 #else
2221     char obuf[BUFSZ], xbuf[BUFSZ];
2222 #endif
2223
2224 #if 0 /*JP*/
2225     if (otmp->otyp == CORPSE) {
2226         /* Tobjnam() calls xname() and would yield "The corpse";
2227            we want more specific "The newt corpse" or "Medusa's corpse" */
2228         optr = upstart(corpse_xname(otmp, (char *) 0, CXN_PFX_THE));
2229     } else {
2230         optr = Tobjnam(otmp, (char *) 0);
2231     }
2232     Strcpy(obuf, optr);
2233 #else
2234     Sprintf(obuf, "%s\82Í", xname(otmp));
2235 #endif
2236
2237     if (num) { /* means: other objects are impacted */
2238         /* As of 3.6.2: use a separate buffer for the suffix to avoid risk of
2239            overrunning obuf[] (let pline() handle truncation if necessary) */
2240 #if 0 /*JP*/
2241         Sprintf(xbuf, " %s %s object%s", otense(otmp, "hit"),
2242                 (num == 1L) ? "another" : "other", (num > 1L) ? "s" : "");
2243         if (nodrop)
2244             Sprintf(eos(xbuf), ".");
2245         else
2246             Sprintf(eos(xbuf), " and %s %s.", otense(otmp, "fall"), gate_str);
2247 #else
2248         Sprintf(xbuf, "\91¼\82Ì\95¨\91Ì\82É\96½\92\86\82µ\82Ä");
2249         if(nodrop)
2250             Sprintf(eos(xbuf), "\8e~\82Ü\82Á\82½\81D");
2251         else
2252             Sprintf(eos(xbuf), "%s\97\8e\82¿\82½\81D", gate_str);
2253 #endif
2254         pline("%s%s", obuf, xbuf);
2255     } else if (!nodrop)
2256 /*JP
2257         pline("%s %s %s.", obuf, otense(otmp, "fall"), gate_str);
2258 */
2259         pline("%s%s\97\8e\82¿\82½\81D", obuf, gate_str);
2260 }
2261
2262 /* migration destination for objects which fall down to next level */
2263 schar
2264 down_gate(x, y)
2265 xchar x, y;
2266 {
2267     struct trap *ttmp;
2268
2269     gate_str = 0;
2270     /* this matches the player restriction in goto_level() */
2271     if (on_level(&u.uz, &qstart_level) && !ok_to_quest())
2272         return MIGR_NOWHERE;
2273
2274     if ((xdnstair == x && ydnstair == y)
2275         || (sstairs.sx == x && sstairs.sy == y && !sstairs.up)) {
2276 /*JP
2277         gate_str = "down the stairs";
2278 */
2279         gate_str = "\8aK\92i\82©\82ç";
2280         return (xdnstair == x && ydnstair == y) ? MIGR_STAIRS_UP
2281                                                 : MIGR_SSTAIRS;
2282     }
2283     if (xdnladder == x && ydnladder == y) {
2284 /*JP
2285         gate_str = "down the ladder";
2286 */
2287         gate_str = "\82Í\82µ\82²\82©\82ç";
2288         return MIGR_LADDER_UP;
2289     }
2290
2291     if (((ttmp = t_at(x, y)) != 0 && ttmp->tseen)
2292         && is_hole(ttmp->ttyp)) {
2293 #if 0 /*JP:T*/
2294         gate_str = (ttmp->ttyp == TRAPDOOR) ? "through the trap door"
2295                                             : "through the hole";
2296 #else
2297         gate_str = (ttmp->ttyp == TRAPDOOR) ? "\97\8e\82µ\94à\82É"
2298                                             : "\8c\8a\82É";
2299 #endif
2300         return MIGR_RANDOM;
2301     }
2302     return MIGR_NOWHERE;
2303 }
2304
2305 /*dokick.c*/