OSDN Git Service

ソースコードのUTF-8化。
[hengband/hengband.git] / src / melee1.c
1 /*!
2  * @file melee1.c
3  * @brief モンスターの打撃処理 / Monster attacks
4  * @date 2014/01/17
5  * @author
6  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
7  * This software may be copied and distributed for educational, research,\n
8  * and not for profit purposes provided that this copyright and statement\n
9  * are included in all such copies.  Other copyrights may also apply.\n
10  * 2014 Deskull rearranged comment for Doxygen.\n
11  * @details
12  */
13
14 #include "angband.h"
15
16
17 /*!
18  * @brief モンスター打撃のクリティカルランクを返す /
19  * Critical blow. All hits that do 95% of total possible damage,
20  * @param dice モンスター打撃のダイス数
21  * @param sides モンスター打撃の最大ダイス目
22  * @param dam プレイヤーに与えたダメージ
23  * @details
24  * and which also do at least 20 damage, or, sometimes, N damage.
25  * This is used only to determine "cuts" and "stuns".
26  */
27 static int monster_critical(int dice, int sides, int dam)
28 {
29         int max = 0;
30         int total = dice * sides;
31
32         /* Must do at least 95% of perfect */
33         if (dam < total * 19 / 20) return (0);
34
35         /* Weak blows rarely work */
36         if ((dam < 20) && (randint0(100) >= dam)) return (0);
37
38         /* Perfect damage */
39         if ((dam >= total) && (dam >= 40)) max++;
40
41         /* Super-charge */
42         if (dam >= 20)
43         {
44                 while (randint0(100) < 2) max++;
45         }
46
47         /* Critical damage */
48         if (dam > 45) return (6 + max);
49         if (dam > 33) return (5 + max);
50         if (dam > 25) return (4 + max);
51         if (dam > 18) return (3 + max);
52         if (dam > 11) return (2 + max);
53         return (1 + max);
54 }
55
56 /*!
57  * @brief モンスター打撃の命中を判定する /
58  * Determine if a monster attack against the player succeeds.
59  * @param power 打撃属性毎の基本命中値
60  * @param level モンスターのレベル
61  * @param stun モンスターの朦朧値
62  * @return TRUEならば命中判定
63  * @details
64  * Always miss 5% of the time, Always hit 5% of the time.
65  * Otherwise, match monster power against player armor.
66  */
67 static int check_hit(int power, int level, int stun)
68 {
69         int i, k, ac;
70
71         /* Percentile dice */
72         k = randint0(100);
73
74         if (stun && one_in_(2)) return FALSE;
75
76         /* Hack -- Always miss or hit */
77         if (k < 10) return (k < 5);
78
79         /* Calculate the "attack quality" */
80         i = (power + (level * 3));
81
82         /* Total armor */
83         ac = p_ptr->ac + p_ptr->to_a;
84         if (p_ptr->special_attack & ATTACK_SUIKEN) ac += (p_ptr->lev * 2);
85
86         /* Power and Level compete against Armor */
87         if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
88
89         /* Assume miss */
90         return (FALSE);
91 }
92
93
94
95 /*! モンスターの侮辱行為メッセージテーブル / Hack -- possible "insult" messages */
96 static cptr desc_insult[] =
97 {
98 #ifdef JP
99         "があなたを侮辱した!",
100         "があなたの母を侮辱した!",
101         "があなたを軽蔑した!",
102         "があなたを辱めた!",
103         "があなたを汚した!",
104         "があなたの回りで踊った!",
105         "が猥褻な身ぶりをした!",
106         "があなたをぼんやりと見た!!!",
107         "があなたをパラサイト呼ばわりした!",
108         "があなたをサイボーグ扱いした!"
109 #else
110         "insults you!",
111         "insults your mother!",
112         "gives you the finger!",
113         "humiliates you!",
114         "defiles you!",
115         "dances around you!",
116         "makes obscene gestures!",
117         "moons you!!!"
118         "calls you a parasite!",
119         "calls you a cyborg!"
120 #endif
121
122 };
123
124
125 /*! マゴットのぼやきメッセージテーブル / Hack -- possible "insult" messages */
126 static cptr desc_moan[] =
127 {
128 #ifdef JP
129         "は何かを悲しんでいるようだ。",
130         "が彼の飼い犬を見なかったかと尋ねている。",
131         "が縄張りから出て行けと言っている。",
132         "はキノコがどうとか呟いている。"
133 #else
134         "seems sad about something.",
135         "asks if you have seen his dogs.",
136         "tells you to get off his land.",
137         "mumbles something about mushrooms."
138 #endif
139
140 };
141
142
143 /*!
144  * @brief モンスターからプレイヤーへの打撃処理 / Attack the player via physical attacks.
145  * @param m_idx 打撃を行うモンスターのID
146  * @return 実際に攻撃処理を行った場合TRUEを返す
147  */
148 bool make_attack_normal(int m_idx)
149 {
150         monster_type *m_ptr = &m_list[m_idx];
151
152         monster_race *r_ptr = &r_info[m_ptr->r_idx];
153
154         int ap_cnt;
155
156         int i, k, tmp, ac, rlev;
157         int do_cut, do_stun;
158
159         s32b gold;
160
161         object_type *o_ptr;
162
163         char o_name[MAX_NLEN];
164
165         char m_name[80];
166
167         char ddesc[80];
168
169         bool blinked;
170         bool touched = FALSE, fear = FALSE, alive = TRUE;
171         bool explode = FALSE;
172         bool do_silly_attack = (one_in_(2) && p_ptr->image);
173         int get_damage = 0;
174 #ifdef JP
175         int abbreviate = 0;
176 #endif
177
178         /* Not allowed to attack */
179         if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE);
180
181         if (d_info[dungeon_type].flags1 & DF1_NO_MELEE) return (FALSE);
182
183         /* ...nor if friendly */
184         if (!is_hostile(m_ptr)) return FALSE;
185
186         /* Extract the effective monster level */
187         rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
188
189
190         /* Get the monster name (or "it") */
191         monster_desc(m_name, m_ptr, 0);
192
193         /* Get the "died from" information (i.e. "a kobold") */
194         monster_desc(ddesc, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
195
196         if (p_ptr->special_defense & KATA_IAI)
197         {
198 #ifdef JP
199                 msg_print("相手が襲いかかる前に素早く武器を振るった。");
200 #else
201                 msg_format("You took sen, draw and cut in one motion before %s move.", m_name);
202 #endif
203                 if (py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
204         }
205
206         if ((p_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (p_ptr->lev*3/5+20)))
207         {
208                 if (kawarimi(TRUE)) return TRUE;
209         }
210
211         /* Assume no blink */
212         blinked = FALSE;
213
214         /* Scan through all four blows */
215         for (ap_cnt = 0; ap_cnt < 4; ap_cnt++)
216         {
217                 bool obvious = FALSE;
218
219                 int power = 0;
220                 int damage = 0;
221
222                 cptr act = NULL;
223
224                 /* Extract the attack infomation */
225                 int effect = r_ptr->blow[ap_cnt].effect;
226                 int method = r_ptr->blow[ap_cnt].method;
227                 int d_dice = r_ptr->blow[ap_cnt].d_dice;
228                 int d_side = r_ptr->blow[ap_cnt].d_side;
229
230
231                 if (!m_ptr->r_idx) break;
232
233                 /* Hack -- no more attacks */
234                 if (!method) break;
235
236                 if (is_pet(m_ptr) && (r_ptr->flags1 & RF1_UNIQUE) && (method == RBM_EXPLODE))
237                 {
238                         method = RBM_HIT;
239                         d_dice /= 10;
240                 }
241
242                 /* Stop if player is dead or gone */
243                 if (!p_ptr->playing || p_ptr->is_dead) break;
244                 if (distance(py, px, m_ptr->fy, m_ptr->fx) > 1) break;
245
246                 /* Handle "leaving" */
247                 if (p_ptr->leaving) break;
248
249                 if (method == RBM_SHOOT) continue;
250
251                 /* Extract the attack "power" */
252                 power = mbe_info[effect].power;
253
254                 /* Total armor */
255                 ac = p_ptr->ac + p_ptr->to_a;
256
257                 /* Monster hits player */
258                 if (!effect || check_hit(power, rlev, MON_STUNNED(m_ptr)))
259                 {
260                         /* Always disturbing */
261                         disturb(1, 1);
262
263
264                         /* Hack -- Apply "protection from evil" */
265                         if ((p_ptr->protevil > 0) &&
266                             (r_ptr->flags3 & RF3_EVIL) &&
267                             (p_ptr->lev >= rlev) &&
268                             ((randint0(100) + p_ptr->lev) > 50))
269                         {
270                                 /* Remember the Evil-ness */
271                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
272
273                                 /* Message */
274 #ifdef JP
275                                 if (abbreviate)
276                                     msg_format("撃退した。");
277                                 else
278                                     msg_format("%^sは撃退された。", m_name);
279                                 abbreviate = 1;/*2回目以降は省略 */
280 #else
281                                 msg_format("%^s is repelled.", m_name);
282 #endif
283
284
285                                 /* Hack -- Next attack */
286                                 continue;
287                         }
288
289
290                         /* Assume no cut or stun */
291                         do_cut = do_stun = 0;
292
293                         /* Describe the attack method */
294                         switch (method)
295                         {
296                                 case RBM_HIT:
297                                 {
298 #ifdef JP
299                                         act = "殴られた。";
300 #else
301                                         act = "hits you.";
302 #endif
303
304                                         do_cut = do_stun = 1;
305                                         touched = TRUE;
306                                         sound(SOUND_HIT);
307                                         break;
308                                 }
309
310                                 case RBM_TOUCH:
311                                 {
312 #ifdef JP
313                                         act = "触られた。";
314 #else
315                                         act = "touches you.";
316 #endif
317
318                                         touched = TRUE;
319                                         sound(SOUND_TOUCH);
320                                         break;
321                                 }
322
323                                 case RBM_PUNCH:
324                                 {
325 #ifdef JP
326                                         act = "パンチされた。";
327 #else
328                                         act = "punches you.";
329 #endif
330
331                                         touched = TRUE;
332                                         do_stun = 1;
333                                         sound(SOUND_HIT);
334                                         break;
335                                 }
336
337                                 case RBM_KICK:
338                                 {
339 #ifdef JP
340                                         act = "蹴られた。";
341 #else
342                                         act = "kicks you.";
343 #endif
344
345                                         touched = TRUE;
346                                         do_stun = 1;
347                                         sound(SOUND_HIT);
348                                         break;
349                                 }
350
351                                 case RBM_CLAW:
352                                 {
353 #ifdef JP
354                                         act = "ひっかかれた。";
355 #else
356                                         act = "claws you.";
357 #endif
358
359                                         touched = TRUE;
360                                         do_cut = 1;
361                                         sound(SOUND_CLAW);
362                                         break;
363                                 }
364
365                                 case RBM_BITE:
366                                 {
367 #ifdef JP
368                                         act = "噛まれた。";
369 #else
370                                         act = "bites you.";
371 #endif
372
373                                         do_cut = 1;
374                                         touched = TRUE;
375                                         sound(SOUND_BITE);
376                                         break;
377                                 }
378
379                                 case RBM_STING:
380                                 {
381 #ifdef JP
382                                         act = "刺された。";
383 #else
384                                         act = "stings you.";
385 #endif
386
387                                         touched = TRUE;
388                                         sound(SOUND_STING);
389                                         break;
390                                 }
391
392                                 case RBM_SLASH:
393                                 {
394 #ifdef JP
395                                         act = "斬られた。";
396 #else
397                                         act = "slashes you.";
398 #endif
399
400                                         touched = TRUE;
401                                         do_cut = 1;
402                                         sound(SOUND_CLAW);
403                                         break;
404                                 }
405
406                                 case RBM_BUTT:
407                                 {
408 #ifdef JP
409                                         act = "角で突かれた。";
410 #else
411                                         act = "butts you.";
412 #endif
413
414                                         do_stun = 1;
415                                         touched = TRUE;
416                                         sound(SOUND_HIT);
417                                         break;
418                                 }
419
420                                 case RBM_CRUSH:
421                                 {
422 #ifdef JP
423                                         act = "体当たりされた。";
424 #else
425                                         act = "crushes you.";
426 #endif
427
428                                         do_stun = 1;
429                                         touched = TRUE;
430                                         sound(SOUND_CRUSH);
431                                         break;
432                                 }
433
434                                 case RBM_ENGULF:
435                                 {
436 #ifdef JP
437                                         act = "飲み込まれた。";
438 #else
439                                         act = "engulfs you.";
440 #endif
441
442                                         touched = TRUE;
443                                         sound(SOUND_CRUSH);
444                                         break;
445                                 }
446
447                                 case RBM_CHARGE:
448                                 {
449 #ifdef JP
450                                         abbreviate = -1;
451                                         act = "は請求書をよこした。";
452 #else
453                                         act = "charges you.";
454 #endif
455
456                                         touched = TRUE;
457                                         sound(SOUND_BUY); /* Note! This is "charges", not "charges at". */
458                                         break;
459                                 }
460
461                                 case RBM_CRAWL:
462                                 {
463 #ifdef JP
464                                         abbreviate = -1;
465                                         act = "が体の上を這い回った。";
466 #else
467                                         act = "crawls on you.";
468 #endif
469
470                                         touched = TRUE;
471                                         sound(SOUND_SLIME);
472                                         break;
473                                 }
474
475                                 case RBM_DROOL:
476                                 {
477 #ifdef JP
478                                         act = "よだれをたらされた。";
479 #else
480                                         act = "drools on you.";
481 #endif
482
483                                         sound(SOUND_SLIME);
484                                         break;
485                                 }
486
487                                 case RBM_SPIT:
488                                 {
489 #ifdef JP
490                                         act = "唾を吐かれた。";
491 #else
492                                         act = "spits on you.";
493 #endif
494
495                                         sound(SOUND_SLIME);
496                                         break;
497                                 }
498
499                                 case RBM_EXPLODE:
500                                 {
501 #ifdef JP
502                                         abbreviate = -1;
503                                         act = "は爆発した。";
504 #else
505                                         act = "explodes.";
506 #endif
507
508                                         explode = TRUE;
509                                         break;
510                                 }
511
512                                 case RBM_GAZE:
513                                 {
514 #ifdef JP
515                                         act = "にらまれた。";
516 #else
517                                         act = "gazes at you.";
518 #endif
519
520                                         break;
521                                 }
522
523                                 case RBM_WAIL:
524                                 {
525 #ifdef JP
526                                         act = "泣き叫ばれた。";
527 #else
528                                         act = "wails at you.";
529 #endif
530
531                                         sound(SOUND_WAIL);
532                                         break;
533                                 }
534
535                                 case RBM_SPORE:
536                                 {
537 #ifdef JP
538                                         act = "胞子を飛ばされた。";
539 #else
540                                         act = "releases spores at you.";
541 #endif
542
543                                         sound(SOUND_SLIME);
544                                         break;
545                                 }
546
547                                 case RBM_XXX4:
548                                 {
549 #ifdef JP
550                                         abbreviate = -1;
551                                         act = "が XXX4 を発射した。";
552 #else
553                                         act = "projects XXX4's at you.";
554 #endif
555
556                                         break;
557                                 }
558
559                                 case RBM_BEG:
560                                 {
561 #ifdef JP
562                                         act = "金をせがまれた。";
563 #else
564                                         act = "begs you for money.";
565 #endif
566
567                                         sound(SOUND_MOAN);
568                                         break;
569                                 }
570
571                                 case RBM_INSULT:
572                                 {
573 #ifdef JP
574                                         abbreviate = -1;
575 #endif
576                                         act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
577                                         sound(SOUND_MOAN);
578                                         break;
579                                 }
580
581                                 case RBM_MOAN:
582                                 {
583 #ifdef JP
584                                         abbreviate = -1;
585 #endif
586                                         act = desc_moan[randint0(4)];
587                                         sound(SOUND_MOAN);
588                                         break;
589                                 }
590
591                                 case RBM_SHOW:
592                                 {
593 #ifdef JP
594                                         abbreviate = -1;
595 #endif
596                                         if (m_ptr->r_idx == MON_JAIAN)
597                                         {
598 #ifdef JP
599                                                 switch(randint1(15))
600                                                 {
601                                                   case 1:
602                                                   case 6:
603                                                   case 11:
604                                                         act = "「♪お~れはジャイアン~~ガ~キだいしょう~」";
605                                                         break;
606                                                   case 2:
607                                                         act = "「♪て~んかむ~てきのお~とこだぜ~~」";
608                                                         break;
609                                                   case 3:
610                                                         act = "「♪の~び太スネ夫はメじゃないよ~~」";
611                                                         break;
612                                                   case 4:
613                                                         act = "「♪け~んかスポ~ツ~どんとこい~」";
614                                                         break;
615                                                   case 5:
616                                                         act = "「♪うた~も~~う~まいぜ~まかしとけ~」";
617                                                         break;
618                                                   case 7:
619                                                         act = "「♪ま~ちいちば~んのに~んきもの~~」";
620                                                         break;
621                                                   case 8:
622                                                         act = "「♪べんきょうしゅくだいメじゃないよ~~」";
623                                                         break;
624                                                   case 9:
625                                                         act = "「♪きはやさし~くて~ち~からもち~」";
626                                                         break;
627                                                   case 10:
628                                                         act = "「♪かお~も~~スタイルも~バツグンさ~」";
629                                                         break;
630                                                   case 12:
631                                                         act = "「♪がっこうい~ちの~あ~ばれんぼう~~」";
632                                                         break;
633                                                   case 13:
634                                                         act = "「♪ド~ラもドラミもメじゃないよ~~」";
635                                                         break;
636                                                   case 14:
637                                                         act = "「♪よじげんぽけっと~な~くたって~」";
638                                                         break;
639                                                   case 15:
640                                                         act = "「♪あし~の~~ながさ~は~まけないぜ~」";
641                                                         break;
642                                                 }
643 #else
644                                                 act = "horribly sings 'I AM GIAAAAAN. THE BOOOSS OF THE KIIIIDS.'";
645 #endif
646                                         }
647                                         else
648                                         {
649                                                 if (one_in_(3))
650 #ifdef JP
651                                                         act = "は♪僕らは楽しい家族♪と歌っている。";
652                                                 else
653                                                         act = "は♪アイ ラブ ユー、ユー ラブ ミー♪と歌っている。";
654 #else
655                                                         act = "sings 'We are a happy family.'";
656                                                 else
657                                                         act = "sings 'I love you, you love me.'";
658 #endif
659                                         }
660
661                                         sound(SOUND_SHOW);
662                                         break;
663                                 }
664                         }
665
666                         /* Message */
667                         if (act)
668                         {
669                                 if (do_silly_attack)
670                                 {
671 #ifdef JP
672                                         abbreviate = -1;
673 #endif
674                                         act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
675                                 }
676 #ifdef JP
677                                 if (abbreviate == 0)
678                                     msg_format("%^sに%s", m_name, act);
679                                 else if (abbreviate == 1)
680                                     msg_format("%s", act);
681                                 else /* if (abbreviate == -1) */
682                                     msg_format("%^s%s", m_name, act);
683                                 abbreviate = 1;/*2回目以降は省略 */
684 #else
685                                 msg_format("%^s %s%s", m_name, act, do_silly_attack ? " you." : "");
686 #endif
687                         }
688
689                         /* Hack -- assume all attacks are obvious */
690                         obvious = TRUE;
691
692                         /* Roll out the damage */
693                         damage = damroll(d_dice, d_side);
694
695                         /*
696                          * Skip the effect when exploding, since the explosion
697                          * already causes the effect.
698                          */
699                         if (explode)
700                                 damage = 0;
701                         /* Apply appropriate damage */
702                         switch (effect)
703                         {
704                                 case 0:
705                                 {
706                                         /* Hack -- Assume obvious */
707                                         obvious = TRUE;
708
709                                         /* Hack -- No damage */
710                                         damage = 0;
711
712                                         break;
713                                 }
714
715                                 case RBE_SUPERHURT:
716                                 {
717                                         if (((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) && !CHECK_MULTISHADOW())
718                                         {
719                                                 int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
720 #ifdef JP
721                                                 msg_print("痛恨の一撃!");
722 #else
723                                                 msg_print("It was a critical hit!");
724 #endif
725
726                                                 tmp_damage = MAX(damage, tmp_damage*2);
727
728                                                 /* Take damage */
729                                                 get_damage += take_hit(DAMAGE_ATTACK, tmp_damage, ddesc, -1);
730                                                 break;
731                                         }
732                                 }
733                                 case RBE_HURT:
734                                 {
735                                         /* Obvious */
736                                         obvious = TRUE;
737
738                                         /* Hack -- Player armor reduces total damage */
739                                         damage -= (damage * ((ac < 150) ? ac : 150) / 250);
740
741                                         /* Take damage */
742                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
743
744                                         break;
745                                 }
746
747                                 case RBE_POISON:
748                                 {
749                                         if (explode) break;
750
751                                         /* Take "poison" effect */
752                                         if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && !CHECK_MULTISHADOW())
753                                         {
754                                                 if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
755                                                 {
756                                                         obvious = TRUE;
757                                                 }
758                                         }
759
760                                         /* Take some damage */
761                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
762
763                                         /* Learn about the player */
764                                         update_smart_learn(m_idx, DRS_POIS);
765
766                                         break;
767                                 }
768
769                                 case RBE_UN_BONUS:
770                                 {
771                                         if (explode) break;
772
773                                         /* Allow complete resist */
774                                         if (!p_ptr->resist_disen && !CHECK_MULTISHADOW())
775                                         {
776                                                 /* Apply disenchantment */
777                                                 if (apply_disenchant(0))
778                                                 {
779                                                         /* Hack -- Update AC */
780                                                         update_stuff();
781                                                         obvious = TRUE;
782                                                 }
783                                         }
784
785                                         /* Take some damage */
786                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
787
788                                         /* Learn about the player */
789                                         update_smart_learn(m_idx, DRS_DISEN);
790
791                                         break;
792                                 }
793
794                                 case RBE_UN_POWER:
795                                 {
796                                         /* Take some damage */
797                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
798
799                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
800
801                                         /* Find an item */
802                                         for (k = 0; k < 10; k++)
803                                         {
804                                                 /* Pick an item */
805                                                 i = randint0(INVEN_PACK);
806
807                                                 /* Obtain the item */
808                                                 o_ptr = &inventory[i];
809
810                                                 /* Skip non-objects */
811                                                 if (!o_ptr->k_idx) continue;
812
813                                                 /* Drain charged wands/staffs */
814                                                 if (((o_ptr->tval == TV_STAFF) ||
815                                                      (o_ptr->tval == TV_WAND)) &&
816                                                     (o_ptr->pval))
817                                                 {
818                                                         /* Calculate healed hitpoints */
819                                                         int heal=rlev * o_ptr->pval;
820                                                         if( o_ptr->tval == TV_STAFF)
821                                                             heal *=  o_ptr->number;
822
823                                                         /* Don't heal more than max hp */
824                                                         heal = MIN(heal, m_ptr->maxhp - m_ptr->hp);
825
826                                                         /* Message */
827 #ifdef JP
828                                                         msg_print("ザックからエネルギーが吸い取られた!");
829 #else
830                                                         msg_print("Energy drains from your pack!");
831 #endif
832
833
834                                                         /* Obvious */
835                                                         obvious = TRUE;
836
837                                                         /* Heal the monster */
838                                                         m_ptr->hp += heal;
839
840                                                         /* Redraw (later) if needed */
841                                                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
842                                                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
843
844                                                         /* Uncharge */
845                                                         o_ptr->pval = 0;
846
847                                                         /* Combine / Reorder the pack */
848                                                         p_ptr->notice |= (PN_COMBINE | PN_REORDER);
849
850                                                         /* Window stuff */
851                                                         p_ptr->window |= (PW_INVEN);
852
853                                                         /* Done */
854                                                         break;
855                                                 }
856                                         }
857
858                                         break;
859                                 }
860
861                                 case RBE_EAT_GOLD:
862                                 {
863                                         /* Take some damage */
864                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
865
866                                         /* Confused monsters cannot steal successfully. -LM-*/
867                                         if (MON_CONFUSED(m_ptr)) break;
868
869                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
870
871                                         /* Obvious */
872                                         obvious = TRUE;
873
874                                         /* Saving throw (unless paralyzed) based on dex and level */
875                                         if (!p_ptr->paralyzed &&
876                                             (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
877                                                               p_ptr->lev)))
878                                         {
879                                                 /* Saving throw message */
880 #ifdef JP
881                                                 msg_print("しかし素早く財布を守った!");
882 #else
883                                                 msg_print("You quickly protect your money pouch!");
884 #endif
885
886
887                                                 /* Occasional blink anyway */
888                                                 if (randint0(3)) blinked = TRUE;
889                                         }
890
891                                         /* Eat gold */
892                                         else
893                                         {
894                                                 gold = (p_ptr->au / 10) + randint1(25);
895                                                 if (gold < 2) gold = 2;
896                                                 if (gold > 5000) gold = (p_ptr->au / 20) + randint1(3000);
897                                                 if (gold > p_ptr->au) gold = p_ptr->au;
898                                                 p_ptr->au -= gold;
899                                                 if (gold <= 0)
900                                                 {
901 #ifdef JP
902                                                         msg_print("しかし何も盗まれなかった。");
903 #else
904                                                         msg_print("Nothing was stolen.");
905 #endif
906
907                                                 }
908                                                 else if (p_ptr->au)
909                                                 {
910 #ifdef JP
911                                                         msg_print("財布が軽くなった気がする。");
912                                                         msg_format("$%ld のお金が盗まれた!", (long)gold);
913 #else
914                                                         msg_print("Your purse feels lighter.");
915                                                         msg_format("%ld coins were stolen!", (long)gold);
916 #endif
917                                                         chg_virtue(V_SACRIFICE, 1);
918                                                 }
919                                                 else
920                                                 {
921 #ifdef JP
922                                                         msg_print("財布が軽くなった気がする。");
923                                                         msg_print("お金が全部盗まれた!");
924 #else
925                                                         msg_print("Your purse feels lighter.");
926                                                         msg_print("All of your coins were stolen!");
927 #endif
928
929                                                         chg_virtue(V_SACRIFICE, 2);
930                                                 }
931
932                                                 /* Redraw gold */
933                                                 p_ptr->redraw |= (PR_GOLD);
934
935                                                 /* Window stuff */
936                                                 p_ptr->window |= (PW_PLAYER);
937
938                                                 /* Blink away */
939                                                 blinked = TRUE;
940                                         }
941
942                                         break;
943                                 }
944
945                                 case RBE_EAT_ITEM:
946                                 {
947                                         /* Take some damage */
948                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
949
950                                         /* Confused monsters cannot steal successfully. -LM-*/
951                                         if (MON_CONFUSED(m_ptr)) break;
952
953                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
954
955                                         /* Saving throw (unless paralyzed) based on dex and level */
956                                         if (!p_ptr->paralyzed &&
957                                             (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
958                                                               p_ptr->lev)))
959                                         {
960                                                 /* Saving throw message */
961 #ifdef JP
962                                                 msg_print("しかしあわててザックを取り返した!");
963 #else
964                                                 msg_print("You grab hold of your backpack!");
965 #endif
966
967
968                                                 /* Occasional "blink" anyway */
969                                                 blinked = TRUE;
970
971                                                 /* Obvious */
972                                                 obvious = TRUE;
973
974                                                 /* Done */
975                                                 break;
976                                         }
977
978                                         /* Find an item */
979                                         for (k = 0; k < 10; k++)
980                                         {
981                                                 s16b o_idx;
982
983                                                 /* Pick an item */
984                                                 i = randint0(INVEN_PACK);
985
986                                                 /* Obtain the item */
987                                                 o_ptr = &inventory[i];
988
989                                                 /* Skip non-objects */
990                                                 if (!o_ptr->k_idx) continue;
991
992                                                 /* Skip artifacts */
993                                                 if (object_is_artifact(o_ptr)) continue;
994
995                                                 /* Get a description */
996                                                 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
997
998                                                 /* Message */
999 #ifdef JP
1000                                                 msg_format("%s(%c)を%s盗まれた!",
1001                                                            o_name, index_to_label(i),
1002                                                            ((o_ptr->number > 1) ? "一つ" : ""));
1003 #else
1004                                                 msg_format("%sour %s (%c) was stolen!",
1005                                                            ((o_ptr->number > 1) ? "One of y" : "Y"),
1006                                                            o_name, index_to_label(i));
1007 #endif
1008
1009                                                 chg_virtue(V_SACRIFICE, 1);
1010
1011
1012                                                 /* Make an object */
1013                                                 o_idx = o_pop();
1014
1015                                                 /* Success */
1016                                                 if (o_idx)
1017                                                 {
1018                                                         object_type *j_ptr;
1019
1020                                                         /* Get new object */
1021                                                         j_ptr = &o_list[o_idx];
1022
1023                                                         /* Copy object */
1024                                                         object_copy(j_ptr, o_ptr);
1025
1026                                                         /* Modify number */
1027                                                         j_ptr->number = 1;
1028
1029                                                         /* Hack -- If a rod or wand, allocate total
1030                                                          * maximum timeouts or charges between those
1031                                                          * stolen and those missed. -LM-
1032                                                          */
1033                                                         if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
1034                                                         {
1035                                                                 j_ptr->pval = o_ptr->pval / o_ptr->number;
1036                                                                 o_ptr->pval -= j_ptr->pval;
1037                                                         }
1038
1039                                                         /* Forget mark */
1040                                                         j_ptr->marked = OM_TOUCHED;
1041
1042                                                         /* Memorize monster */
1043                                                         j_ptr->held_m_idx = m_idx;
1044
1045                                                         /* Build stack */
1046                                                         j_ptr->next_o_idx = m_ptr->hold_o_idx;
1047
1048                                                         /* Build stack */
1049                                                         m_ptr->hold_o_idx = o_idx;
1050                                                 }
1051
1052                                                 /* Steal the items */
1053                                                 inven_item_increase(i, -1);
1054                                                 inven_item_optimize(i);
1055
1056                                                 /* Obvious */
1057                                                 obvious = TRUE;
1058
1059                                                 /* Blink away */
1060                                                 blinked = TRUE;
1061
1062                                                 /* Done */
1063                                                 break;
1064                                         }
1065
1066                                         break;
1067                                 }
1068
1069                                 case RBE_EAT_FOOD:
1070                                 {
1071                                         /* Take some damage */
1072                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1073
1074                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1075
1076                                         /* Steal some food */
1077                                         for (k = 0; k < 10; k++)
1078                                         {
1079                                                 /* Pick an item from the pack */
1080                                                 i = randint0(INVEN_PACK);
1081
1082                                                 /* Get the item */
1083                                                 o_ptr = &inventory[i];
1084
1085                                                 /* Skip non-objects */
1086                                                 if (!o_ptr->k_idx) continue;
1087
1088                                                 /* Skip non-food objects */
1089                                                 if ((o_ptr->tval != TV_FOOD) && !((o_ptr->tval == TV_CORPSE) && (o_ptr->sval))) continue;
1090
1091                                                 /* Get a description */
1092                                                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
1093
1094                                                 /* Message */
1095 #ifdef JP
1096                                                 msg_format("%s(%c)を%s食べられてしまった!",
1097                                                           o_name, index_to_label(i),
1098                                                           ((o_ptr->number > 1) ? "一つ" : ""));
1099 #else
1100                                                 msg_format("%sour %s (%c) was eaten!",
1101                                                            ((o_ptr->number > 1) ? "One of y" : "Y"),
1102                                                            o_name, index_to_label(i));
1103 #endif
1104
1105
1106                                                 /* Steal the items */
1107                                                 inven_item_increase(i, -1);
1108                                                 inven_item_optimize(i);
1109
1110                                                 /* Obvious */
1111                                                 obvious = TRUE;
1112
1113                                                 /* Done */
1114                                                 break;
1115                                         }
1116
1117                                         break;
1118                                 }
1119
1120                                 case RBE_EAT_LITE:
1121                                 {
1122                                         /* Access the lite */
1123                                         o_ptr = &inventory[INVEN_LITE];
1124
1125                                         /* Take some damage */
1126                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1127
1128                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1129
1130                                         /* Drain fuel */
1131                                         if ((o_ptr->xtra4 > 0) && (!object_is_fixed_artifact(o_ptr)))
1132                                         {
1133                                                 /* Reduce fuel */
1134                                                 o_ptr->xtra4 -= (s16b)(250 + randint1(250));
1135                                                 if (o_ptr->xtra4 < 1) o_ptr->xtra4 = 1;
1136
1137                                                 /* Notice */
1138                                                 if (!p_ptr->blind)
1139                                                 {
1140 #ifdef JP
1141                                                         msg_print("明かりが暗くなってしまった。");
1142 #else
1143                                                         msg_print("Your light dims.");
1144 #endif
1145
1146                                                         obvious = TRUE;
1147                                                 }
1148
1149                                                 /* Window stuff */
1150                                                 p_ptr->window |= (PW_EQUIP);
1151                                         }
1152
1153                                         break;
1154                                 }
1155
1156                                 case RBE_ACID:
1157                                 {
1158                                         if (explode) break;
1159                                         /* Obvious */
1160                                         obvious = TRUE;
1161
1162                                         /* Message */
1163 #ifdef JP
1164                                         msg_print("酸を浴びせられた!");
1165 #else
1166                                         msg_print("You are covered in acid!");
1167 #endif
1168
1169
1170                                         /* Special damage */
1171                                         get_damage += acid_dam(damage, ddesc, -1, FALSE);
1172
1173                                         /* Hack -- Update AC */
1174                                         update_stuff();
1175
1176                                         /* Learn about the player */
1177                                         update_smart_learn(m_idx, DRS_ACID);
1178
1179                                         break;
1180                                 }
1181
1182                                 case RBE_ELEC:
1183                                 {
1184                                         if (explode) break;
1185                                         /* Obvious */
1186                                         obvious = TRUE;
1187
1188                                         /* Message */
1189 #ifdef JP
1190                                         msg_print("電撃を浴びせられた!");
1191 #else
1192                                         msg_print("You are struck by electricity!");
1193 #endif
1194
1195
1196                                         /* Special damage */
1197                                         get_damage += elec_dam(damage, ddesc, -1, FALSE);
1198
1199                                         /* Learn about the player */
1200                                         update_smart_learn(m_idx, DRS_ELEC);
1201
1202                                         break;
1203                                 }
1204
1205                                 case RBE_FIRE:
1206                                 {
1207                                         if (explode) break;
1208                                         /* Obvious */
1209                                         obvious = TRUE;
1210
1211                                         /* Message */
1212 #ifdef JP
1213                                         msg_print("全身が炎に包まれた!");
1214 #else
1215                                         msg_print("You are enveloped in flames!");
1216 #endif
1217
1218
1219                                         /* Special damage */
1220                                         get_damage += fire_dam(damage, ddesc, -1, FALSE);
1221
1222                                         /* Learn about the player */
1223                                         update_smart_learn(m_idx, DRS_FIRE);
1224
1225                                         break;
1226                                 }
1227
1228                                 case RBE_COLD:
1229                                 {
1230                                         if (explode) break;
1231                                         /* Obvious */
1232                                         obvious = TRUE;
1233
1234                                         /* Message */
1235 #ifdef JP
1236                                         msg_print("全身が冷気で覆われた!");
1237 #else
1238                                         msg_print("You are covered with frost!");
1239 #endif
1240
1241
1242                                         /* Special damage */
1243                                         get_damage += cold_dam(damage, ddesc, -1, FALSE);
1244
1245                                         /* Learn about the player */
1246                                         update_smart_learn(m_idx, DRS_COLD);
1247
1248                                         break;
1249                                 }
1250
1251                                 case RBE_BLIND:
1252                                 {
1253                                         /* Take damage */
1254                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1255
1256                                         if (p_ptr->is_dead) break;
1257
1258                                         /* Increase "blind" */
1259                                         if (!p_ptr->resist_blind && !CHECK_MULTISHADOW())
1260                                         {
1261                                                 if (set_blind(p_ptr->blind + 10 + randint1(rlev)))
1262                                                 {
1263 #ifdef JP
1264                                                         if (m_ptr->r_idx == MON_DIO) msg_print("どうだッ!この血の目潰しはッ!");
1265 #else
1266                                                         /* nanka */
1267 #endif
1268                                                         obvious = TRUE;
1269                                                 }
1270                                         }
1271
1272                                         /* Learn about the player */
1273                                         update_smart_learn(m_idx, DRS_BLIND);
1274
1275                                         break;
1276                                 }
1277
1278                                 case RBE_CONFUSE:
1279                                 {
1280                                         if (explode) break;
1281                                         /* Take damage */
1282                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1283
1284                                         if (p_ptr->is_dead) break;
1285
1286                                         /* Increase "confused" */
1287                                         if (!p_ptr->resist_conf && !CHECK_MULTISHADOW())
1288                                         {
1289                                                 if (set_confused(p_ptr->confused + 3 + randint1(rlev)))
1290                                                 {
1291                                                         obvious = TRUE;
1292                                                 }
1293                                         }
1294
1295                                         /* Learn about the player */
1296                                         update_smart_learn(m_idx, DRS_CONF);
1297
1298                                         break;
1299                                 }
1300
1301                                 case RBE_TERRIFY:
1302                                 {
1303                                         /* Take damage */
1304                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1305
1306                                         if (p_ptr->is_dead) break;
1307
1308                                         /* Increase "afraid" */
1309                                         if (CHECK_MULTISHADOW())
1310                                         {
1311                                                 /* Do nothing */
1312                                         }
1313                                         else if (p_ptr->resist_fear)
1314                                         {
1315 #ifdef JP
1316                                                 msg_print("しかし恐怖に侵されなかった!");
1317 #else
1318                                                 msg_print("You stand your ground!");
1319 #endif
1320
1321                                                 obvious = TRUE;
1322                                         }
1323                                         else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1324                                         {
1325 #ifdef JP
1326                                                 msg_print("しかし恐怖に侵されなかった!");
1327 #else
1328                                                 msg_print("You stand your ground!");
1329 #endif
1330
1331                                                 obvious = TRUE;
1332                                         }
1333                                         else
1334                                         {
1335                                                 if (set_afraid(p_ptr->afraid + 3 + randint1(rlev)))
1336                                                 {
1337                                                         obvious = TRUE;
1338                                                 }
1339                                         }
1340
1341                                         /* Learn about the player */
1342                                         update_smart_learn(m_idx, DRS_FEAR);
1343
1344                                         break;
1345                                 }
1346
1347                                 case RBE_PARALYZE:
1348                                 {
1349                                         /* Take damage */
1350                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1351
1352                                         if (p_ptr->is_dead) break;
1353
1354                                         /* Increase "paralyzed" */
1355                                         if (CHECK_MULTISHADOW())
1356                                         {
1357                                                 /* Do nothing */
1358                                         }
1359                                         else if (p_ptr->free_act)
1360                                         {
1361 #ifdef JP
1362                                                 msg_print("しかし効果がなかった!");
1363 #else
1364                                                 msg_print("You are unaffected!");
1365 #endif
1366
1367                                                 obvious = TRUE;
1368                                         }
1369                                         else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
1370                                         {
1371 #ifdef JP
1372                                                 msg_print("しかし効力を跳ね返した!");
1373 #else
1374                                                 msg_print("You resist the effects!");
1375 #endif
1376
1377                                                 obvious = TRUE;
1378                                         }
1379                                         else
1380                                         {
1381                                                 if (!p_ptr->paralyzed)
1382                                                 {
1383                                                         if (set_paralyzed(3 + randint1(rlev)))
1384                                                         {
1385                                                                 obvious = TRUE;
1386                                                         }
1387                                                 }
1388                                         }
1389
1390                                         /* Learn about the player */
1391                                         update_smart_learn(m_idx, DRS_FREE);
1392
1393                                         break;
1394                                 }
1395
1396                                 case RBE_LOSE_STR:
1397                                 {
1398                                         /* Damage (physical) */
1399                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1400
1401                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1402
1403                                         /* Damage (stat) */
1404                                         if (do_dec_stat(A_STR)) obvious = TRUE;
1405
1406                                         break;
1407                                 }
1408
1409                                 case RBE_LOSE_INT:
1410                                 {
1411                                         /* Damage (physical) */
1412                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1413
1414                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1415
1416                                         /* Damage (stat) */
1417                                         if (do_dec_stat(A_INT)) obvious = TRUE;
1418
1419                                         break;
1420                                 }
1421
1422                                 case RBE_LOSE_WIS:
1423                                 {
1424                                         /* Damage (physical) */
1425                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1426
1427                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1428
1429                                         /* Damage (stat) */
1430                                         if (do_dec_stat(A_WIS)) obvious = TRUE;
1431
1432                                         break;
1433                                 }
1434
1435                                 case RBE_LOSE_DEX:
1436                                 {
1437                                         /* Damage (physical) */
1438                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1439
1440                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1441
1442                                         /* Damage (stat) */
1443                                         if (do_dec_stat(A_DEX)) obvious = TRUE;
1444
1445                                         break;
1446                                 }
1447
1448                                 case RBE_LOSE_CON:
1449                                 {
1450                                         /* Damage (physical) */
1451                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1452
1453                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1454
1455                                         /* Damage (stat) */
1456                                         if (do_dec_stat(A_CON)) obvious = TRUE;
1457
1458                                         break;
1459                                 }
1460
1461                                 case RBE_LOSE_CHR:
1462                                 {
1463                                         /* Damage (physical) */
1464                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1465
1466                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1467
1468                                         /* Damage (stat) */
1469                                         if (do_dec_stat(A_CHR)) obvious = TRUE;
1470
1471                                         break;
1472                                 }
1473
1474                                 case RBE_LOSE_ALL:
1475                                 {
1476                                         /* Damage (physical) */
1477                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1478
1479                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1480
1481                                         /* Damage (stats) */
1482                                         if (do_dec_stat(A_STR)) obvious = TRUE;
1483                                         if (do_dec_stat(A_DEX)) obvious = TRUE;
1484                                         if (do_dec_stat(A_CON)) obvious = TRUE;
1485                                         if (do_dec_stat(A_INT)) obvious = TRUE;
1486                                         if (do_dec_stat(A_WIS)) obvious = TRUE;
1487                                         if (do_dec_stat(A_CHR)) obvious = TRUE;
1488
1489                                         break;
1490                                 }
1491
1492                                 case RBE_SHATTER:
1493                                 {
1494                                         /* Obvious */
1495                                         obvious = TRUE;
1496
1497                                         /* Hack -- Reduce damage based on the player armor class */
1498                                         damage -= (damage * ((ac < 150) ? ac : 150) / 250);
1499
1500                                         /* Take damage */
1501                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1502
1503                                         /* Radius 8 earthquake centered at the monster */
1504                                         if (damage > 23 || explode)
1505                                         {
1506                                                 earthquake_aux(m_ptr->fy, m_ptr->fx, 8, m_idx);
1507                                         }
1508
1509                                         break;
1510                                 }
1511
1512                                 case RBE_EXP_10:
1513                                 {
1514                                         s32b d = damroll(10, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1515
1516                                         /* Obvious */
1517                                         obvious = TRUE;
1518
1519                                         /* Take damage */
1520                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1521
1522                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1523
1524                                         (void)drain_exp(d, d / 10, 95);
1525                                         break;
1526                                 }
1527
1528                                 case RBE_EXP_20:
1529                                 {
1530                                         s32b d = damroll(20, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1531
1532                                         /* Obvious */
1533                                         obvious = TRUE;
1534
1535                                         /* Take damage */
1536                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1537
1538                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1539
1540                                         (void)drain_exp(d, d / 10, 90);
1541                                         break;
1542                                 }
1543
1544                                 case RBE_EXP_40:
1545                                 {
1546                                         s32b d = damroll(40, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1547
1548                                         /* Obvious */
1549                                         obvious = TRUE;
1550
1551                                         /* Take damage */
1552                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1553
1554                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1555
1556                                         (void)drain_exp(d, d / 10, 75);
1557                                         break;
1558                                 }
1559
1560                                 case RBE_EXP_80:
1561                                 {
1562                                         s32b d = damroll(80, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1563
1564                                         /* Obvious */
1565                                         obvious = TRUE;
1566
1567                                         /* Take damage */
1568                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1569
1570                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1571
1572                                         (void)drain_exp(d, d / 10, 50);
1573                                         break;
1574                                 }
1575
1576                                 case RBE_DISEASE:
1577                                 {
1578                                         /* Take some damage */
1579                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1580
1581                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1582
1583                                         /* Take "poison" effect */
1584                                         if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
1585                                         {
1586                                                 if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
1587                                                 {
1588                                                         obvious = TRUE;
1589                                                 }
1590                                         }
1591
1592                                         /* Damage CON (10% chance)*/
1593                                         if ((randint1(100) < 11) && (p_ptr->prace != RACE_ANDROID))
1594                                         {
1595                                                 /* 1% chance for perm. damage */
1596                                                 bool perm = one_in_(10);
1597                                                 if (dec_stat(A_CON, randint1(10), perm))
1598                                                 {
1599 #ifdef JP
1600                                                         msg_print("病があなたを蝕んでいる気がする。");
1601 #else
1602                                                         msg_print("You feel strange sickness.");
1603 #endif
1604
1605                                                         obvious = TRUE;
1606                                                 }
1607                                         }
1608
1609                                         break;
1610                                 }
1611                                 case RBE_TIME:
1612                                 {
1613                                         if (explode) break;
1614                                         if (!p_ptr->resist_time && !CHECK_MULTISHADOW())
1615                                         {
1616                                                 switch (randint1(10))
1617                                                 {
1618                                                         case 1: case 2: case 3: case 4: case 5:
1619                                                         {
1620                                                                 if (p_ptr->prace == RACE_ANDROID) break;
1621 #ifdef JP
1622                                                                 msg_print("人生が逆戻りした気がする。");
1623 #else
1624                                                                 msg_print("You feel life has clocked back.");
1625 #endif
1626
1627                                                                 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
1628                                                                 break;
1629                                                         }
1630
1631                                                         case 6: case 7: case 8: case 9:
1632                                                         {
1633                                                                 int stat = randint0(6);
1634
1635                                                                 switch (stat)
1636                                                                 {
1637 #ifdef JP
1638                                                                         case A_STR: act = "強く"; break;
1639                                                                         case A_INT: act = "聡明で"; break;
1640                                                                         case A_WIS: act = "賢明で"; break;
1641                                                                         case A_DEX: act = "器用で"; break;
1642                                                                         case A_CON: act = "健康で"; break;
1643                                                                         case A_CHR: act = "美しく"; break;
1644 #else
1645                                                                         case A_STR: act = "strong"; break;
1646                                                                         case A_INT: act = "bright"; break;
1647                                                                         case A_WIS: act = "wise"; break;
1648                                                                         case A_DEX: act = "agile"; break;
1649                                                                         case A_CON: act = "hale"; break;
1650                                                                         case A_CHR: act = "beautiful"; break;
1651 #endif
1652
1653                                                                 }
1654
1655 #ifdef JP
1656                                                                 msg_format("あなたは以前ほど%sなくなってしまった...。", act);
1657 #else
1658                                                                 msg_format("You're not as %s as you used to be...", act);
1659 #endif
1660
1661
1662                                                                 p_ptr->stat_cur[stat] = (p_ptr->stat_cur[stat] * 3) / 4;
1663                                                                 if (p_ptr->stat_cur[stat] < 3) p_ptr->stat_cur[stat] = 3;
1664                                                                 p_ptr->update |= (PU_BONUS);
1665                                                                 break;
1666                                                         }
1667
1668                                                         case 10:
1669                                                         {
1670 #ifdef JP
1671                                                 msg_print("あなたは以前ほど力強くなくなってしまった...。");
1672 #else
1673                                                                 msg_print("You're not as powerful as you used to be...");
1674 #endif
1675
1676
1677                                                                 for (k = 0; k < 6; k++)
1678                                                                 {
1679                                                                         p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
1680                                                                         if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
1681                                                                 }
1682                                                                 p_ptr->update |= (PU_BONUS);
1683                                                                 break;
1684                                                         }
1685                                                 }
1686                                         }
1687                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1688
1689                                         break;
1690                                 }
1691                                 case RBE_DR_LIFE:
1692                                 {
1693                                         s32b d = damroll(60, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
1694                                         bool resist_drain;
1695
1696                                         /* Obvious */
1697                                         obvious = TRUE;
1698
1699                                         /* Take damage */
1700                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1701
1702                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
1703
1704                                         resist_drain = !drain_exp(d, d / 10, 50);
1705
1706                                         /* Heal the attacker? */
1707                                         if (p_ptr->mimic_form)
1708                                         {
1709                                                 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)
1710                                                         resist_drain = TRUE;
1711                                         }
1712                                         else
1713                                         {
1714                                                 switch (p_ptr->prace)
1715                                                 {
1716                                                 case RACE_ZOMBIE:
1717                                                 case RACE_VAMPIRE:
1718                                                 case RACE_SPECTRE:
1719                                                 case RACE_SKELETON:
1720                                                 case RACE_DEMON:
1721                                                 case RACE_GOLEM:
1722                                                 case RACE_ANDROID:
1723                                                         resist_drain = TRUE;
1724                                                         break;
1725                                                 }
1726                                         }
1727
1728                                         if ((damage > 5) && !resist_drain)
1729                                         {
1730                                                 bool did_heal = FALSE;
1731
1732                                                 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
1733
1734                                                 /* Heal */
1735                                                 m_ptr->hp += damroll(4, damage / 6);
1736                                                 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1737
1738                                                 /* Redraw (later) if needed */
1739                                                 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
1740                                                 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
1741
1742                                                 /* Special message */
1743                                                 if (m_ptr->ml && did_heal)
1744                                                 {
1745 #ifdef JP
1746 msg_format("%sは体力を回復したようだ。", m_name);
1747 #else
1748                                                         msg_format("%^s appears healthier.", m_name);
1749 #endif
1750
1751                                                 }
1752                                         }
1753
1754                                         break;
1755                                 }
1756                                 case RBE_DR_MANA:
1757                                 {
1758                                         /* Obvious */
1759                                         obvious = TRUE;
1760
1761                                         if (CHECK_MULTISHADOW())
1762                                         {
1763 #ifdef JP
1764                                                 msg_print("攻撃は幻影に命中し、あなたには届かなかった。");
1765 #else
1766                                                 msg_print("The attack hits Shadow, you are unharmed!");
1767 #endif
1768                                         }
1769                                         else
1770                                         {
1771                                                 do_cut = 0;
1772
1773                                                 /* Take damage */
1774                                                 p_ptr->csp -= damage;
1775                                                 if (p_ptr->csp < 0)
1776                                                 {
1777                                                         p_ptr->csp = 0;
1778                                                         p_ptr->csp_frac = 0;
1779                                                 }
1780
1781                                                 p_ptr->redraw |= (PR_MANA);
1782                                         }
1783
1784                                         /* Learn about the player */
1785                                         update_smart_learn(m_idx, DRS_MANA);
1786
1787                                         break;
1788                                 }
1789                                 case RBE_INERTIA:
1790                                 {
1791                                         /* Take damage */
1792                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1793
1794                                         if (p_ptr->is_dead) break;
1795
1796                                         /* Decrease speed */
1797                                         if (CHECK_MULTISHADOW())
1798                                         {
1799                                                 /* Do nothing */
1800                                         }
1801                                         else
1802                                         {
1803                                                 if (set_slow((p_ptr->slow + 4 + randint0(rlev / 10)), FALSE))
1804                                                 {
1805                                                         obvious = TRUE;
1806                                                 }
1807                                         }
1808
1809                                         break;
1810                                 }
1811                                 case RBE_STUN:
1812                                 {
1813                                         /* Take damage */
1814                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
1815
1816                                         if (p_ptr->is_dead) break;
1817
1818                                         /* Decrease speed */
1819                                         if (p_ptr->resist_sound || CHECK_MULTISHADOW())
1820                                         {
1821                                                 /* Do nothing */
1822                                         }
1823                                         else
1824                                         {
1825                                                 if (set_stun(p_ptr->stun + 10 + randint1(r_ptr->level / 4)))
1826                                                 {
1827                                                         obvious = TRUE;
1828                                                 }
1829                                         }
1830
1831                                         break;
1832                                 }
1833                         }
1834
1835                         /* Hack -- only one of cut or stun */
1836                         if (do_cut && do_stun)
1837                         {
1838                                 /* Cancel cut */
1839                                 if (randint0(100) < 50)
1840                                 {
1841                                         do_cut = 0;
1842                                 }
1843
1844                                 /* Cancel stun */
1845                                 else
1846                                 {
1847                                         do_stun = 0;
1848                                 }
1849                         }
1850
1851                         /* Handle cut */
1852                         if (do_cut)
1853                         {
1854                                 int k = 0;
1855
1856                                 /* Critical hit (zero if non-critical) */
1857                                 tmp = monster_critical(d_dice, d_side, damage);
1858
1859                                 /* Roll for damage */
1860                                 switch (tmp)
1861                                 {
1862                                         case 0: k = 0; break;
1863                                         case 1: k = randint1(5); break;
1864                                         case 2: k = randint1(5) + 5; break;
1865                                         case 3: k = randint1(20) + 20; break;
1866                                         case 4: k = randint1(50) + 50; break;
1867                                         case 5: k = randint1(100) + 100; break;
1868                                         case 6: k = 300; break;
1869                                         default: k = 500; break;
1870                                 }
1871
1872                                 /* Apply the cut */
1873                                 if (k) (void)set_cut(p_ptr->cut + k);
1874                         }
1875
1876                         /* Handle stun */
1877                         if (do_stun)
1878                         {
1879                                 int k = 0;
1880
1881                                 /* Critical hit (zero if non-critical) */
1882                                 tmp = monster_critical(d_dice, d_side, damage);
1883
1884                                 /* Roll for damage */
1885                                 switch (tmp)
1886                                 {
1887                                         case 0: k = 0; break;
1888                                         case 1: k = randint1(5); break;
1889                                         case 2: k = randint1(5) + 10; break;
1890                                         case 3: k = randint1(10) + 20; break;
1891                                         case 4: k = randint1(15) + 30; break;
1892                                         case 5: k = randint1(20) + 40; break;
1893                                         case 6: k = 80; break;
1894                                         default: k = 150; break;
1895                                 }
1896
1897                                 /* Apply the stun */
1898                                 if (k) (void)set_stun(p_ptr->stun + k);
1899                         }
1900
1901                         if (explode)
1902                         {
1903                                 sound(SOUND_EXPLODE);
1904
1905                                 if (mon_take_hit(m_idx, m_ptr->hp + 1, &fear, NULL))
1906                                 {
1907                                         blinked = FALSE;
1908                                         alive = FALSE;
1909                                 }
1910                         }
1911
1912                         if (touched)
1913                         {
1914                                 if (p_ptr->sh_fire && alive && !p_ptr->is_dead)
1915                                 {
1916                                         if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
1917                                         {
1918                                                 int dam = damroll(2, 6);
1919
1920                                                 /* Modify the damage */
1921                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
1922
1923 #ifdef JP
1924                                                 msg_format("%^sは突然熱くなった!", m_name);
1925                                                 if (mon_take_hit(m_idx, dam, &fear,
1926                                                     "は灰の山になった。"))
1927 #else
1928                                                 msg_format("%^s is suddenly very hot!", m_name);
1929
1930                                                 if (mon_take_hit(m_idx, dam, &fear,
1931                                                     " turns into a pile of ash."))
1932 #endif
1933
1934                                                 {
1935                                                         blinked = FALSE;
1936                                                         alive = FALSE;
1937                                                 }
1938                                         }
1939                                         else
1940                                         {
1941                                                 if (is_original_ap_and_seen(m_ptr))
1942                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
1943                                         }
1944                                 }
1945
1946                                 if (p_ptr->sh_elec && alive && !p_ptr->is_dead)
1947                                 {
1948                                         if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
1949                                         {
1950                                                 int dam = damroll(2, 6);
1951
1952                                                 /* Modify the damage */
1953                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
1954
1955 #ifdef JP
1956                                                 msg_format("%^sは電撃をくらった!", m_name);
1957                                                 if (mon_take_hit(m_idx, dam, &fear,
1958                                                     "は燃え殻の山になった。"))
1959 #else
1960                                                 msg_format("%^s gets zapped!", m_name);
1961
1962                                                 if (mon_take_hit(m_idx, dam, &fear,
1963                                                     " turns into a pile of cinder."))
1964 #endif
1965
1966                                                 {
1967                                                         blinked = FALSE;
1968                                                         alive = FALSE;
1969                                                 }
1970                                         }
1971                                         else
1972                                         {
1973                                                 if (is_original_ap_and_seen(m_ptr))
1974                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
1975                                         }
1976                                 }
1977
1978                                 if (p_ptr->sh_cold && alive && !p_ptr->is_dead)
1979                                 {
1980                                         if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
1981                                         {
1982                                                 int dam = damroll(2, 6);
1983
1984                                                 /* Modify the damage */
1985                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
1986
1987 #ifdef JP
1988                                                 msg_format("%^sは冷気をくらった!", m_name);
1989                                                 if (mon_take_hit(m_idx, dam, &fear,
1990                                                     "は凍りついた。"))
1991 #else
1992                                                 msg_format("%^s is very cold!", m_name);
1993
1994                                                 if (mon_take_hit(m_idx, dam, &fear,
1995                                                     " was frozen."))
1996 #endif
1997
1998                                                 {
1999                                                         blinked = FALSE;
2000                                                         alive = FALSE;
2001                                                 }
2002                                         }
2003                                         else
2004                                         {
2005                                                 if (is_original_ap_and_seen(m_ptr))
2006                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
2007                                         }
2008                                 }
2009
2010                                 /* by henkma */
2011                                 if (p_ptr->dustrobe && alive && !p_ptr->is_dead)
2012                                 {
2013                                         if (!(r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK))
2014                                         {
2015                                                 int dam = damroll(2, 6);
2016
2017                                                 /* Modify the damage */
2018                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
2019
2020 #ifdef JP
2021                                                 msg_format("%^sは鏡の破片をくらった!", m_name);
2022                                                 if (mon_take_hit(m_idx, dam, &fear,
2023                                                     "はズタズタになった。"))
2024 #else
2025                                                 msg_format("%^s gets zapped!", m_name);
2026
2027                                                 if (mon_take_hit(m_idx, dam, &fear,
2028                                                     " had torn to pieces."))
2029 #endif
2030                                                 {
2031                                                         blinked = FALSE;
2032                                                         alive = FALSE;
2033                                                 }
2034                                         }
2035                                         else
2036                                         {
2037                                                 if (is_original_ap_and_seen(m_ptr))
2038                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK);
2039                                         }
2040
2041                                         if (is_mirror_grid(&cave[py][px]))
2042                                         {
2043                                                 teleport_player(10, 0L);
2044                                         }
2045                                 }
2046
2047                                 if (p_ptr->tim_sh_holy && alive && !p_ptr->is_dead)
2048                                 {
2049                                         if (r_ptr->flags3 & RF3_EVIL)
2050                                         {
2051                                                 if (!(r_ptr->flagsr & RFR_RES_ALL))
2052                                                 {
2053                                                         int dam = damroll(2, 6);
2054
2055                                                         /* Modify the damage */
2056                                                         dam = mon_damage_mod(m_ptr, dam, FALSE);
2057
2058 #ifdef JP
2059                                                         msg_format("%^sは聖なるオーラで傷ついた!", m_name);
2060                                                         if (mon_take_hit(m_idx, dam, &fear,
2061                                                             "は倒れた。"))
2062 #else
2063                                                         msg_format("%^s is injured by holy power!", m_name);
2064
2065                                                         if (mon_take_hit(m_idx, dam, &fear,
2066                                                             " is destroyed."))
2067 #endif
2068                                                         {
2069                                                                 blinked = FALSE;
2070                                                                 alive = FALSE;
2071                                                         }
2072                                                         if (is_original_ap_and_seen(m_ptr))
2073                                                                 r_ptr->r_flags3 |= RF3_EVIL;
2074                                                 }
2075                                                 else
2076                                                 {
2077                                                         if (is_original_ap_and_seen(m_ptr))
2078                                                                 r_ptr->r_flagsr |= RFR_RES_ALL;
2079                                                 }
2080                                         }
2081                                 }
2082
2083                                 if (p_ptr->tim_sh_touki && alive && !p_ptr->is_dead)
2084                                 {
2085                                         if (!(r_ptr->flagsr & RFR_RES_ALL))
2086                                         {
2087                                                 int dam = damroll(2, 6);
2088
2089                                                 /* Modify the damage */
2090                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
2091
2092 #ifdef JP
2093                                                 msg_format("%^sが鋭い闘気のオーラで傷ついた!", m_name);
2094                                                 if (mon_take_hit(m_idx, dam, &fear,
2095                                                     "は倒れた。"))
2096 #else
2097                                                 msg_format("%^s is injured by the Force", m_name);
2098
2099                                                 if (mon_take_hit(m_idx, dam, &fear,
2100                                                     " is destroyed."))
2101 #endif
2102
2103                                                 {
2104                                                         blinked = FALSE;
2105                                                         alive = FALSE;
2106                                                 }
2107                                         }
2108                                         else
2109                                         {
2110                                                 if (is_original_ap_and_seen(m_ptr))
2111                                                         r_ptr->r_flagsr |= RFR_RES_ALL;
2112                                         }
2113                                 }
2114
2115                                 if (hex_spelling(HEX_SHADOW_CLOAK) && alive && !p_ptr->is_dead)
2116                                 {
2117                                         int dam = 1;
2118                                         object_type *o_ptr = &inventory[INVEN_RARM];
2119
2120                                         if (!(r_ptr->flagsr & RFR_RES_ALL || r_ptr->flagsr & RFR_RES_DARK))
2121                                         {
2122                                                 if (o_ptr->k_idx)
2123                                                 {
2124                                                         int basedam = ((o_ptr->dd + p_ptr->to_dd[0]) * (o_ptr->ds + p_ptr->to_ds[0] + 1));
2125                                                         dam = basedam / 2 + o_ptr->to_d + p_ptr->to_d[0];
2126                                                 }
2127
2128                                                 /* Cursed armor makes damages doubled */
2129                                                 o_ptr = &inventory[INVEN_BODY];
2130                                                 if ((o_ptr->k_idx) && object_is_cursed(o_ptr)) dam *= 2;
2131
2132                                                 /* Modify the damage */
2133                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
2134
2135 #ifdef JP
2136                                                 msg_format("影のオーラが%^sに反撃した!", m_name);
2137                                                 if (mon_take_hit(m_idx, dam, &fear, "は倒れた。"))
2138 #else
2139                                                 msg_format("Enveloped shadows attack %^s.", m_name);
2140
2141                                                 if (mon_take_hit(m_idx, dam, &fear, " is destroyed."))
2142 #endif
2143                                                 {
2144                                                         blinked = FALSE;
2145                                                         alive = FALSE;
2146                                                 }
2147                                                 else /* monster does not dead */
2148                                                 {
2149                                                         int j;
2150                                                         int flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
2151                                                         int typ[4][2] = {
2152                                                                 { INVEN_HEAD, GF_OLD_CONF },
2153                                                                 { INVEN_LARM,  GF_OLD_SLEEP },
2154                                                                 { INVEN_HANDS, GF_TURN_ALL },
2155                                                                 { INVEN_FEET, GF_OLD_SLOW }
2156                                                         };
2157
2158                                                         /* Some cursed armours gives an extra effect */
2159                                                         for (j = 0; j < 4; j++)
2160                                                         {
2161                                                                 o_ptr = &inventory[typ[j][0]];
2162                                                                 if ((o_ptr->k_idx) && object_is_cursed(o_ptr) && object_is_armour(o_ptr))
2163                                                                         project(0, 0, m_ptr->fy, m_ptr->fx, (p_ptr->lev * 2), typ[j][1], flg, -1);
2164                                                         }
2165                                                 }
2166                                         }
2167                                         else
2168                                         {
2169                                                 if (is_original_ap_and_seen(m_ptr))
2170                                                         r_ptr->r_flagsr |= (RFR_RES_ALL | RFR_RES_DARK);
2171                                         }
2172                                 }
2173                         }
2174                 }
2175
2176                 /* Monster missed player */
2177                 else
2178                 {
2179                         /* Analyze failed attacks */
2180                         switch (method)
2181                         {
2182                                 case RBM_HIT:
2183                                 case RBM_TOUCH:
2184                                 case RBM_PUNCH:
2185                                 case RBM_KICK:
2186                                 case RBM_CLAW:
2187                                 case RBM_BITE:
2188                                 case RBM_STING:
2189                                 case RBM_SLASH:
2190                                 case RBM_BUTT:
2191                                 case RBM_CRUSH:
2192                                 case RBM_ENGULF:
2193                                 case RBM_CHARGE:
2194
2195                                 /* Visible monsters */
2196                                 if (m_ptr->ml)
2197                                 {
2198                                         /* Disturbing */
2199                                         disturb(1, 1);
2200
2201                                         /* Message */
2202 #ifdef JP
2203                                         if (abbreviate)
2204                                             msg_format("%sかわした。", (p_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "");
2205                                         else
2206                                             msg_format("%s%^sの攻撃をかわした。", (p_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "", m_name);
2207                                         abbreviate = 1;/*2回目以降は省略 */
2208 #else
2209                                         msg_format("%^s misses you.", m_name);
2210 #endif
2211
2212                                 }
2213                                 damage = 0;
2214
2215                                 break;
2216                         }
2217                 }
2218
2219
2220                 /* Analyze "visible" monsters only */
2221                 if (is_original_ap_and_seen(m_ptr) && !do_silly_attack)
2222                 {
2223                         /* Count "obvious" attacks (and ones that cause damage) */
2224                         if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
2225                         {
2226                                 /* Count attacks of this type */
2227                                 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
2228                                 {
2229                                         r_ptr->r_blows[ap_cnt]++;
2230                                 }
2231                         }
2232                 }
2233
2234                 if (p_ptr->riding && damage)
2235                 {
2236                         char m_name[80];
2237                         monster_desc(m_name, &m_list[p_ptr->riding], 0);
2238                         if (rakuba((damage > 200) ? 200 : damage, FALSE))
2239                         {
2240 #ifdef JP
2241 msg_format("%^sから落ちてしまった!", m_name);
2242 #else
2243                                 msg_format("You have fallen from %s.", m_name);
2244 #endif
2245                         }
2246                 }
2247
2248                 if (p_ptr->special_defense & NINJA_KAWARIMI)
2249                 {
2250                         if (kawarimi(FALSE)) return TRUE;
2251                 }
2252         }
2253
2254         /* Hex - revenge damage stored */
2255         revenge_store(get_damage);
2256
2257         if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
2258                 && get_damage > 0 && !p_ptr->is_dead)
2259         {
2260 #ifdef JP
2261                 msg_format("攻撃が%s自身を傷つけた!", m_name);
2262 #else
2263                 char m_name_self[80];
2264
2265                 /* hisself */
2266                 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
2267
2268                 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
2269 #endif
2270                 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
2271                 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
2272         }
2273
2274         if ((p_ptr->counter || (p_ptr->special_defense & KATA_MUSOU)) && alive && !p_ptr->is_dead && m_ptr->ml && (p_ptr->csp > 7))
2275         {
2276                 char m_name[80];
2277                 monster_desc(m_name, m_ptr, 0);
2278
2279                 p_ptr->csp -= 7;
2280 #ifdef JP
2281                 msg_format("%^sに反撃した!", m_name);
2282 #else
2283                 msg_format("Your counterattack to %s!", m_name);
2284 #endif
2285                 py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_COUNTER);
2286                 fear = FALSE;
2287
2288                 /* Redraw mana */
2289                 p_ptr->redraw |= (PR_MANA);
2290         }
2291
2292         /* Blink away */
2293         if (blinked && alive && !p_ptr->is_dead)
2294         {
2295                 if (teleport_barrier(m_idx))
2296                 {
2297 #ifdef JP
2298                         msg_print("泥棒は笑って逃げ...ようとしたがバリアに防がれた。");
2299 #else
2300                         msg_print("The thief flees laughing...? But magic barrier obstructs it.");
2301 #endif
2302                 }
2303                 else
2304                 {
2305 #ifdef JP
2306                         msg_print("泥棒は笑って逃げた!");
2307 #else
2308                         msg_print("The thief flees laughing!");
2309 #endif
2310                         teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
2311                 }
2312         }
2313
2314
2315         /* Always notice cause of death */
2316         if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
2317         {
2318                 r_ptr->r_deaths++;
2319         }
2320
2321         if (m_ptr->ml && fear && alive && !p_ptr->is_dead)
2322         {
2323                 sound(SOUND_FLEE);
2324 #ifdef JP
2325                 msg_format("%^sは恐怖で逃げ出した!", m_name);
2326 #else
2327                 msg_format("%^s flees in terror!", m_name);
2328 #endif
2329
2330         }
2331
2332         if (p_ptr->special_defense & KATA_IAI)
2333         {
2334                 set_action(ACTION_NONE);
2335         }
2336
2337         /* Assume we attacked */
2338         return (TRUE);
2339 }