From d3d179784805b13274ab6339735a6068438db91e Mon Sep 17 00:00:00 2001 From: deskull Date: Mon, 11 Jan 2021 01:27:33 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#40514=20player=5Ftype=20=E3=81=AE?= =?utf8?q?=20resist=5Fcold=20=E5=A4=89=E6=95=B0=E3=82=92=E5=BB=83=E6=AD=A2?= =?utf8?q?.=20/=20Abolished=20the=20resist=5Fcold=20variable=20in=20player?= =?utf8?q?=5Ftype.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- 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 +- 11 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/core/hp-mp-processor.c b/src/core/hp-mp-processor.c index 137e46f73..361f6bd02 100644 --- a/src/core/hp-mp-processor.c +++ b/src/core/hp-mp-processor.c @@ -147,7 +147,7 @@ void process_player_hp_mp(player_type *creature_ptr) } if (damage) { - if (creature_ptr->resist_cold) + if (has_resist_cold(creature_ptr)) damage = damage / 3; if (is_oppose_cold(creature_ptr)) damage = damage / 3; @@ -313,7 +313,7 @@ void process_player_hp_mp(player_type *creature_ptr) } if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !has_immune_cold(creature_ptr)) { damage = r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].level / 2; - if (creature_ptr->resist_cold) + if (has_resist_cold(creature_ptr)) damage = damage / 3; if (is_oppose_cold(creature_ptr)) damage = damage / 3; diff --git a/src/effect/effect-player-resist-hurt.c b/src/effect/effect-player-resist-hurt.c index 5e8b3870b..41dc2cc5e 100644 --- a/src/effect/effect-player-resist-hurt.c +++ b/src/effect/effect-player-resist-hurt.c @@ -567,7 +567,7 @@ void effect_player_icee(player_type *target_ptr, effect_player_type *ep_ptr) (void)set_stun(target_ptr, target_ptr->stun + randint1(15)); } - if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12)) { + if ((!(has_resist_cold(target_ptr) || is_oppose_cold(target_ptr))) || one_in_(12)) { if (!has_immune_cold(target_ptr)) inventory_damage(target_ptr, set_cold_destroy, 3); } diff --git a/src/monster/monster-update.c b/src/monster/monster-update.c index 894502ea2..04cd139e9 100644 --- a/src/monster/monster-update.c +++ b/src/monster/monster-update.c @@ -572,7 +572,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what) break; case DRS_COLD: - if (player_ptr->resist_cold) + if (has_resist_cold(player_ptr)) m_ptr->smart |= SM_RES_COLD; if (is_oppose_cold(player_ptr)) diff --git a/src/mspell/element-resistance-checker.c b/src/mspell/element-resistance-checker.c index 902f96bc3..e01547a27 100644 --- a/src/mspell/element-resistance-checker.c +++ b/src/mspell/element-resistance-checker.c @@ -36,7 +36,7 @@ void add_cheat_remove_flags_element(player_type *target_ptr, msr_type *msr_ptr) if (has_immune_fire(target_ptr)) msr_ptr->smart |= SM_IMM_FIRE; - if (target_ptr->resist_cold) + if (has_resist_cold(target_ptr)) msr_ptr->smart |= SM_RES_COLD; if (is_oppose_cold(target_ptr)) diff --git a/src/object-use/read-execution.c b/src/object-use/read-execution.c index a9c941733..1bf234865 100644 --- a/src/object-use/read-execution.c +++ b/src/object-use/read-execution.c @@ -421,7 +421,7 @@ void exe_read(player_type *creature_ptr, INVENTORY_IDX item, bool known) } case SV_SCROLL_ICE: { fire_ball(creature_ptr, GF_ICE, 0, 777, 4); - if (!(is_oppose_cold(creature_ptr) || creature_ptr->resist_cold || has_immune_cold(creature_ptr))) + if (!(is_oppose_cold(creature_ptr) || has_resist_cold(creature_ptr) || has_immune_cold(creature_ptr))) take_hit(creature_ptr, DAMAGE_NOESCAPE, 100 + randint1(100), _("氷の巻物", "a Scroll of Ice"), -1); ident = TRUE; diff --git a/src/player-info/resistance-info.c b/src/player-info/resistance-info.c index 143b1d94b..79ae3a5ea 100644 --- a/src/player-info/resistance-info.c +++ b/src/player-info/resistance-info.c @@ -39,9 +39,9 @@ void set_element_resistance_info(player_type* creature_ptr, self_info_type* self if (has_immune_cold(creature_ptr)) { self_ptr->info[self_ptr->line++] = _("あなたは冷気に対する完全なる免疫を持っている。", "You are completely immune to cold."); - } else if (creature_ptr->resist_cold && is_oppose_cold(creature_ptr)) { + } else if (has_resist_cold(creature_ptr) && is_oppose_cold(creature_ptr)) { self_ptr->info[self_ptr->line++] = _("あなたは冷気への強力な耐性を持っている。", "You resist cold exceptionally well."); - } else if (creature_ptr->resist_cold || is_oppose_cold(creature_ptr)) { + } else if (has_resist_cold(creature_ptr) || is_oppose_cold(creature_ptr)) { self_ptr->info[self_ptr->line++] = _("あなたは冷気への耐性を持っている。", "You are resistant to cold."); } diff --git a/src/player/player-damage.c b/src/player/player-damage.c index 39efcefe8..6bd05fecb 100644 --- a/src/player/player-damage.c +++ b/src/player/player-damage.c @@ -248,12 +248,12 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int dam = dam * calc_cold_damage_rate(creature_ptr) / 100; if (aura || !check_multishadow(creature_ptr)) { - if ((!(double_resist || creature_ptr->resist_cold)) && one_in_(HURT_CHANCE)) + if ((!(double_resist || has_resist_cold(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_cold)) + if (!aura && !(double_resist && has_resist_cold(creature_ptr))) inventory_damage(creature_ptr, set_cold_destroy, inv); return get_damage; diff --git a/src/player/player-status-resist.c b/src/player/player-status-resist.c index e073e39ad..a20c0475c 100644 --- a/src/player/player-status-resist.c +++ b/src/player/player-status-resist.c @@ -160,7 +160,7 @@ PERCENTAGE calc_cold_damage_rate(player_type *creature_ptr) } } - if (creature_ptr->resist_cold) + if (has_resist_cold(creature_ptr)) per = (per + 2) / 3; if (is_oppose_cold(creature_ptr)) per = (per + 2) / 3; diff --git a/src/player/player-status.c b/src/player/player-status.c index 5a93095af..a6f28e1db 100644 --- a/src/player/player-status.c +++ b/src/player/player-status.c @@ -394,7 +394,6 @@ void calc_bonuses(player_type *creature_ptr) has_curses(creature_ptr); creature_ptr->impact = has_impact(creature_ptr); has_extra_blow(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); creature_ptr->resist_sound = has_resist_sound(creature_ptr); diff --git a/src/player/player-status.h b/src/player/player-status.h index 6a337db8d..4a4bb66a3 100644 --- a/src/player/player-status.h +++ b/src/player/player-status.h @@ -366,7 +366,6 @@ typedef struct player_type { bool is_fired; bool level_up_message; - BIT_FLAGS resist_cold; /* Resist cold */ BIT_FLAGS resist_pois; /* Resist poison */ BIT_FLAGS resist_conf; /* Resist confusion */ diff --git a/src/specific-object/death-scythe.c b/src/specific-object/death-scythe.c index 524e54f7a..5be4dc93f 100644 --- a/src/specific-object/death-scythe.c +++ b/src/specific-object/death-scythe.c @@ -96,7 +96,7 @@ static void compensate_death_scythe_reflection_magnification(player_type *attack 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)) + if (!(has_resist_cold(attacker_ptr) || is_oppose_cold(attacker_ptr) || has_immune_cold(attacker_ptr)) && (*magnification < 25)) *magnification = 25; if (!(attacker_ptr->resist_pois || is_oppose_pois(attacker_ptr)) && (*magnification < 25)) -- 2.11.0