OSDN Git Service

[Refactor] #40514 immune_cold は has_immune_cold() を直接参照. / For immune_cold, directly...
authordeskull <deskull@users.sourceforge.jp>
Wed, 2 Sep 2020 16:10:21 +0000 (01:10 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 2 Sep 2020 16:10:21 +0000 (01:10 +0900)
12 files changed:
src/core/hp-mp-processor.c
src/effect/effect-player-switcher.c
src/monster/monster-update.c
src/mspell/element-resistance-checker.c
src/mspell/mspell-judgement.c
src/object-use/read-execution.c
src/object/warning.c
src/player-info/resistance-info.c
src/player/player-damage.c
src/player/player-status.c
src/player/player-status.h
src/specific-object/death-scythe.c

index c6a43e7..c0db3d9 100644 (file)
@@ -127,7 +127,7 @@ void process_player_hp_mp(player_type *creature_ptr)
         }
     }
 
-    if (has_flag(f_ptr->flags, FF_COLD_PUDDLE) && !is_invuln(creature_ptr) && !creature_ptr->immune_cold) {
+    if (has_flag(f_ptr->flags, FF_COLD_PUDDLE) && !is_invuln(creature_ptr) && !has_immune_cold(creature_ptr)) {
         int damage = 0;
 
         if (has_flag(f_ptr->flags, FF_DEEP)) {
@@ -304,7 +304,7 @@ void process_player_hp_mp(player_type *creature_ptr)
             msg_print(_("痛い!", "It hurts!"));
             take_hit(creature_ptr, DAMAGE_NOESCAPE, damage, _("電気のオーラ", "Elec aura"), -1);
         }
-        if ((r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->riding].r_idx].flags3 & RF3_AURA_COLD) && !creature_ptr->immune_cold) {
+        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)
                 damage = damage / 3;
index b7965c6..4eb1479 100644 (file)
@@ -66,7 +66,7 @@ void effect_player_icee(player_type *target_ptr, effect_player_type *ep_ptr)
     }
 
     if ((!(target_ptr->resist_cold || is_oppose_cold(target_ptr))) || one_in_(12)) {
-        if (!target_ptr->immune_cold)
+        if (!has_immune_cold(target_ptr))
             inventory_damage(target_ptr, set_cold_destroy, 3);
     }
 }
index 49345d1..be0b7c8 100644 (file)
@@ -480,7 +480,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
             m_ptr->smart |= (SM_RES_COLD);
         if (is_oppose_cold(player_ptr))
             m_ptr->smart |= (SM_OPP_COLD);
-        if (player_ptr->immune_cold)
+        if (has_immune_cold(player_ptr))
             m_ptr->smart |= (SM_IMM_COLD);
         break;
 
index 1e487a2..69627f1 100644 (file)
@@ -42,7 +42,7 @@ void add_cheat_remove_flags_element(player_type *target_ptr, msr_type *msr_ptr)
     if (is_oppose_cold(target_ptr))
         msr_ptr->smart |= SM_OPP_COLD;
 
-    if (target_ptr->immune_cold)
+    if (has_immune_cold(target_ptr))
         msr_ptr->smart |= SM_IMM_COLD;
 
     if (target_ptr->resist_pois)
index 507f9e1..a091d4b 100644 (file)
@@ -281,7 +281,7 @@ bool dispel_check(player_type *creature_ptr, MONSTER_IDX m_idx)
     }
 
     if (r_ptr->flags4 & RF4_BR_COLD) {
-        if (!creature_ptr->immune_cold && (creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST)))
+        if (!has_immune_cold(creature_ptr) && (creature_ptr->oppose_cold || music_singing(creature_ptr, MUSIC_RESIST)))
             return TRUE;
 
         if (creature_ptr->special_defense & DEFENSE_COLD)
index ef05a01..b63e1c6 100644 (file)
@@ -422,7 +422,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 || creature_ptr->immune_cold))
+            if (!(is_oppose_cold(creature_ptr) || creature_ptr->resist_cold || has_immune_cold(creature_ptr)))
                 take_hit(creature_ptr, DAMAGE_NOESCAPE, 100 + randint1(100), _("氷の巻物", "a Scroll of Ice"), -1);
 
             ident = TRUE;
