OSDN Git Service

Merge pull request #947 from shimitei/feature/#870_describe_music_and_sound
[hengbandforosx/hengbandosx.git] / src / player / player-status-resist.cpp
index 20560c3..9a1c068 100644 (file)
@@ -29,6 +29,7 @@
 #include "system/floor-type-definition.h"
 #include "system/monster-type-definition.h"
 #include "system/object-type-definition.h"
+#include "system/player-type-definition.h"
 #include "util/bit-flags-calculator.h"
 #include "util/quarks.h"
 #include "util/string-processor.h"
@@ -219,6 +220,9 @@ PERCENTAGE calc_deathray_damage_rate(player_type *creature_ptr, rate_calc_type_m
     case RACE_SPECTRE:
         return 0;
         break;
+
+    default:
+        break;
     }
 
     return 100;
@@ -230,10 +234,16 @@ PERCENTAGE calc_deathray_damage_rate(player_type *creature_ptr, rate_calc_type_m
 PERCENTAGE calc_lite_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
 {
     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 (player_race_has_flag(creature_ptr, TR_VUL_LITE)) {
+        switch (player_race_life(creature_ptr)) {
+        case PlayerRaceLife::UNDEAD:
+            per *= 2;
+            break;
+        default:
+            per = per * 4 / 3;
+            break;
+        }
     }
 
     if (has_resist_lite(creature_ptr)) {
@@ -254,9 +264,8 @@ PERCENTAGE calc_dark_damage_rate(player_type *creature_ptr, rate_calc_type_mode
 {
     PERCENTAGE per = 100;
 
-    if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE) || creature_ptr->wraith_form) {
+    if (has_immune_dark(creature_ptr))
         return 0;
-    }
 
     if (has_resist_dark(creature_ptr)) {
         per *= 400;
@@ -405,6 +414,22 @@ PERCENTAGE calc_time_damage_rate(player_type *creature_ptr, rate_calc_type_mode
 }
 
 /*!
+ * @brief 水流攻撃に対するダメージ倍率計算
+ */
+PERCENTAGE calc_water_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
+{
+    (void)mode; // unused
+    PERCENTAGE per = 100;
+
+    if (has_resist_water(creature_ptr)) {
+        per *= 400;
+        per /= randrate(4, 7, mode);
+    }
+
+    return per;
+}
+
+/*!
  * @brief 聖なる火炎攻撃に対するダメージ倍率計算
  */
 PERCENTAGE calc_holy_fire_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
@@ -442,3 +467,38 @@ PERCENTAGE calc_gravity_damage_rate(player_type *creature_ptr, rate_calc_type_mo
     }
     return per;
 }
+
+/*!
+ * @brief 虚無攻撃に対するダメージ倍率計算
+ */
+PERCENTAGE calc_void_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
+{
+    (void)mode; // unused
+    PERCENTAGE per = 100;
+    if (creature_ptr->tim_pass_wall) {
+        per = per * 3 / 2;
+    } else if (creature_ptr->anti_tele) {
+        per *= 400;
+        per /= randrate(4, 7, mode);
+    } else if (creature_ptr->levitation) {
+        per = (per * 2) / 3;
+    }
+    return per;
+}
+
+/*!
+ * @brief 深淵攻撃に対するダメージ倍率計算
+ */
+PERCENTAGE calc_abyss_damage_rate(player_type *creature_ptr, rate_calc_type_mode mode)
+{
+    (void)mode; // unused
+    PERCENTAGE per = 100;
+
+    if (has_resist_dark(creature_ptr)) {
+        per *= 400;
+        per /= randrate(4, 7, mode);
+    } else if (!creature_ptr->levitation && creature_ptr->anti_tele) {
+        per = (per * 5) / 4;
+    }
+    return per;
+}