OSDN Git Service

[Refactor] #40514 calc_acid_damage_rate() に免疫処理反映. / Reflect immunity processing...
authordeskull <deskull@users.sourceforge.jp>
Sun, 13 Sep 2020 02:00:07 +0000 (11:00 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 13 Sep 2020 02:00:07 +0000 (11:00 +0900)
src/object/warning.c
src/player/player-damage.c
src/player/player-status-resist.c

index f451783..be94bd9 100644 (file)
@@ -100,11 +100,8 @@ static void spell_damcalc(player_type *target_ptr, monster_type *m_ptr, EFFECT_I
 
     case GF_ACID:
         if (is_immune_acid(target_ptr)) {
-            dam = 0;
             ignore_wraith_form = TRUE;
-            break;
         }
-
         dam = dam * calc_acid_damage_rate(target_ptr) / 100;
         break;
 
index 62a10fd..b1c3b7e 100644 (file)
@@ -151,15 +151,13 @@ HIT_POINT acid_dam(player_type *creature_ptr, HIT_POINT dam, concptr kb_str, int
     int inv = (dam < 30) ? 1 : (dam < 60) ? 2 : 3;
     bool double_resist = is_oppose_acid(creature_ptr);
 
-    /* Total Immunity */
-    if (is_immune_acid(creature_ptr) || (dam <= 0)) {
+    dam = dam * calc_acid_damage_rate(creature_ptr) / 100;
+
+    if (dam <= 0) {
         learn_spell(creature_ptr, monspell);
         return 0;
     }
 
-    /* Vulnerability (Ouch!) */
-    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))
             (void)do_dec_stat(creature_ptr, A_CHR);
index e92131d..053134e 100644 (file)
@@ -58,6 +58,10 @@ PERCENTAGE calc_acid_damage_rate(player_type *creature_ptr)
     PERCENTAGE per = 100;
     int i;
 
+    if (is_immune_acid(creature_ptr)) {
+        return 0;
+    }
+
     BIT_FLAGS flgs = is_vuln_acid(creature_ptr);
     for (i = 0; i < FLAG_CAUSE_MAX; i++) {
         if (flgs & (0x01 << i)) {