1 #include "system/angband.h"
4 #include "dungeon/dungeon.h"
5 #include "floor/floor.h"
9 #include "object/object-kind.h"
10 #include "object/object-flavor.h"
11 #include "object/object-hook.h"
13 #include "io/write-diary.h"
14 #include "cmd/cmd-basic.h"
15 #include "cmd/cmd-dump.h"
17 #include "floor/floor-events.h"
18 #include "floor/floor-save.h"
19 #include "player/player-damage.h"
20 #include "player/player-effects.h"
21 #include "player/player-move.h"
23 #include "view/display-main-window.h"
25 #include "monster/monster-status.h"
27 #include "spell/spells3.h"
28 #include "spell/spells-floor.h"
31 * Light up the dungeon using "clairvoyance"
33 * This function "illuminates" every grid in the dungeon, memorizes all
34 * "objects", memorizes all grids as with magic mapping, and, under the
35 * standard option settings (view_perma_grids but not view_torch_grids)
36 * memorizes all floor grids too.
38 * Note that if "view_perma_grids" is not set, we do not memorize floor
39 * grids, since this would defeat the purpose of "view_perma_grids", not
40 * that anyone seems to play without this option.
42 * Note that if "view_torch_grids" is set, we do not memorize floor grids,
43 * since this would prevent the use of "view_torch_grids" as a method to
44 * keep track of what grids have been observed directly.
46 void wiz_lite(player_type *caster_ptr, bool ninja)
48 /* Memorize objects */
49 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
51 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
52 if (!OBJECT_IS_VALID(o_ptr)) continue;
53 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
54 o_ptr->marked |= OM_FOUND;
57 /* Scan all normal grids */
58 for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
60 /* Scan all normal grids */
61 for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++)
63 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
65 /* Memorize terrain of the grid */
66 g_ptr->info |= (CAVE_KNOWN);
68 /* Feature code (applying "mimic" field) */
69 FEAT_IDX feat = get_feat_mimic(g_ptr);
71 f_ptr = &f_info[feat];
73 /* Process all non-walls */
74 if (have_flag(f_ptr->flags, FF_WALL)) continue;
76 /* Scan all neighbors */
77 for (OBJECT_IDX i = 0; i < 9; i++)
79 POSITION yy = y + ddy_ddd[i];
80 POSITION xx = x + ddx_ddd[i];
81 g_ptr = &caster_ptr->current_floor_ptr->grid_array[yy][xx];
83 /* Feature code (applying "mimic" field) */
84 f_ptr = &f_info[get_feat_mimic(g_ptr)];
86 /* Perma-lite the grid */
87 if (!(d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
89 g_ptr->info |= (CAVE_GLOW);
92 /* Memorize normal features */
93 if (have_flag(f_ptr->flags, FF_REMEMBER))
95 /* Memorize the grid */
96 g_ptr->info |= (CAVE_MARK);
99 /* Perma-lit grids (newly and previously) */
100 else if (g_ptr->info & CAVE_GLOW)
102 /* Normally, memorize floors (see above) */
103 if (view_perma_grids && !view_torch_grids)
105 /* Memorize the grid */
106 g_ptr->info |= (CAVE_MARK);
113 caster_ptr->update |= (PU_MONSTERS);
114 caster_ptr->redraw |= (PR_MAP);
115 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
117 if (caster_ptr->special_defense & NINJA_S_STEALTH)
119 if (caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);
125 * Forget the dungeon map (ala "Thinking of Maud...").
127 void wiz_dark(player_type *caster_ptr)
129 /* Forget every grid */
130 for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
132 for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++)
134 grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
136 /* Process the grid */
137 g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
138 g_ptr->info |= (CAVE_UNSAFE);
142 /* Forget every grid on horizontal edge */
143 for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
145 caster_ptr->current_floor_ptr->grid_array[0][x].info &= ~(CAVE_MARK);
146 caster_ptr->current_floor_ptr->grid_array[caster_ptr->current_floor_ptr->height - 1][x].info &= ~(CAVE_MARK);
149 /* Forget every grid on vertical edge */
150 for (POSITION y = 1; y < (caster_ptr->current_floor_ptr->height - 1); y++)
152 caster_ptr->current_floor_ptr->grid_array[y][0].info &= ~(CAVE_MARK);
153 caster_ptr->current_floor_ptr->grid_array[y][caster_ptr->current_floor_ptr->width - 1].info &= ~(CAVE_MARK);
156 /* Forget all objects */
157 for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
159 object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
161 if (!OBJECT_IS_VALID(o_ptr)) continue;
162 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
164 /* Forget the object */
165 o_ptr->marked &= OM_TOUCHED;
168 /* Forget travel route when we have forgotten map */
169 forget_travel_flow(caster_ptr->current_floor_ptr);
171 caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
172 caster_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
173 caster_ptr->update |= (PU_MONSTERS);
174 caster_ptr->redraw |= (PR_MAP);
175 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
180 * @brief 守りのルーン設置処理 /
181 * Leave a "glyph of warding" which prevents monster movement
182 * @return 実際に設置が行われた場合TRUEを返す
184 bool warding_glyph(player_type *caster_ptr)
186 if (!cave_clean_bold(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x))
188 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
193 caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info |= CAVE_OBJECT;
194 caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].mimic = feat_glyph;
196 note_spot(caster_ptr, caster_ptr->y, caster_ptr->x);
197 lite_spot(caster_ptr, caster_ptr->y, caster_ptr->x);
204 * @brief 爆発のルーン設置処理 /
205 * Leave an "explosive rune" which prevents monster movement
206 * @param caster_ptr プレーヤーへの参照ポインタ
209 * @return 実際に設置が行われた場合TRUEを返す
211 bool explosive_rune(player_type *caster_ptr, POSITION y, POSITION x)
213 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
214 if (!cave_clean_bold(floor_ptr, y, x))
216 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
221 floor_ptr->grid_array[y][x].info |= CAVE_OBJECT;
222 floor_ptr->grid_array[y][x].mimic = feat_explosive_rune;
224 note_spot(caster_ptr, y, x);
225 lite_spot(caster_ptr, y, x);
233 * @return 実際に設置が行われた場合TRUEを返す
235 bool place_mirror(player_type *caster_ptr)
237 if (!cave_clean_bold(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x))
239 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
243 /* Create a mirror */
244 caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info |= CAVE_OBJECT;
245 caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].mimic = feat_mirror;
247 /* Turn on the light */
248 caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info |= CAVE_GLOW;
250 note_spot(caster_ptr, caster_ptr->y, caster_ptr->x);
251 lite_spot(caster_ptr, caster_ptr->y, caster_ptr->x);
252 update_local_illumination(caster_ptr, caster_ptr->y, caster_ptr->x);
259 * @brief プレイヤーの手による能動的な階段生成処理 /
260 * Create stairs at or move previously created stairs into the player location.
263 void stair_creation(player_type *caster_ptr)
265 /* Forbid up staircases on Ironman mode */
267 if (ironman_downward) up = FALSE;
269 /* Forbid down staircases on quest level */
271 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
272 if (quest_number(caster_ptr, floor_ptr->dun_level) || (floor_ptr->dun_level >= d_info[caster_ptr->dungeon_idx].maxdepth)) down = FALSE;
274 /* No effect out of standard dungeon floor */
275 if (!floor_ptr->dun_level || (!up && !down) ||
276 (floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) ||
277 floor_ptr->inside_arena || caster_ptr->phase_out)
280 msg_print(_("効果がありません!", "There is no effect!"));
284 /* Artifacts resists */
285 if (!cave_valid_bold(floor_ptr, caster_ptr->y, caster_ptr->x))
287 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
291 /* Destroy all objects in the grid */
292 delete_object(caster_ptr, caster_ptr->y, caster_ptr->x);
294 /* Extract current floor data */
295 saved_floor_type *sf_ptr;
296 sf_ptr = get_sf_ptr(caster_ptr->floor_id);
299 /* No floor id? -- Create now! */
300 caster_ptr->floor_id = get_new_floor_id(caster_ptr);
301 sf_ptr = get_sf_ptr(caster_ptr->floor_id);
304 /* Choose randomly */
307 if (randint0(100) < 50) up = FALSE;
311 /* Destination is already fixed */
312 FLOOR_IDX dest_floor_id = 0;
315 if (sf_ptr->upper_floor_id) dest_floor_id = sf_ptr->upper_floor_id;
319 if (sf_ptr->lower_floor_id) dest_floor_id = sf_ptr->lower_floor_id;
322 /* Search old stairs leading to the destination */
327 for (y = 0; y < floor_ptr->height; y++)
329 for (x = 0; x < floor_ptr->width; x++)
331 grid_type *g_ptr = &floor_ptr->grid_array[y][x];
333 if (!g_ptr->special) continue;
334 if (feat_uses_special(g_ptr->feat)) continue;
335 if (g_ptr->special != dest_floor_id) continue;
337 /* Remove old stairs */
339 cave_set_feat(caster_ptr, y, x, feat_ground_type[randint0(100)]);
344 /* No old destination -- Get new one now */
347 dest_floor_id = get_new_floor_id(caster_ptr);
351 sf_ptr->upper_floor_id = dest_floor_id;
353 sf_ptr->lower_floor_id = dest_floor_id;
356 /* Extract destination floor data */
357 saved_floor_type *dest_sf_ptr;
358 dest_sf_ptr = get_sf_ptr(dest_floor_id);
360 /* Create a staircase */
363 cave_set_feat(caster_ptr, caster_ptr->y, caster_ptr->x,
364 (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= floor_ptr->dun_level - 2)) ?
365 feat_state(caster_ptr, feat_up_stair, FF_SHAFT) : feat_up_stair);
369 cave_set_feat(caster_ptr, caster_ptr->y, caster_ptr->x,
370 (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= floor_ptr->dun_level + 2)) ?
371 feat_state(caster_ptr, feat_down_stair, FF_SHAFT) : feat_down_stair);
374 /* Connect this stairs to the destination */
375 floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].special = dest_floor_id;
379 * Hack -- map the current panel (plus some) ala "magic mapping"
381 void map_area(player_type *caster_ptr, POSITION range)
383 if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
386 for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
388 for (POSITION x = 1; x < caster_ptr->current_floor_ptr->width - 1; x++)
390 if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
393 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
395 /* Memorize terrain of the grid */
396 g_ptr->info |= (CAVE_KNOWN);
398 /* Feature code (applying "mimic" field) */
399 FEAT_IDX feat = get_feat_mimic(g_ptr);
401 f_ptr = &f_info[feat];
403 /* All non-walls are "checked" */
404 if (have_flag(f_ptr->flags, FF_WALL)) continue;
406 /* Memorize normal features */
407 if (have_flag(f_ptr->flags, FF_REMEMBER))
409 /* Memorize the object */
410 g_ptr->info |= (CAVE_MARK);
413 /* Memorize known walls */
414 for (int i = 0; i < 8; i++)
416 g_ptr = &caster_ptr->current_floor_ptr->grid_array[y + ddy_ddd[i]][x + ddx_ddd[i]];
418 /* Feature code (applying "mimic" field) */
419 feat = get_feat_mimic(g_ptr);
420 f_ptr = &f_info[feat];
422 /* Memorize walls (etc) */
423 if (have_flag(f_ptr->flags, FF_REMEMBER))
425 /* Memorize the walls */
426 g_ptr->info |= (CAVE_MARK);
432 caster_ptr->redraw |= (PR_MAP);
433 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
439 * @brief *破壊*処理を行う / The spell of destruction
443 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
444 * @return 効力があった場合TRUEを返す
447 * This spell "deletes" monsters (instead of "killing" them).
449 * Later we may use one function for both "destruction" and
450 * "earthquake" by using the "full" to select "destruction".
453 bool destroy_area(player_type *caster_ptr, POSITION y1, POSITION x1, POSITION r, bool in_generate)
455 /* Prevent destruction of quest levels and town */
456 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
457 if ((floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) || !floor_ptr->dun_level)
462 /* Lose monster light */
463 if (!in_generate) clear_mon_lite(floor_ptr);
465 /* Big area of affect */
467 for (POSITION y = (y1 - r); y <= (y1 + r); y++)
469 for (POSITION x = (x1 - r); x <= (x1 + r); x++)
471 if (!in_bounds(floor_ptr, y, x)) continue;
473 /* Extract the distance */
474 int k = distance(y1, x1, y, x);
476 /* Stay in the circle of death */
479 g_ptr = &floor_ptr->grid_array[y][x];
481 /* Lose room and vault */
482 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
484 /* Lose light and knowledge */
485 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
487 if (!in_generate) /* Normal */
490 g_ptr->info &= ~(CAVE_UNSAFE);
492 /* Hack -- Notice player affect */
493 if (player_bold(caster_ptr, y, x))
495 /* Hurt the player later */
498 /* Do not hurt this grid */
503 /* Hack -- Skip the epicenter */
504 if ((y == y1) && (x == x1)) continue;
508 monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
509 monster_race *r_ptr = &r_info[m_ptr->r_idx];
511 if (in_generate) /* In generation */
513 /* Delete the monster (if any) */
514 delete_monster(caster_ptr, y, x);
516 else if (r_ptr->flags1 & RF1_QUESTOR)
518 /* Heal the monster */
519 m_ptr->hp = m_ptr->maxhp;
521 /* Try to teleport away quest monsters */
522 if (!teleport_away(caster_ptr, g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
526 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
528 GAME_TEXT m_name[MAX_NLEN];
530 monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
531 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
534 /* Delete the monster (if any) */
535 delete_monster(caster_ptr, y, x);
539 /* During generation, destroyed artifacts are "preserved" */
540 if (preserve_mode || in_generate)
542 OBJECT_IDX this_o_idx, next_o_idx = 0;
544 /* Scan all objects in the grid */
545 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
548 o_ptr = &floor_ptr->o_list[this_o_idx];
549 next_o_idx = o_ptr->next_o_idx;
551 /* Hack -- Preserve unknown artifacts */
552 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
554 /* Mega-Hack -- Preserve the artifact */
555 a_info[o_ptr->name1].cur_num = 0;
557 if (in_generate && cheat_peek)
559 GAME_TEXT o_name[MAX_NLEN];
560 object_desc(caster_ptr, o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
561 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
564 else if (in_generate && cheat_peek && o_ptr->art_name)
566 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
567 "One of the random artifacts was *destroyed* during generation."));
572 delete_object(caster_ptr, y, x);
574 /* Destroy "non-permanent" grids */
575 if (cave_perma_grid(g_ptr)) continue;
577 /* Wall (or floor) type */
578 int t = randint0(200);
580 if (!in_generate) /* Normal */
584 /* Create granite wall */
585 cave_set_feat(caster_ptr, y, x, feat_granite);
589 /* Create quartz vein */
590 cave_set_feat(caster_ptr, y, x, feat_quartz_vein);
594 /* Create magma vein */
595 cave_set_feat(caster_ptr, y, x, feat_magma_vein);
600 cave_set_feat(caster_ptr, y, x, feat_ground_type[randint0(100)]);
608 /* Create granite wall */
609 place_grid(caster_ptr, g_ptr, GB_EXTRA);
613 /* Create quartz vein */
614 g_ptr->feat = feat_quartz_vein;
618 /* Create magma vein */
619 g_ptr->feat = feat_magma_vein;
624 place_grid(caster_ptr, g_ptr, GB_FLOOR);
627 /* Clear garbage of hidden trap or door */
632 if (in_generate) return TRUE;
634 /* Process "re-glowing" */
635 for (POSITION y = (y1 - r); y <= (y1 + r); y++)
637 for (POSITION x = (x1 - r); x <= (x1 + r); x++)
639 if (!in_bounds(floor_ptr, y, x)) continue;
641 /* Extract the distance */
642 int k = distance(y1, x1, y, x);
644 /* Stay in the circle of death */
647 g_ptr = &floor_ptr->grid_array[y][x];
649 if (is_mirror_grid(g_ptr))
651 g_ptr->info |= CAVE_GLOW;
655 if ((d_info[floor_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) continue;
661 for (i = 0; i < 9; i++)
665 if (!in_bounds2(floor_ptr, yy, xx)) continue;
666 cc_ptr = &floor_ptr->grid_array[yy][xx];
667 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
669 g_ptr->info |= CAVE_GLOW;
676 /* Hack -- Affect player */
679 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
681 /* Blind the player */
682 if (!caster_ptr->resist_blind && !caster_ptr->resist_lite)
685 (void)set_blind(caster_ptr, caster_ptr->blind + 10 + randint1(10));
689 forget_flow(floor_ptr);
691 /* Mega-Hack -- Forget the view and lite */
692 caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
693 caster_ptr->redraw |= (PR_MAP);
694 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
696 if (caster_ptr->special_defense & NINJA_S_STEALTH)
698 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);
706 * @brief 地震処理(サブルーチン) /
707 * Induce an "earthquake" of the given radius at the given location.
708 * @param caster_ptrプレーヤーへの参照ポインタ
712 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
713 * @return 効力があった場合TRUEを返す
717 * This will turn some walls into floors and some floors into walls.
719 * The player will take damage and "jump" into a safe grid if possible,
720 * otherwise, he will "tunnel" through the rubble instantaneously.
722 * Monsters will take damage, and "jump" into a safe grid if possible,
723 * otherwise they will be "buried" in the rubble, disappearing from
724 * the level in the same way that they do when genocided.
726 * Note that thus the player and monsters (except eaters of walls and
727 * passers through walls) will never occupy the same grid as a wall.
728 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
729 * for a single turn, unless that monster can pass_walls or kill_walls.
730 * This has allowed massive simplification of the "monster" code.
733 bool earthquake(player_type *caster_ptr, POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
735 /* Prevent destruction of quest levels and town */
736 floor_type *floor_ptr = caster_ptr->current_floor_ptr;
737 if ((floor_ptr->inside_quest && is_fixed_quest_idx(floor_ptr->inside_quest)) || !floor_ptr->dun_level)
742 /* Paranoia -- Enforce maximum range */
745 /* Clear the "maximal blast" area */
748 for (y = 0; y < 32; y++)
750 for (x = 0; x < 32; x++)
756 /* Check around the epicenter */
757 POSITION yy, xx, dy, dx;
760 for (dy = -r; dy <= r; dy++)
762 for (dx = -r; dx <= r; dx++)
767 if (!in_bounds(floor_ptr, yy, xx)) continue;
769 /* Skip distant grids */
770 if (distance(cy, cx, yy, xx) > r) continue;
772 g_ptr = &floor_ptr->grid_array[yy][xx];
774 /* Lose room and vault / Lose light and knowledge */
775 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
776 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
778 /* Skip the epicenter */
779 if (!dx && !dy) continue;
781 /* Skip most grids */
782 if (randint0(100) < 85) continue;
784 /* Damage this grid */
785 map[16 + yy - cy][16 + xx - cx] = TRUE;
787 /* Hack -- Take note of player damage */
788 if (player_bold(caster_ptr, yy, xx)) hurt = TRUE;
792 /* First, affect the player (if necessary) */
794 POSITION sy = 0, sx = 0;
795 if (hurt && !caster_ptr->pass_wall && !caster_ptr->kill_wall)
797 /* Check around the player */
798 for (DIRECTION i = 0; i < 8; i++)
800 y = caster_ptr->y + ddy_ddd[i];
801 x = caster_ptr->x + ddx_ddd[i];
803 /* Skip non-empty grids */
804 if (!is_cave_empty_bold(caster_ptr, y, x)) continue;
806 /* Important -- Skip "quake" grids */
807 if (map[16 + y - cy][16 + x - cx]) continue;
809 if (floor_ptr->grid_array[y][x].m_idx) continue;
811 /* Count "safe" grids */
814 /* Randomize choice */
815 if (randint0(sn) > 0) continue;
817 /* Save the safe location */
826 msg_print(_("ダンジョンの壁が崩れた!", "The dungeon's ceiling collapses!"));
831 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The dungeon's floor twists in an unnatural way!"));
836 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The dungeon quakes! You are pummeled with debris!"));
841 /* Hurt the player a lot */
844 /* Message and damage */
845 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
849 /* Destroy the grid, and push the player to safety */
852 /* Calculate results */
857 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
863 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
864 damage = damroll(10, 4);
865 (void)set_stun(caster_ptr, caster_ptr->stun + randint1(50));
870 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
871 damage = damroll(10, 4);
872 (void)set_stun(caster_ptr, caster_ptr->stun + randint1(50));
877 /* Move the player to the safe location */
878 (void)move_player_effect(caster_ptr, sy, sx, MPE_DONT_PICKUP);
881 /* Important -- no wall on player */
882 map[16 + caster_ptr->y - cy][16 + caster_ptr->x - cx] = FALSE;
890 GAME_TEXT m_name[MAX_NLEN];
891 monster_type *m_ptr = &floor_ptr->m_list[m_idx];
892 monster_desc(caster_ptr, m_name, m_ptr, MD_WRONGDOER_NAME);
893 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
897 killer = _("地震", "an earthquake");
900 take_hit(caster_ptr, DAMAGE_ATTACK, damage, killer, -1);
904 /* Examine the quaked region */
905 for (dy = -r; dy <= r; dy++)
907 for (dx = -r; dx <= r; dx++)
912 /* Skip unaffected grids */
913 if (!map[16 + yy - cy][16 + xx - cx]) continue;
916 g_ptr = &floor_ptr->grid_array[yy][xx];
918 if (g_ptr->m_idx == caster_ptr->riding) continue;
920 /* Process monsters */
921 if (!g_ptr->m_idx) continue;
923 monster_type *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
924 monster_race *r_ptr = &r_info[m_ptr->r_idx];
927 if (r_ptr->flags1 & RF1_QUESTOR)
929 /* No wall on quest monsters */
930 map[16 + yy - cy][16 + xx - cx] = FALSE;
935 /* Most monsters cannot co-exist with rock */
936 if ((r_ptr->flags2 & RF2_KILL_WALL) || (r_ptr->flags2 & RF2_PASS_WALL)) continue;
938 GAME_TEXT m_name[MAX_NLEN];
940 /* Assume not safe */
943 /* Monster can move to escape the wall */
944 if (!(r_ptr->flags1 & RF1_NEVER_MOVE))
946 /* Look for safety */
947 for (DIRECTION i = 0; i < 8; i++)
952 /* Skip non-empty grids */
953 if (!is_cave_empty_bold(caster_ptr, y, x)) continue;
955 /* Hack -- no safety on glyph of warding */
956 if (is_glyph_grid(&floor_ptr->grid_array[y][x])) continue;
957 if (is_explosive_rune_grid(&floor_ptr->grid_array[y][x])) continue;
959 /* ... nor on the Pattern */
960 if (pattern_tile(floor_ptr, y, x)) continue;
962 /* Important -- Skip "quake" grids */
963 if (map[16 + y - cy][16 + x - cx]) continue;
965 if (floor_ptr->grid_array[y][x].m_idx) continue;
966 if (player_bold(caster_ptr, y, x)) continue;
968 /* Count "safe" grids */
971 /* Randomize choice */
972 if (randint0(sn) > 0) continue;
974 /* Save the safe grid */
979 monster_desc(caster_ptr, m_name, m_ptr, 0);
982 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
984 /* Take damage from the quake */
985 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
987 /* Monster is certainly awake */
988 (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
990 /* Apply damage directly */
993 /* Delete (not kill) "dead" monsters */
996 if (!ignore_unview || is_seen(m_ptr))
997 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1001 if (record_named_pet && is_pet(&floor_ptr->m_list[g_ptr->m_idx]) && floor_ptr->m_list[g_ptr->m_idx].nickname)
1003 char m2_name[MAX_NLEN];
1005 monster_desc(caster_ptr, m2_name, m_ptr, MD_INDEF_VISIBLE);
1006 exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1010 delete_monster(caster_ptr, yy, xx);
1015 /* Hack -- Escape from the rock */
1016 if (sn == 0) continue;
1018 IDX m_idx_aux = floor_ptr->grid_array[yy][xx].m_idx;
1020 /* Update the old location */
1021 floor_ptr->grid_array[yy][xx].m_idx = 0;
1023 /* Update the new location */
1024 floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1026 /* Move the monster */
1030 update_monster(caster_ptr, m_idx, TRUE);
1031 lite_spot(caster_ptr, yy, xx);
1032 lite_spot(caster_ptr, sy, sx);
1036 /* Lose monster light */
1037 clear_mon_lite(floor_ptr);
1039 /* Examine the quaked region */
1040 for (dy = -r; dy <= r; dy++)
1042 for (dx = -r; dx <= r; dx++)
1047 /* Skip unaffected grids */
1048 if (!map[16 + yy - cy][16 + xx - cx]) continue;
1050 /* Destroy location (if valid) */
1051 if (!cave_valid_bold(floor_ptr, yy, xx)) continue;
1053 delete_object(caster_ptr, yy, xx);
1055 /* Wall (or floor) type */
1056 int t = cave_have_flag_bold(floor_ptr, yy, xx, FF_PROJECT) ? randint0(100) : 200;
1058 /* Create granite wall */
1061 cave_set_feat(caster_ptr, yy, xx, feat_granite);
1065 /* Create quartz vein */
1068 cave_set_feat(caster_ptr, yy, xx, feat_quartz_vein);
1072 /* Create magma vein */
1075 cave_set_feat(caster_ptr, yy, xx, feat_magma_vein);
1080 cave_set_feat(caster_ptr, yy, xx, feat_ground_type[randint0(100)]);
1084 /* Process "re-glowing" */
1085 for (dy = -r; dy <= r; dy++)
1087 for (dx = -r; dx <= r; dx++)
1092 if (!in_bounds(floor_ptr, yy, xx)) continue;
1094 /* Skip distant grids */
1095 if (distance(cy, cx, yy, xx) > r) continue;
1097 g_ptr = &floor_ptr->grid_array[yy][xx];
1099 if (is_mirror_grid(g_ptr))
1101 g_ptr->info |= CAVE_GLOW;
1105 if ((d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)) continue;
1111 for (ii = 0; ii < 9; ii++)
1113 yyy = yy + ddy_ddd[ii];
1114 xxx = xx + ddx_ddd[ii];
1115 if (!in_bounds2(floor_ptr, yyy, xxx)) continue;
1116 cc_ptr = &floor_ptr->grid_array[yyy][xxx];
1117 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1119 g_ptr->info |= CAVE_GLOW;
1126 /* Mega-Hack -- Forget the view and lite */
1127 caster_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1128 caster_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
1129 caster_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1131 if (caster_ptr->special_defense & NINJA_S_STEALTH)
1133 if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);