OSDN Git Service

[Refactor] #40514 calc_vuln_acid_rate() を calc_acid_damage_rate() に改名して耐性処理反映. /...
authordeskull <deskull@users.sourceforge.jp>
Sat, 12 Sep 2020 16:09:34 +0000 (01:09 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sat, 12 Sep 2020 16:09:34 +0000 (01:09 +0900)
src/object/warning.c
src/player/player-damage.c
src/player/player-status-resist.c
src/player/player-status-resist.h

index f69f055..701f7d5 100644 (file)
@@ -114,11 +114,7 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
             break;
         }
 
-        dam = dam * calc_vuln_acid_rate(target_ptr) / 100;
-        if (target_ptr->resist_acid)
-            dam = (dam + 2) / 3;
-        if (is_oppose_acid(target_ptr))
-            dam = (dam + 2) / 3;
+        dam = dam * calc_acid_damage_rate(target_ptr) / 100;
         break;
 
     case GF_COLD:
index 9406d3a..242cf99 100644 (file)
@@ -158,13 +158,7 @@ HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
     }
 
     /* Vulnerability (Ouch!) */
-    dam = dam * calc_vuln_acid_rate(creature_ptr) / 100;
-
-    /* Resist the damage */
-    if (creature_ptr->resist_acid)
-        dam = (dam + 2) / 3;
-    if (double_resist)
-        dam = (dam + 2) / 3;
+    dam = dam * calc_acid_damage_rate(creature_ptr) / 100;
 
     if (aura || !check_multishadow(creature_ptr)) {
         if ((!(double_resist || creature_ptr->resist_acid)) && one_in_(HURT_CHANCE))
index 72de341..4780ce0 100644 (file)
 #include "util/bit-flags-calculator.h"
 #include "util/quarks.h"
 #include "util/string-processor.h"
+#include "status/element-resistance.h"
 
-PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr)
+PERCENTAGE calc_acid_damage_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)) {
@@ -44,7 +46,14 @@ PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr)
             }
         }
     }
+
+    if (creature_ptr->resist_acid)
+        per = (per + 2) / 3;
+    if (is_oppose_acid(creature_ptr))
+        per = (per + 2) / 3;
+
     return per;
+
 }
 
 PERCENTAGE calc_vuln_elec_rate(player_type *creature_ptr)
index a794af8..1775467 100644 (file)
@@ -1,6 +1,6 @@
 #include "player/player-status.h"
 
-PERCENTAGE calc_vuln_acid_rate(player_type *creature_ptr);
+PERCENTAGE calc_acid_damage_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);