OSDN Git Service

[Fix] ダンジョンで指定された条件と逆のモンスターが生成されてしまうバグを修正
authorSlimebreath6078 <slimebreath6078@yahoo.co.jp>
Thu, 17 Mar 2022 12:30:29 +0000 (21:30 +0900)
committerSlimebreath6078 <slimebreath6078@yahoo.co.jp>
Thu, 17 Mar 2022 12:30:29 +0000 (21:30 +0900)
src/monster/monster-util.cpp

index d9f70fc..b666d1a 100644 (file)
@@ -145,13 +145,19 @@ static bool restrict_monster_to_dungeon(PlayerType *player_ptr, MonsterRaceId r_
         }
 
         if (d_ptr->mon_resistance_flags.any()) {
-            if (!d_ptr->mon_resistance_flags.has_all_of(r_ptr->resistance_flags)) {
+            if (!r_ptr->resistance_flags.has_all_of(d_ptr->mon_resistance_flags)) {
                 return false;
             }
         }
 
         if (d_ptr->mon_drop_flags.any()) {
-            if (!d_ptr->mon_drop_flags.has_all_of(r_ptr->drop_flags)) {
+            if (!r_ptr->drop_flags.has_all_of(d_ptr->mon_drop_flags)) {
+                return false;
+            }
+        }
+
+        if (d_ptr->mon_kind_flags.any()) {
+            if (!r_ptr->kind_flags.has_all_of(d_ptr->mon_kind_flags)) {
                 return false;
             }
         }
@@ -214,13 +220,19 @@ static bool restrict_monster_to_dungeon(PlayerType *player_ptr, MonsterRaceId r_
         }
 
         if (d_ptr->mon_resistance_flags.any()) {
-            if (!d_ptr->mon_resistance_flags.has_all_of(r_ptr->resistance_flags)) {
+            if (!r_ptr->resistance_flags.has_all_of(d_ptr->mon_resistance_flags)) {
                 return true;
             }
         }
 
         if (d_ptr->mon_drop_flags.any()) {
-            if (!d_ptr->mon_drop_flags.has_all_of(r_ptr->drop_flags)) {
+            if (!r_ptr->drop_flags.has_all_of(d_ptr->mon_drop_flags)) {
+                return true;
+            }
+        }
+
+        if (d_ptr->mon_kind_flags.any()) {
+            if (!r_ptr->kind_flags.has_all_of(d_ptr->mon_kind_flags)) {
                 return true;
             }
         }
@@ -264,6 +276,9 @@ static bool restrict_monster_to_dungeon(PlayerType *player_ptr, MonsterRaceId r_
         if (r_ptr->drop_flags.has_any_of(d_ptr->mon_drop_flags)) {
             return true;
         }
+        if (r_ptr->kind_flags.has_any_of(d_ptr->mon_kind_flags)) {
+            return true;
+        }
         for (a = 0; a < 5; a++) {
             if (d_ptr->r_char[a] == r_ptr->d_char) {
                 return true;
@@ -303,6 +318,9 @@ static bool restrict_monster_to_dungeon(PlayerType *player_ptr, MonsterRaceId r_
         if (r_ptr->drop_flags.has_any_of(d_ptr->mon_drop_flags)) {
             return false;
         }
+        if (r_ptr->kind_flags.has_any_of(d_ptr->mon_kind_flags)) {
+            return false;
+        }
         for (a = 0; a < 5; a++) {
             if (d_ptr->r_char[a] == r_ptr->d_char) {
                 return false;