1 #include "system/angband.h"
5 #include "floor/floor-generate.h"
6 #include "room/rooms.h"
7 #include "monster/monster.h"
8 #include "monster/monsterrace-hook.h"
9 #include "object/object-kind-hook.h"
10 #include "grid/feature.h"
11 #include "floor/floor.h"
12 #include "dungeon/dungeon.h"
16 * @brief タイプ15の部屋…ガラス部屋の生成 / Type 15 -- glass rooms
17 * @param player_ptr プレーヤーへの参照ポインタ
20 bool build_type15(player_type *player_ptr)
22 POSITION y, x, y2, x2, yval, xval;
23 POSITION y1, x1, xsize, ysize;
28 /* Pick a room size */
29 xsize = rand_range(9, 13);
30 ysize = rand_range(9, 13);
32 /* Find and reserve some space in the dungeon. Get center of room. */
33 floor_type *floor_ptr = player_ptr->current_floor_ptr;
34 if (!find_space(player_ptr, &yval, &xval, ysize + 2, xsize + 2)) return FALSE;
36 /* Choose lite or dark */
37 light = ((floor_ptr->dun_level <= randint1(25)) && !(d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS));
39 /* Get corner values */
40 y1 = yval - ysize / 2;
41 x1 = xval - xsize / 2;
42 y2 = yval + (ysize - 1) / 2;
43 x2 = xval + (xsize - 1) / 2;
45 /* Place a full floor under the room */
46 for (y = y1 - 1; y <= y2 + 1; y++)
48 for (x = x1 - 1; x <= x2 + 1; x++)
50 g_ptr = &floor_ptr->grid_array[y][x];
51 place_grid(player_ptr, g_ptr, GB_FLOOR);
52 g_ptr->feat = feat_glass_floor;
53 g_ptr->info |= (CAVE_ROOM);
54 if (light) g_ptr->info |= (CAVE_GLOW);
58 /* Walls around the room */
59 for (y = y1 - 1; y <= y2 + 1; y++)
61 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
62 place_grid(player_ptr, g_ptr, GB_OUTER);
63 g_ptr->feat = feat_glass_wall;
64 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
65 place_grid(player_ptr, g_ptr, GB_OUTER);
66 g_ptr->feat = feat_glass_wall;
69 for (x = x1 - 1; x <= x2 + 1; x++)
71 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
72 place_grid(player_ptr, g_ptr, GB_OUTER);
73 g_ptr->feat = feat_glass_wall;
74 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
75 place_grid(player_ptr, g_ptr, GB_OUTER);
76 g_ptr->feat = feat_glass_wall;
81 case 1: /* 4 lite breathers + potion */
84 get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
86 /* Place fixed lite berathers */
87 for (dir1 = 4; dir1 < 8; dir1++)
89 MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
91 y = yval + 2 * ddy_ddd[dir1];
92 x = xval + 2 * ddx_ddd[dir1];
93 if (r_idx) place_monster_aux(player_ptr, 0, y, x, r_idx, PM_ALLOW_SLEEP);
95 /* Walls around the breather */
96 for (dir2 = 0; dir2 < 8; dir2++)
98 g_ptr = &floor_ptr->grid_array[y + ddy_ddd[dir2]][x + ddx_ddd[dir2]];
99 place_grid(player_ptr, g_ptr, GB_INNER);
100 g_ptr->feat = feat_glass_wall;
104 /* Walls around the potion */
105 for (dir1 = 0; dir1 < 4; dir1++)
107 y = yval + 2 * ddy_ddd[dir1];
108 x = xval + 2 * ddx_ddd[dir1];
109 g_ptr = &floor_ptr->grid_array[y][x];
110 place_grid(player_ptr, g_ptr, GB_INNER_PERM);
111 g_ptr->feat = feat_permanent_glass_wall;
112 floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]].info |= (CAVE_ICKY);
117 y = yval + 2 * ddy_ddd[dir1];
118 x = xval + 2 * ddx_ddd[dir1];
119 place_secret_door(player_ptr, y, x, DOOR_GLASS_DOOR);
120 g_ptr = &floor_ptr->grid_array[y][x];
121 if (is_closed_door(player_ptr, g_ptr->feat)) g_ptr->mimic = feat_glass_wall;
124 get_obj_num_hook = kind_is_potion;
125 place_object(player_ptr, yval, xval, AM_NO_FIXED_ART);
126 floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY);
130 case 2: /* 1 lite breather + random object */
136 g_ptr = &floor_ptr->grid_array[y1 + 1][x1 + 1];
137 place_grid(player_ptr, g_ptr, GB_INNER);
138 g_ptr->feat = feat_glass_wall;
140 g_ptr = &floor_ptr->grid_array[y1 + 1][x2 - 1];
141 place_grid(player_ptr, g_ptr, GB_INNER);
142 g_ptr->feat = feat_glass_wall;
144 g_ptr = &floor_ptr->grid_array[y2 - 1][x1 + 1];
145 place_grid(player_ptr, g_ptr, GB_INNER);
146 g_ptr->feat = feat_glass_wall;
148 g_ptr = &floor_ptr->grid_array[y2 - 1][x2 - 1];
149 place_grid(player_ptr, g_ptr, GB_INNER);
150 g_ptr->feat = feat_glass_wall;
151 get_mon_num_prep(player_ptr, vault_aux_lite, NULL);
153 r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
154 if (r_idx) place_monster_aux(player_ptr, 0, yval, xval, r_idx, 0L);
156 /* Walls around the breather */
157 for (dir1 = 0; dir1 < 8; dir1++)
159 g_ptr = &floor_ptr->grid_array[yval + ddy_ddd[dir1]][xval + ddx_ddd[dir1]];
160 place_grid(player_ptr, g_ptr, GB_INNER);
161 g_ptr->feat = feat_glass_wall;
164 /* Curtains around the breather */
165 for (y = yval - 1; y <= yval + 1; y++)
167 place_secret_door(player_ptr, y, xval - 2, DOOR_CURTAIN);
168 place_secret_door(player_ptr, y, xval + 2, DOOR_CURTAIN);
171 for (x = xval - 1; x <= xval + 1; x++)
173 place_secret_door(player_ptr, yval - 2, x, DOOR_CURTAIN);
174 place_secret_door(player_ptr, yval + 2, x, DOOR_CURTAIN);
177 /* Place an object */
178 place_object(player_ptr, yval, xval, AM_NO_FIXED_ART);
179 floor_ptr->grid_array[yval][xval].info |= (CAVE_ICKY);
183 case 3: /* 4 shards breathers + 2 potions */
187 /* Walls around the potion */
188 for (y = yval - 2; y <= yval + 2; y++)
190 g_ptr = &floor_ptr->grid_array[y][xval - 3];
191 place_grid(player_ptr, g_ptr, GB_INNER);
192 g_ptr->feat = feat_glass_wall;
193 g_ptr = &floor_ptr->grid_array[y][xval + 3];
194 place_grid(player_ptr, g_ptr, GB_INNER);
195 g_ptr->feat = feat_glass_wall;
198 for (x = xval - 2; x <= xval + 2; x++)
200 g_ptr = &floor_ptr->grid_array[yval - 3][x];
201 place_grid(player_ptr, g_ptr, GB_INNER);
202 g_ptr->feat = feat_glass_wall;
203 g_ptr = &floor_ptr->grid_array[yval + 3][x];
204 place_grid(player_ptr, g_ptr, GB_INNER);
205 g_ptr->feat = feat_glass_wall;
208 for (dir1 = 4; dir1 < 8; dir1++)
210 g_ptr = &floor_ptr->grid_array[yval + 2 * ddy_ddd[dir1]][xval + 2 * ddx_ddd[dir1]];
211 place_grid(player_ptr, g_ptr, GB_INNER);
212 g_ptr->feat = feat_glass_wall;
215 get_mon_num_prep(player_ptr, vault_aux_shards, NULL);
217 /* Place shard berathers */
218 for (dir1 = 4; dir1 < 8; dir1++)
220 MONRACE_IDX r_idx = get_mon_num(player_ptr, floor_ptr->dun_level, 0);
222 y = yval + ddy_ddd[dir1];
223 x = xval + ddx_ddd[dir1];
224 if (r_idx) place_monster_aux(player_ptr, 0, y, x, r_idx, 0L);
227 /* Place two potions */
230 get_obj_num_hook = kind_is_potion;
231 place_object(player_ptr, yval, xval - 1, AM_NO_FIXED_ART);
232 get_obj_num_hook = kind_is_potion;
233 place_object(player_ptr, yval, xval + 1, AM_NO_FIXED_ART);
237 get_obj_num_hook = kind_is_potion;
238 place_object(player_ptr, yval - 1, xval, AM_NO_FIXED_ART);
239 get_obj_num_hook = kind_is_potion;
240 place_object(player_ptr, yval + 1, xval, AM_NO_FIXED_ART);
243 for (y = yval - 2; y <= yval + 2; y++)
244 for (x = xval - 2; x <= xval + 2; x++)
245 floor_ptr->grid_array[y][x].info |= (CAVE_ICKY);
251 msg_print_wizard(CHEAT_DUNGEON, _("ガラスの部屋が生成されました。", "Glass room was generated."));