OSDN Git Service

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