OSDN Git Service

[Refactor] #40514 is_immune_dark()を実装. / Implement is_immune_dark().
authordeskull <deskull@users.sourceforge.jp>
Sun, 6 Sep 2020 11:36:34 +0000 (20:36 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Sun, 6 Sep 2020 11:36:34 +0000 (20:36 +0900)
src/player/player-status-flags.c
src/player/player-status-flags.h

index 42e8301..0801ab0 100644 (file)
@@ -1543,6 +1543,21 @@ BIT_FLAGS is_immune_cold(player_type *creature_ptr)
     return result;
 }
 
+BIT_FLAGS is_immune_dark(player_type *creature_ptr)
+{
+    BIT_FLAGS result = 0L;
+
+    if (is_specific_player_race(creature_ptr, RACE_VAMPIRE) || (creature_ptr->mimic_form == MIMIC_VAMPIRE)) {
+        result |= 0x01 << FLAG_CAUSE_RACE;
+    }
+
+    if (creature_ptr->wraith_form) {
+        result |= 0x01 << FLAG_CAUSE_MAGIC_TIME_EFFECT;
+    }
+
+    return result;
+}
+
 bool has_right_hand_weapon(player_type *creature_ptr)
 {
     if (has_melee_weapon(creature_ptr, INVEN_RARM))
index f86a4d5..bb81132 100644 (file)
@@ -102,6 +102,7 @@ BIT_FLAGS is_immune_acid(player_type *creature_ptr);
 BIT_FLAGS is_immune_elec(player_type *creature_ptr);
 BIT_FLAGS is_immune_fire(player_type *creature_ptr);
 BIT_FLAGS is_immune_cold(player_type *creature_ptr);
+BIT_FLAGS is_immune_dark(player_type *creature_ptr);
 bool has_right_hand_weapon(player_type *creature_ptr);
 bool has_left_hand_weapon(player_type *creature_ptr);
 bool has_two_handed_weapons(player_type *creature_ptr);