OSDN Git Service

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