<ClCompile Include="..\..\src\room\cave-filler.c" />\r
<ClCompile Include="..\..\src\room\room-generator.c" />\r
<ClCompile Include="..\..\src\room\room-info-table.c" />\r
+ <ClCompile Include="..\..\src\room\treasure-deployment.c" />\r
<ClCompile Include="..\..\src\save\floor-writer.c" />\r
<ClCompile Include="..\..\src\save\info-writer.c" />\r
<ClCompile Include="..\..\src\save\item-writer.c" />\r
<ClInclude Include="..\..\src\room\room-generator.h" />\r
<ClInclude Include="..\..\src\room\room-info-table.h" />\r
<ClInclude Include="..\..\src\room\room-types.h" />\r
+ <ClInclude Include="..\..\src\room\treasure-deployment.h" />\r
<ClInclude Include="..\..\src\save\floor-writer.h" />\r
<ClInclude Include="..\..\src\save\info-writer.h" />\r
<ClInclude Include="..\..\src\save\item-writer.h" />\r
<ClCompile Include="..\..\src\system\dungeon-data-definition.c">
<Filter>system</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\room\treasure-deployment.c">
+ <Filter>room</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\combat\shoot.h">
<ClInclude Include="..\..\src\system\dungeon-data-definition.h">
<Filter>system</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\room\treasure-deployment.h">
+ <Filter>room</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
room/rooms-vault.c room/rooms-vault.h \
room/rooms-pit-nest.c room/rooms-pit-nest.h \
room/pit-nest-kinds-table.c room/pit-nest-kinds-table.h \
+ room/treasure-deployment.c room/treasure-deployment.h \
\
save/floor-writer.c save/floor-writer.h \
save/info-writer.c save/info-writer.h \
#include "room/cave-filler.h"
#include "room/lake-types.h"
#include "room/rooms.h"
+#include "room/treasure-deployment.h"
#include "store/store-util.h"
#include "store/store.h"
#include "system/dungeon-data-definition.h"
#include "room/rooms-special.h"
#include "room/rooms-trap.h"
#include "room/rooms-vault.h"
+#include "room/treasure-deployment.h"
#include "system/dungeon-data-definition.h"
#include "system/floor-type-definition.h"
#include "util/bit-flags-calculator.h"
}
/*
- * Routine that fills the empty areas of a room with treasure and monsters.
- */
-void fill_treasure(player_type *player_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty)
-{
- POSITION cx = (x1 + x2) / 2;
- POSITION cy = (y1 + y2) / 2;
- POSITION size = abs(x2 - x1) + abs(y2 - y1);
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (POSITION x = x1; x <= x2; x++) {
- for (POSITION y = y1; y <= y2; y++) {
- s32b value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint1(10) - difficulty;
- if ((randint1(100) - difficulty * 3) > 50)
- value = 20;
-
- if (!is_floor_bold(floor_ptr, y, x) && (!cave_have_flag_bold(floor_ptr, y, x, FF_PLACE) || !cave_have_flag_bold(floor_ptr, y, x, FF_DROP)))
- continue;
-
- if (value < 0) {
- floor_ptr->monster_level = floor_ptr->base_level + 40;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- floor_ptr->object_level = floor_ptr->base_level + 20;
- place_object(player_ptr, y, x, AM_GOOD);
- floor_ptr->object_level = floor_ptr->base_level;
- } else if (value < 5) {
- floor_ptr->monster_level = floor_ptr->base_level + 20;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- floor_ptr->object_level = floor_ptr->base_level + 10;
- place_object(player_ptr, y, x, AM_GOOD);
- floor_ptr->object_level = floor_ptr->base_level;
- } else if (value < 10) {
- floor_ptr->monster_level = floor_ptr->base_level + 9;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- } else if (value < 17) {
- } else if (value < 23) {
- if (randint0(100) < 25) {
- place_object(player_ptr, y, x, 0L);
- } else {
- place_trap(player_ptr, y, x);
- }
- } else if (value < 30) {
- floor_ptr->monster_level = floor_ptr->base_level + 5;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- place_trap(player_ptr, y, x);
- } else if (value < 40) {
- if (randint0(100) < 50) {
- floor_ptr->monster_level = floor_ptr->base_level + 3;
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- floor_ptr->monster_level = floor_ptr->base_level;
- }
-
- if (randint0(100) < 50) {
- floor_ptr->object_level = floor_ptr->base_level + 7;
- place_object(player_ptr, y, x, 0L);
- floor_ptr->object_level = floor_ptr->base_level;
- }
- } else if (value < 50) {
- place_trap(player_ptr, y, x);
- } else {
- if (randint0(100) < 20) {
- place_monster(player_ptr, y, x, (PM_ALLOW_SLEEP | PM_ALLOW_GROUP));
- } else if (randint0(100) < 50) {
- place_trap(player_ptr, y, x);
- } else if (randint0(100) < 50) {
- place_object(player_ptr, y, x, 0L);
- }
- }
- }
- }
-}
-
-/*
* Overlay a rectangular room given its bounds
* This routine is used by build_room_vault
* The area inside the walls is not touched:
void build_small_room(player_type *player_ptr, POSITION x0, POSITION y0);
void add_outer_wall(player_type *player_ptr, POSITION x, POSITION y, int light, POSITION x1, POSITION y1, POSITION x2, POSITION y2);
POSITION dist2(POSITION x1, POSITION y1, POSITION x2, POSITION y2, POSITION h1, POSITION h2, POSITION h3, POSITION h4);
-void fill_treasure(player_type *player_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty);
void build_recursive_room(player_type *player_ptr, POSITION x1, POSITION y1, POSITION x2, POSITION y2, int power);
void build_room(player_type *player_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2);
void r_visit(player_type *player_ptr, POSITION y1, POSITION x1, POSITION y2, POSITION x2, int node, DIRECTION dir, int *visited);
--- /dev/null
+/*!
+ * @brief 部屋にアイテム・モンスター・罠を配置する処理
+ * @date 2020/07/24
+ * @author Hourier
+ */
+
+#include "room/treasure-deployment.h"
+#include "floor/cave.h"
+#include "floor/floor.h"
+#include "grid/feature-flag-types.h"
+#include "grid/grid.h"
+#include "grid/trap.h"
+#include "monster-floor/monster-generator.h"
+#include "monster-floor/place-monster-types.h"
+#include "object-enchant/item-apply-magic.h"
+#include "system/floor-type-definition.h"
+
+/*
+ * Routine that fills the empty areas of a room with treasure and monsters.
+ */
+void fill_treasure(player_type *player_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty)
+{
+ POSITION cx = (x1 + x2) / 2;
+ POSITION cy = (y1 + y2) / 2;
+ POSITION size = abs(x2 - x1) + abs(y2 - y1);
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (POSITION x = x1; x <= x2; x++) {
+ for (POSITION y = y1; y <= y2; y++) {
+ s32b value = ((((s32b)(distance(cx, cy, x, y))) * 100) / size) + randint1(10) - difficulty;
+ if ((randint1(100) - difficulty * 3) > 50)
+ value = 20;
+
+ if (!is_floor_bold(floor_ptr, y, x) && (!cave_have_flag_bold(floor_ptr, y, x, FF_PLACE) || !cave_have_flag_bold(floor_ptr, y, x, FF_DROP)))
+ continue;
+
+ if (value < 0) {
+ floor_ptr->monster_level = floor_ptr->base_level + 40;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ floor_ptr->object_level = floor_ptr->base_level + 20;
+ place_object(player_ptr, y, x, AM_GOOD);
+ floor_ptr->object_level = floor_ptr->base_level;
+ } else if (value < 5) {
+ floor_ptr->monster_level = floor_ptr->base_level + 20;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ floor_ptr->object_level = floor_ptr->base_level + 10;
+ place_object(player_ptr, y, x, AM_GOOD);
+ floor_ptr->object_level = floor_ptr->base_level;
+ } else if (value < 10) {
+ floor_ptr->monster_level = floor_ptr->base_level + 9;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ } else if (value < 17) {
+ } else if (value < 23) {
+ if (randint0(100) < 25) {
+ place_object(player_ptr, y, x, 0L);
+ } else {
+ place_trap(player_ptr, y, x);
+ }
+ } else if (value < 30) {
+ floor_ptr->monster_level = floor_ptr->base_level + 5;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ place_trap(player_ptr, y, x);
+ } else if (value < 40) {
+ if (randint0(100) < 50) {
+ floor_ptr->monster_level = floor_ptr->base_level + 3;
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
+ floor_ptr->monster_level = floor_ptr->base_level;
+ }
+
+ if (randint0(100) < 50) {
+ floor_ptr->object_level = floor_ptr->base_level + 7;
+ place_object(player_ptr, y, x, 0L);
+ floor_ptr->object_level = floor_ptr->base_level;
+ }
+ } else if (value < 50) {
+ place_trap(player_ptr, y, x);
+ } else {
+ if (randint0(100) < 20) {
+ place_monster(player_ptr, y, x, PM_ALLOW_SLEEP | PM_ALLOW_GROUP);
+ } else if (randint0(100) < 50) {
+ place_trap(player_ptr, y, x);
+ } else if (randint0(100) < 50) {
+ place_object(player_ptr, y, x, 0L);
+ }
+ }
+ }
+ }
+}
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+void fill_treasure(player_type *player_ptr, POSITION x1, POSITION x2, POSITION y1, POSITION y2, int difficulty);