5 * @details 現時点ではダメージ反射のみ。行数に注意して関数を追加しても良い.
8 #include "specific-object/death-scythe.h"
9 #include "combat/attack-criticality.h"
10 #include "core/stuff-handler.h"
11 #include "main/sound-definitions-table.h"
12 #include "main/sound-of-music.h"
13 #include "object-enchant/tr-types.h"
14 #include "object/object-flags.h"
15 #include "player/player-damage.h"
16 #include "player/player-race.h"
17 #include "util/bit-flags-calculator.h"
18 #include "view/display-messages.h"
21 * @brief 死の大鎌ダメージが跳ね返ってきた時の、種族ごとのダメージ倍率を返す
22 * @param attacker_ptr プレーヤーへの参照ポインタ
23 * @return 倍率 (実際は1/10になる)
25 static int calc_death_scythe_reflection_magnification_mimic_none(player_type *attacker_ptr)
27 switch (attacker_ptr->prace) {
56 * @brief 死の大鎌ダメージが跳ね返ってきた時の、変身中の種族も考慮したダメージ倍率を返す
57 * @param attacker_ptr プレーヤーへの参照ポインタ
58 * @return 倍率 (実際は1/10になる)
60 static int calc_death_scythe_reflection_magnification(player_type *attacker_ptr)
62 switch (attacker_ptr->mimic_form) {
64 return calc_death_scythe_reflection_magnification_mimic_none(attacker_ptr);
66 case MIMIC_DEMON_LORD:
75 * @brief 耐性等に応じて死の大鎌による反射ダメージ倍率を補正する
76 * @param attacker_ptr プレーヤーへの参照ポインタ
77 * @param magnification ダメージ倍率
78 * @param death_scythe_flags 死の大鎌に関するオブジェクトフラグ配列
81 static void compensate_death_scythe_reflection_magnification(player_type *attacker_ptr, int *magnification, BIT_FLAGS *death_scythe_flags)
83 if ((attacker_ptr->align < 0) && (*magnification < 20))
86 if (!(attacker_ptr->resist_acid || is_oppose_acid(attacker_ptr) || attacker_ptr->immune_acid) && (*magnification < 25))
89 if (!(attacker_ptr->resist_elec || is_oppose_elec(attacker_ptr) || attacker_ptr->immune_elec) && (*magnification < 25))
92 if (!(attacker_ptr->resist_fire || is_oppose_fire(attacker_ptr) || attacker_ptr->immune_fire) && (*magnification < 25))
95 if (!(attacker_ptr->resist_cold || is_oppose_cold(attacker_ptr) || attacker_ptr->immune_cold) && (*magnification < 25))
98 if (!(attacker_ptr->resist_pois || is_oppose_pois(attacker_ptr)) && (*magnification < 25))
101 if ((attacker_ptr->pclass != CLASS_SAMURAI) && (have_flag(death_scythe_flags, TR_FORCE_WEAPON)) && (attacker_ptr->csp > (attacker_ptr->msp / 30))) {
102 attacker_ptr->csp -= (1 + (attacker_ptr->msp / 30));
103 attacker_ptr->redraw |= (PR_MANA);
104 *magnification = *magnification * 3 / 2 + 20;
109 * @brief 死の大鎌による反射ダメージ倍率を更に上げる
110 * @param pa_ptr 直接攻撃構造体への参照ポインタ
113 static void death_scythe_reflection_critial_hit(player_attack_type *pa_ptr)
118 int more_magnification = 2;
119 msg_format(_("グッサリ切り裂かれた!", "Your weapon cuts deep into yourself!"));
121 more_magnification++;
123 pa_ptr->attack_damage *= (HIT_POINT)more_magnification;
127 * @brief 死の大鎌によるダメージ反射のメインルーチン
128 * @param attacker_ptr プレーヤーへの参照ポインタ
129 * @param pa_ptr 直接攻撃構造体への参照ポインタ
132 void process_death_scythe_reflection(player_type *attacker_ptr, player_attack_type *pa_ptr)
134 BIT_FLAGS death_scythe_flags[TR_FLAG_SIZE];
136 msg_format(_("ミス! %sにかわされた。", "You miss %s."), pa_ptr->m_name);
137 msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
139 object_type *o_ptr = &attacker_ptr->inventory_list[INVEN_RARM + pa_ptr->hand];
140 object_flags(o_ptr, death_scythe_flags);
141 pa_ptr->attack_damage = damroll(o_ptr->dd + attacker_ptr->to_dd[pa_ptr->hand], o_ptr->ds + attacker_ptr->to_ds[pa_ptr->hand]);
142 int magnification = calc_death_scythe_reflection_magnification(attacker_ptr);
143 compensate_death_scythe_reflection_magnification(attacker_ptr, &magnification, death_scythe_flags);
144 pa_ptr->attack_damage *= (HIT_POINT)magnification;
145 pa_ptr->attack_damage /= 10;
146 pa_ptr->attack_damage = critical_norm(attacker_ptr, o_ptr->weight, o_ptr->to_h, pa_ptr->attack_damage, attacker_ptr->to_h[pa_ptr->hand], pa_ptr->mode);
147 death_scythe_reflection_critial_hit(pa_ptr);
148 pa_ptr->attack_damage += (attacker_ptr->to_d[pa_ptr->hand] + o_ptr->to_d);
149 if (pa_ptr->attack_damage < 0)
150 pa_ptr->attack_damage = 0;
152 take_hit(attacker_ptr, DAMAGE_FORCE, pa_ptr->attack_damage, _("死の大鎌", "Death scythe"), -1);
153 handle_stuff(attacker_ptr);