OSDN Git Service

[Refactor] #40514 player_type の resist_elec 変数を廃止. / Abolished the resist_elec variab...
authordeskull <deskull@users.sourceforge.jp>
Sun, 10 Jan 2021 16:20:35 +0000 (01:20 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 10 Jan 2021 16:21:51 +0000 (01:21 +0900)
src/cmd-action/cmd-travel.c
src/core/hp-mp-processor.c
src/monster/monster-update.c
src/mspell/element-resistance-checker.c
src/player-info/resistance-info.c
src/player/player-damage.c
src/player/player-status-resist.c
src/player/player-status.c
src/player/player-status.h
src/specific-object/death-scythe.c

index 79a1b8a..c7460cc 100644 (file)
@@ -5,6 +5,7 @@
 #include "grid/feature.h"
 #include "grid/grid.h"
 #include "player/player-move.h"
+#include "player/player-status-flags.h"
 #include "system/floor-type-definition.h"
 #include "target/grid-selector.h"
 #include "view/display-messages.h"
index 97a694d..137e46f 100644 (file)
@@ -182,7 +182,7 @@ void process_player_hp_mp(player_type *creature_ptr)
         }
 
         if (damage) {
-            if (creature_ptr->resist_elec)
+            if (has_resist_elec(creature_ptr))
                 damage = damage / 3;
             if (is_oppose_elec(creature_ptr))
                 damage = damage / 3;
@@ -304,7 +304,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_ANDROID))
                 damage += damage / 3;
-            if (creature_ptr->resist_elec)
+            if (has_resist_elec(creature_ptr))
                 damage = damage / 3;
             if (is_oppose_elec(creature_ptr))
                 damage = damage / 3;
index b90e1f7..894502e 100644 (file)
@@ -550,7 +550,7 @@ void update_smart_learn(player_type *player_ptr, MONSTER_IDX m_idx, int what)
 
         break;
     case DRS_ELEC:
-        if (player_ptr->resist_elec)
+        if (has_resist_elec(player_ptr))
             m_ptr->smart |= SM_RES_ELEC;
 
         if (is_oppose_elec(player_ptr))
index 162ae12..902f96b 100644 (file)
@@ -18,7 +18,7 @@ void add_cheat_remove_flags_element(player_type *target_ptr, msr_type *msr_ptr)
     if (has_immune_acid(target_ptr))
         msr_ptr->smart |= SM_IMM_ACID;
 
-    if (target_ptr->resist_elec)
+    if (has_resist_elec(target_ptr))
         msr_ptr->smart |= SM_RES_ELEC;
 
     if (is_oppose_elec(target_ptr))
index 56ff64b..143b1d9 100644 (file)
@@ -16,9 +16,9 @@ void set_element_resistance_info(player_type* creature_ptr, self_info_type* self
 
     if (has_immune_elec(creature_ptr)) {
         self_ptr->info[self_ptr->line++] = _("あなたは電撃に対する完全なる免疫を持っている。", "You are completely immune to lightning.");
-    } else if (creature_ptr->resist_elec && is_oppose_elec(creature_ptr)) {
+    } else if (has_resist_elec(creature_ptr) && is_oppose_elec(creature_ptr)) {
         self_ptr->info[self_ptr->line++] = _("あなたは電撃への強力な耐性を持っている。", "You resist lightning exceptionally well.");
-    } else if (creature_ptr->resist_elec || is_oppose_elec(creature_ptr)) {
+    } else if (has_resist_elec(creature_ptr) || is_oppose_elec(creature_ptr)) {
         self_ptr->info[self_ptr->line++] = _("あなたは電撃への耐性を持っている。", "You are resistant to lightning.");
     }
     if (is_specific_player_race(creature_ptr, RACE_ANDROID) && !has_immune_elec(creature_ptr)) {
index c2ded83..39efcef 100644 (file)
@@ -182,12 +182,12 @@ HIT_POINT elec_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
     }
 
     if (aura || !check_multishadow(creature_ptr)) {
-        if ((!(double_resist || creature_ptr->resist_elec)) && one_in_(HURT_CHANCE))
+        if ((!(double_resist || has_resist_elec(creature_ptr))) && one_in_(HURT_CHANCE))
             (void)do_dec_stat(creature_ptr, A_DEX);
     }
 
     HIT_POINT get_damage = take_hit(creature_ptr, aura ? DAMAGE_NOESCAPE : DAMAGE_ATTACK, dam, kb_str, monspell);
-    if (!aura && !(double_resist && creature_ptr->resist_elec))
+    if (!aura && !(double_resist && has_resist_elec(creature_ptr)))
         inventory_damage(creature_ptr, set_elec_destroy, inv);
 
     return get_damage;
index 72b9d07..e073e39 100644 (file)
@@ -109,7 +109,7 @@ PERCENTAGE calc_elec_damage_rate(player_type *creature_ptr)
         }
     }
 
-    if (creature_ptr->resist_elec)
+    if (has_resist_elec(creature_ptr))
         per = (per + 2) / 3;
     if (is_oppose_elec(creature_ptr))
         per = (per + 2) / 3;
index d4a23ef..5a93095 100644 (file)
@@ -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_elec = has_resist_elec(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);
index 79561da..6a337db 100644 (file)
@@ -366,7 +366,6 @@ typedef struct player_type {
     bool is_fired;
     bool level_up_message;
 
-    BIT_FLAGS resist_elec; /* Resist lightning */
     BIT_FLAGS resist_cold; /* Resist cold */
     BIT_FLAGS resist_pois; /* Resist poison */
 
index 23ea3fe..524e54f 100644 (file)
@@ -90,7 +90,7 @@ static void compensate_death_scythe_reflection_magnification(player_type *attack
     if (!(has_resist_acid(attacker_ptr) || is_oppose_acid(attacker_ptr) || has_immune_acid(attacker_ptr)) && (*magnification < 25))
         *magnification = 25;
 
-    if (!(attacker_ptr->resist_elec || is_oppose_elec(attacker_ptr) || has_immune_elec(attacker_ptr)) && (*magnification < 25))
+    if (!(has_resist_elec(attacker_ptr) || is_oppose_elec(attacker_ptr) || has_immune_elec(attacker_ptr)) && (*magnification < 25))
         *magnification = 25;
 
     if (!(has_resist_fire(attacker_ptr) || is_oppose_fire(attacker_ptr) || has_immune_fire(attacker_ptr)) && (*magnification < 25))