OSDN Git Service

add translation
[jnethack/source.git] / src / uhitm.c
1 /* NetHack 3.6  uhitm.c $NHDT-Date: 1446887537 2015/11/07 09:12:17 $  $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
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-2016            */
8 /* JNetHack may be freely redistributed.  See license for details. */
9
10 #include "hack.h"
11
12 STATIC_DCL boolean FDECL(known_hitum, (struct monst *, struct obj *, int *,
13                                        int, int, struct attack *));
14 STATIC_DCL boolean FDECL(theft_petrifies, (struct obj *));
15 STATIC_DCL void FDECL(steal_it, (struct monst *, struct attack *));
16 STATIC_DCL boolean FDECL(hitum, (struct monst *, struct attack *));
17 STATIC_DCL boolean FDECL(hmon_hitmon, (struct monst *, struct obj *, int));
18 STATIC_DCL int FDECL(joust, (struct monst *, struct obj *));
19 STATIC_DCL void NDECL(demonpet);
20 STATIC_DCL boolean FDECL(m_slips_free, (struct monst * mtmp,
21                                         struct attack *mattk));
22 STATIC_DCL int FDECL(explum, (struct monst *, struct attack *));
23 STATIC_DCL void FDECL(start_engulf, (struct monst *));
24 STATIC_DCL void NDECL(end_engulf);
25 STATIC_DCL int FDECL(gulpum, (struct monst *, struct attack *));
26 STATIC_DCL boolean FDECL(hmonas, (struct monst *));
27 STATIC_DCL void FDECL(nohandglow, (struct monst *));
28 STATIC_DCL boolean FDECL(shade_aware, (struct obj *));
29
30 extern boolean notonhead; /* for long worms */
31 /* The below might become a parameter instead if we use it a lot */
32 static int dieroll;
33 /* Used to flag attacks caused by Stormbringer's maliciousness. */
34 static boolean override_confirmation = FALSE;
35
36 #define PROJECTILE(obj) ((obj) && is_ammo(obj))
37
38 void
39 erode_armor(mdef, hurt)
40 struct monst *mdef;
41 int hurt;
42 {
43     struct obj *target;
44
45     /* What the following code does: it keeps looping until it
46      * finds a target for the rust monster.
47      * Head, feet, etc... not covered by metal, or covered by
48      * rusty metal, are not targets.  However, your body always
49      * is, no matter what covers it.
50      */
51     while (1) {
52         switch (rn2(5)) {
53         case 0:
54             target = which_armor(mdef, W_ARMH);
55             if (!target
56                 || erode_obj(target, xname(target), hurt, EF_GREASE)
57                        == ER_NOTHING)
58                 continue;
59             break;
60         case 1:
61             target = which_armor(mdef, W_ARMC);
62             if (target) {
63                 (void) erode_obj(target, xname(target), hurt,
64                                  EF_GREASE | EF_VERBOSE);
65                 break;
66             }
67             if ((target = which_armor(mdef, W_ARM)) != (struct obj *) 0) {
68                 (void) erode_obj(target, xname(target), hurt,
69                                  EF_GREASE | EF_VERBOSE);
70             } else if ((target = which_armor(mdef, W_ARMU))
71                        != (struct obj *) 0) {
72                 (void) erode_obj(target, xname(target), hurt,
73                                  EF_GREASE | EF_VERBOSE);
74             }
75             break;
76         case 2:
77             target = which_armor(mdef, W_ARMS);
78             if (!target
79                 || erode_obj(target, xname(target), hurt, EF_GREASE)
80                        == ER_NOTHING)
81                 continue;
82             break;
83         case 3:
84             target = which_armor(mdef, W_ARMG);
85             if (!target
86                 || erode_obj(target, xname(target), hurt, EF_GREASE)
87                        == ER_NOTHING)
88                 continue;
89             break;
90         case 4:
91             target = which_armor(mdef, W_ARMF);
92             if (!target
93                 || erode_obj(target, xname(target), hurt, EF_GREASE)
94                        == ER_NOTHING)
95                 continue;
96             break;
97         }
98         break; /* Out of while loop */
99     }
100 }
101
102 /* FALSE means it's OK to attack */
103 boolean
104 attack_checks(mtmp, wep)
105 register struct monst *mtmp;
106 struct obj *wep; /* uwep for attack(), null for kick_monster() */
107 {
108     char qbuf[QBUFSZ];
109
110     /* if you're close enough to attack, alert any waiting monster */
111     mtmp->mstrategy &= ~STRAT_WAITMASK;
112
113     if (u.uswallow && mtmp == u.ustuck)
114         return FALSE;
115
116     if (context.forcefight) {
117         /* Do this in the caller, after we checked that the monster
118          * didn't die from the blow.  Reason: putting the 'I' there
119          * causes the hero to forget the square's contents since
120          * both 'I' and remembered contents are stored in .glyph.
121          * If the monster dies immediately from the blow, the 'I' will
122          * not stay there, so the player will have suddenly forgotten
123          * the square's contents for no apparent reason.
124         if (!canspotmon(mtmp)
125             && !glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph))
126             map_invisible(bhitpos.x, bhitpos.y);
127          */
128         return FALSE;
129     }
130
131     /* Put up an invisible monster marker, but with exceptions for
132      * monsters that hide and monsters you've been warned about.
133      * The former already prints a warning message and
134      * prevents you from hitting the monster just via the hidden monster
135      * code below; if we also did that here, similar behavior would be
136      * happening two turns in a row.  The latter shows a glyph on
137      * the screen, so you know something is there.
138      */
139     if (!canspotmon(mtmp) && !glyph_is_warning(glyph_at(bhitpos.x, bhitpos.y))
140         && !glyph_is_invisible(levl[bhitpos.x][bhitpos.y].glyph)
141         && !(!Blind && mtmp->mundetected && hides_under(mtmp->data))) {
142 /*JP
143         pline("Wait!  There's %s there you can't see!", something);
144 */
145         pline("\82¿\82å\82Á\82Æ\91Ò\82Á\82½\81I\8ep\82Ì\8c©\82¦\82È\82¢%s\82ª\82¢\82é\81I", something);
146         map_invisible(bhitpos.x, bhitpos.y);
147         /* if it was an invisible mimic, treat it as if we stumbled
148          * onto a visible mimic
149          */
150         if (mtmp->m_ap_type && !Protection_from_shape_changers
151             /* applied pole-arm attack is too far to get stuck */
152             && distu(mtmp->mx, mtmp->my) <= 2) {
153             if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
154                 u.ustuck = mtmp;
155         }
156         wakeup(mtmp); /* always necessary; also un-mimics mimics */
157         return TRUE;
158     }
159
160     if (mtmp->m_ap_type && !Protection_from_shape_changers && !sensemon(mtmp)
161         && !glyph_is_warning(glyph_at(bhitpos.x, bhitpos.y))) {
162         /* If a hidden mimic was in a square where a player remembers
163          * some (probably different) unseen monster, the player is in
164          * luck--he attacks it even though it's hidden.
165          */
166         if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) {
167             seemimic(mtmp);
168             return FALSE;
169         }
170         stumble_onto_mimic(mtmp);
171         return TRUE;
172     }
173
174     if (mtmp->mundetected && !canseemon(mtmp)
175         && !glyph_is_warning(glyph_at(bhitpos.x, bhitpos.y))
176         && (hides_under(mtmp->data) || mtmp->data->mlet == S_EEL)) {
177         mtmp->mundetected = mtmp->msleeping = 0;
178         newsym(mtmp->mx, mtmp->my);
179         if (glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph)) {
180             seemimic(mtmp);
181             return FALSE;
182         }
183         if (!((Blind ? Blind_telepat : Unblind_telepat) || Detect_monsters)) {
184             struct obj *obj;
185
186             if (Blind || (is_pool(mtmp->mx, mtmp->my) && !Underwater))
187 /*JP
188                 pline("Wait!  There's a hidden monster there!");
189 */
190                 pline("\91Ò\82Ä\81I\89ö\95¨\82ª\89B\82ê\82Ä\82¢\82é\81I");
191             else if ((obj = level.objects[mtmp->mx][mtmp->my]) != 0)
192 #if 0 /*JP*/
193                 pline("Wait!  There's %s hiding under %s!",
194                       an(l_monnam(mtmp)), doname(obj));
195 #else
196                 pline("\91Ò\82Ä\81I%s\82Ì\89º\82É%s\82ª\89B\82ê\82Ä\82¢\82é\81I",
197                       doname(obj), l_monnam(mtmp));
198 #endif
199             return TRUE;
200         }
201     }
202
203     /*
204      * make sure to wake up a monster from the above cases if the
205      * hero can sense that the monster is there.
206      */
207     if ((mtmp->mundetected || mtmp->m_ap_type) && sensemon(mtmp)) {
208         mtmp->mundetected = 0;
209         wakeup(mtmp);
210     }
211
212     if (flags.confirm && mtmp->mpeaceful && !Confusion && !Hallucination
213         && !Stunned) {
214         /* Intelligent chaotic weapons (Stormbringer) want blood */
215         if (wep && wep->oartifact == ART_STORMBRINGER) {
216             override_confirmation = TRUE;
217             return FALSE;
218         }
219         if (canspotmon(mtmp)) {
220 /*JP
221             Sprintf(qbuf, "Really attack %s?", mon_nam(mtmp));
222 */
223             Sprintf(qbuf, "\96{\93\96\82É%s\82ð\8dU\8c\82\82·\82é\82Ì\81H", mon_nam(mtmp));
224             if (!paranoid_query(ParanoidHit, qbuf)) {
225                 context.move = 0;
226                 return TRUE;
227             }
228         }
229     }
230
231     return FALSE;
232 }
233
234 /*
235  * It is unchivalrous for a knight to attack the defenseless or from behind.
236  */
237 void
238 check_caitiff(mtmp)
239 struct monst *mtmp;
240 {
241     if (u.ualign.record <= -10)
242         return;
243
244     if (Role_if(PM_KNIGHT) && u.ualign.type == A_LAWFUL
245         && (!mtmp->mcanmove || mtmp->msleeping
246             || (mtmp->mflee && !mtmp->mavenge))) {
247 /*JP
248         You("caitiff!");
249 */
250         pline("\82±\82ê\82Í\94Ú\8b¯\82È\8ds\82¢\82¾\81I");
251         adjalign(-1);
252     } else if (Role_if(PM_SAMURAI) && mtmp->mpeaceful) {
253         /* attacking peaceful creatures is bad for the samurai's giri */
254 /*JP
255         You("dishonorably attack the innocent!");
256 */
257         pline("\96³\8eÀ\82Ì\8eÒ\82ð\8dU\8c\82\82·\82é\82Ì\82Í\95s\96¼\97_\82¾\81I");
258         adjalign(-1);
259     }
260 }
261
262 int
263 find_roll_to_hit(mtmp, aatyp, weapon, attk_count, role_roll_penalty)
264 register struct monst *mtmp;
265 uchar aatyp;        /* usually AT_WEAP or AT_KICK */
266 struct obj *weapon; /* uwep or uswapwep or NULL */
267 int *attk_count, *role_roll_penalty;
268 {
269     int tmp, tmp2;
270
271     *role_roll_penalty = 0; /* default is `none' */
272
273     tmp = 1 + Luck + abon() + find_mac(mtmp) + u.uhitinc
274           + maybe_polyd(youmonst.data->mlevel, u.ulevel);
275
276     /* some actions should occur only once during multiple attacks */
277     if (!(*attk_count)++) {
278         /* knight's chivalry or samurai's giri */
279         check_caitiff(mtmp);
280     }
281
282     /* adjust vs. (and possibly modify) monster state */
283     if (mtmp->mstun)
284         tmp += 2;
285     if (mtmp->mflee)
286         tmp += 2;
287
288     if (mtmp->msleeping) {
289         mtmp->msleeping = 0;
290         tmp += 2;
291     }
292     if (!mtmp->mcanmove) {
293         tmp += 4;
294         if (!rn2(10)) {
295             mtmp->mcanmove = 1;
296             mtmp->mfrozen = 0;
297         }
298     }
299
300     /* role/race adjustments */
301     if (Role_if(PM_MONK) && !Upolyd) {
302         if (uarm)
303             tmp -= (*role_roll_penalty = urole.spelarmr);
304         else if (!uwep && !uarms)
305             tmp += (u.ulevel / 3) + 2;
306     }
307     if (is_orc(mtmp->data)
308         && maybe_polyd(is_elf(youmonst.data), Race_if(PM_ELF)))
309         tmp++;
310
311     /* encumbrance: with a lot of luggage, your agility diminishes */
312     if ((tmp2 = near_capacity()) != 0)
313         tmp -= (tmp2 * 2) - 1;
314     if (u.utrap)
315         tmp -= 3;
316
317     /*
318      * hitval applies if making a weapon attack while wielding a weapon;
319      * weapon_hit_bonus applies if doing a weapon attack even bare-handed
320      * or if kicking as martial artist
321      */
322     if (aatyp == AT_WEAP || aatyp == AT_CLAW) {
323         if (weapon)
324             tmp += hitval(weapon, mtmp);
325         tmp += weapon_hit_bonus(weapon);
326     } else if (aatyp == AT_KICK && martial_bonus()) {
327         tmp += weapon_hit_bonus((struct obj *) 0);
328     }
329
330     return tmp;
331 }
332
333 /* try to attack; return False if monster evaded;
334    u.dx and u.dy must be set */
335 boolean
336 attack(mtmp)
337 register struct monst *mtmp;
338 {
339     register struct permonst *mdat = mtmp->data;
340
341     /* This section of code provides protection against accidentally
342      * hitting peaceful (like '@') and tame (like 'd') monsters.
343      * Protection is provided as long as player is not: blind, confused,
344      * hallucinating or stunned.
345      * changes by wwp 5/16/85
346      * More changes 12/90, -dkh-. if its tame and safepet, (and protected
347      * 07/92) then we assume that you're not trying to attack. Instead,
348      * you'll usually just swap places if this is a movement command
349      */
350     /* Intelligent chaotic weapons (Stormbringer) want blood */
351     if (is_safepet(mtmp) && !context.forcefight) {
352         if (!uwep || uwep->oartifact != ART_STORMBRINGER) {
353             /* there are some additional considerations: this won't work
354              * if in a shop or Punished or you miss a random roll or
355              * if you can walk thru walls and your pet cannot (KAA) or
356              * if your pet is a long worm (unless someone does better).
357              * there's also a chance of displacing a "frozen" monster.
358              * sleeping monsters might magically walk in their sleep.
359              */
360             boolean foo = (Punished || !rn2(7) || is_longworm(mtmp->data)),
361                     inshop = FALSE;
362             char *p;
363
364             for (p = in_rooms(mtmp->mx, mtmp->my, SHOPBASE); *p; p++)
365                 if (tended_shop(&rooms[*p - ROOMOFFSET])) {
366                     inshop = TRUE;
367                     break;
368                 }
369
370             if (inshop || foo || (IS_ROCK(levl[u.ux][u.uy].typ)
371                                   && !passes_walls(mtmp->data))) {
372                 char buf[BUFSZ];
373
374                 monflee(mtmp, rnd(6), FALSE, FALSE);
375                 Strcpy(buf, y_monnam(mtmp));
376                 buf[0] = highc(buf[0]);
377 /*JP
378                 You("stop.  %s is in the way!", buf);
379 */
380                 You("\8e~\82Ü\82Á\82½\81D%s\82ª\93¹\82É\82¢\82é\81I", buf);
381                 return TRUE;
382             } else if ((mtmp->mfrozen || (!mtmp->mcanmove)
383                         || (mtmp->data->mmove == 0)) && rn2(6)) {
384 /*JP
385                 pline("%s doesn't seem to move!", Monnam(mtmp));
386 */
387                 pline("%s\82Í\93®\82¯\82È\82¢\82æ\82¤\82¾\81I", Monnam(mtmp));
388                 return TRUE;
389             } else
390                 return FALSE;
391         }
392     }
393
394     /* possibly set in attack_checks;
395        examined in known_hitum, called via hitum or hmonas below */
396     override_confirmation = FALSE;
397     /* attack_checks() used to use <u.ux+u.dx,u.uy+u.dy> directly, now
398        it uses bhitpos instead; it might map an invisible monster there */
399     bhitpos.x = u.ux + u.dx;
400     bhitpos.y = u.uy + u.dy;
401     if (attack_checks(mtmp, uwep))
402         return TRUE;
403
404     if (Upolyd && noattacks(youmonst.data)) {
405         /* certain "pacifist" monsters don't attack */
406 /*JP
407         You("have no way to attack monsters physically.");
408 */
409         You("\95¨\97\9d\93I\82É\89ö\95¨\82ð\8dU\8c\82\82·\82é\82·\82×\82ª\82È\82¢\81D");
410         mtmp->mstrategy &= ~STRAT_WAITMASK;
411         goto atk_done;
412     }
413
414 /*JP
415     if (check_capacity("You cannot fight while so heavily loaded.")
416 */
417     if (check_capacity("\82 \82È\82½\82Í\95¨\82ð\82½\82­\82³\82ñ\8e\9d\82¿\82·\82¬\82Ä\90í\82¦\82È\82¢\81D")
418         /* consume extra nutrition during combat; maybe pass out */
419         || overexertion())
420         goto atk_done;
421
422     if (u.twoweap && !can_twoweapon())
423         untwoweapon();
424
425     if (unweapon) {
426         unweapon = FALSE;
427         if (flags.verbose) {
428             if (uwep)
429 /*JP
430                 You("begin bashing monsters with %s.",
431 */
432                 You("%s\82Å\89ö\95¨\82ð\82È\82®\82è\82Â\82¯\82½\81D",
433                     yobjnam(uwep, (char *) 0));
434             else if (!cantwield(youmonst.data))
435 #if 0 /*JP*/
436                 You("begin %sing monsters with your %s %s.",
437                     Role_if(PM_MONK) ? "strik" : "bash",
438                     uarmg ? "gloved" : "bare", /* Del Lamb */
439                     makeplural(body_part(HAND)));
440 #else
441                 You("%s%s\82Å\89ö\95¨\82ð%s\82Â\82¯\82½\81D",
442                     uarmg ? "\83O\83\8d\81[\83u\82ð\95t\82¯\82½" : "\91f",
443                     body_part(HAND),
444                     Role_if(PM_MONK) ? "\91Å\82¿" : "\82È\82®\82è");
445 #endif
446         }
447     }
448     exercise(A_STR, TRUE); /* you're exercising muscles */
449     /* andrew@orca: prevent unlimited pick-axe attacks */
450     u_wipe_engr(3);
451
452     /* Is the "it died" check actually correct? */
453     if (mdat->mlet == S_LEPRECHAUN && !mtmp->mfrozen && !mtmp->msleeping
454         && !mtmp->mconf && mtmp->mcansee && !rn2(7)
455         && (m_move(mtmp, 0) == 2 /* it died */
456             || mtmp->mx != u.ux + u.dx
457             || mtmp->my != u.uy + u.dy)) /* it moved */
458         return FALSE;
459
460     if (Upolyd)
461         (void) hmonas(mtmp);
462     else
463         (void) hitum(mtmp, youmonst.data->mattk);
464     mtmp->mstrategy &= ~STRAT_WAITMASK;
465
466 atk_done:
467     /* see comment in attack_checks() */
468     /* we only need to check for this if we did an attack_checks()
469      * and it returned 0 (it's okay to attack), and the monster didn't
470      * evade.
471      */
472     if (context.forcefight && mtmp->mhp > 0 && !canspotmon(mtmp)
473         && !glyph_is_invisible(levl[u.ux + u.dx][u.uy + u.dy].glyph)
474         && !(u.uswallow && mtmp == u.ustuck))
475         map_invisible(u.ux + u.dx, u.uy + u.dy);
476
477     return TRUE;
478 }
479
480 /* really hit target monster; returns TRUE if it still lives */
481 STATIC_OVL boolean
482 known_hitum(mon, weapon, mhit, rollneeded, armorpenalty, uattk)
483 register struct monst *mon;
484 struct obj *weapon;
485 int *mhit;
486 int rollneeded, armorpenalty; /* for monks */
487 struct attack *uattk;
488 {
489     register boolean malive = TRUE;
490
491     if (override_confirmation) {
492         /* this may need to be generalized if weapons other than
493            Stormbringer acquire similar anti-social behavior... */
494         if (flags.verbose)
495 /*JP
496             Your("bloodthirsty blade attacks!");
497 */
498             Your("\95\90\8aí\82Í\8c\8c\82É\8bQ\82¦\82Ä\82¢\82é\81I");
499     }
500
501     if (!*mhit) {
502         missum(mon, uattk, (rollneeded + armorpenalty > dieroll));
503     } else {
504         int oldhp = mon->mhp, x = u.ux + u.dx, y = u.uy + u.dy;
505         long oldweaphit = u.uconduct.weaphit;
506
507         /* KMH, conduct */
508         if (weapon && (weapon->oclass == WEAPON_CLASS || is_weptool(weapon)))
509             u.uconduct.weaphit++;
510
511         /* we hit the monster; be careful: it might die or
512            be knocked into a different location */
513         notonhead = (mon->mx != x || mon->my != y);
514         malive = hmon(mon, weapon, HMON_MELEE);
515         if (malive) {
516             /* monster still alive */
517             if (!rn2(25) && mon->mhp < mon->mhpmax / 2
518                 && !(u.uswallow && mon == u.ustuck)) {
519                 /* maybe should regurgitate if swallowed? */
520                 monflee(mon, !rn2(3) ? rnd(100) : 0, FALSE, TRUE);
521
522                 if (u.ustuck == mon && !u.uswallow && !sticks(youmonst.data))
523                     u.ustuck = 0;
524             }
525             /* Vorpal Blade hit converted to miss */
526             /* could be headless monster or worm tail */
527             if (mon->mhp == oldhp) {
528                 *mhit = 0;
529                 /* a miss does not break conduct */
530                 u.uconduct.weaphit = oldweaphit;
531             }
532             if (mon->wormno && *mhit)
533                 cutworm(mon, x, y, weapon);
534         }
535     }
536     return malive;
537 }
538
539 /* hit target monster; returns TRUE if it still lives */
540 STATIC_OVL boolean
541 hitum(mon, uattk)
542 struct monst *mon;
543 struct attack *uattk;
544 {
545     boolean malive, wep_was_destroyed = FALSE;
546     struct obj *wepbefore = uwep;
547     int armorpenalty, attknum = 0, x = u.ux + u.dx, y = u.uy + u.dy,
548                       tmp = find_roll_to_hit(mon, uattk->aatyp, uwep,
549                                              &attknum, &armorpenalty);
550     int mhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
551
552     if (tmp > dieroll)
553         exercise(A_DEX, TRUE);
554     malive = known_hitum(mon, uwep, &mhit, tmp, armorpenalty, uattk);
555     /* second attack for two-weapon combat; won't occur if Stormbringer
556        overrode confirmation (assumes Stormbringer is primary weapon)
557        or if the monster was killed or knocked to different location */
558     if (u.twoweap && !override_confirmation && malive && m_at(x, y) == mon) {
559         tmp = find_roll_to_hit(mon, uattk->aatyp, uswapwep, &attknum,
560                                &armorpenalty);
561         mhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
562         malive = known_hitum(mon, uswapwep, &mhit, tmp, armorpenalty, uattk);
563     }
564     if (wepbefore && !uwep)
565         wep_was_destroyed = TRUE;
566     (void) passive(mon, mhit, malive, AT_WEAP, wep_was_destroyed);
567     return malive;
568 }
569
570 /* general "damage monster" routine; return True if mon still alive */
571 boolean
572 hmon(mon, obj, thrown)
573 struct monst *mon;
574 struct obj *obj;
575 int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
576 {
577     boolean result, anger_guards;
578
579     anger_guards = (mon->mpeaceful
580                     && (mon->ispriest || mon->isshk || is_watch(mon->data)));
581     result = hmon_hitmon(mon, obj, thrown);
582     if (mon->ispriest && !rn2(2))
583         ghod_hitsu(mon);
584     if (anger_guards)
585         (void) angry_guards(!!Deaf);
586     return result;
587 }
588
589 /* guts of hmon() */
590 STATIC_OVL boolean
591 hmon_hitmon(mon, obj, thrown)
592 struct monst *mon;
593 struct obj *obj;
594 int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */
595 {
596     int tmp;
597     struct permonst *mdat = mon->data;
598     int barehand_silver_rings = 0;
599     /* The basic reason we need all these booleans is that we don't want
600      * a "hit" message when a monster dies, so we have to know how much
601      * damage it did _before_ outputting a hit message, but any messages
602      * associated with the damage don't come out until _after_ outputting
603      * a hit message.
604      */
605     boolean hittxt = FALSE, destroyed = FALSE, already_killed = FALSE;
606     boolean get_dmg_bonus = TRUE;
607     boolean ispoisoned = FALSE, needpoismsg = FALSE, poiskilled = FALSE,
608             unpoisonmsg = FALSE;
609     boolean silvermsg = FALSE, silverobj = FALSE;
610     boolean valid_weapon_attack = FALSE;
611     boolean unarmed = !uwep && !uarm && !uarms;
612     boolean hand_to_hand = (thrown == HMON_MELEE
613                             /* not grapnels; applied implies uwep */
614                             || (thrown == HMON_APPLIED && is_pole(uwep)));
615     int jousting = 0;
616     int wtype;
617     struct obj *monwep;
618     char unconventional[BUFSZ]; /* substituted for word "attack" in msg */
619     char saved_oname[BUFSZ];
620
621     unconventional[0] = '\0';
622     saved_oname[0] = '\0';
623
624     wakeup(mon);
625     if (!obj) { /* attack with bare hands */
626         if (mdat == &mons[PM_SHADE])
627             tmp = 0;
628         else if (martial_bonus())
629             tmp = rnd(4); /* bonus for martial arts */
630         else
631             tmp = rnd(2);
632         valid_weapon_attack = (tmp > 1);
633         /* blessed gloves give bonuses when fighting 'bare-handed' */
634         if (uarmg && uarmg->blessed
635             && (is_undead(mdat) || is_demon(mdat) || is_vampshifter(mon)))
636             tmp += rnd(4);
637         /* So do silver rings.  Note: rings are worn under gloves, so you
638          * don't get both bonuses.
639          */
640         if (!uarmg) {
641             if (uleft && objects[uleft->otyp].oc_material == SILVER)
642                 barehand_silver_rings++;
643             if (uright && objects[uright->otyp].oc_material == SILVER)
644                 barehand_silver_rings++;
645             if (barehand_silver_rings && mon_hates_silver(mon)) {
646                 tmp += rnd(20);
647                 silvermsg = TRUE;
648             }
649         }
650     } else {
651         Strcpy(saved_oname, cxname(obj));
652         if (obj->oclass == WEAPON_CLASS || is_weptool(obj)
653             || obj->oclass == GEM_CLASS) {
654             /* is it not a melee weapon? */
655             if (/* if you strike with a bow... */
656                 is_launcher(obj)
657                 /* or strike with a missile in your hand... */
658                 || (!thrown && (is_missile(obj) || is_ammo(obj)))
659                 /* or use a pole at short range and not mounted... */
660                 || (!thrown && !u.usteed && is_pole(obj))
661                 /* or throw a missile without the proper bow... */
662                 || (is_ammo(obj) && (thrown != HMON_THROWN
663                                      || !ammo_and_launcher(obj, uwep)))) {
664                 /* then do only 1-2 points of damage */
665                 if (mdat == &mons[PM_SHADE] && !shade_glare(obj))
666                     tmp = 0;
667                 else
668                     tmp = rnd(2);
669                 if (objects[obj->otyp].oc_material == SILVER
670                     && mon_hates_silver(mon)) {
671                     silvermsg = TRUE;
672                     silverobj = TRUE;
673                     /* if it will already inflict dmg, make it worse */
674                     tmp += rnd((tmp) ? 20 : 10);
675                 }
676                 if (!thrown && obj == uwep && obj->otyp == BOOMERANG
677                     && rnl(4) == 4 - 1) {
678                     boolean more_than_1 = (obj->quan > 1L);
679
680 #if 0 /*JP*/
681                     pline("As you hit %s, %s%s breaks into splinters.",
682                           mon_nam(mon), more_than_1 ? "one of " : "",
683                           yname(obj));
684 #else
685                     pline("%s\82ð\8dU\8c\82\82·\82é\82Æ\81C%s%s\82Í\82±\82Á\82Ï\82Ý\82\82ñ\82É\82È\82Á\82½\81D",
686                           mon_nam(mon), yname(obj),
687                           more_than_1 ? "\82Ì\82Ð\82Æ\82Â" : "");
688 #endif
689                     if (!more_than_1)
690                         uwepgone(); /* set unweapon */
691                     useup(obj);
692                     if (!more_than_1)
693                         obj = (struct obj *) 0;
694                     hittxt = TRUE;
695                     if (mdat != &mons[PM_SHADE])
696                         tmp++;
697                 }
698             } else {
699                 tmp = dmgval(obj, mon);
700                 /* a minimal hit doesn't exercise proficiency */
701                 valid_weapon_attack = (tmp > 1);
702                 if (!valid_weapon_attack || mon == u.ustuck || u.twoweap) {
703                     ; /* no special bonuses */
704                 } else if (mon->mflee && Role_if(PM_ROGUE) && !Upolyd
705                            /* multi-shot throwing is too powerful here */
706                            && hand_to_hand) {
707 /*JP
708                     You("strike %s from behind!", mon_nam(mon));
709 */
710                     You("%s\82ð\94w\8cã\82©\82ç\8dU\8c\82\82µ\82½\81I", mon_nam(mon));
711                     tmp += rnd(u.ulevel);
712                     hittxt = TRUE;
713                 } else if (dieroll == 2 && obj == uwep
714                            && obj->oclass == WEAPON_CLASS
715                            && (bimanual(obj)
716                                || (Role_if(PM_SAMURAI) && obj->otyp == KATANA
717                                    && !uarms))
718                            && ((wtype = uwep_skill_type()) != P_NONE
719                                && P_SKILL(wtype) >= P_SKILLED)
720                            && ((monwep = MON_WEP(mon)) != 0
721                                && !is_flimsy(monwep)
722                                && !obj_resists(
723                                       monwep, 50 + 15 * greatest_erosion(obj),
724                                       100))) {
725                     /*
726                      * 2.5% chance of shattering defender's weapon when
727                      * using a two-handed weapon; less if uwep is rusted.
728                      * [dieroll == 2 is most successful non-beheading or
729                      * -bisecting hit, in case of special artifact damage;
730                      * the percentage chance is (1/20)*(50/100).]
731                      */
732                     setmnotwielded(mon, monwep);
733                     mon->weapon_check = NEED_WEAPON;
734 #if 0 /*JP*/
735                     pline("%s from the force of your blow!",
736                           Yobjnam2(monwep, "shatter"));
737 #else
738                     pline("%s\82Ì%s\82Í\82 \82È\82½\82Ì\88ê\8c\82\82Å\95²\81X\82É\82È\82Á\82½\81I",
739                           Monnam(mon), xname(monwep));
740 #endif
741                     m_useupall(mon, monwep);
742                     /* If someone just shattered MY weapon, I'd flee! */
743                     if (rn2(4)) {
744                         monflee(mon, d(2, 3), TRUE, TRUE);
745                     }
746                     hittxt = TRUE;
747                 }
748
749                 if (obj->oartifact
750                     && artifact_hit(&youmonst, mon, obj, &tmp, dieroll)) {
751                     if (mon->mhp <= 0) /* artifact killed monster */
752                         return FALSE;
753                     if (tmp == 0)
754                         return TRUE;
755                     hittxt = TRUE;
756                 }
757                 if (objects[obj->otyp].oc_material == SILVER
758                     && mon_hates_silver(mon)) {
759                     silvermsg = TRUE;
760                     silverobj = TRUE;
761                 }
762                 if (u.usteed && !thrown && tmp > 0
763                     && weapon_type(obj) == P_LANCE && mon != u.ustuck) {
764                     jousting = joust(mon, obj);
765                     /* exercise skill even for minimal damage hits */
766                     if (jousting)
767                         valid_weapon_attack = TRUE;
768                 }
769                 if (thrown == HMON_THROWN
770                     && (is_ammo(obj) || is_missile(obj))) {
771                     if (ammo_and_launcher(obj, uwep)) {
772                         /* Elves and Samurai do extra damage using
773                          * their bows&arrows; they're highly trained.
774                          */
775                         if (Role_if(PM_SAMURAI) && obj->otyp == YA
776                             && uwep->otyp == YUMI)
777                             tmp++;
778                         else if (Race_if(PM_ELF) && obj->otyp == ELVEN_ARROW
779                                  && uwep->otyp == ELVEN_BOW)
780                             tmp++;
781                     }
782                     if (obj->opoisoned && is_poisonable(obj))
783                         ispoisoned = TRUE;
784                 }
785             }
786         } else if (obj->oclass == POTION_CLASS) {
787             if (obj->quan > 1L)
788                 obj = splitobj(obj, 1L);
789             else
790                 setuwep((struct obj *) 0);
791             freeinv(obj);
792             potionhit(mon, obj, TRUE);
793             if (mon->mhp <= 0)
794                 return FALSE; /* killed */
795             hittxt = TRUE;
796             /* in case potion effect causes transformation */
797             mdat = mon->data;
798             tmp = (mdat == &mons[PM_SHADE]) ? 0 : 1;
799         } else {
800             if (mdat == &mons[PM_SHADE] && !shade_aware(obj)) {
801                 tmp = 0;
802 #if 0 /*JP*/
803                 Strcpy(unconventional, cxname(obj));
804 #endif
805             } else {
806                 switch (obj->otyp) {
807                 case BOULDER:         /* 1d20 */
808                 case HEAVY_IRON_BALL: /* 1d25 */
809                 case IRON_CHAIN:      /* 1d4+1 */
810                     tmp = dmgval(obj, mon);
811                     break;
812                 case MIRROR:
813                     if (breaktest(obj)) {
814 /*JP
815                         You("break %s.  That's bad luck!", ysimple_name(obj));
816 */
817                         You("%s\8b¾\82ð\89ó\82µ\82Ä\82µ\82Ü\82Á\82½\81D\82±\82è\82á\82Ü\82¢\82Á\82½\81I", ysimple_name(obj));
818                         change_luck(-2);
819                         useup(obj);
820                         obj = (struct obj *) 0;
821                         unarmed = FALSE; /* avoid obj==0 confusion */
822                         get_dmg_bonus = FALSE;
823                         hittxt = TRUE;
824                     }
825                     tmp = 1;
826                     break;
827                 case EXPENSIVE_CAMERA:
828 /*JP
829                     You("succeed in destroying %s.  Congratulations!",
830 */
831                     You("%s\83J\83\81\83\89\82ð\89ó\82·\82±\82Æ\82ª\82Å\82«\82½\81D\82¨\82ß\82Å\82Æ\82¤\81I",
832                         ysimple_name(obj));
833                     release_camera_demon(obj, u.ux, u.uy);
834                     useup(obj);
835                     return TRUE;
836                 case CORPSE: /* fixed by polder@cs.vu.nl */
837                     if (touch_petrifies(&mons[obj->corpsenm])) {
838                         tmp = 1;
839                         hittxt = TRUE;
840 #if 0 /*JP*/
841                         You("hit %s with %s.", mon_nam(mon),
842                             corpse_xname(obj, (const char *) 0,
843                                          obj->dknown ? CXN_PFX_THE
844                                                      : CXN_ARTICLE));
845 #else
846                         You("%s\82ð%s\82Å\8dU\8c\82\82µ\82½\81D", mon_nam(mon),
847                             corpse_xname(obj, (const char *) 0,
848                                          obj->dknown ? CXN_PFX_THE
849                                                      : CXN_ARTICLE));
850 #endif
851                         obj->dknown = 1;
852                         if (!munstone(mon, TRUE))
853                             minstapetrify(mon, TRUE);
854                         if (resists_ston(mon))
855                             break;
856                         /* note: hp may be <= 0 even if munstoned==TRUE */
857                         return (boolean) (mon->mhp > 0);
858 #if 0
859                     } else if (touch_petrifies(mdat)) {
860                         ; /* maybe turn the corpse into a statue? */
861 #endif
862                     }
863                     tmp = (obj->corpsenm >= LOW_PM ? mons[obj->corpsenm].msize
864                                                    : 0) + 1;
865                     break;
866
867 #define useup_eggs(o)                    \
868     {                                    \
869         if (thrown)                      \
870             obfree(o, (struct obj *) 0); \
871         else                             \
872             useupall(o);                 \
873         o = (struct obj *) 0;            \
874     } /* now gone */
875                 case EGG: {
876                     long cnt = obj->quan;
877
878                     tmp = 1; /* nominal physical damage */
879                     get_dmg_bonus = FALSE;
880                     hittxt = TRUE; /* message always given */
881                     /* egg is always either used up or transformed, so next
882                        hand-to-hand attack should yield a "bashing" mesg */
883                     if (obj == uwep)
884                         unweapon = TRUE;
885                     if (obj->spe && obj->corpsenm >= LOW_PM) {
886                         if (obj->quan < 5L)
887                             change_luck((schar) - (obj->quan));
888                         else
889                             change_luck(-5);
890                     }
891
892                     if (touch_petrifies(&mons[obj->corpsenm])) {
893                         /*learn_egg_type(obj->corpsenm);*/
894 #if 0 /*JP*/
895                         pline("Splat! You hit %s with %s %s egg%s!",
896                               mon_nam(mon),
897                               obj->known ? "the" : cnt > 1L ? "some" : "a",
898                               obj->known ? mons[obj->corpsenm].mname
899                                          : "petrifying",
900                               plur(cnt));
901 #else
902                         pline("\83r\83`\83\83\83b\81I\82 \82È\82½\82Í%s\82É%s%s\82Ì\97\91\82ð\93\8a\82°\82Â\82¯\82½\81I",
903                               mon_nam(mon),
904                               cnt > 1L ? "\82¢\82­\82Â\82©\82Ì" : "",
905                               obj->known ? mons[obj->corpsenm].mname
906                                          : "\90Î\89»");
907 #endif
908                         obj->known = 1; /* (not much point...) */
909                         useup_eggs(obj);
910                         if (!munstone(mon, TRUE))
911                             minstapetrify(mon, TRUE);
912                         if (resists_ston(mon))
913                             break;
914                         return (boolean) (mon->mhp > 0);
915                     } else { /* ordinary egg(s) */
916 #if 0 /*JP*/
917                         const char *eggp =
918                             (obj->corpsenm != NON_PM && obj->known)
919                                 ? the(mons[obj->corpsenm].mname)
920                                 : (cnt > 1L) ? "some" : "an";
921                         You("hit %s with %s egg%s.", mon_nam(mon), eggp,
922                             plur(cnt));
923 #else
924                         const char *eggp =
925                             (obj->corpsenm != NON_PM && obj->known)
926                                 ? mons[obj->corpsenm].mname : "";
927                             You("%s\82É%s%s\97\91\82ð\93\8a\82°\82Â\82¯\82½\81D",
928                                 mon_nam(mon), eggp, *eggp ? "\82Ì" : "");
929 #endif
930                         if (touch_petrifies(mdat) && !stale_egg(obj)) {
931 #if 0 /*JP*/
932                             pline_The("egg%s %s alive any more...", plur(cnt),
933                                       (cnt == 1L) ? "isn't" : "aren't");
934 #else
935                             pline("\82à\82¤\97\91\82ª\9bz\89»\82·\82é\82±\82Æ\82Í\82È\82¢\82¾\82ë\82¤\81D\81D\81D");
936 #endif
937                             if (obj->timed)
938                                 obj_stop_timers(obj);
939                             obj->otyp = ROCK;
940                             obj->oclass = GEM_CLASS;
941                             obj->oartifact = 0;
942                             obj->spe = 0;
943                             obj->known = obj->dknown = obj->bknown = 0;
944                             obj->owt = weight(obj);
945                             if (thrown)
946                                 place_object(obj, mon->mx, mon->my);
947                         } else {
948 /*JP
949                             pline("Splat!");
950 */
951                             pline("\83r\83`\83\83\83b\81I");
952                             useup_eggs(obj);
953                             exercise(A_WIS, FALSE);
954                         }
955                     }
956                     break;
957 #undef useup_eggs
958                 }
959                 case CLOVE_OF_GARLIC: /* no effect against demons */
960                     if (is_undead(mdat) || is_vampshifter(mon)) {
961                         monflee(mon, d(2, 4), FALSE, TRUE);
962                     }
963                     tmp = 1;
964                     break;
965                 case CREAM_PIE:
966                 case BLINDING_VENOM:
967                     mon->msleeping = 0;
968                     if (can_blnd(&youmonst, mon,
969                                  (uchar) (obj->otyp == BLINDING_VENOM
970                                              ? AT_SPIT
971                                              : AT_WEAP),
972                                  obj)) {
973                         if (Blind) {
974 #if 0 /*JP*/
975                             pline(obj->otyp == CREAM_PIE ? "Splat!"
976                                                          : "Splash!");
977 #else
978                             pline(obj->otyp == CREAM_PIE ? "\83r\83V\83\83\83b\81I"
979                                                          : "\83s\83`\83\83\83b\81I");
980 #endif
981                         } else if (obj->otyp == BLINDING_VENOM) {
982 #if 0 /*JP*/
983                             pline_The("venom blinds %s%s!", mon_nam(mon),
984                                       mon->mcansee ? "" : " further");
985 #else
986                             pline("\93Å\89t\82Å%s\82Í%s\96Ú\82ª\8c©\82¦\82È\82­\82È\82Á\82½\81I", mon_nam(mon),
987                                   mon->mcansee ? "" : "\82³\82ç\82É");
988 #endif
989                         } else {
990                             char *whom = mon_nam(mon);
991                             char *what = The(xname(obj));
992
993                             if (!thrown && obj->quan > 1L)
994                                 what = An(singular(obj, xname));
995                             /* note: s_suffix returns a modifiable buffer */
996                             if (haseyes(mdat)
997                                 && mdat != &mons[PM_FLOATING_EYE])
998 #if 0 /*JP*/
999                                 whom = strcat(strcat(s_suffix(whom), " "),
1000                                               mbodypart(mon, FACE));
1001 #else
1002                                 whom = strcat(strcat(s_suffix(whom), "\82Ì"),
1003                                               mbodypart(mon, FACE));
1004 #endif
1005 #if 0 /*JP*/
1006                             pline("%s %s over %s!", what,
1007                                   vtense(what, "splash"), whom);
1008 #else
1009                             pline("%s\82Í%s\82É\82Ô\82¿\82Ü\82¯\82ç\82ê\82½\81I",
1010                                   what, whom);
1011 #endif
1012                         }
1013                         setmangry(mon);
1014                         mon->mcansee = 0;
1015                         tmp = rn1(25, 21);
1016                         if (((int) mon->mblinded + tmp) > 127)
1017                             mon->mblinded = 127;
1018                         else
1019                             mon->mblinded += tmp;
1020                     } else {
1021 /*JP
1022                         pline(obj->otyp == CREAM_PIE ? "Splat!" : "Splash!");
1023 */
1024                         pline(obj->otyp==CREAM_PIE ? "\83r\83V\83\83\83b\81I" : "\83s\83`\83\83\83b\81I");
1025                         setmangry(mon);
1026                     }
1027                     if (thrown)
1028                         obfree(obj, (struct obj *) 0);
1029                     else
1030                         useup(obj);
1031                     hittxt = TRUE;
1032                     get_dmg_bonus = FALSE;
1033                     tmp = 0;
1034                     break;
1035                 case ACID_VENOM: /* thrown (or spit) */
1036                     if (resists_acid(mon)) {
1037 /*JP
1038                         Your("venom hits %s harmlessly.", mon_nam(mon));
1039 */
1040                         pline("\93Å\89t\82Í%s\82É\82Í\8cø\89Ê\82ª\82È\82©\82Á\82½\81D", mon_nam(mon));
1041                         tmp = 0;
1042                     } else {
1043 /*JP
1044                         Your("venom burns %s!", mon_nam(mon));
1045 */
1046                         Your("\93Å\89t\82Í%s\82ð\8fÄ\82¢\82½\81I", mon_nam(mon));
1047                         tmp = dmgval(obj, mon);
1048                     }
1049                     if (thrown)
1050                         obfree(obj, (struct obj *) 0);
1051                     else
1052                         useup(obj);
1053                     hittxt = TRUE;
1054                     get_dmg_bonus = FALSE;
1055                     break;
1056                 default:
1057                     /* non-weapons can damage because of their weight */
1058                     /* (but not too much) */
1059                     tmp = obj->owt / 100;
1060                     if (is_wet_towel(obj)) {
1061                         /* wielded wet towel should probably use whip skill
1062                            (but not by setting objects[TOWEL].oc_skill==P_WHIP
1063                            because that would turn towel into a weptool) */
1064                         tmp += obj->spe;
1065                         if (rn2(obj->spe + 1)) /* usually lose some wetness */
1066                             dry_a_towel(obj, -1, TRUE);
1067                     }
1068                     if (tmp < 1)
1069                         tmp = 1;
1070                     else
1071                         tmp = rnd(tmp);
1072                     if (tmp > 6)
1073                         tmp = 6;
1074                     /*
1075                      * Things like silver wands can arrive here so
1076                      * so we need another silver check.
1077                      */
1078                     if (objects[obj->otyp].oc_material == SILVER
1079                         && mon_hates_silver(mon)) {
1080                         tmp += rnd(20);
1081                         silvermsg = TRUE;
1082                         silverobj = TRUE;
1083                     }
1084                 }
1085             }
1086         }
1087     }
1088
1089     /****** NOTE: perhaps obj is undefined!! (if !thrown && BOOMERANG)
1090      *      *OR* if attacking bare-handed!! */
1091
1092     if (get_dmg_bonus && tmp > 0) {
1093         tmp += u.udaminc;
1094         /* If you throw using a propellor, you don't get a strength
1095          * bonus but you do get an increase-damage bonus.
1096          */
1097         if (thrown != HMON_THROWN || !obj || !uwep
1098             || !ammo_and_launcher(obj, uwep))
1099             tmp += dbon();
1100     }
1101
1102     if (valid_weapon_attack) {
1103         struct obj *wep;
1104
1105         /* to be valid a projectile must have had the correct projector */
1106         wep = PROJECTILE(obj) ? uwep : obj;
1107         tmp += weapon_dam_bonus(wep);
1108         /* [this assumes that `!thrown' implies wielded...] */
1109         wtype = thrown ? weapon_type(wep) : uwep_skill_type();
1110         use_skill(wtype, 1);
1111     }
1112
1113     if (ispoisoned) {
1114         int nopoison = (10 - (obj->owt / 10));
1115
1116         if (nopoison < 2)
1117             nopoison = 2;
1118         if (Role_if(PM_SAMURAI)) {
1119 /*JP
1120             You("dishonorably use a poisoned weapon!");
1121 */
1122             You("\95s\96¼\97_\82É\82à\93Å\82Ì\95\90\8aí\82ð\8eg\97p\82µ\82½\81I");
1123             adjalign(-sgn(u.ualign.type));
1124         } else if (u.ualign.type == A_LAWFUL && u.ualign.record > -10) {
1125 /*JP
1126             You_feel("like an evil coward for using a poisoned weapon.");
1127 */
1128             You("\93Å\82Ì\95\90\8aí\82ð\8eg\97p\82·\82é\82Ì\82Í\94Ú\8b¯\82¾\82Æ\8a´\82\82½\81D");
1129             adjalign(-1);
1130         }
1131         if (obj && !rn2(nopoison)) {
1132             /* remove poison now in case obj ends up in a bones file */
1133             obj->opoisoned = FALSE;
1134             /* defer "obj is no longer poisoned" until after hit message */
1135             unpoisonmsg = TRUE;
1136         }
1137         if (resists_poison(mon))
1138             needpoismsg = TRUE;
1139         else if (rn2(10))
1140             tmp += rnd(6);
1141         else
1142             poiskilled = TRUE;
1143     }
1144     if (tmp < 1) {
1145         /* make sure that negative damage adjustment can't result
1146            in inadvertently boosting the victim's hit points */
1147         tmp = 0;
1148         if (mdat == &mons[PM_SHADE]) {
1149             if (!hittxt) {
1150 #if 0 /*JP*/
1151                 const char *what = *unconventional ? unconventional : "attack";
1152
1153                 Your("%s %s harmlessly through %s.", what,
1154                      vtense(what, "pass"), mon_nam(mon));
1155 #else
1156                 Your("\8dU\8c\82\82Í%s\82ð\92Ê\82è\82Ê\82¯\82½\81D", mon_nam(mon));
1157 #endif
1158                 hittxt = TRUE;
1159             }
1160         } else {
1161             if (get_dmg_bonus)
1162                 tmp = 1;
1163         }
1164     }
1165
1166     if (jousting) {
1167         tmp += d(2, (obj == uwep) ? 10 : 2); /* [was in dmgval()] */
1168 /*JP
1169         You("joust %s%s", mon_nam(mon), canseemon(mon) ? exclam(tmp) : ".");
1170 */
1171         You("%s\82É\93Ë\8c\82\82µ\82½%s", mon_nam(mon), canseemon(mon) ? exclam(tmp) : "\81D");
1172         if (jousting < 0) {
1173 /*JP
1174             pline("%s shatters on impact!", Yname2(obj));
1175 */
1176             Your("%s\82Í\8fÕ\8c\82\82Å\89ó\82ê\82½\81I", xname(obj));
1177             /* (must be either primary or secondary weapon to get here) */
1178             u.twoweap = FALSE; /* untwoweapon() is too verbose here */
1179             if (obj == uwep)
1180                 uwepgone(); /* set unweapon */
1181             /* minor side-effect: broken lance won't split puddings */
1182             useup(obj);
1183             obj = 0;
1184         }
1185         /* avoid migrating a dead monster */
1186         if (mon->mhp > tmp) {
1187             mhurtle(mon, u.dx, u.dy, 1);
1188             mdat = mon->data; /* in case of a polymorph trap */
1189             if (DEADMONSTER(mon))
1190                 already_killed = TRUE;
1191         }
1192         hittxt = TRUE;
1193     } else if (unarmed && tmp > 1 && !thrown && !obj && !Upolyd) {
1194         /* VERY small chance of stunning opponent if unarmed. */
1195         if (rnd(100) < P_SKILL(P_BARE_HANDED_COMBAT) && !bigmonst(mdat)
1196             && !thick_skinned(mdat)) {
1197             if (canspotmon(mon))
1198 #if 0 /*JP*/
1199                 pline("%s %s from your powerful strike!", Monnam(mon),
1200                       makeplural(stagger(mon->data, "stagger")));
1201 #else
1202                 pline("%s\82Í\82 \82È\82½\82Ì\89ï\90S\82Ì\88ê\8c\82\82Å%s\81I", Monnam(mon),
1203                       jpast(stagger(mon->data, "\82æ\82ë\82ß\82­")));
1204 #endif
1205             /* avoid migrating a dead monster */
1206             if (mon->mhp > tmp) {
1207                 mhurtle(mon, u.dx, u.dy, 1);
1208                 mdat = mon->data; /* in case of a polymorph trap */
1209                 if (DEADMONSTER(mon))
1210                     already_killed = TRUE;
1211             }
1212             hittxt = TRUE;
1213         }
1214     }
1215
1216     if (!already_killed)
1217         mon->mhp -= tmp;
1218     /* adjustments might have made tmp become less than what
1219        a level draining artifact has already done to max HP */
1220     if (mon->mhp > mon->mhpmax)
1221         mon->mhp = mon->mhpmax;
1222     if (mon->mhp < 1)
1223         destroyed = TRUE;
1224     if (mon->mtame && tmp > 0) {
1225         /* do this even if the pet is being killed (affects revival) */
1226         abuse_dog(mon); /* reduces tameness */
1227         /* flee if still alive and still tame; if already suffering from
1228            untimed fleeing, no effect, otherwise increases timed fleeing */
1229         if (mon->mtame && !destroyed)
1230             monflee(mon, 10 * rnd(tmp), FALSE, FALSE);
1231     }
1232     if ((mdat == &mons[PM_BLACK_PUDDING] || mdat == &mons[PM_BROWN_PUDDING])
1233         /* pudding is alive and healthy enough to split */
1234         && mon->mhp > 1 && !mon->mcan
1235         /* iron weapon using melee or polearm hit */
1236         && obj && obj == uwep && objects[obj->otyp].oc_material == IRON
1237         && hand_to_hand) {
1238         if (clone_mon(mon, 0, 0)) {
1239 /*JP
1240             pline("%s divides as you hit it!", Monnam(mon));
1241 */
1242             pline("\82 \82È\82½\82Ì\8dU\8c\82\82Å%s\82Í\95ª\97ô\82µ\82½\81I", Monnam(mon));
1243             hittxt = TRUE;
1244         }
1245     }
1246
1247     if (!hittxt /*( thrown => obj exists )*/
1248         && (!destroyed
1249             || (thrown && m_shot.n > 1 && m_shot.o == obj->otyp))) {
1250         if (thrown)
1251             hit(mshot_xname(obj), mon, exclam(tmp));
1252         else if (!flags.verbose)
1253 /*JP
1254             You("hit it.");
1255 */
1256             pline("\8dU\8c\82\82Í\96½\92\86\82µ\82½\81D");
1257         else
1258 #if 0 /*JP*/
1259             You("%s %s%s", Role_if(PM_BARBARIAN) ? "smite" : "hit",
1260                 mon_nam(mon), canseemon(mon) ? exclam(tmp) : ".");
1261 #else
1262             Your("%s\82Ö\82Ì\8dU\8c\82\82Í\96½\92\86\82µ\82½%s",
1263                  mon_nam(mon), canseemon(mon) ? exclam(tmp) : "\81D");
1264 #endif
1265     }
1266
1267     if (silvermsg) {
1268         const char *fmt;
1269         char *whom = mon_nam(mon);
1270         char silverobjbuf[BUFSZ];
1271
1272         if (canspotmon(mon)) {
1273             if (barehand_silver_rings == 1)
1274 /*JP
1275                 fmt = "Your silver ring sears %s!";
1276 */
1277                 fmt = "%s\82Í\8bâ\82Ì\8ew\97Ö\82Å\8fÄ\82©\82ê\82½\81I";
1278             else if (barehand_silver_rings == 2)
1279 /*JP
1280                 fmt = "Your silver rings sear %s!";
1281 */
1282                 fmt = "%s\82Í\8bâ\82Ì\8ew\97Ö\82Å\8fÄ\82©\82ê\82½\81I";
1283             else if (silverobj && saved_oname[0]) {
1284 #if 0 /*JP*/
1285                 Sprintf(silverobjbuf, "Your %s%s %s %%s!",
1286                         strstri(saved_oname, "silver") ? "" : "silver ",
1287                         saved_oname, vtense(saved_oname, "sear"));
1288 #else
1289                 Sprintf(silverobjbuf, "%%s\82Í%s%s\82Å\8fÄ\82©\82ê\82½\81I",
1290                         strstri(saved_oname, "\8bâ") ?
1291                         "" : "\8bâ\82Ì",
1292                         saved_oname);
1293 #endif
1294                 fmt = silverobjbuf;
1295             } else
1296 /*JP
1297                 fmt = "The silver sears %s!";
1298 */
1299                 fmt = "%s\82Í\8bâ\82Å\8fÄ\82©\82ê\82½\81I";
1300         } else {
1301             *whom = highc(*whom); /* "it" -> "It" */
1302 /*JP
1303             fmt = "%s is seared!";
1304 */
1305             fmt = "%s\82Í\8fÄ\82©\82ê\82½\81I";
1306         }
1307         /* note: s_suffix returns a modifiable buffer */
1308         if (!noncorporeal(mdat) && !amorphous(mdat))
1309 /*JP
1310             whom = strcat(s_suffix(whom), " flesh");
1311 */
1312             whom = strcat(s_suffix(whom), "\82Ì\93÷");
1313         pline(fmt, whom);
1314     }
1315     /* if a "no longer poisoned" message is coming, it will be last;
1316        obj->opoisoned was cleared above and any message referring to
1317        "poisoned <obj>" has now been given; we want just "<obj>" for
1318        last message, so reformat while obj is still accessible */
1319     if (unpoisonmsg)
1320         Strcpy(saved_oname, cxname(obj));
1321
1322     /* [note: thrown obj might go away during killed/xkilled call] */
1323
1324     if (needpoismsg)
1325 /*JP
1326         pline_The("poison doesn't seem to affect %s.", mon_nam(mon));
1327 */
1328         pline("\93Å\82Í%s\82É\8cø\82©\82È\82©\82Á\82½\82æ\82¤\82¾\81D", mon_nam(mon));
1329     if (poiskilled) {
1330 /*JP
1331         pline_The("poison was deadly...");
1332 */
1333         pline("\93Å\82Í\92v\8e\80\97Ê\82¾\82Á\82½\81D\81D\81D");
1334         if (!already_killed)
1335             xkilled(mon, 0);
1336         destroyed = TRUE; /* return FALSE; */
1337     } else if (destroyed) {
1338         if (!already_killed)
1339             killed(mon); /* takes care of most messages */
1340     } else if (u.umconf && hand_to_hand) {
1341         nohandglow(mon);
1342         if (!mon->mconf && !resist(mon, SPBOOK_CLASS, 0, NOTELL)) {
1343             mon->mconf = 1;
1344             if (!mon->mstun && mon->mcanmove && !mon->msleeping
1345                 && canseemon(mon))
1346 /*JP
1347                 pline("%s appears confused.", Monnam(mon));
1348 */
1349                 pline("%s\82Í\8d¬\97\90\82µ\82Ä\82¢\82é\82æ\82¤\82¾\81D", Monnam(mon));
1350         }
1351     }
1352     if (unpoisonmsg)
1353 #if 0 /*JP*/
1354         Your("%s %s no longer poisoned.", saved_oname,
1355              vtense(saved_oname, "are"));
1356 #else
1357         Your("%s\82Í\82à\82¤\93Å\82ª\93h\82ç\82ê\82Ä\82¢\82È\82¢\81D", xname(obj));
1358 #endif
1359
1360     return destroyed ? FALSE : TRUE;
1361 }
1362
1363 STATIC_OVL boolean
1364 shade_aware(obj)
1365 struct obj *obj;
1366 {
1367     if (!obj)
1368         return FALSE;
1369     /*
1370      * The things in this list either
1371      * 1) affect shades.
1372      *  OR
1373      * 2) are dealt with properly by other routines
1374      *    when it comes to shades.
1375      */
1376     if (obj->otyp == BOULDER
1377         || obj->otyp == HEAVY_IRON_BALL
1378         || obj->otyp == IRON_CHAIN      /* dmgval handles those first three */
1379         || obj->otyp == MIRROR          /* silver in the reflective surface */
1380         || obj->otyp == CLOVE_OF_GARLIC /* causes shades to flee */
1381         || objects[obj->otyp].oc_material == SILVER)
1382         return TRUE;
1383     return FALSE;
1384 }
1385
1386 /* check whether slippery clothing protects from hug or wrap attack */
1387 /* [currently assumes that you are the attacker] */
1388 STATIC_OVL boolean
1389 m_slips_free(mdef, mattk)
1390 struct monst *mdef;
1391 struct attack *mattk;
1392 {
1393     struct obj *obj;
1394
1395     if (mattk->adtyp == AD_DRIN) {
1396         /* intelligence drain attacks the head */
1397         obj = which_armor(mdef, W_ARMH);
1398     } else {
1399         /* grabbing attacks the body */
1400         obj = which_armor(mdef, W_ARMC); /* cloak */
1401         if (!obj)
1402             obj = which_armor(mdef, W_ARM); /* suit */
1403         if (!obj)
1404             obj = which_armor(mdef, W_ARMU); /* shirt */
1405     }
1406
1407     /* if monster's cloak/armor is greased, your grab slips off; this
1408        protection might fail (33% chance) when the armor is cursed */
1409     if (obj && (obj->greased || obj->otyp == OILSKIN_CLOAK)
1410         && (!obj->cursed || rn2(3))) {
1411 #if 0 /*JP*/
1412         You("%s %s %s %s!",
1413             mattk->adtyp == AD_WRAP ? "slip off of"
1414                                     : "grab, but cannot hold onto",
1415             s_suffix(mon_nam(mdef)), obj->greased ? "greased" : "slippery",
1416             /* avoid "slippery slippery cloak"
1417                for undiscovered oilskin cloak */
1418             (obj->greased || objects[obj->otyp].oc_name_known)
1419                 ? xname(obj)
1420                 : cloak_simple_name(obj));
1421 #else
1422         You("%s\82Ì%s%s%s\81I",
1423             mon_nam(mdef), obj->greased ? "\96û\82Ì\93h\82ç\82ê\82½" : "\8a\8a\82è\82â\82·\82¢",
1424             (obj->greased || objects[obj->otyp].oc_name_known)
1425                 ? xname(obj)
1426                 : cloak_simple_name(obj),
1427             mattk->adtyp == AD_WRAP ? "\82Å\8a\8a\82Á\82½"
1428                                     : "\82ð\82Â\82©\82Ü\82æ\82¤\82Æ\82µ\82½\82ª\81C\82Å\82«\82È\82©\82Á\82½");
1429 #endif
1430
1431         if (obj->greased && !rn2(2)) {
1432 /*JP
1433             pline_The("grease wears off.");
1434 */
1435             pline("\96û\82Í\97\8e\82¿\82Ä\82µ\82Ü\82Á\82½\81D");
1436             obj->greased = 0;
1437         }
1438         return TRUE;
1439     }
1440     return FALSE;
1441 }
1442
1443 /* used when hitting a monster with a lance while mounted;
1444    1: joust hit; 0: ordinary hit; -1: joust but break lance */
1445 STATIC_OVL int
1446 joust(mon, obj)
1447 struct monst *mon; /* target */
1448 struct obj *obj;   /* weapon */
1449 {
1450     int skill_rating, joust_dieroll;
1451
1452     if (Fumbling || Stunned)
1453         return 0;
1454     /* sanity check; lance must be wielded in order to joust */
1455     if (obj != uwep && (obj != uswapwep || !u.twoweap))
1456         return 0;
1457
1458     /* if using two weapons, use worse of lance and two-weapon skills */
1459     skill_rating = P_SKILL(weapon_type(obj)); /* lance skill */
1460     if (u.twoweap && P_SKILL(P_TWO_WEAPON_COMBAT) < skill_rating)
1461         skill_rating = P_SKILL(P_TWO_WEAPON_COMBAT);
1462     if (skill_rating == P_ISRESTRICTED)
1463         skill_rating = P_UNSKILLED; /* 0=>1 */
1464
1465     /* odds to joust are expert:80%, skilled:60%, basic:40%, unskilled:20% */
1466     if ((joust_dieroll = rn2(5)) < skill_rating) {
1467         if (joust_dieroll == 0 && rnl(50) == (50 - 1) && !unsolid(mon->data)
1468             && !obj_resists(obj, 0, 100))
1469             return -1; /* hit that breaks lance */
1470         return 1;      /* successful joust */
1471     }
1472     return 0; /* no joust bonus; revert to ordinary attack */
1473 }
1474
1475 /*
1476  * Send in a demon pet for the hero.  Exercise wisdom.
1477  *
1478  * This function used to be inline to damageum(), but the Metrowerks compiler
1479  * (DR4 and DR4.5) screws up with an internal error 5 "Expression Too
1480  * Complex."
1481  * Pulling it out makes it work.
1482  */
1483 STATIC_OVL void
1484 demonpet()
1485 {
1486     int i;
1487     struct permonst *pm;
1488     struct monst *dtmp;
1489
1490 /*JP
1491     pline("Some hell-p has arrived!");
1492 */
1493     pline("\92n\8d\96\82Ì\92\87\8aÔ\82ª\8c»\82í\82ê\82½\81I");
1494     i = !rn2(6) ? ndemon(u.ualign.type) : NON_PM;
1495     pm = i != NON_PM ? &mons[i] : youmonst.data;
1496     if ((dtmp = makemon(pm, u.ux, u.uy, NO_MM_FLAGS)) != 0)
1497         (void) tamedog(dtmp, (struct obj *) 0);
1498     exercise(A_WIS, TRUE);
1499 }
1500
1501 STATIC_OVL boolean
1502 theft_petrifies(otmp)
1503 struct obj *otmp;
1504 {
1505     if (uarmg || otmp->otyp != CORPSE
1506         || !touch_petrifies(&mons[otmp->corpsenm]) || Stone_resistance)
1507         return FALSE;
1508
1509 #if 0   /* no poly_when_stoned() critter has theft capability */
1510     if (poly_when_stoned(youmonst.data) && polymon(PM_STONE_GOLEM)) {
1511         display_nhwindow(WIN_MESSAGE, FALSE);   /* --More-- */
1512         return TRUE;
1513     }
1514 #endif
1515
1516     /* stealing this corpse is fatal... */
1517 /*JP
1518     instapetrify(corpse_xname(otmp, "stolen", CXN_ARTICLE));
1519 */
1520     instapetrify(corpse_xname(otmp, "\93\90\82Ü\82ê\82½", CXN_ARTICLE));
1521     /* apparently wasn't fatal after all... */
1522     return TRUE;
1523 }
1524
1525 /*
1526  * Player uses theft attack against monster.
1527  *
1528  * If the target is wearing body armor, take all of its possessions;
1529  * otherwise, take one object.  [Is this really the behavior we want?]
1530  */
1531 STATIC_OVL void
1532 steal_it(mdef, mattk)
1533 struct monst *mdef;
1534 struct attack *mattk;
1535 {
1536     struct obj *otmp, *stealoid, **minvent_ptr;
1537     long unwornmask;
1538
1539     if (!mdef->minvent)
1540         return; /* nothing to take */
1541
1542     /* look for worn body armor */
1543     stealoid = (struct obj *) 0;
1544     if (could_seduce(&youmonst, mdef, mattk)) {
1545         /* find armor, and move it to end of inventory in the process */
1546         minvent_ptr = &mdef->minvent;
1547         while ((otmp = *minvent_ptr) != 0)
1548             if (otmp->owornmask & W_ARM) {
1549                 if (stealoid)
1550                     panic("steal_it: multiple worn suits");
1551                 *minvent_ptr = otmp->nobj; /* take armor out of minvent */
1552                 stealoid = otmp;
1553                 stealoid->nobj = (struct obj *) 0;
1554             } else {
1555                 minvent_ptr = &otmp->nobj;
1556             }
1557         *minvent_ptr = stealoid; /* put armor back into minvent */
1558     }
1559
1560     if (stealoid) { /* we will be taking everything */
1561         if (gender(mdef) == (int) u.mfemale && youmonst.data->mlet == S_NYMPH)
1562 /*JP
1563             You("charm %s.  She gladly hands over her possessions.",
1564 */
1565             You("%s\82ð\82¤\82Á\82Æ\82è\82³\82¹\82½\81D\94Þ\8f\97\82Í\82æ\82ë\82±\82ñ\82Å\8e\9d\82¿\95¨\82ð\82³\82µ\82¾\82µ\82½\81D",
1566                 mon_nam(mdef));
1567         else
1568 #if 0 /*JP*/
1569             You("seduce %s and %s starts to take off %s clothes.",
1570                 mon_nam(mdef), mhe(mdef), mhis(mdef));
1571 #else
1572             You("%s\82ð\97U\98f\82µ\82½\81D%s\82Í\95\9e\82ð\92E\82¬\82Í\82\82ß\82½\81D",
1573                 mon_nam(mdef), mhe(mdef));
1574 #endif
1575     }
1576
1577     while ((otmp = mdef->minvent) != 0) {
1578         if (!Upolyd)
1579             break; /* no longer have ability to steal */
1580         /* take the object away from the monster */
1581         obj_extract_self(otmp);
1582         if ((unwornmask = otmp->owornmask) != 0L) {
1583             mdef->misc_worn_check &= ~unwornmask;
1584             if (otmp->owornmask & W_WEP)
1585                 setmnotwielded(mdef, otmp);
1586             otmp->owornmask = 0L;
1587             update_mon_intrinsics(mdef, otmp, FALSE, FALSE);
1588
1589             if (otmp == stealoid) /* special message for final item */
1590 #if 0 /*JP*/
1591                 pline("%s finishes taking off %s suit.", Monnam(mdef),
1592                       mhis(mdef));
1593 #else
1594                 pline("%s\82Í\92E\82¬\8fI\82¦\82½\81D", Monnam(mdef));
1595 #endif
1596         }
1597         /* give the object to the character */
1598 #if 0 /*JP*/
1599         otmp = hold_another_object(otmp, "You snatched but dropped %s.",
1600                                    doname(otmp), "You steal: ");
1601 #else
1602         otmp = hold_another_object(otmp, "\82 \82È\82½\82Í%s\82ð\93\90\82ñ\82¾\82ª\97\8e\82Æ\82µ\82½\81D",
1603                                    doname(otmp), "\82ð\93\90\82ñ\82¾\81D");
1604 #endif
1605         if (otmp->where != OBJ_INVENT)
1606             continue;
1607         if (theft_petrifies(otmp))
1608             break; /* stop thieving even though hero survived */
1609         /* more take-away handling, after theft message */
1610         if (unwornmask & W_WEP) { /* stole wielded weapon */
1611             possibly_unwield(mdef, FALSE);
1612         } else if (unwornmask & W_ARMG) { /* stole worn gloves */
1613             mselftouch(mdef, (const char *) 0, TRUE);
1614             if (mdef->mhp <= 0) /* it's now a statue */
1615                 return;         /* can't continue stealing */
1616         }
1617
1618         if (!stealoid)
1619             break; /* only taking one item */
1620     }
1621 }
1622
1623 int
1624 damageum(mdef, mattk)
1625 register struct monst *mdef;
1626 register struct attack *mattk;
1627 {
1628     register struct permonst *pd = mdef->data;
1629     int armpro, tmp = d((int) mattk->damn, (int) mattk->damd);
1630     boolean negated;
1631
1632     armpro = magic_negation(mdef);
1633     /* since hero can't be cancelled, only defender's armor applies */
1634     negated = !(rn2(10) >= 3 * armpro);
1635
1636     if (is_demon(youmonst.data) && !rn2(13) && !uwep
1637         && u.umonnum != PM_SUCCUBUS && u.umonnum != PM_INCUBUS
1638         && u.umonnum != PM_BALROG) {
1639         demonpet();
1640         return 0;
1641     }
1642     switch (mattk->adtyp) {
1643     case AD_STUN:
1644         if (!Blind)
1645 #if 0 /*JP*/
1646             pline("%s %s for a moment.", Monnam(mdef),
1647                   makeplural(stagger(pd, "stagger")));
1648 #else
1649             pline("%s\82Í\88ê\8fu%s\81D", Monnam(mdef),
1650                   jpast(stagger(pd, "\82æ\82ë\82ß\82­")));
1651 #endif
1652         mdef->mstun = 1;
1653         goto physical;
1654     case AD_LEGS:
1655 #if 0
1656         if (u.ucancelled) {
1657             tmp = 0;
1658             break;
1659         }
1660 #endif
1661         goto physical;
1662     case AD_WERE: /* no special effect on monsters */
1663     case AD_HEAL: /* likewise */
1664     case AD_PHYS:
1665     physical:
1666         if (mattk->aatyp == AT_WEAP) {
1667             if (uwep)
1668                 tmp = 0;
1669         } else if (mattk->aatyp == AT_KICK) {
1670             if (thick_skinned(pd))
1671                 tmp = 0;
1672             if (pd == &mons[PM_SHADE]) {
1673                 if (!(uarmf && uarmf->blessed)) {
1674                     impossible("bad shade attack function flow?");
1675                     tmp = 0;
1676                 } else
1677                     tmp = rnd(4); /* bless damage */
1678             }
1679             /* add ring(s) of increase damage */
1680             if (u.udaminc > 0) {
1681                 /* applies even if damage was 0 */
1682                 tmp += u.udaminc;
1683             } else if (tmp > 0) {
1684                 /* ring(s) might be negative; avoid converting
1685                    0 to non-0 or positive to non-positive */
1686                 tmp += u.udaminc;
1687                 if (tmp < 1)
1688                     tmp = 1;
1689             }
1690         }
1691         break;
1692     case AD_FIRE:
1693         if (negated) {
1694             tmp = 0;
1695             break;
1696         }
1697         if (!Blind)
1698 /*JP
1699             pline("%s is %s!", Monnam(mdef), on_fire(pd, mattk));
1700 */
1701             pline("%s\82Í%s\81I", Monnam(mdef), on_fire(mdef->data, mattk));
1702         if (pd == &mons[PM_STRAW_GOLEM] || pd == &mons[PM_PAPER_GOLEM]) {
1703             if (!Blind)
1704 /*JP
1705                 pline("%s burns completely!", Monnam(mdef));
1706 */
1707                 pline("%s\82Í\8a®\91S\82É\94R\82¦\90s\82«\82½\81I", Monnam(mdef));
1708             xkilled(mdef, 2);
1709             tmp = 0;
1710             break;
1711             /* Don't return yet; keep hp<1 and tmp=0 for pet msg */
1712         }
1713         tmp += destroy_mitem(mdef, SCROLL_CLASS, AD_FIRE);
1714         tmp += destroy_mitem(mdef, SPBOOK_CLASS, AD_FIRE);
1715         if (resists_fire(mdef)) {
1716             if (!Blind)
1717 /*JP
1718                 pline_The("fire doesn't heat %s!", mon_nam(mdef));
1719 */
1720                 pline("\89\8a\82Í%s\82É\89e\8b¿\82ª\82È\82¢\81I", mon_nam(mdef));
1721             golemeffects(mdef, AD_FIRE, tmp);
1722             shieldeff(mdef->mx, mdef->my);
1723             tmp = 0;
1724         }
1725         /* only potions damage resistant players in destroy_item */
1726         tmp += destroy_mitem(mdef, POTION_CLASS, AD_FIRE);
1727         break;
1728     case AD_COLD:
1729         if (negated) {
1730             tmp = 0;
1731             break;
1732         }
1733         if (!Blind)
1734 /*JP
1735             pline("%s is covered in frost!", Monnam(mdef));
1736 */
1737             pline("%s\82Í\95X\82Å\95¢\82í\82ê\82½\81I", Monnam(mdef));
1738         if (resists_cold(mdef)) {
1739             shieldeff(mdef->mx, mdef->my);
1740             if (!Blind)
1741 /*JP
1742                 pline_The("frost doesn't chill %s!", mon_nam(mdef));
1743 */
1744                 pline("\95X\82Í%s\82ð\93\80\82ç\82·\82±\82Æ\82ª\82Å\82«\82È\82¢\81I", mon_nam(mdef));
1745             golemeffects(mdef, AD_COLD, tmp);
1746             tmp = 0;
1747         }
1748         tmp += destroy_mitem(mdef, POTION_CLASS, AD_COLD);
1749         break;
1750     case AD_ELEC:
1751         if (negated) {
1752             tmp = 0;
1753             break;
1754         }
1755         if (!Blind)
1756 /*JP
1757             pline("%s is zapped!", Monnam(mdef));
1758 */
1759             pline("%s\82Í\93d\8c\82\82ð\82­\82ç\82Á\82½\81I", Monnam(mdef));
1760         tmp += destroy_mitem(mdef, WAND_CLASS, AD_ELEC);
1761         if (resists_elec(mdef)) {
1762             if (!Blind)
1763 /*JP
1764                 pline_The("zap doesn't shock %s!", mon_nam(mdef));
1765 */
1766                 pline("\93d\8c\82\82Í%s\82É\89e\8b¿\82ð\97^\82¦\82È\82¢\81I", mon_nam(mdef));
1767             golemeffects(mdef, AD_ELEC, tmp);
1768             shieldeff(mdef->mx, mdef->my);
1769             tmp = 0;
1770         }
1771         /* only rings damage resistant players in destroy_item */
1772         tmp += destroy_mitem(mdef, RING_CLASS, AD_ELEC);
1773         break;
1774     case AD_ACID:
1775         if (resists_acid(mdef))
1776             tmp = 0;
1777         break;
1778     case AD_STON:
1779         if (!munstone(mdef, TRUE))
1780             minstapetrify(mdef, TRUE);
1781         tmp = 0;
1782         break;
1783     case AD_SSEX:
1784     case AD_SEDU:
1785     case AD_SITM:
1786         steal_it(mdef, mattk);
1787         tmp = 0;
1788         break;
1789     case AD_SGLD:
1790         /* This you as a leprechaun, so steal
1791            real gold only, no lesser coins */
1792         {
1793             struct obj *mongold = findgold(mdef->minvent);
1794             if (mongold) {
1795                 obj_extract_self(mongold);
1796                 if (merge_choice(invent, mongold) || inv_cnt(FALSE) < 52) {
1797                     addinv(mongold);
1798 /*JP
1799                     Your("purse feels heavier.");
1800 */
1801                     You("\8dà\95z\82ª\8fd\82­\82È\82Á\82½\82æ\82¤\82È\8bC\82ª\82µ\82½\81D");
1802                 } else {
1803 /*JP
1804                     You("grab %s's gold, but find no room in your knapsack.",
1805 */
1806                     You("%s\82Ì\82¨\8bà\82ð\82Â\82©\82ñ\82¾\82ª\81C\8e\9d\82¿\95¨\91Ü\82É\93ü\82ç\82È\82©\82Á\82½\81D",
1807                         mon_nam(mdef));
1808                     dropy(mongold);
1809                 }
1810             }
1811         }
1812         exercise(A_DEX, TRUE);
1813         tmp = 0;
1814         break;
1815     case AD_TLPT:
1816         if (tmp <= 0)
1817             tmp = 1;
1818         if (!negated && tmp < mdef->mhp) {
1819             char nambuf[BUFSZ];
1820             boolean u_saw_mon =
1821                 canseemon(mdef) || (u.uswallow && u.ustuck == mdef);
1822             /* record the name before losing sight of monster */
1823             Strcpy(nambuf, Monnam(mdef));
1824             if (u_teleport_mon(mdef, FALSE) && u_saw_mon
1825                 && !(canseemon(mdef) || (u.uswallow && u.ustuck == mdef)))
1826 /*JP
1827                 pline("%s suddenly disappears!", nambuf);
1828 */
1829                 pline("%s\82Í\93Ë\91R\8fÁ\82¦\82½\81I", nambuf);
1830         }
1831         break;
1832     case AD_BLND:
1833         if (can_blnd(&youmonst, mdef, mattk->aatyp, (struct obj *) 0)) {
1834             if (!Blind && mdef->mcansee)
1835 /*JP
1836                 pline("%s is blinded.", Monnam(mdef));
1837 */
1838                 pline("%s\82Í\96Ú\82ª\8c©\82¦\82È\82­\82È\82Á\82½\81D", Monnam(mdef));
1839             mdef->mcansee = 0;
1840             tmp += mdef->mblinded;
1841             if (tmp > 127)
1842                 tmp = 127;
1843             mdef->mblinded = tmp;
1844         }
1845         tmp = 0;
1846         break;
1847     case AD_CURS:
1848         if (night() && !rn2(10) && !mdef->mcan) {
1849             if (pd == &mons[PM_CLAY_GOLEM]) {
1850                 if (!Blind)
1851 /*JP
1852                     pline("Some writing vanishes from %s head!",
1853 */
1854                     pline("%s\82Ì\93ª\82É\8f\91\82¢\82Ä\82 \82é\95\8e\9a\82Ì\82¢\82­\82Â\82©\82ª\8fÁ\82¦\82½\81I",
1855                           s_suffix(mon_nam(mdef)));
1856                 xkilled(mdef, 0);
1857                 /* Don't return yet; keep hp<1 and tmp=0 for pet msg */
1858             } else {
1859                 mdef->mcan = 1;
1860 /*JP
1861                 You("chuckle.");
1862 */
1863                 You("\82­\82·\82­\82·\8fÎ\82Á\82½\81D");
1864             }
1865         }
1866         tmp = 0;
1867         break;
1868     case AD_DRLI:
1869         if (!negated && !rn2(3) && !resists_drli(mdef)) {
1870             int xtmp = d(2, 6);
1871 /*JP
1872             pline("%s suddenly seems weaker!", Monnam(mdef));
1873 */
1874             pline("%s\82Í\93Ë\91R\8eã\82­\82È\82Á\82½\82æ\82¤\82É\8c©\82¦\82½\81I", Monnam(mdef));
1875             mdef->mhpmax -= xtmp;
1876             if ((mdef->mhp -= xtmp) <= 0 || !mdef->m_lev) {
1877 /*JP
1878                 pline("%s dies!", Monnam(mdef));
1879 */
1880                 pline("%s\82Í\8e\80\82ñ\82¾\81I", Monnam(mdef));
1881                 xkilled(mdef, 0);
1882             } else
1883                 mdef->m_lev--;
1884             tmp = 0;
1885         }
1886         break;
1887     case AD_RUST:
1888         if (pd == &mons[PM_IRON_GOLEM]) {
1889 /*JP
1890             pline("%s falls to pieces!", Monnam(mdef));
1891 */
1892             pline("%s\82Í\83o\83\89\83o\83\89\82É\82È\82Á\82½\81I", Monnam(mdef));
1893             xkilled(mdef, 0);
1894         }
1895         erode_armor(mdef, ERODE_RUST);
1896         tmp = 0;
1897         break;
1898     case AD_CORR:
1899         erode_armor(mdef, ERODE_CORRODE);
1900         tmp = 0;
1901         break;
1902     case AD_DCAY:
1903         if (pd == &mons[PM_WOOD_GOLEM] || pd == &mons[PM_LEATHER_GOLEM]) {
1904 /*JP
1905             pline("%s falls to pieces!", Monnam(mdef));
1906 */
1907             pline("%s\82Í\83o\83\89\83o\83\89\82É\82È\82Á\82½\81I", Monnam(mdef));
1908             xkilled(mdef, 0);
1909         }
1910         erode_armor(mdef, ERODE_ROT);
1911         tmp = 0;
1912         break;
1913     case AD_DREN:
1914         if (!negated && !rn2(4))
1915             xdrainenergym(mdef, TRUE);
1916         tmp = 0;
1917         break;
1918     case AD_DRST:
1919     case AD_DRDX:
1920     case AD_DRCO:
1921         if (!negated && !rn2(8)) {
1922 /*JP
1923             Your("%s was poisoned!", mpoisons_subj(&youmonst, mattk));
1924 */
1925             Your("%s\82Í\93Å\82³\82ê\82Ä\82¢\82é\81I", mpoisons_subj(&youmonst, mattk));
1926             if (resists_poison(mdef))
1927 /*JP
1928                 pline_The("poison doesn't seem to affect %s.", mon_nam(mdef));
1929 */
1930                 pline("\93Å\82Í%s\82É\89e\8b¿\82ð\97^\82¦\82È\82¢\81D", mon_nam(mdef));
1931             else {
1932                 if (!rn2(10)) {
1933 /*JP
1934                     Your("poison was deadly...");
1935 */
1936                     Your("\97^\82¦\82½\93Å\82Í\92v\8e\80\97Ê\82¾\82Á\82½\81D\81D\81D");
1937                     tmp = mdef->mhp;
1938                 } else
1939                     tmp += rn1(10, 6);
1940             }
1941         }
1942         break;
1943     case AD_DRIN: {
1944         struct obj *helmet;
1945
1946         if (notonhead || !has_head(pd)) {
1947 /*JP
1948             pline("%s doesn't seem harmed.", Monnam(mdef));
1949 */
1950             pline("%s\82Í\8f\9d\82Â\82¢\82½\82æ\82¤\82É\82Í\8c©\82¦\82È\82¢\81D", Monnam(mdef));
1951             tmp = 0;
1952             if (!Unchanging && pd == &mons[PM_GREEN_SLIME]) {
1953                 if (!Slimed) {
1954 /*JP
1955                     You("suck in some slime and don't feel very well.");
1956 */
1957                     You("\83X\83\89\83C\83\80\82ð\8bz\82¢\8eæ\82Á\82Ä\81C\8bï\8d\87\82ª\88«\82­\82È\82Á\82½\81D");
1958                     make_slimed(10L, (char *) 0);
1959                 }
1960             }
1961             break;
1962         }
1963         if (m_slips_free(mdef, mattk))
1964             break;
1965
1966         if ((helmet = which_armor(mdef, W_ARMH)) != 0 && rn2(8)) {
1967 #if 0 /*JP*/
1968             pline("%s %s blocks your attack to %s head.",
1969                   s_suffix(Monnam(mdef)), helm_simple_name(helmet),
1970                   mhis(mdef));
1971 #else
1972             pline("%s\82Ì%s\82ª\93ª\82Ö\82Ì\8dU\8c\82\82ð\96h\82¢\82¾\81D",
1973                   Monnam(mdef), helm_simple_name(helmet));
1974 #endif
1975             break;
1976         }
1977
1978         (void) eat_brains(&youmonst, mdef, TRUE, &tmp);
1979         break;
1980     }
1981     case AD_STCK:
1982         if (!negated && !sticks(pd))
1983             u.ustuck = mdef; /* it's now stuck to you */
1984         break;
1985     case AD_WRAP:
1986         if (!sticks(pd)) {
1987             if (!u.ustuck && !rn2(10)) {
1988                 if (m_slips_free(mdef, mattk)) {
1989                     tmp = 0;
1990                 } else {
1991 /*JP
1992                     You("swing yourself around %s!", mon_nam(mdef));
1993 */
1994                     You("%s\82É\90g\91Ì\82ð\97\8d\82Ý\82Â\82©\82¹\82½\81I", mon_nam(mdef));
1995                     u.ustuck = mdef;
1996                 }
1997             } else if (u.ustuck == mdef) {
1998                 /* Monsters don't wear amulets of magical breathing */
1999                 if (is_pool(u.ux, u.uy) && !is_swimmer(pd)
2000                     && !amphibious(pd)) {
2001 /*JP
2002                     You("drown %s...", mon_nam(mdef));
2003 */
2004                     You("%s\82ð\93M\82ê\82³\82¹\82½\81D\81D\81D", mon_nam(mdef));
2005                     tmp = mdef->mhp;
2006                 } else if (mattk->aatyp == AT_HUGS)
2007 /*JP
2008                     pline("%s is being crushed.", Monnam(mdef));
2009 */
2010                     pline("%s\82Í\89\9f\82µ\82Â\82Ô\82³\82ê\82Ä\82¢\82é\81D", Monnam(mdef));
2011             } else {
2012                 tmp = 0;
2013                 if (flags.verbose)
2014 #if 0 /*JP*/
2015                     You("brush against %s %s.", s_suffix(mon_nam(mdef)),
2016                         mbodypart(mdef, LEG));
2017 #else
2018                     You("%s\82Ì%s\82É\90G\82ê\82½\81D", mon_nam(mdef),
2019                         mbodypart(mdef, LEG));
2020 #endif
2021             }
2022         } else
2023             tmp = 0;
2024         break;
2025     case AD_PLYS:
2026         if (!negated && mdef->mcanmove && !rn2(3) && tmp < mdef->mhp) {
2027             if (!Blind)
2028 /*JP
2029                 pline("%s is frozen by you!", Monnam(mdef));
2030 */
2031                 pline("%s\82Í\82 \82È\82½\82Ì\82É\82ç\82Ý\82Å\93®\82¯\82È\82­\82È\82Á\82½\81I", Monnam(mdef));
2032             paralyze_monst(mdef, rnd(10));
2033         }
2034         break;
2035     case AD_SLEE:
2036         if (!negated && !mdef->msleeping && sleep_monst(mdef, rnd(10), -1)) {
2037             if (!Blind)
2038 /*JP
2039                 pline("%s is put to sleep by you!", Monnam(mdef));
2040 */
2041                 pline("%s\82Í\93Ë\91R\96°\82è\82É\82¨\82¿\82½\81I", Monnam(mdef));
2042             slept_monst(mdef);
2043         }
2044         break;
2045     case AD_SLIM:
2046         if (negated)
2047             break; /* physical damage only */
2048         if (!rn2(4) && !slimeproof(pd)) {
2049             if (!munslime(mdef, TRUE) && mdef->mhp > 0) {
2050                 /* this assumes newcham() won't fail; since hero has
2051                    a slime attack, green slimes haven't been geno'd */
2052 /*JP
2053                 You("turn %s into slime.", mon_nam(mdef));
2054 */
2055                 pline("%s\82Í\83X\83\89\83C\83\80\82É\82È\82Á\82½\81D", mon_nam(mdef));
2056                 if (newcham(mdef, &mons[PM_GREEN_SLIME], FALSE, FALSE))
2057                     pd = mdef->data;
2058             }
2059             /* munslime attempt could have been fatal */
2060             if (mdef->mhp < 1)
2061                 return 2; /* skip death message */
2062             tmp = 0;
2063         }
2064         break;
2065     case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
2066         /* there's no msomearmor() function, so just do damage */
2067         /* if (negated) break; */
2068         break;
2069     case AD_SLOW:
2070         if (!negated && mdef->mspeed != MSLOW) {
2071             unsigned int oldspeed = mdef->mspeed;
2072
2073             mon_adjust_speed(mdef, -1, (struct obj *) 0);
2074             if (mdef->mspeed != oldspeed && canseemon(mdef))
2075 /*JP
2076                 pline("%s slows down.", Monnam(mdef));
2077 */
2078                 pline("%s\82Í\82Ì\82ë\82­\82È\82Á\82½\81D", Monnam(mdef));
2079         }
2080         break;
2081     case AD_CONF:
2082         if (!mdef->mconf) {
2083             if (canseemon(mdef))
2084 /*JP
2085                 pline("%s looks confused.", Monnam(mdef));
2086 */
2087                 pline("%s\82Í\8d¬\97\90\82µ\82½\82æ\82¤\82¾\81D", Monnam(mdef));
2088             mdef->mconf = 1;
2089         }
2090         break;
2091     default:
2092         tmp = 0;
2093         break;
2094     }
2095
2096     mdef->mstrategy &= ~STRAT_WAITFORU; /* in case player is very fast */
2097     if ((mdef->mhp -= tmp) < 1) {
2098         if (mdef->mtame && !cansee(mdef->mx, mdef->my)) {
2099 /*JP
2100             You_feel("embarrassed for a moment.");
2101 */
2102             You("\82µ\82Î\82ç\82­\8d¢\98f\82µ\82½\81D");
2103             if (tmp)
2104                 xkilled(mdef, 0); /* !tmp but hp<1: already killed */
2105         } else if (!flags.verbose) {
2106 /*JP
2107             You("destroy it!");
2108 */
2109             You("\93|\82µ\82½\81I");
2110             if (tmp)
2111                 xkilled(mdef, 0);
2112         } else if (tmp)
2113             killed(mdef);
2114         return 2;
2115     }
2116     return 1;
2117 }
2118
2119 STATIC_OVL int
2120 explum(mdef, mattk)
2121 register struct monst *mdef;
2122 register struct attack *mattk;
2123 {
2124     register int tmp = d((int) mattk->damn, (int) mattk->damd);
2125
2126 /*JP
2127     You("explode!");
2128 */
2129     You("\94\9a\94­\82µ\82½\81I");
2130     switch (mattk->adtyp) {
2131         boolean resistance; /* only for cold/fire/elec */
2132
2133     case AD_BLND:
2134         if (!resists_blnd(mdef)) {
2135 /*JP
2136             pline("%s is blinded by your flash of light!", Monnam(mdef));
2137 */
2138             pline("%s\82Í\82Ü\82Î\82ä\82¢\8cõ\82Å\96Ú\82ª\82­\82ç\82ñ\82¾\81I", Monnam(mdef));
2139             mdef->mblinded = min((int) mdef->mblinded + tmp, 127);
2140             mdef->mcansee = 0;
2141         }
2142         break;
2143     case AD_HALU:
2144         if (haseyes(mdef->data) && mdef->mcansee) {
2145 /*JP
2146             pline("%s is affected by your flash of light!", Monnam(mdef));
2147 */
2148             pline("%s\82Í\82Ü\82Î\82ä\82¢\8cõ\82Å\89e\8b¿\82ð\8eó\82¯\82½\81I", Monnam(mdef));
2149             mdef->mconf = 1;
2150         }
2151         break;
2152     case AD_COLD:
2153         resistance = resists_cold(mdef);
2154         goto common;
2155     case AD_FIRE:
2156         resistance = resists_fire(mdef);
2157         goto common;
2158     case AD_ELEC:
2159         resistance = resists_elec(mdef);
2160     common:
2161         if (!resistance) {
2162 /*JP
2163             pline("%s gets blasted!", Monnam(mdef));
2164 */
2165             pline("%s\82Í\94\9a\94­\82ð\97\81\82Ñ\82½\81I", Monnam(mdef));
2166             mdef->mhp -= tmp;
2167             if (mdef->mhp <= 0) {
2168                 killed(mdef);
2169                 return 2;
2170             }
2171         } else {
2172             shieldeff(mdef->mx, mdef->my);
2173             if (is_golem(mdef->data))
2174                 golemeffects(mdef, (int) mattk->adtyp, tmp);
2175             else
2176 /*JP
2177                 pline_The("blast doesn't seem to affect %s.", mon_nam(mdef));
2178 */
2179                 pline("\94\9a\94­\82Í%s\82É\89e\8b¿\82ð\97^\82¦\82È\82©\82Á\82½\82æ\82¤\82¾\81D", mon_nam(mdef));
2180         }
2181         break;
2182     default:
2183         break;
2184     }
2185     return 1;
2186 }
2187
2188 STATIC_OVL void
2189 start_engulf(mdef)
2190 struct monst *mdef;
2191 {
2192     if (!Invisible) {
2193         map_location(u.ux, u.uy, TRUE);
2194         tmp_at(DISP_ALWAYS, mon_to_glyph(&youmonst));
2195         tmp_at(mdef->mx, mdef->my);
2196     }
2197 /*JP
2198     You("engulf %s!", mon_nam(mdef));
2199 */
2200     You("%s\82ð\88ù\82Ý\8d\9e\82ñ\82¾\81I", mon_nam(mdef));
2201     delay_output();
2202     delay_output();
2203 }
2204
2205 STATIC_OVL void
2206 end_engulf()
2207 {
2208     if (!Invisible) {
2209         tmp_at(DISP_END, 0);
2210         newsym(u.ux, u.uy);
2211     }
2212 }
2213
2214 STATIC_OVL int
2215 gulpum(mdef, mattk)
2216 register struct monst *mdef;
2217 register struct attack *mattk;
2218 {
2219 #ifdef LINT /* static char msgbuf[BUFSZ]; */
2220     char msgbuf[BUFSZ];
2221 #else
2222     static char msgbuf[BUFSZ]; /* for nomovemsg */
2223 #endif
2224     register int tmp;
2225     register int dam = d((int) mattk->damn, (int) mattk->damd);
2226     boolean fatal_gulp;
2227     struct obj *otmp;
2228     struct permonst *pd = mdef->data;
2229
2230     /* Not totally the same as for real monsters.  Specifically, these
2231      * don't take multiple moves.  (It's just too hard, for too little
2232      * result, to program monsters which attack from inside you, which
2233      * would be necessary if done accurately.)  Instead, we arbitrarily
2234      * kill the monster immediately for AD_DGST and we regurgitate them
2235      * after exactly 1 round of attack otherwise.  -KAA
2236      */
2237
2238     if (!engulf_target(&youmonst, mdef))
2239         return 0;
2240
2241     if (u.uhunger < 1500 && !u.uswallow) {
2242         for (otmp = mdef->minvent; otmp; otmp = otmp->nobj)
2243             (void) snuff_lit(otmp);
2244
2245         /* engulfing a cockatrice or digesting a Rider or Medusa */
2246         fatal_gulp = (touch_petrifies(pd) && !Stone_resistance)
2247                      || (mattk->adtyp == AD_DGST
2248                          && (is_rider(pd) || (pd == &mons[PM_MEDUSA]
2249                                               && !Stone_resistance)));
2250
2251         if ((mattk->adtyp == AD_DGST && !Slow_digestion) || fatal_gulp)
2252             eating_conducts(pd);
2253
2254         if (fatal_gulp && !is_rider(pd)) { /* petrification */
2255             char kbuf[BUFSZ];
2256             const char *mname = pd->mname;
2257
2258             if (!type_is_pname(pd))
2259                 mname = an(mname);
2260 /*JP
2261             You("englut %s.", mon_nam(mdef));
2262 */
2263             You("%s\82ð\88ù\82Ý\8d\9e\82ñ\82¾\81D", mon_nam(mdef));
2264 /*JP
2265             Sprintf(kbuf, "swallowing %s whole", mname);
2266 */
2267             Sprintf(kbuf, "%s\82ð\88ù\82Ý\8d\9e\82ñ\82Å", mname);
2268             instapetrify(kbuf);
2269         } else {
2270             start_engulf(mdef);
2271             switch (mattk->adtyp) {
2272             case AD_DGST:
2273                 /* eating a Rider or its corpse is fatal */
2274                 if (is_rider(pd)) {
2275 /*JP
2276                     pline("Unfortunately, digesting any of it is fatal.");
2277 */
2278                     pline("\8ec\94O\82È\82ª\82ç\81C\82»\82ê\82ð\90H\82×\82é\82Ì\82Í\92v\96½\93I\82È\8aÔ\88á\82¢\82¾\81D");
2279                     end_engulf();
2280 #if 0 /*JP*/
2281                     Sprintf(killer.name, "unwisely tried to eat %s",
2282                             pd->mname);
2283                     killer.format = NO_KILLER_PREFIX;
2284 #else
2285                     Sprintf(killer.name, "\8bð\82©\82É\82à%s\82ð\90H\82×\82æ\82¤\82Æ\82µ\82Ä",
2286                             pd->mname);
2287                     killer.format = KILLED_BY;
2288 #endif
2289                     done(DIED);
2290                     return 0; /* lifesaved */
2291                 }
2292
2293                 if (Slow_digestion) {
2294                     dam = 0;
2295                     break;
2296                 }
2297
2298                 /* Use up amulet of life saving */
2299                 if (!!(otmp = mlifesaver(mdef)))
2300                     m_useup(mdef, otmp);
2301
2302                 newuhs(FALSE);
2303                 xkilled(mdef, 2);
2304                 if (mdef->mhp > 0) { /* monster lifesaved */
2305 /*JP
2306                     You("hurriedly regurgitate the sizzling in your %s.",
2307 */
2308                     You("%s\82Ì\92\86\82Å\83V\83\85\81[\83V\83\85\81[\82Æ\82¢\82¤\89¹\82ð\97§\82Ä\82Ä\82¢\82é\82à\82Ì\82ð\91å\8b}\82¬\82Å\93f\82«\96ß\82µ\82½\81D",
2309                         body_part(STOMACH));
2310                 } else {
2311                     tmp = 1 + (pd->cwt >> 8);
2312                     if (corpse_chance(mdef, &youmonst, TRUE)
2313                         && !(mvitals[monsndx(pd)].mvflags & G_NOCORPSE)) {
2314                         /* nutrition only if there can be a corpse */
2315                         u.uhunger += (pd->cnutrit + 1) / 2;
2316                     } else
2317                         tmp = 0;
2318 /*JP
2319                     Sprintf(msgbuf, "You totally digest %s.", mon_nam(mdef));
2320 */
2321                     Sprintf(msgbuf, "\82 \82È\82½\82Í%s\82ð\8a®\91S\82É\8fÁ\89»\82µ\82½\81D", mon_nam(mdef));
2322                     if (tmp != 0) {
2323                         /* setting afternmv = end_engulf is tempting,
2324                          * but will cause problems if the player is
2325                          * attacked (which uses his real location) or
2326                          * if his See_invisible wears off
2327                          */
2328 /*JP
2329                         You("digest %s.", mon_nam(mdef));
2330 */
2331                         You("%s\82ð\8fÁ\89»\82µ\82Ä\82¢\82é\81D", mon_nam(mdef));
2332                         if (Slow_digestion)
2333                             tmp *= 2;
2334                         nomul(-tmp);
2335 /*JP
2336                         multi_reason = "digesting something";
2337 */
2338                         multi_reason = "\8fÁ\89»\92\86\82É";
2339                         nomovemsg = msgbuf;
2340                     } else
2341                         pline1(msgbuf);
2342                     if (pd == &mons[PM_GREEN_SLIME]) {
2343 /*JP
2344                         Sprintf(msgbuf, "%s isn't sitting well with you.",
2345 */
2346                         Sprintf(msgbuf, "%s\82Í\82 \82È\82½\82Æ\82¤\82Ü\82­\90Ü\82è\8d\87\82¢\82ð\82Â\82¯\82ç\82ê\82È\82¢\82æ\82¤\82¾\81D",
2347                                 The(pd->mname));
2348                         if (!Unchanging) {
2349                             make_slimed(5L, (char *) 0);
2350                         }
2351                     } else
2352                         exercise(A_CON, TRUE);
2353                 }
2354                 end_engulf();
2355                 return 2;
2356             case AD_PHYS:
2357                 if (youmonst.data == &mons[PM_FOG_CLOUD]) {
2358 /*JP
2359                     pline("%s is laden with your moisture.", Monnam(mdef));
2360 */
2361                     pline("%s\82Í\82 \82È\82½\82Ì\8e¼\8bC\82É\8bê\82µ\82ß\82ç\82ê\82Ä\82¢\82é\81D", Monnam(mdef));
2362                     if (amphibious(pd) && !flaming(pd)) {
2363                         dam = 0;
2364 /*JP
2365                         pline("%s seems unharmed.", Monnam(mdef));
2366 */
2367                         pline("%s\82Í\8f\9d\82Â\82¢\82Ä\82¢\82È\82¢\82æ\82¤\82¾\81D", Monnam(mdef));
2368                     }
2369                 } else
2370 /*JP
2371                     pline("%s is pummeled with your debris!", Monnam(mdef));
2372 */
2373                     pline("%s\82Í\8a¢âI\82Å\92É\82ß\82Â\82¯\82ç\82ê\82½\81I", Monnam(mdef));
2374                 break;
2375             case AD_ACID:
2376 /*JP
2377                 pline("%s is covered with your goo!", Monnam(mdef));
2378 */
2379                 pline("%s\82Í\82Ë\82Î\82Â\82­\82à\82Ì\82Å\95¢\82í\82ê\82½\81I", Monnam(mdef));
2380                 if (resists_acid(mdef)) {
2381 /*JP
2382                     pline("It seems harmless to %s.", mon_nam(mdef));
2383 */
2384                     pline("\82µ\82©\82µ\81C%s\82Í\82È\82ñ\82Æ\82à\82È\82¢\81D", mon_nam(mdef));
2385                     dam = 0;
2386                 }
2387                 break;
2388             case AD_BLND:
2389                 if (can_blnd(&youmonst, mdef, mattk->aatyp,
2390                              (struct obj *) 0)) {
2391                     if (mdef->mcansee)
2392 /*JP
2393                         pline("%s can't see in there!", Monnam(mdef));
2394 */
2395                         pline("%s\82Í\96Ú\82ª\8c©\82¦\82È\82­\82È\82Á\82½\81I", mon_nam(mdef));
2396                     mdef->mcansee = 0;
2397                     dam += mdef->mblinded;
2398                     if (dam > 127)
2399                         dam = 127;
2400                     mdef->mblinded = dam;
2401                 }
2402                 dam = 0;
2403                 break;
2404             case AD_ELEC:
2405                 if (rn2(2)) {
2406 /*JP
2407                     pline_The("air around %s crackles with electricity.",
2408 */
2409                     pline("%s\82Ì\89ñ\82è\82Ì\8bó\8bC\82Í\93d\8bC\82Å\83s\83\8a\83s\83\8a\82µ\82Ä\82¢\82é\81D",
2410                               mon_nam(mdef));
2411                     if (resists_elec(mdef)) {
2412 /*JP
2413                         pline("%s seems unhurt.", Monnam(mdef));
2414 */
2415                         pline("\82µ\82©\82µ\81C%s\82Í\95½\8bC\82È\82æ\82¤\82¾\81D", Monnam(mdef));
2416                         dam = 0;
2417                     }
2418                     golemeffects(mdef, (int) mattk->adtyp, dam);
2419                 } else
2420                     dam = 0;
2421                 break;
2422             case AD_COLD:
2423                 if (rn2(2)) {
2424                     if (resists_cold(mdef)) {
2425 /*JP
2426                         pline("%s seems mildly chilly.", Monnam(mdef));
2427 */
2428                         pline("%s\82Í\97â\82¦\82½\82æ\82¤\82¾\81D", Monnam(mdef));
2429                         dam = 0;
2430                     } else
2431 /*JP
2432                         pline("%s is freezing to death!", Monnam(mdef));
2433 */
2434                         pline("%s\82Í\93\80\8e\80\82µ\82»\82¤\82¾\81I", Monnam(mdef));
2435                     golemeffects(mdef, (int) mattk->adtyp, dam);
2436                 } else
2437                     dam = 0;
2438                 break;
2439             case AD_FIRE:
2440                 if (rn2(2)) {
2441                     if (resists_fire(mdef)) {
2442 /*JP
2443                         pline("%s seems mildly hot.", Monnam(mdef));
2444 */
2445                         pline("%s\82Í\92g\82©\82­\82È\82Á\82½\82æ\82¤\82¾\81D", Monnam(mdef));
2446                         dam = 0;
2447                     } else
2448 /*JP
2449                         pline("%s is burning to a crisp!", Monnam(mdef));
2450 */
2451                         pline("%s\82Í\94R\82¦\82Ä\83J\83\89\83J\83\89\82É\82È\82Á\82½\81I", Monnam(mdef));
2452                     golemeffects(mdef, (int) mattk->adtyp, dam);
2453                 } else
2454                     dam = 0;
2455                 break;
2456             case AD_DREN:
2457                 if (!rn2(4))
2458                     xdrainenergym(mdef, TRUE);
2459                 dam = 0;
2460                 break;
2461             }
2462             end_engulf();
2463             if ((mdef->mhp -= dam) <= 0) {
2464                 killed(mdef);
2465                 if (mdef->mhp <= 0) /* not lifesaved */
2466                     return 2;
2467             }
2468 #if 0 /*JP*/
2469             You("%s %s!", is_animal(youmonst.data) ? "regurgitate" : "expel",
2470                 mon_nam(mdef));
2471 #else
2472             You("%s\82ð%s\82µ\82½\81I", mon_nam(mdef),
2473                 is_animal(youmonst.data) ? "\93f\82«\96ß" : "\94r\8fo");
2474 #endif
2475             if (Slow_digestion || is_animal(youmonst.data)) {
2476 /*JP
2477                 pline("Obviously, you didn't like %s taste.",
2478 */
2479                 pline("\82Ç\82¤\82à%s\82Ì\96¡\82Í\8dD\82«\82É\82È\82ê\82È\82¢\81D",
2480                       s_suffix(mon_nam(mdef)));
2481             }
2482         }
2483     }
2484     return 0;
2485 }
2486
2487 void
2488 missum(mdef, mattk, wouldhavehit)
2489 register struct monst *mdef;
2490 register struct attack *mattk;
2491 boolean wouldhavehit;
2492 {
2493     if (wouldhavehit) /* monk is missing due to penalty for wearing suit */
2494 /*JP
2495         Your("armor is rather cumbersome...");
2496 */
2497         Your("\96h\8bï\82Í\8f­\82µ\8e×\96\82\82¾\81D\81D\81D");
2498
2499     if (could_seduce(&youmonst, mdef, mattk))
2500 /*JP
2501         You("pretend to be friendly to %s.", mon_nam(mdef));
2502 */
2503         You("%s\82É\97F\8dD\93I\82È\82Ó\82è\82ð\82µ\82½\81D", mon_nam(mdef));
2504     else if (canspotmon(mdef) && flags.verbose)
2505 /*JP
2506         You("miss %s.", mon_nam(mdef));
2507 */
2508         Your("%s\82Ö\82Ì\8dU\8c\82\82Í\8aO\82ê\82½\81D", mon_nam(mdef));
2509     else
2510 /*JP
2511         You("miss it.");
2512 */
2513         Your("\89½\8eÒ\82©\82Ö\82Ì\8dU\8c\82\82Í\8aO\82ê\82½\81D");
2514     if (!mdef->msleeping && mdef->mcanmove)
2515         wakeup(mdef);
2516 }
2517
2518 /* attack monster as a monster. */
2519 STATIC_OVL boolean
2520 hmonas(mon)
2521 register struct monst *mon;
2522 {
2523     struct attack *mattk, alt_attk;
2524     struct obj *weapon;
2525     boolean altwep = FALSE, weapon_used = FALSE;
2526     int i, tmp, armorpenalty, sum[NATTK], nsum = 0, dhit = 0, attknum = 0;
2527
2528     for (i = 0; i < NATTK; i++) {
2529         sum[i] = 0;
2530         mattk = getmattk(youmonst.data, i, sum, &alt_attk);
2531         switch (mattk->aatyp) {
2532         case AT_WEAP:
2533         use_weapon:
2534             /* Certain monsters don't use weapons when encountered as enemies,
2535              * but players who polymorph into them have hands or claws and
2536              * thus should be able to use weapons.  This shouldn't prohibit
2537              * the use of most special abilities, either.
2538              * If monster has multiple claw attacks, only one can use weapon.
2539              */
2540             weapon_used = TRUE;
2541             /* Potential problem: if the monster gets multiple weapon attacks,
2542              * we currently allow the player to get each of these as a weapon
2543              * attack.  Is this really desirable?
2544              */
2545             /* approximate two-weapon mode */
2546             weapon = (altwep && uswapwep) ? uswapwep : uwep;
2547             altwep = !altwep; /* toggle for next attack */
2548             tmp = find_roll_to_hit(mon, AT_WEAP, weapon, &attknum,
2549                                    &armorpenalty);
2550             dhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
2551             /* Enemy dead, before any special abilities used */
2552             if (!known_hitum(mon, weapon, &dhit, tmp, armorpenalty, mattk)) {
2553                 sum[i] = 2;
2554                 break;
2555             } else
2556                 sum[i] = dhit;
2557             /* might be a worm that gets cut in half */
2558             if (m_at(u.ux + u.dx, u.uy + u.dy) != mon)
2559                 return (boolean) (nsum != 0);
2560             /* Do not print "You hit" message, since known_hitum
2561              * already did it.
2562              */
2563             if (dhit && mattk->adtyp != AD_SPEL && mattk->adtyp != AD_PHYS)
2564                 sum[i] = damageum(mon, mattk);
2565             break;
2566         case AT_CLAW:
2567             if (uwep && !cantwield(youmonst.data) && !weapon_used)
2568                 goto use_weapon;
2569             /*FALLTHRU*/
2570         case AT_TUCH:
2571             if (uwep && youmonst.data->mlet == S_LICH && !weapon_used)
2572                 goto use_weapon;
2573             /*FALLTHRU*/
2574         case AT_KICK:
2575         case AT_BITE:
2576         case AT_STNG:
2577         case AT_BUTT:
2578         case AT_TENT:
2579             tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0,
2580                                    &attknum, &armorpenalty);
2581             dhit = (tmp > (dieroll = rnd(20)) || u.uswallow);
2582             if (dhit) {
2583                 int compat;
2584
2585                 if (!u.uswallow
2586                     && (compat = could_seduce(&youmonst, mon, mattk))) {
2587 #if 0 /*JP*/
2588                     You("%s %s %s.",
2589                         mon->mcansee && haseyes(mon->data) ? "smile at"
2590                                                            : "talk to",
2591                         mon_nam(mon),
2592                         compat == 2 ? "engagingly" : "seductively");
2593 #else
2594                     You("%s\82Ö%s%s\81D",
2595                         mon_nam(mon),
2596                         compat == 2 ? "\96£\97Í\93I\82É" : "\97U\98f\93I\82É",
2597                         mon->mcansee && haseyes(mon->data) ? "\94÷\8fÎ\82Ý\82©\82¯\82½"
2598                                                            : "\98b\82µ\82©\82¯\82½");
2599 #endif
2600                     /* doesn't anger it; no wakeup() */
2601                     sum[i] = damageum(mon, mattk);
2602                     break;
2603                 }
2604                 wakeup(mon);
2605                 /* maybe this check should be in damageum()? */
2606                 if (mon->data == &mons[PM_SHADE]
2607                     && !(mattk->aatyp == AT_KICK && uarmf
2608                          && uarmf->blessed)) {
2609 /*JP
2610                     Your("attack passes harmlessly through %s.",
2611 */
2612                     Your("\8dU\8c\82\82Í%s\82ð\82·\82Á\82Æ\92Ê\82è\82Ê\82¯\82½\81D",
2613                          mon_nam(mon));
2614                     break;
2615                 }
2616                 if (mattk->aatyp == AT_KICK)
2617 /*JP
2618                     You("kick %s.", mon_nam(mon));
2619 */
2620                     You("%s\82ð\8fR\82Á\82½\81D", mon_nam(mon));
2621                 else if (mattk->aatyp == AT_BITE)
2622 /*JP
2623                     You("bite %s.", mon_nam(mon));
2624 */
2625                     You("%s\82É\8a\9a\82Ý\82Â\82¢\82½\81D", mon_nam(mon));
2626                 else if (mattk->aatyp == AT_STNG)
2627 /*JP
2628                     You("sting %s.", mon_nam(mon));
2629 */
2630                     You("%s\82É\93Ë\82«\82³\82µ\82½\81D", mon_nam(mon));
2631                 else if (mattk->aatyp == AT_BUTT)
2632 /*JP
2633                     You("butt %s.", mon_nam(mon));
2634 */
2635                     You("%s\82É\93ª\93Ë\82«\82ð\82­\82ç\82í\82µ\82½\81D", mon_nam(mon));
2636                 else if (mattk->aatyp == AT_TUCH)
2637 /*JP
2638                     You("touch %s.", mon_nam(mon));
2639 */
2640                     You("%s\82É\90G\82ê\82½\81D", mon_nam(mon));
2641                 else if (mattk->aatyp == AT_TENT)
2642 /*JP
2643                     Your("tentacles suck %s.", mon_nam(mon));
2644 */
2645                     Your("\90G\8eè\82ª%s\82Ì\91Ì\89t\82ð\8bz\82¢\82Æ\82Á\82½\81D", mon_nam(mon));
2646                 else
2647 /*JP
2648                     You("hit %s.", mon_nam(mon));
2649 */
2650                     Your("%s\82Ö\82Ì\8dU\8c\82\82Í\96½\92\86\82µ\82½\81D", mon_nam(mon));
2651                 sum[i] = damageum(mon, mattk);
2652             } else {
2653                 missum(mon, mattk, (tmp + armorpenalty > dieroll));
2654             }
2655             break;
2656
2657         case AT_HUGS:
2658             /* automatic if prev two attacks succeed, or if
2659              * already grabbed in a previous attack
2660              */
2661             dhit = 1;
2662             wakeup(mon);
2663             if (mon->data == &mons[PM_SHADE])
2664 /*JP
2665                 Your("hug passes harmlessly through %s.", mon_nam(mon));
2666 */
2667                 You("%s\82ð\82Â\82©\82Ü\82¦\82æ\82¤\82Æ\82µ\82½\82ª\92Ê\82è\82Ê\82¯\82½\81D", mon_nam(mon));
2668             else if (!sticks(mon->data) && !u.uswallow) {
2669                 if (mon == u.ustuck) {
2670 #if 0 /*JP*/
2671                     pline("%s is being %s.", Monnam(mon),
2672                           u.umonnum == PM_ROPE_GOLEM ? "choked" : "crushed");
2673 #else
2674                     pline("%s\82Í%s\81D", Monnam(mon),
2675                           u.umonnum==PM_ROPE_GOLEM ? "\8eñ\82ð\8di\82ß\82ç\82ê\82Ä\82¢\82é"
2676                                                    : "\89\9f\82µ\82Â\82Ô\82³\82ê\82Ä\82¢\82é");
2677 #endif
2678                     sum[i] = damageum(mon, mattk);
2679                 } else if (i >= 2 && sum[i - 1] && sum[i - 2]) {
2680 /*JP
2681                     You("grab %s!", mon_nam(mon));
2682 */
2683                     You("%s\82ð\82Â\82©\82Ü\82¦\82½\81I", mon_nam(mon));
2684                     u.ustuck = mon;
2685                     sum[i] = damageum(mon, mattk);
2686                 }
2687             }
2688             break;
2689
2690         case AT_EXPL: /* automatic hit if next to */
2691             dhit = -1;
2692             wakeup(mon);
2693             sum[i] = explum(mon, mattk);
2694             break;
2695
2696         case AT_ENGL:
2697             tmp = find_roll_to_hit(mon, mattk->aatyp, (struct obj *) 0,
2698                                    &attknum, &armorpenalty);
2699             if ((dhit = (tmp > rnd(20 + i)))) {
2700                 wakeup(mon);
2701                 if (mon->data == &mons[PM_SHADE])
2702 /*JP
2703                     Your("attempt to surround %s is harmless.", mon_nam(mon));
2704 */
2705                     You("%s\82ð\88ù\82Ý\82±\82à\82¤\82Æ\82µ\82½\82ª\8e¸\94s\82µ\82½\81D", mon_nam(mon));
2706                 else {
2707                     sum[i] = gulpum(mon, mattk);
2708                     if (sum[i] == 2 && (mon->data->mlet == S_ZOMBIE
2709                                         || mon->data->mlet == S_MUMMY)
2710                         && rn2(5) && !Sick_resistance) {
2711 /*JP
2712                         You_feel("%ssick.", (Sick) ? "very " : "");
2713 */
2714                         You_feel("%s\8bC\95ª\82ª\88«\82¢\81D", (Sick) ? "\82Æ\82Ä\82à" : "");
2715                         mdamageu(mon, rnd(8));
2716                     }
2717                 }
2718             } else {
2719                 missum(mon, mattk, FALSE);
2720             }
2721             break;
2722
2723         case AT_MAGC:
2724             /* No check for uwep; if wielding nothing we want to
2725              * do the normal 1-2 points bare hand damage...
2726              */
2727             if ((youmonst.data->mlet == S_KOBOLD
2728                  || youmonst.data->mlet == S_ORC
2729                  || youmonst.data->mlet == S_GNOME) && !weapon_used)
2730                 goto use_weapon;
2731
2732         case AT_NONE:
2733         case AT_BOOM:
2734             continue;
2735         /* Not break--avoid passive attacks from enemy */
2736
2737         case AT_BREA:
2738         case AT_SPIT:
2739         case AT_GAZE: /* all done using #monster command */
2740             dhit = 0;
2741             break;
2742
2743         default: /* Strange... */
2744             impossible("strange attack of yours (%d)", mattk->aatyp);
2745         }
2746         if (dhit == -1) {
2747             u.mh = -1; /* dead in the current form */
2748             rehumanize();
2749         }
2750         if (sum[i] == 2)
2751             return (boolean) passive(mon, 1, 0, mattk->aatyp, FALSE);
2752         /* defender dead */
2753         else {
2754             (void) passive(mon, sum[i], 1, mattk->aatyp, FALSE);
2755             nsum |= sum[i];
2756         }
2757         if (!Upolyd)
2758             break; /* No extra attacks if no longer a monster */
2759         if (multi < 0)
2760             break; /* If paralyzed while attacking, i.e. floating eye */
2761     }
2762     return (boolean) (nsum != 0);
2763 }
2764
2765 /*      Special (passive) attacks on you by monsters done here.
2766  */
2767 int
2768 passive(mon, mhit, malive, aatyp, wep_was_destroyed)
2769 register struct monst *mon;
2770 register boolean mhit;
2771 register int malive;
2772 uchar aatyp;
2773 boolean wep_was_destroyed;
2774 {
2775     register struct permonst *ptr = mon->data;
2776     register int i, tmp;
2777
2778     for (i = 0;; i++) {
2779         if (i >= NATTK)
2780             return (malive | mhit); /* no passive attacks */
2781         if (ptr->mattk[i].aatyp == AT_NONE)
2782             break; /* try this one */
2783     }
2784     /* Note: tmp not always used */
2785     if (ptr->mattk[i].damn)
2786         tmp = d((int) ptr->mattk[i].damn, (int) ptr->mattk[i].damd);
2787     else if (ptr->mattk[i].damd)
2788         tmp = d((int) mon->m_lev + 1, (int) ptr->mattk[i].damd);
2789     else
2790         tmp = 0;
2791
2792     /*  These affect you even if they just died.
2793      */
2794     switch (ptr->mattk[i].adtyp) {
2795     case AD_FIRE:
2796         if (mhit && !mon->mcan) {
2797             if (aatyp == AT_KICK) {
2798                 if (uarmf && !rn2(6))
2799                     (void) erode_obj(uarmf, xname(uarmf), ERODE_BURN,
2800                                      EF_GREASE | EF_VERBOSE);
2801             } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2802                        || aatyp == AT_MAGC || aatyp == AT_TUCH)
2803                 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2804         }
2805         break;
2806     case AD_ACID:
2807         if (mhit && rn2(2)) {
2808             if (Blind || !flags.verbose)
2809 /*JP
2810                 You("are splashed!");
2811 */
2812                 You("\89½\82©\82ð\97\81\82Ñ\82¹\82ç\82ê\82½\81I");
2813             else
2814 /*JP
2815                 You("are splashed by %s acid!", s_suffix(mon_nam(mon)));
2816 */
2817                 You("%s\82Ì\8e_\82ð\97\81\82Ñ\82¹\82ç\82ê\82½\81I", s_suffix(mon_nam(mon)));
2818
2819             if (!Acid_resistance)
2820                 mdamageu(mon, tmp);
2821             if (!rn2(30))
2822                 erode_armor(&youmonst, ERODE_CORRODE);
2823         }
2824         if (mhit) {
2825             if (aatyp == AT_KICK) {
2826                 if (uarmf && !rn2(6))
2827                     (void) erode_obj(uarmf, xname(uarmf), ERODE_CORRODE,
2828                                      EF_GREASE | EF_VERBOSE);
2829             } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2830                        || aatyp == AT_MAGC || aatyp == AT_TUCH)
2831                 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2832         }
2833         exercise(A_STR, FALSE);
2834         break;
2835     case AD_STON:
2836         if (mhit) { /* successful attack */
2837             long protector = attk_protection((int) aatyp);
2838
2839             /* hero using monsters' AT_MAGC attack is hitting hand to
2840                hand rather than casting a spell */
2841             if (aatyp == AT_MAGC)
2842                 protector = W_ARMG;
2843
2844             if (protector == 0L /* no protection */
2845                 || (protector == W_ARMG && !uarmg
2846                     && !uwep && !wep_was_destroyed)
2847                 || (protector == W_ARMF && !uarmf)
2848                 || (protector == W_ARMH && !uarmh)
2849                 || (protector == (W_ARMC | W_ARMG) && (!uarmc || !uarmg))) {
2850                 if (!Stone_resistance
2851                     && !(poly_when_stoned(youmonst.data)
2852                          && polymon(PM_STONE_GOLEM))) {
2853                     done_in_by(mon, STONING); /* "You turn to stone..." */
2854                     return 2;
2855                 }
2856             }
2857         }
2858         break;
2859     case AD_RUST:
2860         if (mhit && !mon->mcan) {
2861             if (aatyp == AT_KICK) {
2862                 if (uarmf)
2863                     (void) erode_obj(uarmf, xname(uarmf), ERODE_RUST,
2864                                      EF_GREASE | EF_VERBOSE);
2865             } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2866                        || aatyp == AT_MAGC || aatyp == AT_TUCH)
2867                 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2868         }
2869         break;
2870     case AD_CORR:
2871         if (mhit && !mon->mcan) {
2872             if (aatyp == AT_KICK) {
2873                 if (uarmf)
2874                     (void) erode_obj(uarmf, xname(uarmf), ERODE_CORRODE,
2875                                      EF_GREASE | EF_VERBOSE);
2876             } else if (aatyp == AT_WEAP || aatyp == AT_CLAW
2877                        || aatyp == AT_MAGC || aatyp == AT_TUCH)
2878                 passive_obj(mon, (struct obj *) 0, &(ptr->mattk[i]));
2879         }
2880         break;
2881     case AD_MAGM:
2882         /* wrath of gods for attacking Oracle */
2883         if (Antimagic) {
2884             shieldeff(u.ux, u.uy);
2885 /*JP
2886             pline("A hail of magic missiles narrowly misses you!");
2887 */
2888             pline("\96\82\96@\82Ì\96î\82Ì\89J\82ð\82È\82ñ\82Æ\82©\82©\82í\82µ\82½\81I");
2889         } else {
2890 /*JP
2891             You("are hit by magic missiles appearing from thin air!");
2892 */
2893             pline("\93Ë\94@\8bó\92\86\82É\8c»\82í\82ê\82½\96\82\96@\82Ì\96î\82ª\96½\92\86\82µ\82½\81I");
2894             mdamageu(mon, tmp);
2895         }
2896         break;
2897     case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */
2898         if (mhit) {
2899             struct obj *obj = (struct obj *) 0;
2900
2901             if (aatyp == AT_KICK) {
2902                 obj = uarmf;
2903                 if (!obj)
2904                     break;
2905             } else if (aatyp == AT_BITE || aatyp == AT_BUTT
2906                        || (aatyp >= AT_STNG && aatyp < AT_WEAP)) {
2907                 break; /* no object involved */
2908             }
2909             passive_obj(mon, obj, &(ptr->mattk[i]));
2910         }
2911         break;
2912     default:
2913         break;
2914     }
2915
2916     /*  These only affect you if they still live.
2917      */
2918     if (malive && !mon->mcan && rn2(3)) {
2919         switch (ptr->mattk[i].adtyp) {
2920         case AD_PLYS:
2921             if (ptr == &mons[PM_FLOATING_EYE]) {
2922                 if (!canseemon(mon)) {
2923                     break;
2924                 }
2925                 if (mon->mcansee) {
2926 /*JP
2927                     if (ureflects("%s gaze is reflected by your %s.",
2928 */
2929                     if (ureflects("%s\82Ì\82É\82ç\82Ý\82Í%s\82É\82æ\82Á\82Ä\94½\8eË\82³\82ê\82½\81D",
2930                                   s_suffix(Monnam(mon)))) {
2931                         ;
2932                     } else if (Free_action) {
2933 /*JP
2934                         You("momentarily stiffen under %s gaze!",
2935 */
2936                         You("%s\82Ì\82É\82ç\82Ý\82Å\88ê\8fu\8dd\92¼\82µ\82½\81I",
2937                             s_suffix(mon_nam(mon)));
2938                     } else if (Hallucination && rn2(4)) {
2939 #if 0 /*JP*/
2940                         pline("%s looks %s%s.", Monnam(mon),
2941                               !rn2(2) ? "" : "rather ",
2942                               !rn2(2) ? "numb" : "stupified");
2943 #else
2944                         pline("%s\82Í%s\82Î\82©\82É\82È\82Á\82½\82æ\82¤\82¾\81D", Monnam(mon),
2945                               !rn2(2) ? "" : "\8f­\82µ");
2946 #endif
2947                     } else {
2948 /*JP
2949                         You("are frozen by %s gaze!", s_suffix(mon_nam(mon)));
2950 */
2951                         You("%s\82Ì\82É\82ç\82Ý\82Å\93®\82¯\82È\82­\82È\82Á\82½\81I", mon_nam(mon));
2952                         nomul((ACURR(A_WIS) > 12 || rn2(4)) ? -tmp : -127);
2953 /*JP
2954                         multi_reason = "frozen by a monster's gaze";
2955 */
2956                         multi_reason = "\89ö\95¨\82Ì\82É\82ç\82Ý\82Å\8dd\92¼\82µ\82Ä\82¢\82é\8e\9e\82É";
2957                         nomovemsg = 0;
2958                     }
2959                 } else {
2960 #if 0 /*JP*/
2961                     pline("%s cannot defend itself.",
2962                           Adjmonnam(mon, "blind"));
2963 #else
2964                     pline("%s\82Í\96h\8cä\82Å\82«\82È\82¢\81D",
2965                           Adjmonnam(mon,"\96Ú\82Ì\8c©\82¦\82È\82¢"));
2966 #endif
2967                     if (!rn2(500))
2968                         change_luck(-1);
2969                 }
2970             } else if (Free_action) {
2971 /*JP
2972                 You("momentarily stiffen.");
2973 */
2974                 You("\88ê\8fu\8dd\92¼\82µ\82½\81D");
2975             } else { /* gelatinous cube */
2976 /*JP
2977                 You("are frozen by %s!", mon_nam(mon));
2978 */
2979                 You("%s\82É\82æ\82Á\82Ä\93®\82¯\82È\82­\82È\82Á\82½\81I", mon_nam(mon));
2980                 nomovemsg = You_can_move_again;
2981                 nomul(-tmp);
2982 /*JP
2983                 multi_reason = "frozen by a monster";
2984 */
2985                 multi_reason = "\89ö\95¨\82É\82æ\82Á\82Ä\8dd\92¼\82µ\82Ä\82¢\82é\8e\9e\82É";
2986                 exercise(A_DEX, FALSE);
2987             }
2988             break;
2989         case AD_COLD: /* brown mold or blue jelly */
2990             if (monnear(mon, u.ux, u.uy)) {
2991                 if (Cold_resistance) {
2992                     shieldeff(u.ux, u.uy);
2993 /*JP
2994                     You_feel("a mild chill.");
2995 */
2996                     You("\8a¦\82³\82ð\8a´\82\82½\81D");
2997                     ugolemeffects(AD_COLD, tmp);
2998                     break;
2999                 }
3000 /*JP
3001                 You("are suddenly very cold!");
3002 */
3003                 You("\93Ë\91R\81C\96Ò\97ó\82É\8a¦\82­\82È\82Á\82½\81I");
3004                 mdamageu(mon, tmp);
3005                 /* monster gets stronger with your heat! */
3006                 mon->mhp += tmp / 2;
3007                 if (mon->mhpmax < mon->mhp)
3008                     mon->mhpmax = mon->mhp;
3009                 /* at a certain point, the monster will reproduce! */
3010                 if (mon->mhpmax > ((int) (mon->m_lev + 1) * 8))
3011                     (void) split_mon(mon, &youmonst);
3012             }
3013             break;
3014         case AD_STUN: /* specifically yellow mold */
3015             if (!Stunned)
3016                 make_stunned((long) tmp, TRUE);
3017             break;
3018         case AD_FIRE:
3019             if (monnear(mon, u.ux, u.uy)) {
3020                 if (Fire_resistance) {
3021                     shieldeff(u.ux, u.uy);
3022 /*JP
3023                     You_feel("mildly warm.");
3024 */
3025                     You("\92g\82©\82³\82ð\8a´\82\82½\81D");
3026                     ugolemeffects(AD_FIRE, tmp);
3027                     break;
3028                 }
3029 /*JP
3030                 You("are suddenly very hot!");
3031 */
3032                 You("\93Ë\91R\81C\96Ò\97ó\82É\94M\82­\82È\82Á\82½\81I");
3033                 mdamageu(mon, tmp); /* fire damage */
3034             }
3035             break;
3036         case AD_ELEC:
3037             if (Shock_resistance) {
3038                 shieldeff(u.ux, u.uy);
3039 /*JP
3040                 You_feel("a mild tingle.");
3041 */
3042                 You("\83s\83\8a\83s\83\8a\82Æá\83\82ê\82ð\8a´\82\82½\81D");
3043                 ugolemeffects(AD_ELEC, tmp);
3044                 break;
3045             }
3046 /*JP
3047             You("are jolted with electricity!");
3048 */
3049             You("\93d\8bC\83V\83\87\83b\83N\82ð\82¤\82¯\82½\81I");
3050             mdamageu(mon, tmp);
3051             break;
3052         default:
3053             break;
3054         }
3055     }
3056     return (malive | mhit);
3057 }
3058
3059 /*
3060  * Special (passive) attacks on an attacking object by monsters done here.
3061  * Assumes the attack was successful.
3062  */
3063 void
3064 passive_obj(mon, obj, mattk)
3065 register struct monst *mon;
3066 register struct obj *obj; /* null means pick uwep, uswapwep or uarmg */
3067 struct attack *mattk;     /* null means we find one internally */
3068 {
3069     struct permonst *ptr = mon->data;
3070     register int i;
3071
3072     /* if caller hasn't specified an object, use uwep, uswapwep or uarmg */
3073     if (!obj) {
3074         obj = (u.twoweap && uswapwep && !rn2(2)) ? uswapwep : uwep;
3075         if (!obj && mattk->adtyp == AD_ENCH)
3076             obj = uarmg; /* no weapon? then must be gloves */
3077         if (!obj)
3078             return; /* no object to affect */
3079     }
3080
3081     /* if caller hasn't specified an attack, find one */
3082     if (!mattk) {
3083         for (i = 0;; i++) {
3084             if (i >= NATTK)
3085                 return; /* no passive attacks */
3086             if (ptr->mattk[i].aatyp == AT_NONE)
3087                 break; /* try this one */
3088         }
3089         mattk = &(ptr->mattk[i]);
3090     }
3091
3092     switch (mattk->adtyp) {
3093     case AD_FIRE:
3094         if (!rn2(6) && !mon->mcan) {
3095             (void) erode_obj(obj, NULL, ERODE_BURN, EF_NONE);
3096         }
3097         break;
3098     case AD_ACID:
3099         if (!rn2(6)) {
3100             (void) erode_obj(obj, NULL, ERODE_CORRODE, EF_NONE);
3101         }
3102         break;
3103     case AD_RUST:
3104         if (!mon->mcan) {
3105             (void) erode_obj(obj, NULL, ERODE_RUST, EF_NONE);
3106         }
3107         break;
3108     case AD_CORR:
3109         if (!mon->mcan) {
3110             (void) erode_obj(obj, NULL, ERODE_CORRODE, EF_NONE);
3111         }
3112         break;
3113     case AD_ENCH:
3114         if (!mon->mcan) {
3115             if (drain_item(obj) && carried(obj)
3116                 && (obj->known || obj->oclass == ARMOR_CLASS)) {
3117 /*JP
3118                 pline("%s less effective.", Yobjnam2(obj, "seem"));
3119 */
3120                 Your("%s\82©\82ç\96\82\97Í\82ª\8fÁ\82¦\82½\82æ\82¤\82¾\81D", xname(obj));
3121             }
3122             break;
3123         }
3124     default:
3125         break;
3126     }
3127
3128     if (carried(obj))
3129         update_inventory();
3130 }
3131
3132 /* Note: caller must ascertain mtmp is mimicking... */
3133 void
3134 stumble_onto_mimic(mtmp)
3135 struct monst *mtmp;
3136 {
3137 /*JP
3138     const char *fmt = "Wait!  That's %s!", *generic = "a monster", *what = 0;
3139 */
3140     const char *fmt = "\82¿\82å\82Á\82Æ\82Ü\82Á\82½\81I%s\82¾\81I", *generic = "\89ö\95¨", *what = 0;
3141
3142     if (!u.ustuck && !mtmp->mflee && dmgtype(mtmp->data, AD_STCK))
3143         u.ustuck = mtmp;
3144
3145     if (Blind) {
3146         if (!Blind_telepat)
3147             what = generic; /* with default fmt */
3148         else if (mtmp->m_ap_type == M_AP_MONSTER)
3149             what = a_monnam(mtmp); /* differs from what was sensed */
3150     } else {
3151         int glyph = levl[u.ux + u.dx][u.uy + u.dy].glyph;
3152
3153         if (glyph_is_cmap(glyph) && (glyph_to_cmap(glyph) == S_hcdoor
3154                                      || glyph_to_cmap(glyph) == S_vcdoor))
3155 /*JP
3156             fmt = "The door actually was %s!";
3157 */
3158             fmt = "\94à\82Í\8eÀ\8dÛ\82É\82Í%s\82¾\82Á\82½\81I";
3159         else if (glyph_is_object(glyph) && glyph_to_obj(glyph) == GOLD_PIECE)
3160 /*JP
3161             fmt = "That gold was %s!";
3162 */
3163             fmt = "\8bà\89Ý\82Í%s\82¾\82Á\82½\81I";
3164
3165         /* cloned Wiz starts out mimicking some other monster and
3166            might make himself invisible before being revealed */
3167         if (mtmp->minvis && !See_invisible)
3168             what = generic;
3169         else
3170             what = a_monnam(mtmp);
3171     }
3172     if (what)
3173         pline(fmt, what);
3174
3175     wakeup(mtmp); /* clears mimicking */
3176     /* if hero is blind, wakeup() won't display the monster even though
3177        it's no longer concealed */
3178     if (!canspotmon(mtmp)
3179         && !glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph))
3180         map_invisible(mtmp->mx, mtmp->my);
3181 }
3182
3183 STATIC_OVL void
3184 nohandglow(mon)
3185 struct monst *mon;
3186 {
3187     char *hands = makeplural(body_part(HAND));
3188
3189     if (!u.umconf || mon->mconf)
3190         return;
3191     if (u.umconf == 1) {
3192         if (Blind)
3193 /*JP
3194             Your("%s stop tingling.", hands);
3195 */
3196             Your("%s\82Ìá\83\82ê\82ª\82Æ\82ê\82½\81D", hands);
3197         else
3198 /*JP
3199             Your("%s stop glowing %s.", hands, hcolor(NH_RED));
3200 */
3201             Your("%s\82Ì%s\8bP\82«\82Í\82È\82­\82È\82Á\82½\81D", hands, hcolor(NH_RED));
3202     } else {
3203         if (Blind)
3204 /*JP
3205             pline_The("tingling in your %s lessens.", hands);
3206 */
3207             pline("%s\82Ìá\83\82ê\82ª\82Æ\82ê\82Ä\82«\82½\81D",hands);
3208         else
3209 /*JP
3210             Your("%s no longer glow so brightly %s.", hands, hcolor(NH_RED));
3211 */
3212             Your("%s\82Ì%s\8bP\82«\82ª\82È\82­\82È\82Á\82Ä\82«\82½\81D",hands, hcolor(NH_RED));
3213     }
3214     u.umconf--;
3215 }
3216
3217 int
3218 flash_hits_mon(mtmp, otmp)
3219 struct monst *mtmp;
3220 struct obj *otmp; /* source of flash */
3221 {
3222     int tmp, amt, res = 0, useeit = canseemon(mtmp);
3223
3224     if (mtmp->msleeping) {
3225         mtmp->msleeping = 0;
3226         if (useeit) {
3227 /*JP
3228             pline_The("flash awakens %s.", mon_nam(mtmp));
3229 */
3230             pline("\91M\8cõ\82Å%s\82ª\96Ú\82ð\8ao\82Ü\82µ\82½\81D", mon_nam(mtmp));
3231             res = 1;
3232         }
3233     } else if (mtmp->data->mlet != S_LIGHT) {
3234         if (!resists_blnd(mtmp)) {
3235             tmp = dist2(otmp->ox, otmp->oy, mtmp->mx, mtmp->my);
3236             if (useeit) {
3237 /*JP
3238                 pline("%s is blinded by the flash!", Monnam(mtmp));
3239 */
3240                 pline("%s\82Í\91M\8cõ\82Å\96Ú\82ª\8c©\82¦\82È\82­\82È\82Á\82½\81I", Monnam(mtmp));
3241                 res = 1;
3242             }
3243             if (mtmp->data == &mons[PM_GREMLIN]) {
3244                 /* Rule #1: Keep them out of the light. */
3245                 amt = otmp->otyp == WAN_LIGHT ? d(1 + otmp->spe, 4)
3246                                               : rn2(min(mtmp->mhp, 4));
3247                 light_hits_gremlin(mtmp, amt);
3248             }
3249             if (mtmp->mhp > 0) {
3250                 if (!context.mon_moving)
3251                     setmangry(mtmp);
3252                 if (tmp < 9 && !mtmp->isshk && rn2(4))
3253                     monflee(mtmp, rn2(4) ? rnd(100) : 0, FALSE, TRUE);
3254                 mtmp->mcansee = 0;
3255                 mtmp->mblinded = (tmp < 3) ? 0 : rnd(1 + 50 / tmp);
3256             }
3257         }
3258     }
3259     return res;
3260 }
3261
3262 void
3263 light_hits_gremlin(mon, dmg)
3264 struct monst *mon;
3265 int dmg;
3266 {
3267 #if 0 /*JP*/
3268     pline("%s %s!", Monnam(mon),
3269           (dmg > mon->mhp / 2) ? "wails in agony" : "cries out in pain");
3270 #else
3271     pline("%s\82Í%s\81I", Monnam(mon),
3272           (dmg > mon->mhp / 2) ? "\8bê\92É\82Ì\90º\82ð\82 \82°\82½" : "\8c\83\92É\82Å\8b©\82ñ\82¾");
3273 #endif
3274     if ((mon->mhp -= dmg) <= 0) {
3275         if (context.mon_moving)
3276             monkilled(mon, (char *) 0, AD_BLND);
3277         else
3278             killed(mon);
3279     } else if (cansee(mon->mx, mon->my) && !canspotmon(mon)) {
3280         map_invisible(mon->mx, mon->my);
3281     }
3282 }
3283
3284 /*uhitm.c*/