1 #include "room/rooms-pit-nest.h"
2 #include "dungeon/dungeon.h"
3 #include "floor/floor-generator.h"
4 #include "game-option/cheat-options.h"
5 #include "game-option/cheat-types.h"
7 #include "grid/feature.h"
9 #include "monster-floor/monster-generator.h"
10 #include "monster-floor/place-monster-types.h"
11 #include "monster-race/monster-race-hook.h"
12 #include "monster-race/monster-race.h"
13 #include "monster-race/race-flags-resistance.h"
14 #include "monster-race/race-flags1.h"
15 #include "monster-race/race-flags2.h"
16 #include "monster-race/race-flags3.h"
17 #include "monster-race/race-flags4.h"
18 #include "monster-race/race-flags7.h"
19 #include "monster/monster-info.h"
20 #include "monster/monster-list.h"
21 #include "monster/monster-util.h"
22 #include "room/pit-nest-kinds-table.h"
23 #include "room/space-finder.h"
24 #include "system/floor-type-definition.h"
25 #include "util/sort.h"
26 #include "view/display-messages.h"
27 #include "wizard/wizard-messages.h"
30 * @brief ダンジョン毎に指定されたピット配列を基準にランダムなpit/nestタイプを決める
31 * @param l_ptr 選択されたpit/nest情報を返す参照ポインタ
32 * @param allow_flag_mask 生成が許されるpit/nestのビット配列
33 * @return 選択されたpit/nestのID、選択失敗した場合-1を返す。
35 static int pick_vault_type(floor_type *floor_ptr, vault_aux_type *l_ptr, BIT_FLAGS16 allow_flag_mask)
39 vault_aux_type *n_ptr;
40 for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++) {
44 if (n_ptr->level > floor_ptr->dun_level)
47 if (!(allow_flag_mask & (1L << count)))
50 total += n_ptr->chance * MAX_DEPTH / (MIN(floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);
53 int random_type = randint0(total);
54 for (n_ptr = l_ptr, total = 0, count = 0; TRUE; n_ptr++, count++) {
58 if (n_ptr->level > floor_ptr->dun_level)
61 if (!(allow_flag_mask & (1L << count)))
64 total += n_ptr->chance * MAX_DEPTH / (MIN(floor_ptr->dun_level, MAX_DEPTH - 1) - n_ptr->level + 5);
65 if (random_type < total)
69 return n_ptr->name ? count : -1;
73 * @brief デバッグ時に生成されたpit/nestの型を出力する処理
74 * @param type pit/nestの型ID
75 * @param nest TRUEならばnest、FALSEならばpit
76 * @return デバッグ表示文字列の参照ポインタ
78 * Hack -- Get the string describing subtype of pit/nest
79 * Determined in prepare function (some pit/nest only)
81 static concptr pit_subtype_string(int type, bool nest)
83 static char inner_buf[256] = "";
88 sprintf(inner_buf, "(%s)", r_name + r_info[vault_aux_race].name);
90 case NEST_TYPE_SYMBOL_GOOD:
91 case NEST_TYPE_SYMBOL_EVIL:
92 sprintf(inner_buf, "(%c)", vault_aux_char);
101 case PIT_TYPE_SYMBOL_GOOD:
102 case PIT_TYPE_SYMBOL_EVIL:
103 sprintf(inner_buf, "(%c)", vault_aux_char);
105 case PIT_TYPE_DRAGON:
106 switch (vault_aux_dragon_mask4) {
108 strcpy(inner_buf, _("(酸)", "(acid)"));
111 strcpy(inner_buf, _("(稲妻)", "(lightning)"));
114 strcpy(inner_buf, _("(火炎)", "(fire)"));
117 strcpy(inner_buf, _("(冷気)", "(frost)"));
120 strcpy(inner_buf, _("(毒)", "(poison)"));
122 case (RF4_BR_ACID | RF4_BR_ELEC | RF4_BR_FIRE | RF4_BR_COLD | RF4_BR_POIS):
123 strcpy(inner_buf, _("(万色)", "(multi-hued)"));
126 strcpy(inner_buf, _("(未定義)", "(undefined)"));
136 *! @brief nestのモンスターリストをソートするための関数 /
137 * Comp function for sorting nest monster information
138 * @param u ソート処理対象配列ポインタ
144 static bool ang_sort_comp_nest_mon_info(player_type *player_ptr, vptr u, vptr v, int a, int b)
150 nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;
151 MONSTER_IDX w1 = nest_mon_info[a].r_idx;
152 MONSTER_IDX w2 = nest_mon_info[b].r_idx;
153 monster_race *r1_ptr = &r_info[w1];
154 monster_race *r2_ptr = &r_info[w2];
155 int z1 = nest_mon_info[a].used;
156 int z2 = nest_mon_info[b].used;
163 if (r1_ptr->level < r2_ptr->level)
165 if (r1_ptr->level > r2_ptr->level)
168 if (r1_ptr->mexp < r2_ptr->mexp)
170 if (r1_ptr->mexp > r2_ptr->mexp)
177 * @brief nestのモンスターリストをスワップするための関数 /
178 * Swap function for sorting nest monster information
179 * @param u スワップ処理対象配列ポインタ
181 * @param a スワップ対象参照ID1
182 * @param b スワップ対象参照ID2
185 static void ang_sort_swap_nest_mon_info(player_type *player_ptr, vptr u, vptr v, int a, int b)
191 nest_mon_info_type *nest_mon_info = (nest_mon_info_type *)u;
192 nest_mon_info_type holder = nest_mon_info[a];
193 nest_mon_info[a] = nest_mon_info[b];
194 nest_mon_info[b] = holder;
198 * @brief タイプ5の部屋…nestを生成する / Type 5 -- Monster nests
199 * @param player_ptr プレーヤーへの参照ポインタ
202 * A monster nest is a "big" room, with an "inner" room, containing\n
203 * a "collection" of monsters of a given type strewn about the room.\n
205 * The monsters are chosen from a set of 64 randomly selected monster\n
206 * races, to allow the nest creation to fail instead of having "holes".\n
208 * Note the use of the "get_mon_num_prep()" function, and the special\n
209 * "get_mon_num_hook()" restriction function, to prepare the "monster\n
210 * allocation table" in such a way as to optimize the selection of\n
211 * "appropriate" non-unique monsters for the nest.\n
213 * Note that the "get_mon_num()" function may (rarely) fail, in which\n
214 * case the nest will be empty.\n
216 * Note that "monster nests" will never contain "unique" monsters.\n
218 bool build_type5(player_type *player_ptr, dun_data_type *dd_ptr)
220 POSITION y, x, y1, x1, y2, x2, xval, yval;
222 nest_mon_info_type nest_mon_info[NUM_NEST_MON_TYPE];
228 floor_type *floor_ptr = player_ptr->current_floor_ptr;
229 int cur_nest_type = pick_vault_type(floor_ptr, nest_types, d_info[floor_ptr->dungeon_idx].nest);
230 vault_aux_type *n_ptr;
232 /* No type available */
233 if (cur_nest_type < 0)
236 n_ptr = &nest_types[cur_nest_type];
238 /* Process a preparation function if necessary */
239 if (n_ptr->prep_func)
240 (*(n_ptr->prep_func))(player_ptr);
241 get_mon_num_prep(player_ptr, n_ptr->hook_func, NULL);
243 align.sub_align = SUB_ALIGN_NEUTRAL;
245 /* Pick some monster types */
246 for (i = 0; i < NUM_NEST_MON_TYPE; i++) {
247 MONRACE_IDX r_idx = 0;
249 monster_race *r_ptr = NULL;
252 /* Get a (hard) monster type */
253 r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level + 11, 0);
254 r_ptr = &r_info[r_idx];
256 /* Decline incorrect alignment */
257 if (monster_has_hostile_align(player_ptr, &align, 0, 0, r_ptr))
260 /* Accept this monster */
265 if (!r_idx || !attempts)
268 /* Note the alignment */
269 if (r_ptr->flags3 & RF3_EVIL)
270 align.sub_align |= SUB_ALIGN_EVIL;
271 if (r_ptr->flags3 & RF3_GOOD)
272 align.sub_align |= SUB_ALIGN_GOOD;
274 nest_mon_info[i].r_idx = (s16b)r_idx;
275 nest_mon_info[i].used = FALSE;
278 /* Find and reserve some space in the dungeon. Get center of room. */
279 if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
288 /* Place the floor area */
289 for (y = y1 - 1; y <= y2 + 1; y++) {
290 for (x = x1 - 1; x <= x2 + 1; x++) {
291 g_ptr = &floor_ptr->grid_array[y][x];
292 place_grid(player_ptr, g_ptr, GB_FLOOR);
293 g_ptr->info |= (CAVE_ROOM);
297 /* Place the outer walls */
298 for (y = y1 - 1; y <= y2 + 1; y++) {
299 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
300 place_grid(player_ptr, g_ptr, GB_OUTER);
301 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
302 place_grid(player_ptr, g_ptr, GB_OUTER);
304 for (x = x1 - 1; x <= x2 + 1; x++) {
305 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
306 place_grid(player_ptr, g_ptr, GB_OUTER);
307 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
308 place_grid(player_ptr, g_ptr, GB_OUTER);
311 /* Advance to the center room */
317 /* The inner walls */
318 for (y = y1 - 1; y <= y2 + 1; y++) {
319 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
320 place_grid(player_ptr, g_ptr, GB_INNER);
321 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
322 place_grid(player_ptr, g_ptr, GB_INNER);
325 for (x = x1 - 1; x <= x2 + 1; x++) {
326 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
327 place_grid(player_ptr, g_ptr, GB_INNER);
328 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
329 place_grid(player_ptr, g_ptr, GB_INNER);
331 for (y = y1; y <= y2; y++) {
332 for (x = x1; x <= x2; x++) {
333 add_cave_info(floor_ptr, y, x, CAVE_ICKY);
337 /* Place a secret door */
338 switch (randint1(4)) {
340 place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
343 place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
346 place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
349 place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
354 player_ptr, CHEAT_DUNGEON, _("モンスター部屋(nest)(%s%s)を生成します。", "Monster nest (%s%s)"), n_ptr->name, pit_subtype_string(cur_nest_type, TRUE));
356 /* Place some monsters */
357 for (y = yval - 2; y <= yval + 2; y++) {
358 for (x = xval - 9; x <= xval + 9; x++) {
361 i = randint0(NUM_NEST_MON_TYPE);
362 r_idx = nest_mon_info[i].r_idx;
364 /* Place that "random" monster (no groups) */
365 (void)place_monster_aux(player_ptr, 0, y, x, r_idx, 0L);
367 nest_mon_info[i].used = TRUE;
372 ang_sort(player_ptr, nest_mon_info, NULL, NUM_NEST_MON_TYPE, ang_sort_comp_nest_mon_info, ang_sort_swap_nest_mon_info);
374 /* Dump the entries (prevent multi-printing) */
375 for (i = 0; i < NUM_NEST_MON_TYPE; i++) {
376 if (!nest_mon_info[i].used)
378 for (; i < NUM_NEST_MON_TYPE - 1; i++) {
379 if (nest_mon_info[i].r_idx != nest_mon_info[i + 1].r_idx)
381 if (!nest_mon_info[i + 1].used)
385 msg_format_wizard(player_ptr, CHEAT_DUNGEON, "Nest構成モンスターNo.%d:%s", i, r_name + r_info[nest_mon_info[i].r_idx].name);
393 * @brief タイプ6の部屋…pitを生成する / Type 6 -- Monster pits
396 * A monster pit is a "big" room, with an "inner" room, containing\n
397 * a "collection" of monsters of a given type organized in the room.\n
399 * The inside room in a monster pit appears as shown below, where the\n
400 * actual monsters in each location depend on the type of the pit\n
402 * XXXXXXXXXXXXXXXXXXXXX\n
403 * X0000000000000000000X\n
404 * X0112233455543322110X\n
405 * X0112233467643322110X\n
406 * X0112233455543322110X\n
407 * X0000000000000000000X\n
408 * XXXXXXXXXXXXXXXXXXXXX\n
410 * Note that the monsters in the pit are now chosen by using "get_mon_num()"\n
411 * to request 16 "appropriate" monsters, sorting them by level, and using\n
412 * the "even" entries in this sorted list for the contents of the pit.\n
414 * Hack -- all of the "dragons" in a "dragon" pit must be the same "color",\n
415 * which is handled by requiring a specific "breath" attack for all of the\n
416 * dragons. This may include "multi-hued" breath. Note that "wyrms" may\n
417 * be present in many of the dragon pits, if they have the proper breath.\n
419 * Note the use of the "get_mon_num_prep()" function, and the special\n
420 * "get_mon_num_hook()" restriction function, to prepare the "monster\n
421 * allocation table" in such a way as to optimize the selection of\n
422 * "appropriate" non-unique monsters for the pit.\n
424 * Note that the "get_mon_num()" function may (rarely) fail, in which case\n
425 * the pit will be empty.\n
427 * Note that "monster pits" will never contain "unique" monsters.\n
429 bool build_type6(player_type *player_ptr, dun_data_type *dd_ptr)
431 POSITION y, x, y1, x1, y2, x2, xval, yval;
434 MONRACE_IDX what[16];
440 floor_type *floor_ptr = player_ptr->current_floor_ptr;
441 int cur_pit_type = pick_vault_type(floor_ptr, pit_types, d_info[floor_ptr->dungeon_idx].pit);
442 vault_aux_type *n_ptr;
444 /* No type available */
445 if (cur_pit_type < 0)
448 n_ptr = &pit_types[cur_pit_type];
450 /* Process a preparation function if necessary */
451 if (n_ptr->prep_func)
452 (*(n_ptr->prep_func))(player_ptr);
453 get_mon_num_prep(player_ptr, n_ptr->hook_func, NULL);
455 align.sub_align = SUB_ALIGN_NEUTRAL;
457 /* Pick some monster types */
458 for (i = 0; i < 16; i++) {
459 MONRACE_IDX r_idx = 0;
461 monster_race *r_ptr = NULL;
464 /* Get a (hard) monster type */
465 r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level + 11, 0);
466 r_ptr = &r_info[r_idx];
468 /* Decline incorrect alignment */
469 if (monster_has_hostile_align(player_ptr, &align, 0, 0, r_ptr))
472 /* Accept this monster */
477 if (!r_idx || !attempts)
480 /* Note the alignment */
481 if (r_ptr->flags3 & RF3_EVIL)
482 align.sub_align |= SUB_ALIGN_EVIL;
483 if (r_ptr->flags3 & RF3_GOOD)
484 align.sub_align |= SUB_ALIGN_GOOD;
489 /* Find and reserve some space in the dungeon. Get center of room. */
490 if (!find_space(player_ptr, dd_ptr, &yval, &xval, 11, 25))
499 /* Place the floor area */
500 for (y = y1 - 1; y <= y2 + 1; y++) {
501 for (x = x1 - 1; x <= x2 + 1; x++) {
502 g_ptr = &floor_ptr->grid_array[y][x];
503 place_grid(player_ptr, g_ptr, GB_FLOOR);
504 g_ptr->info |= (CAVE_ROOM);
508 /* Place the outer walls */
509 for (y = y1 - 1; y <= y2 + 1; y++) {
510 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
511 place_grid(player_ptr, g_ptr, GB_OUTER);
512 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
513 place_grid(player_ptr, g_ptr, GB_OUTER);
515 for (x = x1 - 1; x <= x2 + 1; x++) {
516 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
517 place_grid(player_ptr, g_ptr, GB_OUTER);
518 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
519 place_grid(player_ptr, g_ptr, GB_OUTER);
522 /* Advance to the center room */
528 /* The inner walls */
529 for (y = y1 - 1; y <= y2 + 1; y++) {
530 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
531 place_grid(player_ptr, g_ptr, GB_INNER);
532 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
533 place_grid(player_ptr, g_ptr, GB_INNER);
535 for (x = x1 - 1; x <= x2 + 1; x++) {
536 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
537 place_grid(player_ptr, g_ptr, GB_INNER);
538 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
539 place_grid(player_ptr, g_ptr, GB_INNER);
541 for (y = y1; y <= y2; y++) {
542 for (x = x1; x <= x2; x++) {
543 add_cave_info(floor_ptr, y, x, CAVE_ICKY);
547 /* Place a secret door */
548 switch (randint1(4)) {
550 place_secret_door(player_ptr, y1 - 1, xval, DOOR_DEFAULT);
553 place_secret_door(player_ptr, y2 + 1, xval, DOOR_DEFAULT);
556 place_secret_door(player_ptr, yval, x1 - 1, DOOR_DEFAULT);
559 place_secret_door(player_ptr, yval, x2 + 1, DOOR_DEFAULT);
563 /* Sort the entries */
564 for (i = 0; i < 16 - 1; i++) {
565 /* Sort the entries */
566 for (j = 0; j < 16 - 1; j++) {
570 int p1 = r_info[what[i1]].level;
571 int p2 = r_info[what[i2]].level;
575 MONRACE_IDX tmp = what[i1];
583 player_ptr, CHEAT_DUNGEON, _("モンスター部屋(pit)(%s%s)を生成します。", "Monster pit (%s%s)"), n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
585 /* Select the entries */
586 for (i = 0; i < 8; i++) {
587 /* Every other entry */
588 what[i] = what[i * 2];
589 msg_format_wizard(player_ptr, CHEAT_DUNGEON, _("Nest構成モンスター選択No.%d:%s", "Nest Monster Select No.%d:%s"), i, r_name + r_info[what[i]].name);
592 /* Top and bottom rows */
593 for (x = xval - 9; x <= xval + 9; x++) {
594 place_monster_aux(player_ptr, 0, yval - 2, x, what[0], PM_NO_KAGE);
595 place_monster_aux(player_ptr, 0, yval + 2, x, what[0], PM_NO_KAGE);
599 for (y = yval - 1; y <= yval + 1; y++) {
600 place_monster_aux(player_ptr, 0, y, xval - 9, what[0], PM_NO_KAGE);
601 place_monster_aux(player_ptr, 0, y, xval + 9, what[0], PM_NO_KAGE);
603 place_monster_aux(player_ptr, 0, y, xval - 8, what[1], PM_NO_KAGE);
604 place_monster_aux(player_ptr, 0, y, xval + 8, what[1], PM_NO_KAGE);
606 place_monster_aux(player_ptr, 0, y, xval - 7, what[1], PM_NO_KAGE);
607 place_monster_aux(player_ptr, 0, y, xval + 7, what[1], PM_NO_KAGE);
609 place_monster_aux(player_ptr, 0, y, xval - 6, what[2], PM_NO_KAGE);
610 place_monster_aux(player_ptr, 0, y, xval + 6, what[2], PM_NO_KAGE);
612 place_monster_aux(player_ptr, 0, y, xval - 5, what[2], PM_NO_KAGE);
613 place_monster_aux(player_ptr, 0, y, xval + 5, what[2], PM_NO_KAGE);
615 place_monster_aux(player_ptr, 0, y, xval - 4, what[3], PM_NO_KAGE);
616 place_monster_aux(player_ptr, 0, y, xval + 4, what[3], PM_NO_KAGE);
618 place_monster_aux(player_ptr, 0, y, xval - 3, what[3], PM_NO_KAGE);
619 place_monster_aux(player_ptr, 0, y, xval + 3, what[3], PM_NO_KAGE);
621 place_monster_aux(player_ptr, 0, y, xval - 2, what[4], PM_NO_KAGE);
622 place_monster_aux(player_ptr, 0, y, xval + 2, what[4], PM_NO_KAGE);
625 /* Above/Below the center monster */
626 for (x = xval - 1; x <= xval + 1; x++) {
627 place_monster_aux(player_ptr, 0, yval + 1, x, what[5], PM_NO_KAGE);
628 place_monster_aux(player_ptr, 0, yval - 1, x, what[5], PM_NO_KAGE);
631 /* Next to the center monster */
632 place_monster_aux(player_ptr, 0, yval, xval + 1, what[6], PM_NO_KAGE);
633 place_monster_aux(player_ptr, 0, yval, xval - 1, what[6], PM_NO_KAGE);
636 place_monster_aux(player_ptr, 0, yval, xval, what[7], PM_NO_KAGE);
642 * Helper function for "trapped monster pit"
644 static bool vault_aux_trapped_pit(player_type *player_ptr, MONRACE_IDX r_idx)
649 monster_race *r_ptr = &r_info[r_idx];
651 if (!vault_monster_okay(player_ptr, r_idx))
654 /* No wall passing monster */
655 if (r_ptr->flags2 & (RF2_PASS_WALL | RF2_KILL_WALL))
662 * @brief タイプ13の部屋…トラップpitの生成 / Type 13 -- Trapped monster pits
665 * A trapped monster pit is a "big" room with a straight corridor in\n
666 * which wall opening traps are placed, and with two "inner" rooms\n
667 * containing a "collection" of monsters of a given type organized in\n
670 * The trapped monster pit appears as shown below, where the actual\n
671 * monsters in each location depend on the type of the pit\n
673 * XXXXXXXXXXXXXXXXXXXXXXXXX\n
675 * XXXXXXXXXXXXXXXXXXXXXXX X\n
676 * XXXXX001123454321100XXX X\n
677 * XXX0012234567654322100X X\n
678 * XXXXXXXXXXXXXXXXXXXXXXX X\n
680 * X XXXXXXXXXXXXXXXXXXXXXXX\n
681 * X X0012234567654322100XXX\n
682 * X XXX001123454321100XXXXX\n
683 * X XXXXXXXXXXXXXXXXXXXXXXX\n
685 * XXXXXXXXXXXXXXXXXXXXXXXXX\n
687 * Note that the monsters in the pit are now chosen by using "get_mon_num()"\n
688 * to request 16 "appropriate" monsters, sorting them by level, and using\n
689 * the "even" entries in this sorted list for the contents of the pit.\n
691 * Hack -- all of the "dragons" in a "dragon" pit must be the same "color",\n
692 * which is handled by requiring a specific "breath" attack for all of the\n
693 * dragons. This may include "multi-hued" breath. Note that "wyrms" may\n
694 * be present in many of the dragon pits, if they have the proper breath.\n
696 * Note the use of the "get_mon_num_prep()" function, and the special\n
697 * "get_mon_num_hook()" restriction function, to prepare the "monster\n
698 * allocation table" in such a way as to optimize the selection of\n
699 * "appropriate" non-unique monsters for the pit.\n
701 * Note that the "get_mon_num()" function may (rarely) fail, in which case\n
702 * the pit will be empty.\n
704 * Note that "monster pits" will never contain "unique" monsters.\n
706 bool build_type13(player_type *player_ptr, dun_data_type *dd_ptr)
708 POSITION y, x, y1, x1, y2, x2, xval, yval;
711 MONRACE_IDX what[16];
717 floor_type *floor_ptr = player_ptr->current_floor_ptr;
718 int cur_pit_type = pick_vault_type(floor_ptr, pit_types, d_info[floor_ptr->dungeon_idx].pit);
719 vault_aux_type *n_ptr;
721 /* Only in Angband */
722 if (floor_ptr->dungeon_idx != DUNGEON_ANGBAND)
725 /* No type available */
726 if (cur_pit_type < 0)
729 n_ptr = &pit_types[cur_pit_type];
731 /* Process a preparation function if necessary */
732 if (n_ptr->prep_func)
733 (*(n_ptr->prep_func))(player_ptr);
734 get_mon_num_prep(player_ptr, n_ptr->hook_func, vault_aux_trapped_pit);
736 align.sub_align = SUB_ALIGN_NEUTRAL;
738 /* Pick some monster types */
739 for (i = 0; i < 16; i++) {
740 MONRACE_IDX r_idx = 0;
742 monster_race *r_ptr = NULL;
745 /* Get a (hard) monster type */
746 r_idx = get_mon_num(player_ptr, 0, floor_ptr->dun_level + 0, 0);
747 r_ptr = &r_info[r_idx];
749 /* Decline incorrect alignment */
750 if (monster_has_hostile_align(player_ptr, &align, 0, 0, r_ptr))
753 /* Accept this monster */
758 if (!r_idx || !attempts)
761 /* Note the alignment */
762 if (r_ptr->flags3 & RF3_EVIL)
763 align.sub_align |= SUB_ALIGN_EVIL;
764 if (r_ptr->flags3 & RF3_GOOD)
765 align.sub_align |= SUB_ALIGN_GOOD;
770 /* Find and reserve some space in the dungeon. Get center of room. */
771 if (!find_space(player_ptr, dd_ptr, &yval, &xval, 13, 25))
780 /* Fill with inner walls */
781 for (y = y1 - 1; y <= y2 + 1; y++) {
782 for (x = x1 - 1; x <= x2 + 1; x++) {
783 g_ptr = &floor_ptr->grid_array[y][x];
784 place_grid(player_ptr, g_ptr, GB_INNER);
785 g_ptr->info |= (CAVE_ROOM);
789 /* Place the floor area 1 */
790 for (x = x1 + 3; x <= x2 - 3; x++) {
791 g_ptr = &floor_ptr->grid_array[yval - 2][x];
792 place_grid(player_ptr, g_ptr, GB_FLOOR);
793 add_cave_info(floor_ptr, yval - 2, x, CAVE_ICKY);
795 g_ptr = &floor_ptr->grid_array[yval + 2][x];
796 place_grid(player_ptr, g_ptr, GB_FLOOR);
797 add_cave_info(floor_ptr, yval + 2, x, CAVE_ICKY);
800 /* Place the floor area 2 */
801 for (x = x1 + 5; x <= x2 - 5; x++) {
802 g_ptr = &floor_ptr->grid_array[yval - 3][x];
803 place_grid(player_ptr, g_ptr, GB_FLOOR);
804 add_cave_info(floor_ptr, yval - 3, x, CAVE_ICKY);
806 g_ptr = &floor_ptr->grid_array[yval + 3][x];
807 place_grid(player_ptr, g_ptr, GB_FLOOR);
808 add_cave_info(floor_ptr, yval + 3, x, CAVE_ICKY);
812 for (x = x1; x <= x2; x++) {
813 g_ptr = &floor_ptr->grid_array[yval][x];
814 place_grid(player_ptr, g_ptr, GB_FLOOR);
815 g_ptr = &floor_ptr->grid_array[y1][x];
816 place_grid(player_ptr, g_ptr, GB_FLOOR);
817 g_ptr = &floor_ptr->grid_array[y2][x];
818 place_grid(player_ptr, g_ptr, GB_FLOOR);
821 /* Place the outer walls */
822 for (y = y1 - 1; y <= y2 + 1; y++) {
823 g_ptr = &floor_ptr->grid_array[y][x1 - 1];
824 place_grid(player_ptr, g_ptr, GB_OUTER);
825 g_ptr = &floor_ptr->grid_array[y][x2 + 1];
826 place_grid(player_ptr, g_ptr, GB_OUTER);
828 for (x = x1 - 1; x <= x2 + 1; x++) {
829 g_ptr = &floor_ptr->grid_array[y1 - 1][x];
830 place_grid(player_ptr, g_ptr, GB_OUTER);
831 g_ptr = &floor_ptr->grid_array[y2 + 1][x];
832 place_grid(player_ptr, g_ptr, GB_OUTER);
835 /* Random corridor */
837 for (y = y1; y <= yval; y++) {
838 place_bold(player_ptr, y, x2, GB_FLOOR);
839 place_bold(player_ptr, y, x1 - 1, GB_SOLID);
841 for (y = yval; y <= y2 + 1; y++) {
842 place_bold(player_ptr, y, x1, GB_FLOOR);
843 place_bold(player_ptr, y, x2 + 1, GB_SOLID);
846 for (y = yval; y <= y2 + 1; y++) {
847 place_bold(player_ptr, y, x1, GB_FLOOR);
848 place_bold(player_ptr, y, x2 + 1, GB_SOLID);
850 for (y = y1; y <= yval; y++) {
851 place_bold(player_ptr, y, x2, GB_FLOOR);
852 place_bold(player_ptr, y, x1 - 1, GB_SOLID);
856 /* Place the wall open trap */
857 floor_ptr->grid_array[yval][xval].mimic = floor_ptr->grid_array[yval][xval].feat;
858 floor_ptr->grid_array[yval][xval].feat = feat_trap_open;
860 /* Sort the entries */
861 for (i = 0; i < 16 - 1; i++) {
862 /* Sort the entries */
863 for (j = 0; j < 16 - 1; j++) {
867 int p1 = r_info[what[i1]].level;
868 int p2 = r_info[what[i2]].level;
872 MONRACE_IDX tmp = what[i1];
880 player_ptr, CHEAT_DUNGEON, _("%s%sの罠ピットが生成されました。", "Trapped monster pit (%s%s)"), n_ptr->name, pit_subtype_string(cur_pit_type, FALSE));
882 /* Select the entries */
883 for (i = 0; i < 8; i++) {
884 /* Every other entry */
885 what[i] = what[i * 2];
888 msg_print(r_name + r_info[what[i]].name);
892 for (i = 0; placing[i][2] >= 0; i++) {
893 y = yval + placing[i][0];
894 x = xval + placing[i][1];
895 place_monster_aux(player_ptr, 0, y, x, what[placing[i][2]], PM_NO_KAGE);