From 44e952721021ec517d3bafbe361bfcb59dbbef2d Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 11 Jan 2021 01:01:09 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40514=20player=5Ftype=20=E3=81=AE?= =?utf8?q?=20resist=5Ffire=20=E5=A4=89=E6=95=B0=E3=82=92=E5=BB=83=E6=AD=A2?= =?utf8?q?.=20/=20Abolished=20the=20resist=5Ffire=20variable=20in=20player?= =?utf8?q?=5Ftype.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/cmd-action/cmd-travel.c | 2 +- src/core/hp-mp-processor.c | 4 ++-- src/effect/effect-player-resist-hurt.c | 2 +- src/monster/monster-update.c | 2 +- src/mspell/element-resistance-checker.c | 2 +- src/object-use/read-execution.c | 2 +- src/player-info/resistance-info.c | 4 ++-- src/player/player-damage.c | 4 ++-- src/player/player-status-resist.c | 2 +- src/player/player-status.c | 1 - src/player/player-status.h | 1 - src/specific-object/death-scythe.c | 2 +- 12 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/cmd-action/cmd-travel.c b/src/cmd-action/cmd-travel.c index d419067b1..79a1b8ac4 100644 --- a/src/cmd-action/cmd-travel.c +++ b/src/cmd-action/cmd-travel.c @@ -31,7 +31,7 @@ static int travel_flow_cost(player_type *creature_ptr, POSITION y, POSITION x) if (has_flag(f_ptr->flags, FF_LAVA)) { int lava = 2; - if (!creature_ptr->resist_fire) + if (!has_resist_fire(creature_ptr)) lava *= 2; if (!creature_ptr->levitation) diff --git a/src/core/hp-mp-processor.c b/src/core/hp-mp-processor.c index c8154ff7e..f1675ee40 100644 --- a/src/core/hp-mp-processor.c +++ b/src/core/hp-mp-processor.c @@ -110,7 +110,7 @@ void process_player_hp_mp(player_type *creature_ptr) if (damage) { if (is_specific_player_race(creature_ptr, RACE_ENT)) damage += damage / 3; - if (creature_ptr->resist_fire) + if (has_resist_fire(creature_ptr)) damage = damage / 3; if (is_oppose_fire(creature_ptr)) damage = damage / 3; @@ -293,7 +293,7 @@ void process_player_hp_mp(player_type *creature_ptr) damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; if (is_specific_player_race(creature_ptr, RACE_ENT)) damage += damage / 3; - if (creature_ptr->resist_fire) + if (has_resist_fire(creature_ptr)) damage = damage / 3; if (is_oppose_fire(creature_ptr)) damage = damage / 3; diff --git a/src/effect/effect-player-resist-hurt.c b/src/effect/effect-player-resist-hurt.c index 334b9512e..5e8b3870b 100644 --- a/src/effect/effect-player-resist-hurt.c +++ b/src/effect/effect-player-resist-hurt.c @@ -139,7 +139,7 @@ void effect_player_plasma(player_type *target_ptr, effect_player_type *ep_ptr) (void)set_stun(target_ptr, target_ptr->stun + plus_stun); } - if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) || has_immune_fire(target_ptr))) + if (!(has_resist_fire(target_ptr) || is_oppose_fire(target_ptr) || has_immune_fire(target_ptr))) inventory_damage(target_ptr, set_acid_destroy, 3); } diff --git a/src/monster/monster-update.c b/src/monster/monster-update.c index 4da071639..4ba1b5567 100644 --- a/src/monster/monster-update.c +++ b/src/monster/monster-update.c @@ -561,7 +561,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what) break; case DRS_FIRE: - if (player_ptr->resist_fire) + if (has_resist_fire(player_ptr)) m_ptr->smart |= SM_RES_FIRE; if (is_oppose_fire(player_ptr)) diff --git a/src/mspell/element-resistance-checker.c b/src/mspell/element-resistance-checker.c index 69627f1a6..fc67e3d74 100644 --- a/src/mspell/element-resistance-checker.c +++ b/src/mspell/element-resistance-checker.c @@ -27,7 +27,7 @@ void add_cheat_remove_flags_element(player_type *target_ptr, msr_type *msr_ptr) if (has_immune_elec(target_ptr)) msr_ptr->smart |= SM_IMM_ELEC; - if (target_ptr->resist_fire) + if (has_resist_fire(target_ptr)) msr_ptr->smart |= SM_RES_FIRE; if (is_oppose_fire(target_ptr)) diff --git a/src/object-use/read-execution.c b/src/object-use/read-execution.c index ef93be3c4..a9c941733 100644 --- a/src/object-use/read-execution.c +++ b/src/object-use/read-execution.c @@ -413,7 +413,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) } case SV_SCROLL_FIRE: { fire_ball(creature_ptr, GF_FIRE, 0, 666, 4); - if (!(is_oppose_fire(creature_ptr) || creature_ptr->resist_fire || has_immune_fire(creature_ptr))) + if (!(is_oppose_fire(creature_ptr) || has_resist_fire(creature_ptr) || has_immune_fire(creature_ptr))) take_hit(creature_ptr, DAMAGE_NOESCAPE, 50 + randint1(50), _("炎の巻物", "a Scroll of Fire"), -1); ident = TRUE; diff --git a/src/player-info/resistance-info.c b/src/player-info/resistance-info.c index 5d033083b..5ddbc0e3e 100644 --- a/src/player-info/resistance-info.c +++ b/src/player-info/resistance-info.c @@ -27,9 +27,9 @@ void set_element_resistance_info(player_type* creature_ptr, self_info_type* self if (has_immune_fire(creature_ptr)) { self_ptr->info[self_ptr->line++] = _("あなたは火に対する完全なる免疫を持っている。", "You are completely immune to fire."); - } else if (creature_ptr->resist_fire && is_oppose_fire(creature_ptr)) { + } else if (has_resist_fire(creature_ptr) &&is_oppose_fire(creature_ptr)) { self_ptr->info[self_ptr->line++] = _("あなたは火への強力な耐性を持っている。", "You resist fire exceptionally well."); - } else if (creature_ptr->resist_fire || is_oppose_fire(creature_ptr)) { + } else if (has_resist_fire(creature_ptr) || is_oppose_fire(creature_ptr)) { self_ptr->info[self_ptr->line++] = _("あなたは火への耐性を持っている。", "You are resistant to fire."); } diff --git a/src/player/player-damage.c b/src/player/player-damage.c index 112f6995b..d201cfc33 100644 --- a/src/player/player-damage.c +++ b/src/player/player-damage.c @@ -216,12 +216,12 @@ HIT_POINT fire_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int dam = dam * calc_fire_damage_rate(creature_ptr) / 100; if (aura || !check_multishadow(creature_ptr)) { - if ((!(double_resist || creature_ptr->resist_fire)) && one_in_(HURT_CHANCE)) + if ((!(double_resist || has_resist_fire(creature_ptr))) && one_in_(HURT_CHANCE)) (void)do_dec_stat(creature_ptr, A_STR); } HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell); - if (!aura && !(double_resist && creature_ptr->resist_fire)) + if (!aura && !(double_resist && has_resist_fire(creature_ptr))) inventory_damage(creature_ptr, set_fire_destroy, inv); return get_damage; diff --git a/src/player/player-status-resist.c b/src/player/player-status-resist.c index dadbf15c2..93a3bc7dd 100644 --- a/src/player/player-status-resist.c +++ b/src/player/player-status-resist.c @@ -135,7 +135,7 @@ PERCENTAGE calc_fire_damage_rate(player_type *creature_ptr) } /* Resist the damage */ - if (creature_ptr->resist_fire) + if (has_resist_fire(creature_ptr)) per = (per + 2) / 3; if (is_oppose_fire(creature_ptr)) per = (per + 2) / 3; diff --git a/src/player/player-status.c b/src/player/player-status.c index 4e863f35a..5c496abb6 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -396,7 +396,6 @@ void calc_bonuses(player_type *creature_ptr) has_extra_blow(creature_ptr); creature_ptr->resist_acid = has_resist_acid(creature_ptr); creature_ptr->resist_elec = has_resist_elec(creature_ptr); - creature_ptr->resist_fire = has_resist_fire(creature_ptr); creature_ptr->resist_cold = has_resist_cold(creature_ptr); creature_ptr->resist_pois = has_resist_pois(creature_ptr); creature_ptr->resist_conf = has_resist_conf(creature_ptr); diff --git a/src/player/player-status.h b/src/player/player-status.h index 4de7bd258..b008e7c43 100644 --- a/src/player/player-status.h +++ b/src/player/player-status.h @@ -368,7 +368,6 @@ typedef struct player_type { BIT_FLAGS resist_acid; /* Resist acid */ BIT_FLAGS resist_elec; /* Resist lightning */ - BIT_FLAGS resist_fire; /* Resist fire */ BIT_FLAGS resist_cold; /* Resist cold */ BIT_FLAGS resist_pois; /* Resist poison */ diff --git a/src/specific-object/death-scythe.c b/src/specific-object/death-scythe.c index e7ece76e9..ac9b414e3 100644 --- a/src/specific-object/death-scythe.c +++ b/src/specific-object/death-scythe.c @@ -93,7 +93,7 @@ static void compensate_death_scythe_reflection_magnification(player_type *attack if (!(attacker_ptr->resist_elec || is_oppose_elec(attacker_ptr) || has_immune_elec(attacker_ptr)) && (*magnification < 25)) *magnification = 25; - if (!(attacker_ptr->resist_fire || is_oppose_fire(attacker_ptr) || has_immune_fire(attacker_ptr)) && (*magnification < 25)) + if (!(has_resist_fire(attacker_ptr) || is_oppose_fire(attacker_ptr) || has_immune_fire(attacker_ptr)) && (*magnification < 25)) *magnification = 25; if (!(attacker_ptr->resist_cold || is_oppose_cold(attacker_ptr) || has_immune_cold(attacker_ptr)) && (*magnification < 25)) -- 2.11.0