OSDN Git Service

[Refactor] #40514 player-status-flags.c/h から player-status-resist.c/h を分離. / Separate...
authordeskull <deskull@users.sourceforge.jp>
Wed, 9 Sep 2020 17:04:05 +0000 (02:04 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Wed, 9 Sep 2020 17:05:58 +0000 (02:05 +0900)
Hengband/Hengband/Hengband.vcxproj
Hengband/Hengband/Hengband.vcxproj.filters
src/Makefile.am
src/effect/effect-player-resist-hurt.c
src/object/warning.c
src/player/player-damage.c
src/player/player-status-flags.c
src/player/player-status-flags.h
src/player/player-status-resist.c [new file with mode: 0644]
src/player/player-status-resist.h [new file with mode: 0644]

index 194ba03..017cb7a 100644 (file)
     <ClCompile Include="..\..\src\player-info\resistance-info.c" />\r
     <ClCompile Include="..\..\src\player-info\self-info-util.c" />\r
     <ClCompile Include="..\..\src\player-info\weapon-effect-info.c" />\r
+    <ClCompile Include="..\..\src\player\player-status-resist.c" />\r
     <ClCompile Include="..\..\src\room\vault-builder.c" />\r
     <ClCompile Include="..\..\src\specific-object\blade-turner.c" />\r
     <ClCompile Include="..\..\src\specific-object\monster-ball.c" />\r
     <ClInclude Include="..\..\src\player-info\resistance-info.h" />\r
     <ClInclude Include="..\..\src\player-info\self-info-util.h" />\r
     <ClInclude Include="..\..\src\player-info\weapon-effect-info.h" />\r
+    <ClInclude Include="..\..\src\player\player-status-resist.h" />\r
     <ClInclude Include="..\..\src\room\vault-builder.h" />\r
     <ClInclude Include="..\..\src\specific-object\blade-turner.h" />\r
     <ClInclude Include="..\..\src\specific-object\monster-ball.h" />\r
index 19e1322..9b84e49 100644 (file)
     <ClCompile Include="..\..\src\monster-floor\special-death-switcher.c">
       <Filter>monster-floor</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\src\player\player-status-resist.c">
+      <Filter>player</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\src\combat\shoot.h">
     <ClInclude Include="..\..\src\spell\summon-types.h">
       <Filter>spell</Filter>
     </ClInclude>
+    <ClInclude Include="..\..\src\player\player-status-resist.h">
+      <Filter>player</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\wall.bmp" />
index dc778dd..4f44d87 100644 (file)
@@ -627,6 +627,7 @@ hengband_SOURCES = \
        player/player-status.c player/player-status.h \
        player/player-status-flags.c player/player-status-flags.h \
        player/player-status-table.c player/player-status-table.h \
+       player/player-status-resist.c player/player-status-resist.h \
        player/player-personalities-types.h \
        player/player-sex.c player/player-sex.h \
        player/player-view.c player/player-view.h \
index c1feda4..df66710 100644 (file)
@@ -15,6 +15,7 @@
 #include "player/player-race-types.h"
 #include "player/player-race.h"
 #include "player/player-status-flags.h"
+#include "player/player-status-resist.h"
 #include "spell-kind/spells-equipment.h"
 #include "spell-kind/spells-teleport.h"
 #include "spell/spells-status.h"
index 901138a..f69f055 100644 (file)
@@ -31,6 +31,7 @@
 #include "player/player-race-types.h"
 #include "player/special-defense-types.h"
 #include "player/player-status-flags.h"
+#include "player/player-status-resist.h"
 #include "spell/spell-types.h"
 #include "status/element-resistance.h"
 #include "system/floor-type-definition.h"
index 6a86c43..9406d3a 100644 (file)
@@ -47,6 +47,7 @@
 #include "player/race-info-table.h"
 #include "player/special-defense-types.h"
 #include "player/player-status-flags.h"
+#include "player/player-status-resist.h"
 #include "racial/racial-android.h"
 #include "save/save.h"
 #include "status/base-status.h"
index 049cbc0..daca276 100644 (file)
@@ -935,23 +935,6 @@ BIT_FLAGS is_vuln_acid(player_type *creature_ptr)
     return result;
 }
 
-PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr)
-{
-    PERCENTAGE per = 100;
-    int i;
-    BIT_FLAGS flgs = is_vuln_acid(creature_ptr);
-    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
-        if (flgs & (0x01 << i)) {
-            if (i == FLAG_CAUSE_MUTATION) {
-                per *= 2;
-            } else {
-                per += per / 3;
-            }
-        }
-    }
-    return per;
-}
-
 BIT_FLAGS is_resist_elec(player_type *creature_ptr)
 {
     BIT_FLAGS result = 0L;
@@ -992,23 +975,6 @@ BIT_FLAGS is_vuln_elec(player_type *creature_ptr)
     return result;
 }
 
-PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr)
-{
-    PERCENTAGE per = 100;
-    int i;
-    BIT_FLAGS flgs = is_vuln_elec(creature_ptr);
-    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
-        if (flgs & (0x01 << i)) {
-            if (i == FLAG_CAUSE_MUTATION) {
-                per *= 2;
-            } else {
-                per += per / 3;
-            }
-        }
-    }
-    return per;
-}
-
 BIT_FLAGS is_resist_fire(player_type *creature_ptr)
 {
     BIT_FLAGS result = 0L;
@@ -1055,23 +1021,6 @@ BIT_FLAGS is_vuln_fire(player_type *creature_ptr)
     return result;
 }
 
-PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr)
-{
-    PERCENTAGE per = 100;
-    int i;
-    BIT_FLAGS flgs = is_vuln_fire(creature_ptr);
-    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
-        if (flgs & (0x01 << i)) {
-            if (i == FLAG_CAUSE_MUTATION) {
-                per *= 2;
-            } else {
-                per += per / 3;
-            }
-        }
-    }
-    return per;
-}
-
 BIT_FLAGS is_resist_cold(player_type *creature_ptr)
 {
     BIT_FLAGS result = 0L;
@@ -1118,23 +1067,6 @@ BIT_FLAGS is_vuln_cold(player_type *creature_ptr)
     return result;
 }
 
-PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr)
-{
-    PERCENTAGE per = 100;
-    int i;
-    BIT_FLAGS flgs = is_vuln_cold(creature_ptr);
-    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
-        if (flgs & (0x01 << i)) {
-            if (i == FLAG_CAUSE_MUTATION) {
-                per *= 2;
-            } else {
-                per += per / 3;
-            }
-        }
-    }
-    return per;
-}
-
 BIT_FLAGS is_resist_pois(player_type *creature_ptr)
 {
     BIT_FLAGS result = 0L;
@@ -1258,21 +1190,6 @@ BIT_FLAGS is_vuln_lite(player_type *creature_ptr)
     return result;
 }
 
-PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr)
-{
-    PERCENTAGE per = 100;
-    if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE)) {
-        per *= 2;
-    } else if (is_specific_player_race(creature_ptr, RACE_S_FAIRY)) {
-        per = per * 4 / 3;
-    }
-
-    if (creature_ptr->wraith_form)
-        per *= 2;
-
-    return per;
-}
-
 BIT_FLAGS is_resist_dark(player_type *creature_ptr)
 {
     BIT_FLAGS result = 0L;
index 98fb1c1..2a0748a 100644 (file)
@@ -73,22 +73,17 @@ BIT_FLAGS has_impact(player_type *creature_ptr);
 void has_extra_blow(player_type *creature_ptr);
 BIT_FLAGS is_resist_acid(player_type *creature_ptr);
 BIT_FLAGS is_vuln_acid(player_type *creature_ptr);
-PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr);
 BIT_FLAGS is_resist_elec(player_type *creature_ptr);
 BIT_FLAGS is_vuln_elec(player_type *creature_ptr);
-PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr);
 BIT_FLAGS is_resist_fire(player_type *creature_ptr);
 BIT_FLAGS is_vuln_fire(player_type *creature_ptr);
-PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr);
 BIT_FLAGS is_resist_cold(player_type *creature_ptr);
 BIT_FLAGS is_vuln_cold(player_type *creature_ptr);
-PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr);
 BIT_FLAGS is_resist_pois(player_type *creature_ptr);
 BIT_FLAGS is_resist_conf(player_type *creature_ptr);
 BIT_FLAGS is_resist_sound(player_type *creature_ptr);
 BIT_FLAGS is_resist_lite(player_type *creature_ptr);
 BIT_FLAGS is_vuln_lite(player_type *creature_ptr);
-PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr);
 BIT_FLAGS is_resist_dark(player_type *creature_ptr);
 BIT_FLAGS is_resist_chaos(player_type *creature_ptr);
 BIT_FLAGS is_resist_disen(player_type *creature_ptr);
diff --git a/src/player/player-status-resist.c b/src/player/player-status-resist.c
new file mode 100644 (file)
index 0000000..72de341
--- /dev/null
@@ -0,0 +1,114 @@
+#include "player/player-status-flags.h"
+#include "art-definition/art-sword-types.h"
+#include "grid/grid.h"
+#include "inventory/inventory-slot-types.h"
+#include "monster-race/monster-race.h"
+#include "monster-race/race-flags2.h"
+#include "monster-race/race-flags7.h"
+#include "mutation/mutation-flag-types.h"
+#include "object-enchant/object-ego.h"
+#include "object-enchant/tr-types.h"
+#include "object-enchant/trc-types.h"
+#include "object-hook/hook-checker.h"
+#include "object-hook/hook-weapon.h"
+#include "object/object-flags.h"
+#include "player/player-class.h"
+#include "player/player-race-types.h"
+#include "player/player-race.h"
+#include "player/player-skill.h"
+#include "player/player-status.h"
+#include "player/special-defense-types.h"
+#include "realm/realm-hex-numbers.h"
+#include "realm/realm-song-numbers.h"
+#include "realm/realm-types.h"
+#include "spell-realm/spells-hex.h"
+#include "sv-definition/sv-weapon-types.h"
+#include "system/floor-type-definition.h"
+#include "system/monster-type-definition.h"
+#include "system/object-type-definition.h"
+#include "util/bit-flags-calculator.h"
+#include "util/quarks.h"
+#include "util/string-processor.h"
+
+PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr)
+{
+    PERCENTAGE per = 100;
+    int i;
+    BIT_FLAGS flgs = is_vuln_acid(creature_ptr);
+    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
+        if (flgs & (0x01 << i)) {
+            if (i == FLAG_CAUSE_MUTATION) {
+                per *= 2;
+            } else {
+                per += per / 3;
+            }
+        }
+    }
+    return per;
+}
+
+PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr)
+{
+    PERCENTAGE per = 100;
+    int i;
+    BIT_FLAGS flgs = is_vuln_elec(creature_ptr);
+    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
+        if (flgs & (0x01 << i)) {
+            if (i == FLAG_CAUSE_MUTATION) {
+                per *= 2;
+            } else {
+                per += per / 3;
+            }
+        }
+    }
+    return per;
+}
+
+PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr)
+{
+    PERCENTAGE per = 100;
+    int i;
+    BIT_FLAGS flgs = is_vuln_fire(creature_ptr);
+    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
+        if (flgs & (0x01 << i)) {
+            if (i == FLAG_CAUSE_MUTATION) {
+                per *= 2;
+            } else {
+                per += per / 3;
+            }
+        }
+    }
+    return per;
+}
+
+PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr)
+{
+    PERCENTAGE per = 100;
+    int i;
+    BIT_FLAGS flgs = is_vuln_cold(creature_ptr);
+    for (i = 0; i < FLAG_CAUSE_MAX; i++) {
+        if (flgs & (0x01 << i)) {
+            if (i == FLAG_CAUSE_MUTATION) {
+                per *= 2;
+            } else {
+                per += per / 3;
+            }
+        }
+    }
+    return per;
+}
+
+PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr)
+{
+    PERCENTAGE per = 100;
+    if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE)) {
+        per *= 2;
+    } else if (is_specific_player_race(creature_ptr, RACE_S_FAIRY)) {
+        per = per * 4 / 3;
+    }
+
+    if (creature_ptr->wraith_form)
+        per *= 2;
+
+    return per;
+}
diff --git a/src/player/player-status-resist.h b/src/player/player-status-resist.h
new file mode 100644 (file)
index 0000000..a794af8
--- /dev/null
@@ -0,0 +1,7 @@
+#include "player/player-status.h"
+
+PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr);
+PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr);
+PERCENTAGE calc_vuln_fire_rate(player_type *creature_ptr);
+PERCENTAGE calc_vuln_cold_rate(player_type *creature_ptr);
+PERCENTAGE calc_vuln_lite_rate(player_type *creature_ptr);