OSDN Git Service

Merge pull request #1202 from sikabane-works/feature/improve-fixed-reinforcement
[hengbandforosx/hengbandosx.git] / src / monster-floor / monster-generator.cpp
index 67032dc..a677cad 100644 (file)
@@ -35,6 +35,8 @@
 #include "target/projection-path-calculator.h"
 #include "util/string-processor.h"
 #include "view/display-messages.h"
+#include "wizard/wizard-messages.h"
+#include "game-option/cheat-types.h"
 
 #define MON_SCAT_MAXD 10 /*!< mon_scatter()関数によるモンスター配置で許される中心からの最大距離 */
 
@@ -280,9 +282,18 @@ bool place_monster_aux(player_type *player_ptr, MONSTER_IDX who, POSITION y, POS
             break;
         int n = damroll(r_ptr->reinforce_dd[i], r_ptr->reinforce_ds[i]);
         for (int j = 0; j < n; j++) {
-            POSITION nx, ny, d = 7;
-            scatter(player_ptr, &ny, &nx, y, x, d, PROJECT_NONE);
-            (void)place_monster_one(player_ptr, place_monster_m_idx, ny, nx, r_ptr->reinforce_id[i], mode);
+            POSITION nx, ny, d;
+            const POSITION scatter_min = 7;
+            const POSITION scatter_max = 40;
+            for (d = scatter_min; d <= scatter_max; d++) {
+                scatter(player_ptr, &ny, &nx, y, x, d, PROJECT_NONE);
+                if (place_monster_one(player_ptr, place_monster_m_idx, ny, nx, r_ptr->reinforce_id[i], mode)) {
+                    break;
+                }
+            }
+            if (d > scatter_max) {
+                msg_format_wizard(player_ptr, CHEAT_MONSTER, _("護衛の指定生成に失敗しました。", "Failed fixed escorts."));
+            }
         }
     }