OSDN Git Service

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