OSDN Git Service

[Fix] 元素使いのダンプで免疫の表示がおかしい(+になる)
authoriks <iks3@users.noreply.github.com>
Sun, 21 Mar 2021 06:48:04 +0000 (15:48 +0900)
committeriks <iks3@users.noreply.github.com>
Sun, 21 Mar 2021 06:48:04 +0000 (15:48 +0900)
src/player/permanent-resistances.cpp
src/player/race-resistances.cpp

index 4ae6c21..6ce23c0 100644 (file)
@@ -117,20 +117,12 @@ static void add_class_flags(player_type *creature_ptr, BIT_FLAGS *flags)
     case CLASS_ELEMENTALIST:
         if (has_element_resist(creature_ptr, ElementRealm::FIRE, 1))
             add_flag(flags, TR_RES_FIRE);
-        if (has_element_resist(creature_ptr, ElementRealm::FIRE, 30))
-            add_flag(flags, TR_IM_FIRE);
         if (has_element_resist(creature_ptr, ElementRealm::ICE, 1))
             add_flag(flags, TR_RES_COLD);
-        if (has_element_resist(creature_ptr, ElementRealm::ICE, 30))
-            add_flag(flags, TR_IM_COLD);
         if (has_element_resist(creature_ptr, ElementRealm::SKY, 1))
             add_flag(flags, TR_RES_ELEC);
-        if (has_element_resist(creature_ptr, ElementRealm::SKY, 30))
-            add_flag(flags, TR_IM_ELEC);
         if (has_element_resist(creature_ptr, ElementRealm::SEA, 1))
             add_flag(flags, TR_RES_ACID);
-        if (has_element_resist(creature_ptr, ElementRealm::SEA, 30))
-            add_flag(flags, TR_IM_ACID);
         if (has_element_resist(creature_ptr, ElementRealm::DARKNESS, 1))
             add_flag(flags, TR_RES_DARK);
         if (has_element_resist(creature_ptr, ElementRealm::DARKNESS, 30))
index 6d50bc6..cf9e31f 100644 (file)
@@ -6,10 +6,11 @@
 #include "object-enchant/tr-types.h"
 #include "player/player-race.h"
 #include "player/special-defense-types.h"
+#include "mind/mind-elementalist.h"
 #include "util/bit-flags-calculator.h"
 
 /*!
- * @brief プレイヤーの種族による免疫フラグを返す
+ * @brief プレイヤーの職業/種族による免疫フラグを返す
  * @param creature_ptr プレーヤーへの参照ポインタ
  * @param flags フラグを保管する配列
  * @return なし
  */
 void player_immunity(player_type *creature_ptr, BIT_FLAGS *flags)
 {
-       for (int i = 0; i < TR_FLAG_SIZE; i++)
-               flags[i] = 0L;
+    for (int i = 0; i < TR_FLAG_SIZE; i++)
+        flags[i] = 0L;
 
-       if (is_specific_player_race(creature_ptr, RACE_SPECTRE))
-               add_flag(flags, TR_RES_NETHER);
-       if (creature_ptr->mimic_form == MIMIC_VAMPIRE || is_specific_player_race(creature_ptr, RACE_VAMPIRE))
-               add_flag(flags, TR_RES_DARK);
-       if (creature_ptr->mimic_form == MIMIC_DEMON_LORD)
-               add_flag(flags, TR_RES_FIRE);
-       else if (is_specific_player_race(creature_ptr, RACE_YEEK) && creature_ptr->lev > 19)
-               add_flag(flags, TR_RES_ACID);
+    if (is_specific_player_race(creature_ptr, RACE_SPECTRE))
+        add_flag(flags, TR_RES_NETHER);
+    if (creature_ptr->mimic_form == MIMIC_VAMPIRE || is_specific_player_race(creature_ptr, RACE_VAMPIRE))
+        add_flag(flags, TR_RES_DARK);
+    if (creature_ptr->mimic_form == MIMIC_DEMON_LORD)
+        add_flag(flags, TR_RES_FIRE);
+    else if (is_specific_player_race(creature_ptr, RACE_YEEK) && creature_ptr->lev > 19)
+        add_flag(flags, TR_RES_ACID);
+
+    if (creature_ptr->pclass == CLASS_ELEMENTALIST) {
+        if (has_element_resist(creature_ptr, ElementRealm::FIRE, 30))
+            add_flag(flags, TR_RES_FIRE);
+        if (has_element_resist(creature_ptr, ElementRealm::SKY, 30))
+            add_flag(flags, TR_RES_ELEC);
+        if (has_element_resist(creature_ptr, ElementRealm::SEA, 30))
+            add_flag(flags, TR_RES_ACID);
+        if (has_element_resist(creature_ptr, ElementRealm::ICE, 30))
+            add_flag(flags, TR_RES_COLD);
+    }
 }