OSDN Git Service

[Refactor] #37353 monster_is_valid() 関数を定義し単純な !r_idx の条件から置換。 / Define monster_is_va...
[hengband/hengband.git] / src / melee1.c
1 /*!
2  * @file melee1.c
3  * @brief 打撃処理 / Melee process.
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 #include "artifact.h"
16 #include "cmd-pet.h"
17 #include "player-damage.h"
18 #include "monsterrace-hook.h"
19 #include "melee.h"
20 #include "projection.h"
21 #include "monster-status.h"
22 #include "avatar.h"
23 #include "player-status.h"
24 #include "realm-hex.h"
25 #include "object-hook.h"
26 #include "grid.h"
27 #include "player-move.h"
28
29
30
31  /*!
32  * @brief プレイヤーからモンスターへの打撃命中判定 /
33  * Determine if the player "hits" a monster (normal combat).
34  * @param chance 基本命中値
35  * @param ac モンスターのAC
36  * @param visible 目標を視界に捕らえているならばTRUEを指定
37  * @return 命中と判定された場合TRUEを返す
38  * @note Always miss 5%, always hit 5%, otherwise random.
39  */
40 bool test_hit_norm(HIT_RELIABILITY chance, ARMOUR_CLASS ac, bool visible)
41 {
42         if (!visible) chance = (chance + 1) / 2;
43         return hit_chance(chance, ac) >= randint1(100);
44 }
45
46 /*!
47  * @brief モンスターへの命中率の計算
48  * @param to_h 命中値
49  * @param ac 敵AC
50  * @return 命中確率
51  */
52 PERCENTAGE hit_chance(HIT_RELIABILITY reli, ARMOUR_CLASS ac)
53 {
54         PERCENTAGE chance = 5, chance_left = 90;
55         if(reli <= 0) return 5;
56         if(p_ptr->pseikaku == SEIKAKU_NAMAKE) chance_left = (chance_left * 19 + 9) / 20;
57         chance += (100 - ((ac * 75) / reli)) * chance_left / 100;
58         if (chance < 5) chance = 5;
59         return chance;
60 }
61
62 /*!
63  * @brief プレイヤー攻撃の種族スレイング倍率計算
64  * @param mult 算出前の基本倍率(/10倍)
65  * @param flgs スレイフラグ配列
66  * @param m_ptr 目標モンスターの構造体参照ポインタ
67  * @return スレイング加味後の倍率(/10倍)
68  */
69 static MULTIPLY mult_slaying(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_type* m_ptr)
70 {
71         static const struct slay_table_t {
72                 int slay_flag;
73                 BIT_FLAGS affect_race_flag;
74                 MULTIPLY slay_mult;
75                 size_t flag_offset;
76                 size_t r_flag_offset;
77         } slay_table[] = {
78 #define OFFSET(X) offsetof(monster_race, X)
79                 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
80                 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
81                 {TR_SLAY_EVIL,   RF3_EVIL,   20, OFFSET(flags3), OFFSET(r_flags3)},
82                 {TR_KILL_EVIL,   RF3_EVIL,   35, OFFSET(flags3), OFFSET(r_flags3)},
83                 {TR_SLAY_GOOD,   RF3_GOOD,   20, OFFSET(flags3), OFFSET(r_flags3)},
84                 {TR_KILL_GOOD,   RF3_GOOD,   35, OFFSET(flags3), OFFSET(r_flags3)},
85                 {TR_SLAY_HUMAN,  RF2_HUMAN,  25, OFFSET(flags2), OFFSET(r_flags2)},
86                 {TR_KILL_HUMAN,  RF2_HUMAN,  40, OFFSET(flags2), OFFSET(r_flags2)},
87                 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
88                 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
89                 {TR_SLAY_DEMON,  RF3_DEMON,  30, OFFSET(flags3), OFFSET(r_flags3)},
90                 {TR_KILL_DEMON,  RF3_DEMON,  50, OFFSET(flags3), OFFSET(r_flags3)},
91                 {TR_SLAY_ORC,    RF3_ORC,    30, OFFSET(flags3), OFFSET(r_flags3)},
92                 {TR_KILL_ORC,    RF3_ORC,    50, OFFSET(flags3), OFFSET(r_flags3)},
93                 {TR_SLAY_TROLL,  RF3_TROLL,  30, OFFSET(flags3), OFFSET(r_flags3)},
94                 {TR_KILL_TROLL,  RF3_TROLL,  50, OFFSET(flags3), OFFSET(r_flags3)},
95                 {TR_SLAY_GIANT,  RF3_GIANT,  30, OFFSET(flags3), OFFSET(r_flags3)},
96                 {TR_KILL_GIANT,  RF3_GIANT,  50, OFFSET(flags3), OFFSET(r_flags3)},
97                 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
98                 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
99 #undef OFFSET
100         };
101         int i;
102         monster_race* r_ptr = &r_info[m_ptr->r_idx];
103
104         for (i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++i)
105         {
106                 const struct slay_table_t* p = &slay_table[i];
107
108                 if ((have_flag(flgs, p->slay_flag)) &&
109                         (atoffset(u32b, r_ptr, p->flag_offset) & p->affect_race_flag))
110                 {
111                         if (is_original_ap_and_seen(m_ptr))
112                         {
113                                 atoffset(u32b, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
114                         }
115
116                         mult = MAX(mult, p->slay_mult);
117                 }
118         }
119
120         return mult;
121 }
122
123 /*!
124  * @brief プレイヤー攻撃の属性スレイング倍率計算
125  * @param mult 算出前の基本倍率(/10倍)
126  * @param flgs スレイフラグ配列
127  * @param m_ptr 目標モンスターの構造体参照ポインタ
128  * @return スレイング加味後の倍率(/10倍)
129  */
130 static MULTIPLY mult_brand(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_type* m_ptr)
131 {
132         static const struct brand_table_t {
133                 int brand_flag;
134                 BIT_FLAGS resist_mask;
135                 BIT_FLAGS hurt_flag;
136         } brand_table[] = {
137                 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U           },
138                 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U           },
139                 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
140                 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
141                 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U           },
142         };
143         int i;
144         monster_race* r_ptr = &r_info[m_ptr->r_idx];
145
146         for (i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++i)
147         {
148                 const struct brand_table_t* p = &brand_table[i];
149
150                 if (have_flag(flgs, p->brand_flag))
151                 {
152                         /* Notice immunity */
153                         if (r_ptr->flagsr & p->resist_mask)
154                         {
155                                 if (is_original_ap_and_seen(m_ptr))
156                                 {
157                                         r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
158                                 }
159                         }
160
161                         /* Otherwise, take the damage */
162                         else if (r_ptr->flags3 & p->hurt_flag)
163                         {
164                                 if (is_original_ap_and_seen(m_ptr))
165                                 {
166                                         r_ptr->r_flags3 |= p->hurt_flag;
167                                 }
168
169                                 mult = MAX(mult, 50);
170                         }
171                         else
172                         {
173                                 mult = MAX(mult, 25);
174                         }
175                 }
176         }
177
178         return mult;
179 }
180
181 /*!
182  * @brief 剣術のスレイ倍率計算を行う /
183  * Calcurate magnification of hissatsu technics
184  * @param mult 剣術のスレイ効果以前に算出している多要素の倍率(/10倍)
185  * @param flgs 剣術に使用する武器のスレイフラグ配列
186  * @param m_ptr 目標となるモンスターの構造体参照ポインタ
187  * @param mode 剣術のスレイ型ID
188  * @return スレイの倍率(/10倍)
189  */
190 static MULTIPLY mult_hissatsu(MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, BIT_FLAGS mode)
191 {
192         monster_race *r_ptr = &r_info[m_ptr->r_idx];
193
194         /* Burning Strike (Fire) */
195         if (mode == HISSATSU_FIRE)
196         {
197                 /* Notice immunity */
198                 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
199                 {
200                         if (is_original_ap_and_seen(m_ptr))
201                         {
202                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
203                         }
204                 }
205
206                 /* Otherwise, take the damage */
207                 else if (have_flag(flgs, TR_BRAND_FIRE))
208                 {
209                         if (r_ptr->flags3 & RF3_HURT_FIRE)
210                         {
211                                 if (mult < 70) mult = 70;
212                                 if (is_original_ap_and_seen(m_ptr))
213                                 {
214                                         r_ptr->r_flags3 |= RF3_HURT_FIRE;
215                                 }
216                         }
217                         else if (mult < 35) mult = 35;
218                 }
219                 else
220                 {
221                         if (r_ptr->flags3 & RF3_HURT_FIRE)
222                         {
223                                 if (mult < 50) mult = 50;
224                                 if (is_original_ap_and_seen(m_ptr))
225                                 {
226                                         r_ptr->r_flags3 |= RF3_HURT_FIRE;
227                                 }
228                         }
229                         else if (mult < 25) mult = 25;
230                 }
231         }
232
233         /* Serpent's Tongue (Poison) */
234         if (mode == HISSATSU_POISON)
235         {
236                 /* Notice immunity */
237                 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
238                 {
239                         if (is_original_ap_and_seen(m_ptr))
240                         {
241                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
242                         }
243                 }
244
245                 /* Otherwise, take the damage */
246                 else if (have_flag(flgs, TR_BRAND_POIS))
247                 {
248                         if (mult < 35) mult = 35;
249                 }
250                 else
251                 {
252                         if (mult < 25) mult = 25;
253                 }
254         }
255
256         /* Zammaken (Nonliving Evil) */
257         if (mode == HISSATSU_ZANMA)
258         {
259                 if (!monster_living(m_ptr->r_idx) && (r_ptr->flags3 & RF3_EVIL))
260                 {
261                         if (mult < 15) mult = 25;
262                         else if (mult < 50) mult = MIN(50, mult + 20);
263                 }
264         }
265
266         /* Rock Smash (Hurt Rock) */
267         if (mode == HISSATSU_HAGAN)
268         {
269                 if (r_ptr->flags3 & RF3_HURT_ROCK)
270                 {
271                         if (is_original_ap_and_seen(m_ptr))
272                         {
273                                 r_ptr->r_flags3 |= RF3_HURT_ROCK;
274                         }
275                         if (mult == 10) mult = 40;
276                         else if (mult < 60) mult = 60;
277                 }
278         }
279
280         /* Midare-Setsugekka (Cold) */
281         if (mode == HISSATSU_COLD)
282         {
283                 /* Notice immunity */
284                 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
285                 {
286                         if (is_original_ap_and_seen(m_ptr))
287                         {
288                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
289                         }
290                 }
291                 /* Otherwise, take the damage */
292                 else if (have_flag(flgs, TR_BRAND_COLD))
293                 {
294                         if (r_ptr->flags3 & RF3_HURT_COLD)
295                         {
296                                 if (mult < 70) mult = 70;
297                                 if (is_original_ap_and_seen(m_ptr))
298                                 {
299                                         r_ptr->r_flags3 |= RF3_HURT_COLD;
300                                 }
301                         }
302                         else if (mult < 35) mult = 35;
303                 }
304                 else
305                 {
306                         if (r_ptr->flags3 & RF3_HURT_COLD)
307                         {
308                                 if (mult < 50) mult = 50;
309                                 if (is_original_ap_and_seen(m_ptr))
310                                 {
311                                         r_ptr->r_flags3 |= RF3_HURT_COLD;
312                                 }
313                         }
314                         else if (mult < 25) mult = 25;
315                 }
316         }
317
318         /* Lightning Eagle (Elec) */
319         if (mode == HISSATSU_ELEC)
320         {
321                 /* Notice immunity */
322                 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
323                 {
324                         if (is_original_ap_and_seen(m_ptr))
325                         {
326                                 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
327                         }
328                 }
329
330                 /* Otherwise, take the damage */
331                 else if (have_flag(flgs, TR_BRAND_ELEC))
332                 {
333                         if (mult < 70) mult = 70;
334                 }
335                 else
336                 {
337                         if (mult < 50) mult = 50;
338                 }
339         }
340
341         /* Bloody Maelstrom */
342         if ((mode == HISSATSU_SEKIRYUKA) && p_ptr->cut && monster_living(m_ptr->r_idx))
343         {
344                 MULTIPLY tmp = MIN(100, MAX(10, p_ptr->cut / 10));
345                 if (mult < tmp) mult = tmp;
346         }
347
348         /* Keiun-Kininken */
349         if (mode == HISSATSU_UNDEAD)
350         {
351                 if (r_ptr->flags3 & RF3_UNDEAD)
352                 {
353                         if (is_original_ap_and_seen(m_ptr))
354                         {
355                                 r_ptr->r_flags3 |= RF3_UNDEAD;
356                         }
357                         if (mult == 10) mult = 70;
358                         else if (mult < 140) mult = MIN(140, mult + 60);
359                 }
360                 if (mult == 10) mult = 40;
361                 else if (mult < 60) mult = MIN(60, mult + 30);
362         }
363
364         if (mult > 150) mult = 150;
365
366         return mult;
367 }
368
369 /*!
370  * @brief ダメージにスレイ要素を加える総合処理ルーチン /
371  * Extract the "total damage" from a given object hitting a given monster.
372  * @param o_ptr 使用武器オブジェクトの構造体参照ポインタ
373  * @param tdam 現在算出途中のダメージ値
374  * @param m_ptr 目標モンスターの構造体参照ポインタ
375  * @param mode 剣術のID
376  * @param thrown 射撃処理ならばTRUEを指定する
377  * @return 総合的なスレイを加味したダメージ値
378  * @note
379  * Note that "flasks of oil" do NOT do fire damage, although they\n
380  * certainly could be made to do so.  XXX XXX\n
381  *\n
382  * Note that most brands and slays are x3, except Slay Animal (x2),\n
383  * Slay Evil (x2), and Kill dragon (x5).\n
384  */
385 HIT_POINT tot_dam_aux(object_type *o_ptr, HIT_POINT tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown)
386 {
387         MULTIPLY mult = 10;
388
389         BIT_FLAGS flgs[TR_FLAG_SIZE];
390         object_flags(o_ptr, flgs);
391         torch_flags(o_ptr, flgs); /* torches has secret flags */
392
393         if (!thrown)
394         {
395                 /* Magical Swords */
396                 if (p_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
397                 if (p_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
398                 if (p_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
399                 if (p_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
400                 if (p_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
401         }
402
403         /* Hex - Slay Good (Runesword) */
404         if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
405
406         /* Some "weapons" and "ammo" do extra damage */
407         switch (o_ptr->tval)
408         {
409         case TV_SHOT:
410         case TV_ARROW:
411         case TV_BOLT:
412         case TV_HAFTED:
413         case TV_POLEARM:
414         case TV_SWORD:
415         case TV_DIGGING:
416         case TV_LITE:
417         {
418                 /* Slaying */
419                 mult = mult_slaying(mult, flgs, m_ptr);
420
421                 /* Elemental Brand */
422                 mult = mult_brand(mult, flgs, m_ptr);
423
424                 /* Hissatsu */
425                 if (p_ptr->pclass == CLASS_SAMURAI)
426                 {
427                         mult = mult_hissatsu(mult, flgs, m_ptr, mode);
428                 }
429
430                 /* Force Weapon */
431                 if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (p_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
432                 {
433                         p_ptr->csp -= (1 + (o_ptr->dd * o_ptr->ds / 5));
434                         p_ptr->redraw |= (PR_MANA);
435                         mult = mult * 3 / 2 + 20;
436                 }
437
438                 /* Hack -- The Nothung cause special damage to Fafner */
439                 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
440                         mult = 150;
441                 break;
442         }
443         }
444         if (mult > 150) mult = 150;
445
446         /* Return the total damage */
447         return (tdam * mult / 10);
448 }
449
450 /*!
451 * @brief プレイヤーからモンスターへの打撃クリティカル判定 /
452 * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
453 * @param weight 矢弾の重量
454 * @param plus 武器の命中修正
455 * @param dam 現在算出中のダメージ値
456 * @param meichuu 打撃の基本命中力
457 * @param mode オプションフラグ
458 * @return クリティカル修正が入ったダメージ値
459 */
460 HIT_POINT critical_norm(WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, BIT_FLAGS mode)
461 {
462         int i, k;
463
464         /* Extract "blow" power */
465         i = (weight + (meichuu * 3 + plus * 5) + p_ptr->skill_thn);
466
467         /* Chance */
468         if ((randint1((p_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i) || (mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN))
469         {
470                 k = weight + randint1(650);
471                 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k += randint1(650);
472
473                 if (k < 400)
474                 {
475                         msg_print(_("手ごたえがあった!", "It was a good hit!"));
476
477                         dam = 2 * dam + 5;
478                 }
479                 else if (k < 700)
480                 {
481                         msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
482                         dam = 2 * dam + 10;
483                 }
484                 else if (k < 900)
485                 {
486                         msg_print(_("会心の一撃だ!", "It was a superb hit!"));
487                         dam = 3 * dam + 15;
488                 }
489                 else if (k < 1300)
490                 {
491                         msg_print(_("最高の会心の一撃だ!", "It was a *GREAT* hit!"));
492                         dam = 3 * dam + 20;
493                 }
494                 else
495                 {
496                         msg_print(_("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!"));
497                         dam = ((7 * dam) / 2) + 25;
498                 }
499         }
500
501         return (dam);
502 }
503
504 /*!
505  * @brief モンスター打撃のクリティカルランクを返す /
506  * Critical blow. All hits that do 95% of total possible damage,
507  * @param dice モンスター打撃のダイス数
508  * @param sides モンスター打撃の最大ダイス目
509  * @param dam プレイヤーに与えたダメージ
510  * @details
511  * and which also do at least 20 damage, or, sometimes, N damage.
512  * This is used only to determine "cuts" and "stuns".
513  */
514 static int monster_critical(DICE_NUMBER dice, DICE_SID sides, HIT_POINT dam)
515 {
516         int max = 0;
517         int total = dice * sides;
518
519         /* Must do at least 95% of perfect */
520         if (dam < total * 19 / 20) return (0);
521
522         /* Weak blows rarely work */
523         if ((dam < 20) && (randint0(100) >= dam)) return (0);
524
525         /* Perfect damage */
526         if ((dam >= total) && (dam >= 40)) max++;
527
528         /* Super-charge */
529         if (dam >= 20)
530         {
531                 while (randint0(100) < 2) max++;
532         }
533
534         /* Critical damage */
535         if (dam > 45) return (6 + max);
536         if (dam > 33) return (5 + max);
537         if (dam > 25) return (4 + max);
538         if (dam > 18) return (3 + max);
539         if (dam > 11) return (2 + max);
540         return (1 + max);
541 }
542
543 /*!
544  * @brief モンスター打撃の命中を判定する /
545  * Determine if a monster attack against the player succeeds.
546  * @param power 打撃属性毎の基本命中値
547  * @param level モンスターのレベル
548  * @param stun モンスターの朦朧値
549  * @return TRUEならば命中判定
550  * @details
551  * Always miss 5% of the time, Always hit 5% of the time.
552  * Otherwise, match monster power against player armor.
553  */
554 static int check_hit(int power, DEPTH level, int stun)
555 {
556         int i, k, ac;
557
558         /* Percentile dice */
559         k = randint0(100);
560
561         if (stun && one_in_(2)) return FALSE;
562
563         /* Hack -- Always miss or hit */
564         if (k < 10) return (k < 5);
565
566         /* Calculate the "attack quality" */
567         i = (power + (level * 3));
568
569         /* Total armor */
570         ac = p_ptr->ac + p_ptr->to_a;
571         if (p_ptr->special_attack & ATTACK_SUIKEN) ac += (p_ptr->lev * 2);
572
573         /* Power and Level compete against Armor */
574         if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return (TRUE);
575
576         /* Assume miss */
577         return (FALSE);
578 }
579
580 /*! モンスターの侮辱行為メッセージテーブル / Hack -- possible "insult" messages */
581 static concptr desc_insult[] =
582 {
583 #ifdef JP
584         "があなたを侮辱した!",
585         "があなたの母を侮辱した!",
586         "があなたを軽蔑した!",
587         "があなたを辱めた!",
588         "があなたを汚した!",
589         "があなたの回りで踊った!",
590         "が猥褻な身ぶりをした!",
591         "があなたをぼんやりと見た!!!",
592         "があなたをパラサイト呼ばわりした!",
593         "があなたをサイボーグ扱いした!"
594 #else
595         "insults you!",
596         "insults your mother!",
597         "gives you the finger!",
598         "humiliates you!",
599         "defiles you!",
600         "dances around you!",
601         "makes obscene gestures!",
602         "moons you!!!"
603         "calls you a parasite!",
604         "calls you a cyborg!"
605 #endif
606
607 };
608
609 /*! マゴットのぼやきメッセージテーブル / Hack -- possible "insult" messages */
610 static concptr desc_moan[] =
611 {
612 #ifdef JP
613         "は何かを悲しんでいるようだ。",
614         "が彼の飼い犬を見なかったかと尋ねている。",
615         "が縄張りから出て行けと言っている。",
616         "はキノコがどうとか呟いている。"
617 #else
618         "seems sad about something.",
619         "asks if you have seen his dogs.",
620         "tells you to get off his land.",
621         "mumbles something about mushrooms."
622 #endif
623
624 };
625
626 /*!
627 * @brief 敵オーラによるプレイヤーのダメージ処理(補助)
628 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
629 * @param immune ダメージを回避できる免疫フラグ
630 * @param flags_offset オーラフラグ配列の参照オフセット
631 * @param r_flags_offset モンスターの耐性配列の参照オフセット
632 * @param aura_flag オーラフラグ配列
633 * @param dam_func ダメージ処理を行う関数の参照ポインタ
634 * @param message オーラダメージを受けた際のメッセージ
635 * @return なし
636 */
637 static void touch_zap_player_aux(monster_type *m_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
638         HIT_POINT(*dam_func)(HIT_POINT dam, concptr kb_str, int monspell, bool aura), concptr message)
639 {
640         monster_race *r_ptr = &r_info[m_ptr->r_idx];
641
642         if ((atoffset(u32b, r_ptr, flags_offset) & aura_flag) && !immune)
643         {
644                 GAME_TEXT mon_name[MAX_NLEN];
645                 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
646
647                 /* Hack -- Get the "died from" name */
648                 monster_desc(mon_name, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
649
650                 msg_print(message);
651
652                 dam_func(aura_damage, mon_name, -1, TRUE);
653
654                 if (is_original_ap_and_seen(m_ptr))
655                 {
656                         atoffset(u32b, r_ptr, r_flags_offset) |= aura_flag;
657                 }
658
659                 handle_stuff();
660         }
661 }
662
663 /*!
664 * @brief 敵オーラによるプレイヤーのダメージ処理(メイン)
665 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
666 * @return なし
667 */
668 static void touch_zap_player(monster_type *m_ptr)
669 {
670         touch_zap_player_aux(m_ptr, p_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
671                 fire_dam, _("突然とても熱くなった!", "You are suddenly very hot!"));
672         touch_zap_player_aux(m_ptr, p_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
673                 cold_dam, _("突然とても寒くなった!", "You are suddenly very cold!"));
674         touch_zap_player_aux(m_ptr, p_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
675                 elec_dam, _("電撃をくらった!", "You get zapped!"));
676 }
677
678 /*!
679 * @brief プレイヤーの変異要素による打撃処理
680 * @param m_idx 攻撃目標となったモンスターの参照ID
681 * @param attack 変異要素による攻撃要素の種類
682 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
683 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
684 * @return なし
685 */
686 static void natural_attack(MONSTER_IDX m_idx, int attack, bool *fear, bool *mdeath)
687 {
688         HIT_POINT k;
689         int bonus, chance;
690         WEIGHT n_weight = 0;
691         monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
692         monster_race *r_ptr = &r_info[m_ptr->r_idx];
693         GAME_TEXT m_name[MAX_NLEN];
694
695         int dice_num, dice_side;
696
697         concptr atk_desc;
698
699         switch (attack)
700         {
701         case MUT2_SCOR_TAIL:
702                 dice_num = 3;
703                 dice_side = 7;
704                 n_weight = 5;
705                 atk_desc = _("尻尾", "tail");
706
707                 break;
708         case MUT2_HORNS:
709                 dice_num = 2;
710                 dice_side = 6;
711                 n_weight = 15;
712                 atk_desc = _("角", "horns");
713
714                 break;
715         case MUT2_BEAK:
716                 dice_num = 2;
717                 dice_side = 4;
718                 n_weight = 5;
719                 atk_desc = _("クチバシ", "beak");
720
721                 break;
722         case MUT2_TRUNK:
723                 dice_num = 1;
724                 dice_side = 4;
725                 n_weight = 35;
726                 atk_desc = _("象の鼻", "trunk");
727
728                 break;
729         case MUT2_TENTACLES:
730                 dice_num = 2;
731                 dice_side = 5;
732                 n_weight = 5;
733                 atk_desc = _("触手", "tentacles");
734
735                 break;
736         default:
737                 dice_num = dice_side = n_weight = 1;
738                 atk_desc = _("未定義の部位", "undefined body part");
739
740         }
741
742         /* Extract monster name (or "it") */
743         monster_desc(m_name, m_ptr, 0);
744
745         /* Calculate the "attack quality" */
746         bonus = p_ptr->to_h_m + (p_ptr->lev * 6 / 5);
747         chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
748
749         /* Test for hit */
750         if ((!(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2)) && test_hit_norm(chance, r_ptr->ac, m_ptr->ml))
751         {
752                 sound(SOUND_HIT);
753                 msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
754
755                 k = damroll(dice_num, dice_side);
756                 k = critical_norm(n_weight, bonus, k, (s16b)bonus, 0);
757
758                 /* Apply the player damage bonuses */
759                 k += p_ptr->to_d_m;
760
761                 /* No negative damage */
762                 if (k < 0) k = 0;
763
764                 /* Modify the damage */
765                 k = mon_damage_mod(m_ptr, k, FALSE);
766
767                 /* Complex message */
768                 msg_format_wizard(CHEAT_MONSTER,
769                         _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
770                         k, m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
771
772                 /* Anger the monster */
773                 if (k > 0) anger_monster(m_ptr);
774
775                 /* Damage, check for fear and mdeath */
776                 switch (attack)
777                 {
778                 case MUT2_SCOR_TAIL:
779                         project(0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
780                         *mdeath = (m_ptr->r_idx == 0);
781                         break;
782                 case MUT2_HORNS:
783                         *mdeath = mon_take_hit(m_idx, k, fear, NULL);
784                         break;
785                 case MUT2_BEAK:
786                         *mdeath = mon_take_hit(m_idx, k, fear, NULL);
787                         break;
788                 case MUT2_TRUNK:
789                         *mdeath = mon_take_hit(m_idx, k, fear, NULL);
790                         break;
791                 case MUT2_TENTACLES:
792                         *mdeath = mon_take_hit(m_idx, k, fear, NULL);
793                         break;
794                 default:
795                         *mdeath = mon_take_hit(m_idx, k, fear, NULL);
796                 }
797
798                 touch_zap_player(m_ptr);
799         }
800         /* Player misses */
801         else
802         {
803                 sound(SOUND_MISS);
804                 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
805         }
806 }
807
808 /*!
809 * @brief プレイヤーの打撃処理サブルーチン /
810 * Player attacks a (poor, defenseless) creature        -RAK-
811 * @param y 攻撃目標のY座標
812 * @param x 攻撃目標のX座標
813 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
814 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
815 * @param hand 攻撃を行うための武器を持つ手
816 * @param mode 発動中の剣術ID
817 * @return なし
818 * @details
819 * If no "weapon" is available, then "punch" the monster one time.
820 */
821 static void py_attack_aux(POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, COMBAT_OPTION_IDX mode)
822 {
823         int num = 0, bonus, chance, vir;
824         HIT_POINT k;
825
826         grid_type       *g_ptr = &current_floor_ptr->grid_array[y][x];
827
828         monster_type    *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
829         monster_race    *r_ptr = &r_info[m_ptr->r_idx];
830
831         /* Access the weapon */
832         object_type     *o_ptr = &inventory[INVEN_RARM + hand];
833
834         GAME_TEXT m_name[MAX_NLEN];
835
836         bool            success_hit = FALSE;
837         bool            backstab = FALSE;
838         bool            vorpal_cut = FALSE;
839         int             chaos_effect = 0;
840         bool            stab_fleeing = FALSE;
841         bool            fuiuchi = FALSE;
842         bool            monk_attack = FALSE;
843         bool            do_quake = FALSE;
844         bool            weak = FALSE;
845         bool            drain_msg = TRUE;
846         int             drain_result = 0, drain_heal = 0;
847         bool            can_drain = FALSE;
848         int             num_blow;
849         int             drain_left = MAX_VAMPIRIC_DRAIN;
850         BIT_FLAGS flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
851         bool            is_human = (r_ptr->d_char == 'p');
852         bool            is_lowlevel = (r_ptr->level < (p_ptr->lev - 15));
853         bool            zantetsu_mukou, e_j_mukou;
854
855         switch (p_ptr->pclass)
856         {
857         case CLASS_ROGUE:
858         case CLASS_NINJA:
859                 if (has_melee_weapon(INVEN_RARM + hand) && !p_ptr->icky_wield[hand])
860                 {
861                         int tmp = p_ptr->lev * 6 + (p_ptr->skill_stl + 10) * 4;
862                         if (p_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
863                         if (p_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
864                         if (r_ptr->level > (p_ptr->lev * p_ptr->lev / 20 + 10)) tmp /= 3;
865                         if (MON_CSLEEP(m_ptr) && m_ptr->ml)
866                         {
867                                 /* Can't backstab creatures that we can't see, right? */
868                                 backstab = TRUE;
869                         }
870                         else if ((p_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level + 20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
871                         {
872                                 fuiuchi = TRUE;
873                         }
874                         else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
875                         {
876                                 stab_fleeing = TRUE;
877                         }
878                 }
879                 break;
880
881         case CLASS_MONK:
882         case CLASS_FORCETRAINER:
883         case CLASS_BERSERKER:
884                 if ((empty_hands(TRUE) & EMPTY_HAND_RARM) && !p_ptr->riding) monk_attack = TRUE;
885                 break;
886         }
887
888         if (!o_ptr->k_idx) /* Empty hand */
889         {
890                 if ((r_ptr->level + 10) > p_ptr->lev)
891                 {
892                         if (p_ptr->skill_exp[GINOU_SUDE] < s_info[p_ptr->pclass].s_max[GINOU_SUDE])
893                         {
894                                 if (p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
895                                         p_ptr->skill_exp[GINOU_SUDE] += 40;
896                                 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
897                                         p_ptr->skill_exp[GINOU_SUDE] += 5;
898                                 else if ((p_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19))
899                                         p_ptr->skill_exp[GINOU_SUDE] += 1;
900                                 else if ((p_ptr->lev > 34))
901                                         if (one_in_(3)) p_ptr->skill_exp[GINOU_SUDE] += 1;
902                                 p_ptr->update |= (PU_BONUS);
903                         }
904                 }
905         }
906         else if (object_is_melee_weapon(o_ptr))
907         {
908                 if ((r_ptr->level + 10) > p_ptr->lev)
909                 {
910                         OBJECT_TYPE_VALUE tval = inventory[INVEN_RARM + hand].tval - TV_WEAPON_BEGIN;
911                         OBJECT_SUBTYPE_VALUE sval = inventory[INVEN_RARM + hand].sval;
912                         int now_exp = p_ptr->weapon_exp[tval][sval];
913                         if (now_exp < s_info[p_ptr->pclass].w_max[tval][sval])
914                         {
915                                 SUB_EXP amount = 0;
916                                 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
917                                 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
918                                 else if ((now_exp < WEAPON_EXP_EXPERT) && (p_ptr->lev > 19)) amount = 1;
919                                 else if ((p_ptr->lev > 34) && one_in_(2)) amount = 1;
920                                 p_ptr->weapon_exp[tval][sval] += amount;
921                                 p_ptr->update |= (PU_BONUS);
922                         }
923                 }
924         }
925
926         /* Disturb the monster */
927         (void)set_monster_csleep(g_ptr->m_idx, 0);
928
929         /* Extract monster name (or "it") */
930         monster_desc(m_name, m_ptr, 0);
931
932         /* Calculate the "attack quality" */
933         bonus = p_ptr->to_h[hand] + o_ptr->to_h;
934         chance = (p_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
935         if (mode == HISSATSU_IAI) chance += 60;
936         if (p_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
937         if (p_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
938
939         vir = virtue_number(V_VALOUR);
940         if (vir)
941         {
942                 chance += (p_ptr->virtues[vir - 1] / 10);
943         }
944
945         zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
946         e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
947
948         if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
949         else if (mode == HISSATSU_COLD) num_blow = p_ptr->num_blow[hand] + 2;
950         else num_blow = p_ptr->num_blow[hand];
951
952         /* Hack -- DOKUBARI always hit once */
953         if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) num_blow = 1;
954
955         /* Attack once for each legal blow */
956         while ((num++ < num_blow) && !p_ptr->is_dead)
957         {
958                 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
959                 {
960                         int n = 1;
961
962                         if (p_ptr->migite && p_ptr->hidarite)
963                         {
964                                 n *= 2;
965                         }
966                         if (mode == HISSATSU_3DAN)
967                         {
968                                 n *= 2;
969                         }
970
971                         success_hit = one_in_(n);
972                 }
973                 else if ((p_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
974                 else success_hit = test_hit_norm(chance, r_ptr->ac, m_ptr->ml);
975
976                 if (mode == HISSATSU_MAJIN)
977                 {
978                         if (one_in_(2))
979                                 success_hit = FALSE;
980                 }
981
982                 /* Test for hit */
983                 if (success_hit)
984                 {
985                         int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
986
987                         sound(SOUND_HIT);
988
989                         if (backstab) msg_format(_("あなたは冷酷にも眠っている無力な%sを突き刺した!", "You cruelly stab the helpless, sleeping %s!"), m_name);
990                         else if (fuiuchi) msg_format(_("不意を突いて%sに強烈な一撃を喰らわせた!", "You make surprise attack, and hit %s with a powerful blow!"), m_name);
991                         else if (stab_fleeing) msg_format(_("逃げる%sを背中から突き刺した!", "You backstab the fleeing %s!"), m_name);
992                         else if (!monk_attack) msg_format(_("%sを攻撃した。", "You hit %s."), m_name);
993
994                         /* Hack -- bare hands do one damage */
995                         k = 1;
996
997                         object_flags(o_ptr, flgs);
998
999                         /* Select a chaotic effect (50% chance) */
1000                         if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1001                         {
1002                                 if (one_in_(10))
1003                                         chg_virtue(V_CHANCE, 1);
1004
1005                                 if (randint1(5) < 3)
1006                                 {
1007                                         /* Vampiric (20%) */
1008                                         chaos_effect = 1;
1009                                 }
1010                                 else if (one_in_(250))
1011                                 {
1012                                         /* Quake (0.12%) */
1013                                         chaos_effect = 2;
1014                                 }
1015                                 else if (!one_in_(10))
1016                                 {
1017                                         /* Confusion (26.892%) */
1018                                         chaos_effect = 3;
1019                                 }
1020                                 else if (one_in_(2))
1021                                 {
1022                                         /* Teleport away (1.494%) */
1023                                         chaos_effect = 4;
1024                                 }
1025                                 else
1026                                 {
1027                                         /* Polymorph (1.494%) */
1028                                         chaos_effect = 5;
1029                                 }
1030                         }
1031
1032                         /* Vampiric drain */
1033                         if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
1034                         {
1035                                 /* Only drain "living" monsters */
1036                                 if (monster_living(m_ptr->r_idx))
1037                                         can_drain = TRUE;
1038                                 else
1039                                         can_drain = FALSE;
1040                         }
1041
1042                         if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance * 3 / 2) == 1) && !zantetsu_mukou)
1043                                 vorpal_cut = TRUE;
1044                         else vorpal_cut = FALSE;
1045
1046                         if (monk_attack)
1047                         {
1048                                 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1049                                 int min_level = 1;
1050                                 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1051                                 int resist_stun = 0;
1052                                 WEIGHT weight = 8;
1053
1054                                 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1055                                 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1056                                 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1057                                 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1058                                 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1059                                         resist_stun += 66;
1060
1061                                 if (p_ptr->special_defense & KAMAE_BYAKKO)
1062                                         max_times = (p_ptr->lev < 3 ? 1 : p_ptr->lev / 3);
1063                                 else if (p_ptr->special_defense & KAMAE_SUZAKU)
1064                                         max_times = 1;
1065                                 else if (p_ptr->special_defense & KAMAE_GENBU)
1066                                         max_times = 1;
1067                                 else
1068                                         max_times = (p_ptr->lev < 7 ? 1 : p_ptr->lev / 7);
1069                                 /* Attempt 'times' */
1070                                 for (times = 0; times < max_times; times++)
1071                                 {
1072                                         do
1073                                         {
1074                                                 ma_ptr = &ma_blows[randint0(MAX_MA)];
1075                                                 if ((p_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
1076                                                 else min_level = ma_ptr->min_level;
1077                                         } while ((min_level > p_ptr->lev) ||
1078                                                 (randint1(p_ptr->lev) < ma_ptr->chance));
1079
1080                                         /* keep the highest level attack available we found */
1081                                         if ((ma_ptr->min_level > old_ptr->min_level) &&
1082                                                 !p_ptr->stun && !p_ptr->confused)
1083                                         {
1084                                                 old_ptr = ma_ptr;
1085
1086                                                 if (p_ptr->wizard && cheat_xtra)
1087                                                 {
1088                                                         msg_print(_("攻撃を再選択しました。", "Attack re-selected."));
1089                                                 }
1090                                         }
1091                                         else
1092                                         {
1093                                                 ma_ptr = old_ptr;
1094                                         }
1095                                 }
1096
1097                                 if (p_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
1098                                 else min_level = ma_ptr->min_level;
1099                                 k = damroll(ma_ptr->dd + p_ptr->to_dd[hand], ma_ptr->ds + p_ptr->to_ds[hand]);
1100                                 if (p_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
1101
1102                                 if (ma_ptr->effect == MA_KNEE)
1103                                 {
1104                                         if (r_ptr->flags1 & RF1_MALE)
1105                                         {
1106                                                 msg_format(_("%sに金的膝蹴りをくらわした!", "You hit %s in the groin with your knee!"), m_name);
1107                                                 sound(SOUND_PAIN);
1108                                                 special_effect = MA_KNEE;
1109                                         }
1110                                         else
1111                                                 msg_format(ma_ptr->desc, m_name);
1112                                 }
1113
1114                                 else if (ma_ptr->effect == MA_SLOW)
1115                                 {
1116                                         if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
1117                                                 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
1118                                         {
1119                                                 msg_format(_("%sの足首に関節蹴りをくらわした!", "You kick %s in the ankle."), m_name);
1120                                                 special_effect = MA_SLOW;
1121                                         }
1122                                         else msg_format(ma_ptr->desc, m_name);
1123                                 }
1124                                 else
1125                                 {
1126                                         if (ma_ptr->effect)
1127                                         {
1128                                                 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
1129                                         }
1130
1131                                         msg_format(ma_ptr->desc, m_name);
1132                                 }
1133
1134                                 if (p_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
1135                                 if ((p_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
1136                                 {
1137                                         weight += (P_PTR_KI / 30);
1138                                         if (weight > 20) weight = 20;
1139                                 }
1140
1141                                 k = critical_norm(p_ptr->lev * weight, min_level, k, p_ptr->to_h[0], 0);
1142
1143                                 if ((special_effect == MA_KNEE) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1144                                 {
1145                                         msg_format(_("%^sは苦痛にうめいている!", "%^s moans in agony!"), m_name);
1146                                         stun_effect = 7 + randint1(13);
1147                                         resist_stun /= 3;
1148                                 }
1149
1150                                 else if ((special_effect == MA_SLOW) && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1151                                 {
1152                                         if (!(r_ptr->flags1 & RF1_UNIQUE) &&
1153                                                 (randint1(p_ptr->lev) > r_ptr->level) &&
1154                                                 m_ptr->mspeed > 60)
1155                                         {
1156                                                 msg_format(_("%^sは足をひきずり始めた。", "%^s starts limping slower."), m_name);
1157                                                 m_ptr->mspeed -= 10;
1158                                         }
1159                                 }
1160
1161                                 if (stun_effect && ((k + p_ptr->to_d[hand]) < m_ptr->hp))
1162                                 {
1163                                         if (p_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
1164                                         {
1165                                                 if (set_monster_stunned(g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
1166                                                 {
1167                                                         msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name);
1168                                                 }
1169                                                 else
1170                                                 {
1171                                                         msg_format(_("%^sはさらにフラフラになった。", "%^s is more stunned."), m_name);
1172                                                 }
1173                                         }
1174                                 }
1175                         }
1176
1177                         /* Handle normal weapon */
1178                         else if (o_ptr->k_idx)
1179                         {
1180                                 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
1181                                 k = tot_dam_aux(o_ptr, k, m_ptr, mode, FALSE);
1182
1183                                 if (backstab)
1184                                 {
1185                                         k *= (3 + (p_ptr->lev / 20));
1186                                 }
1187                                 else if (fuiuchi)
1188                                 {
1189                                         k = k*(5 + (p_ptr->lev * 2 / 25)) / 2;
1190                                 }
1191                                 else if (stab_fleeing)
1192                                 {
1193                                         k = (3 * k) / 2;
1194                                 }
1195
1196                                 if ((p_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
1197                                         (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
1198                                 {
1199                                         do_quake = TRUE;
1200                                 }
1201
1202                                 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_DOKUBARI)) && !(mode == HISSATSU_KYUSHO))
1203                                         k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
1204
1205                                 drain_result = k;
1206
1207                                 if (vorpal_cut)
1208                                 {
1209                                         int mult = 2;
1210
1211                                         if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
1212                                         {
1213                                                 char chainsword_noise[1024];
1214                                                 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, chainsword_noise))
1215                                                 {
1216                                                         msg_print(chainsword_noise);
1217                                                 }
1218                                         }
1219
1220                                         if (o_ptr->name1 == ART_VORPAL_BLADE)
1221                                         {
1222                                                 msg_print(_("目にも止まらぬヴォーパルブレード、手錬の早業!", "Your Vorpal Blade goes snicker-snack!"));
1223                                         }
1224                                         else
1225                                         {
1226                                                 msg_format(_("%sをグッサリ切り裂いた!", "Your weapon cuts deep into %s!"), m_name);
1227                                         }
1228
1229                                         /* Try to increase the damage */
1230                                         while (one_in_(vorpal_chance))
1231                                         {
1232                                                 mult++;
1233                                         }
1234
1235                                         k *= (HIT_POINT)mult;
1236
1237                                         /* Ouch! */
1238                                         if (((r_ptr->flagsr & RFR_RES_ALL) ? k / 100 : k) > m_ptr->hp)
1239                                         {
1240                                                 msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), m_name);
1241                                         }
1242                                         else
1243                                         {
1244                                                 switch (mult)
1245                                                 {
1246                                                 case 2: msg_format(_("%sを斬った!", "You gouge %s!"), m_name); break;
1247                                                 case 3: msg_format(_("%sをぶった斬った!", "You maim %s!"), m_name); break;
1248                                                 case 4: msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), m_name); break;
1249                                                 case 5: msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), m_name); break;
1250                                                 case 6: msg_format(_("%sを刺身にした!", "You smite %s!"), m_name); break;
1251                                                 case 7: msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), m_name); break;
1252                                                 default: msg_format(_("%sを細切れにした!", "You shred %s!"), m_name); break;
1253                                                 }
1254                                         }
1255                                         drain_result = drain_result * 3 / 2;
1256                                 }
1257
1258                                 k += o_ptr->to_d;
1259                                 drain_result += o_ptr->to_d;
1260                         }
1261
1262                         /* Apply the player damage bonuses */
1263                         k += p_ptr->to_d[hand];
1264                         drain_result += p_ptr->to_d[hand];
1265
1266                         if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
1267                         if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(m_ptr->r_idx)) k = 0;
1268                         if ((mode == HISSATSU_SEKIRYUKA) && !p_ptr->cut) k /= 2;
1269
1270                         /* No negative damage */
1271                         if (k < 0) k = 0;
1272
1273                         if ((mode == HISSATSU_ZANMA) && !(!monster_living(m_ptr->r_idx) && (r_ptr->flags3 & RF3_EVIL)))
1274                         {
1275                                 k = 0;
1276                         }
1277
1278                         if (zantetsu_mukou)
1279                         {
1280                                 msg_print(_("こんな軟らかいものは切れん!", "You cannot cut such a elastic thing!"));
1281                                 k = 0;
1282                         }
1283
1284                         if (e_j_mukou)
1285                         {
1286                                 msg_print(_("蜘蛛は苦手だ!", "Spiders are difficult for you to deal with!"));
1287                                 k /= 2;
1288                         }
1289
1290                         if (mode == HISSATSU_MINEUCHI)
1291                         {
1292                                 int tmp = (10 + randint1(15) + p_ptr->lev / 5);
1293
1294                                 k = 0;
1295                                 anger_monster(m_ptr);
1296
1297                                 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
1298                                 {
1299                                         /* Get stunned */
1300                                         if (MON_STUNNED(m_ptr))
1301                                         {
1302                                                 msg_format(_("%sはひどくもうろうとした。", "%s is more dazed."), m_name);
1303                                                 tmp /= 2;
1304                                         }
1305                                         else
1306                                         {
1307                                                 msg_format(_("%s はもうろうとした。", "%s is dazed."), m_name);
1308                                         }
1309
1310                                         /* Apply stun */
1311                                         (void)set_monster_stunned(g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
1312                                 }
1313                                 else
1314                                 {
1315                                         msg_format(_("%s には効果がなかった。", "%s is not effected."), m_name);
1316                                 }
1317                         }
1318
1319                         /* Modify the damage */
1320                         k = mon_damage_mod(m_ptr, k, (bool)(((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((p_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
1321                         if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) || (mode == HISSATSU_KYUSHO))
1322                         {
1323                                 if ((randint1(randint1(r_ptr->level / 7) + 5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
1324                                 {
1325                                         k = m_ptr->hp + 1;
1326                                         msg_format(_("%sの急所を突き刺した!", "You hit %s on a fatal spot!"), m_name);
1327                                 }
1328                                 else k = 1;
1329                         }
1330                         else if ((p_ptr->pclass == CLASS_NINJA) && has_melee_weapon(INVEN_RARM + hand) && !p_ptr->icky_wield[hand] && ((p_ptr->cur_lite <= 0) || one_in_(7)))
1331                         {
1332                                 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
1333                                 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
1334                                 {
1335                                         k *= 5;
1336                                         drain_result *= 2;
1337                                         msg_format(_("刃が%sに深々と突き刺さった!", "You critically injured %s!"), m_name);
1338                                 }
1339                                 else if (((m_ptr->hp < maxhp / 2) && one_in_((p_ptr->num_blow[0] + p_ptr->num_blow[1] + 1) * 10)) || ((one_in_(666) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)))
1340                                 {
1341                                         if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp / 2))
1342                                         {
1343                                                 k = MAX(k * 5, m_ptr->hp / 2);
1344                                                 drain_result *= 2;
1345                                                 msg_format(_("%sに致命傷を負わせた!", "You fatally injured %s!"), m_name);
1346                                         }
1347                                         else
1348                                         {
1349                                                 k = m_ptr->hp + 1;
1350                                                 msg_format(_("刃が%sの急所を貫いた!", "You hit %s on a fatal spot!"), m_name);
1351                                         }
1352                                 }
1353                         }
1354
1355                         msg_format_wizard(CHEAT_MONSTER,
1356                                 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), k,
1357                                 m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
1358
1359                         if (k <= 0) can_drain = FALSE;
1360
1361                         if (drain_result > m_ptr->hp)
1362                                 drain_result = m_ptr->hp;
1363
1364                         /* Damage, check for fear and death */
1365                         if (mon_take_hit(g_ptr->m_idx, k, fear, NULL))
1366                         {
1367                                 *mdeath = TRUE;
1368                                 if ((p_ptr->pclass == CLASS_BERSERKER) && p_ptr->energy_use)
1369                                 {
1370                                         if (p_ptr->migite && p_ptr->hidarite)
1371                                         {
1372                                                 if (hand) p_ptr->energy_use = p_ptr->energy_use * 3 / 5 + p_ptr->energy_use*num * 2 / (p_ptr->num_blow[hand] * 5);
1373                                                 else p_ptr->energy_use = p_ptr->energy_use*num * 3 / (p_ptr->num_blow[hand] * 5);
1374                                         }
1375                                         else
1376                                         {
1377                                                 p_ptr->energy_use = p_ptr->energy_use*num / p_ptr->num_blow[hand];
1378                                         }
1379                                 }
1380                                 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
1381                                         msg_print(_("またつまらぬものを斬ってしまった...", "Sigh... Another trifling thing I've cut...."));
1382                                 break;
1383                         }
1384
1385                         /* Anger the monster */
1386                         if (k > 0) anger_monster(m_ptr);
1387
1388                         touch_zap_player(m_ptr);
1389
1390                         /* Are we draining it?  A little note: If the monster is
1391                         dead, the drain does not work... */
1392
1393                         if (can_drain && (drain_result > 0))
1394                         {
1395                                 if (o_ptr->name1 == ART_MURAMASA)
1396                                 {
1397                                         if (is_human)
1398                                         {
1399                                                 HIT_PROB to_h = o_ptr->to_h;
1400                                                 HIT_POINT to_d = o_ptr->to_d;
1401                                                 int i, flag;
1402
1403                                                 flag = 1;
1404                                                 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
1405                                                 if (flag) to_h++;
1406
1407                                                 flag = 1;
1408                                                 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
1409                                                 if (flag) to_d++;
1410
1411                                                 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
1412                                                 {
1413                                                         msg_print(_("妖刀は血を吸って強くなった!", "Muramasa sucked blood, and became more powerful!"));
1414                                                         o_ptr->to_h = to_h;
1415                                                         o_ptr->to_d = to_d;
1416                                                 }
1417                                         }
1418                                 }
1419                                 else
1420                                 {
1421                                         if (drain_result > 5) /* Did we really hurt it? */
1422                                         {
1423                                                 drain_heal = damroll(2, drain_result / 6);
1424
1425                                                 /* Hex */
1426                                                 if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
1427
1428                                                 if (cheat_xtra)
1429                                                 {
1430                                                         msg_format(_("Draining left: %d", "Draining left: %d"), drain_left);
1431                                                 }
1432
1433                                                 if (drain_left)
1434                                                 {
1435                                                         if (drain_heal < drain_left)
1436                                                         {
1437                                                                 drain_left -= drain_heal;
1438                                                         }
1439                                                         else
1440                                                         {
1441                                                                 drain_heal = drain_left;
1442                                                                 drain_left = 0;
1443                                                         }
1444
1445                                                         if (drain_msg)
1446                                                         {
1447                                                                 msg_format(_("刃が%sから生命力を吸い取った!", "Your weapon drains life from %s!"), m_name);
1448                                                                 drain_msg = FALSE;
1449                                                         }
1450
1451                                                         drain_heal = (drain_heal * p_ptr->mutant_regenerate_mod) / 100;
1452
1453                                                         hp_player(drain_heal);
1454                                                         /* We get to keep some of it! */
1455                                                 }
1456                                         }
1457                                 }
1458                                 m_ptr->maxhp -= (k + 7) / 8;
1459                                 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
1460                                 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
1461                                 weak = TRUE;
1462                         }
1463                         can_drain = FALSE;
1464                         drain_result = 0;
1465
1466                         /* Confusion attack */
1467                         if ((p_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
1468                         {
1469                                 /* Cancel glowing hands */
1470                                 if (p_ptr->special_attack & ATTACK_CONFUSE)
1471                                 {
1472                                         p_ptr->special_attack &= ~(ATTACK_CONFUSE);
1473                                         msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
1474                                         p_ptr->redraw |= (PR_STATUS);
1475
1476                                 }
1477
1478                                 /* Confuse the monster */
1479                                 if (r_ptr->flags3 & RF3_NO_CONF)
1480                                 {
1481                                         if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
1482                                         msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1483
1484                                 }
1485                                 else if (randint0(100) < r_ptr->level)
1486                                 {
1487                                         msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1488                                 }
1489                                 else
1490                                 {
1491                                         msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name);
1492                                         (void)set_monster_confused(g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(p_ptr->lev) / 5);
1493                                 }
1494                         }
1495
1496                         else if (chaos_effect == 4)
1497                         {
1498                                 bool resists_tele = FALSE;
1499
1500                                 if (r_ptr->flagsr & RFR_RES_TELE)
1501                                 {
1502                                         if (r_ptr->flags1 & RF1_UNIQUE)
1503                                         {
1504                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1505                                                 msg_format(_("%^sには効果がなかった。", "%^s is unaffected!"), m_name);
1506                                                 resists_tele = TRUE;
1507                                         }
1508                                         else if (r_ptr->level > randint1(100))
1509                                         {
1510                                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
1511                                                 msg_format(_("%^sは抵抗力を持っている!", "%^s resists!"), m_name);
1512                                                 resists_tele = TRUE;
1513                                         }
1514                                 }
1515
1516                                 if (!resists_tele)
1517                                 {
1518                                         msg_format(_("%^sは消えた!", "%^s disappears!"), m_name);
1519                                         teleport_away(g_ptr->m_idx, 50, TELEPORT_PASSIVE);
1520                                         num = num_blow + 1; /* Can't hit it anymore! */
1521                                         *mdeath = TRUE;
1522                                 }
1523                         }
1524
1525                         else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
1526                         {
1527                                 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
1528                                         !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
1529                                 {
1530                                         if (polymorph_monster(y, x))
1531                                         {
1532                                                 msg_format(_("%^sは変化した!", "%^s changes!"), m_name);
1533                                                 *fear = FALSE;
1534                                                 weak = FALSE;
1535                                         }
1536                                         else
1537                                         {
1538                                                 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
1539                                         }
1540
1541                                         /* Hack -- Get new monster */
1542                                         m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
1543
1544                                         /* Oops, we need a different name... */
1545                                         monster_desc(m_name, m_ptr, 0);
1546
1547                                         /* Hack -- Get new race */
1548                                         r_ptr = &r_info[m_ptr->r_idx];
1549                                 }
1550                         }
1551                         else if (o_ptr->name1 == ART_G_HAMMER)
1552                         {
1553                                 monster_type *target_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
1554
1555                                 if (target_ptr->hold_o_idx)
1556                                 {
1557                                         object_type *q_ptr = &current_floor_ptr->o_list[target_ptr->hold_o_idx];
1558                                         GAME_TEXT o_name[MAX_NLEN];
1559
1560                                         object_desc(o_name, q_ptr, OD_NAME_ONLY);
1561                                         q_ptr->held_m_idx = 0;
1562                                         q_ptr->marked = OM_TOUCHED;
1563                                         target_ptr->hold_o_idx = q_ptr->next_o_idx;
1564                                         q_ptr->next_o_idx = 0;
1565                                         msg_format(_("%sを奪った。", "You snatched %s."), o_name);
1566                                         inven_carry(q_ptr);
1567                                 }
1568                         }
1569                 }
1570
1571                 /* Player misses */
1572                 else
1573                 {
1574                         backstab = FALSE; /* Clumsy! */
1575                         fuiuchi = FALSE; /* Clumsy! */
1576
1577                         if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
1578                         {
1579                                 BIT_FLAGS flgs_aux[TR_FLAG_SIZE];
1580
1581                                 sound(SOUND_HIT);
1582
1583                                 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1584                                 msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
1585                                 object_flags(o_ptr, flgs_aux);
1586
1587                                 k = damroll(o_ptr->dd + p_ptr->to_dd[hand], o_ptr->ds + p_ptr->to_ds[hand]);
1588                                 {
1589                                         int mult;
1590                                         switch (p_ptr->mimic_form)
1591                                         {
1592                                         case MIMIC_NONE:
1593                                                 switch (p_ptr->prace)
1594                                                 {
1595                                                 case RACE_YEEK:
1596                                                 case RACE_KLACKON:
1597                                                 case RACE_HUMAN:
1598                                                 case RACE_AMBERITE:
1599                                                 case RACE_DUNADAN:
1600                                                 case RACE_BARBARIAN:
1601                                                 case RACE_BEASTMAN:
1602                                                         mult = 25; break;
1603                                                 case RACE_HALF_ORC:
1604                                                 case RACE_HALF_TROLL:
1605                                                 case RACE_HALF_OGRE:
1606                                                 case RACE_HALF_GIANT:
1607                                                 case RACE_HALF_TITAN:
1608                                                 case RACE_CYCLOPS:
1609                                                 case RACE_IMP:
1610                                                 case RACE_SKELETON:
1611                                                 case RACE_ZOMBIE:
1612                                                 case RACE_VAMPIRE:
1613                                                 case RACE_SPECTRE:
1614                                                 case RACE_DEMON:
1615                                                 case RACE_DRACONIAN:
1616                                                         mult = 30; break;
1617                                                 default:
1618                                                         mult = 10; break;
1619                                                 }
1620                                                 break;
1621                                         case MIMIC_DEMON:
1622                                         case MIMIC_DEMON_LORD:
1623                                         case MIMIC_VAMPIRE:
1624                                                 mult = 30; break;
1625                                         default:
1626                                                 mult = 10; break;
1627                                         }
1628
1629                                         if (p_ptr->align < 0 && mult < 20)
1630                                                 mult = 20;
1631                                         if (!(p_ptr->resist_acid || IS_OPPOSE_ACID() || p_ptr->immune_acid) && (mult < 25))
1632                                                 mult = 25;
1633                                         if (!(p_ptr->resist_elec || IS_OPPOSE_ELEC() || p_ptr->immune_elec) && (mult < 25))
1634                                                 mult = 25;
1635                                         if (!(p_ptr->resist_fire || IS_OPPOSE_FIRE() || p_ptr->immune_fire) && (mult < 25))
1636                                                 mult = 25;
1637                                         if (!(p_ptr->resist_cold || IS_OPPOSE_COLD() || p_ptr->immune_cold) && (mult < 25))
1638                                                 mult = 25;
1639                                         if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && (mult < 25))
1640                                                 mult = 25;
1641
1642                                         if ((p_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs_aux, TR_FORCE_WEAPON)) && (p_ptr->csp >(p_ptr->msp / 30)))
1643                                         {
1644                                                 p_ptr->csp -= (1 + (p_ptr->msp / 30));
1645                                                 p_ptr->redraw |= (PR_MANA);
1646                                                 mult = mult * 3 / 2 + 20;
1647                                         }
1648                                         k *= (HIT_POINT)mult;
1649                                         k /= 10;
1650                                 }
1651
1652                                 k = critical_norm(o_ptr->weight, o_ptr->to_h, k, p_ptr->to_h[hand], mode);
1653                                 if (one_in_(6))
1654                                 {
1655                                         int mult = 2;
1656                                         msg_format(_("グッサリ切り裂かれた!", "Your weapon cuts deep into yourself!"));
1657                                         /* Try to increase the damage */
1658                                         while (one_in_(4))
1659                                         {
1660                                                 mult++;
1661                                         }
1662
1663                                         k *= (HIT_POINT)mult;
1664                                 }
1665                                 k += (p_ptr->to_d[hand] + o_ptr->to_d);
1666                                 if (k < 0) k = 0;
1667
1668                                 take_hit(DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1);
1669                                 handle_stuff();
1670                         }
1671                         else
1672                         {
1673                                 sound(SOUND_MISS);
1674                                 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1675                         }
1676                 }
1677                 backstab = FALSE;
1678                 fuiuchi = FALSE;
1679         }
1680
1681
1682         if (weak && !(*mdeath))
1683         {
1684                 msg_format(_("%sは弱くなったようだ。", "%^s seems weakened."), m_name);
1685         }
1686         if (drain_left != MAX_VAMPIRIC_DRAIN)
1687         {
1688                 if (one_in_(4))
1689                 {
1690                         chg_virtue(V_UNLIFE, 1);
1691                 }
1692         }
1693         /* Mega-Hack -- apply earthquake brand */
1694         if (do_quake)
1695         {
1696                 earthquake(p_ptr->y, p_ptr->x, 10);
1697                 if (!current_floor_ptr->grid_array[y][x].m_idx) *mdeath = TRUE;
1698         }
1699 }
1700
1701 /*!
1702 * @brief プレイヤーの打撃処理メインルーチン
1703 * @param y 攻撃目標のY座標
1704 * @param x 攻撃目標のX座標
1705 * @param mode 発動中の剣術ID
1706 * @return 実際に攻撃処理が行われた場合TRUEを返す。
1707 * @details
1708 * If no "weapon" is available, then "punch" the monster one time.
1709 */
1710 bool py_attack(POSITION y, POSITION x, COMBAT_OPTION_IDX mode)
1711 {
1712         bool            fear = FALSE;
1713         bool            mdeath = FALSE;
1714         bool            stormbringer = FALSE;
1715
1716         grid_type       *g_ptr = &current_floor_ptr->grid_array[y][x];
1717         monster_type    *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
1718         monster_race    *r_ptr = &r_info[m_ptr->r_idx];
1719         GAME_TEXT m_name[MAX_NLEN];
1720
1721         disturb(FALSE, TRUE);
1722
1723         take_turn(p_ptr, 100);
1724
1725         if (!p_ptr->migite && !p_ptr->hidarite &&
1726                 !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
1727         {
1728                 msg_format(_("%s攻撃できない。", "You cannot do attacking."),
1729                         (empty_hands(FALSE) == EMPTY_HAND_NONE) ? _("両手がふさがって", "") : "");
1730                 return FALSE;
1731         }
1732
1733         /* Extract monster name (or "it") */
1734         monster_desc(m_name, m_ptr, 0);
1735
1736         if (m_ptr->ml)
1737         {
1738                 /* Auto-Recall if possible and visible */
1739                 if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
1740
1741                 /* Track a new monster */
1742                 health_track(g_ptr->m_idx);
1743         }
1744
1745         if ((r_ptr->flags1 & RF1_FEMALE) &&
1746                 !(p_ptr->stun || p_ptr->confused || p_ptr->image || !m_ptr->ml))
1747         {
1748                 if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
1749                 {
1750                         msg_print(_("拙者、おなごは斬れぬ!", "I can not attack women!"));
1751                         return FALSE;
1752                 }
1753         }
1754
1755         if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
1756         {
1757                 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
1758                 return FALSE;
1759         }
1760
1761         /* Stop if friendly */
1762         if (!is_hostile(m_ptr) &&
1763                 !(p_ptr->stun || p_ptr->confused || p_ptr->image ||
1764                         p_ptr->shero || !m_ptr->ml))
1765         {
1766                 if (inventory[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
1767                 if (inventory[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
1768                 if (stormbringer)
1769                 {
1770                         msg_format(_("黒い刃は強欲に%sを攻撃した!", "Your black blade greedily attacks %s!"), m_name);
1771                         chg_virtue(V_INDIVIDUALISM, 1);
1772                         chg_virtue(V_HONOUR, -1);
1773                         chg_virtue(V_JUSTICE, -1);
1774                         chg_virtue(V_COMPASSION, -1);
1775                 }
1776                 else if (p_ptr->pclass != CLASS_BERSERKER)
1777                 {
1778                         if (get_check(_("本当に攻撃しますか?", "Really hit it? ")))
1779                         {
1780                                 chg_virtue(V_INDIVIDUALISM, 1);
1781                                 chg_virtue(V_HONOUR, -1);
1782                                 chg_virtue(V_JUSTICE, -1);
1783                                 chg_virtue(V_COMPASSION, -1);
1784                         }
1785                         else
1786                         {
1787                                 msg_format(_("%sを攻撃するのを止めた。", "You stop to avoid hitting %s."), m_name);
1788                                 return FALSE;
1789                         }
1790                 }
1791         }
1792
1793
1794         /* Handle player fear */
1795         if (p_ptr->afraid)
1796         {
1797                 if (m_ptr->ml)
1798                         msg_format(_("恐くて%sを攻撃できない!", "You are too afraid to attack %s!"), m_name);
1799                 else
1800                         msg_format(_("そっちには何か恐いものがいる!", "There is something scary in your way!"));
1801
1802                 /* Disturb the monster */
1803                 (void)set_monster_csleep(g_ptr->m_idx, 0);
1804
1805                 return FALSE;
1806         }
1807
1808         if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
1809         {
1810                 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_COMPASSION, -1);
1811                 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(V_HONOUR, -1);
1812         }
1813
1814         if (p_ptr->migite && p_ptr->hidarite)
1815         {
1816                 if ((p_ptr->skill_exp[GINOU_NITOURYU] < s_info[p_ptr->pclass].s_max[GINOU_NITOURYU]) && ((p_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_ptr->level))
1817                 {
1818                         if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
1819                                 p_ptr->skill_exp[GINOU_NITOURYU] += 80;
1820                         else if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
1821                                 p_ptr->skill_exp[GINOU_NITOURYU] += 4;
1822                         else if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
1823                                 p_ptr->skill_exp[GINOU_NITOURYU] += 1;
1824                         else if (p_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
1825                                 if (one_in_(3)) p_ptr->skill_exp[GINOU_NITOURYU] += 1;
1826                         p_ptr->update |= (PU_BONUS);
1827                 }
1828         }
1829
1830         /* Gain riding experience */
1831         if (p_ptr->riding)
1832         {
1833                 int cur = p_ptr->skill_exp[GINOU_RIDING];
1834                 int max = s_info[p_ptr->pclass].s_max[GINOU_RIDING];
1835
1836                 if (cur < max)
1837                 {
1838                         DEPTH ridinglevel = r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level;
1839                         DEPTH targetlevel = r_ptr->level;
1840                         int inc = 0;
1841
1842                         if ((cur / 200 - 5) < targetlevel)
1843                                 inc += 1;
1844
1845                         /* Extra experience */
1846                         if ((cur / 100) < ridinglevel)
1847                         {
1848                                 if ((cur / 100 + 15) < ridinglevel)
1849                                         inc += 1 + (ridinglevel - (cur / 100 + 15));
1850                                 else
1851                                         inc += 1;
1852                         }
1853
1854                         p_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
1855                         p_ptr->update |= (PU_BONUS);
1856                 }
1857         }
1858
1859         riding_t_m_idx = g_ptr->m_idx;
1860         if (p_ptr->migite) py_attack_aux(y, x, &fear, &mdeath, 0, mode);
1861         if (p_ptr->hidarite && !mdeath) py_attack_aux(y, x, &fear, &mdeath, 1, mode);
1862
1863         /* Mutations which yield extra 'natural' attacks */
1864         if (!mdeath)
1865         {
1866                 if ((p_ptr->muta2 & MUT2_HORNS) && !mdeath)
1867                         natural_attack(g_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
1868                 if ((p_ptr->muta2 & MUT2_BEAK) && !mdeath)
1869                         natural_attack(g_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
1870                 if ((p_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
1871                         natural_attack(g_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
1872                 if ((p_ptr->muta2 & MUT2_TRUNK) && !mdeath)
1873                         natural_attack(g_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
1874                 if ((p_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
1875                         natural_attack(g_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
1876         }
1877
1878         /* Hack -- delay fear messages */
1879         if (fear && m_ptr->ml && !mdeath)
1880         {
1881                 sound(SOUND_FLEE);
1882
1883                 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
1884         }
1885
1886         if ((p_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
1887         {
1888                 set_action(ACTION_NONE);
1889         }
1890
1891         return mdeath;
1892 }
1893
1894 /*!
1895  * @brief モンスターからプレイヤーへの打撃処理 / Attack the player via physical attacks.
1896  * @param m_idx 打撃を行うモンスターのID
1897  * @return 実際に攻撃処理を行った場合TRUEを返す
1898  */
1899 bool make_attack_normal(MONSTER_IDX m_idx)
1900 {
1901         monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
1902         monster_race *r_ptr = &r_info[m_ptr->r_idx];
1903
1904         int ap_cnt;
1905
1906         INVENTORY_IDX i;
1907         int k, tmp;
1908         ARMOUR_CLASS ac;
1909         DEPTH rlev;
1910         int do_cut, do_stun;
1911
1912         PRICE gold;
1913         object_type *o_ptr;
1914         GAME_TEXT o_name[MAX_NLEN];
1915         GAME_TEXT m_name[MAX_NLEN];
1916         GAME_TEXT ddesc[80];
1917
1918         bool blinked;
1919         bool touched = FALSE, fear = FALSE, alive = TRUE;
1920         bool explode = FALSE;
1921         bool do_silly_attack = (one_in_(2) && p_ptr->image);
1922         HIT_POINT get_damage = 0;
1923         int abbreviate = 0;     // 2回目以降の省略表現フラグ
1924
1925         /* Not allowed to attack */
1926         if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return (FALSE);
1927
1928         if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return (FALSE);
1929
1930         /* ...nor if friendly */
1931         if (!is_hostile(m_ptr)) return FALSE;
1932
1933         /* Extract the effective monster level */
1934         rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
1935
1936
1937         /* Get the monster name (or "it") */
1938         monster_desc(m_name, m_ptr, 0);
1939
1940         /* Get the "died from" information (i.e. "a kobold") */
1941         monster_desc(ddesc, m_ptr, MD_IGNORE_HALLU | MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE);
1942
1943         if (p_ptr->special_defense & KATA_IAI)
1944         {
1945                 msg_format(_("相手が襲いかかる前に素早く武器を振るった。", "You took sen, draw and cut in one motion before %s move."), m_name);
1946                 if (py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
1947         }
1948
1949         if ((p_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (p_ptr->lev*3/5+20)))
1950         {
1951                 if (kawarimi(TRUE)) return TRUE;
1952         }
1953
1954         /* Assume no blink */
1955         blinked = FALSE;
1956
1957         /* Scan through all four blows */
1958         for (ap_cnt = 0; ap_cnt < 4; ap_cnt++)
1959         {
1960                 bool obvious = FALSE;
1961
1962                 HIT_POINT power = 0;
1963                 HIT_POINT damage = 0;
1964
1965                 concptr act = NULL;
1966
1967                 /* Extract the attack infomation */
1968                 int effect = r_ptr->blow[ap_cnt].effect;
1969                 int method = r_ptr->blow[ap_cnt].method;
1970                 int d_dice = r_ptr->blow[ap_cnt].d_dice;
1971                 int d_side = r_ptr->blow[ap_cnt].d_side;
1972
1973                 if (!monster_is_valid(m_ptr)) break;
1974
1975                 /* Hack -- no more attacks */
1976                 if (!method) break;
1977
1978                 if (is_pet(m_ptr) && (r_ptr->flags1 & RF1_UNIQUE) && (method == RBM_EXPLODE))
1979                 {
1980                         method = RBM_HIT;
1981                         d_dice /= 10;
1982                 }
1983
1984                 /* Stop if player is dead or gone */
1985                 if (!p_ptr->playing || p_ptr->is_dead) break;
1986                 if (distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx) > 1) break;
1987
1988                 /* Handle "leaving" */
1989                 if (p_ptr->leaving) break;
1990
1991                 if (method == RBM_SHOOT) continue;
1992
1993                 /* Extract the attack "power" */
1994                 power = mbe_info[effect].power;
1995
1996                 /* Total armor */
1997                 ac = p_ptr->ac + p_ptr->to_a;
1998
1999                 /* Monster hits player */
2000                 if (!effect || check_hit(power, rlev, MON_STUNNED(m_ptr)))
2001                 {
2002                         /* Always disturbing */
2003                         disturb(TRUE, TRUE);
2004
2005
2006                         /* Hack -- Apply "protection from evil" */
2007                         if ((p_ptr->protevil > 0) &&
2008                             (r_ptr->flags3 & RF3_EVIL) &&
2009                             (p_ptr->lev >= rlev) &&
2010                             ((randint0(100) + p_ptr->lev) > 50))
2011                         {
2012                                 /* Remember the Evil-ness */
2013                                 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2014
2015 #ifdef JP
2016                                 if (abbreviate) msg_format("撃退した。");
2017                                 else msg_format("%^sは撃退された。", m_name);
2018                                 abbreviate = 1; /*2回目以降は省略 */
2019 #else
2020                                 msg_format("%^s is repelled.", m_name);
2021 #endif
2022
2023
2024                                 /* Hack -- Next attack */
2025                                 continue;
2026                         }
2027
2028
2029                         /* Assume no cut or stun */
2030                         do_cut = do_stun = 0;
2031
2032                         /* Describe the attack method */
2033                         switch (method)
2034                         {
2035                                 case RBM_HIT:
2036                                 {
2037                                         act = _("殴られた。", "hits you.");
2038                                         do_cut = do_stun = 1;
2039                                         touched = TRUE;
2040                                         sound(SOUND_HIT);
2041                                         break;
2042                                 }
2043
2044                                 case RBM_TOUCH:
2045                                 {
2046                                         act = _("触られた。", "touches you.");
2047                                         touched = TRUE;
2048                                         sound(SOUND_TOUCH);
2049                                         break;
2050                                 }
2051
2052                                 case RBM_PUNCH:
2053                                 {
2054                                         act = _("パンチされた。", "punches you.");
2055                                         touched = TRUE;
2056                                         do_stun = 1;
2057                                         sound(SOUND_HIT);
2058                                         break;
2059                                 }
2060
2061                                 case RBM_KICK:
2062                                 {
2063                                         act = _("蹴られた。", "kicks you.");
2064                                         touched = TRUE;
2065                                         do_stun = 1;
2066                                         sound(SOUND_HIT);
2067                                         break;
2068                                 }
2069
2070                                 case RBM_CLAW:
2071                                 {
2072                                         act = _("ひっかかれた。", "claws you.");
2073                                         touched = TRUE;
2074                                         do_cut = 1;
2075                                         sound(SOUND_CLAW);
2076                                         break;
2077                                 }
2078
2079                                 case RBM_BITE:
2080                                 {
2081                                         act = _("噛まれた。", "bites you.");
2082                                         do_cut = 1;
2083                                         touched = TRUE;
2084                                         sound(SOUND_BITE);
2085                                         break;
2086                                 }
2087
2088                                 case RBM_STING:
2089                                 {
2090                                         act = _("刺された。", "stings you.");
2091                                         touched = TRUE;
2092                                         sound(SOUND_STING);
2093                                         break;
2094                                 }
2095
2096                                 case RBM_SLASH:
2097                                 {
2098                                         act = _("斬られた。", "slashes you.");
2099                                         touched = TRUE;
2100                                         do_cut = 1;
2101                                         sound(SOUND_CLAW);
2102                                         break;
2103                                 }
2104
2105                                 case RBM_BUTT:
2106                                 {
2107                                         act = _("角で突かれた。", "butts you.");
2108                                         do_stun = 1;
2109                                         touched = TRUE;
2110                                         sound(SOUND_HIT);
2111                                         break;
2112                                 }
2113
2114                                 case RBM_CRUSH:
2115                                 {
2116                                         act = _("体当たりされた。", "crushes you.");
2117                                         do_stun = 1;
2118                                         touched = TRUE;
2119                                         sound(SOUND_CRUSH);
2120                                         break;
2121                                 }
2122
2123                                 case RBM_ENGULF:
2124                                 {
2125                                         act = _("飲み込まれた。", "engulfs you.");
2126                                         touched = TRUE;
2127                                         sound(SOUND_CRUSH);
2128                                         break;
2129                                 }
2130
2131                                 case RBM_CHARGE:
2132                                 {
2133                                         abbreviate = -1;
2134                                         act = _("は請求書をよこした。", "charges you.");
2135                                         touched = TRUE;
2136                                         sound(SOUND_BUY); /* Note! This is "charges", not "charges at". */
2137                                         break;
2138                                 }
2139
2140                                 case RBM_CRAWL:
2141                                 {
2142                                         abbreviate = -1;
2143                                         act = _("が体の上を這い回った。", "crawls on you.");
2144                                         touched = TRUE;
2145                                         sound(SOUND_SLIME);
2146                                         break;
2147                                 }
2148
2149                                 case RBM_DROOL:
2150                                 {
2151                                         act = _("よだれをたらされた。", "drools on you.");
2152                                         sound(SOUND_SLIME);
2153                                         break;
2154                                 }
2155
2156                                 case RBM_SPIT:
2157                                 {
2158                                         act = _("唾を吐かれた。", "spits on you.");
2159                                         sound(SOUND_SLIME);
2160                                         break;
2161                                 }
2162
2163                                 case RBM_EXPLODE:
2164                                 {
2165                                         abbreviate = -1;
2166                                         act = _("は爆発した。", "explodes.");
2167                                         explode = TRUE;
2168                                         break;
2169                                 }
2170
2171                                 case RBM_GAZE:
2172                                 {
2173                                         act = _("にらまれた。", "gazes at you.");
2174                                         break;
2175                                 }
2176
2177                                 case RBM_WAIL:
2178                                 {
2179                                         act = _("泣き叫ばれた。", "wails at you.");
2180                                         sound(SOUND_WAIL);
2181                                         break;
2182                                 }
2183
2184                                 case RBM_SPORE:
2185                                 {
2186                                         act = _("胞子を飛ばされた。", "releases spores at you.");
2187                                         sound(SOUND_SLIME);
2188                                         break;
2189                                 }
2190
2191                                 case RBM_XXX4:
2192                                 {
2193                                         abbreviate = -1;
2194                                         act = _("が XXX4 を発射した。", "projects XXX4's at you.");
2195                                         break;
2196                                 }
2197
2198                                 case RBM_BEG:
2199                                 {
2200                                         act = _("金をせがまれた。", "begs you for money.");
2201                                         sound(SOUND_MOAN);
2202                                         break;
2203                                 }
2204
2205                                 case RBM_INSULT:
2206                                 {
2207 #ifdef JP
2208                                         abbreviate = -1;
2209 #endif
2210                                         act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
2211                                         sound(SOUND_MOAN);
2212                                         break;
2213                                 }
2214
2215                                 case RBM_MOAN:
2216                                 {
2217 #ifdef JP
2218                                         abbreviate = -1;
2219 #endif
2220                                         act = desc_moan[randint0(4)];
2221                                         sound(SOUND_MOAN);
2222                                         break;
2223                                 }
2224
2225                                 case RBM_SHOW:
2226                                 {
2227 #ifdef JP
2228                                         abbreviate = -1;
2229 #endif
2230                                         if (m_ptr->r_idx == MON_JAIAN)
2231                                         {
2232 #ifdef JP
2233                                                 switch(randint1(15))
2234                                                 {
2235                                                   case 1:
2236                                                   case 6:
2237                                                   case 11:
2238                                                         act = "「♪お~れはジャイアン~~ガ~キだいしょう~」";
2239                                                         break;
2240                                                   case 2:
2241                                                         act = "「♪て~んかむ~てきのお~とこだぜ~~」";
2242                                                         break;
2243                                                   case 3:
2244                                                         act = "「♪の~び太スネ夫はメじゃないよ~~」";
2245                                                         break;
2246                                                   case 4:
2247                                                         act = "「♪け~んかスポ~ツ~どんとこい~」";
2248                                                         break;
2249                                                   case 5:
2250                                                         act = "「♪うた~も~~う~まいぜ~まかしとけ~」";
2251                                                         break;
2252                                                   case 7:
2253                                                         act = "「♪ま~ちいちば~んのに~んきもの~~」";
2254                                                         break;
2255                                                   case 8:
2256                                                         act = "「♪べんきょうしゅくだいメじゃないよ~~」";
2257                                                         break;
2258                                                   case 9:
2259                                                         act = "「♪きはやさし~くて~ち~からもち~」";
2260                                                         break;
2261                                                   case 10:
2262                                                         act = "「♪かお~も~~スタイルも~バツグンさ~」";
2263                                                         break;
2264                                                   case 12:
2265                                                         act = "「♪がっこうい~ちの~あ~ばれんぼう~~」";
2266                                                         break;
2267                                                   case 13:
2268                                                         act = "「♪ド~ラもドラミもメじゃないよ~~」";
2269                                                         break;
2270                                                   case 14:
2271                                                         act = "「♪よじげんぽけっと~な~くたって~」";
2272                                                         break;
2273                                                   case 15:
2274                                                         act = "「♪あし~の~~ながさ~は~まけないぜ~」";
2275                                                         break;
2276                                                 }
2277 #else
2278                                                 act = "horribly sings 'I AM GIAAAAAN. THE BOOOSS OF THE KIIIIDS.'";
2279 #endif
2280                                         }
2281                                         else
2282                                         {
2283                                                 if (one_in_(3))
2284                                                         act = _("は♪僕らは楽しい家族♪と歌っている。", "sings 'We are a happy family.'");
2285                                                 else
2286                                                         act = _("は♪アイ ラブ ユー、ユー ラブ ミー♪と歌っている。", "sings 'I love you, you love me.'");
2287                                         }
2288
2289                                         sound(SOUND_SHOW);
2290                                         break;
2291                                 }
2292                         }
2293
2294                         if (act)
2295                         {
2296                                 if (do_silly_attack)
2297                                 {
2298 #ifdef JP
2299                                         abbreviate = -1;
2300 #endif
2301                                         act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
2302                                 }
2303 #ifdef JP
2304                                 if (abbreviate == 0)
2305                                         msg_format("%^sに%s", m_name, act);
2306                                 else if (abbreviate == 1)
2307                                         msg_format("%s", act);
2308                                 else /* if (abbreviate == -1) */
2309                                         msg_format("%^s%s", m_name, act);
2310                                 abbreviate = 1;/*2回目以降は省略 */
2311 #else
2312                                 msg_format("%^s %s%s", m_name, act, do_silly_attack ? " you." : "");
2313 #endif
2314                         }
2315
2316                         /* Hack -- assume all attacks are obvious */
2317                         obvious = TRUE;
2318
2319                         /* Roll out the damage */
2320                         damage = damroll(d_dice, d_side);
2321
2322                         /*
2323                          * Skip the effect when exploding, since the explosion
2324                          * already causes the effect.
2325                          */
2326                         if(explode) damage = 0;
2327                         /* Apply appropriate damage */
2328                         switch (effect)
2329                         {
2330                                 case 0:
2331                                 {
2332                                         obvious = TRUE;
2333                                         damage = 0;
2334                                         break;
2335                                 }
2336
2337                                 case RBE_SUPERHURT:     /* AC軽減あり / Player armor reduces total damage */
2338                                 {
2339                                         if (((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) && !CHECK_MULTISHADOW())
2340                                         {
2341                                                 int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
2342                                                 msg_print(_("痛恨の一撃!", "It was a critical hit!"));
2343                                                 tmp_damage = MAX(damage, tmp_damage*2);
2344
2345                                                 get_damage += take_hit(DAMAGE_ATTACK, tmp_damage, ddesc, -1);
2346                                                 break;
2347                                         }
2348                                 }
2349                                 case RBE_HURT: /* AC軽減あり / Player armor reduces total damage */
2350                                 {
2351                                         obvious = TRUE;
2352                                         damage -= (damage * ((ac < 150) ? ac : 150) / 250);
2353                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2354                                         break;
2355                                 }
2356
2357                                 case RBE_POISON:
2358                                 {
2359                                         if (explode) break;
2360
2361                                         /* Take "poison" effect */
2362                                         if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()) && !CHECK_MULTISHADOW())
2363                                         {
2364                                                 if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
2365                                                 {
2366                                                         obvious = TRUE;
2367                                                 }
2368                                         }
2369
2370                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2371
2372                                         /* Learn about the player */
2373                                         update_smart_learn(m_idx, DRS_POIS);
2374
2375                                         break;
2376                                 }
2377
2378                                 case RBE_UN_BONUS:
2379                                 {
2380                                         if (explode) break;
2381
2382                                         /* Allow complete resist */
2383                                         if (!p_ptr->resist_disen && !CHECK_MULTISHADOW())
2384                                         {
2385                                                 /* Apply disenchantment */
2386                                                 if (apply_disenchant(0))
2387                                                 {
2388                                                         /* Hack -- Update AC */
2389                                                         update_creature(p_ptr);
2390                                                         obvious = TRUE;
2391                                                 }
2392                                         }
2393
2394                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2395
2396                                         /* Learn about the player */
2397                                         update_smart_learn(m_idx, DRS_DISEN);
2398
2399                                         break;
2400                                 }
2401
2402                                 case RBE_UN_POWER:
2403                                 {
2404                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2405
2406                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2407
2408                                         /* Find an item */
2409                                         for (k = 0; k < 10; k++)
2410                                         {
2411                                                 /* Pick an item */
2412                                                 i = (INVENTORY_IDX)randint0(INVEN_PACK);
2413
2414                                                 /* Obtain the item */
2415                                                 o_ptr = &inventory[i];
2416
2417                                                 /* Skip non-objects */
2418                                                 if (!o_ptr->k_idx) continue;
2419
2420                                                 /* Drain charged wands/staffs */
2421                                                 if (((o_ptr->tval == TV_STAFF) ||
2422                                                      (o_ptr->tval == TV_WAND)) &&
2423                                                     (o_ptr->pval))
2424                                                 {
2425                                                         /* Calculate healed hitpoints */
2426                                                         int heal=rlev * o_ptr->pval;
2427                                                         if( o_ptr->tval == TV_STAFF)
2428                                                             heal *=  o_ptr->number;
2429
2430                                                         /* Don't heal more than max hp */
2431                                                         heal = MIN(heal, m_ptr->maxhp - m_ptr->hp);
2432
2433                                                         msg_print(_("ザックからエネルギーが吸い取られた!", "Energy drains from your pack!"));
2434
2435                                                         obvious = TRUE;
2436
2437                                                         /* Heal the monster */
2438                                                         m_ptr->hp += (HIT_POINT)heal;
2439
2440                                                         /* Redraw (later) if needed */
2441                                                         if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
2442                                                         if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
2443
2444                                                         /* Uncharge */
2445                                                         o_ptr->pval = 0;
2446
2447                                                         /* Combine / Reorder the pack */
2448                                                         p_ptr->update |= (PU_COMBINE | PU_REORDER);
2449                                                         p_ptr->window |= (PW_INVEN);
2450
2451                                                         break;
2452                                                 }
2453                                         }
2454
2455                                         break;
2456                                 }
2457
2458                                 case RBE_EAT_GOLD:
2459                                 {
2460                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2461
2462                                         /* Confused monsters cannot steal successfully. -LM-*/
2463                                         if (MON_CONFUSED(m_ptr)) break;
2464
2465                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2466
2467                                         obvious = TRUE;
2468
2469                                         /* Saving throw (unless paralyzed) based on dex and level */
2470                                         if (!p_ptr->paralyzed &&
2471                                             (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
2472                                                               p_ptr->lev)))
2473                                         {
2474                                                 /* Saving throw message */
2475                                                 msg_print(_("しかし素早く財布を守った!", "You quickly protect your money pouch!"));
2476
2477                                                 /* Occasional blink anyway */
2478                                                 if (randint0(3)) blinked = TRUE;
2479                                         }
2480
2481                                         /* Eat gold */
2482                                         else
2483                                         {
2484                                                 gold = (p_ptr->au / 10) + randint1(25);
2485                                                 if (gold < 2) gold = 2;
2486                                                 if (gold > 5000) gold = (p_ptr->au / 20) + randint1(3000);
2487                                                 if (gold > p_ptr->au) gold = p_ptr->au;
2488                                                 p_ptr->au -= gold;
2489                                                 if (gold <= 0)
2490                                                 {
2491                                                         msg_print(_("しかし何も盗まれなかった。", "Nothing was stolen."));
2492                                                 }
2493                                                 else if (p_ptr->au)
2494                                                 {
2495                                                         msg_print(_("財布が軽くなった気がする。", "Your purse feels lighter."));
2496                                                         msg_format(_("$%ld のお金が盗まれた!", "%ld coins were stolen!"), (long)gold);
2497                                                         chg_virtue(V_SACRIFICE, 1);
2498                                                 }
2499                                                 else
2500                                                 {
2501                                                         msg_print(_("財布が軽くなった気がする。", "Your purse feels lighter."));
2502                                                         msg_print(_("お金が全部盗まれた!", "All of your coins were stolen!"));
2503                                                         chg_virtue(V_SACRIFICE, 2);
2504                                                 }
2505
2506                                                 /* Redraw gold */
2507                                                 p_ptr->redraw |= (PR_GOLD);
2508
2509                                                 p_ptr->window |= (PW_PLAYER);
2510
2511                                                 /* Blink away */
2512                                                 blinked = TRUE;
2513                                         }
2514
2515                                         break;
2516                                 }
2517
2518                                 case RBE_EAT_ITEM:
2519                                 {
2520                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2521
2522                                         /* Confused monsters cannot steal successfully. -LM-*/
2523                                         if (MON_CONFUSED(m_ptr)) break;
2524
2525                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2526
2527                                         /* Saving throw (unless paralyzed) based on dex and level */
2528                                         if (!p_ptr->paralyzed &&
2529                                             (randint0(100) < (adj_dex_safe[p_ptr->stat_ind[A_DEX]] +
2530                                                               p_ptr->lev)))
2531                                         {
2532                                                 /* Saving throw message */
2533                                                 msg_print(_("しかしあわててザックを取り返した!", "You grab hold of your backpack!"));
2534
2535                                                 /* Occasional "blink" anyway */
2536                                                 blinked = TRUE;
2537                                                 obvious = TRUE;
2538                                                 break;
2539                                         }
2540
2541                                         /* Find an item */
2542                                         for (k = 0; k < 10; k++)
2543                                         {
2544                                                 OBJECT_IDX o_idx;
2545
2546                                                 /* Pick an item */
2547                                                 i = (INVENTORY_IDX)randint0(INVEN_PACK);
2548
2549                                                 /* Obtain the item */
2550                                                 o_ptr = &inventory[i];
2551
2552                                                 /* Skip non-objects */
2553                                                 if (!o_ptr->k_idx) continue;
2554
2555                                                 /* Skip artifacts */
2556                                                 if (object_is_artifact(o_ptr)) continue;
2557
2558                                                 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
2559
2560 #ifdef JP
2561                                                 msg_format("%s(%c)を%s盗まれた!", o_name, index_to_label(i), ((o_ptr->number > 1) ? "一つ" : ""));
2562 #else
2563                                                 msg_format("%sour %s (%c) was stolen!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
2564 #endif
2565
2566                                                 chg_virtue(V_SACRIFICE, 1);
2567
2568
2569                                                 /* Make an object */
2570                                                 o_idx = o_pop();
2571
2572                                                 /* Success */
2573                                                 if (o_idx)
2574                                                 {
2575                                                         object_type *j_ptr;
2576                                                         j_ptr = &current_floor_ptr->o_list[o_idx];
2577                                                         object_copy(j_ptr, o_ptr);
2578
2579                                                         /* Modify number */
2580                                                         j_ptr->number = 1;
2581
2582                                                         /* Hack -- If a rod or wand, allocate total
2583                                                          * maximum timeouts or charges between those
2584                                                          * stolen and those missed. -LM-
2585                                                          */
2586                                                         if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
2587                                                         {
2588                                                                 j_ptr->pval = o_ptr->pval / o_ptr->number;
2589                                                                 o_ptr->pval -= j_ptr->pval;
2590                                                         }
2591
2592                                                         /* Forget mark */
2593                                                         j_ptr->marked = OM_TOUCHED;
2594
2595                                                         /* Memorize monster */
2596                                                         j_ptr->held_m_idx = m_idx;
2597
2598                                                         /* Build stack */
2599                                                         j_ptr->next_o_idx = m_ptr->hold_o_idx;
2600
2601                                                         /* Build stack */
2602                                                         m_ptr->hold_o_idx = o_idx;
2603                                                 }
2604
2605                                                 /* Steal the items */
2606                                                 inven_item_increase(i, -1);
2607                                                 inven_item_optimize(i);
2608
2609                                                 obvious = TRUE;
2610
2611                                                 /* Blink away */
2612                                                 blinked = TRUE;
2613
2614                                                 break;
2615                                         }
2616
2617                                         break;
2618                                 }
2619
2620                                 case RBE_EAT_FOOD:
2621                                 {
2622                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2623
2624                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2625
2626                                         /* Steal some food */
2627                                         for (k = 0; k < 10; k++)
2628                                         {
2629                                                 /* Pick an item from the pack */
2630                                                 i = (INVENTORY_IDX)randint0(INVEN_PACK);
2631
2632                                                 o_ptr = &inventory[i];
2633
2634                                                 /* Skip non-objects */
2635                                                 if (!o_ptr->k_idx) continue;
2636
2637                                                 /* Skip non-food objects */
2638                                                 if ((o_ptr->tval != TV_FOOD) && !((o_ptr->tval == TV_CORPSE) && (o_ptr->sval))) continue;
2639
2640                                                 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
2641
2642 #ifdef JP
2643                                                 msg_format("%s(%c)を%s食べられてしまった!", o_name, index_to_label(i), ((o_ptr->number > 1) ? "一つ" : ""));
2644 #else
2645                                                 msg_format("%sour %s (%c) was eaten!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
2646 #endif
2647
2648                                                 /* Steal the items */
2649                                                 inven_item_increase(i, -1);
2650                                                 inven_item_optimize(i);
2651
2652                                                 obvious = TRUE;
2653
2654                                                 break;
2655                                         }
2656
2657                                         break;
2658                                 }
2659
2660                                 case RBE_EAT_LITE:
2661                                 {
2662                                         /* Access the lite */
2663                                         o_ptr = &inventory[INVEN_LITE];
2664                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2665
2666                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2667
2668                                         /* Drain fuel */
2669                                         if ((o_ptr->xtra4 > 0) && (!object_is_fixed_artifact(o_ptr)))
2670                                         {
2671                                                 /* Reduce fuel */
2672                                                 o_ptr->xtra4 -= (s16b)(250 + randint1(250));
2673                                                 if (o_ptr->xtra4 < 1) o_ptr->xtra4 = 1;
2674
2675                                                 if (!p_ptr->blind)
2676                                                 {
2677                                                         msg_print(_("明かりが暗くなってしまった。", "Your light dims."));
2678                                                         obvious = TRUE;
2679                                                 }
2680
2681                                                 p_ptr->window |= (PW_EQUIP);
2682                                         }
2683
2684                                         break;
2685                                 }
2686
2687                                 case RBE_ACID:
2688                                 {
2689                                         if (explode) break;
2690                                         obvious = TRUE;
2691                                         msg_print(_("酸を浴びせられた!", "You are covered in acid!"));
2692                                         get_damage += acid_dam(damage, ddesc, -1, FALSE);
2693                                         update_creature(p_ptr);
2694                                         update_smart_learn(m_idx, DRS_ACID);
2695                                         break;
2696                                 }
2697
2698                                 case RBE_ELEC:
2699                                 {
2700                                         if (explode) break;
2701                                         obvious = TRUE;
2702                                         msg_print(_("電撃を浴びせられた!", "You are struck by electricity!"));
2703                                         get_damage += elec_dam(damage, ddesc, -1, FALSE);
2704                                         update_smart_learn(m_idx, DRS_ELEC);
2705                                         break;
2706                                 }
2707
2708                                 case RBE_FIRE:
2709                                 {
2710                                         if (explode) break;
2711                                         obvious = TRUE;
2712                                         msg_print(_("全身が炎に包まれた!", "You are enveloped in flames!"));
2713                                         get_damage += fire_dam(damage, ddesc, -1, FALSE);
2714                                         update_smart_learn(m_idx, DRS_FIRE);
2715                                         break;
2716                                 }
2717
2718                                 case RBE_COLD:
2719                                 {
2720                                         if (explode) break;
2721                                         obvious = TRUE;
2722                                         msg_print(_("全身が冷気で覆われた!", "You are covered with frost!"));
2723                                         get_damage += cold_dam(damage, ddesc, -1, FALSE);
2724                                         update_smart_learn(m_idx, DRS_COLD);
2725                                         break;
2726                                 }
2727
2728                                 case RBE_BLIND:
2729                                 {
2730                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2731                                         if (p_ptr->is_dead) break;
2732
2733                                         /* Increase "blind" */
2734                                         if (!p_ptr->resist_blind && !CHECK_MULTISHADOW())
2735                                         {
2736                                                 if (set_blind(p_ptr->blind + 10 + randint1(rlev)))
2737                                                 {
2738 #ifdef JP
2739                                                         if (m_ptr->r_idx == MON_DIO) msg_print("どうだッ!この血の目潰しはッ!");
2740 #else
2741                                                         /* nanka */
2742 #endif
2743                                                         obvious = TRUE;
2744                                                 }
2745                                         }
2746
2747                                         /* Learn about the player */
2748                                         update_smart_learn(m_idx, DRS_BLIND);
2749
2750                                         break;
2751                                 }
2752
2753                                 case RBE_CONFUSE:
2754                                 {
2755                                         if (explode) break;
2756                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2757
2758                                         if (p_ptr->is_dead) break;
2759
2760                                         /* Increase "confused" */
2761                                         if (!p_ptr->resist_conf && !CHECK_MULTISHADOW())
2762                                         {
2763                                                 if (set_confused(p_ptr->confused + 3 + randint1(rlev)))
2764                                                 {
2765                                                         obvious = TRUE;
2766                                                 }
2767                                         }
2768
2769                                         /* Learn about the player */
2770                                         update_smart_learn(m_idx, DRS_CONF);
2771
2772                                         break;
2773                                 }
2774
2775                                 case RBE_TERRIFY:
2776                                 {
2777                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2778
2779                                         if (p_ptr->is_dead) break;
2780
2781                                         /* Increase "afraid" */
2782                                         if (CHECK_MULTISHADOW())
2783                                         {
2784                                                 /* Do nothing */
2785                                         }
2786                                         else if (p_ptr->resist_fear)
2787                                         {
2788                                                 msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
2789                                                 obvious = TRUE;
2790                                         }
2791                                         else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2792                                         {
2793                                                 msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
2794                                                 obvious = TRUE;
2795                                         }
2796                                         else
2797                                         {
2798                                                 if (set_afraid(p_ptr->afraid + 3 + randint1(rlev)))
2799                                                 {
2800                                                         obvious = TRUE;
2801                                                 }
2802                                         }
2803
2804                                         /* Learn about the player */
2805                                         update_smart_learn(m_idx, DRS_FEAR);
2806
2807                                         break;
2808                                 }
2809
2810                                 case RBE_PARALYZE:
2811                                 {
2812                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2813
2814                                         if (p_ptr->is_dead) break;
2815
2816                                         /* Increase "paralyzed" */
2817                                         if (CHECK_MULTISHADOW())
2818                                         {
2819                                                 /* Do nothing */
2820                                         }
2821                                         else if (p_ptr->free_act)
2822                                         {
2823                                                 msg_print(_("しかし効果がなかった!", "You are unaffected!"));
2824                                                 obvious = TRUE;
2825                                         }
2826                                         else if (randint0(100 + r_ptr->level/2) < p_ptr->skill_sav)
2827                                         {
2828                                                 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
2829                                                 obvious = TRUE;
2830                                         }
2831                                         else
2832                                         {
2833                                                 if (!p_ptr->paralyzed)
2834                                                 {
2835                                                         if (set_paralyzed(3 + randint1(rlev)))
2836                                                         {
2837                                                                 obvious = TRUE;
2838                                                         }
2839                                                 }
2840                                         }
2841
2842                                         /* Learn about the player */
2843                                         update_smart_learn(m_idx, DRS_FREE);
2844
2845                                         break;
2846                                 }
2847
2848                                 case RBE_LOSE_STR:
2849                                 {
2850                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2851
2852                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2853                                         if (do_dec_stat(A_STR)) obvious = TRUE;
2854
2855                                         break;
2856                                 }
2857
2858                                 case RBE_LOSE_INT:
2859                                 {
2860                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2861
2862                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2863                                         if (do_dec_stat(A_INT)) obvious = TRUE;
2864
2865                                         break;
2866                                 }
2867
2868                                 case RBE_LOSE_WIS:
2869                                 {
2870                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2871
2872                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2873                                         if (do_dec_stat(A_WIS)) obvious = TRUE;
2874
2875                                         break;
2876                                 }
2877
2878                                 case RBE_LOSE_DEX:
2879                                 {
2880                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2881
2882                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2883                                         if (do_dec_stat(A_DEX)) obvious = TRUE;
2884
2885                                         break;
2886                                 }
2887
2888                                 case RBE_LOSE_CON:
2889                                 {
2890                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2891
2892                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2893                                         if (do_dec_stat(A_CON)) obvious = TRUE;
2894
2895                                         break;
2896                                 }
2897
2898                                 case RBE_LOSE_CHR:
2899                                 {
2900                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2901
2902                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2903                                         if (do_dec_stat(A_CHR)) obvious = TRUE;
2904
2905                                         break;
2906                                 }
2907
2908                                 case RBE_LOSE_ALL:
2909                                 {
2910                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2911
2912                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2913
2914                                         /* Damage (stats) */
2915                                         if (do_dec_stat(A_STR)) obvious = TRUE;
2916                                         if (do_dec_stat(A_DEX)) obvious = TRUE;
2917                                         if (do_dec_stat(A_CON)) obvious = TRUE;
2918                                         if (do_dec_stat(A_INT)) obvious = TRUE;
2919                                         if (do_dec_stat(A_WIS)) obvious = TRUE;
2920                                         if (do_dec_stat(A_CHR)) obvious = TRUE;
2921
2922                                         break;
2923                                 }
2924
2925                                 case RBE_SHATTER:
2926                                 {
2927                                         obvious = TRUE;
2928
2929                                         /* Hack -- Reduce damage based on the player armor class */
2930                                         damage -= (damage * ((ac < 150) ? ac : 150) / 250);
2931
2932                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2933
2934                                         /* Radius 8 earthquake centered at the monster */
2935                                         if (damage > 23 || explode)
2936                                         {
2937                                                 earthquake_aux(m_ptr->fy, m_ptr->fx, 8, m_idx);
2938                                         }
2939
2940                                         break;
2941                                 }
2942
2943                                 case RBE_EXP_10:
2944                                 {
2945                                         s32b d = damroll(10, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
2946
2947                                         obvious = TRUE;
2948
2949                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2950
2951                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2952
2953                                         (void)drain_exp(d, d / 10, 95);
2954                                         break;
2955                                 }
2956
2957                                 case RBE_EXP_20:
2958                                 {
2959                                         s32b d = damroll(20, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
2960
2961                                         obvious = TRUE;
2962
2963                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2964
2965                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2966
2967                                         (void)drain_exp(d, d / 10, 90);
2968                                         break;
2969                                 }
2970
2971                                 case RBE_EXP_40:
2972                                 {
2973                                         s32b d = damroll(40, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
2974
2975                                         obvious = TRUE;
2976
2977                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2978
2979                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2980
2981                                         (void)drain_exp(d, d / 10, 75);
2982                                         break;
2983                                 }
2984
2985                                 case RBE_EXP_80:
2986                                 {
2987                                         s32b d = damroll(80, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
2988
2989                                         obvious = TRUE;
2990
2991                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
2992
2993                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
2994
2995                                         (void)drain_exp(d, d / 10, 50);
2996                                         break;
2997                                 }
2998
2999                                 case RBE_DISEASE:
3000                                 {
3001                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
3002
3003                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3004
3005                                         /* Take "poison" effect */
3006                                         if (!(p_ptr->resist_pois || IS_OPPOSE_POIS()))
3007                                         {
3008                                                 if (set_poisoned(p_ptr->poisoned + randint1(rlev) + 5))
3009                                                 {
3010                                                         obvious = TRUE;
3011                                                 }
3012                                         }
3013
3014                                         /* Damage CON (10% chance)*/
3015                                         if ((randint1(100) < 11) && (p_ptr->prace != RACE_ANDROID))
3016                                         {
3017                                                 /* 1% chance for perm. damage */
3018                                                 bool perm = one_in_(10);
3019                                                 if (dec_stat(A_CON, randint1(10), perm))
3020                                                 {
3021                                                         msg_print(_("病があなたを蝕んでいる気がする。", "You feel strange sickness."));
3022                                                         obvious = TRUE;
3023                                                 }
3024                                         }
3025
3026                                         break;
3027                                 }
3028                                 case RBE_TIME:
3029                                 {
3030                                         if (explode) break;
3031                                         if (!p_ptr->resist_time && !CHECK_MULTISHADOW())
3032                                         {
3033                                                 switch (randint1(10))
3034                                                 {
3035                                                         case 1: case 2: case 3: case 4: case 5:
3036                                                         {
3037                                                                 if (p_ptr->prace == RACE_ANDROID) break;
3038                                                                 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
3039                                                                 lose_exp(100 + (p_ptr->exp / 100) * MON_DRAIN_LIFE);
3040                                                                 break;
3041                                                         }
3042
3043                                                         case 6: case 7: case 8: case 9:
3044                                                         {
3045                                                                 int stat = randint0(6);
3046
3047                                                                 switch (stat)
3048                                                                 {
3049 #ifdef JP
3050                                                                         case A_STR: act = "強く"; break;
3051                                                                         case A_INT: act = "聡明で"; break;
3052                                                                         case A_WIS: act = "賢明で"; break;
3053                                                                         case A_DEX: act = "器用で"; break;
3054                                                                         case A_CON: act = "健康で"; break;
3055                                                                         case A_CHR: act = "美しく"; break;
3056 #else
3057                                                                         case A_STR: act = "strong"; break;
3058                                                                         case A_INT: act = "bright"; break;
3059                                                                         case A_WIS: act = "wise"; break;
3060                                                                         case A_DEX: act = "agile"; break;
3061                                                                         case A_CON: act = "hale"; break;
3062                                                                         case A_CHR: act = "beautiful"; break;
3063 #endif
3064
3065                                                                 }
3066
3067                                                                 msg_format(_("あなたは以前ほど%sなくなってしまった...。", "You're not as %s as you used to be..."), act);
3068                                                                 p_ptr->stat_cur[stat] = (p_ptr->stat_cur[stat] * 3) / 4;
3069                                                                 if (p_ptr->stat_cur[stat] < 3) p_ptr->stat_cur[stat] = 3;
3070                                                                 p_ptr->update |= (PU_BONUS);
3071                                                                 break;
3072                                                         }
3073
3074                                                         case 10:
3075                                                         {
3076                                                                 msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
3077
3078                                                                 for (k = 0; k < A_MAX; k++)
3079                                                                 {
3080                                                                         p_ptr->stat_cur[k] = (p_ptr->stat_cur[k] * 7) / 8;
3081                                                                         if (p_ptr->stat_cur[k] < 3) p_ptr->stat_cur[k] = 3;
3082                                                                 }
3083                                                                 p_ptr->update |= (PU_BONUS);
3084                                                                 break;
3085                                                         }
3086                                                 }
3087                                         }
3088                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
3089
3090                                         break;
3091                                 }
3092                                 case RBE_DR_LIFE:
3093                                 {
3094                                         s32b d = damroll(60, 6) + (p_ptr->exp / 100) * MON_DRAIN_LIFE;
3095                                         bool resist_drain;
3096
3097                                         obvious = TRUE;
3098
3099                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
3100
3101                                         if (p_ptr->is_dead || CHECK_MULTISHADOW()) break;
3102
3103                                         resist_drain = !drain_exp(d, d / 10, 50);
3104
3105                                         /* Heal the attacker? */
3106                                         if (p_ptr->mimic_form)
3107                                         {
3108                                                 if (mimic_info[p_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)
3109                                                         resist_drain = TRUE;
3110                                         }
3111                                         else
3112                                         {
3113                                                 switch (p_ptr->prace)
3114                                                 {
3115                                                 case RACE_ZOMBIE:
3116                                                 case RACE_VAMPIRE:
3117                                                 case RACE_SPECTRE:
3118                                                 case RACE_SKELETON:
3119                                                 case RACE_DEMON:
3120                                                 case RACE_GOLEM:
3121                                                 case RACE_ANDROID:
3122                                                         resist_drain = TRUE;
3123                                                         break;
3124                                                 }
3125                                         }
3126
3127                                         if ((damage > 5) && !resist_drain)
3128                                         {
3129                                                 bool did_heal = FALSE;
3130
3131                                                 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
3132
3133                                                 /* Heal */
3134                                                 m_ptr->hp += damroll(4, damage / 6);
3135                                                 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3136
3137                                                 /* Redraw (later) if needed */
3138                                                 if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
3139                                                 if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
3140
3141                                                 /* Special message */
3142                                                 if (m_ptr->ml && did_heal)
3143                                                 {
3144                                                         msg_format(_("%sは体力を回復したようだ。", "%^s appears healthier."), m_name);
3145                                                 }
3146                                         }
3147
3148                                         break;
3149                                 }
3150                                 case RBE_DR_MANA:
3151                                 {
3152                                         obvious = TRUE;
3153
3154                                         if (CHECK_MULTISHADOW())
3155                                         {
3156                                                 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
3157                                         }
3158                                         else
3159                                         {
3160                                                 do_cut = 0;
3161
3162                                                 p_ptr->csp -= damage;
3163                                                 if (p_ptr->csp < 0)
3164                                                 {
3165                                                         p_ptr->csp = 0;
3166                                                         p_ptr->csp_frac = 0;
3167                                                 }
3168
3169                                                 p_ptr->redraw |= (PR_MANA);
3170                                         }
3171
3172                                         /* Learn about the player */
3173                                         update_smart_learn(m_idx, DRS_MANA);
3174
3175                                         break;
3176                                 }
3177                                 case RBE_INERTIA:
3178                                 {
3179                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
3180
3181                                         if (p_ptr->is_dead) break;
3182
3183                                         /* Decrease speed */
3184                                         if (CHECK_MULTISHADOW())
3185                                         {
3186                                                 /* Do nothing */
3187                                         }
3188                                         else
3189                                         {
3190                                                 if (set_slow((p_ptr->slow + 4 + randint0(rlev / 10)), FALSE))
3191                                                 {
3192                                                         obvious = TRUE;
3193                                                 }
3194                                         }
3195
3196                                         break;
3197                                 }
3198                                 case RBE_STUN:
3199                                 {
3200                                         get_damage += take_hit(DAMAGE_ATTACK, damage, ddesc, -1);
3201
3202                                         if (p_ptr->is_dead) break;
3203
3204                                         /* Decrease speed */
3205                                         if (p_ptr->resist_sound || CHECK_MULTISHADOW())
3206                                         {
3207                                                 /* Do nothing */
3208                                         }
3209                                         else
3210                                         {
3211                                                 if (set_stun(p_ptr->stun + 10 + randint1(r_ptr->level / 4)))
3212                                                 {
3213                                                         obvious = TRUE;
3214                                                 }
3215                                         }
3216
3217                                         break;
3218                                 }
3219                         }
3220
3221                         /* Hack -- only one of cut or stun */
3222                         if (do_cut && do_stun)
3223                         {
3224                                 /* Cancel cut */
3225                                 if (randint0(100) < 50)
3226                                 {
3227                                         do_cut = 0;
3228                                 }
3229
3230                                 /* Cancel stun */
3231                                 else
3232                                 {
3233                                         do_stun = 0;
3234                                 }
3235                         }
3236
3237                         /* Handle cut */
3238                         if (do_cut)
3239                         {
3240                                 int cut_plus = 0;
3241
3242                                 /* Critical hit (zero if non-critical) */
3243                                 tmp = monster_critical(d_dice, d_side, damage);
3244
3245                                 /* Roll for damage */
3246                                 switch (tmp)
3247                                 {
3248                                         case 0: cut_plus = 0; break;
3249                                         case 1: cut_plus = randint1(5); break;
3250                                         case 2: cut_plus = randint1(5) + 5; break;
3251                                         case 3: cut_plus = randint1(20) + 20; break;
3252                                         case 4: cut_plus = randint1(50) + 50; break;
3253                                         case 5: cut_plus = randint1(100) + 100; break;
3254                                         case 6: cut_plus = 300; break;
3255                                         default: cut_plus = 500; break;
3256                                 }
3257
3258                                 /* Apply the cut */
3259                                 if (cut_plus) (void)set_cut(p_ptr->cut + cut_plus);
3260                         }
3261
3262                         /* Handle stun */
3263                         if (do_stun)
3264                         {
3265                                 int stun_plus = 0;
3266
3267                                 /* Critical hit (zero if non-critical) */
3268                                 tmp = monster_critical(d_dice, d_side, damage);
3269
3270                                 /* Roll for damage */
3271                                 switch (tmp)
3272                                 {
3273                                         case 0: stun_plus = 0; break;
3274                                         case 1: stun_plus = randint1(5); break;
3275                                         case 2: stun_plus = randint1(5) + 10; break;
3276                                         case 3: stun_plus = randint1(10) + 20; break;
3277                                         case 4: stun_plus = randint1(15) + 30; break;
3278                                         case 5: stun_plus = randint1(20) + 40; break;
3279                                         case 6: stun_plus = 80; break;
3280                                         default: stun_plus = 150; break;
3281                                 }
3282
3283                                 /* Apply the stun */
3284                                 if (stun_plus) (void)set_stun(p_ptr->stun + stun_plus);
3285                         }
3286
3287                         if (explode)
3288                         {
3289                                 sound(SOUND_EXPLODE);
3290
3291                                 if (mon_take_hit(m_idx, m_ptr->hp + 1, &fear, NULL))
3292                                 {
3293                                         blinked = FALSE;
3294                                         alive = FALSE;
3295                                 }
3296                         }
3297
3298                         if (touched)
3299                         {
3300                                 if (p_ptr->sh_fire && alive && !p_ptr->is_dead)
3301                                 {
3302                                         if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3303                                         {
3304                                                 HIT_POINT dam = damroll(2, 6);
3305
3306                                                 /* Modify the damage */
3307                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
3308
3309                                                 msg_format(_("%^sは突然熱くなった!", "%^s is suddenly very hot!"), m_name);
3310
3311                                                 if (mon_take_hit(m_idx, dam, &fear, _("は灰の山になった。", " turns into a pile of ash.")))
3312                                                 {
3313                                                         blinked = FALSE;
3314                                                         alive = FALSE;
3315                                                 }
3316                                         }
3317                                         else
3318                                         {
3319                                                 if (is_original_ap_and_seen(m_ptr))
3320                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
3321                                         }
3322                                 }
3323
3324                                 if (p_ptr->sh_elec && alive && !p_ptr->is_dead)
3325                                 {
3326                                         if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
3327                                         {
3328                                                 HIT_POINT dam = damroll(2, 6);
3329
3330                                                 /* Modify the damage */
3331                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
3332
3333                                                 msg_format(_("%^sは電撃をくらった!", "%^s gets zapped!"), m_name);
3334                                                 if (mon_take_hit(m_idx, dam, &fear, _("は燃え殻の山になった。", " turns into a pile of cinder.")))
3335                                                 {
3336                                                         blinked = FALSE;
3337                                                         alive = FALSE;
3338                                                 }
3339                                         }
3340                                         else
3341                                         {
3342                                                 if (is_original_ap_and_seen(m_ptr))
3343                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
3344                                         }
3345                                 }
3346
3347                                 if (p_ptr->sh_cold && alive && !p_ptr->is_dead)
3348                                 {
3349                                         if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
3350                                         {
3351                                                 HIT_POINT dam = damroll(2, 6);
3352
3353                                                 /* Modify the damage */
3354                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
3355
3356                                                 msg_format(_("%^sは冷気をくらった!", "%^s is very cold!"), m_name);
3357                                                 if (mon_take_hit(m_idx, dam, &fear, _("は凍りついた。", " was frozen.")))
3358                                                 {
3359                                                         blinked = FALSE;
3360                                                         alive = FALSE;
3361                                                 }
3362                                         }
3363                                         else
3364                                         {
3365                                                 if (is_original_ap_and_seen(m_ptr))
3366                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
3367                                         }
3368                                 }
3369
3370                                 /* by henkma */
3371                                 if (p_ptr->dustrobe && alive && !p_ptr->is_dead)
3372                                 {
3373                                         if (!(r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK))
3374                                         {
3375                                                 HIT_POINT dam = damroll(2, 6);
3376
3377                                                 /* Modify the damage */
3378                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
3379
3380                                                 msg_format(_("%^sは鏡の破片をくらった!", "%^s gets zapped!"), m_name);
3381                                                 if (mon_take_hit(m_idx, dam, &fear, _("はズタズタになった。", " had torn to pieces.")))
3382                                                 {
3383                                                         blinked = FALSE;
3384                                                         alive = FALSE;
3385                                                 }
3386                                         }
3387                                         else
3388                                         {
3389                                                 if (is_original_ap_and_seen(m_ptr))
3390                                                         r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK);
3391                                         }
3392
3393                                         if (is_mirror_grid(&current_floor_ptr->grid_array[p_ptr->y][p_ptr->x]))
3394                                         {
3395                                                 teleport_player(10, 0L);
3396                                         }
3397                                 }
3398
3399                                 if (p_ptr->tim_sh_holy && alive && !p_ptr->is_dead)
3400                                 {
3401                                         if (r_ptr->flags3 & RF3_EVIL)
3402                                         {
3403                                                 if (!(r_ptr->flagsr & RFR_RES_ALL))
3404                                                 {
3405                                                         HIT_POINT dam = damroll(2, 6);
3406
3407                                                         /* Modify the damage */
3408                                                         dam = mon_damage_mod(m_ptr, dam, FALSE);
3409
3410                                                         msg_format(_("%^sは聖なるオーラで傷ついた!", "%^s is injured by holy power!"), m_name);
3411                                                         if (mon_take_hit(m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3412                                                         {
3413                                                                 blinked = FALSE;
3414                                                                 alive = FALSE;
3415                                                         }
3416                                                         if (is_original_ap_and_seen(m_ptr))
3417                                                                 r_ptr->r_flags3 |= RF3_EVIL;
3418                                                 }
3419                                                 else
3420                                                 {
3421                                                         if (is_original_ap_and_seen(m_ptr))
3422                                                                 r_ptr->r_flagsr |= RFR_RES_ALL;
3423                                                 }
3424                                         }
3425                                 }
3426
3427                                 if (p_ptr->tim_sh_touki && alive && !p_ptr->is_dead)
3428                                 {
3429                                         if (!(r_ptr->flagsr & RFR_RES_ALL))
3430                                         {
3431                                                 HIT_POINT dam = damroll(2, 6);
3432
3433                                                 /* Modify the damage */
3434                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
3435
3436                                                 msg_format(_("%^sが鋭い闘気のオーラで傷ついた!", "%^s is injured by the Force"), m_name);
3437                                                 if (mon_take_hit(m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3438                                                 {
3439                                                         blinked = FALSE;
3440                                                         alive = FALSE;
3441                                                 }
3442                                         }
3443                                         else
3444                                         {
3445                                                 if (is_original_ap_and_seen(m_ptr))
3446                                                         r_ptr->r_flagsr |= RFR_RES_ALL;
3447                                         }
3448                                 }
3449
3450                                 if (hex_spelling(HEX_SHADOW_CLOAK) && alive && !p_ptr->is_dead)
3451                                 {
3452                                         HIT_POINT dam = 1;
3453                                         object_type *o_armed_ptr = &inventory[INVEN_RARM];
3454
3455                                         if (!(r_ptr->flagsr & RFR_RES_ALL || r_ptr->flagsr & RFR_RES_DARK))
3456                                         {
3457                                                 if (o_armed_ptr->k_idx)
3458                                                 {
3459                                                         int basedam = ((o_armed_ptr->dd + p_ptr->to_dd[0]) * (o_armed_ptr->ds + p_ptr->to_ds[0] + 1));
3460                                                         dam = basedam / 2 + o_armed_ptr->to_d + p_ptr->to_d[0];
3461                                                 }
3462
3463                                                 /* Cursed armor makes damages doubled */
3464                                                 o_armed_ptr = &inventory[INVEN_BODY];
3465                                                 if ((o_armed_ptr->k_idx) && object_is_cursed(o_armed_ptr)) dam *= 2;
3466
3467                                                 /* Modify the damage */
3468                                                 dam = mon_damage_mod(m_ptr, dam, FALSE);
3469
3470                                                 msg_format(_("影のオーラが%^sに反撃した!", "Enveloped shadows attack %^s."), m_name);
3471                                                 if (mon_take_hit(m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3472                                                 {
3473                                                         blinked = FALSE;
3474                                                         alive = FALSE;
3475                                                 }
3476                                                 else /* monster does not dead */
3477                                                 {
3478                                                         int j;
3479                                                         BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3480                                                         EFFECT_ID typ[4][2] = {
3481                                                                 { INVEN_HEAD, GF_OLD_CONF },
3482                                                                 { INVEN_LARM,  GF_OLD_SLEEP },
3483                                                                 { INVEN_HANDS, GF_TURN_ALL },
3484                                                                 { INVEN_FEET, GF_OLD_SLOW }
3485                                                         };
3486
3487                                                         /* Some cursed armours gives an extra effect */
3488                                                         for (j = 0; j < 4; j++)
3489                                                         {
3490                                                                 o_armed_ptr = &inventory[typ[j][0]];
3491                                                                 if ((o_armed_ptr->k_idx) && object_is_cursed(o_armed_ptr) && object_is_armour(o_armed_ptr))
3492                                                                         project(0, 0, m_ptr->fy, m_ptr->fx, (p_ptr->lev * 2), typ[j][1], flg, -1);
3493                                                         }
3494                                                 }
3495                                         }
3496                                         else
3497                                         {
3498                                                 if (is_original_ap_and_seen(m_ptr))
3499                                                         r_ptr->r_flagsr |= (RFR_RES_ALL | RFR_RES_DARK);
3500                                         }
3501                                 }
3502                         }
3503                 }
3504
3505                 /* Monster missed player */
3506                 else
3507                 {
3508                         /* Analyze failed attacks */
3509                         switch (method)
3510                         {
3511                                 case RBM_HIT:
3512                                 case RBM_TOUCH:
3513                                 case RBM_PUNCH:
3514                                 case RBM_KICK:
3515                                 case RBM_CLAW:
3516                                 case RBM_BITE:
3517                                 case RBM_STING:
3518                                 case RBM_SLASH:
3519                                 case RBM_BUTT:
3520                                 case RBM_CRUSH:
3521                                 case RBM_ENGULF:
3522                                 case RBM_CHARGE:
3523
3524                                 /* Visible monsters */
3525                                 if (m_ptr->ml)
3526                                 {
3527                                         disturb(TRUE, TRUE);
3528
3529 #ifdef JP
3530                                         if (abbreviate)
3531                                             msg_format("%sかわした。", (p_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "");
3532                                         else
3533                                             msg_format("%s%^sの攻撃をかわした。", (p_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "", m_name);
3534                                         abbreviate = 1;/*2回目以降は省略 */
3535 #else
3536                                         msg_format("%^s misses you.", m_name);
3537 #endif
3538
3539                                 }
3540
3541                                 /* Gain shield experience */
3542                                 if (object_is_armour(&inventory[INVEN_RARM]) || object_is_armour(&inventory[INVEN_LARM]))
3543                                 {
3544                                         int cur = p_ptr->skill_exp[GINOU_SHIELD];
3545                                         int max = s_info[p_ptr->pclass].s_max[GINOU_SHIELD];
3546
3547                                         if (cur < max)
3548                                         {
3549                                                 DEPTH targetlevel = r_ptr->level;
3550                                                 int inc = 0;
3551
3552
3553                                                 /* Extra experience */
3554                                                 if ((cur / 100) < targetlevel)
3555                                                 {
3556                                                         if ((cur / 100 + 15) < targetlevel)
3557                                                                 inc += 1 + (targetlevel - (cur / 100 + 15));
3558                                                         else
3559                                                                 inc += 1;
3560                                                 }
3561
3562                                                 p_ptr->skill_exp[GINOU_SHIELD] = MIN(max, cur + inc);
3563                                                 p_ptr->update |= (PU_BONUS);
3564                                         }
3565                                 }
3566
3567                                 damage = 0;
3568
3569                                 break;
3570                         }
3571                 }
3572
3573
3574                 /* Analyze "visible" monsters only */
3575                 if (is_original_ap_and_seen(m_ptr) && !do_silly_attack)
3576                 {
3577                         /* Count "obvious" attacks (and ones that cause damage) */
3578                         if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
3579                         {
3580                                 /* Count attacks of this type */
3581                                 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
3582                                 {
3583                                         r_ptr->r_blows[ap_cnt]++;
3584                                 }
3585                         }
3586                 }
3587
3588                 if (p_ptr->riding && damage)
3589                 {
3590                         char m_steed_name[MAX_NLEN];
3591                         monster_desc(m_steed_name, &current_floor_ptr->m_list[p_ptr->riding], 0);
3592                         if (rakuba((damage > 200) ? 200 : damage, FALSE))
3593                         {
3594                                 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_steed_name);
3595                         }
3596                 }
3597
3598                 if (p_ptr->special_defense & NINJA_KAWARIMI)
3599                 {
3600                         if (kawarimi(FALSE)) return TRUE;
3601                 }
3602         }
3603
3604         /* Hex - revenge damage stored */
3605         revenge_store(get_damage);
3606
3607         if ((p_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
3608                 && get_damage > 0 && !p_ptr->is_dead)
3609         {
3610 #ifdef JP
3611                 msg_format("攻撃が%s自身を傷つけた!", m_name);
3612 #else
3613                 GAME_TEXT m_name_self[80];
3614
3615                 /* hisself */
3616                 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
3617
3618                 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
3619 #endif
3620                 project(0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
3621                 if (p_ptr->tim_eyeeye) set_tim_eyeeye(p_ptr->tim_eyeeye-5, TRUE);
3622         }
3623
3624         if ((p_ptr->counter || (p_ptr->special_defense & KATA_MUSOU)) && alive && !p_ptr->is_dead && m_ptr->ml && (p_ptr->csp > 7))
3625         {
3626                 char m_target_name[MAX_NLEN];
3627                 monster_desc(m_target_name, m_ptr, 0);
3628
3629                 p_ptr->csp -= 7;
3630                 msg_format(_("%^sに反撃した!", "Your counterattack to %s!"), m_target_name);
3631                 py_attack(m_ptr->fy, m_ptr->fx, HISSATSU_COUNTER);
3632                 fear = FALSE;
3633                 p_ptr->redraw |= (PR_MANA);
3634         }
3635
3636         /* Blink away */
3637         if (blinked && alive && !p_ptr->is_dead)
3638         {
3639                 if (teleport_barrier(m_idx))
3640                 {
3641                         msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But magic barrier obstructs it."));
3642                 }
3643                 else
3644                 {
3645                         msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
3646                         teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
3647                 }
3648         }
3649
3650
3651         /* Always notice cause of death */
3652         if (p_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !p_ptr->inside_arena)
3653         {
3654                 r_ptr->r_deaths++;
3655         }
3656
3657         if (m_ptr->ml && fear && alive && !p_ptr->is_dead)
3658         {
3659                 sound(SOUND_FLEE);
3660                 msg_format(_("%^sは恐怖で逃げ出した!", "%^s flees in terror!"), m_name);
3661         }
3662
3663         if (p_ptr->special_defense & KATA_IAI)
3664         {
3665                 set_action(ACTION_NONE);
3666         }
3667
3668         /* Assume we attacked */
3669         return (TRUE);
3670 }