index b2c0f93..219f9f6 100644 (file)
@@ -131,7 +131,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
 
     case GF_COLD:
     case GF_ICE:
-        if (target_ptr->immune_cold) {
+        if (has_immune_cold(target_ptr)) {
             dam = 0;
             ignore_wraith_form = TRUE;
             break;
index fa7b3a3..b9982a0 100644 (file)
@@ -38,7 +38,7 @@ void set_element_resistance_info(player_type* creature_ptr, self_info_type* si_p
         si_ptr->info[si_ptr->line++] = _("\82 \82È\82½\82Í\89Î\82É\8eã\82¢\81B", "You are susceptible to damage from fire.");
     }
 
-    if (creature_ptr->immune_cold) {
+    if (has_immune_cold(creature_ptr)) {
         si_ptr->info[si_ptr->line++] = _("\82 \82È\82½\82Í\97â\8bC\82É\91Î\82·\82é\8a®\91S\82È\82é\96Æ\89u\82ð\8e\9d\82Á\82Ä\82¢\82é\81B", "You are completely immune to cold.");
     } else if (creature_ptr->resist_cold && is_oppose_cold(creature_ptr)) {
         si_ptr->info[si_ptr->line++] = _("\82 \82È\82½\82Í\97â\8bC\82Ö\82Ì\8b­\97Í\82È\91Ï\90«\82ð\8e\9d\82Á\82Ä\82¢\82é\81B", "You resist cold exceptionally well.");
index 77e5f6f..2b59400 100644 (file)
@@ -302,7 +302,7 @@ HIT_POINT cold_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
     bool double_resist = is_oppose_cold(creature_ptr);
 
     /* Total immunity */
-    if (creature_ptr->immune_cold || (dam <= 0)) {
+    if (has_immune_cold(creature_ptr) || (dam <= 0)) {
         learn_spell(creature_ptr, monspell);
         return 0;
     }
@@ -728,7 +728,8 @@ void touch_zap_player(monster_type *m_ptr, player_type *touched_ptr)
         RF2_AURA_FIRE,
         fire_dam,
         _("突然とても熱くなった!", "You are suddenly very hot!"));
-    process_aura_damage(m_ptr, touched_ptr, (bool)touched_ptr->immune_cold, offsetof(monster_race, flags3), offsetof(monster_race, r_flags3), RF3_AURA_COLD,
+    process_aura_damage(m_ptr, touched_ptr, (bool)has_immune_cold(touched_ptr), offsetof(monster_race, flags3), offsetof(monster_race, r_flags3),
+        RF3_AURA_COLD,
         cold_dam,
         _("突然とても寒くなった!", "You are suddenly very cold!"));
     process_aura_damage(m_ptr, touched_ptr, (bool)has_immune_elec(touched_ptr), offsetof(monster_race, flags2), offsetof(monster_race, r_flags2),
index effe70a..f5caa65 100644 (file)
@@ -367,7 +367,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->immune_cold = has_immune_cold(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);
index 44c032d..b390b77 100644 (file)
@@ -366,8 +366,6 @@ typedef struct player_type {
     bool is_fired;
     bool level_up_message;
 
-    BIT_FLAGS immune_cold; /* Immunity to cold */
-
     BIT_FLAGS resist_acid; /* Resist acid */
     BIT_FLAGS resist_elec; /* Resist lightning */
     BIT_FLAGS resist_fire; /* Resist fire */
index ccfe92f..e7ece76 100644 (file)
@@ -96,7 +96,7 @@ static void compensate_death_scythe_reflection_magnification(player_type *attack
     if (!(attacker_ptr->resist_fire || is_oppose_fire(attacker_ptr) || has_immune_fire(attacker_ptr)) && (*magnification < 25))
         *magnification = 25;
 
-    if (!(attacker_ptr->resist_cold || is_oppose_cold(attacker_ptr) || attacker_ptr->immune_cold) && (*magnification < 25))
+    if (!(attacker_ptr->resist_cold || 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))