3 * @brief 打撃処理 / Melee process.
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
20 #include "monsterrace-hook.h"
23 #include "monster-status.h"
24 #include "monster-spell.h"
26 #include "realm-hex.h"
27 #include "realm-song.h"
28 #include "object-flavor.h"
29 #include "object-hook.h"
36 #include "player-move.h"
37 #include "player-effects.h"
38 #include "player-skill.h"
39 #include "player-damage.h"
40 #include "player-status.h"
41 #include "player-race.h"
42 #include "player-class.h"
43 #include "player-personality.h"
44 #include "view-mainwindow.h"
46 #include "spells-floor.h"
48 #define BLOW_EFFECT_TYPE_NONE 0
49 #define BLOW_EFFECT_TYPE_FEAR 1
50 #define BLOW_EFFECT_TYPE_SLEEP 2
51 #define BLOW_EFFECT_TYPE_HEAL 3
54 * @brief モンスターの打撃効力テーブル /
55 * The table of monsters' blow effects
57 const mbe_info_type mbe_info[] =
60 { 60, GF_MISSILE, }, /* HURT */
61 { 5, GF_POIS, }, /* POISON */
62 { 20, GF_DISENCHANT, }, /* UN_BONUS */
63 { 15, GF_MISSILE, }, /* UN_POWER */ /* ToDo: Apply the correct effects */
64 { 5, GF_MISSILE, }, /* EAT_GOLD */
65 { 5, GF_MISSILE, }, /* EAT_ITEM */
66 { 5, GF_MISSILE, }, /* EAT_FOOD */
67 { 5, GF_MISSILE, }, /* EAT_LITE */
68 { 0, GF_ACID, }, /* ACID */
69 { 10, GF_ELEC, }, /* ELEC */
70 { 10, GF_FIRE, }, /* FIRE */
71 { 10, GF_COLD, }, /* COLD */
72 { 2, GF_MISSILE, }, /* BLIND */
73 { 10, GF_CONFUSION, }, /* CONFUSE */
74 { 10, GF_MISSILE, }, /* TERRIFY */
75 { 2, GF_MISSILE, }, /* PARALYZE */
76 { 0, GF_MISSILE, }, /* LOSE_STR */
77 { 0, GF_MISSILE, }, /* LOSE_INT */
78 { 0, GF_MISSILE, }, /* LOSE_WIS */
79 { 0, GF_MISSILE, }, /* LOSE_DEX */
80 { 0, GF_MISSILE, }, /* LOSE_CON */
81 { 0, GF_MISSILE, }, /* LOSE_CHR */
82 { 2, GF_MISSILE, }, /* LOSE_ALL */
83 { 60, GF_ROCKET, }, /* SHATTER */
84 { 5, GF_MISSILE, }, /* EXP_10 */
85 { 5, GF_MISSILE, }, /* EXP_20 */
86 { 5, GF_MISSILE, }, /* EXP_40 */
87 { 5, GF_MISSILE, }, /* EXP_80 */
88 { 5, GF_POIS, }, /* DISEASE */
89 { 5, GF_TIME, }, /* TIME */
90 { 5, GF_MISSILE, }, /* EXP_VAMP */
91 { 5, GF_MANA, }, /* DR_MANA */
92 { 60, GF_MISSILE, }, /* SUPERHURT */
96 * @brief 幻覚時の打撃記述テーブル / Weird melee attack types when hallucinating
99 const concptr silly_attacks[MAX_SILLY_ATTACK] =
102 "があなたの回りを3回回ってワンと言った。",
110 "に「神の国」発言の撤回を求められた。",
121 "はあなたの100の秘密について熱く語った。",
133 "に二週間以内でビデオを人に見せないと死ぬ呪いをかけられた。",
135 "はスーパーウルトラギャラクティカマグナムを放った。",
137 "にジェットストリームアタックをかけられた。",
138 "はあなたに卍固めをかけて「1、2、3、ダーッ!」と叫んだ。",
139 "は「いくじなし!ばかばかばか!」といって駆け出した。",
140 "が「ごらん、ルーベンスの絵だよ」と言って静かに目を閉じた。",
141 "は言った。「変愚蛮怒、絶賛公開中!」",
145 * @brief 幻覚時の打撃記述テーブル(フォーマットつき) / Weird melee attack types when hallucinating (%s for strfmt())
147 const concptr silly_attacks2[MAX_SILLY_ATTACK] =
150 "%sの回りを3回回ってワンと言った。",
158 "%sに「神の国」発言の撤回を求めた。",
169 "%sの100の秘密について熱く語った。",
181 "%sに二週間以内でビデオを人に見せないと死ぬ呪いをかけた。",
183 "%sにスーパーウルトラギャラクティカマグナムを放った。",
185 "%sにジェットストリームアタックをかけた。",
186 "%sに卍固めをかけて「1、2、3、ダーッ!」と叫んだ。",
187 "「いくじなし!ばかばかばか!」といって駆け出した。",
188 "「ごらん、ルーベンスの絵だよ」と言って静かに目を閉じた。",
192 const concptr silly_attacks[MAX_SILLY_ATTACK] =
203 "makes obscene gestures at",
233 * @brief マーシャルアーツ打撃テーブル
235 const martial_arts ma_blows[MAX_MA] =
238 { "%sを殴った。", 1, 0, 1, 5, 0 },
239 { "%sを蹴った。", 2, 0, 1, 7, 0 },
240 { "%sに正拳突きをくらわした。", 3, 0, 1, 9, 0 },
241 { "%sに膝蹴りをくらわした。", 5, 5, 2, 4, MA_KNEE },
242 { "%sに肘打ちをくらわした。", 7, 5, 1, 12, 0 },
243 { "%sに体当りした。", 9, 10, 2, 6, 0 },
244 { "%sを蹴った。", 11, 10, 3, 6, MA_SLOW },
245 { "%sにアッパーをくらわした。", 13, 12, 5, 5, 6 },
246 { "%sに二段蹴りをくらわした。", 16, 15, 5, 6, 8 },
247 { "%sに猫爪撃をくらわした。", 20, 20, 5, 8, 0 },
248 { "%sに跳空脚をくらわした。", 24, 25, 6, 8, 10 },
249 { "%sに鷲爪襲をくらわした。", 28, 25, 7, 9, 0 },
250 { "%sに回し蹴りをくらわした。", 32, 30, 8, 10, 10 },
251 { "%sに鉄拳撃をくらわした。", 35, 35, 8, 11, 10 },
252 { "%sに飛空脚をくらわした。", 39, 35, 8, 12, 12 },
253 { "%sに昇龍拳をくらわした。", 43, 35, 9, 12, 16 },
254 { "%sに石破天驚拳をくらわした。", 48, 40, 10, 13, 18 },
256 { "You punch %s.", 1, 0, 1, 4, 0 },
257 { "You kick %s.", 2, 0, 1, 6, 0 },
258 { "You strike %s.", 3, 0, 1, 7, 0 },
259 { "You hit %s with your knee.", 5, 5, 2, 3, MA_KNEE },
260 { "You hit %s with your elbow.", 7, 5, 1, 8, 0 },
261 { "You butt %s.", 9, 10, 2, 5, 0 },
262 { "You kick %s.", 11, 10, 3, 4, MA_SLOW },
263 { "You uppercut %s.", 13, 12, 4, 4, 6 },
264 { "You double-kick %s.", 16, 15, 5, 4, 8 },
265 { "You hit %s with a Cat's Claw.", 20, 20, 5, 5, 0 },
266 { "You hit %s with a jump kick.", 25, 25, 5, 6, 10 },
267 { "You hit %s with an Eagle's Claw.", 29, 25, 6, 6, 0 },
268 { "You hit %s with a circle kick.", 33, 30, 6, 8, 10 },
269 { "You hit %s with an Iron Fist.", 37, 35, 8, 8, 10 },
270 { "You hit %s with a flying kick.", 41, 35, 8, 10, 12 },
271 { "You hit %s with a Dragon Fist.", 45, 35, 10, 10, 16 },
272 { "You hit %s with a Crushing Blow.", 48, 35, 10, 12, 18 },
278 * @brief 修行僧のターンダメージ算出テーブル
280 const int monk_ave_damage[PY_MAX_LEVEL + 1][3] =
337 * Stat Table (STR) -- help index into the "blow" table
339 const byte adj_str_blow[] =
356 20 /* 18/00-18/09 */,
357 30 /* 18/10-18/19 */,
358 40 /* 18/20-18/29 */,
359 50 /* 18/30-18/39 */,
360 60 /* 18/40-18/49 */,
361 70 /* 18/50-18/59 */,
362 80 /* 18/60-18/69 */,
363 90 /* 18/70-18/79 */,
364 100 /* 18/80-18/89 */,
365 110 /* 18/90-18/99 */,
366 120 /* 18/100-18/109 */,
367 130 /* 18/110-18/119 */,
368 140 /* 18/120-18/129 */,
369 150 /* 18/130-18/139 */,
370 160 /* 18/140-18/149 */,
371 170 /* 18/150-18/159 */,
372 180 /* 18/160-18/169 */,
373 190 /* 18/170-18/179 */,
374 200 /* 18/180-18/189 */,
375 210 /* 18/190-18/199 */,
376 220 /* 18/200-18/209 */,
377 230 /* 18/210-18/219 */,
383 * 器用さによる攻撃回数インデックステーブル
384 * Stat Table (DEX) -- index into the "blow" table
386 const byte adj_dex_blow[] =
413 7 /* 18/100-18/109 */,
414 7 /* 18/110-18/119 */,
415 8 /* 18/120-18/129 */,
416 8 /* 18/130-18/139 */,
417 9 /* 18/140-18/149 */,
418 9 /* 18/150-18/159 */,
419 10 /* 18/160-18/169 */,
420 10 /* 18/170-18/179 */,
421 11 /* 18/180-18/189 */,
422 11 /* 18/190-18/199 */,
423 12 /* 18/200-18/209 */,
424 12 /* 18/210-18/219 */,
431 * 腕力、器用さに応じた攻撃回数テーブル /
432 * This table is used to help calculate the number of blows the player can
433 * make in a single round of attacks (one player turn) with a normal weapon.
436 * This number ranges from a single blow/round for weak players to up to six
437 * blows/round for powerful warriors.
439 * Note that certain artifacts and ego-items give "bonus" blows/round.
441 * First, from the player class, we extract some values:
443 * Warrior num = 6; mul = 5; div = MAX(70, weapon_weight);
444 * Berserker num = 6; mul = 7; div = MAX(70, weapon_weight);
445 * Mage num = 3; mul = 2; div = MAX(100, weapon_weight);
446 * Priest num = 5; mul = 3; div = MAX(100, weapon_weight);
447 * Mindcrafter num = 5; mul = 3; div = MAX(100, weapon_weight);
448 * Rogue num = 5; mul = 3; div = MAX(40, weapon_weight);
449 * Ranger num = 5; mul = 4; div = MAX(70, weapon_weight);
450 * Paladin num = 5; mul = 4; div = MAX(70, weapon_weight);
451 * Weaponsmith num = 5; mul = 5; div = MAX(150, weapon_weight);
452 * Warrior-Mage num = 5; mul = 3; div = MAX(70, weapon_weight);
453 * Chaos Warrior num = 5; mul = 4; div = MAX(70, weapon_weight);
454 * Monk num = 5; mul = 3; div = MAX(60, weapon_weight);
455 * Tourist num = 4; mul = 3; div = MAX(100, weapon_weight);
456 * Imitator num = 5; mul = 4; div = MAX(70, weapon_weight);
457 * Beastmaster num = 5; mul = 3; div = MAX(70, weapon_weight);
458 * Cavalry(Ride) num = 5; mul = 4; div = MAX(70, weapon_weight);
459 * Cavalry(Walk) num = 5; mul = 3; div = MAX(100, weapon_weight);
460 * Sorcerer num = 1; mul = 1; div = MAX(1, weapon_weight);
461 * Archer num = 4; mul = 2; div = MAX(70, weapon_weight);
462 * Magic eater num = 4; mul = 2; div = MAX(70, weapon_weight);
463 * ForceTrainer num = 4; mul = 2; div = MAX(60, weapon_weight);
464 * Mirror Master num = 3; mul = 3; div = MAX(100, weapon_weight);
465 * Ninja num = 4; mul = 1; div = MAX(20, weapon_weight);
467 * To get "P", we look up the relevant "adj_str_blow[]" (see above),
468 * multiply it by "mul", and then divide it by "div".
469 * Increase P by 1 if you wield a weapon two-handed.
470 * Decrease P by 1 if you are a Ninja.
472 * To get "D", we look up the relevant "adj_dex_blow[]" (see above),
474 * The player gets "blows_table[P][D]" blows/round, as shown below,
475 * up to a maximum of "num" blows/round, plus any "bonus" blows/round.
478 const byte blows_table[12][12] =
481 /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11+ */
482 /* 3 10 15 /10 /40 /60 /80 /100 /120 /140 /160 /180 */
483 /* 0 */{ 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4 },
484 /* 1 */{ 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4 },
485 /* 2 */{ 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5 },
486 /* 3 */{ 1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5 },
487 /* 4 */{ 1, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5 },
488 /* 5 */{ 1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6 },
489 /* 6 */{ 1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6 },
490 /* 7 */{ 1, 2, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6 },
491 /* 8 */{ 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6 },
492 /* 9 */{ 1, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6 },
493 /* 10*/{ 2, 2, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6 },
494 /*11+*/{ 2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6 },
498 * @brief プレイヤーからモンスターへの打撃命中判定 /
499 * Determine if the player "hits" a monster (normal combat).
500 * @param chance 基本命中値
502 * @param visible 目標を視界に捕らえているならばTRUEを指定
503 * @return 命中と判定された場合TRUEを返す
504 * @note Always miss 5%, always hit 5%, otherwise random.
506 bool test_hit_norm(player_type *attacker_ptr, HIT_RELIABILITY chance, ARMOUR_CLASS ac, bool visible)
508 if (!visible) chance = (chance + 1) / 2;
509 return hit_chance(attacker_ptr, chance, ac) >= randint1(100);
513 * @brief モンスターへの命中率の計算
514 * @param player_ptr プレーヤーへの参照ポインタ
519 PERCENTAGE hit_chance(player_type *attacker_ptr, HIT_RELIABILITY reli, ARMOUR_CLASS ac)
521 PERCENTAGE chance = 5, chance_left = 90;
522 if(reli <= 0) return 5;
523 if(attacker_ptr->pseikaku == SEIKAKU_NAMAKE) chance_left = (chance_left * 19 + 9) / 20;
524 chance += (100 - ((ac * 75) / reli)) * chance_left / 100;
525 if (chance < 5) chance = 5;
531 * @brief プレイヤー攻撃の種族スレイング倍率計算
532 * @param mult 算出前の基本倍率(/10倍)
533 * @param flgs スレイフラグ配列
534 * @param m_ptr 目標モンスターの構造体参照ポインタ
535 * @return スレイング加味後の倍率(/10倍)
537 static MULTIPLY mult_slaying(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_type* m_ptr)
539 static const struct slay_table_t {
541 BIT_FLAGS affect_race_flag;
544 size_t r_flag_offset;
546 #define OFFSET(X) offsetof(monster_race, X)
547 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
548 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
549 {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
550 {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
551 {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
552 {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
553 {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
554 {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
555 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
556 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
557 {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
558 {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
559 {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
560 {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
561 {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
562 {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
563 {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
564 {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
565 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
566 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
570 monster_race* r_ptr = &r_info[m_ptr->r_idx];
571 for (int i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++i)
573 const struct slay_table_t* p = &slay_table[i];
575 if (!have_flag(flgs, p->slay_flag) ||
576 !(atoffset(BIT_FLAGS, r_ptr, p->flag_offset) & p->affect_race_flag))
579 if (is_original_ap_and_seen(m_ptr))
581 atoffset(BIT_FLAGS, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
584 mult = MAX(mult, p->slay_mult);
592 * @brief プレイヤー攻撃の属性スレイング倍率計算
593 * @param mult 算出前の基本倍率(/10倍)
594 * @param flgs スレイフラグ配列
595 * @param m_ptr 目標モンスターの構造体参照ポインタ
596 * @return スレイング加味後の倍率(/10倍)
598 static MULTIPLY mult_brand(MULTIPLY mult, const BIT_FLAGS* flgs, const monster_type* m_ptr)
600 static const struct brand_table_t {
602 BIT_FLAGS resist_mask;
605 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
606 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
607 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
608 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
609 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
612 monster_race* r_ptr = &r_info[m_ptr->r_idx];
613 for (int i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++i)
615 const struct brand_table_t* p = &brand_table[i];
617 if (!have_flag(flgs, p->brand_flag)) continue;
619 /* Notice immunity */
620 if (r_ptr->flagsr & p->resist_mask)
622 if (is_original_ap_and_seen(m_ptr))
624 r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
630 /* Otherwise, take the damage */
631 if (r_ptr->flags3 & p->hurt_flag)
633 if (is_original_ap_and_seen(m_ptr))
635 r_ptr->r_flags3 |= p->hurt_flag;
638 mult = MAX(mult, 50);
642 mult = MAX(mult, 25);
650 * @brief 剣術のスレイ倍率計算を行う /
651 * Calcurate magnification of hissatsu technics
652 * @param mult 剣術のスレイ効果以前に算出している多要素の倍率(/10倍)
653 * @param flgs 剣術に使用する武器のスレイフラグ配列
654 * @param m_ptr 目標となるモンスターの構造体参照ポインタ
655 * @param mode 剣術のスレイ型ID
656 * @return スレイの倍率(/10倍)
658 static MULTIPLY mult_hissatsu(player_type *attacker_ptr, MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, BIT_FLAGS mode)
660 monster_race *r_ptr = &r_info[m_ptr->r_idx];
662 /* Burning Strike (Fire) */
663 if (mode == HISSATSU_FIRE)
665 /* Notice immunity */
666 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
668 if (is_original_ap_and_seen(m_ptr))
670 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
674 /* Otherwise, take the damage */
675 else if (have_flag(flgs, TR_BRAND_FIRE))
677 if (r_ptr->flags3 & RF3_HURT_FIRE)
679 if (mult < 70) mult = 70;
680 if (is_original_ap_and_seen(m_ptr))
682 r_ptr->r_flags3 |= RF3_HURT_FIRE;
685 else if (mult < 35) mult = 35;
689 if (r_ptr->flags3 & RF3_HURT_FIRE)
691 if (mult < 50) mult = 50;
692 if (is_original_ap_and_seen(m_ptr))
694 r_ptr->r_flags3 |= RF3_HURT_FIRE;
697 else if (mult < 25) mult = 25;
701 /* Serpent's Tongue (Poison) */
702 if (mode == HISSATSU_POISON)
704 /* Notice immunity */
705 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
707 if (is_original_ap_and_seen(m_ptr))
709 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
713 /* Otherwise, take the damage */
714 else if (have_flag(flgs, TR_BRAND_POIS))
716 if (mult < 35) mult = 35;
720 if (mult < 25) mult = 25;
724 /* Zammaken (Nonliving Evil) */
725 if (mode == HISSATSU_ZANMA)
727 if (!monster_living(m_ptr->r_idx) && (r_ptr->flags3 & RF3_EVIL))
729 if (mult < 15) mult = 25;
730 else if (mult < 50) mult = MIN(50, mult + 20);
734 /* Rock Smash (Hurt Rock) */
735 if (mode == HISSATSU_HAGAN)
737 if (r_ptr->flags3 & RF3_HURT_ROCK)
739 if (is_original_ap_and_seen(m_ptr))
741 r_ptr->r_flags3 |= RF3_HURT_ROCK;
743 if (mult == 10) mult = 40;
744 else if (mult < 60) mult = 60;
748 /* Midare-Setsugekka (Cold) */
749 if (mode == HISSATSU_COLD)
751 /* Notice immunity */
752 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
754 if (is_original_ap_and_seen(m_ptr))
756 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
759 /* Otherwise, take the damage */
760 else if (have_flag(flgs, TR_BRAND_COLD))
762 if (r_ptr->flags3 & RF3_HURT_COLD)
764 if (mult < 70) mult = 70;
765 if (is_original_ap_and_seen(m_ptr))
767 r_ptr->r_flags3 |= RF3_HURT_COLD;
770 else if (mult < 35) mult = 35;
774 if (r_ptr->flags3 & RF3_HURT_COLD)
776 if (mult < 50) mult = 50;
777 if (is_original_ap_and_seen(m_ptr))
779 r_ptr->r_flags3 |= RF3_HURT_COLD;
782 else if (mult < 25) mult = 25;
786 /* Lightning Eagle (Elec) */
787 if (mode == HISSATSU_ELEC)
789 /* Notice immunity */
790 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
792 if (is_original_ap_and_seen(m_ptr))
794 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
798 /* Otherwise, take the damage */
799 else if (have_flag(flgs, TR_BRAND_ELEC))
801 if (mult < 70) mult = 70;
805 if (mult < 50) mult = 50;
809 /* Bloody Maelstrom */
810 if ((mode == HISSATSU_SEKIRYUKA) && attacker_ptr->cut && monster_living(m_ptr->r_idx))
812 MULTIPLY tmp = MIN(100, MAX(10, attacker_ptr->cut / 10));
813 if (mult < tmp) mult = tmp;
817 if (mode == HISSATSU_UNDEAD)
819 if (r_ptr->flags3 & RF3_UNDEAD)
821 if (is_original_ap_and_seen(m_ptr))
823 r_ptr->r_flags3 |= RF3_UNDEAD;
825 if (mult == 10) mult = 70;
826 else if (mult < 140) mult = MIN(140, mult + 60);
828 if (mult == 10) mult = 40;
829 else if (mult < 60) mult = MIN(60, mult + 30);
832 if (mult > 150) mult = 150;
838 * @brief ダメージにスレイ要素を加える総合処理ルーチン /
839 * Extract the "total damage" from a given object hitting a given monster.
840 * @param o_ptr 使用武器オブジェクトの構造体参照ポインタ
841 * @param tdam 現在算出途中のダメージ値
842 * @param m_ptr 目標モンスターの構造体参照ポインタ
844 * @param thrown 投擲処理ならばTRUEを指定する
845 * @return 総合的なスレイを加味したダメージ値
847 * Note that "flasks of oil" do NOT do fire damage, although they\n
848 * certainly could be made to do so. XXX XXX\n
850 * Note that most brands and slays are x3, except Slay Animal (x2),\n
851 * Slay Evil (x2), and Kill dragon (x5).\n
853 HIT_POINT tot_dam_aux(player_type *attacker_ptr, object_type *o_ptr, HIT_POINT tdam, monster_type *m_ptr, BIT_FLAGS mode, bool thrown)
855 BIT_FLAGS flgs[TR_FLAG_SIZE];
856 object_flags(o_ptr, flgs);
857 torch_flags(o_ptr, flgs); /* torches has secret flags */
861 if (attacker_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
862 if (attacker_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
863 if (attacker_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
864 if (attacker_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
865 if (attacker_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
868 if (hex_spelling(HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
882 mult = mult_slaying(mult, flgs, m_ptr);
884 mult = mult_brand(mult, flgs, m_ptr);
886 if (attacker_ptr->pclass == CLASS_SAMURAI)
888 mult = mult_hissatsu(attacker_ptr, mult, flgs, m_ptr, mode);
891 if ((attacker_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (attacker_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
893 attacker_ptr->csp -= (1 + (o_ptr->dd * o_ptr->ds / 5));
894 attacker_ptr->redraw |= (PR_MANA);
895 mult = mult * 3 / 2 + 20;
898 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
904 if (mult > 150) mult = 150;
905 return (tdam * mult / 10);
909 * @brief プレイヤーからモンスターへの打撃クリティカル判定 /
910 * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
911 * @param weight 矢弾の重量
912 * @param plus 武器の命中修正
913 * @param dam 現在算出中のダメージ値
914 * @param meichuu 打撃の基本命中力
915 * @param mode オプションフラグ
916 * @return クリティカル修正が入ったダメージ値
918 HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, BIT_FLAGS mode)
920 /* Extract "blow" power */
921 int i = (weight + (meichuu * 3 + plus * 5) + attacker_ptr->skill_thn);
924 bool is_special_option = randint1((attacker_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i;
925 is_special_option |= mode == HISSATSU_MAJIN;
926 is_special_option |= mode == HISSATSU_3DAN;
927 if (!is_special_option) return dam;
929 int k = weight + randint1(650);
930 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k += randint1(650);
934 msg_print(_("手ごたえがあった!", "It was a good hit!"));
942 msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
949 msg_print(_("会心の一撃だ!", "It was a superb hit!"));
956 msg_print(_("最高の会心の一撃だ!", "It was a *GREAT* hit!"));
961 msg_print(_("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!"));
962 dam = ((7 * dam) / 2) + 25;
967 * @brief モンスター打撃のクリティカルランクを返す /
968 * Critical blow. All hits that do 95% of total possible damage,
969 * @param dice モンスター打撃のダイス数
970 * @param sides モンスター打撃の最大ダイス目
971 * @param dam プレイヤーに与えたダメージ
973 * and which also do at least 20 damage, or, sometimes, N damage.
974 * This is used only to determine "cuts" and "stuns".
976 static int monster_critical(DICE_NUMBER dice, DICE_SID sides, HIT_POINT dam)
978 /* Must do at least 95% of perfect */
979 int total = dice * sides;
980 if (dam < total * 19 / 20) return (0);
982 /* Weak blows rarely work */
983 if ((dam < 20) && (randint0(100) >= dam)) return (0);
987 if ((dam >= total) && (dam >= 40)) max++;
992 while (randint0(100) < 2) max++;
995 /* Critical damage */
996 if (dam > 45) return (6 + max);
997 if (dam > 33) return (5 + max);
998 if (dam > 25) return (4 + max);
999 if (dam > 18) return (3 + max);
1000 if (dam > 11) return (2 + max);
1006 * @brief モンスター打撃の命中を判定する /
1007 * Determine if a monster attack against the player succeeds.
1008 * @param power 打撃属性毎の基本命中値
1009 * @param level モンスターのレベル
1010 * @param stun モンスターの朦朧値
1011 * @return TRUEならば命中判定
1013 * Always miss 5% of the time, Always hit 5% of the time.
1014 * Otherwise, match monster power against player armor.
1016 static int check_hit(player_type *target_ptr, int power, DEPTH level, int stun)
1018 int k = randint0(100);
1019 if (stun && one_in_(2)) return FALSE;
1020 if (k < 10) return (k < 5);
1021 int i = (power + (level * 3));
1023 int ac = target_ptr->ac + target_ptr->to_a;
1024 if (target_ptr->special_attack & ATTACK_SUIKEN) ac += (target_ptr->lev * 2);
1026 if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return TRUE;
1031 * @brief モンスターから敵モンスターへの命中判定
1032 * @param power 打撃属性による基本命中値
1033 * @param level 攻撃側モンスターのレベル
1034 * @param ac 目標モンスターのAC
1035 * @param stun 攻撃側モンスターが朦朧状態ならTRUEを返す
1036 * @return 命中ならばTRUEを返す
1038 static int check_hit2(int power, DEPTH level, ARMOUR_CLASS ac, int stun)
1040 int k = randint0(100);
1041 if (stun && one_in_(2)) return FALSE;
1042 if (k < 10) return (k < 5);
1043 int i = (power + (level * 3));
1045 if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return TRUE;
1049 /*! モンスターの侮辱行為メッセージテーブル / Hack -- possible "insult" messages */
1050 static concptr desc_insult[] =
1061 "があなたをパラサイト呼ばわりした!",
1065 "insults your mother!",
1066 "gives you the finger!",
1069 "dances around you!",
1070 "makes obscene gestures!",
1072 "calls you a parasite!",
1073 "calls you a cyborg!"
1078 /*! マゴットのぼやきメッセージテーブル / Hack -- possible "insult" messages */
1079 static concptr desc_moan[] =
1083 "が彼の飼い犬を見なかったかと尋ねている。",
1084 "が縄張りから出て行けと言っている。",
1087 "seems sad about something.",
1088 "asks if you have seen his dogs.",
1089 "tells you to get off his land.",
1090 "mumbles something about mushrooms."
1097 * @brief 敵オーラによるプレイヤーのダメージ処理(補助)
1098 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
1099 * @param immune ダメージを回避できる免疫フラグ
1100 * @param flags_offset オーラフラグ配列の参照オフセット
1101 * @param r_flags_offset モンスターの耐性配列の参照オフセット
1102 * @param aura_flag オーラフラグ配列
1103 * @param dam_func ダメージ処理を行う関数の参照ポインタ
1104 * @param message オーラダメージを受けた際のメッセージ
1107 static void touch_zap_player_aux(monster_type *m_ptr, player_type *touched_ptr, bool immune, int flags_offset, int r_flags_offset, u32b aura_flag,
1108 HIT_POINT(*dam_func)(player_type *creature_type, HIT_POINT dam, concptr kb_str, int monspell, bool aura), concptr message)
1110 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1111 if (!(atoffset(BIT_FLAGS, r_ptr, flags_offset) & aura_flag) || immune) return;
1113 GAME_TEXT mon_name[MAX_NLEN];
1114 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1116 monster_desc(mon_name, m_ptr, MD_WRONGDOER_NAME);
1118 dam_func(touched_ptr, aura_damage, mon_name, -1, TRUE);
1120 if (is_original_ap_and_seen(m_ptr))
1122 atoffset(BIT_FLAGS, r_ptr, r_flags_offset) |= aura_flag;
1125 handle_stuff(touched_ptr);
1130 * @brief 敵オーラによるプレイヤーのダメージ処理(メイン)
1131 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
1132 * @param touched_ptr オーラを持つ相手に振れたクリーチャーの参照ポインタ
1135 static void touch_zap_player(monster_type *m_ptr, player_type *touched_ptr)
1137 touch_zap_player_aux(m_ptr, touched_ptr, touched_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
1138 fire_dam, _("突然とても熱くなった!", "You are suddenly very hot!"));
1139 touch_zap_player_aux(m_ptr, touched_ptr, touched_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
1140 cold_dam, _("突然とても寒くなった!", "You are suddenly very cold!"));
1141 touch_zap_player_aux(m_ptr, touched_ptr, touched_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
1142 elec_dam, _("電撃をくらった!", "You get zapped!"));
1147 * @brief プレイヤーの変異要素による打撃処理
1148 * @param attacker_ptr プレーヤーへの参照ポインタ
1149 * @param m_idx 攻撃目標となったモンスターの参照ID
1150 * @param attack 変異要素による攻撃要素の種類
1151 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
1152 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
1155 static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int attack, bool *fear, bool *mdeath)
1157 WEIGHT n_weight = 0;
1158 monster_type *m_ptr = &attacker_ptr->current_floor_ptr->m_list[m_idx];
1159 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1161 int dice_num, dice_side;
1165 case MUT2_SCOR_TAIL:
1169 atk_desc = _("尻尾", "tail");
1176 atk_desc = _("角", "horns");
1183 atk_desc = _("クチバシ", "beak");
1190 atk_desc = _("象の鼻", "trunk");
1193 case MUT2_TENTACLES:
1197 atk_desc = _("触手", "tentacles");
1201 dice_num = dice_side = n_weight = 1;
1202 atk_desc = _("未定義の部位", "undefined body part");
1206 GAME_TEXT m_name[MAX_NLEN];
1207 monster_desc(m_name, m_ptr, 0);
1209 /* Calculate the "attack quality" */
1210 int bonus = attacker_ptr->to_h_m + (attacker_ptr->lev * 6 / 5);
1211 int chance = (attacker_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1213 bool is_hit = !(r_ptr->flags2 & RF2_QUANTUM) || !randint0(2);
1214 is_hit &= test_hit_norm(attacker_ptr, chance, r_ptr->ac, m_ptr->ml);
1218 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1223 msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
1225 HIT_POINT k = damroll(dice_num, dice_side);
1226 k = critical_norm(attacker_ptr, n_weight, bonus, k, (s16b)bonus, 0);
1228 /* Apply the player damage bonuses */
1229 k += attacker_ptr->to_d_m;
1231 /* No negative damage */
1234 /* Modify the damage */
1235 k = mon_damage_mod(attacker_ptr, m_ptr, k, FALSE);
1237 /* Complex message */
1238 msg_format_wizard(CHEAT_MONSTER,
1239 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
1240 k, m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
1242 /* Anger the monster */
1243 if (k > 0) anger_monster(m_ptr);
1245 /* Damage, check for fear and mdeath */
1248 case MUT2_SCOR_TAIL:
1249 project(attacker_ptr, 0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1250 *mdeath = (m_ptr->r_idx == 0);
1253 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1256 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1259 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1261 case MUT2_TENTACLES:
1262 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1265 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1268 touch_zap_player(m_ptr, attacker_ptr);
1272 * @brief プレイヤーの打撃処理サブルーチン /
1273 * Player attacks a (poor, defenseless) creature -RAK-
1276 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
1277 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
1278 * @param hand 攻撃を行うための武器を持つ手
1279 * @param mode 発動中の剣術ID
1282 * If no "weapon" is available, then "punch" the monster one time.
1284 static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, COMBAT_OPTION_IDX mode)
1286 int num = 0, bonus, chance, vir;
1289 floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
1290 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
1292 monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
1293 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1295 /* Access the weapon */
1296 object_type *o_ptr = &attacker_ptr->inventory_list[INVEN_RARM + hand];
1298 GAME_TEXT m_name[MAX_NLEN];
1300 bool success_hit = FALSE;
1301 bool backstab = FALSE;
1302 bool vorpal_cut = FALSE;
1303 int chaos_effect = 0;
1304 bool stab_fleeing = FALSE;
1305 bool fuiuchi = FALSE;
1306 bool monk_attack = FALSE;
1307 bool do_quake = FALSE;
1309 bool drain_msg = TRUE;
1310 int drain_result = 0, drain_heal = 0;
1311 bool can_drain = FALSE;
1313 int drain_left = MAX_VAMPIRIC_DRAIN;
1314 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1315 bool is_human = (r_ptr->d_char == 'p');
1316 bool is_lowlevel = (r_ptr->level < (attacker_ptr->lev - 15));
1317 bool zantetsu_mukou, e_j_mukou;
1319 switch (attacker_ptr->pclass)
1323 if (has_melee_weapon(attacker_ptr, INVEN_RARM + hand) && !attacker_ptr->icky_wield[hand])
1325 int tmp = attacker_ptr->lev * 6 + (attacker_ptr->skill_stl + 10) * 4;
1326 if (attacker_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1327 if (attacker_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1328 if (r_ptr->level > (attacker_ptr->lev * attacker_ptr->lev / 20 + 10)) tmp /= 3;
1329 if (MON_CSLEEP(m_ptr) && m_ptr->ml)
1331 /* Can't backstab creatures that we can't see, right? */
1334 else if ((attacker_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level + 20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
1338 else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
1340 stab_fleeing = TRUE;
1347 case CLASS_FORCETRAINER:
1348 case CLASS_BERSERKER:
1349 if ((empty_hands(attacker_ptr, TRUE) & EMPTY_HAND_RARM) && !attacker_ptr->riding) monk_attack = TRUE;
1353 if (!o_ptr->k_idx) /* Empty hand */
1355 if ((r_ptr->level + 10) > attacker_ptr->lev)
1357 if (attacker_ptr->skill_exp[GINOU_SUDE] < s_info[attacker_ptr->pclass].s_max[GINOU_SUDE])
1359 if (attacker_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
1360 attacker_ptr->skill_exp[GINOU_SUDE] += 40;
1361 else if ((attacker_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
1362 attacker_ptr->skill_exp[GINOU_SUDE] += 5;
1363 else if ((attacker_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (attacker_ptr->lev > 19))
1364 attacker_ptr->skill_exp[GINOU_SUDE] += 1;
1365 else if ((attacker_ptr->lev > 34))
1366 if (one_in_(3)) attacker_ptr->skill_exp[GINOU_SUDE] += 1;
1367 attacker_ptr->update |= (PU_BONUS);
1371 else if (object_is_melee_weapon(o_ptr))
1373 if ((r_ptr->level + 10) > attacker_ptr->lev)
1375 OBJECT_TYPE_VALUE tval = attacker_ptr->inventory_list[INVEN_RARM + hand].tval - TV_WEAPON_BEGIN;
1376 OBJECT_SUBTYPE_VALUE sval = attacker_ptr->inventory_list[INVEN_RARM + hand].sval;
1377 int now_exp = attacker_ptr->weapon_exp[tval][sval];
1378 if (now_exp < s_info[attacker_ptr->pclass].w_max[tval][sval])
1381 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
1382 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
1383 else if ((now_exp < WEAPON_EXP_EXPERT) && (attacker_ptr->lev > 19)) amount = 1;
1384 else if ((attacker_ptr->lev > 34) && one_in_(2)) amount = 1;
1385 attacker_ptr->weapon_exp[tval][sval] += amount;
1386 attacker_ptr->update |= (PU_BONUS);
1391 /* Disturb the monster */
1392 (void)set_monster_csleep(g_ptr->m_idx, 0);
1394 monster_desc(m_name, m_ptr, 0);
1396 /* Calculate the "attack quality" */
1397 bonus = attacker_ptr->to_h[hand] + o_ptr->to_h;
1398 chance = (attacker_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1399 if (mode == HISSATSU_IAI) chance += 60;
1400 if (attacker_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1401 if (attacker_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1403 vir = virtue_number(attacker_ptr, V_VALOUR);
1406 chance += (attacker_ptr->virtues[vir - 1] / 10);
1409 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1410 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1412 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1413 else if (mode == HISSATSU_COLD) num_blow = attacker_ptr->num_blow[hand] + 2;
1414 else num_blow = attacker_ptr->num_blow[hand];
1416 /* Hack -- DOKUBARI always hit once */
1417 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) num_blow = 1;
1419 /* Attack once for each legal blow */
1420 while ((num++ < num_blow) && !attacker_ptr->is_dead)
1422 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) || (mode == HISSATSU_KYUSHO))
1426 if (attacker_ptr->migite && attacker_ptr->hidarite)
1430 if (mode == HISSATSU_3DAN)
1435 success_hit = one_in_(n);
1437 else if ((attacker_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
1438 else success_hit = test_hit_norm(attacker_ptr, chance, r_ptr->ac, m_ptr->ml);
1440 if (mode == HISSATSU_MAJIN)
1443 success_hit = FALSE;
1448 backstab = FALSE; /* Clumsy! */
1449 fuiuchi = FALSE; /* Clumsy! */
1451 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
1453 BIT_FLAGS flgs_aux[TR_FLAG_SIZE];
1457 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1458 msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
1459 object_flags(o_ptr, flgs_aux);
1461 k = damroll(o_ptr->dd + attacker_ptr->to_dd[hand], o_ptr->ds + attacker_ptr->to_ds[hand]);
1464 switch (attacker_ptr->mimic_form)
1467 switch (attacker_ptr->prace)
1474 case RACE_BARBARIAN:
1478 case RACE_HALF_TROLL:
1479 case RACE_HALF_OGRE:
1480 case RACE_HALF_GIANT:
1481 case RACE_HALF_TITAN:
1489 case RACE_DRACONIAN:
1496 case MIMIC_DEMON_LORD:
1503 if (attacker_ptr->align < 0 && mult < 20)
1505 if (!(attacker_ptr->resist_acid || is_oppose_acid(attacker_ptr) || attacker_ptr->immune_acid) && (mult < 25))
1507 if (!(attacker_ptr->resist_elec || is_oppose_elec(attacker_ptr) || attacker_ptr->immune_elec) && (mult < 25))
1509 if (!(attacker_ptr->resist_fire || is_oppose_fire(attacker_ptr) || attacker_ptr->immune_fire) && (mult < 25))
1511 if (!(attacker_ptr->resist_cold || is_oppose_cold(attacker_ptr) || attacker_ptr->immune_cold) && (mult < 25))
1513 if (!(attacker_ptr->resist_pois || is_oppose_pois(attacker_ptr)) && (mult < 25))
1516 if ((attacker_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs_aux, TR_FORCE_WEAPON)) && (attacker_ptr->csp > (attacker_ptr->msp / 30)))
1518 attacker_ptr->csp -= (1 + (attacker_ptr->msp / 30));
1519 attacker_ptr->redraw |= (PR_MANA);
1520 mult = mult * 3 / 2 + 20;
1522 k *= (HIT_POINT)mult;
1526 k = critical_norm(attacker_ptr, o_ptr->weight, o_ptr->to_h, k, attacker_ptr->to_h[hand], mode);
1530 msg_format(_("グッサリ切り裂かれた!", "Your weapon cuts deep into yourself!"));
1531 /* Try to increase the damage */
1537 k *= (HIT_POINT)mult;
1539 k += (attacker_ptr->to_d[hand] + o_ptr->to_d);
1542 take_hit(attacker_ptr, DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1);
1543 handle_stuff(attacker_ptr);
1548 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1554 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1558 if (backstab) msg_format(_("あなたは冷酷にも眠っている無力な%sを突き刺した!", "You cruelly stab the helpless, sleeping %s!"), m_name);
1559 else if (fuiuchi) msg_format(_("不意を突いて%sに強烈な一撃を喰らわせた!", "You make surprise attack, and hit %s with a powerful blow!"), m_name);
1560 else if (stab_fleeing) msg_format(_("逃げる%sを背中から突き刺した!", "You backstab the fleeing %s!"), m_name);
1561 else if (!monk_attack) msg_format(_("%sを攻撃した。", "You hit %s."), m_name);
1563 /* Hack -- bare hands do one damage */
1566 object_flags(o_ptr, flgs);
1568 /* Select a chaotic effect (50% chance) */
1569 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1572 chg_virtue(attacker_ptr, V_CHANCE, 1);
1574 if (randint1(5) < 3)
1576 /* Vampiric (20%) */
1579 else if (one_in_(250))
1584 else if (!one_in_(10))
1586 /* Confusion (26.892%) */
1589 else if (one_in_(2))
1591 /* Teleport away (1.494%) */
1596 /* Polymorph (1.494%) */
1601 /* Vampiric drain */
1602 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(HEX_VAMP_BLADE))
1604 /* Only drain "living" monsters */
1605 if (monster_living(m_ptr->r_idx))
1611 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(HEX_RUNESWORD)) && (randint1(vorpal_chance * 3 / 2) == 1) && !zantetsu_mukou)
1613 else vorpal_cut = FALSE;
1617 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1619 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1620 int resist_stun = 0;
1623 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1624 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1625 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1626 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1627 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1630 if (attacker_ptr->special_defense & KAMAE_BYAKKO)
1631 max_times = (attacker_ptr->lev < 3 ? 1 : attacker_ptr->lev / 3);
1632 else if (attacker_ptr->special_defense & KAMAE_SUZAKU)
1634 else if (attacker_ptr->special_defense & KAMAE_GENBU)
1637 max_times = (attacker_ptr->lev < 7 ? 1 : attacker_ptr->lev / 7);
1638 /* Attempt 'times' */
1639 for (times = 0; times < max_times; times++)
1643 ma_ptr = &ma_blows[randint0(MAX_MA)];
1644 if ((attacker_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
1645 else min_level = ma_ptr->min_level;
1646 } while ((min_level > attacker_ptr->lev) ||
1647 (randint1(attacker_ptr->lev) < ma_ptr->chance));
1649 /* keep the highest level attack available we found */
1650 if ((ma_ptr->min_level > old_ptr->min_level) &&
1651 !attacker_ptr->stun && !attacker_ptr->confused)
1655 if (current_world_ptr->wizard && cheat_xtra)
1657 msg_print(_("攻撃を再選択しました。", "Attack re-selected."));
1666 if (attacker_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
1667 else min_level = ma_ptr->min_level;
1668 k = damroll(ma_ptr->dd + attacker_ptr->to_dd[hand], ma_ptr->ds + attacker_ptr->to_ds[hand]);
1669 if (attacker_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
1671 if (ma_ptr->effect == MA_KNEE)
1673 if (r_ptr->flags1 & RF1_MALE)
1675 msg_format(_("%sに金的膝蹴りをくらわした!", "You hit %s in the groin with your knee!"), m_name);
1677 special_effect = MA_KNEE;
1680 msg_format(ma_ptr->desc, m_name);
1683 else if (ma_ptr->effect == MA_SLOW)
1685 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
1686 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
1688 msg_format(_("%sの足首に関節蹴りをくらわした!", "You kick %s in the ankle."), m_name);
1689 special_effect = MA_SLOW;
1691 else msg_format(ma_ptr->desc, m_name);
1697 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
1700 msg_format(ma_ptr->desc, m_name);
1703 if (attacker_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
1704 if ((attacker_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
1706 weight += (P_PTR_KI / 30);
1707 if (weight > 20) weight = 20;
1710 k = critical_norm(attacker_ptr, attacker_ptr->lev * weight, min_level, k, attacker_ptr->to_h[0], 0);
1712 if ((special_effect == MA_KNEE) && ((k + attacker_ptr->to_d[hand]) < m_ptr->hp))
1714 msg_format(_("%^sは苦痛にうめいている!", "%^s moans in agony!"), m_name);
1715 stun_effect = 7 + randint1(13);
1719 else if ((special_effect == MA_SLOW) && ((k + attacker_ptr->to_d[hand]) < m_ptr->hp))
1721 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
1722 (randint1(attacker_ptr->lev) > r_ptr->level) &&
1725 msg_format(_("%^sは足をひきずり始めた。", "%^s starts limping slower."), m_name);
1726 m_ptr->mspeed -= 10;
1730 if (stun_effect && ((k + attacker_ptr->to_d[hand]) < m_ptr->hp))
1732 if (attacker_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
1734 if (set_monster_stunned(g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
1736 msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name);
1740 msg_format(_("%^sはさらにフラフラになった。", "%^s is more stunned."), m_name);
1746 /* Handle normal weapon */
1747 else if (o_ptr->k_idx)
1749 k = damroll(o_ptr->dd + attacker_ptr->to_dd[hand], o_ptr->ds + attacker_ptr->to_ds[hand]);
1750 k = tot_dam_aux(attacker_ptr, o_ptr, k, m_ptr, mode, FALSE);
1754 k *= (3 + (attacker_ptr->lev / 20));
1758 k = k * (5 + (attacker_ptr->lev * 2 / 25)) / 2;
1760 else if (stab_fleeing)
1765 if ((attacker_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
1766 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
1771 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_POISON_NEEDLE)) && !(mode == HISSATSU_KYUSHO))
1772 k = critical_norm(attacker_ptr, o_ptr->weight, o_ptr->to_h, k, attacker_ptr->to_h[hand], mode);
1780 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
1782 char chainsword_noise[1024];
1783 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, chainsword_noise))
1785 msg_print(chainsword_noise);
1789 if (o_ptr->name1 == ART_VORPAL_BLADE)
1791 msg_print(_("目にも止まらぬヴォーパルブレード、手錬の早業!", "Your Vorpal Blade goes snicker-snack!"));
1795 msg_format(_("%sをグッサリ切り裂いた!", "Your weapon cuts deep into %s!"), m_name);
1798 /* Try to increase the damage */
1799 while (one_in_(vorpal_chance))
1804 k *= (HIT_POINT)mult;
1807 if (((r_ptr->flagsr & RFR_RES_ALL) ? k / 100 : k) > m_ptr->hp)
1809 msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), m_name);
1815 case 2: msg_format(_("%sを斬った!", "You gouge %s!"), m_name); break;
1816 case 3: msg_format(_("%sをぶった斬った!", "You maim %s!"), m_name); break;
1817 case 4: msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), m_name); break;
1818 case 5: msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), m_name); break;
1819 case 6: msg_format(_("%sを刺身にした!", "You smite %s!"), m_name); break;
1820 case 7: msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), m_name); break;
1821 default: msg_format(_("%sを細切れにした!", "You shred %s!"), m_name); break;
1824 drain_result = drain_result * 3 / 2;
1828 drain_result += o_ptr->to_d;
1831 /* Apply the player damage bonuses */
1832 k += attacker_ptr->to_d[hand];
1833 drain_result += attacker_ptr->to_d[hand];
1835 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
1836 if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(m_ptr->r_idx)) k = 0;
1837 if ((mode == HISSATSU_SEKIRYUKA) && !attacker_ptr->cut) k /= 2;
1839 /* No negative damage */
1842 if ((mode == HISSATSU_ZANMA) && !(!monster_living(m_ptr->r_idx) && (r_ptr->flags3 & RF3_EVIL)))
1849 msg_print(_("こんな軟らかいものは切れん!", "You cannot cut such a elastic thing!"));
1855 msg_print(_("蜘蛛は苦手だ!", "Spiders are difficult for you to deal with!"));
1859 if (mode == HISSATSU_MINEUCHI)
1861 int tmp = (10 + randint1(15) + attacker_ptr->lev / 5);
1864 anger_monster(m_ptr);
1866 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
1869 if (MON_STUNNED(m_ptr))
1871 msg_format(_("%sはひどくもうろうとした。", "%s is more dazed."), m_name);
1876 msg_format(_("%s はもうろうとした。", "%s is dazed."), m_name);
1880 (void)set_monster_stunned(g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
1884 msg_format(_("%s には効果がなかった。", "%s is not effected."), m_name);
1888 /* Modify the damage */
1889 k = mon_damage_mod(attacker_ptr, m_ptr, k, (bool)(((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) || ((attacker_ptr->pclass == CLASS_BERSERKER) && one_in_(2))));
1890 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) || (mode == HISSATSU_KYUSHO))
1892 if ((randint1(randint1(r_ptr->level / 7) + 5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
1895 msg_format(_("%sの急所を突き刺した!", "You hit %s on a fatal spot!"), m_name);
1899 else if ((attacker_ptr->pclass == CLASS_NINJA) && has_melee_weapon(attacker_ptr, INVEN_RARM + hand) && !attacker_ptr->icky_wield[hand] && ((attacker_ptr->cur_lite <= 0) || one_in_(7)))
1901 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
1902 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
1906 msg_format(_("刃が%sに深々と突き刺さった!", "You critically injured %s!"), m_name);
1908 else if (((m_ptr->hp < maxhp / 2) && one_in_((attacker_ptr->num_blow[0] + attacker_ptr->num_blow[1] + 1) * 10)) || ((one_in_(666) || ((backstab || fuiuchi) && one_in_(11))) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)))
1910 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp / 2))
1912 k = MAX(k * 5, m_ptr->hp / 2);
1914 msg_format(_("%sに致命傷を負わせた!", "You fatally injured %s!"), m_name);
1919 msg_format(_("刃が%sの急所を貫いた!", "You hit %s on a fatal spot!"), m_name);
1924 msg_format_wizard(CHEAT_MONSTER,
1925 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), k,
1926 m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
1928 if (k <= 0) can_drain = FALSE;
1930 if (drain_result > m_ptr->hp)
1931 drain_result = m_ptr->hp;
1933 /* Damage, check for fear and death */
1934 if (mon_take_hit(attacker_ptr, g_ptr->m_idx, k, fear, NULL))
1937 if ((attacker_ptr->pclass == CLASS_BERSERKER) && attacker_ptr->energy_use)
1939 if (attacker_ptr->migite && attacker_ptr->hidarite)
1941 if (hand) attacker_ptr->energy_use = attacker_ptr->energy_use * 3 / 5 + attacker_ptr->energy_use*num * 2 / (attacker_ptr->num_blow[hand] * 5);
1942 else attacker_ptr->energy_use = attacker_ptr->energy_use*num * 3 / (attacker_ptr->num_blow[hand] * 5);
1946 attacker_ptr->energy_use = attacker_ptr->energy_use*num / attacker_ptr->num_blow[hand];
1949 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
1950 msg_print(_("またつまらぬものを斬ってしまった...", "Sigh... Another trifling thing I've cut...."));
1954 /* Anger the monster */
1955 if (k > 0) anger_monster(m_ptr);
1957 touch_zap_player(m_ptr, attacker_ptr);
1959 /* Are we draining it? A little note: If the monster is
1960 dead, the drain does not work... */
1962 if (can_drain && (drain_result > 0))
1964 if (o_ptr->name1 == ART_MURAMASA)
1968 HIT_PROB to_h = o_ptr->to_h;
1969 HIT_POINT to_d = o_ptr->to_d;
1973 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
1977 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
1980 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
1982 msg_print(_("妖刀は血を吸って強くなった!", "Muramasa sucked blood, and became more powerful!"));
1990 if (drain_result > 5) /* Did we really hurt it? */
1992 drain_heal = damroll(2, drain_result / 6);
1994 if (hex_spelling(HEX_VAMP_BLADE)) drain_heal *= 2;
1998 msg_format(_("Draining left: %d", "Draining left: %d"), drain_left);
2003 if (drain_heal < drain_left)
2005 drain_left -= drain_heal;
2009 drain_heal = drain_left;
2015 msg_format(_("刃が%sから生命力を吸い取った!", "Your weapon drains life from %s!"), m_name);
2019 drain_heal = (drain_heal * attacker_ptr->mutant_regenerate_mod) / 100;
2021 hp_player(attacker_ptr, drain_heal);
2022 /* We get to keep some of it! */
2027 m_ptr->maxhp -= (k + 7) / 8;
2028 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2029 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
2036 /* Confusion attack */
2037 if ((attacker_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(HEX_CONFUSION))
2039 /* Cancel glowing hands */
2040 if (attacker_ptr->special_attack & ATTACK_CONFUSE)
2042 attacker_ptr->special_attack &= ~(ATTACK_CONFUSE);
2043 msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
2044 attacker_ptr->redraw |= (PR_STATUS);
2048 /* Confuse the monster */
2049 if (r_ptr->flags3 & RF3_NO_CONF)
2051 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
2052 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2055 else if (randint0(100) < r_ptr->level)
2057 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2061 msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name);
2062 (void)set_monster_confused(g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(attacker_ptr->lev) / 5);
2066 else if (chaos_effect == 4)
2068 bool resists_tele = FALSE;
2070 if (r_ptr->flagsr & RFR_RES_TELE)
2072 if (r_ptr->flags1 & RF1_UNIQUE)
2074 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2075 msg_format(_("%^sには効果がなかった。", "%^s is unaffected!"), m_name);
2076 resists_tele = TRUE;
2078 else if (r_ptr->level > randint1(100))
2080 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2081 msg_format(_("%^sは抵抗力を持っている!", "%^s resists!"), m_name);
2082 resists_tele = TRUE;
2088 msg_format(_("%^sは消えた!", "%^s disappears!"), m_name);
2089 teleport_away(attacker_ptr, g_ptr->m_idx, 50, TELEPORT_PASSIVE);
2090 num = num_blow + 1; /* Can't hit it anymore! */
2095 else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
2097 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
2098 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
2100 if (polymorph_monster(attacker_ptr, y, x))
2102 msg_format(_("%^sは変化した!", "%^s changes!"), m_name);
2108 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2111 /* Hack -- Get new monster */
2112 m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
2114 /* Oops, we need a different name... */
2115 monster_desc(m_name, m_ptr, 0);
2117 /* Hack -- Get new race */
2118 r_ptr = &r_info[m_ptr->r_idx];
2121 else if (o_ptr->name1 == ART_G_HAMMER)
2123 monster_type *target_ptr = &floor_ptr->m_list[g_ptr->m_idx];
2125 if (target_ptr->hold_o_idx)
2127 object_type *q_ptr = &floor_ptr->o_list[target_ptr->hold_o_idx];
2128 GAME_TEXT o_name[MAX_NLEN];
2130 object_desc(o_name, q_ptr, OD_NAME_ONLY);
2131 q_ptr->held_m_idx = 0;
2132 q_ptr->marked = OM_TOUCHED;
2133 target_ptr->hold_o_idx = q_ptr->next_o_idx;
2134 q_ptr->next_o_idx = 0;
2135 msg_format(_("%sを奪った。", "You snatched %s."), o_name);
2136 inven_carry(attacker_ptr, q_ptr);
2144 if (weak && !(*mdeath))
2146 msg_format(_("%sは弱くなったようだ。", "%^s seems weakened."), m_name);
2149 if ((drain_left != MAX_VAMPIRIC_DRAIN) && one_in_(4))
2151 chg_virtue(attacker_ptr, V_UNLIFE, 1);
2155 k -- apply earthquake brand */
2158 earthquake(attacker_ptr, attacker_ptr->y, attacker_ptr->x, 10, 0);
2159 if (!floor_ptr->grid_array[y][x].m_idx) *mdeath = TRUE;
2165 * @brief プレイヤーの打撃処理メインルーチン
2168 * @param mode 発動中の剣術ID
2169 * @return 実際に攻撃処理が行われた場合TRUEを返す。
2171 * If no "weapon" is available, then "punch" the monster one time.
2173 bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_IDX mode)
2175 grid_type *g_ptr = &attacker_ptr->current_floor_ptr->grid_array[y][x];
2176 monster_type *m_ptr = &attacker_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2177 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2178 GAME_TEXT m_name[MAX_NLEN];
2180 disturb(attacker_ptr, FALSE, TRUE);
2182 take_turn(attacker_ptr, 100);
2184 if (!attacker_ptr->migite && !attacker_ptr->hidarite &&
2185 !(attacker_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
2187 msg_format(_("%s攻撃できない。", "You cannot do attacking."),
2188 (empty_hands(attacker_ptr, FALSE) == EMPTY_HAND_NONE) ? _("両手がふさがって", "") : "");
2192 monster_desc(m_name, m_ptr, 0);
2196 /* Auto-Recall if possible and visible */
2197 if (!attacker_ptr->image) monster_race_track(attacker_ptr, m_ptr->ap_r_idx);
2199 health_track(attacker_ptr, g_ptr->m_idx);
2202 if ((r_ptr->flags1 & RF1_FEMALE) &&
2203 !(attacker_ptr->stun || attacker_ptr->confused || attacker_ptr->image || !m_ptr->ml))
2205 if ((attacker_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (attacker_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
2207 msg_print(_("拙者、おなごは斬れぬ!", "I can not attack women!"));
2212 if (d_info[attacker_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
2214 msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
2218 /* Stop if friendly */
2219 bool stormbringer = FALSE;
2220 if (!is_hostile(m_ptr) &&
2221 !(attacker_ptr->stun || attacker_ptr->confused || attacker_ptr->image ||
2222 attacker_ptr->shero || !m_ptr->ml))
2224 if (attacker_ptr->inventory_list[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2225 if (attacker_ptr->inventory_list[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2228 msg_format(_("黒い刃は強欲に%sを攻撃した!", "Your black blade greedily attacks %s!"), m_name);
2229 chg_virtue(attacker_ptr, V_INDIVIDUALISM, 1);
2230 chg_virtue(attacker_ptr, V_HONOUR, -1);
2231 chg_virtue(attacker_ptr, V_JUSTICE, -1);
2232 chg_virtue(attacker_ptr, V_COMPASSION, -1);
2234 else if (attacker_ptr->pclass != CLASS_BERSERKER)
2236 if (get_check(_("本当に攻撃しますか?", "Really hit it? ")))
2238 chg_virtue(attacker_ptr, V_INDIVIDUALISM, 1);
2239 chg_virtue(attacker_ptr, V_HONOUR, -1);
2240 chg_virtue(attacker_ptr, V_JUSTICE, -1);
2241 chg_virtue(attacker_ptr, V_COMPASSION, -1);
2245 msg_format(_("%sを攻撃するのを止めた。", "You stop to avoid hitting %s."), m_name);
2251 /* Handle player fear */
2252 if (attacker_ptr->afraid)
2255 msg_format(_("恐くて%sを攻撃できない!", "You are too afraid to attack %s!"), m_name);
2257 msg_format(_("そっちには何か恐いものがいる!", "There is something scary in your way!"));
2259 /* Disturb the monster */
2260 (void)set_monster_csleep(g_ptr->m_idx, 0);
2265 if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
2267 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(attacker_ptr, V_COMPASSION, -1);
2268 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(attacker_ptr, V_HONOUR, -1);
2271 if (attacker_ptr->migite && attacker_ptr->hidarite)
2273 if ((attacker_ptr->skill_exp[GINOU_NITOURYU] < s_info[attacker_ptr->pclass].s_max[GINOU_NITOURYU]) && ((attacker_ptr->skill_exp[GINOU_NITOURYU] - 1000) / 200 < r_ptr->level))
2275 if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
2276 attacker_ptr->skill_exp[GINOU_NITOURYU] += 80;
2277 else if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
2278 attacker_ptr->skill_exp[GINOU_NITOURYU] += 4;
2279 else if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
2280 attacker_ptr->skill_exp[GINOU_NITOURYU] += 1;
2281 else if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
2282 if (one_in_(3)) attacker_ptr->skill_exp[GINOU_NITOURYU] += 1;
2283 attacker_ptr->update |= (PU_BONUS);
2287 /* Gain riding experience */
2288 if (attacker_ptr->riding)
2290 int cur = attacker_ptr->skill_exp[GINOU_RIDING];
2291 int max = s_info[attacker_ptr->pclass].s_max[GINOU_RIDING];
2295 DEPTH ridinglevel = r_info[attacker_ptr->current_floor_ptr->m_list[attacker_ptr->riding].r_idx].level;
2296 DEPTH targetlevel = r_ptr->level;
2299 if ((cur / 200 - 5) < targetlevel)
2302 /* Extra experience */
2303 if ((cur / 100) < ridinglevel)
2305 if ((cur / 100 + 15) < ridinglevel)
2306 inc += 1 + (ridinglevel - (cur / 100 + 15));
2311 attacker_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
2312 attacker_ptr->update |= (PU_BONUS);
2316 attacker_ptr->riding_t_m_idx = g_ptr->m_idx;
2318 bool mdeath = FALSE;
2319 if (attacker_ptr->migite) py_attack_aux(attacker_ptr, y, x, &fear, &mdeath, 0, mode);
2320 if (attacker_ptr->hidarite && !mdeath) py_attack_aux(attacker_ptr, y, x, &fear, &mdeath, 1, mode);
2322 /* Mutations which yield extra 'natural' attacks */
2325 if ((attacker_ptr->muta2 & MUT2_HORNS) && !mdeath)
2326 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
2327 if ((attacker_ptr->muta2 & MUT2_BEAK) && !mdeath)
2328 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
2329 if ((attacker_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
2330 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
2331 if ((attacker_ptr->muta2 & MUT2_TRUNK) && !mdeath)
2332 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
2333 if ((attacker_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
2334 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
2337 /* Hack -- delay fear messages */
2338 if (fear && m_ptr->ml && !mdeath)
2342 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2345 if ((attacker_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
2347 set_action(attacker_ptr, ACTION_NONE);
2355 * @brief モンスターからプレイヤーへの打撃処理 / Attack the player via physical attacks.
2356 * @param m_idx 打撃を行うモンスターのID
2357 * @return 実際に攻撃処理を行った場合TRUEを返す
2359 bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
2361 floor_type *floor_ptr = target_ptr->current_floor_ptr;
2362 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
2363 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2368 int do_cut, do_stun;
2372 GAME_TEXT o_name[MAX_NLEN];
2373 GAME_TEXT m_name[MAX_NLEN];
2374 GAME_TEXT ddesc[80];
2377 bool touched = FALSE, fear = FALSE, alive = TRUE;
2378 bool explode = FALSE;
2379 bool do_silly_attack = (one_in_(2) && target_ptr->image);
2380 HIT_POINT get_damage = 0;
2381 int abbreviate = 0; // 2回目以降の省略表現フラグ
2383 /* Not allowed to attack */
2384 if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return FALSE;
2386 if (d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return FALSE;
2388 /* ...nor if friendly */
2389 if (!is_hostile(m_ptr)) return FALSE;
2391 /* Extract the effective monster level */
2392 rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
2394 /* Get the monster name (or "it") */
2395 monster_desc(m_name, m_ptr, 0);
2397 monster_desc(ddesc, m_ptr, MD_WRONGDOER_NAME);
2399 if (target_ptr->special_defense & KATA_IAI)
2401 msg_format(_("相手が襲いかかる前に素早く武器を振るった。", "You took sen, draw and cut in one motion before %s moved."), m_name);
2402 if (py_attack(target_ptr, m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
2405 if ((target_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (target_ptr->lev*3/5+20)))
2407 if (kawarimi(target_ptr, TRUE)) return TRUE;
2410 /* Assume no blink */
2413 /* Scan through all four blows */
2414 for (int ap_cnt = 0; ap_cnt < 4; ap_cnt++)
2416 bool obvious = FALSE;
2418 HIT_POINT power = 0;
2419 HIT_POINT damage = 0;
2423 /* Extract the attack infomation */
2424 int effect = r_ptr->blow[ap_cnt].effect;
2425 int method = r_ptr->blow[ap_cnt].method;
2426 int d_dice = r_ptr->blow[ap_cnt].d_dice;
2427 int d_side = r_ptr->blow[ap_cnt].d_side;
2429 if (!monster_is_valid(m_ptr)) break;
2431 /* Hack -- no more attacks */
2434 if (is_pet(m_ptr) && (r_ptr->flags1 & RF1_UNIQUE) && (method == RBM_EXPLODE))
2440 /* Stop if player is dead or gone */
2441 if (!target_ptr->playing || target_ptr->is_dead) break;
2442 if (distance(target_ptr->y, target_ptr->x, m_ptr->fy, m_ptr->fx) > 1) break;
2444 /* Handle "leaving" */
2445 if (target_ptr->leaving) break;
2447 if (method == RBM_SHOOT) continue;
2449 /* Extract the attack "power" */
2450 power = mbe_info[effect].power;
2453 ac = target_ptr->ac + target_ptr->to_a;
2455 /* Monster hits player */
2456 if (!effect || check_hit(target_ptr, power, rlev, MON_STUNNED(m_ptr)))
2458 /* Always disturbing */
2459 disturb(target_ptr, TRUE, TRUE);
2462 /* Hack -- Apply "protection from evil" */
2463 if ((target_ptr->protevil > 0) &&
2464 (r_ptr->flags3 & RF3_EVIL) &&
2465 (target_ptr->lev >= rlev) &&
2466 ((randint0(100) + target_ptr->lev) > 50))
2468 /* Remember the Evil-ness */
2469 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2472 if (abbreviate) msg_format("撃退した。");
2473 else msg_format("%^sは撃退された。", m_name);
2474 abbreviate = 1; /*2回目以降は省略 */
2476 msg_format("%^s is repelled.", m_name);
2482 /* Assume no cut or stun */
2483 do_cut = do_stun = 0;
2485 /* Describe the attack method */
2490 act = _("殴られた。", "hits you.");
2491 do_cut = do_stun = 1;
2499 act = _("触られた。", "touches you.");
2507 act = _("パンチされた。", "punches you.");
2516 act = _("蹴られた。", "kicks you.");
2525 act = _("ひっかかれた。", "claws you.");
2534 act = _("噛まれた。", "bites you.");
2543 act = _("刺された。", "stings you.");
2551 act = _("斬られた。", "slashes you.");
2560 act = _("角で突かれた。", "butts you.");
2569 act = _("体当たりされた。", "crushes you.");
2578 act = _("飲み込まれた。", "engulfs you.");
2587 act = _("は請求書をよこした。", "charges you.");
2589 sound(SOUND_BUY); /* Note! This is "charges", not "charges at". */
2596 act = _("が体の上を這い回った。", "crawls on you.");
2604 act = _("よだれをたらされた。", "drools on you.");
2611 act = _("唾を吐かれた。", "spits on you.");
2619 act = _("は爆発した。", "explodes.");
2626 act = _("にらまれた。", "gazes at you.");
2632 act = _("泣き叫ばれた。", "wails at you.");
2639 act = _("胞子を飛ばされた。", "releases spores at you.");
2647 act = _("が XXX4 を発射した。", "projects XXX4's at you.");
2653 act = _("金をせがまれた。", "begs you for money.");
2663 act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
2673 act = desc_moan[randint0(4)];
2683 if (m_ptr->r_idx == MON_JAIAN)
2686 switch(randint1(15))
2691 act = "「♪お~れはジャイアン~~ガ~キだいしょう~」";
2694 act = "「♪て~んかむ~てきのお~とこだぜ~~」";
2697 act = "「♪の~び太スネ夫はメじゃないよ~~」";
2700 act = "「♪け~んかスポ~ツ~どんとこい~」";
2703 act = "「♪うた~も~~う~まいぜ~まかしとけ~」";
2706 act = "「♪ま~ちいちば~んのに~んきもの~~」";
2709 act = "「♪べんきょうしゅくだいメじゃないよ~~」";
2712 act = "「♪きはやさし~くて~ち~からもち~」";
2715 act = "「♪かお~も~~スタイルも~バツグンさ~」";
2718 act = "「♪がっこうい~ちの~あ~ばれんぼう~~」";
2721 act = "「♪ド~ラもドラミもメじゃないよ~~」";
2724 act = "「♪よじげんぽけっと~な~くたって~」";
2727 act = "「♪あし~の~~ながさ~は~まけないぜ~」";
2731 act = "horribly sings 'I AM GIAAAAAN. THE BOOOSS OF THE KIIIIDS.'";
2737 act = _("は♪僕らは楽しい家族♪と歌っている。", "sings 'We are a happy family.'");
2739 act = _("は♪アイ ラブ ユー、ユー ラブ ミー♪と歌っている。", "sings 'I love you, you love me.'");
2749 if (do_silly_attack)
2754 act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
2757 if (abbreviate == 0)
2758 msg_format("%^sに%s", m_name, act);
2759 else if (abbreviate == 1)
2760 msg_format("%s", act);
2761 else /* if (abbreviate == -1) */
2762 msg_format("%^s%s", m_name, act);
2763 abbreviate = 1;/*2回目以降は省略 */
2765 msg_format("%^s %s%s", m_name, act, do_silly_attack ? " you." : "");
2769 /* Hack -- assume all attacks are obvious */
2772 /* Roll out the damage */
2773 damage = damroll(d_dice, d_side);
2776 * Skip the effect when exploding, since the explosion
2777 * already causes the effect.
2779 if(explode) damage = 0;
2780 /* Apply appropriate damage */
2790 case RBE_SUPERHURT: /* AC軽減あり / Player armor reduces total damage */
2792 if (((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) && !CHECK_MULTISHADOW(target_ptr))
2794 int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
2795 msg_print(_("痛恨の一撃!", "It was a critical hit!"));
2796 tmp_damage = MAX(damage, tmp_damage*2);
2798 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, tmp_damage, ddesc, -1);
2802 case RBE_HURT: /* AC軽減あり / Player armor reduces total damage */
2805 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
2806 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2814 /* Take "poison" effect */
2815 if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)) && !CHECK_MULTISHADOW(target_ptr))
2817 if (set_poisoned(target_ptr, target_ptr->poisoned + randint1(rlev) + 5))
2823 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2825 /* Learn about the player */
2826 update_smart_learn(m_idx, DRS_POIS);
2835 /* Allow complete resist */
2836 if (!target_ptr->resist_disen && !CHECK_MULTISHADOW(target_ptr))
2838 /* Apply disenchantment */
2839 if (apply_disenchant(target_ptr, 0))
2841 /* Hack -- Update AC */
2842 update_creature(target_ptr);
2847 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2849 /* Learn about the player */
2850 update_smart_learn(m_idx, DRS_DISEN);
2857 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2859 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
2862 for (k = 0; k < 10; k++)
2865 INVENTORY_IDX i = (INVENTORY_IDX)randint0(INVEN_PACK);
2867 /* Obtain the item */
2868 o_ptr = &target_ptr->inventory_list[i];
2869 if (!o_ptr->k_idx) continue;
2871 /* Drain charged wands/staffs */
2872 if (((o_ptr->tval == TV_STAFF) ||
2873 (o_ptr->tval == TV_WAND)) &&
2876 /* Calculate healed hitpoints */
2877 int heal=rlev * o_ptr->pval;
2878 if( o_ptr->tval == TV_STAFF)
2879 heal *= o_ptr->number;
2881 /* Don't heal more than max hp */
2882 heal = MIN(heal, m_ptr->maxhp - m_ptr->hp);
2884 msg_print(_("ザックからエネルギーが吸い取られた!", "Energy drains from your pack!"));
2888 /* Heal the monster */
2889 m_ptr->hp += (HIT_POINT)heal;
2891 /* Redraw (later) if needed */
2892 if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
2893 if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
2898 /* Combine / Reorder the pack */
2899 target_ptr->update |= (PU_COMBINE | PU_REORDER);
2900 target_ptr->window |= (PW_INVEN);
2911 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2913 /* Confused monsters cannot steal successfully. -LM-*/
2914 if (MON_CONFUSED(m_ptr)) break;
2916 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
2920 /* Saving throw (unless paralyzed) based on dex and level */
2921 if (!target_ptr->paralyzed &&
2922 (randint0(100) < (adj_dex_safe[target_ptr->stat_ind[A_DEX]] +
2925 /* Saving throw message */
2926 msg_print(_("しかし素早く財布を守った!", "You quickly protect your money pouch!"));
2928 /* Occasional blink anyway */
2929 if (randint0(3)) blinked = TRUE;
2935 gold = (target_ptr->au / 10) + randint1(25);
2936 if (gold < 2) gold = 2;
2937 if (gold > 5000) gold = (target_ptr->au / 20) + randint1(3000);
2938 if (gold > target_ptr->au) gold = target_ptr->au;
2939 target_ptr->au -= gold;
2942 msg_print(_("しかし何も盗まれなかった。", "Nothing was stolen."));
2944 else if (target_ptr->au)
2946 msg_print(_("財布が軽くなった気がする。", "Your purse feels lighter."));
2947 msg_format(_("$%ld のお金が盗まれた!", "%ld coins were stolen!"), (long)gold);
2948 chg_virtue(target_ptr, V_SACRIFICE, 1);
2952 msg_print(_("財布が軽くなった気がする。", "Your purse feels lighter."));
2953 msg_print(_("お金が全部盗まれた!", "All of your coins were stolen!"));
2954 chg_virtue(target_ptr, V_SACRIFICE, 2);
2958 target_ptr->redraw |= (PR_GOLD);
2960 target_ptr->window |= (PW_PLAYER);
2971 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2973 /* Confused monsters cannot steal successfully. -LM-*/
2974 if (MON_CONFUSED(m_ptr)) break;
2976 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
2978 /* Saving throw (unless paralyzed) based on dex and level */
2979 if (!target_ptr->paralyzed && (randint0(100) < (adj_dex_safe[target_ptr->stat_ind[A_DEX]] + target_ptr->lev)))
2981 /* Saving throw message */
2982 msg_print(_("しかしあわててザックを取り返した!", "You grab hold of your backpack!"));
2984 /* Occasional "blink" anyway */
2991 for (k = 0; k < 10; k++)
2996 INVENTORY_IDX i = (INVENTORY_IDX)randint0(INVEN_PACK);
2998 /* Obtain the item */
2999 o_ptr = &target_ptr->inventory_list[i];
3000 if (!o_ptr->k_idx) continue;
3002 /* Skip artifacts */
3003 if (object_is_artifact(o_ptr)) continue;
3005 object_desc(o_name, o_ptr, OD_OMIT_PREFIX);
3008 msg_format("%s(%c)を%s盗まれた!", o_name, index_to_label(i), ((o_ptr->number > 1) ? "一つ" : ""));
3010 msg_format("%sour %s (%c) was stolen!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
3012 chg_virtue(target_ptr, V_SACRIFICE, 1);
3013 o_idx = o_pop(floor_ptr);
3019 j_ptr = &floor_ptr->o_list[o_idx];
3020 object_copy(j_ptr, o_ptr);
3025 /* Hack -- If a rod or wand, allocate total
3026 * maximum timeouts or charges between those
3027 * stolen and those missed. -LM-
3029 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3031 j_ptr->pval = o_ptr->pval / o_ptr->number;
3032 o_ptr->pval -= j_ptr->pval;
3036 j_ptr->marked = OM_TOUCHED;
3038 /* Memorize monster */
3039 j_ptr->held_m_idx = m_idx;
3042 j_ptr->next_o_idx = m_ptr->hold_o_idx;
3045 m_ptr->hold_o_idx = o_idx;
3048 /* Steal the items */
3049 inven_item_increase(target_ptr, i, -1);
3050 inven_item_optimize(target_ptr, i);
3065 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3067 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3069 /* Steal some food */
3070 for (k = 0; k < 10; k++)
3072 /* Pick an item from the pack */
3073 INVENTORY_IDX i = (INVENTORY_IDX)randint0(INVEN_PACK);
3075 o_ptr = &target_ptr->inventory_list[i];
3076 if (!o_ptr->k_idx) continue;
3078 /* Skip non-food objects */
3079 if ((o_ptr->tval != TV_FOOD) && !((o_ptr->tval == TV_CORPSE) && (o_ptr->sval))) continue;
3081 object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3084 msg_format("%s(%c)を%s食べられてしまった!", o_name, index_to_label(i), ((o_ptr->number > 1) ? "一つ" : ""));
3086 msg_format("%sour %s (%c) was eaten!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
3089 /* Steal the items */
3090 inven_item_increase(target_ptr, i, -1);
3091 inven_item_optimize(target_ptr, i);
3103 /* Access the lite */
3104 o_ptr = &target_ptr->inventory_list[INVEN_LITE];
3105 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3107 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3110 if ((o_ptr->xtra4 > 0) && (!object_is_fixed_artifact(o_ptr)))
3113 o_ptr->xtra4 -= (s16b)(250 + randint1(250));
3114 if (o_ptr->xtra4 < 1) o_ptr->xtra4 = 1;
3116 if (!target_ptr->blind)
3118 msg_print(_("明かりが暗くなってしまった。", "Your light dims."));
3122 target_ptr->window |= (PW_EQUIP);
3132 msg_print(_("酸を浴びせられた!", "You are covered in acid!"));
3133 get_damage += acid_dam(target_ptr, damage, ddesc, -1, FALSE);
3134 update_creature(target_ptr);
3135 update_smart_learn(m_idx, DRS_ACID);
3143 msg_print(_("電撃を浴びせられた!", "You are struck by electricity!"));
3144 get_damage += elec_dam(target_ptr, damage, ddesc, -1, FALSE);
3145 update_smart_learn(m_idx, DRS_ELEC);
3153 msg_print(_("全身が炎に包まれた!", "You are enveloped in flames!"));
3154 get_damage += fire_dam(target_ptr, damage, ddesc, -1, FALSE);
3155 update_smart_learn(m_idx, DRS_FIRE);
3163 msg_print(_("全身が冷気で覆われた!", "You are covered with frost!"));
3164 get_damage += cold_dam(target_ptr, damage, ddesc, -1, FALSE);
3165 update_smart_learn(m_idx, DRS_COLD);
3171 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3172 if (target_ptr->is_dead) break;
3174 /* Increase "blind" */
3175 if (!target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
3177 if (set_blind(target_ptr, target_ptr->blind + 10 + randint1(rlev)))
3180 if (m_ptr->r_idx == MON_DIO) msg_print("どうだッ!この血の目潰しはッ!");
3188 /* Learn about the player */
3189 update_smart_learn(m_idx, DRS_BLIND);
3197 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3199 if (target_ptr->is_dead) break;
3201 /* Increase "confused" */
3202 if (!target_ptr->resist_conf && !CHECK_MULTISHADOW(target_ptr))
3204 if (set_confused(target_ptr, target_ptr->confused + 3 + randint1(rlev)))
3210 /* Learn about the player */
3211 update_smart_learn(m_idx, DRS_CONF);
3218 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3220 if (target_ptr->is_dead) break;
3222 /* Increase "afraid" */
3223 if (CHECK_MULTISHADOW(target_ptr))
3227 else if (target_ptr->resist_fear)
3229 msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
3232 else if (randint0(100 + r_ptr->level/2) < target_ptr->skill_sav)
3234 msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
3239 if (set_afraid(target_ptr, target_ptr->afraid + 3 + randint1(rlev)))
3245 /* Learn about the player */
3246 update_smart_learn(m_idx, DRS_FEAR);
3253 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3255 if (target_ptr->is_dead) break;
3257 /* Increase "paralyzed" */
3258 if (CHECK_MULTISHADOW(target_ptr))
3262 else if (target_ptr->free_act)
3264 msg_print(_("しかし効果がなかった!", "You are unaffected!"));
3267 else if (randint0(100 + r_ptr->level/2) < target_ptr->skill_sav)
3269 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
3274 if (!target_ptr->paralyzed)
3276 if (set_paralyzed(target_ptr, 3 + randint1(rlev)))
3283 /* Learn about the player */
3284 update_smart_learn(m_idx, DRS_FREE);
3291 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3293 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3294 if (do_dec_stat(target_ptr, A_STR)) obvious = TRUE;
3301 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3303 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3304 if (do_dec_stat(target_ptr, A_INT)) obvious = TRUE;
3311 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3313 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3314 if (do_dec_stat(target_ptr, A_WIS)) obvious = TRUE;
3321 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3323 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3324 if (do_dec_stat(target_ptr, A_DEX)) obvious = TRUE;
3331 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3333 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3334 if (do_dec_stat(target_ptr, A_CON)) obvious = TRUE;
3341 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3343 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3344 if (do_dec_stat(target_ptr, A_CHR)) obvious = TRUE;
3351 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3353 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3355 /* Damage (stats) */
3356 if (do_dec_stat(target_ptr, A_STR)) obvious = TRUE;
3357 if (do_dec_stat(target_ptr, A_DEX)) obvious = TRUE;
3358 if (do_dec_stat(target_ptr, A_CON)) obvious = TRUE;
3359 if (do_dec_stat(target_ptr, A_INT)) obvious = TRUE;
3360 if (do_dec_stat(target_ptr, A_WIS)) obvious = TRUE;
3361 if (do_dec_stat(target_ptr, A_CHR)) obvious = TRUE;
3370 /* Hack -- Reduce damage based on the player armor class */
3371 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
3373 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3375 /* Radius 8 earthquake centered at the monster */
3376 if (damage > 23 || explode)
3378 earthquake(target_ptr, m_ptr->fy, m_ptr->fx, 8, m_idx);
3386 s32b d = damroll(10, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3390 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3392 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3394 (void)drain_exp(target_ptr, d, d / 10, 95);
3400 s32b d = damroll(20, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3404 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3406 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3408 (void)drain_exp(target_ptr, d, d / 10, 90);
3414 s32b d = damroll(40, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3418 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3420 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3422 (void)drain_exp(target_ptr, d, d / 10, 75);
3428 s32b d = damroll(80, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3432 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3434 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3436 (void)drain_exp(target_ptr, d, d / 10, 50);
3442 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3444 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3446 /* Take "poison" effect */
3447 if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)))
3449 if (set_poisoned(target_ptr, target_ptr->poisoned + randint1(rlev) + 5))
3455 /* Damage CON (10% chance)*/
3456 if ((randint1(100) < 11) && (target_ptr->prace != RACE_ANDROID))
3458 /* 1% chance for perm. damage */
3459 bool perm = one_in_(10);
3460 if (dec_stat(target_ptr, A_CON, randint1(10), perm))
3462 msg_print(_("病があなたを蝕んでいる気がする。", "You feel strange sickness."));
3472 if (!target_ptr->resist_time && !CHECK_MULTISHADOW(target_ptr))
3474 switch (randint1(10))
3476 case 1: case 2: case 3: case 4: case 5:
3478 if (target_ptr->prace == RACE_ANDROID) break;
3479 msg_print(_("人生が逆戻りした気がする。", "You feel life has clocked back."));
3480 lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
3484 case 6: case 7: case 8: case 9:
3486 int stat = randint0(6);
3491 case A_STR: act = "強く"; break;
3492 case A_INT: act = "聡明で"; break;
3493 case A_WIS: act = "賢明で"; break;
3494 case A_DEX: act = "器用で"; break;
3495 case A_CON: act = "健康で"; break;
3496 case A_CHR: act = "美しく"; break;
3498 case A_STR: act = "strong"; break;
3499 case A_INT: act = "bright"; break;
3500 case A_WIS: act = "wise"; break;
3501 case A_DEX: act = "agile"; break;
3502 case A_CON: act = "hale"; break;
3503 case A_CHR: act = "beautiful"; break;
3508 msg_format(_("あなたは以前ほど%sなくなってしまった...。", "You're not as %s as you used to be..."), act);
3509 target_ptr->stat_cur[stat] = (target_ptr->stat_cur[stat] * 3) / 4;
3510 if (target_ptr->stat_cur[stat] < 3) target_ptr->stat_cur[stat] = 3;
3511 target_ptr->update |= (PU_BONUS);
3517 msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
3519 for (k = 0; k < A_MAX; k++)
3521 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
3522 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
3524 target_ptr->update |= (PU_BONUS);
3529 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3535 s32b d = damroll(60, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3540 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3542 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3544 resist_drain = !drain_exp(target_ptr, d, d / 10, 50);
3546 /* Heal the attacker? */
3547 if (target_ptr->mimic_form)
3549 if (mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)
3550 resist_drain = TRUE;
3554 switch (target_ptr->prace)
3563 resist_drain = TRUE;
3568 if ((damage > 5) && !resist_drain)
3570 bool did_heal = FALSE;
3572 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
3575 m_ptr->hp += damroll(4, damage / 6);
3576 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3578 /* Redraw (later) if needed */
3579 if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
3580 if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
3582 /* Special message */
3583 if (m_ptr->ml && did_heal)
3585 msg_format(_("%sは体力を回復したようだ。", "%^s appears healthier."), m_name);
3595 if (CHECK_MULTISHADOW(target_ptr))
3597 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, you are unharmed!"));
3603 target_ptr->csp -= damage;
3604 if (target_ptr->csp < 0)
3606 target_ptr->csp = 0;
3607 target_ptr->csp_frac = 0;
3610 target_ptr->redraw |= (PR_MANA);
3613 /* Learn about the player */
3614 update_smart_learn(m_idx, DRS_MANA);
3620 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3622 if (target_ptr->is_dead) break;
3624 /* Decrease speed */
3625 if (CHECK_MULTISHADOW(target_ptr))
3631 if (set_slow(target_ptr, (target_ptr->slow + 4 + randint0(rlev / 10)), FALSE))
3641 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3643 if (target_ptr->is_dead) break;
3645 /* Decrease speed */
3646 if (target_ptr->resist_sound || CHECK_MULTISHADOW(target_ptr))
3652 if (set_stun(target_ptr, target_ptr->stun + 10 + randint1(r_ptr->level / 4)))
3662 /* Hack -- only one of cut or stun */
3663 if (do_cut && do_stun)
3666 if (randint0(100) < 50)
3683 /* Critical hit (zero if non-critical) */
3684 tmp = monster_critical(d_dice, d_side, damage);
3686 /* Roll for damage */
3689 case 0: cut_plus = 0; break;
3690 case 1: cut_plus = randint1(5); break;
3691 case 2: cut_plus = randint1(5) + 5; break;
3692 case 3: cut_plus = randint1(20) + 20; break;
3693 case 4: cut_plus = randint1(50) + 50; break;
3694 case 5: cut_plus = randint1(100) + 100; break;
3695 case 6: cut_plus = 300; break;
3696 default: cut_plus = 500; break;
3700 if (cut_plus) (void)set_cut(target_ptr,target_ptr->cut + cut_plus);
3708 /* Critical hit (zero if non-critical) */
3709 tmp = monster_critical(d_dice, d_side, damage);
3711 /* Roll for damage */
3714 case 0: stun_plus = 0; break;
3715 case 1: stun_plus = randint1(5); break;
3716 case 2: stun_plus = randint1(5) + 10; break;
3717 case 3: stun_plus = randint1(10) + 20; break;
3718 case 4: stun_plus = randint1(15) + 30; break;
3719 case 5: stun_plus = randint1(20) + 40; break;
3720 case 6: stun_plus = 80; break;
3721 default: stun_plus = 150; break;
3724 /* Apply the stun */
3725 if (stun_plus) (void)set_stun(target_ptr, target_ptr->stun + stun_plus);
3730 sound(SOUND_EXPLODE);
3732 if (mon_take_hit(target_ptr, m_idx, m_ptr->hp + 1, &fear, NULL))
3741 if (target_ptr->sh_fire && alive && !target_ptr->is_dead)
3743 if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3745 HIT_POINT dam = damroll(2, 6);
3747 /* Modify the damage */
3748 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3750 msg_format(_("%^sは突然熱くなった!", "%^s is suddenly very hot!"), m_name);
3752 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は灰の山になった。", " turns into a pile of ash.")))
3760 if (is_original_ap_and_seen(m_ptr))
3761 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
3765 if (target_ptr->sh_elec && alive && !target_ptr->is_dead)
3767 if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
3769 HIT_POINT dam = damroll(2, 6);
3771 /* Modify the damage */
3772 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3774 msg_format(_("%^sは電撃をくらった!", "%^s gets zapped!"), m_name);
3775 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は燃え殻の山になった。", " turns into a pile of cinder.")))
3783 if (is_original_ap_and_seen(m_ptr))
3784 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
3788 if (target_ptr->sh_cold && alive && !target_ptr->is_dead)
3790 if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
3792 HIT_POINT dam = damroll(2, 6);
3794 /* Modify the damage */
3795 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3797 msg_format(_("%^sは冷気をくらった!", "%^s is very cold!"), m_name);
3798 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は凍りついた。", " was frozen.")))
3806 if (is_original_ap_and_seen(m_ptr))
3807 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
3812 if (target_ptr->dustrobe && alive && !target_ptr->is_dead)
3814 if (!(r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK))
3816 HIT_POINT dam = damroll(2, 6);
3818 /* Modify the damage */
3819 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3821 msg_format(_("%^sは鏡の破片をくらった!", "%^s gets zapped!"), m_name);
3822 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("はズタズタになった。", " had torn to pieces.")))
3830 if (is_original_ap_and_seen(m_ptr))
3831 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK);
3834 if (is_mirror_grid(&floor_ptr->grid_array[target_ptr->y][target_ptr->x]))
3836 teleport_player(target_ptr, 10, 0L);
3840 if (target_ptr->tim_sh_holy && alive && !target_ptr->is_dead)
3842 if (r_ptr->flags3 & RF3_EVIL)
3844 if (!(r_ptr->flagsr & RFR_RES_ALL))
3846 HIT_POINT dam = damroll(2, 6);
3848 /* Modify the damage */
3849 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3851 msg_format(_("%^sは聖なるオーラで傷ついた!", "%^s is injured by holy power!"), m_name);
3852 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3857 if (is_original_ap_and_seen(m_ptr))
3858 r_ptr->r_flags3 |= RF3_EVIL;
3862 if (is_original_ap_and_seen(m_ptr))
3863 r_ptr->r_flagsr |= RFR_RES_ALL;
3868 if (target_ptr->tim_sh_touki && alive && !target_ptr->is_dead)
3870 if (!(r_ptr->flagsr & RFR_RES_ALL))
3872 HIT_POINT dam = damroll(2, 6);
3874 /* Modify the damage */
3875 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3877 msg_format(_("%^sが鋭い闘気のオーラで傷ついた!", "%^s is injured by the Force"), m_name);
3878 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3886 if (is_original_ap_and_seen(m_ptr))
3887 r_ptr->r_flagsr |= RFR_RES_ALL;
3891 if (hex_spelling(HEX_SHADOW_CLOAK) && alive && !target_ptr->is_dead)
3894 object_type *o_armed_ptr = &target_ptr->inventory_list[INVEN_RARM];
3896 if (!(r_ptr->flagsr & RFR_RES_ALL || r_ptr->flagsr & RFR_RES_DARK))
3898 if (o_armed_ptr->k_idx)
3900 int basedam = ((o_armed_ptr->dd + target_ptr->to_dd[0]) * (o_armed_ptr->ds + target_ptr->to_ds[0] + 1));
3901 dam = basedam / 2 + o_armed_ptr->to_d + target_ptr->to_d[0];
3904 /* Cursed armor makes damages doubled */
3905 o_armed_ptr = &target_ptr->inventory_list[INVEN_BODY];
3906 if ((o_armed_ptr->k_idx) && object_is_cursed(o_armed_ptr)) dam *= 2;
3908 /* Modify the damage */
3909 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3911 msg_format(_("影のオーラが%^sに反撃した!", "Enveloping shadows attack %^s."), m_name);
3912 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3917 else /* monster does not dead */
3920 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3921 EFFECT_ID typ[4][2] = {
3922 { INVEN_HEAD, GF_OLD_CONF },
3923 { INVEN_LARM, GF_OLD_SLEEP },
3924 { INVEN_HANDS, GF_TURN_ALL },
3925 { INVEN_FEET, GF_OLD_SLOW }
3928 /* Some cursed armours gives an extra effect */
3929 for (j = 0; j < 4; j++)
3931 o_armed_ptr = &target_ptr->inventory_list[typ[j][0]];
3932 if ((o_armed_ptr->k_idx) && object_is_cursed(o_armed_ptr) && object_is_armour(o_armed_ptr))
3933 project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, (target_ptr->lev * 2), typ[j][1], flg, -1);
3939 if (is_original_ap_and_seen(m_ptr))
3940 r_ptr->r_flagsr |= (RFR_RES_ALL | RFR_RES_DARK);
3946 /* Monster missed player */
3949 /* Analyze failed attacks */
3965 /* Visible monsters */
3968 disturb(target_ptr, TRUE, TRUE);
3972 msg_format("%sかわした。", (target_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "");
3974 msg_format("%s%^sの攻撃をかわした。", (target_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "", m_name);
3975 abbreviate = 1;/*2回目以降は省略 */
3977 msg_format("%^s misses you.", m_name);
3982 /* Gain shield experience */
3983 if (object_is_armour(&target_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&target_ptr->inventory_list[INVEN_LARM]))
3985 int cur = target_ptr->skill_exp[GINOU_SHIELD];
3986 int max = s_info[target_ptr->pclass].s_max[GINOU_SHIELD];
3990 DEPTH targetlevel = r_ptr->level;
3994 /* Extra experience */
3995 if ((cur / 100) < targetlevel)
3997 if ((cur / 100 + 15) < targetlevel)
3998 inc += 1 + (targetlevel - (cur / 100 + 15));
4003 target_ptr->skill_exp[GINOU_SHIELD] = MIN(max, cur + inc);
4004 target_ptr->update |= (PU_BONUS);
4014 /* Analyze "visible" monsters only */
4015 if (is_original_ap_and_seen(m_ptr) && !do_silly_attack)
4017 /* Count "obvious" attacks (and ones that cause damage) */
4018 if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
4020 /* Count attacks of this type */
4021 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
4023 r_ptr->r_blows[ap_cnt]++;
4028 if (target_ptr->riding && damage)
4030 char m_steed_name[MAX_NLEN];
4031 monster_desc(m_steed_name, &floor_ptr->m_list[target_ptr->riding], 0);
4032 if (rakuba(target_ptr, (damage > 200) ? 200 : damage, FALSE))
4034 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_steed_name);
4038 if (target_ptr->special_defense & NINJA_KAWARIMI)
4040 if (kawarimi(target_ptr, FALSE)) return TRUE;
4044 /* Hex - revenge damage stored */
4045 revenge_store(target_ptr, get_damage);
4047 if ((target_ptr->tim_eyeeye || hex_spelling(HEX_EYE_FOR_EYE))
4048 && get_damage > 0 && !target_ptr->is_dead)
4051 msg_format("攻撃が%s自身を傷つけた!", m_name);
4053 GAME_TEXT m_name_self[80];
4056 monster_desc(m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
4058 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
4060 project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
4061 if (target_ptr->tim_eyeeye) set_tim_eyeeye(target_ptr, target_ptr->tim_eyeeye-5, TRUE);
4064 if ((target_ptr->counter || (target_ptr->special_defense & KATA_MUSOU)) && alive && !target_ptr->is_dead && m_ptr->ml && (target_ptr->csp > 7))
4066 char m_target_name[MAX_NLEN];
4067 monster_desc(m_target_name, m_ptr, 0);
4069 target_ptr->csp -= 7;
4070 msg_format(_("%^sに反撃した!", "Your counterattacked to %s!"), m_target_name);
4071 py_attack(target_ptr, m_ptr->fy, m_ptr->fx, HISSATSU_COUNTER);
4073 target_ptr->redraw |= (PR_MANA);
4077 if (blinked && alive && !target_ptr->is_dead)
4079 if (teleport_barrier(target_ptr, m_idx))
4081 msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But magic barrier obstructs it."));
4085 msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
4086 teleport_away(target_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L);
4090 /* Always notice cause of death */
4091 if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
4096 if (m_ptr->ml && fear && alive && !target_ptr->is_dead)
4099 msg_format(_("%^sは恐怖で逃げ出した!", "%^s flees in terror!"), m_name);
4102 if (target_ptr->special_defense & KATA_IAI)
4104 set_action(target_ptr, ACTION_NONE);
4112 * @brief モンスターから敵モンスターへの打撃攻撃処理
4113 * @param m_idx 攻撃側モンスターの参照ID
4114 * @param t_idx 目標側モンスターの参照ID
4115 * @return 実際に打撃処理が行われた場合TRUEを返す
4117 bool monst_attack_monst(player_type *subject_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
4119 monster_type *m_ptr = &subject_ptr->current_floor_ptr->m_list[m_idx];
4120 monster_type *t_ptr = &subject_ptr->current_floor_ptr->m_list[t_idx];
4122 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4123 monster_race *tr_ptr = &r_info[t_ptr->r_idx];
4125 ARMOUR_CLASS ap_cnt;
4129 GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN];
4130 char temp[MAX_NLEN];
4132 bool explode = FALSE, touched = FALSE, fear = FALSE, dead = FALSE;
4133 POSITION y_saver = t_ptr->fy;
4134 POSITION x_saver = t_ptr->fx;
4137 bool see_m = is_seen(m_ptr);
4138 bool see_t = is_seen(t_ptr);
4139 bool see_either = see_m || see_t;
4141 /* Can the player be aware of this attack? */
4142 bool known = (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT);
4143 bool do_silly_attack = (one_in_(2) && subject_ptr->image);
4145 /* Cannot attack self */
4146 if (m_idx == t_idx) return FALSE;
4148 /* Not allowed to attack */
4149 if (r_ptr->flags1 & RF1_NEVER_BLOW) return FALSE;
4151 if (d_info[subject_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return FALSE;
4156 /* Extract the effective monster level */
4157 rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
4159 monster_desc(m_name, m_ptr, 0);
4160 monster_desc(t_name, t_ptr, 0);
4162 /* Assume no blink */
4165 if (!see_either && known)
4167 subject_ptr->current_floor_ptr->monster_noise = TRUE;
4170 if (subject_ptr->riding && (m_idx == subject_ptr->riding)) disturb(subject_ptr, TRUE, TRUE);
4172 /* Scan through all four blows */
4173 for (ap_cnt = 0; ap_cnt < 4; ap_cnt++)
4175 bool obvious = FALSE;
4177 HIT_POINT power = 0;
4178 HIT_POINT damage = 0;
4182 /* Extract the attack infomation */
4183 int effect = r_ptr->blow[ap_cnt].effect;
4184 int method = r_ptr->blow[ap_cnt].method;
4185 int d_dice = r_ptr->blow[ap_cnt].d_dice;
4186 int d_side = r_ptr->blow[ap_cnt].d_side;
4188 if (!monster_is_valid(m_ptr)) break;
4190 /* Stop attacking if the target dies! */
4191 if (t_ptr->fx != x_saver || t_ptr->fy != y_saver)
4194 /* Hack -- no more attacks */
4197 if (method == RBM_SHOOT) continue;
4199 /* Extract the attack "power" */
4200 power = mbe_info[effect].power;
4203 if (!effect || check_hit2(power, rlev, ac, MON_STUNNED(m_ptr)))
4205 (void)set_monster_csleep(t_idx, 0);
4209 /* Redraw the health bar */
4210 if (subject_ptr->health_who == t_idx) subject_ptr->redraw |= (PR_HEALTH);
4211 if (subject_ptr->riding == t_idx) subject_ptr->redraw |= (PR_UHEALTH);
4214 /* Describe the attack method */
4219 act = _("%sを殴った。", "hits %s.");
4226 act = _("%sを触った。", "touches %s.");
4233 act = _("%sをパンチした。", "punches %s.");
4240 act = _("%sを蹴った。", "kicks %s.");
4247 act = _("%sをひっかいた。", "claws %s.");
4254 act = _("%sを噛んだ。", "bites %s.");
4261 act = _("%sを刺した。", "stings %s.");
4268 act = _("%sを斬った。", "slashes %s.");
4274 act = _("%sを角で突いた。", "butts %s.");
4281 act = _("%sに体当りした。", "crushes %s.");
4288 act = _("%sを飲み込んだ。", "engulfs %s.");
4295 act = _("%sに請求書をよこした。", "charges %s.");
4302 act = _("%sの体の上を這い回った。", "crawls on %s.");
4309 act = _("%sによだれをたらした。", "drools on %s.");
4316 act = _("%sに唾を吐いた。", "spits on %s.");
4323 if (see_either) disturb(subject_ptr, TRUE, TRUE);
4324 act = _("爆発した。", "explodes.");
4332 act = _("%sをにらんだ。", "gazes at %s.");
4339 act = _("%sに泣きついた。", "wails at %s.");
4346 act = _("%sに胞子を飛ばした。", "releases spores at %s.");
4353 act = _("%sにXXX4を飛ばした。", "projects XXX4's at %s.");
4360 act = _("%sに金をせがんだ。", "begs %s for money.");
4367 act = _("%sを侮辱した。", "insults %s.");
4374 act = _("%sにむかってうめいた。", "moans at %s.");
4381 act = _("%sにむかって歌った。", "sings to %s.");
4387 if (act && see_either)
4390 if (do_silly_attack) act = silly_attacks2[randint0(MAX_SILLY_ATTACK)];
4391 strfmt(temp, act, t_name);
4392 msg_format("%^sは%s", m_name, temp);
4394 if (do_silly_attack)
4396 act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
4397 strfmt(temp, "%s %s.", act, t_name);
4399 else strfmt(temp, act, t_name);
4400 msg_format("%^s %s", m_name, temp);
4404 /* Hack -- assume all attacks are obvious */
4407 /* Roll out the damage */
4408 damage = damroll(d_dice, d_side);
4410 /* Assume no effect */
4411 effect_type = BLOW_EFFECT_TYPE_NONE;
4415 /* Apply appropriate damage */
4424 if ((randint1(rlev * 2 + 250) > (ac + 200)) || one_in_(13))
4426 int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
4427 damage = MAX(damage, tmp_damage * 2);
4434 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
4449 if ((subject_ptr->riding != m_idx) && one_in_(2)) blinked = TRUE;
4485 effect_type = BLOW_EFFECT_TYPE_FEAR;
4489 effect_type = BLOW_EFFECT_TYPE_SLEEP;
4493 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
4494 if (damage > 23) earthquake(subject_ptr, m_ptr->fy, m_ptr->fx, 8, m_idx);
4509 pt = GF_HYPODYNAMIA;
4510 effect_type = BLOW_EFFECT_TYPE_HEAL;
4528 /* Do damage if not exploding */
4531 project(subject_ptr, m_idx, 0, t_ptr->fy, t_ptr->fx,
4532 damage, pt, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4535 switch (effect_type)
4537 case BLOW_EFFECT_TYPE_FEAR:
4538 project(subject_ptr, m_idx, 0, t_ptr->fy, t_ptr->fx,
4539 damage, GF_TURN_ALL, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4542 case BLOW_EFFECT_TYPE_SLEEP:
4543 project(subject_ptr, m_idx, 0, t_ptr->fy, t_ptr->fx,
4544 r_ptr->level, GF_OLD_SLEEP, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4547 case BLOW_EFFECT_TYPE_HEAL:
4548 if ((monster_living(m_idx)) && (damage > 2))
4550 bool did_heal = FALSE;
4552 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
4555 m_ptr->hp += damroll(4, damage / 6);
4556 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4558 /* Redraw (later) if needed */
4559 if (subject_ptr->health_who == m_idx) subject_ptr->redraw |= (PR_HEALTH);
4560 if (subject_ptr->riding == m_idx) subject_ptr->redraw |= (PR_UHEALTH);
4562 /* Special message */
4563 if (see_m && did_heal)
4565 msg_format(_("%sは体力を回復したようだ。", "%^s appears healthier."), m_name);
4574 if ((tr_ptr->flags2 & RF2_AURA_FIRE) && m_ptr->r_idx)
4576 if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
4580 msg_format(_("%^sは突然熱くなった!", "%^s is suddenly very hot!"), m_name);
4582 if (m_ptr->ml && is_original_ap_and_seen(t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_FIRE;
4583 project(subject_ptr, t_idx, 0, m_ptr->fy, m_ptr->fx,
4584 damroll(1 + ((tr_ptr->level) / 26),
4585 1 + ((tr_ptr->level) / 17)),
4586 GF_FIRE, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4590 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
4595 if ((tr_ptr->flags3 & RF3_AURA_COLD) && m_ptr->r_idx)
4597 if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
4601 msg_format(_("%^sは突然寒くなった!", "%^s is suddenly very cold!"), m_name);
4603 if (m_ptr->ml && is_original_ap_and_seen(t_ptr)) tr_ptr->r_flags3 |= RF3_AURA_COLD;
4604 project(subject_ptr, t_idx, 0, m_ptr->fy, m_ptr->fx,
4605 damroll(1 + ((tr_ptr->level) / 26),
4606 1 + ((tr_ptr->level) / 17)),
4607 GF_COLD, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4611 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
4616 if ((tr_ptr->flags2 & RF2_AURA_ELEC) && m_ptr->r_idx)
4618 if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
4622 msg_format(_("%^sは電撃を食らった!", "%^s gets zapped!"), m_name);
4624 if (m_ptr->ml && is_original_ap_and_seen(t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_ELEC;
4625 project(subject_ptr, t_idx, 0, m_ptr->fy, m_ptr->fx,
4626 damroll(1 + ((tr_ptr->level) / 26),
4627 1 + ((tr_ptr->level) / 17)),
4628 GF_ELEC, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4632 if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
4639 /* Monster missed player */
4642 /* Analyze failed attacks */
4658 (void)set_monster_csleep(t_idx, 0);
4660 /* Visible monsters */
4664 msg_format("%sは%^sの攻撃をかわした。", t_name, m_name);
4666 msg_format("%^s misses %s.", m_name, t_name);
4676 /* Analyze "visible" monsters only */
4677 if (is_original_ap_and_seen(m_ptr) && !do_silly_attack)
4679 /* Count "obvious" attacks (and ones that cause damage) */
4680 if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
4682 /* Count attacks of this type */
4683 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
4685 r_ptr->r_blows[ap_cnt]++;
4693 sound(SOUND_EXPLODE);
4695 /* Cancel Invulnerability */
4696 (void)set_monster_invulner(m_idx, 0, FALSE);
4697 mon_take_hit_mon(subject_ptr, m_idx, m_ptr->hp + 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
4701 if (!blinked || m_ptr->r_idx == 0) return TRUE;
4703 if (teleport_barrier(subject_ptr, m_idx))
4707 msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But magic barrier obstructs it."));
4711 subject_ptr->current_floor_ptr->monster_noise = TRUE;
4718 msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
4722 subject_ptr->current_floor_ptr->monster_noise = TRUE;
4725 teleport_away(subject_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L);
4734 * @brief モンスターが敵モンスターに行う打撃処理 /
4735 * Hack, based on mon_take_hit... perhaps all monster attacks on other monsters should use this?
4736 * @param m_idx 目標となるモンスターの参照ID
4738 * @param dead 目標となったモンスターの死亡状態を返す参照ポインタ
4739 * @param fear 目標となったモンスターの恐慌状態を返す参照ポインタ
4740 * @param note 目標モンスターが死亡した場合の特別メッセージ(NULLならば標準表示を行う)
4741 * @param who 打撃を行ったモンスターの参照ID
4744 void mon_take_hit_mon(player_type *player_ptr, MONSTER_IDX m_idx, HIT_POINT dam, bool *dead, bool *fear, concptr note, MONSTER_IDX who)
4746 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4747 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
4748 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4749 GAME_TEXT m_name[160];
4750 bool seen = is_seen(m_ptr);
4752 /* Can the player be aware of this attack? */
4753 bool known = (m_ptr->cdis <= MAX_SIGHT);
4755 monster_desc(m_name, m_ptr, 0);
4757 /* Redraw (later) if needed */
4760 if (player_ptr->health_who == m_idx) player_ptr->redraw |= (PR_HEALTH);
4761 if (player_ptr->riding == m_idx) player_ptr->redraw |= (PR_UHEALTH);
4764 (void)set_monster_csleep(m_idx, 0);
4766 if (player_ptr->riding && (m_idx == player_ptr->riding)) disturb(player_ptr, TRUE, TRUE);
4768 if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY))
4772 msg_format(_("%^sはダメージを受けない。", "%^s is unharmed."), m_name);
4777 if (r_ptr->flagsr & RFR_RES_ALL)
4782 if ((dam == 0) && one_in_(3)) dam = 1;
4788 msg_format(_("%^sはダメージを受けない。", "%^s is unharmed."), m_name);
4797 /* It is dead now... or is it? */
4800 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
4801 (r_ptr->flags7 & RF7_NAZGUL)) &&
4802 !player_ptr->phase_out)
4809 if (!monster_living(m_ptr->r_idx))
4811 sound(SOUND_N_KILL);
4822 monster_desc(m_name, m_ptr, MD_TRUE_NAME);
4823 /* Unseen death by normal attack */
4826 floor_ptr->monster_noise = TRUE;
4828 /* Death by special attack */
4831 msg_format(_("%^s%s", "%^s%s"), m_name, note);
4833 /* Death by normal attack -- nonliving monster */
4834 else if (!monster_living(m_ptr->r_idx))
4836 msg_format(_("%^sは破壊された。", "%^s is destroyed."), m_name);
4838 /* Death by normal attack -- living monster */
4841 msg_format(_("%^sは殺された。", "%^s is killed."), m_name);
4845 monster_gain_exp(who, m_ptr->r_idx);
4846 monster_death(m_idx, FALSE);
4847 delete_monster_idx(m_idx);
4852 /* Monster is dead */
4861 /* Mega-Hack -- Pain cancels fear */
4862 if (MON_MONFEAR(m_ptr) && (dam > 0))
4865 if (set_monster_monfear(m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
4872 /* Sometimes a monster gets scared by damage */
4873 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & RF3_NO_FEAR))
4875 /* Percentage of fully healthy */
4876 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
4879 * Run (sometimes) if at 10% or less of max hit points,
4880 * or (usually) when hit for half its current hit points
4882 if (((percentage <= 10) && (randint0(10) < percentage)) ||
4883 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
4885 /* Hack -- note fear */
4888 /* Hack -- Add some timed fear */
4889 (void)set_monster_monfear(m_idx, (randint1(10) +
4890 (((dam >= m_ptr->hp) && (percentage > 7)) ?
4891 20 : ((11 - percentage) * 5))));
4895 #endif /* ALLOW_FEAR */
4897 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr) && (who != m_idx))
4899 if (is_pet(&floor_ptr->m_list[who]) && !player_bold(player_ptr, m_ptr->target_y, m_ptr->target_x))
4901 set_target(m_ptr, floor_ptr->m_list[who].fy, floor_ptr->m_list[who].fx);
4905 if (player_ptr->riding && (player_ptr->riding == m_idx) && (dam > 0))
4907 monster_desc(m_name, m_ptr, 0);
4909 if (m_ptr->hp > m_ptr->maxhp / 3) dam = (dam + 1) / 2;
4910 if (rakuba(player_ptr, (dam > 200) ? 200 : dam, FALSE))
4912 msg_format(_("%^sに振り落とされた!", "You have been thrown off from %s!"), m_name);