OSDN Git Service

[Feature] 固定クエストにRES_ALL持ちモンスターを生成しない
[hengbandforosx/hengbandosx.git] / src / monster / monster-util.cpp
index 57eab7f..adbe913 100644 (file)
@@ -4,16 +4,20 @@
 #include "dungeon/quest.h"
 #include "floor/wild.h"
 #include "game-option/cheat-options.h"
+#include "grid/feature.h"
 #include "grid/grid.h"
 #include "monster-race/monster-race-hook.h"
 #include "monster-race/monster-race.h"
 #include "monster-race/race-ability-mask.h"
+#include "monster-race/race-flags-resistance.h"
 #include "monster-race/race-flags1.h"
 #include "monster-race/race-flags7.h"
 #include "monster-race/race-indice-types.h"
 #include "spell/summon-types.h"
 #include "system/alloc-entries.h"
 #include "system/floor-type-definition.h"
+#include "system/monster-race-definition.h"
+#include "system/player-type-definition.h"
 #include "util/bit-flags-calculator.h"
 #include "view/display-messages.h"
 
@@ -53,17 +57,17 @@ static bool restrict_monster_to_dungeon(player_type *player_ptr, MONRACE_IDX r_i
     dungeon_type *d_ptr = &d_info[d_idx];
     monster_race *r_ptr = &r_info[r_idx];
 
-    if (d_ptr->flags1 & DF1_CHAMELEON) {
+    if (d_ptr->flags.has(DF::CHAMELEON)) {
         if (chameleon_change_m_idx)
             return TRUE;
     }
 
-    if (d_ptr->flags1 & DF1_NO_MAGIC) {
+    if (d_ptr->flags.has(DF::NO_MAGIC)) {
         if (r_idx != MON_CHAMELEON && r_ptr->freq_spell && r_ptr->ability_flags.has_none_of(RF_ABILITY_NOMAGIC_MASK))
             return FALSE;
     }
 
-    if (d_ptr->flags1 & DF1_NO_MELEE) {
+    if (d_ptr->flags.has(DF::NO_MELEE)) {
         if (r_idx == MON_CHAMELEON)
             return TRUE;
         if (r_ptr->ability_flags.has_none_of(RF_ABILITY_BOLT_MASK | RF_ABILITY_BEAM_MASK | RF_ABILITY_BALL_MASK)
@@ -73,14 +77,14 @@ static bool restrict_monster_to_dungeon(player_type *player_ptr, MONRACE_IDX r_i
     }
 
     floor_type *floor_ptr = player_ptr->current_floor_ptr;
-    if (d_ptr->flags1 & DF1_BEGINNER) {
+    if (d_ptr->flags.has(DF::BEGINNER)) {
         if (r_ptr->level > floor_ptr->dun_level)
             return FALSE;
     }
 
     if (d_ptr->special_div >= 64)
         return TRUE;
-    if (summon_specific_type && !(d_ptr->flags1 & DF1_CHAMELEON))
+    if (summon_specific_type && d_ptr->flags.has_not(DF::CHAMELEON))
         return TRUE;
 
     byte a;
@@ -332,6 +336,10 @@ static errr do_get_mon_num_prep(player_type *player_ptr, const monsterrace_hook_
             // RF1_FORCE_DEPTH フラグ持ちは指定階未満では生成禁止。
             if ((r_ptr->flags1 & RF1_FORCE_DEPTH) && (r_ptr->level > floor_ptr->dun_level))
                 continue;
+
+            // クエスト内でRES_ALLの生成を禁止する (殲滅系クエストの詰み防止)
+            if (player_ptr->current_floor_ptr->inside_quest && any_bits(r_ptr->flagsr, RFR_RES_ALL))
+                continue;
         }
 
         // 生成を許可するものは基本重みをそのまま引き継ぐ。