OSDN Git Service

[Refactor] #40514 calc_vuln_elec_rate() を実装. / Implement calc_vuln_elec_rate().
authordeskull <deskull@users.sourceforge.jp>
Sun, 6 Sep 2020 05:38:57 +0000 (14:38 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 6 Sep 2020 05:38:57 +0000 (14:38 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h

index 7d3a8ce..6f911df 100644 (file)
@@ -992,6 +992,23 @@ 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;
index e2c5f71..b45752b 100644 (file)
@@ -73,8 +73,10 @@ 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);
 BIT_FLAGS is_resist_cold(player_type *creature_ptr);