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
14 #include "system/angband.h"
15 #include "core/stuff-handler.h"
17 #include "main/sound-definitions-table.h"
19 #include "object/artifact.h"
21 #include "monster/monsterrace-hook.h"
23 #include "monster/monster.h"
24 #include "monster/monster-status.h"
25 #include "spell/monster-spell.h"
27 #include "realm/realm-hex.h"
28 #include "realm/realm-song.h"
29 #include "object/object-flavor.h"
30 #include "object/object-hook.h"
31 #include "grid/grid.h"
32 #include "dungeon/dungeon.h"
33 #include "effect/effect-characteristics.h"
34 #include "dungeon/dungeon.h"
35 #include "spell/process-effect.h"
36 #include "spell/spells-type.h"
38 #include "player/player-move.h"
39 #include "player/player-effects.h"
40 #include "player/player-skill.h"
41 #include "player/player-damage.h"
42 #include "player/player-status.h"
43 #include "player/mimic-info-table.h"
44 #include "player/player-class.h"
45 #include "player/player-personality.h"
46 #include "view/display-main-window.h"
47 #include "world/world.h"
48 #include "spell/spells-floor.h"
49 #include "spell/spells2.h"
50 #include "spell/spells3.h"
52 #define BLOW_EFFECT_TYPE_NONE 0
53 #define BLOW_EFFECT_TYPE_FEAR 1
54 #define BLOW_EFFECT_TYPE_SLEEP 2
55 #define BLOW_EFFECT_TYPE_HEAL 3
58 * @brief モンスターの打撃効力テーブル /
59 * The table of monsters' blow effects
61 const mbe_info_type mbe_info[] =
64 { 60, GF_MISSILE, }, /* HURT */
65 { 5, GF_POIS, }, /* POISON */
66 { 20, GF_DISENCHANT, }, /* UN_BONUS */
67 { 15, GF_MISSILE, }, /* UN_POWER */ /* ToDo: Apply the correct effects */
68 { 5, GF_MISSILE, }, /* EAT_GOLD */
69 { 5, GF_MISSILE, }, /* EAT_ITEM */
70 { 5, GF_MISSILE, }, /* EAT_FOOD */
71 { 5, GF_MISSILE, }, /* EAT_LITE */
72 { 0, GF_ACID, }, /* ACID */
73 { 10, GF_ELEC, }, /* ELEC */
74 { 10, GF_FIRE, }, /* FIRE */
75 { 10, GF_COLD, }, /* COLD */
76 { 2, GF_MISSILE, }, /* BLIND */
77 { 10, GF_CONFUSION, }, /* CONFUSE */
78 { 10, GF_MISSILE, }, /* TERRIFY */
79 { 2, GF_MISSILE, }, /* PARALYZE */
80 { 0, GF_MISSILE, }, /* LOSE_STR */
81 { 0, GF_MISSILE, }, /* LOSE_INT */
82 { 0, GF_MISSILE, }, /* LOSE_WIS */
83 { 0, GF_MISSILE, }, /* LOSE_DEX */
84 { 0, GF_MISSILE, }, /* LOSE_CON */
85 { 0, GF_MISSILE, }, /* LOSE_CHR */
86 { 2, GF_MISSILE, }, /* LOSE_ALL */
87 { 60, GF_ROCKET, }, /* SHATTER */
88 { 5, GF_MISSILE, }, /* EXP_10 */
89 { 5, GF_MISSILE, }, /* EXP_20 */
90 { 5, GF_MISSILE, }, /* EXP_40 */
91 { 5, GF_MISSILE, }, /* EXP_80 */
92 { 5, GF_POIS, }, /* DISEASE */
93 { 5, GF_TIME, }, /* TIME */
94 { 5, GF_MISSILE, }, /* EXP_VAMP */
95 { 5, GF_MANA, }, /* DR_MANA */
96 { 60, GF_MISSILE, }, /* SUPERHURT */
100 * @brief 幻覚時の打撃記述テーブル / Weird melee attack types when hallucinating
103 const concptr silly_attacks[MAX_SILLY_ATTACK] =
106 "があなたの回りを3回回ってワンと言った。",
114 "に「神の国」発言の撤回を求められた。",
125 "はあなたの100の秘密について熱く語った。",
137 "に二週間以内でビデオを人に見せないと死ぬ呪いをかけられた。",
139 "はスーパーウルトラギャラクティカマグナムを放った。",
141 "にジェットストリームアタックをかけられた。",
142 "はあなたに卍固めをかけて「1、2、3、ダーッ!」と叫んだ。",
143 "は「いくじなし!ばかばかばか!」といって駆け出した。",
144 "が「ごらん、ルーベンスの絵だよ」と言って静かに目を閉じた。",
145 "は言った。「変愚蛮怒、絶賛公開中!」",
149 * @brief 幻覚時の打撃記述テーブル(フォーマットつき) / Weird melee attack types when hallucinating (%s for strfmt())
151 const concptr silly_attacks2[MAX_SILLY_ATTACK] =
154 "%sの回りを3回回ってワンと言った。",
162 "%sに「神の国」発言の撤回を求めた。",
173 "%sの100の秘密について熱く語った。",
185 "%sに二週間以内でビデオを人に見せないと死ぬ呪いをかけた。",
187 "%sにスーパーウルトラギャラクティカマグナムを放った。",
189 "%sにジェットストリームアタックをかけた。",
190 "%sに卍固めをかけて「1、2、3、ダーッ!」と叫んだ。",
191 "「いくじなし!ばかばかばか!」といって駆け出した。",
192 "「ごらん、ルーベンスの絵だよ」と言って静かに目を閉じた。",
196 const concptr silly_attacks[MAX_SILLY_ATTACK] =
207 "makes obscene gestures at",
237 * @brief マーシャルアーツ打撃テーブル
239 const martial_arts ma_blows[MAX_MA] =
242 { "%sを殴った。", 1, 0, 1, 5, 0 },
243 { "%sを蹴った。", 2, 0, 1, 7, 0 },
244 { "%sに正拳突きをくらわした。", 3, 0, 1, 9, 0 },
245 { "%sに膝蹴りをくらわした。", 5, 5, 2, 4, MA_KNEE },
246 { "%sに肘打ちをくらわした。", 7, 5, 1, 12, 0 },
247 { "%sに体当りした。", 9, 10, 2, 6, 0 },
248 { "%sを蹴った。", 11, 10, 3, 6, MA_SLOW },
249 { "%sにアッパーをくらわした。", 13, 12, 5, 5, 6 },
250 { "%sに二段蹴りをくらわした。", 16, 15, 5, 6, 8 },
251 { "%sに猫爪撃をくらわした。", 20, 20, 5, 8, 0 },
252 { "%sに跳空脚をくらわした。", 24, 25, 6, 8, 10 },
253 { "%sに鷲爪襲をくらわした。", 28, 25, 7, 9, 0 },
254 { "%sに回し蹴りをくらわした。", 32, 30, 8, 10, 10 },
255 { "%sに鉄拳撃をくらわした。", 35, 35, 8, 11, 10 },
256 { "%sに飛空脚をくらわした。", 39, 35, 8, 12, 12 },
257 { "%sに昇龍拳をくらわした。", 43, 35, 9, 12, 16 },
258 { "%sに石破天驚拳をくらわした。", 48, 40, 10, 13, 18 },
260 { "You punch %s.", 1, 0, 1, 4, 0 },
261 { "You kick %s.", 2, 0, 1, 6, 0 },
262 { "You strike %s.", 3, 0, 1, 7, 0 },
263 { "You hit %s with your knee.", 5, 5, 2, 3, MA_KNEE },
264 { "You hit %s with your elbow.", 7, 5, 1, 8, 0 },
265 { "You butt %s.", 9, 10, 2, 5, 0 },
266 { "You kick %s.", 11, 10, 3, 4, MA_SLOW },
267 { "You uppercut %s.", 13, 12, 4, 4, 6 },
268 { "You double-kick %s.", 16, 15, 5, 4, 8 },
269 { "You hit %s with a Cat's Claw.", 20, 20, 5, 5, 0 },
270 { "You hit %s with a jump kick.", 25, 25, 5, 6, 10 },
271 { "You hit %s with an Eagle's Claw.", 29, 25, 6, 6, 0 },
272 { "You hit %s with a circle kick.", 33, 30, 6, 8, 10 },
273 { "You hit %s with an Iron Fist.", 37, 35, 8, 8, 10 },
274 { "You hit %s with a flying kick.", 41, 35, 8, 10, 12 },
275 { "You hit %s with a Dragon Fist.", 45, 35, 10, 10, 16 },
276 { "You hit %s with a Crushing Blow.", 48, 35, 10, 12, 18 },
282 * @brief 修行僧のターンダメージ算出テーブル
284 const int monk_ave_damage[PY_MAX_LEVEL + 1][3] =
341 * Stat Table (STR) -- help index into the "blow" table
343 const byte adj_str_blow[] =
360 20 /* 18/00-18/09 */,
361 30 /* 18/10-18/19 */,
362 40 /* 18/20-18/29 */,
363 50 /* 18/30-18/39 */,
364 60 /* 18/40-18/49 */,
365 70 /* 18/50-18/59 */,
366 80 /* 18/60-18/69 */,
367 90 /* 18/70-18/79 */,
368 100 /* 18/80-18/89 */,
369 110 /* 18/90-18/99 */,
370 120 /* 18/100-18/109 */,
371 130 /* 18/110-18/119 */,
372 140 /* 18/120-18/129 */,
373 150 /* 18/130-18/139 */,
374 160 /* 18/140-18/149 */,
375 170 /* 18/150-18/159 */,
376 180 /* 18/160-18/169 */,
377 190 /* 18/170-18/179 */,
378 200 /* 18/180-18/189 */,
379 210 /* 18/190-18/199 */,
380 220 /* 18/200-18/209 */,
381 230 /* 18/210-18/219 */,
387 * 器用さによる攻撃回数インデックステーブル
388 * Stat Table (DEX) -- index into the "blow" table
390 const byte adj_dex_blow[] =
417 7 /* 18/100-18/109 */,
418 7 /* 18/110-18/119 */,
419 8 /* 18/120-18/129 */,
420 8 /* 18/130-18/139 */,
421 9 /* 18/140-18/149 */,
422 9 /* 18/150-18/159 */,
423 10 /* 18/160-18/169 */,
424 10 /* 18/170-18/179 */,
425 11 /* 18/180-18/189 */,
426 11 /* 18/190-18/199 */,
427 12 /* 18/200-18/209 */,
428 12 /* 18/210-18/219 */,
435 * 腕力、器用さに応じた攻撃回数テーブル /
436 * This table is used to help calculate the number of blows the player can
437 * make in a single round of attacks (one player turn) with a normal weapon.
440 * This number ranges from a single blow/round for weak players to up to six
441 * blows/round for powerful warriors.
443 * Note that certain artifacts and ego-items give "bonus" blows/round.
445 * First, from the player class, we extract some values:
447 * Warrior num = 6; mul = 5; div = MAX(70, weapon_weight);
448 * Berserker num = 6; mul = 7; div = MAX(70, weapon_weight);
449 * Mage num = 3; mul = 2; div = MAX(100, weapon_weight);
450 * Priest num = 5; mul = 3; div = MAX(100, weapon_weight);
451 * Mindcrafter num = 5; mul = 3; div = MAX(100, weapon_weight);
452 * Rogue num = 5; mul = 3; div = MAX(40, weapon_weight);
453 * Ranger num = 5; mul = 4; div = MAX(70, weapon_weight);
454 * Paladin num = 5; mul = 4; div = MAX(70, weapon_weight);
455 * Weaponsmith num = 5; mul = 5; div = MAX(150, weapon_weight);
456 * Warrior-Mage num = 5; mul = 3; div = MAX(70, weapon_weight);
457 * Chaos Warrior num = 5; mul = 4; div = MAX(70, weapon_weight);
458 * Monk num = 5; mul = 3; div = MAX(60, weapon_weight);
459 * Tourist num = 4; mul = 3; div = MAX(100, weapon_weight);
460 * Imitator num = 5; mul = 4; div = MAX(70, weapon_weight);
461 * Beastmaster num = 5; mul = 3; div = MAX(70, weapon_weight);
462 * Cavalry(Ride) num = 5; mul = 4; div = MAX(70, weapon_weight);
463 * Cavalry(Walk) num = 5; mul = 3; div = MAX(100, weapon_weight);
464 * Sorcerer num = 1; mul = 1; div = MAX(1, weapon_weight);
465 * Archer num = 4; mul = 2; div = MAX(70, weapon_weight);
466 * Magic eater num = 4; mul = 2; div = MAX(70, weapon_weight);
467 * ForceTrainer num = 4; mul = 2; div = MAX(60, weapon_weight);
468 * Mirror Master num = 3; mul = 3; div = MAX(100, weapon_weight);
469 * Ninja num = 4; mul = 1; div = MAX(20, weapon_weight);
471 * To get "P", we look up the relevant "adj_str_blow[]" (see above),
472 * multiply it by "mul", and then divide it by "div".
473 * Increase P by 1 if you wield a weapon two-handed.
474 * Decrease P by 1 if you are a Ninja.
476 * To get "D", we look up the relevant "adj_dex_blow[]" (see above),
478 * The player gets "blows_table[P][D]" blows/round, as shown below,
479 * up to a maximum of "num" blows/round, plus any "bonus" blows/round.
482 const byte blows_table[12][12] =
485 /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11+ */
486 /* 3 10 15 /10 /40 /60 /80 /100 /120 /140 /160 /180 */
487 /* 0 */{ 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4 },
488 /* 1 */{ 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4 },
489 /* 2 */{ 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5 },
490 /* 3 */{ 1, 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 5 },
491 /* 4 */{ 1, 1, 2, 3, 3, 4, 4, 5, 5, 5, 5, 5 },
492 /* 5 */{ 1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6 },
493 /* 6 */{ 1, 1, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6 },
494 /* 7 */{ 1, 2, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6 },
495 /* 8 */{ 1, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6 },
496 /* 9 */{ 1, 2, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6 },
497 /* 10*/{ 2, 2, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6 },
498 /*11+*/{ 2, 2, 3, 4, 4, 4, 5, 5, 6, 6, 6, 6 },
502 * @brief プレイヤーからモンスターへの打撃命中判定 /
503 * Determine if the player "hits" a monster (normal combat).
504 * @param chance 基本命中値
506 * @param visible 目標を視界に捕らえているならばTRUEを指定
507 * @return 命中と判定された場合TRUEを返す
508 * @note Always miss 5%, always hit 5%, otherwise random.
510 bool test_hit_norm(player_type *attacker_ptr, HIT_RELIABILITY chance, ARMOUR_CLASS ac, bool visible)
512 if (!visible) chance = (chance + 1) / 2;
513 return hit_chance(attacker_ptr, chance, ac) >= randint1(100);
517 * @brief モンスターへの命中率の計算
518 * @param player_ptr プレーヤーへの参照ポインタ
523 PERCENTAGE hit_chance(player_type *attacker_ptr, HIT_RELIABILITY reli, ARMOUR_CLASS ac)
525 PERCENTAGE chance = 5, chance_left = 90;
526 if(reli <= 0) return 5;
527 if(attacker_ptr->pseikaku == SEIKAKU_NAMAKE) chance_left = (chance_left * 19 + 9) / 20;
528 chance += (100 - ((ac * 75) / reli)) * chance_left / 100;
529 if (chance < 5) chance = 5;
535 * @brief プレイヤー攻撃の種族スレイング倍率計算
536 * @param player_ptr プレーヤーへの参照ポインタ
537 * @param mult 算出前の基本倍率(/10倍)
538 * @param flgs スレイフラグ配列
539 * @param m_ptr 目標モンスターの構造体参照ポインタ
540 * @return スレイング加味後の倍率(/10倍)
542 static MULTIPLY mult_slaying(player_type *player_ptr, MULTIPLY mult, const BIT_FLAGS* flgs, monster_type* m_ptr)
544 static const struct slay_table_t {
546 BIT_FLAGS affect_race_flag;
549 size_t r_flag_offset;
551 #define OFFSET(X) offsetof(monster_race, X)
552 {TR_SLAY_ANIMAL, RF3_ANIMAL, 25, OFFSET(flags3), OFFSET(r_flags3)},
553 {TR_KILL_ANIMAL, RF3_ANIMAL, 40, OFFSET(flags3), OFFSET(r_flags3)},
554 {TR_SLAY_EVIL, RF3_EVIL, 20, OFFSET(flags3), OFFSET(r_flags3)},
555 {TR_KILL_EVIL, RF3_EVIL, 35, OFFSET(flags3), OFFSET(r_flags3)},
556 {TR_SLAY_GOOD, RF3_GOOD, 20, OFFSET(flags3), OFFSET(r_flags3)},
557 {TR_KILL_GOOD, RF3_GOOD, 35, OFFSET(flags3), OFFSET(r_flags3)},
558 {TR_SLAY_HUMAN, RF2_HUMAN, 25, OFFSET(flags2), OFFSET(r_flags2)},
559 {TR_KILL_HUMAN, RF2_HUMAN, 40, OFFSET(flags2), OFFSET(r_flags2)},
560 {TR_SLAY_UNDEAD, RF3_UNDEAD, 30, OFFSET(flags3), OFFSET(r_flags3)},
561 {TR_KILL_UNDEAD, RF3_UNDEAD, 50, OFFSET(flags3), OFFSET(r_flags3)},
562 {TR_SLAY_DEMON, RF3_DEMON, 30, OFFSET(flags3), OFFSET(r_flags3)},
563 {TR_KILL_DEMON, RF3_DEMON, 50, OFFSET(flags3), OFFSET(r_flags3)},
564 {TR_SLAY_ORC, RF3_ORC, 30, OFFSET(flags3), OFFSET(r_flags3)},
565 {TR_KILL_ORC, RF3_ORC, 50, OFFSET(flags3), OFFSET(r_flags3)},
566 {TR_SLAY_TROLL, RF3_TROLL, 30, OFFSET(flags3), OFFSET(r_flags3)},
567 {TR_KILL_TROLL, RF3_TROLL, 50, OFFSET(flags3), OFFSET(r_flags3)},
568 {TR_SLAY_GIANT, RF3_GIANT, 30, OFFSET(flags3), OFFSET(r_flags3)},
569 {TR_KILL_GIANT, RF3_GIANT, 50, OFFSET(flags3), OFFSET(r_flags3)},
570 {TR_SLAY_DRAGON, RF3_DRAGON, 30, OFFSET(flags3), OFFSET(r_flags3)},
571 {TR_KILL_DRAGON, RF3_DRAGON, 50, OFFSET(flags3), OFFSET(r_flags3)},
575 monster_race* r_ptr = &r_info[m_ptr->r_idx];
576 for (size_t i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++i)
578 const struct slay_table_t* p = &slay_table[i];
580 if (!have_flag(flgs, p->slay_flag) ||
581 !(atoffset(BIT_FLAGS, r_ptr, p->flag_offset) & p->affect_race_flag))
584 if (is_original_ap_and_seen(player_ptr, m_ptr))
586 atoffset(BIT_FLAGS, r_ptr, p->r_flag_offset) |= p->affect_race_flag;
589 mult = MAX(mult, p->slay_mult);
597 * @brief プレイヤー攻撃の属性スレイング倍率計算
598 * @param player_ptr プレーヤーへの参照ポインタ
599 * @param mult 算出前の基本倍率(/10倍)
600 * @param flgs スレイフラグ配列
601 * @param m_ptr 目標モンスターの構造体参照ポインタ
602 * @return スレイング加味後の倍率(/10倍)
604 static MULTIPLY mult_brand(player_type *player_ptr, MULTIPLY mult, const BIT_FLAGS* flgs, monster_type* m_ptr)
606 static const struct brand_table_t {
608 BIT_FLAGS resist_mask;
611 {TR_BRAND_ACID, RFR_EFF_IM_ACID_MASK, 0U },
612 {TR_BRAND_ELEC, RFR_EFF_IM_ELEC_MASK, 0U },
613 {TR_BRAND_FIRE, RFR_EFF_IM_FIRE_MASK, RF3_HURT_FIRE},
614 {TR_BRAND_COLD, RFR_EFF_IM_COLD_MASK, RF3_HURT_COLD},
615 {TR_BRAND_POIS, RFR_EFF_IM_POIS_MASK, 0U },
618 monster_race* r_ptr = &r_info[m_ptr->r_idx];
619 for (size_t i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++i)
621 const struct brand_table_t* p = &brand_table[i];
623 if (!have_flag(flgs, p->brand_flag)) continue;
625 /* Notice immunity */
626 if (r_ptr->flagsr & p->resist_mask)
628 if (is_original_ap_and_seen(player_ptr, m_ptr))
630 r_ptr->r_flagsr |= (r_ptr->flagsr & p->resist_mask);
636 /* Otherwise, take the damage */
637 if (r_ptr->flags3 & p->hurt_flag)
639 if (is_original_ap_and_seen(player_ptr, m_ptr))
641 r_ptr->r_flags3 |= p->hurt_flag;
644 mult = MAX(mult, 50);
648 mult = MAX(mult, 25);
656 * @brief 剣術のスレイ倍率計算を行う /
657 * Calcurate magnification of hissatsu technics
658 * @param mult 剣術のスレイ効果以前に算出している多要素の倍率(/10倍)
659 * @param flgs 剣術に使用する武器のスレイフラグ配列
660 * @param m_ptr 目標となるモンスターの構造体参照ポインタ
661 * @param mode 剣術のスレイ型ID
662 * @return スレイの倍率(/10倍)
664 static MULTIPLY mult_hissatsu(player_type *attacker_ptr, MULTIPLY mult, BIT_FLAGS *flgs, monster_type *m_ptr, BIT_FLAGS mode)
666 monster_race *r_ptr = &r_info[m_ptr->r_idx];
668 /* Burning Strike (Fire) */
669 if (mode == HISSATSU_FIRE)
671 /* Notice immunity */
672 if (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)
674 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
676 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
680 /* Otherwise, take the damage */
681 else if (have_flag(flgs, TR_BRAND_FIRE))
683 if (r_ptr->flags3 & RF3_HURT_FIRE)
685 if (mult < 70) mult = 70;
686 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
688 r_ptr->r_flags3 |= RF3_HURT_FIRE;
691 else if (mult < 35) mult = 35;
695 if (r_ptr->flags3 & RF3_HURT_FIRE)
697 if (mult < 50) mult = 50;
698 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
700 r_ptr->r_flags3 |= RF3_HURT_FIRE;
703 else if (mult < 25) mult = 25;
707 /* Serpent's Tongue (Poison) */
708 if (mode == HISSATSU_POISON)
710 /* Notice immunity */
711 if (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)
713 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
715 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_POIS_MASK);
719 /* Otherwise, take the damage */
720 else if (have_flag(flgs, TR_BRAND_POIS))
722 if (mult < 35) mult = 35;
726 if (mult < 25) mult = 25;
730 /* Zammaken (Nonliving Evil) */
731 if (mode == HISSATSU_ZANMA)
733 if (!monster_living(m_ptr->r_idx) && (r_ptr->flags3 & RF3_EVIL))
735 if (mult < 15) mult = 25;
736 else if (mult < 50) mult = MIN(50, mult + 20);
740 /* Rock Smash (Hurt Rock) */
741 if (mode == HISSATSU_HAGAN)
743 if (r_ptr->flags3 & RF3_HURT_ROCK)
745 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
747 r_ptr->r_flags3 |= RF3_HURT_ROCK;
749 if (mult == 10) mult = 40;
750 else if (mult < 60) mult = 60;
754 /* Midare-Setsugekka (Cold) */
755 if (mode == HISSATSU_COLD)
757 /* Notice immunity */
758 if (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)
760 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
762 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
765 /* Otherwise, take the damage */
766 else if (have_flag(flgs, TR_BRAND_COLD))
768 if (r_ptr->flags3 & RF3_HURT_COLD)
770 if (mult < 70) mult = 70;
771 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
773 r_ptr->r_flags3 |= RF3_HURT_COLD;
776 else if (mult < 35) mult = 35;
780 if (r_ptr->flags3 & RF3_HURT_COLD)
782 if (mult < 50) mult = 50;
783 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
785 r_ptr->r_flags3 |= RF3_HURT_COLD;
788 else if (mult < 25) mult = 25;
792 /* Lightning Eagle (Elec) */
793 if (mode == HISSATSU_ELEC)
795 /* Notice immunity */
796 if (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK)
798 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
800 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
804 /* Otherwise, take the damage */
805 else if (have_flag(flgs, TR_BRAND_ELEC))
807 if (mult < 70) mult = 70;
811 if (mult < 50) mult = 50;
815 /* Bloody Maelstrom */
816 if ((mode == HISSATSU_SEKIRYUKA) && attacker_ptr->cut && monster_living(m_ptr->r_idx))
818 MULTIPLY tmp = MIN(100, MAX(10, attacker_ptr->cut / 10));
819 if (mult < tmp) mult = tmp;
823 if (mode == HISSATSU_UNDEAD)
825 if (r_ptr->flags3 & RF3_UNDEAD)
827 if (is_original_ap_and_seen(attacker_ptr, m_ptr))
829 r_ptr->r_flags3 |= RF3_UNDEAD;
831 if (mult == 10) mult = 70;
832 else if (mult < 140) mult = MIN(140, mult + 60);
834 if (mult == 10) mult = 40;
835 else if (mult < 60) mult = MIN(60, mult + 30);
838 if (mult > 150) mult = 150;
844 * @brief ダメージにスレイ要素を加える総合処理ルーチン /
845 * Extract the "total damage" from a given object hitting a given monster.
846 * @param o_ptr 使用武器オブジェクトの構造体参照ポインタ
847 * @param tdam 現在算出途中のダメージ値
848 * @param m_ptr 目標モンスターの構造体参照ポインタ
850 * @param thrown 投擲処理ならばTRUEを指定する
851 * @return 総合的なスレイを加味したダメージ値
853 * Note that "flasks of oil" do NOT do fire damage, although they\n
854 * certainly could be made to do so. XXX XXX\n
856 * Note that most brands and slays are x3, except Slay Animal (x2),\n
857 * Slay Evil (x2), and Kill dragon (x5).\n
859 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)
861 BIT_FLAGS flgs[TR_FLAG_SIZE];
862 object_flags(o_ptr, flgs);
863 torch_flags(o_ptr, flgs); /* torches has secret flags */
867 if (attacker_ptr->special_attack & (ATTACK_ACID)) add_flag(flgs, TR_BRAND_ACID);
868 if (attacker_ptr->special_attack & (ATTACK_COLD)) add_flag(flgs, TR_BRAND_COLD);
869 if (attacker_ptr->special_attack & (ATTACK_ELEC)) add_flag(flgs, TR_BRAND_ELEC);
870 if (attacker_ptr->special_attack & (ATTACK_FIRE)) add_flag(flgs, TR_BRAND_FIRE);
871 if (attacker_ptr->special_attack & (ATTACK_POIS)) add_flag(flgs, TR_BRAND_POIS);
874 if (hex_spelling(attacker_ptr, HEX_RUNESWORD)) add_flag(flgs, TR_SLAY_GOOD);
888 mult = mult_slaying(attacker_ptr, mult, flgs, m_ptr);
890 mult = mult_brand(attacker_ptr, mult, flgs, m_ptr);
892 if (attacker_ptr->pclass == CLASS_SAMURAI)
894 mult = mult_hissatsu(attacker_ptr, mult, flgs, m_ptr, mode);
897 if ((attacker_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs, TR_FORCE_WEAPON)) && (attacker_ptr->csp > (o_ptr->dd * o_ptr->ds / 5)))
899 attacker_ptr->csp -= (1 + (o_ptr->dd * o_ptr->ds / 5));
900 attacker_ptr->redraw |= (PR_MANA);
901 mult = mult * 3 / 2 + 20;
904 if ((o_ptr->name1 == ART_NOTHUNG) && (m_ptr->r_idx == MON_FAFNER))
910 if (mult > 150) mult = 150;
911 return (tdam * mult / 10);
915 * @brief プレイヤーからモンスターへの打撃クリティカル判定 /
916 * Critical hits (by player) Factor in weapon weight, total plusses, player melee bonus
917 * @param weight 矢弾の重量
918 * @param plus 武器の命中修正
919 * @param dam 現在算出中のダメージ値
920 * @param meichuu 打撃の基本命中力
921 * @param mode オプションフラグ
922 * @return クリティカル修正が入ったダメージ値
924 HIT_POINT critical_norm(player_type *attacker_ptr, WEIGHT weight, int plus, HIT_POINT dam, s16b meichuu, BIT_FLAGS mode)
926 /* Extract "blow" power */
927 int i = (weight + (meichuu * 3 + plus * 5) + attacker_ptr->skill_thn);
930 bool is_special_option = randint1((attacker_ptr->pclass == CLASS_NINJA) ? 4444 : 5000) <= i;
931 is_special_option |= mode == HISSATSU_MAJIN;
932 is_special_option |= mode == HISSATSU_3DAN;
933 if (!is_special_option) return dam;
935 int k = weight + randint1(650);
936 if ((mode == HISSATSU_MAJIN) || (mode == HISSATSU_3DAN)) k += randint1(650);
940 msg_print(_("手ごたえがあった!", "It was a good hit!"));
948 msg_print(_("かなりの手ごたえがあった!", "It was a great hit!"));
955 msg_print(_("会心の一撃だ!", "It was a superb hit!"));
962 msg_print(_("最高の会心の一撃だ!", "It was a *GREAT* hit!"));
967 msg_print(_("比類なき最高の会心の一撃だ!", "It was a *SUPERB* hit!"));
968 dam = ((7 * dam) / 2) + 25;
973 * @brief モンスター打撃のクリティカルランクを返す /
974 * Critical blow. All hits that do 95% of total possible damage,
975 * @param dice モンスター打撃のダイス数
976 * @param sides モンスター打撃の最大ダイス目
977 * @param dam プレイヤーに与えたダメージ
979 * and which also do at least 20 damage, or, sometimes, N damage.
980 * This is used only to determine "cuts" and "stuns".
982 static int monster_critical(DICE_NUMBER dice, DICE_SID sides, HIT_POINT dam)
984 /* Must do at least 95% of perfect */
985 int total = dice * sides;
986 if (dam < total * 19 / 20) return 0;
988 /* Weak blows rarely work */
989 if ((dam < 20) && (randint0(100) >= dam)) return 0;
993 if ((dam >= total) && (dam >= 40)) max++;
998 while (randint0(100) < 2) max++;
1001 /* Critical damage */
1002 if (dam > 45) return (6 + max);
1003 if (dam > 33) return (5 + max);
1004 if (dam > 25) return (4 + max);
1005 if (dam > 18) return (3 + max);
1006 if (dam > 11) return (2 + max);
1012 * @brief モンスター打撃の命中を判定する /
1013 * Determine if a monster attack against the player succeeds.
1014 * @param power 打撃属性毎の基本命中値
1015 * @param level モンスターのレベル
1016 * @param stun モンスターの朦朧値
1017 * @return TRUEならば命中判定
1019 * Always miss 5% of the time, Always hit 5% of the time.
1020 * Otherwise, match monster power against player armor.
1022 static int check_hit(player_type *target_ptr, int power, DEPTH level, int stun)
1024 int k = randint0(100);
1025 if (stun && one_in_(2)) return FALSE;
1026 if (k < 10) return (k < 5);
1027 int i = (power + (level * 3));
1029 int ac = target_ptr->ac + target_ptr->to_a;
1030 if (target_ptr->special_attack & ATTACK_SUIKEN) ac += (target_ptr->lev * 2);
1032 if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return TRUE;
1037 * @brief モンスターから敵モンスターへの命中判定
1038 * @param power 打撃属性による基本命中値
1039 * @param level 攻撃側モンスターのレベル
1040 * @param ac 目標モンスターのAC
1041 * @param stun 攻撃側モンスターが朦朧状態ならTRUEを返す
1042 * @return 命中ならばTRUEを返す
1044 static int check_hit2(int power, DEPTH level, ARMOUR_CLASS ac, int stun)
1046 int k = randint0(100);
1047 if (stun && one_in_(2)) return FALSE;
1048 if (k < 10) return (k < 5);
1049 int i = (power + (level * 3));
1051 if ((i > 0) && (randint1(i) > ((ac * 3) / 4))) return TRUE;
1055 /*! モンスターの侮辱行為メッセージテーブル / Hack -- possible "insult" messages */
1056 static concptr desc_insult[] =
1067 "があなたをパラサイト呼ばわりした!",
1071 "insults your mother!",
1072 "gives you the finger!",
1075 "dances around you!",
1076 "makes obscene gestures!",
1078 "calls you a parasite!",
1079 "calls you a cyborg!"
1084 /*! マゴットのぼやきメッセージテーブル / Hack -- possible "insult" messages */
1085 static concptr desc_moan[] =
1089 "が彼の飼い犬を見なかったかと尋ねている。",
1090 "が縄張りから出て行けと言っている。",
1093 "seems sad about something.",
1094 "asks if you have seen his dogs.",
1095 "tells you to get off his land.",
1096 "mumbles something about mushrooms."
1103 * @brief 敵オーラによるプレイヤーのダメージ処理(補助)
1104 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
1105 * @param immune ダメージを回避できる免疫フラグ
1106 * @param flags_offset オーラフラグ配列の参照オフセット
1107 * @param r_flags_offset モンスターの耐性配列の参照オフセット
1108 * @param aura_flag オーラフラグ配列
1109 * @param dam_func ダメージ処理を行う関数の参照ポインタ
1110 * @param message オーラダメージを受けた際のメッセージ
1113 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,
1114 HIT_POINT(*dam_func)(player_type *creature_type, HIT_POINT dam, concptr kb_str, int monspell, bool aura), concptr message)
1116 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1117 if (!(atoffset(BIT_FLAGS, r_ptr, flags_offset) & aura_flag) || immune) return;
1119 GAME_TEXT mon_name[MAX_NLEN];
1120 int aura_damage = damroll(1 + (r_ptr->level / 26), 1 + (r_ptr->level / 17));
1122 monster_desc(touched_ptr, mon_name, m_ptr, MD_WRONGDOER_NAME);
1124 dam_func(touched_ptr, aura_damage, mon_name, -1, TRUE);
1126 if (is_original_ap_and_seen(touched_ptr, m_ptr))
1128 atoffset(BIT_FLAGS, r_ptr, r_flags_offset) |= aura_flag;
1131 handle_stuff(touched_ptr);
1136 * @brief 敵オーラによるプレイヤーのダメージ処理(メイン)
1137 * @param m_ptr オーラを持つモンスターの構造体参照ポインタ
1138 * @param touched_ptr オーラを持つ相手に振れたクリーチャーの参照ポインタ
1141 static void touch_zap_player(monster_type *m_ptr, player_type *touched_ptr)
1143 touch_zap_player_aux(m_ptr, touched_ptr, touched_ptr->immune_fire, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_FIRE,
1144 fire_dam, _("突然とても熱くなった!", "You are suddenly very hot!"));
1145 touch_zap_player_aux(m_ptr, touched_ptr, touched_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
1146 cold_dam, _("突然とても寒くなった!", "You are suddenly very cold!"));
1147 touch_zap_player_aux(m_ptr, touched_ptr, touched_ptr->immune_elec, offsetof(monster_race, flags2), offsetof(monster_race, r_flags2), RF2_AURA_ELEC,
1148 elec_dam, _("電撃をくらった!", "You get zapped!"));
1153 * @brief プレイヤーの変異要素による打撃処理
1154 * @param attacker_ptr プレーヤーへの参照ポインタ
1155 * @param m_idx 攻撃目標となったモンスターの参照ID
1156 * @param attack 変異要素による攻撃要素の種類
1157 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
1158 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
1161 static void natural_attack(player_type *attacker_ptr, MONSTER_IDX m_idx, int attack, bool *fear, bool *mdeath)
1163 WEIGHT n_weight = 0;
1164 monster_type *m_ptr = &attacker_ptr->current_floor_ptr->m_list[m_idx];
1165 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1167 int dice_num, dice_side;
1171 case MUT2_SCOR_TAIL:
1175 atk_desc = _("尻尾", "tail");
1182 atk_desc = _("角", "horns");
1189 atk_desc = _("クチバシ", "beak");
1196 atk_desc = _("象の鼻", "trunk");
1199 case MUT2_TENTACLES:
1203 atk_desc = _("触手", "tentacles");
1207 dice_num = dice_side = n_weight = 1;
1208 atk_desc = _("未定義の部位", "undefined body part");
1212 GAME_TEXT m_name[MAX_NLEN];
1213 monster_desc(attacker_ptr, m_name, m_ptr, 0);
1215 /* Calculate the "attack quality" */
1216 int bonus = attacker_ptr->to_h_m + (attacker_ptr->lev * 6 / 5);
1217 int chance = (attacker_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1219 bool is_hit = ((r_ptr->flags2 & RF2_QUANTUM) == 0) || !randint0(2);
1220 is_hit &= test_hit_norm(attacker_ptr, chance, r_ptr->ac, m_ptr->ml);
1224 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1229 msg_format(_("%sを%sで攻撃した。", "You hit %s with your %s."), m_name, atk_desc);
1231 HIT_POINT k = damroll(dice_num, dice_side);
1232 k = critical_norm(attacker_ptr, n_weight, bonus, k, (s16b)bonus, 0);
1234 /* Apply the player damage bonuses */
1235 k += attacker_ptr->to_d_m;
1237 /* No negative damage */
1240 /* Modify the damage */
1241 k = mon_damage_mod(attacker_ptr, m_ptr, k, FALSE);
1243 /* Complex message */
1244 msg_format_wizard(CHEAT_MONSTER,
1245 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"),
1246 k, m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
1248 /* Anger the monster */
1249 if (k > 0) anger_monster(attacker_ptr, m_ptr);
1251 /* Damage, check for fear and mdeath */
1254 case MUT2_SCOR_TAIL:
1255 project(attacker_ptr, 0, 0, m_ptr->fy, m_ptr->fx, k, GF_POIS, PROJECT_KILL, -1);
1256 *mdeath = (m_ptr->r_idx == 0);
1259 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1262 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1265 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1267 case MUT2_TENTACLES:
1268 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1271 *mdeath = mon_take_hit(attacker_ptr, m_idx, k, fear, NULL);
1274 touch_zap_player(m_ptr, attacker_ptr);
1278 * @brief プレイヤーの打撃処理サブルーチン /
1279 * Player attacks a (poor, defenseless) creature -RAK-
1282 * @param fear 攻撃を受けたモンスターが恐慌状態に陥ったかを返す参照ポインタ
1283 * @param mdeath 攻撃を受けたモンスターが死亡したかを返す参照ポインタ
1284 * @param hand 攻撃を行うための武器を持つ手
1285 * @param mode 発動中の剣術ID
1288 * If no "weapon" is available, then "punch" the monster one time.
1290 static void py_attack_aux(player_type *attacker_ptr, POSITION y, POSITION x, bool *fear, bool *mdeath, s16b hand, COMBAT_OPTION_IDX mode)
1292 int num = 0, bonus, chance, vir;
1295 floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
1296 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
1298 monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
1299 monster_race *r_ptr = &r_info[m_ptr->r_idx];
1301 /* Access the weapon */
1302 object_type *o_ptr = &attacker_ptr->inventory_list[INVEN_RARM + hand];
1304 GAME_TEXT m_name[MAX_NLEN];
1306 bool success_hit = FALSE;
1307 bool backstab = FALSE;
1308 bool vorpal_cut = FALSE;
1309 int chaos_effect = 0;
1310 bool stab_fleeing = FALSE;
1311 bool fuiuchi = FALSE;
1312 bool monk_attack = FALSE;
1313 bool do_quake = FALSE;
1315 bool drain_msg = TRUE;
1316 int drain_result = 0, drain_heal = 0;
1317 bool can_drain = FALSE;
1319 int drain_left = MAX_VAMPIRIC_DRAIN;
1320 BIT_FLAGS flgs[TR_FLAG_SIZE]; /* A massive hack -- life-draining weapons */
1321 bool is_human = (r_ptr->d_char == 'p');
1322 bool is_lowlevel = (r_ptr->level < (attacker_ptr->lev - 15));
1323 bool zantetsu_mukou, e_j_mukou;
1325 switch (attacker_ptr->pclass)
1329 if (has_melee_weapon(attacker_ptr, INVEN_RARM + hand) && !attacker_ptr->icky_wield[hand])
1331 int tmp = attacker_ptr->lev * 6 + (attacker_ptr->skill_stl + 10) * 4;
1332 if (attacker_ptr->monlite && (mode != HISSATSU_NYUSIN)) tmp /= 3;
1333 if (attacker_ptr->cursed & TRC_AGGRAVATE) tmp /= 2;
1334 if (r_ptr->level > (attacker_ptr->lev * attacker_ptr->lev / 20 + 10)) tmp /= 3;
1335 if (MON_CSLEEP(m_ptr) && m_ptr->ml)
1337 /* Can't backstab creatures that we can't see, right? */
1340 else if ((attacker_ptr->special_defense & NINJA_S_STEALTH) && (randint0(tmp) > (r_ptr->level + 20)) && m_ptr->ml && !(r_ptr->flagsr & RFR_RES_ALL))
1344 else if (MON_MONFEAR(m_ptr) && m_ptr->ml)
1346 stab_fleeing = TRUE;
1353 case CLASS_FORCETRAINER:
1354 case CLASS_BERSERKER:
1355 if ((empty_hands(attacker_ptr, TRUE) & EMPTY_HAND_RARM) && !attacker_ptr->riding) monk_attack = TRUE;
1359 if (!o_ptr->k_idx) /* Empty hand */
1361 if ((r_ptr->level + 10) > attacker_ptr->lev)
1363 if (attacker_ptr->skill_exp[GINOU_SUDE] < s_info[attacker_ptr->pclass].s_max[GINOU_SUDE])
1365 if (attacker_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_BEGINNER)
1366 attacker_ptr->skill_exp[GINOU_SUDE] += 40;
1367 else if ((attacker_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_SKILLED))
1368 attacker_ptr->skill_exp[GINOU_SUDE] += 5;
1369 else if ((attacker_ptr->skill_exp[GINOU_SUDE] < WEAPON_EXP_EXPERT) && (attacker_ptr->lev > 19))
1370 attacker_ptr->skill_exp[GINOU_SUDE] += 1;
1371 else if ((attacker_ptr->lev > 34))
1372 if (one_in_(3)) attacker_ptr->skill_exp[GINOU_SUDE] += 1;
1373 attacker_ptr->update |= (PU_BONUS);
1377 else if (object_is_melee_weapon(o_ptr))
1379 if ((r_ptr->level + 10) > attacker_ptr->lev)
1381 OBJECT_TYPE_VALUE tval = attacker_ptr->inventory_list[INVEN_RARM + hand].tval - TV_WEAPON_BEGIN;
1382 OBJECT_SUBTYPE_VALUE sval = attacker_ptr->inventory_list[INVEN_RARM + hand].sval;
1383 int now_exp = attacker_ptr->weapon_exp[tval][sval];
1384 if (now_exp < s_info[attacker_ptr->pclass].w_max[tval][sval])
1387 if (now_exp < WEAPON_EXP_BEGINNER) amount = 80;
1388 else if (now_exp < WEAPON_EXP_SKILLED) amount = 10;
1389 else if ((now_exp < WEAPON_EXP_EXPERT) && (attacker_ptr->lev > 19)) amount = 1;
1390 else if ((attacker_ptr->lev > 34) && one_in_(2)) amount = 1;
1391 attacker_ptr->weapon_exp[tval][sval] += amount;
1392 attacker_ptr->update |= (PU_BONUS);
1397 /* Disturb the monster */
1398 (void)set_monster_csleep(attacker_ptr, g_ptr->m_idx, 0);
1400 monster_desc(attacker_ptr, m_name, m_ptr, 0);
1402 /* Calculate the "attack quality" */
1403 bonus = attacker_ptr->to_h[hand] + o_ptr->to_h;
1404 chance = (attacker_ptr->skill_thn + (bonus * BTH_PLUS_ADJ));
1405 if (mode == HISSATSU_IAI) chance += 60;
1406 if (attacker_ptr->special_defense & KATA_KOUKIJIN) chance += 150;
1407 if (attacker_ptr->sutemi) chance = MAX(chance * 3 / 2, chance + 60);
1409 vir = virtue_number(attacker_ptr, V_VALOUR);
1412 chance += (attacker_ptr->virtues[vir - 1] / 10);
1415 zantetsu_mukou = ((o_ptr->name1 == ART_ZANTETSU) && (r_ptr->d_char == 'j'));
1416 e_j_mukou = ((o_ptr->name1 == ART_EXCALIBUR_J) && (r_ptr->d_char == 'S'));
1418 if ((mode == HISSATSU_KYUSHO) || (mode == HISSATSU_MINEUCHI) || (mode == HISSATSU_3DAN) || (mode == HISSATSU_IAI)) num_blow = 1;
1419 else if (mode == HISSATSU_COLD) num_blow = attacker_ptr->num_blow[hand] + 2;
1420 else num_blow = attacker_ptr->num_blow[hand];
1422 /* Hack -- DOKUBARI always hit once */
1423 if ((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) num_blow = 1;
1425 /* Attack once for each legal blow */
1426 while ((num++ < num_blow) && !attacker_ptr->is_dead)
1428 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) || (mode == HISSATSU_KYUSHO))
1432 if (attacker_ptr->migite && attacker_ptr->hidarite)
1436 if (mode == HISSATSU_3DAN)
1441 success_hit = one_in_(n);
1443 else if ((attacker_ptr->pclass == CLASS_NINJA) && ((backstab || fuiuchi) && !(r_ptr->flagsr & RFR_RES_ALL))) success_hit = TRUE;
1444 else success_hit = test_hit_norm(attacker_ptr, chance, r_ptr->ac, m_ptr->ml);
1446 if (mode == HISSATSU_MAJIN)
1449 success_hit = FALSE;
1454 backstab = FALSE; /* Clumsy! */
1455 fuiuchi = FALSE; /* Clumsy! */
1457 if ((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE) && one_in_(3))
1459 BIT_FLAGS flgs_aux[TR_FLAG_SIZE];
1463 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1464 msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
1465 object_flags(o_ptr, flgs_aux);
1467 k = damroll(o_ptr->dd + attacker_ptr->to_dd[hand], o_ptr->ds + attacker_ptr->to_ds[hand]);
1470 switch (attacker_ptr->mimic_form)
1473 switch (attacker_ptr->prace)
1480 case RACE_BARBARIAN:
1484 case RACE_HALF_TROLL:
1485 case RACE_HALF_OGRE:
1486 case RACE_HALF_GIANT:
1487 case RACE_HALF_TITAN:
1495 case RACE_DRACONIAN:
1502 case MIMIC_DEMON_LORD:
1509 if (attacker_ptr->align < 0 && mult < 20)
1511 if (!(attacker_ptr->resist_acid || is_oppose_acid(attacker_ptr) || attacker_ptr->immune_acid) && (mult < 25))
1513 if (!(attacker_ptr->resist_elec || is_oppose_elec(attacker_ptr) || attacker_ptr->immune_elec) && (mult < 25))
1515 if (!(attacker_ptr->resist_fire || is_oppose_fire(attacker_ptr) || attacker_ptr->immune_fire) && (mult < 25))
1517 if (!(attacker_ptr->resist_cold || is_oppose_cold(attacker_ptr) || attacker_ptr->immune_cold) && (mult < 25))
1519 if (!(attacker_ptr->resist_pois || is_oppose_pois(attacker_ptr)) && (mult < 25))
1522 if ((attacker_ptr->pclass != CLASS_SAMURAI) && (have_flag(flgs_aux, TR_FORCE_WEAPON)) && (attacker_ptr->csp > (attacker_ptr->msp / 30)))
1524 attacker_ptr->csp -= (1 + (attacker_ptr->msp / 30));
1525 attacker_ptr->redraw |= (PR_MANA);
1526 mult = mult * 3 / 2 + 20;
1528 k *= (HIT_POINT)mult;
1532 k = critical_norm(attacker_ptr, o_ptr->weight, o_ptr->to_h, k, attacker_ptr->to_h[hand], mode);
1536 msg_format(_("グッサリ切り裂かれた!", "Your weapon cuts deep into yourself!"));
1537 /* Try to increase the damage */
1543 k *= (HIT_POINT)mult;
1545 k += (attacker_ptr->to_d[hand] + o_ptr->to_d);
1548 take_hit(attacker_ptr, DAMAGE_FORCE, k, _("死の大鎌", "Death scythe"), -1);
1549 handle_stuff(attacker_ptr);
1554 msg_format(_("ミス! %sにかわされた。", "You miss %s."), m_name);
1560 int vorpal_chance = ((o_ptr->name1 == ART_VORPAL_BLADE) || (o_ptr->name1 == ART_CHAINSWORD)) ? 2 : 4;
1564 if (backstab) msg_format(_("あなたは冷酷にも眠っている無力な%sを突き刺した!", "You cruelly stab the helpless, sleeping %s!"), m_name);
1565 else if (fuiuchi) msg_format(_("不意を突いて%sに強烈な一撃を喰らわせた!", "You make surprise attack, and hit %s with a powerful blow!"), m_name);
1566 else if (stab_fleeing) msg_format(_("逃げる%sを背中から突き刺した!", "You backstab the fleeing %s!"), m_name);
1567 else if (!monk_attack) msg_format(_("%sを攻撃した。", "You hit %s."), m_name);
1569 /* Hack -- bare hands do one damage */
1572 object_flags(o_ptr, flgs);
1574 /* Select a chaotic effect (50% chance) */
1575 if ((have_flag(flgs, TR_CHAOTIC)) && one_in_(2))
1578 chg_virtue(attacker_ptr, V_CHANCE, 1);
1580 if (randint1(5) < 3)
1582 /* Vampiric (20%) */
1585 else if (one_in_(250))
1590 else if (!one_in_(10))
1592 /* Confusion (26.892%) */
1595 else if (one_in_(2))
1597 /* Teleport away (1.494%) */
1602 /* Polymorph (1.494%) */
1607 /* Vampiric drain */
1608 if ((have_flag(flgs, TR_VAMPIRIC)) || (chaos_effect == 1) || (mode == HISSATSU_DRAIN) || hex_spelling(attacker_ptr, HEX_VAMP_BLADE))
1610 /* Only drain "living" monsters */
1611 if (monster_living(m_ptr->r_idx))
1617 if ((have_flag(flgs, TR_VORPAL) || hex_spelling(attacker_ptr, HEX_RUNESWORD)) && (randint1(vorpal_chance * 3 / 2) == 1) && !zantetsu_mukou)
1619 else vorpal_cut = FALSE;
1623 int special_effect = 0, stun_effect = 0, times = 0, max_times;
1625 const martial_arts *ma_ptr = &ma_blows[0], *old_ptr = &ma_blows[0];
1626 int resist_stun = 0;
1629 if (r_ptr->flags1 & RF1_UNIQUE) resist_stun += 88;
1630 if (r_ptr->flags3 & RF3_NO_STUN) resist_stun += 66;
1631 if (r_ptr->flags3 & RF3_NO_CONF) resist_stun += 33;
1632 if (r_ptr->flags3 & RF3_NO_SLEEP) resist_stun += 33;
1633 if ((r_ptr->flags3 & RF3_UNDEAD) || (r_ptr->flags3 & RF3_NONLIVING))
1636 if (attacker_ptr->special_defense & KAMAE_BYAKKO)
1637 max_times = (attacker_ptr->lev < 3 ? 1 : attacker_ptr->lev / 3);
1638 else if (attacker_ptr->special_defense & KAMAE_SUZAKU)
1640 else if (attacker_ptr->special_defense & KAMAE_GENBU)
1643 max_times = (attacker_ptr->lev < 7 ? 1 : attacker_ptr->lev / 7);
1644 /* Attempt 'times' */
1645 for (times = 0; times < max_times; times++)
1649 ma_ptr = &ma_blows[randint0(MAX_MA)];
1650 if ((attacker_ptr->pclass == CLASS_FORCETRAINER) && (ma_ptr->min_level > 1)) min_level = ma_ptr->min_level + 3;
1651 else min_level = ma_ptr->min_level;
1652 } while ((min_level > attacker_ptr->lev) ||
1653 (randint1(attacker_ptr->lev) < ma_ptr->chance));
1655 /* keep the highest level attack available we found */
1656 if ((ma_ptr->min_level > old_ptr->min_level) &&
1657 !attacker_ptr->stun && !attacker_ptr->confused)
1661 if (current_world_ptr->wizard && cheat_xtra)
1663 msg_print(_("攻撃を再選択しました。", "Attack re-selected."));
1672 if (attacker_ptr->pclass == CLASS_FORCETRAINER) min_level = MAX(1, ma_ptr->min_level - 3);
1673 else min_level = ma_ptr->min_level;
1674 k = damroll(ma_ptr->dd + attacker_ptr->to_dd[hand], ma_ptr->ds + attacker_ptr->to_ds[hand]);
1675 if (attacker_ptr->special_attack & ATTACK_SUIKEN) k *= 2;
1677 if (ma_ptr->effect == MA_KNEE)
1679 if (r_ptr->flags1 & RF1_MALE)
1681 msg_format(_("%sに金的膝蹴りをくらわした!", "You hit %s in the groin with your knee!"), m_name);
1683 special_effect = MA_KNEE;
1686 msg_format(ma_ptr->desc, m_name);
1689 else if (ma_ptr->effect == MA_SLOW)
1691 if (!((r_ptr->flags1 & RF1_NEVER_MOVE) ||
1692 my_strchr("~#{}.UjmeEv$,DdsbBFIJQSXclnw!=?", r_ptr->d_char)))
1694 msg_format(_("%sの足首に関節蹴りをくらわした!", "You kick %s in the ankle."), m_name);
1695 special_effect = MA_SLOW;
1697 else msg_format(ma_ptr->desc, m_name);
1703 stun_effect = (ma_ptr->effect / 2) + randint1(ma_ptr->effect / 2);
1706 msg_format(ma_ptr->desc, m_name);
1709 if (attacker_ptr->special_defense & KAMAE_SUZAKU) weight = 4;
1710 if ((attacker_ptr->pclass == CLASS_FORCETRAINER) && P_PTR_KI)
1712 weight += (P_PTR_KI / 30);
1713 if (weight > 20) weight = 20;
1716 k = critical_norm(attacker_ptr, attacker_ptr->lev * weight, min_level, k, attacker_ptr->to_h[0], 0);
1718 if ((special_effect == MA_KNEE) && ((k + attacker_ptr->to_d[hand]) < m_ptr->hp))
1720 msg_format(_("%^sは苦痛にうめいている!", "%^s moans in agony!"), m_name);
1721 stun_effect = 7 + randint1(13);
1725 else if ((special_effect == MA_SLOW) && ((k + attacker_ptr->to_d[hand]) < m_ptr->hp))
1727 if (!(r_ptr->flags1 & RF1_UNIQUE) &&
1728 (randint1(attacker_ptr->lev) > r_ptr->level) &&
1731 msg_format(_("%^sは足をひきずり始めた。", "%^s starts limping slower."), m_name);
1732 m_ptr->mspeed -= 10;
1736 if (stun_effect && ((k + attacker_ptr->to_d[hand]) < m_ptr->hp))
1738 if (attacker_ptr->lev > randint1(r_ptr->level + resist_stun + 10))
1740 if (set_monster_stunned(attacker_ptr, g_ptr->m_idx, stun_effect + MON_STUNNED(m_ptr)))
1742 msg_format(_("%^sはフラフラになった。", "%^s is stunned."), m_name);
1746 msg_format(_("%^sはさらにフラフラになった。", "%^s is more stunned."), m_name);
1752 /* Handle normal weapon */
1753 else if (o_ptr->k_idx)
1755 k = damroll(o_ptr->dd + attacker_ptr->to_dd[hand], o_ptr->ds + attacker_ptr->to_ds[hand]);
1756 k = tot_dam_aux(attacker_ptr, o_ptr, k, m_ptr, mode, FALSE);
1760 k *= (3 + (attacker_ptr->lev / 20));
1764 k = k * (5 + (attacker_ptr->lev * 2 / 25)) / 2;
1766 else if (stab_fleeing)
1771 if ((attacker_ptr->impact[hand] && ((k > 50) || one_in_(7))) ||
1772 (chaos_effect == 2) || (mode == HISSATSU_QUAKE))
1777 if ((!(o_ptr->tval == TV_SWORD) || !(o_ptr->sval == SV_POISON_NEEDLE)) && !(mode == HISSATSU_KYUSHO))
1778 k = critical_norm(attacker_ptr, o_ptr->weight, o_ptr->to_h, k, attacker_ptr->to_h[hand], mode);
1786 if ((o_ptr->name1 == ART_CHAINSWORD) && !one_in_(2))
1788 char chainsword_noise[1024];
1789 if (!get_rnd_line(_("chainswd_j.txt", "chainswd.txt"), 0, chainsword_noise))
1791 msg_print(chainsword_noise);
1795 if (o_ptr->name1 == ART_VORPAL_BLADE)
1797 msg_print(_("目にも止まらぬヴォーパルブレード、手錬の早業!", "Your Vorpal Blade goes snicker-snack!"));
1801 msg_format(_("%sをグッサリ切り裂いた!", "Your weapon cuts deep into %s!"), m_name);
1804 /* Try to increase the damage */
1805 while (one_in_(vorpal_chance))
1810 k *= (HIT_POINT)mult;
1813 if (((r_ptr->flagsr & RFR_RES_ALL) ? k / 100 : k) > m_ptr->hp)
1815 msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), m_name);
1821 case 2: msg_format(_("%sを斬った!", "You gouge %s!"), m_name); break;
1822 case 3: msg_format(_("%sをぶった斬った!", "You maim %s!"), m_name); break;
1823 case 4: msg_format(_("%sをメッタ斬りにした!", "You carve %s!"), m_name); break;
1824 case 5: msg_format(_("%sをメッタメタに斬った!", "You cleave %s!"), m_name); break;
1825 case 6: msg_format(_("%sを刺身にした!", "You smite %s!"), m_name); break;
1826 case 7: msg_format(_("%sを斬って斬って斬りまくった!", "You eviscerate %s!"), m_name); break;
1827 default: msg_format(_("%sを細切れにした!", "You shred %s!"), m_name); break;
1830 drain_result = drain_result * 3 / 2;
1834 drain_result += o_ptr->to_d;
1837 /* Apply the player damage bonuses */
1838 k += attacker_ptr->to_d[hand];
1839 drain_result += attacker_ptr->to_d[hand];
1841 if ((mode == HISSATSU_SUTEMI) || (mode == HISSATSU_3DAN)) k *= 2;
1842 if ((mode == HISSATSU_SEKIRYUKA) && !monster_living(m_ptr->r_idx)) k = 0;
1843 if ((mode == HISSATSU_SEKIRYUKA) && !attacker_ptr->cut) k /= 2;
1845 /* No negative damage */
1848 if ((mode == HISSATSU_ZANMA) && !(!monster_living(m_ptr->r_idx) && (r_ptr->flags3 & RF3_EVIL)))
1855 msg_print(_("こんな軟らかいものは切れん!", "You cannot cut such a elastic thing!"));
1861 msg_print(_("蜘蛛は苦手だ!", "Spiders are difficult for you to deal with!"));
1865 if (mode == HISSATSU_MINEUCHI)
1867 int tmp = (10 + randint1(15) + attacker_ptr->lev / 5);
1870 anger_monster(attacker_ptr, m_ptr);
1872 if (!(r_ptr->flags3 & (RF3_NO_STUN)))
1875 if (MON_STUNNED(m_ptr))
1877 msg_format(_("%sはひどくもうろうとした。", "%s is more dazed."), m_name);
1882 msg_format(_("%s はもうろうとした。", "%s is dazed."), m_name);
1886 (void)set_monster_stunned(attacker_ptr, g_ptr->m_idx, MON_STUNNED(m_ptr) + tmp);
1890 msg_format(_("%s には効果がなかった。", "%s is not effected."), m_name);
1894 /* Modify the damage */
1895 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))));
1896 if (((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_POISON_NEEDLE)) || (mode == HISSATSU_KYUSHO))
1898 if ((randint1(randint1(r_ptr->level / 7) + 5) == 1) && !(r_ptr->flags1 & RF1_UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2))
1901 msg_format(_("%sの急所を突き刺した!", "You hit %s on a fatal spot!"), m_name);
1905 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)))
1907 int maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
1908 if (one_in_(backstab ? 13 : (stab_fleeing || fuiuchi) ? 15 : 27))
1912 msg_format(_("刃が%sに深々と突き刺さった!", "You critically injured %s!"), m_name);
1914 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)))
1916 if ((r_ptr->flags1 & RF1_UNIQUE) || (r_ptr->flags7 & RF7_UNIQUE2) || (m_ptr->hp >= maxhp / 2))
1918 k = MAX(k * 5, m_ptr->hp / 2);
1920 msg_format(_("%sに致命傷を負わせた!", "You fatally injured %s!"), m_name);
1925 msg_format(_("刃が%sの急所を貫いた!", "You hit %s on a fatal spot!"), m_name);
1930 msg_format_wizard(CHEAT_MONSTER,
1931 _("%dのダメージを与えた。(残りHP %d/%d(%d))", "You do %d damage. (left HP %d/%d(%d))"), k,
1932 m_ptr->hp - k, m_ptr->maxhp, m_ptr->max_maxhp);
1934 if (k <= 0) can_drain = FALSE;
1936 if (drain_result > m_ptr->hp)
1937 drain_result = m_ptr->hp;
1939 /* Damage, check for fear and death */
1940 if (mon_take_hit(attacker_ptr, g_ptr->m_idx, k, fear, NULL))
1943 if ((attacker_ptr->pclass == CLASS_BERSERKER) && attacker_ptr->energy_use)
1945 if (attacker_ptr->migite && attacker_ptr->hidarite)
1947 if (hand) attacker_ptr->energy_use = attacker_ptr->energy_use * 3 / 5 + attacker_ptr->energy_use*num * 2 / (attacker_ptr->num_blow[hand] * 5);
1948 else attacker_ptr->energy_use = attacker_ptr->energy_use*num * 3 / (attacker_ptr->num_blow[hand] * 5);
1952 attacker_ptr->energy_use = attacker_ptr->energy_use*num / attacker_ptr->num_blow[hand];
1955 if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel)
1956 msg_print(_("またつまらぬものを斬ってしまった...", "Sigh... Another trifling thing I've cut...."));
1960 /* Anger the monster */
1961 if (k > 0) anger_monster(attacker_ptr, m_ptr);
1963 touch_zap_player(m_ptr, attacker_ptr);
1965 /* Are we draining it? A little note: If the monster is
1966 dead, the drain does not work... */
1968 if (can_drain && (drain_result > 0))
1970 if (o_ptr->name1 == ART_MURAMASA)
1974 HIT_PROB to_h = o_ptr->to_h;
1975 HIT_POINT to_d = o_ptr->to_d;
1979 for (i = 0; i < to_h + 3; i++) if (one_in_(4)) flag = 0;
1983 for (i = 0; i < to_d + 3; i++) if (one_in_(4)) flag = 0;
1986 if (o_ptr->to_h != to_h || o_ptr->to_d != to_d)
1988 msg_print(_("妖刀は血を吸って強くなった!", "Muramasa sucked blood, and became more powerful!"));
1996 if (drain_result > 5) /* Did we really hurt it? */
1998 drain_heal = damroll(2, drain_result / 6);
2000 if (hex_spelling(attacker_ptr, HEX_VAMP_BLADE)) drain_heal *= 2;
2004 msg_format(_("Draining left: %d", "Draining left: %d"), drain_left);
2009 if (drain_heal < drain_left)
2011 drain_left -= drain_heal;
2015 drain_heal = drain_left;
2021 msg_format(_("刃が%sから生命力を吸い取った!", "Your weapon drains life from %s!"), m_name);
2025 drain_heal = (drain_heal * attacker_ptr->mutant_regenerate_mod) / 100;
2027 hp_player(attacker_ptr, drain_heal);
2028 /* We get to keep some of it! */
2033 m_ptr->maxhp -= (k + 7) / 8;
2034 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
2035 if (m_ptr->maxhp < 1) m_ptr->maxhp = 1;
2042 /* Confusion attack */
2043 if ((attacker_ptr->special_attack & ATTACK_CONFUSE) || (chaos_effect == 3) || (mode == HISSATSU_CONF) || hex_spelling(attacker_ptr, HEX_CONFUSION))
2045 /* Cancel glowing hands */
2046 if (attacker_ptr->special_attack & ATTACK_CONFUSE)
2048 attacker_ptr->special_attack &= ~(ATTACK_CONFUSE);
2049 msg_print(_("手の輝きがなくなった。", "Your hands stop glowing."));
2050 attacker_ptr->redraw |= (PR_STATUS);
2054 /* Confuse the monster */
2055 if (r_ptr->flags3 & RF3_NO_CONF)
2057 if (is_original_ap_and_seen(attacker_ptr, m_ptr)) r_ptr->r_flags3 |= RF3_NO_CONF;
2058 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2061 else if (randint0(100) < r_ptr->level)
2063 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2067 msg_format(_("%^sは混乱したようだ。", "%^s appears confused."), m_name);
2068 (void)set_monster_confused(attacker_ptr, g_ptr->m_idx, MON_CONFUSED(m_ptr) + 10 + randint0(attacker_ptr->lev) / 5);
2072 else if (chaos_effect == 4)
2074 bool resists_tele = FALSE;
2076 if (r_ptr->flagsr & RFR_RES_TELE)
2078 if (r_ptr->flags1 & RF1_UNIQUE)
2080 if (is_original_ap_and_seen(attacker_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2081 msg_format(_("%^sには効果がなかった。", "%^s is unaffected!"), m_name);
2082 resists_tele = TRUE;
2084 else if (r_ptr->level > randint1(100))
2086 if (is_original_ap_and_seen(attacker_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
2087 msg_format(_("%^sは抵抗力を持っている!", "%^s resists!"), m_name);
2088 resists_tele = TRUE;
2094 msg_format(_("%^sは消えた!", "%^s disappears!"), m_name);
2095 teleport_away(attacker_ptr, g_ptr->m_idx, 50, TELEPORT_PASSIVE);
2096 num = num_blow + 1; /* Can't hit it anymore! */
2101 else if ((chaos_effect == 5) && (randint1(90) > r_ptr->level))
2103 if (!(r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) &&
2104 !(r_ptr->flagsr & RFR_EFF_RES_CHAO_MASK))
2106 if (polymorph_monster(attacker_ptr, y, x))
2108 msg_format(_("%^sは変化した!", "%^s changes!"), m_name);
2114 msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
2117 /* Hack -- Get new monster */
2118 m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
2120 /* Oops, we need a different name... */
2121 monster_desc(attacker_ptr, m_name, m_ptr, 0);
2123 /* Hack -- Get new race */
2124 r_ptr = &r_info[m_ptr->r_idx];
2127 else if (o_ptr->name1 == ART_G_HAMMER)
2129 monster_type *target_ptr = &floor_ptr->m_list[g_ptr->m_idx];
2131 if (target_ptr->hold_o_idx)
2133 object_type *q_ptr = &floor_ptr->o_list[target_ptr->hold_o_idx];
2134 GAME_TEXT o_name[MAX_NLEN];
2136 object_desc(attacker_ptr, o_name, q_ptr, OD_NAME_ONLY);
2137 q_ptr->held_m_idx = 0;
2138 q_ptr->marked = OM_TOUCHED;
2139 target_ptr->hold_o_idx = q_ptr->next_o_idx;
2140 q_ptr->next_o_idx = 0;
2141 msg_format(_("%sを奪った。", "You snatched %s."), o_name);
2142 inven_carry(attacker_ptr, q_ptr);
2150 if (weak && !(*mdeath))
2152 msg_format(_("%sは弱くなったようだ。", "%^s seems weakened."), m_name);
2155 if ((drain_left != MAX_VAMPIRIC_DRAIN) && one_in_(4))
2157 chg_virtue(attacker_ptr, V_UNLIFE, 1);
2161 k -- apply earthquake brand */
2164 earthquake(attacker_ptr, attacker_ptr->y, attacker_ptr->x, 10, 0);
2165 if (!floor_ptr->grid_array[y][x].m_idx) *mdeath = TRUE;
2171 * @brief プレイヤーの打撃処理メインルーチン
2174 * @param mode 発動中の剣術ID
2175 * @return 実際に攻撃処理が行われた場合TRUEを返す。
2177 * If no "weapon" is available, then "punch" the monster one time.
2179 bool py_attack(player_type *attacker_ptr, POSITION y, POSITION x, COMBAT_OPTION_IDX mode)
2181 grid_type *g_ptr = &attacker_ptr->current_floor_ptr->grid_array[y][x];
2182 monster_type *m_ptr = &attacker_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
2183 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2184 GAME_TEXT m_name[MAX_NLEN];
2186 disturb(attacker_ptr, FALSE, TRUE);
2188 take_turn(attacker_ptr, 100);
2190 if (!attacker_ptr->migite && !attacker_ptr->hidarite &&
2191 !(attacker_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
2193 msg_format(_("%s攻撃できない。", "You cannot do attacking."),
2194 (empty_hands(attacker_ptr, FALSE) == EMPTY_HAND_NONE) ? _("両手がふさがって", "") : "");
2198 monster_desc(attacker_ptr, m_name, m_ptr, 0);
2202 /* Auto-Recall if possible and visible */
2203 if (!attacker_ptr->image) monster_race_track(attacker_ptr, m_ptr->ap_r_idx);
2205 health_track(attacker_ptr, g_ptr->m_idx);
2208 if ((r_ptr->flags1 & RF1_FEMALE) &&
2209 !(attacker_ptr->stun || attacker_ptr->confused || attacker_ptr->image || !m_ptr->ml))
2211 if ((attacker_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) || (attacker_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU))
2213 msg_print(_("拙者、おなごは斬れぬ!", "I can not attack women!"));
2218 if (d_info[attacker_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
2220 msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
2224 /* Stop if friendly */
2225 bool stormbringer = FALSE;
2226 if (!is_hostile(m_ptr) &&
2227 !(attacker_ptr->stun || attacker_ptr->confused || attacker_ptr->image ||
2228 attacker_ptr->shero || !m_ptr->ml))
2230 if (attacker_ptr->inventory_list[INVEN_RARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2231 if (attacker_ptr->inventory_list[INVEN_LARM].name1 == ART_STORMBRINGER) stormbringer = TRUE;
2234 msg_format(_("黒い刃は強欲に%sを攻撃した!", "Your black blade greedily attacks %s!"), m_name);
2235 chg_virtue(attacker_ptr, V_INDIVIDUALISM, 1);
2236 chg_virtue(attacker_ptr, V_HONOUR, -1);
2237 chg_virtue(attacker_ptr, V_JUSTICE, -1);
2238 chg_virtue(attacker_ptr, V_COMPASSION, -1);
2240 else if (attacker_ptr->pclass != CLASS_BERSERKER)
2242 if (get_check(_("本当に攻撃しますか?", "Really hit it? ")))
2244 chg_virtue(attacker_ptr, V_INDIVIDUALISM, 1);
2245 chg_virtue(attacker_ptr, V_HONOUR, -1);
2246 chg_virtue(attacker_ptr, V_JUSTICE, -1);
2247 chg_virtue(attacker_ptr, V_COMPASSION, -1);
2251 msg_format(_("%sを攻撃するのを止めた。", "You stop to avoid hitting %s."), m_name);
2257 /* Handle player fear */
2258 if (attacker_ptr->afraid)
2261 msg_format(_("恐くて%sを攻撃できない!", "You are too afraid to attack %s!"), m_name);
2263 msg_format(_("そっちには何か恐いものがいる!", "There is something scary in your way!"));
2265 /* Disturb the monster */
2266 (void)set_monster_csleep(attacker_ptr, g_ptr->m_idx, 0);
2271 if (MON_CSLEEP(m_ptr)) /* It is not honorable etc to attack helpless victims */
2273 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(attacker_ptr, V_COMPASSION, -1);
2274 if (!(r_ptr->flags3 & RF3_EVIL) || one_in_(5)) chg_virtue(attacker_ptr, V_HONOUR, -1);
2277 if (attacker_ptr->migite && attacker_ptr->hidarite)
2279 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))
2281 if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_BEGINNER)
2282 attacker_ptr->skill_exp[GINOU_NITOURYU] += 80;
2283 else if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_SKILLED)
2284 attacker_ptr->skill_exp[GINOU_NITOURYU] += 4;
2285 else if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_EXPERT)
2286 attacker_ptr->skill_exp[GINOU_NITOURYU] += 1;
2287 else if (attacker_ptr->skill_exp[GINOU_NITOURYU] < WEAPON_EXP_MASTER)
2288 if (one_in_(3)) attacker_ptr->skill_exp[GINOU_NITOURYU] += 1;
2289 attacker_ptr->update |= (PU_BONUS);
2293 /* Gain riding experience */
2294 if (attacker_ptr->riding)
2296 int cur = attacker_ptr->skill_exp[GINOU_RIDING];
2297 int max = s_info[attacker_ptr->pclass].s_max[GINOU_RIDING];
2301 DEPTH ridinglevel = r_info[attacker_ptr->current_floor_ptr->m_list[attacker_ptr->riding].r_idx].level;
2302 DEPTH targetlevel = r_ptr->level;
2305 if ((cur / 200 - 5) < targetlevel)
2308 /* Extra experience */
2309 if ((cur / 100) < ridinglevel)
2311 if ((cur / 100 + 15) < ridinglevel)
2312 inc += 1 + (ridinglevel - (cur / 100 + 15));
2317 attacker_ptr->skill_exp[GINOU_RIDING] = MIN(max, cur + inc);
2318 attacker_ptr->update |= (PU_BONUS);
2322 attacker_ptr->riding_t_m_idx = g_ptr->m_idx;
2324 bool mdeath = FALSE;
2325 if (attacker_ptr->migite) py_attack_aux(attacker_ptr, y, x, &fear, &mdeath, 0, mode);
2326 if (attacker_ptr->hidarite && !mdeath) py_attack_aux(attacker_ptr, y, x, &fear, &mdeath, 1, mode);
2328 /* Mutations which yield extra 'natural' attacks */
2331 if ((attacker_ptr->muta2 & MUT2_HORNS) && !mdeath)
2332 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_HORNS, &fear, &mdeath);
2333 if ((attacker_ptr->muta2 & MUT2_BEAK) && !mdeath)
2334 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_BEAK, &fear, &mdeath);
2335 if ((attacker_ptr->muta2 & MUT2_SCOR_TAIL) && !mdeath)
2336 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_SCOR_TAIL, &fear, &mdeath);
2337 if ((attacker_ptr->muta2 & MUT2_TRUNK) && !mdeath)
2338 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_TRUNK, &fear, &mdeath);
2339 if ((attacker_ptr->muta2 & MUT2_TENTACLES) && !mdeath)
2340 natural_attack(attacker_ptr, g_ptr->m_idx, MUT2_TENTACLES, &fear, &mdeath);
2343 /* Hack -- delay fear messages */
2344 if (fear && m_ptr->ml && !mdeath)
2348 msg_format(_("%^sは恐怖して逃げ出した!", "%^s flees in terror!"), m_name);
2351 if ((attacker_ptr->special_defense & KATA_IAI) && ((mode != HISSATSU_IAI) || mdeath))
2353 set_action(attacker_ptr, ACTION_NONE);
2361 * @brief モンスターからプレイヤーへの打撃処理 / Attack the player via physical attacks.
2362 * @param m_idx 打撃を行うモンスターのID
2363 * @return 実際に攻撃処理を行った場合TRUEを返す
2365 bool make_attack_normal(player_type *target_ptr, MONSTER_IDX m_idx)
2367 floor_type *floor_ptr = target_ptr->current_floor_ptr;
2368 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
2369 monster_race *r_ptr = &r_info[m_ptr->r_idx];
2374 int do_cut, do_stun;
2378 GAME_TEXT o_name[MAX_NLEN];
2379 GAME_TEXT m_name[MAX_NLEN];
2380 GAME_TEXT ddesc[80];
2383 bool touched = FALSE, fear = FALSE, alive = TRUE;
2384 bool explode = FALSE;
2385 bool do_silly_attack = (one_in_(2) && target_ptr->image);
2386 HIT_POINT get_damage = 0;
2387 int abbreviate = 0; // 2回目以降の省略表現フラグ
2389 /* Not allowed to attack */
2390 if (r_ptr->flags1 & (RF1_NEVER_BLOW)) return FALSE;
2392 if (d_info[target_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return FALSE;
2394 /* ...nor if friendly */
2395 if (!is_hostile(m_ptr)) return FALSE;
2397 /* Extract the effective monster level */
2398 rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
2400 /* Get the monster name (or "it") */
2401 monster_desc(target_ptr, m_name, m_ptr, 0);
2403 monster_desc(target_ptr, ddesc, m_ptr, MD_WRONGDOER_NAME);
2405 if (target_ptr->special_defense & KATA_IAI)
2407 msg_format(_("相手が襲いかかる前に素早く武器を振るった。", "You took sen, drew and cut in one motion before %s moved."), m_name);
2408 if (py_attack(target_ptr, m_ptr->fy, m_ptr->fx, HISSATSU_IAI)) return TRUE;
2411 if ((target_ptr->special_defense & NINJA_KAWARIMI) && (randint0(55) < (target_ptr->lev*3/5+20)))
2413 if (kawarimi(target_ptr, TRUE)) return TRUE;
2416 /* Assume no blink */
2419 /* Scan through all four blows */
2420 for (int ap_cnt = 0; ap_cnt < 4; ap_cnt++)
2422 bool obvious = FALSE;
2424 HIT_POINT power = 0;
2425 HIT_POINT damage = 0;
2429 /* Extract the attack infomation */
2430 int effect = r_ptr->blow[ap_cnt].effect;
2431 int method = r_ptr->blow[ap_cnt].method;
2432 int d_dice = r_ptr->blow[ap_cnt].d_dice;
2433 int d_side = r_ptr->blow[ap_cnt].d_side;
2435 if (!monster_is_valid(m_ptr)) break;
2437 /* Hack -- no more attacks */
2440 if (is_pet(m_ptr) && (r_ptr->flags1 & RF1_UNIQUE) && (method == RBM_EXPLODE))
2446 /* Stop if player is dead or gone */
2447 if (!target_ptr->playing || target_ptr->is_dead) break;
2448 if (distance(target_ptr->y, target_ptr->x, m_ptr->fy, m_ptr->fx) > 1) break;
2450 /* Handle "leaving" */
2451 if (target_ptr->leaving) break;
2453 if (method == RBM_SHOOT) continue;
2455 /* Extract the attack "power" */
2456 power = mbe_info[effect].power;
2459 ac = target_ptr->ac + target_ptr->to_a;
2461 /* Monster hits player */
2462 if (!effect || check_hit(target_ptr, power, rlev, MON_STUNNED(m_ptr)))
2464 /* Always disturbing */
2465 disturb(target_ptr, TRUE, TRUE);
2468 /* Hack -- Apply "protection from evil" */
2469 if ((target_ptr->protevil > 0) &&
2470 (r_ptr->flags3 & RF3_EVIL) &&
2471 (target_ptr->lev >= rlev) &&
2472 ((randint0(100) + target_ptr->lev) > 50))
2474 /* Remember the Evil-ness */
2475 if (is_original_ap_and_seen(target_ptr, m_ptr)) r_ptr->r_flags3 |= RF3_EVIL;
2478 if (abbreviate) msg_format("撃退した。");
2479 else msg_format("%^sは撃退された。", m_name);
2480 abbreviate = 1; /*2回目以降は省略 */
2482 msg_format("%^s is repelled.", m_name);
2488 /* Assume no cut or stun */
2489 do_cut = do_stun = 0;
2491 /* Describe the attack method */
2496 act = _("殴られた。", "hits you.");
2497 do_cut = do_stun = 1;
2505 act = _("触られた。", "touches you.");
2513 act = _("パンチされた。", "punches you.");
2522 act = _("蹴られた。", "kicks you.");
2531 act = _("ひっかかれた。", "claws you.");
2540 act = _("噛まれた。", "bites you.");
2549 act = _("刺された。", "stings you.");
2557 act = _("斬られた。", "slashes you.");
2566 act = _("角で突かれた。", "butts you.");
2575 act = _("体当たりされた。", "crushes you.");
2584 act = _("飲み込まれた。", "engulfs you.");
2593 act = _("は請求書をよこした。", "charges you.");
2595 sound(SOUND_BUY); /* Note! This is "charges", not "charges at". */
2602 act = _("が体の上を這い回った。", "crawls on you.");
2610 act = _("よだれをたらされた。", "drools on you.");
2617 act = _("唾を吐かれた。", "spits on you.");
2625 act = _("は爆発した。", "explodes.");
2632 act = _("にらまれた。", "gazes at you.");
2638 act = _("泣き叫ばれた。", "wails at you.");
2645 act = _("胞子を飛ばされた。", "releases spores at you.");
2653 act = _("が XXX4 を発射した。", "projects XXX4's at you.");
2659 act = _("金をせがまれた。", "begs you for money.");
2669 act = desc_insult[randint0(m_ptr->r_idx == MON_DEBBY ? 10 : 8)];
2679 act = desc_moan[randint0(4)];
2689 if (m_ptr->r_idx == MON_JAIAN)
2692 switch(randint1(15))
2697 act = "「♪お~れはジャイアン~~ガ~キだいしょう~」";
2700 act = "「♪て~んかむ~てきのお~とこだぜ~~」";
2703 act = "「♪の~び太スネ夫はメじゃないよ~~」";
2706 act = "「♪け~んかスポ~ツ~どんとこい~」";
2709 act = "「♪うた~も~~う~まいぜ~まかしとけ~」";
2712 act = "「♪ま~ちいちば~んのに~んきもの~~」";
2715 act = "「♪べんきょうしゅくだいメじゃないよ~~」";
2718 act = "「♪きはやさし~くて~ち~からもち~」";
2721 act = "「♪かお~も~~スタイルも~バツグンさ~」";
2724 act = "「♪がっこうい~ちの~あ~ばれんぼう~~」";
2727 act = "「♪ド~ラもドラミもメじゃないよ~~」";
2730 act = "「♪よじげんぽけっと~な~くたって~」";
2733 act = "「♪あし~の~~ながさ~は~まけないぜ~」";
2737 act = "horribly sings 'I AM GIAAAAAN. THE BOOOSS OF THE KIIIIDS.'";
2743 act = _("は♪僕らは楽しい家族♪と歌っている。", "sings 'We are a happy family.'");
2745 act = _("は♪アイ ラブ ユー、ユー ラブ ミー♪と歌っている。", "sings 'I love you, you love me.'");
2755 if (do_silly_attack)
2760 act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
2763 if (abbreviate == 0)
2764 msg_format("%^sに%s", m_name, act);
2765 else if (abbreviate == 1)
2766 msg_format("%s", act);
2767 else /* if (abbreviate == -1) */
2768 msg_format("%^s%s", m_name, act);
2769 abbreviate = 1;/*2回目以降は省略 */
2771 msg_format("%^s %s%s", m_name, act, do_silly_attack ? " you." : "");
2775 /* Hack -- assume all attacks are obvious */
2778 /* Roll out the damage */
2779 damage = damroll(d_dice, d_side);
2782 * Skip the effect when exploding, since the explosion
2783 * already causes the effect.
2785 if(explode) damage = 0;
2786 /* Apply appropriate damage */
2796 case RBE_SUPERHURT: /* AC軽減あり / Player armor reduces total damage */
2798 if (((randint1(rlev*2+300) > (ac+200)) || one_in_(13)) && !CHECK_MULTISHADOW(target_ptr))
2800 int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
2801 msg_print(_("痛恨の一撃!", "It was a critical hit!"));
2802 tmp_damage = MAX(damage, tmp_damage*2);
2804 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, tmp_damage, ddesc, -1);
2809 case RBE_HURT: /* AC軽減あり / Player armor reduces total damage */
2812 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
2813 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2821 /* Take "poison" effect */
2822 if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)) && !CHECK_MULTISHADOW(target_ptr))
2824 if (set_poisoned(target_ptr, target_ptr->poisoned + randint1(rlev) + 5))
2830 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2832 /* Learn about the player */
2833 update_smart_learn(target_ptr, m_idx, DRS_POIS);
2842 /* Allow complete resist */
2843 if (!target_ptr->resist_disen && !CHECK_MULTISHADOW(target_ptr))
2845 /* Apply disenchantment */
2846 if (apply_disenchant(target_ptr, 0))
2848 /* Hack -- Update AC */
2849 update_creature(target_ptr);
2854 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2856 /* Learn about the player */
2857 update_smart_learn(target_ptr, m_idx, DRS_DISEN);
2864 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2866 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
2869 for (k = 0; k < 10; k++)
2872 INVENTORY_IDX i = (INVENTORY_IDX)randint0(INVEN_PACK);
2874 /* Obtain the item */
2875 o_ptr = &target_ptr->inventory_list[i];
2876 if (!o_ptr->k_idx) continue;
2878 /* Drain charged wands/staffs */
2879 if (((o_ptr->tval == TV_STAFF) ||
2880 (o_ptr->tval == TV_WAND)) &&
2883 /* Calculate healed hitpoints */
2884 int heal=rlev * o_ptr->pval;
2885 if( o_ptr->tval == TV_STAFF)
2886 heal *= o_ptr->number;
2888 /* Don't heal more than max hp */
2889 heal = MIN(heal, m_ptr->maxhp - m_ptr->hp);
2891 msg_print(_("ザックからエネルギーが吸い取られた!", "Energy drains from your pack!"));
2895 /* Heal the monster */
2896 m_ptr->hp += (HIT_POINT)heal;
2898 /* Redraw (later) if needed */
2899 if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
2900 if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
2905 /* Combine / Reorder the pack */
2906 target_ptr->update |= (PU_COMBINE | PU_REORDER);
2907 target_ptr->window |= (PW_INVEN);
2918 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2920 /* Confused monsters cannot steal successfully. -LM-*/
2921 if (MON_CONFUSED(m_ptr)) break;
2923 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
2927 /* Saving throw (unless paralyzed) based on dex and level */
2928 if (!target_ptr->paralyzed &&
2929 (randint0(100) < (adj_dex_safe[target_ptr->stat_ind[A_DEX]] +
2932 /* Saving throw message */
2933 msg_print(_("しかし素早く財布を守った!", "You quickly protect your money pouch!"));
2935 /* Occasional blink anyway */
2936 if (randint0(3)) blinked = TRUE;
2942 gold = (target_ptr->au / 10) + randint1(25);
2943 if (gold < 2) gold = 2;
2944 if (gold > 5000) gold = (target_ptr->au / 20) + randint1(3000);
2945 if (gold > target_ptr->au) gold = target_ptr->au;
2946 target_ptr->au -= gold;
2949 msg_print(_("しかし何も盗まれなかった。", "Nothing was stolen."));
2951 else if (target_ptr->au)
2953 msg_print(_("財布が軽くなった気がする。", "Your purse feels lighter."));
2954 msg_format(_("$%ld のお金が盗まれた!", "%ld coins were stolen!"), (long)gold);
2955 chg_virtue(target_ptr, V_SACRIFICE, 1);
2959 msg_print(_("財布が軽くなった気がする。", "Your purse feels lighter."));
2960 msg_print(_("お金が全部盗まれた!", "All of your coins were stolen!"));
2961 chg_virtue(target_ptr, V_SACRIFICE, 2);
2965 target_ptr->redraw |= (PR_GOLD);
2967 target_ptr->window |= (PW_PLAYER);
2978 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
2980 /* Confused monsters cannot steal successfully. -LM-*/
2981 if (MON_CONFUSED(m_ptr)) break;
2983 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
2985 /* Saving throw (unless paralyzed) based on dex and level */
2986 if (!target_ptr->paralyzed && (randint0(100) < (adj_dex_safe[target_ptr->stat_ind[A_DEX]] + target_ptr->lev)))
2988 /* Saving throw message */
2989 msg_print(_("しかしあわててザックを取り返した!", "You grab hold of your backpack!"));
2991 /* Occasional "blink" anyway */
2998 for (k = 0; k < 10; k++)
3003 INVENTORY_IDX i = (INVENTORY_IDX)randint0(INVEN_PACK);
3005 /* Obtain the item */
3006 o_ptr = &target_ptr->inventory_list[i];
3007 if (!o_ptr->k_idx) continue;
3009 /* Skip artifacts */
3010 if (object_is_artifact(o_ptr)) continue;
3012 object_desc(target_ptr, o_name, o_ptr, OD_OMIT_PREFIX);
3015 msg_format("%s(%c)を%s盗まれた!", o_name, index_to_label(i), ((o_ptr->number > 1) ? "一つ" : ""));
3017 msg_format("%sour %s (%c) was stolen!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
3019 chg_virtue(target_ptr, V_SACRIFICE, 1);
3020 o_idx = o_pop(floor_ptr);
3026 j_ptr = &floor_ptr->o_list[o_idx];
3027 object_copy(j_ptr, o_ptr);
3032 /* Hack -- If a rod or wand, allocate total
3033 * maximum timeouts or charges between those
3034 * stolen and those missed. -LM-
3036 if ((o_ptr->tval == TV_ROD) || (o_ptr->tval == TV_WAND))
3038 j_ptr->pval = o_ptr->pval / o_ptr->number;
3039 o_ptr->pval -= j_ptr->pval;
3043 j_ptr->marked = OM_TOUCHED;
3045 /* Memorize monster */
3046 j_ptr->held_m_idx = m_idx;
3049 j_ptr->next_o_idx = m_ptr->hold_o_idx;
3052 m_ptr->hold_o_idx = o_idx;
3055 /* Steal the items */
3056 inven_item_increase(target_ptr, i, -1);
3057 inven_item_optimize(target_ptr, i);
3072 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3074 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3076 /* Steal some food */
3077 for (k = 0; k < 10; k++)
3079 /* Pick an item from the pack */
3080 INVENTORY_IDX i = (INVENTORY_IDX)randint0(INVEN_PACK);
3082 o_ptr = &target_ptr->inventory_list[i];
3083 if (!o_ptr->k_idx) continue;
3085 /* Skip non-food objects */
3086 if ((o_ptr->tval != TV_FOOD) && !((o_ptr->tval == TV_CORPSE) && (o_ptr->sval))) continue;
3088 object_desc(target_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
3091 msg_format("%s(%c)を%s食べられてしまった!", o_name, index_to_label(i), ((o_ptr->number > 1) ? "一つ" : ""));
3093 msg_format("%sour %s (%c) was eaten!", ((o_ptr->number > 1) ? "One of y" : "Y"), o_name, index_to_label(i));
3096 /* Steal the items */
3097 inven_item_increase(target_ptr, i, -1);
3098 inven_item_optimize(target_ptr, i);
3110 /* Access the lite */
3111 o_ptr = &target_ptr->inventory_list[INVEN_LITE];
3112 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3114 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3117 if ((o_ptr->xtra4 > 0) && (!object_is_fixed_artifact(o_ptr)))
3120 o_ptr->xtra4 -= (s16b)(250 + randint1(250));
3121 if (o_ptr->xtra4 < 1) o_ptr->xtra4 = 1;
3123 if (!target_ptr->blind)
3125 msg_print(_("明かりが暗くなってしまった。", "Your light dims."));
3129 target_ptr->window |= (PW_EQUIP);
3139 msg_print(_("酸を浴びせられた!", "You are covered in acid!"));
3140 get_damage += acid_dam(target_ptr, damage, ddesc, -1, FALSE);
3141 update_creature(target_ptr);
3142 update_smart_learn(target_ptr, m_idx, DRS_ACID);
3150 msg_print(_("電撃を浴びせられた!", "You are struck by electricity!"));
3151 get_damage += elec_dam(target_ptr, damage, ddesc, -1, FALSE);
3152 update_smart_learn(target_ptr, m_idx, DRS_ELEC);
3160 msg_print(_("全身が炎に包まれた!", "You are enveloped in flames!"));
3161 get_damage += fire_dam(target_ptr, damage, ddesc, -1, FALSE);
3162 update_smart_learn(target_ptr, m_idx, DRS_FIRE);
3170 msg_print(_("全身が冷気で覆われた!", "You are covered with frost!"));
3171 get_damage += cold_dam(target_ptr, damage, ddesc, -1, FALSE);
3172 update_smart_learn(target_ptr, m_idx, DRS_COLD);
3178 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3179 if (target_ptr->is_dead) break;
3181 /* Increase "blind" */
3182 if (!target_ptr->resist_blind && !CHECK_MULTISHADOW(target_ptr))
3184 if (set_blind(target_ptr, target_ptr->blind + 10 + randint1(rlev)))
3187 if (m_ptr->r_idx == MON_DIO) msg_print("どうだッ!この血の目潰しはッ!");
3195 /* Learn about the player */
3196 update_smart_learn(target_ptr, m_idx, DRS_BLIND);
3204 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3206 if (target_ptr->is_dead) break;
3208 /* Increase "confused" */
3209 if (!target_ptr->resist_conf && !CHECK_MULTISHADOW(target_ptr))
3211 if (set_confused(target_ptr, target_ptr->confused + 3 + randint1(rlev)))
3217 /* Learn about the player */
3218 update_smart_learn(target_ptr, m_idx, DRS_CONF);
3225 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3227 if (target_ptr->is_dead) break;
3229 /* Increase "afraid" */
3230 if (CHECK_MULTISHADOW(target_ptr))
3234 else if (target_ptr->resist_fear)
3236 msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
3239 else if (randint0(100 + r_ptr->level/2) < target_ptr->skill_sav)
3241 msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
3246 if (set_afraid(target_ptr, target_ptr->afraid + 3 + randint1(rlev)))
3252 /* Learn about the player */
3253 update_smart_learn(target_ptr, m_idx, DRS_FEAR);
3260 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3262 if (target_ptr->is_dead) break;
3264 /* Increase "paralyzed" */
3265 if (CHECK_MULTISHADOW(target_ptr))
3269 else if (target_ptr->free_act)
3271 msg_print(_("しかし効果がなかった!", "You are unaffected!"));
3274 else if (randint0(100 + r_ptr->level/2) < target_ptr->skill_sav)
3276 msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
3281 if (!target_ptr->paralyzed)
3283 if (set_paralyzed(target_ptr, 3 + randint1(rlev)))
3290 /* Learn about the player */
3291 update_smart_learn(target_ptr, m_idx, DRS_FREE);
3298 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3300 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3301 if (do_dec_stat(target_ptr, A_STR)) obvious = TRUE;
3308 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3310 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3311 if (do_dec_stat(target_ptr, A_INT)) obvious = TRUE;
3318 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3320 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3321 if (do_dec_stat(target_ptr, A_WIS)) obvious = TRUE;
3328 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3330 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3331 if (do_dec_stat(target_ptr, A_DEX)) obvious = TRUE;
3338 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3340 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3341 if (do_dec_stat(target_ptr, A_CON)) obvious = TRUE;
3348 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3350 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3351 if (do_dec_stat(target_ptr, A_CHR)) obvious = TRUE;
3358 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3360 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3362 /* Damage (stats) */
3363 if (do_dec_stat(target_ptr, A_STR)) obvious = TRUE;
3364 if (do_dec_stat(target_ptr, A_DEX)) obvious = TRUE;
3365 if (do_dec_stat(target_ptr, A_CON)) obvious = TRUE;
3366 if (do_dec_stat(target_ptr, A_INT)) obvious = TRUE;
3367 if (do_dec_stat(target_ptr, A_WIS)) obvious = TRUE;
3368 if (do_dec_stat(target_ptr, A_CHR)) obvious = TRUE;
3377 /* Hack -- Reduce damage based on the player armor class */
3378 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
3380 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3382 /* Radius 8 earthquake centered at the monster */
3383 if (damage > 23 || explode)
3385 earthquake(target_ptr, m_ptr->fy, m_ptr->fx, 8, m_idx);
3393 s32b d = damroll(10, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3397 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3399 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3401 (void)drain_exp(target_ptr, d, d / 10, 95);
3407 s32b d = damroll(20, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3411 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3413 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3415 (void)drain_exp(target_ptr, d, d / 10, 90);
3421 s32b d = damroll(40, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3425 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3427 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3429 (void)drain_exp(target_ptr, d, d / 10, 75);
3435 s32b d = damroll(80, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3439 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3441 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3443 (void)drain_exp(target_ptr, d, d / 10, 50);
3449 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3451 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3453 /* Take "poison" effect */
3454 if (!(target_ptr->resist_pois || is_oppose_pois(target_ptr)))
3456 if (set_poisoned(target_ptr, target_ptr->poisoned + randint1(rlev) + 5))
3462 /* Damage CON (10% chance)*/
3463 if ((randint1(100) < 11) && (target_ptr->prace != RACE_ANDROID))
3465 /* 1% chance for perm. damage */
3466 bool perm = one_in_(10);
3467 if (dec_stat(target_ptr, A_CON, randint1(10), perm))
3469 msg_print(_("病があなたを蝕んでいる気がする。", "You feel sickly."));
3479 if (!target_ptr->resist_time && !CHECK_MULTISHADOW(target_ptr))
3481 switch (randint1(10))
3483 case 1: case 2: case 3: case 4: case 5:
3485 if (target_ptr->prace == RACE_ANDROID) break;
3486 msg_print(_("人生が逆戻りした気がする。", "You feel like a chunk of the past has been ripped away."));
3487 lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
3491 case 6: case 7: case 8: case 9:
3493 int stat = randint0(6);
3498 case A_STR: act = "強く"; break;
3499 case A_INT: act = "聡明で"; break;
3500 case A_WIS: act = "賢明で"; break;
3501 case A_DEX: act = "器用で"; break;
3502 case A_CON: act = "健康で"; break;
3503 case A_CHR: act = "美しく"; break;
3505 case A_STR: act = "strong"; break;
3506 case A_INT: act = "bright"; break;
3507 case A_WIS: act = "wise"; break;
3508 case A_DEX: act = "agile"; break;
3509 case A_CON: act = "hale"; break;
3510 case A_CHR: act = "beautiful"; break;
3515 msg_format(_("あなたは以前ほど%sなくなってしまった...。", "You're not as %s as you used to be..."), act);
3516 target_ptr->stat_cur[stat] = (target_ptr->stat_cur[stat] * 3) / 4;
3517 if (target_ptr->stat_cur[stat] < 3) target_ptr->stat_cur[stat] = 3;
3518 target_ptr->update |= (PU_BONUS);
3524 msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
3526 for (k = 0; k < A_MAX; k++)
3528 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
3529 if (target_ptr->stat_cur[k] < 3) target_ptr->stat_cur[k] = 3;
3531 target_ptr->update |= (PU_BONUS);
3536 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3542 s32b d = damroll(60, 6) + (target_ptr->exp / 100) * MON_DRAIN_LIFE;
3547 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3549 if (target_ptr->is_dead || CHECK_MULTISHADOW(target_ptr)) break;
3551 resist_drain = !drain_exp(target_ptr, d, d / 10, 50);
3553 /* Heal the attacker? */
3554 if (target_ptr->mimic_form)
3556 if (mimic_info[target_ptr->mimic_form].MIMIC_FLAGS & MIMIC_IS_NONLIVING)
3557 resist_drain = TRUE;
3561 switch (target_ptr->prace)
3570 resist_drain = TRUE;
3575 if ((damage > 5) && !resist_drain)
3577 bool did_heal = FALSE;
3579 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
3582 m_ptr->hp += damroll(4, damage / 6);
3583 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
3585 /* Redraw (later) if needed */
3586 if (target_ptr->health_who == m_idx) target_ptr->redraw |= (PR_HEALTH);
3587 if (target_ptr->riding == m_idx) target_ptr->redraw |= (PR_UHEALTH);
3589 /* Special message */
3590 if (m_ptr->ml && did_heal)
3592 msg_format(_("%sは体力を回復したようだ。", "%^s appears healthier."), m_name);
3602 if (CHECK_MULTISHADOW(target_ptr))
3604 msg_print(_("攻撃は幻影に命中し、あなたには届かなかった。", "The attack hits Shadow, but you are unharmed!"));
3610 target_ptr->csp -= damage;
3611 if (target_ptr->csp < 0)
3613 target_ptr->csp = 0;
3614 target_ptr->csp_frac = 0;
3617 target_ptr->redraw |= (PR_MANA);
3620 /* Learn about the player */
3621 update_smart_learn(target_ptr, m_idx, DRS_MANA);
3627 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3629 if (target_ptr->is_dead) break;
3631 /* Decrease speed */
3632 if (CHECK_MULTISHADOW(target_ptr))
3638 if (set_slow(target_ptr, (target_ptr->slow + 4 + randint0(rlev / 10)), FALSE))
3648 get_damage += take_hit(target_ptr, DAMAGE_ATTACK, damage, ddesc, -1);
3650 if (target_ptr->is_dead) break;
3652 /* Decrease speed */
3653 if (target_ptr->resist_sound || CHECK_MULTISHADOW(target_ptr))
3659 if (set_stun(target_ptr, target_ptr->stun + 10 + randint1(r_ptr->level / 4)))
3669 /* Hack -- only one of cut or stun */
3670 if (do_cut && do_stun)
3673 if (randint0(100) < 50)
3690 /* Critical hit (zero if non-critical) */
3691 tmp = monster_critical(d_dice, d_side, damage);
3693 /* Roll for damage */
3696 case 0: cut_plus = 0; break;
3697 case 1: cut_plus = randint1(5); break;
3698 case 2: cut_plus = randint1(5) + 5; break;
3699 case 3: cut_plus = randint1(20) + 20; break;
3700 case 4: cut_plus = randint1(50) + 50; break;
3701 case 5: cut_plus = randint1(100) + 100; break;
3702 case 6: cut_plus = 300; break;
3703 default: cut_plus = 500; break;
3707 if (cut_plus) (void)set_cut(target_ptr,target_ptr->cut + cut_plus);
3715 /* Critical hit (zero if non-critical) */
3716 tmp = monster_critical(d_dice, d_side, damage);
3718 /* Roll for damage */
3721 case 0: stun_plus = 0; break;
3722 case 1: stun_plus = randint1(5); break;
3723 case 2: stun_plus = randint1(5) + 10; break;
3724 case 3: stun_plus = randint1(10) + 20; break;
3725 case 4: stun_plus = randint1(15) + 30; break;
3726 case 5: stun_plus = randint1(20) + 40; break;
3727 case 6: stun_plus = 80; break;
3728 default: stun_plus = 150; break;
3731 /* Apply the stun */
3732 if (stun_plus) (void)set_stun(target_ptr, target_ptr->stun + stun_plus);
3737 sound(SOUND_EXPLODE);
3739 if (mon_take_hit(target_ptr, m_idx, m_ptr->hp + 1, &fear, NULL))
3748 if (target_ptr->sh_fire && alive && !target_ptr->is_dead)
3750 if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
3752 HIT_POINT dam = damroll(2, 6);
3754 /* Modify the damage */
3755 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3757 msg_format(_("%^sは突然熱くなった!", "%^s is suddenly very hot!"), m_name);
3759 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は灰の山になった。", " turns into a pile of ash.")))
3767 if (is_original_ap_and_seen(target_ptr, m_ptr))
3768 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
3772 if (target_ptr->sh_elec && alive && !target_ptr->is_dead)
3774 if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
3776 HIT_POINT dam = damroll(2, 6);
3778 /* Modify the damage */
3779 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3781 msg_format(_("%^sは電撃をくらった!", "%^s gets zapped!"), m_name);
3782 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は燃え殻の山になった。", " turns into a pile of cinder.")))
3790 if (is_original_ap_and_seen(target_ptr, m_ptr))
3791 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
3795 if (target_ptr->sh_cold && alive && !target_ptr->is_dead)
3797 if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
3799 HIT_POINT dam = damroll(2, 6);
3801 /* Modify the damage */
3802 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3804 msg_format(_("%^sは冷気をくらった!", "%^s is very cold!"), m_name);
3805 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は凍りついた。", " was frozen.")))
3813 if (is_original_ap_and_seen(target_ptr, m_ptr))
3814 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
3819 if (target_ptr->dustrobe && alive && !target_ptr->is_dead)
3821 if (!(r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK))
3823 HIT_POINT dam = damroll(2, 6);
3825 /* Modify the damage */
3826 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3828 msg_format(_("%^sは鏡の破片をくらった!", "%^s gets zapped!"), m_name);
3829 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("はズタズタになった。", " had torn to pieces.")))
3837 if (is_original_ap_and_seen(target_ptr, m_ptr))
3838 r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_RES_SHAR_MASK);
3841 if (is_mirror_grid(&floor_ptr->grid_array[target_ptr->y][target_ptr->x]))
3843 teleport_player(target_ptr, 10, TELEPORT_SPONTANEOUS);
3847 if (target_ptr->tim_sh_holy && alive && !target_ptr->is_dead)
3849 if (r_ptr->flags3 & RF3_EVIL)
3851 if (!(r_ptr->flagsr & RFR_RES_ALL))
3853 HIT_POINT dam = damroll(2, 6);
3855 /* Modify the damage */
3856 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3858 msg_format(_("%^sは聖なるオーラで傷ついた!", "%^s is injured by holy power!"), m_name);
3859 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3864 if (is_original_ap_and_seen(target_ptr, m_ptr))
3865 r_ptr->r_flags3 |= RF3_EVIL;
3869 if (is_original_ap_and_seen(target_ptr, m_ptr))
3870 r_ptr->r_flagsr |= RFR_RES_ALL;
3875 if (target_ptr->tim_sh_touki && alive && !target_ptr->is_dead)
3877 if (!(r_ptr->flagsr & RFR_RES_ALL))
3879 HIT_POINT dam = damroll(2, 6);
3881 /* Modify the damage */
3882 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3884 msg_format(_("%^sが鋭い闘気のオーラで傷ついた!", "%^s is injured by the Force"), m_name);
3885 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3893 if (is_original_ap_and_seen(target_ptr, m_ptr))
3894 r_ptr->r_flagsr |= RFR_RES_ALL;
3898 if (hex_spelling(target_ptr, HEX_SHADOW_CLOAK) && alive && !target_ptr->is_dead)
3901 object_type *o_armed_ptr = &target_ptr->inventory_list[INVEN_RARM];
3903 if (!(r_ptr->flagsr & RFR_RES_ALL || r_ptr->flagsr & RFR_RES_DARK))
3905 if (o_armed_ptr->k_idx)
3907 int basedam = ((o_armed_ptr->dd + target_ptr->to_dd[0]) * (o_armed_ptr->ds + target_ptr->to_ds[0] + 1));
3908 dam = basedam / 2 + o_armed_ptr->to_d + target_ptr->to_d[0];
3911 /* Cursed armor makes damages doubled */
3912 o_armed_ptr = &target_ptr->inventory_list[INVEN_BODY];
3913 if ((o_armed_ptr->k_idx) && object_is_cursed(o_armed_ptr)) dam *= 2;
3915 /* Modify the damage */
3916 dam = mon_damage_mod(target_ptr, m_ptr, dam, FALSE);
3918 msg_format(_("影のオーラが%^sに反撃した!", "Enveloping shadows attack %^s."), m_name);
3919 if (mon_take_hit(target_ptr, m_idx, dam, &fear, _("は倒れた。", " is destroyed.")))
3924 else /* monster does not dead */
3927 BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
3928 EFFECT_ID typ[4][2] = {
3929 { INVEN_HEAD, GF_OLD_CONF },
3930 { INVEN_LARM, GF_OLD_SLEEP },
3931 { INVEN_HANDS, GF_TURN_ALL },
3932 { INVEN_FEET, GF_OLD_SLOW }
3935 /* Some cursed armours gives an extra effect */
3936 for (j = 0; j < 4; j++)
3938 o_armed_ptr = &target_ptr->inventory_list[typ[j][0]];
3939 if ((o_armed_ptr->k_idx) && object_is_cursed(o_armed_ptr) && object_is_armour(o_armed_ptr))
3940 project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, (target_ptr->lev * 2), typ[j][1], flg, -1);
3946 if (is_original_ap_and_seen(target_ptr, m_ptr))
3947 r_ptr->r_flagsr |= (RFR_RES_ALL | RFR_RES_DARK);
3953 /* Monster missed player */
3956 /* Analyze failed attacks */
3972 /* Visible monsters */
3975 disturb(target_ptr, TRUE, TRUE);
3979 msg_format("%sかわした。", (target_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "");
3981 msg_format("%s%^sの攻撃をかわした。", (target_ptr->special_attack & ATTACK_SUIKEN) ? "奇妙な動きで" : "", m_name);
3982 abbreviate = 1;/*2回目以降は省略 */
3984 msg_format("%^s misses you.", m_name);
3989 /* Gain shield experience */
3990 if (object_is_armour(&target_ptr->inventory_list[INVEN_RARM]) || object_is_armour(&target_ptr->inventory_list[INVEN_LARM]))
3992 int cur = target_ptr->skill_exp[GINOU_SHIELD];
3993 int max = s_info[target_ptr->pclass].s_max[GINOU_SHIELD];
3997 DEPTH targetlevel = r_ptr->level;
4001 /* Extra experience */
4002 if ((cur / 100) < targetlevel)
4004 if ((cur / 100 + 15) < targetlevel)
4005 inc += 1 + (targetlevel - (cur / 100 + 15));
4010 target_ptr->skill_exp[GINOU_SHIELD] = MIN(max, cur + inc);
4011 target_ptr->update |= (PU_BONUS);
4021 /* Analyze "visible" monsters only */
4022 if (is_original_ap_and_seen(target_ptr, m_ptr) && !do_silly_attack)
4024 /* Count "obvious" attacks (and ones that cause damage) */
4025 if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
4027 /* Count attacks of this type */
4028 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
4030 r_ptr->r_blows[ap_cnt]++;
4035 if (target_ptr->riding && damage)
4037 char m_steed_name[MAX_NLEN];
4038 monster_desc(target_ptr, m_steed_name, &floor_ptr->m_list[target_ptr->riding], 0);
4039 if (rakuba(target_ptr, (damage > 200) ? 200 : damage, FALSE))
4041 msg_format(_("%^sから落ちてしまった!", "You have fallen from %s."), m_steed_name);
4045 if (target_ptr->special_defense & NINJA_KAWARIMI)
4047 if (kawarimi(target_ptr, FALSE)) return TRUE;
4051 /* Hex - revenge damage stored */
4052 revenge_store(target_ptr, get_damage);
4054 if ((target_ptr->tim_eyeeye || hex_spelling(target_ptr, HEX_EYE_FOR_EYE))
4055 && get_damage > 0 && !target_ptr->is_dead)
4058 msg_format("攻撃が%s自身を傷つけた!", m_name);
4060 GAME_TEXT m_name_self[80];
4063 monster_desc(target_ptr, m_name_self, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE | MD_OBJECTIVE);
4065 msg_format("The attack of %s has wounded %s!", m_name, m_name_self);
4067 project(target_ptr, 0, 0, m_ptr->fy, m_ptr->fx, get_damage, GF_MISSILE, PROJECT_KILL, -1);
4068 if (target_ptr->tim_eyeeye) set_tim_eyeeye(target_ptr, target_ptr->tim_eyeeye-5, TRUE);
4071 if ((target_ptr->counter || (target_ptr->special_defense & KATA_MUSOU)) && alive && !target_ptr->is_dead && m_ptr->ml && (target_ptr->csp > 7))
4073 char m_target_name[MAX_NLEN];
4074 monster_desc(target_ptr, m_target_name, m_ptr, 0);
4076 target_ptr->csp -= 7;
4077 msg_format(_("%^sに反撃した!", "You counterattacked %s!"), m_target_name);
4078 py_attack(target_ptr, m_ptr->fy, m_ptr->fx, HISSATSU_COUNTER);
4080 target_ptr->redraw |= (PR_MANA);
4084 if (blinked && alive && !target_ptr->is_dead)
4086 if (teleport_barrier(target_ptr, m_idx))
4088 msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But a magic barrier obstructs it."));
4092 msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
4093 teleport_away(target_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
4097 /* Always notice cause of death */
4098 if (target_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !floor_ptr->inside_arena)
4103 if (m_ptr->ml && fear && alive && !target_ptr->is_dead)
4106 msg_format(_("%^sは恐怖で逃げ出した!", "%^s flees in terror!"), m_name);
4109 if (target_ptr->special_defense & KATA_IAI)
4111 set_action(target_ptr, ACTION_NONE);
4119 * @brief モンスターから敵モンスターへの打撃攻撃処理
4120 * @param m_idx 攻撃側モンスターの参照ID
4121 * @param t_idx 目標側モンスターの参照ID
4122 * @return 実際に打撃処理が行われた場合TRUEを返す
4124 bool monst_attack_monst(player_type *subject_ptr, MONSTER_IDX m_idx, MONSTER_IDX t_idx)
4126 monster_type *m_ptr = &subject_ptr->current_floor_ptr->m_list[m_idx];
4127 monster_type *t_ptr = &subject_ptr->current_floor_ptr->m_list[t_idx];
4129 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4130 monster_race *tr_ptr = &r_info[t_ptr->r_idx];
4133 GAME_TEXT m_name[MAX_NLEN], t_name[MAX_NLEN];
4134 char temp[MAX_NLEN];
4135 bool explode = FALSE, touched = FALSE, fear = FALSE, dead = FALSE;
4136 POSITION y_saver = t_ptr->fy;
4137 POSITION x_saver = t_ptr->fx;
4140 bool see_m = is_seen(m_ptr);
4141 bool see_t = is_seen(t_ptr);
4142 bool see_either = see_m || see_t;
4144 /* Can the player be aware of this attack? */
4145 bool known = (m_ptr->cdis <= MAX_SIGHT) || (t_ptr->cdis <= MAX_SIGHT);
4146 bool do_silly_attack = (one_in_(2) && subject_ptr->image);
4148 if (m_idx == t_idx) return FALSE;
4149 if (r_ptr->flags1 & RF1_NEVER_BLOW) return FALSE;
4150 if (d_info[subject_ptr->dungeon_idx].flags1 & DF1_NO_MELEE) return FALSE;
4153 ARMOUR_CLASS ac = tr_ptr->ac;
4155 /* Extract the effective monster level */
4156 DEPTH rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
4158 monster_desc(subject_ptr, m_name, m_ptr, 0);
4159 monster_desc(subject_ptr, t_name, t_ptr, 0);
4161 /* Assume no blink */
4162 bool blinked = FALSE;
4164 if (!see_either && known)
4166 subject_ptr->current_floor_ptr->monster_noise = TRUE;
4169 if (subject_ptr->riding && (m_idx == subject_ptr->riding)) disturb(subject_ptr, TRUE, TRUE);
4171 /* Scan through all four blows */
4172 for (ARMOUR_CLASS ap_cnt = 0; ap_cnt < 4; ap_cnt++)
4174 bool obvious = FALSE;
4176 HIT_POINT power = 0;
4177 HIT_POINT damage = 0;
4181 /* Extract the attack infomation */
4182 int effect = r_ptr->blow[ap_cnt].effect;
4183 int method = r_ptr->blow[ap_cnt].method;
4184 int d_dice = r_ptr->blow[ap_cnt].d_dice;
4185 int d_side = r_ptr->blow[ap_cnt].d_side;
4187 if (!monster_is_valid(m_ptr)) break;
4189 /* Stop attacking if the target dies! */
4190 if (t_ptr->fx != x_saver || t_ptr->fy != y_saver)
4193 /* Hack -- no more attacks */
4196 if (method == RBM_SHOOT) continue;
4198 /* Extract the attack "power" */
4199 power = mbe_info[effect].power;
4202 if (!effect || check_hit2(power, rlev, ac, MON_STUNNED(m_ptr)))
4204 (void)set_monster_csleep(subject_ptr, t_idx, 0);
4208 /* Redraw the health bar */
4209 if (subject_ptr->health_who == t_idx) subject_ptr->redraw |= (PR_HEALTH);
4210 if (subject_ptr->riding == t_idx) subject_ptr->redraw |= (PR_UHEALTH);
4213 /* Describe the attack method */
4218 act = _("%sを殴った。", "hits %s.");
4225 act = _("%sを触った。", "touches %s.");
4232 act = _("%sをパンチした。", "punches %s.");
4239 act = _("%sを蹴った。", "kicks %s.");
4246 act = _("%sをひっかいた。", "claws %s.");
4253 act = _("%sを噛んだ。", "bites %s.");
4260 act = _("%sを刺した。", "stings %s.");
4267 act = _("%sを斬った。", "slashes %s.");
4273 act = _("%sを角で突いた。", "butts %s.");
4280 act = _("%sに体当りした。", "crushes %s.");
4287 act = _("%sを飲み込んだ。", "engulfs %s.");
4294 act = _("%sに請求書をよこした。", "charges %s.");
4301 act = _("%sの体の上を這い回った。", "crawls on %s.");
4308 act = _("%sによだれをたらした。", "drools on %s.");
4315 act = _("%sに唾を吐いた。", "spits on %s.");
4322 if (see_either) disturb(subject_ptr, TRUE, TRUE);
4323 act = _("爆発した。", "explodes.");
4331 act = _("%sをにらんだ。", "gazes at %s.");
4338 act = _("%sに泣きついた。", "wails at %s.");
4345 act = _("%sに胞子を飛ばした。", "releases spores at %s.");
4352 act = _("%sにXXX4を飛ばした。", "projects XXX4's at %s.");
4359 act = _("%sに金をせがんだ。", "begs %s for money.");
4366 act = _("%sを侮辱した。", "insults %s.");
4373 act = _("%sにむかってうめいた。", "moans at %s.");
4380 act = _("%sにむかって歌った。", "sings to %s.");
4386 if (act && see_either)
4389 if (do_silly_attack) act = silly_attacks2[randint0(MAX_SILLY_ATTACK)];
4390 strfmt(temp, act, t_name);
4391 msg_format("%^sは%s", m_name, temp);
4393 if (do_silly_attack)
4395 act = silly_attacks[randint0(MAX_SILLY_ATTACK)];
4396 strfmt(temp, "%s %s.", act, t_name);
4398 else strfmt(temp, act, t_name);
4399 msg_format("%^s %s", m_name, temp);
4403 /* Hack -- assume all attacks are obvious */
4406 /* Roll out the damage */
4407 damage = damroll(d_dice, d_side);
4409 /* Assume no effect */
4410 effect_type = BLOW_EFFECT_TYPE_NONE;
4414 /* Apply appropriate damage */
4423 if ((randint1(rlev * 2 + 250) > (ac + 200)) || one_in_(13))
4425 int tmp_damage = damage - (damage * ((ac < 150) ? ac : 150) / 250);
4426 damage = MAX(damage, tmp_damage * 2);
4433 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
4448 if ((subject_ptr->riding != m_idx) && one_in_(2)) blinked = TRUE;
4484 effect_type = BLOW_EFFECT_TYPE_FEAR;
4488 effect_type = BLOW_EFFECT_TYPE_SLEEP;
4492 damage -= (damage * ((ac < 150) ? ac : 150) / 250);
4493 if (damage > 23) earthquake(subject_ptr, m_ptr->fy, m_ptr->fx, 8, m_idx);
4508 pt = GF_HYPODYNAMIA;
4509 effect_type = BLOW_EFFECT_TYPE_HEAL;
4527 /* Do damage if not exploding */
4530 project(subject_ptr, m_idx, 0, t_ptr->fy, t_ptr->fx,
4531 damage, pt, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4534 switch (effect_type)
4536 case BLOW_EFFECT_TYPE_FEAR:
4537 project(subject_ptr, m_idx, 0, t_ptr->fy, t_ptr->fx,
4538 damage, GF_TURN_ALL, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4541 case BLOW_EFFECT_TYPE_SLEEP:
4542 project(subject_ptr, m_idx, 0, t_ptr->fy, t_ptr->fx,
4543 r_ptr->level, GF_OLD_SLEEP, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4546 case BLOW_EFFECT_TYPE_HEAL:
4547 if ((monster_living(m_idx)) && (damage > 2))
4549 bool did_heal = FALSE;
4551 if (m_ptr->hp < m_ptr->maxhp) did_heal = TRUE;
4554 m_ptr->hp += damroll(4, damage / 6);
4555 if (m_ptr->hp > m_ptr->maxhp) m_ptr->hp = m_ptr->maxhp;
4557 /* Redraw (later) if needed */
4558 if (subject_ptr->health_who == m_idx) subject_ptr->redraw |= (PR_HEALTH);
4559 if (subject_ptr->riding == m_idx) subject_ptr->redraw |= (PR_UHEALTH);
4561 /* Special message */
4562 if (see_m && did_heal)
4564 msg_format(_("%sは体力を回復したようだ。", "%^s appears healthier."), m_name);
4573 if ((tr_ptr->flags2 & RF2_AURA_FIRE) && m_ptr->r_idx)
4575 if (!(r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK))
4579 msg_format(_("%^sは突然熱くなった!", "%^s is suddenly very hot!"), m_name);
4581 if (m_ptr->ml && is_original_ap_and_seen(subject_ptr, t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_FIRE;
4582 project(subject_ptr, t_idx, 0, m_ptr->fy, m_ptr->fx,
4583 damroll(1 + ((tr_ptr->level) / 26),
4584 1 + ((tr_ptr->level) / 17)),
4585 GF_FIRE, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4589 if (is_original_ap_and_seen(subject_ptr, m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK);
4594 if ((tr_ptr->flags3 & RF3_AURA_COLD) && m_ptr->r_idx)
4596 if (!(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK))
4600 msg_format(_("%^sは突然寒くなった!", "%^s is suddenly very cold!"), m_name);
4602 if (m_ptr->ml && is_original_ap_and_seen(subject_ptr, t_ptr)) tr_ptr->r_flags3 |= RF3_AURA_COLD;
4603 project(subject_ptr, t_idx, 0, m_ptr->fy, m_ptr->fx,
4604 damroll(1 + ((tr_ptr->level) / 26),
4605 1 + ((tr_ptr->level) / 17)),
4606 GF_COLD, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4610 if (is_original_ap_and_seen(subject_ptr, m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_COLD_MASK);
4615 if ((tr_ptr->flags2 & RF2_AURA_ELEC) && m_ptr->r_idx)
4617 if (!(r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK))
4621 msg_format(_("%^sは電撃を食らった!", "%^s gets zapped!"), m_name);
4623 if (m_ptr->ml && is_original_ap_and_seen(subject_ptr, t_ptr)) tr_ptr->r_flags2 |= RF2_AURA_ELEC;
4624 project(subject_ptr, t_idx, 0, m_ptr->fy, m_ptr->fx,
4625 damroll(1 + ((tr_ptr->level) / 26),
4626 1 + ((tr_ptr->level) / 17)),
4627 GF_ELEC, PROJECT_KILL | PROJECT_STOP | PROJECT_AIMED, -1);
4631 if (is_original_ap_and_seen(subject_ptr, m_ptr)) r_ptr->r_flagsr |= (r_ptr->flagsr & RFR_EFF_IM_ELEC_MASK);
4638 /* Monster missed player */
4641 /* Analyze failed attacks */
4657 (void)set_monster_csleep(subject_ptr, t_idx, 0);
4659 /* Visible monsters */
4663 msg_format("%sは%^sの攻撃をかわした。", t_name, m_name);
4665 msg_format("%^s misses %s.", m_name, t_name);
4675 /* Analyze "visible" monsters only */
4676 if (is_original_ap_and_seen(subject_ptr, m_ptr) && !do_silly_attack)
4678 /* Count "obvious" attacks (and ones that cause damage) */
4679 if (obvious || damage || (r_ptr->r_blows[ap_cnt] > 10))
4681 /* Count attacks of this type */
4682 if (r_ptr->r_blows[ap_cnt] < MAX_UCHAR)
4684 r_ptr->r_blows[ap_cnt]++;
4692 sound(SOUND_EXPLODE);
4694 /* Cancel Invulnerability */
4695 (void)set_monster_invulner(subject_ptr, m_idx, 0, FALSE);
4696 mon_take_hit_mon(subject_ptr, m_idx, m_ptr->hp + 1, &dead, &fear, _("は爆発して粉々になった。", " explodes into tiny shreds."), m_idx);
4700 if (!blinked || m_ptr->r_idx == 0) return TRUE;
4702 if (teleport_barrier(subject_ptr, m_idx))
4706 msg_print(_("泥棒は笑って逃げ...ようとしたがバリアに防がれた。", "The thief flees laughing...? But a magic barrier obstructs it."));
4710 subject_ptr->current_floor_ptr->monster_noise = TRUE;
4717 msg_print(_("泥棒は笑って逃げた!", "The thief flees laughing!"));
4721 subject_ptr->current_floor_ptr->monster_noise = TRUE;
4724 teleport_away(subject_ptr, m_idx, MAX_SIGHT * 2 + 5, TELEPORT_SPONTANEOUS);
4733 * @brief モンスターが敵モンスターに行う打撃処理 /
4734 * Hack, based on mon_take_hit... perhaps all monster attacks on other monsters should use this?
4735 * @param m_idx 目標となるモンスターの参照ID
4737 * @param dead 目標となったモンスターの死亡状態を返す参照ポインタ
4738 * @param fear 目標となったモンスターの恐慌状態を返す参照ポインタ
4739 * @param note 目標モンスターが死亡した場合の特別メッセージ(NULLならば標準表示を行う)
4740 * @param who 打撃を行ったモンスターの参照ID
4743 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)
4745 floor_type *floor_ptr = player_ptr->current_floor_ptr;
4746 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
4747 monster_race *r_ptr = &r_info[m_ptr->r_idx];
4748 GAME_TEXT m_name[160];
4749 bool seen = is_seen(m_ptr);
4751 /* Can the player be aware of this attack? */
4752 bool known = (m_ptr->cdis <= MAX_SIGHT);
4754 monster_desc(player_ptr, m_name, m_ptr, 0);
4756 /* Redraw (later) if needed */
4759 if (player_ptr->health_who == m_idx) player_ptr->redraw |= (PR_HEALTH);
4760 if (player_ptr->riding == m_idx) player_ptr->redraw |= (PR_UHEALTH);
4763 (void)set_monster_csleep(player_ptr, m_idx, 0);
4765 if (player_ptr->riding && (m_idx == player_ptr->riding)) disturb(player_ptr, TRUE, TRUE);
4767 if (MON_INVULNER(m_ptr) && randint0(PENETRATE_INVULNERABILITY))
4771 msg_format(_("%^sはダメージを受けない。", "%^s is unharmed."), m_name);
4776 if (r_ptr->flagsr & RFR_RES_ALL)
4781 if ((dam == 0) && one_in_(3)) dam = 1;
4787 msg_format(_("%^sはダメージを受けない。", "%^s is unharmed."), m_name);
4796 /* It is dead now... or is it? */
4799 if (((r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) ||
4800 (r_ptr->flags7 & RF7_NAZGUL)) &&
4801 !player_ptr->phase_out)
4808 if (!monster_living(m_ptr->r_idx))
4810 sound(SOUND_N_KILL);
4821 monster_desc(player_ptr, m_name, m_ptr, MD_TRUE_NAME);
4822 /* Unseen death by normal attack */
4825 floor_ptr->monster_noise = TRUE;
4827 /* Death by special attack */
4830 msg_format(_("%^s%s", "%^s%s"), m_name, note);
4832 /* Death by normal attack -- nonliving monster */
4833 else if (!monster_living(m_ptr->r_idx))
4835 msg_format(_("%^sは破壊された。", "%^s is destroyed."), m_name);
4837 /* Death by normal attack -- living monster */
4840 msg_format(_("%^sは殺された。", "%^s is killed."), m_name);
4844 monster_gain_exp(player_ptr, who, m_ptr->r_idx);
4845 monster_death(player_ptr, m_idx, FALSE);
4846 delete_monster_idx(player_ptr, m_idx);
4851 /* Monster is dead */
4858 /* Mega-Hack -- Pain cancels fear */
4859 if (MON_MONFEAR(m_ptr) && (dam > 0))
4862 if (set_monster_monfear(player_ptr, m_idx, MON_MONFEAR(m_ptr) - randint1(dam / 4)))
4869 /* Sometimes a monster gets scared by damage */
4870 if (!MON_MONFEAR(m_ptr) && !(r_ptr->flags3 & RF3_NO_FEAR))
4872 /* Percentage of fully healthy */
4873 int percentage = (100L * m_ptr->hp) / m_ptr->maxhp;
4876 * Run (sometimes) if at 10% or less of max hit points,
4877 * or (usually) when hit for half its current hit points
4879 if (((percentage <= 10) && (randint0(10) < percentage)) ||
4880 ((dam >= m_ptr->hp) && (randint0(100) < 80)))
4882 /* Hack -- note fear */
4885 /* Hack -- Add some timed fear */
4886 (void)set_monster_monfear(player_ptr, m_idx, (randint1(10) +
4887 (((dam >= m_ptr->hp) && (percentage > 7)) ?
4888 20 : ((11 - percentage) * 5))));
4892 if ((dam > 0) && !is_pet(m_ptr) && !is_friendly(m_ptr) && (who != m_idx))
4894 if (is_pet(&floor_ptr->m_list[who]) && !player_bold(player_ptr, m_ptr->target_y, m_ptr->target_x))
4896 set_target(m_ptr, floor_ptr->m_list[who].fy, floor_ptr->m_list[who].fx);
4900 if (player_ptr->riding && (player_ptr->riding == m_idx) && (dam > 0))
4902 monster_desc(player_ptr, m_name, m_ptr, 0);
4904 if (m_ptr->hp > m_ptr->maxhp / 3) dam = (dam + 1) / 2;
4905 if (rakuba(player_ptr, (dam > 200) ? 200 : dam, FALSE))
4907 msg_format(_("%^sに振り落とされた!", "You have been thrown off from %s!"), m_name);