9 #include "objectkind.h"
10 #include "object-flavor.h"
11 #include "object-hook.h"
13 #include "cmd-basic.h"
16 #include "floor-events.h"
17 #include "floor-save.h"
18 #include "player-damage.h"
19 #include "player-effects.h"
20 #include "player-move.h"
22 #include "view-mainwindow.h"
24 #include "monster-status.h"
27 #include "spells-floor.h"
30 * Light up the dungeon using "clairvoyance"
32 * This function "illuminates" every grid in the dungeon, memorizes all
33 * "objects", memorizes all grids as with magic mapping, and, under the
34 * standard option settings (view_perma_grids but not view_torch_grids)
35 * memorizes all floor grids too.
37 * Note that if "view_perma_grids" is not set, we do not memorize floor
38 * grids, since this would defeat the purpose of "view_perma_grids", not
39 * that anyone seems to play without this option.
41 * Note that if "view_torch_grids" is set, we do not memorize floor grids,
42 * since this would prevent the use of "view_torch_grids" as a method to
43 * keep track of what grids have been observed directly.
45 void wiz_lite(bool ninja)
52 /* Memorize objects */
53 for (i = 1; i < current_floor_ptr->o_max; i++)
55 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
57 if (!OBJECT_IS_VALID(o_ptr)) continue;
58 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
61 o_ptr->marked |= OM_FOUND;
64 /* Scan all normal grids */
65 for (y = 1; y < current_floor_ptr->height - 1; y++)
67 /* Scan all normal grids */
68 for (x = 1; x < current_floor_ptr->width - 1; x++)
70 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
72 /* Memorize terrain of the grid */
73 g_ptr->info |= (CAVE_KNOWN);
75 /* Feature code (applying "mimic" field) */
76 feat = get_feat_mimic(g_ptr);
77 f_ptr = &f_info[feat];
79 /* Process all non-walls */
80 if (!have_flag(f_ptr->flags, FF_WALL))
82 /* Scan all neighbors */
83 for (i = 0; i < 9; i++)
85 POSITION yy = y + ddy_ddd[i];
86 POSITION xx = x + ddx_ddd[i];
87 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
89 /* Feature code (applying "mimic" field) */
90 f_ptr = &f_info[get_feat_mimic(g_ptr)];
92 /* Perma-lite the grid */
93 if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) && !ninja)
95 g_ptr->info |= (CAVE_GLOW);
98 /* Memorize normal features */
99 if (have_flag(f_ptr->flags, FF_REMEMBER))
101 /* Memorize the grid */
102 g_ptr->info |= (CAVE_MARK);
105 /* Perma-lit grids (newly and previously) */
106 else if (g_ptr->info & CAVE_GLOW)
108 /* Normally, memorize floors (see above) */
109 if (view_perma_grids && !view_torch_grids)
111 /* Memorize the grid */
112 g_ptr->info |= (CAVE_MARK);
120 p_ptr->update |= (PU_MONSTERS);
121 p_ptr->redraw |= (PR_MAP);
122 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
124 if (p_ptr->special_defense & NINJA_S_STEALTH)
126 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
132 * Forget the dungeon map (ala "Thinking of Maud...").
139 /* Forget every grid */
140 for (y = 1; y < current_floor_ptr->height - 1; y++)
142 for (x = 1; x < current_floor_ptr->width - 1; x++)
144 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
146 /* Process the grid */
147 g_ptr->info &= ~(CAVE_MARK | CAVE_IN_DETECT | CAVE_KNOWN);
148 g_ptr->info |= (CAVE_UNSAFE);
152 /* Forget every grid on horizontal edge */
153 for (x = 0; x < current_floor_ptr->width; x++)
155 current_floor_ptr->grid_array[0][x].info &= ~(CAVE_MARK);
156 current_floor_ptr->grid_array[current_floor_ptr->height - 1][x].info &= ~(CAVE_MARK);
159 /* Forget every grid on vertical edge */
160 for (y = 1; y < (current_floor_ptr->height - 1); y++)
162 current_floor_ptr->grid_array[y][0].info &= ~(CAVE_MARK);
163 current_floor_ptr->grid_array[y][current_floor_ptr->width - 1].info &= ~(CAVE_MARK);
166 /* Forget all objects */
167 for (i = 1; i < current_floor_ptr->o_max; i++)
169 object_type *o_ptr = ¤t_floor_ptr->o_list[i];
171 if (!OBJECT_IS_VALID(o_ptr)) continue;
172 if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
174 /* Forget the object */
175 o_ptr->marked &= OM_TOUCHED;
178 /* Forget travel route when we have forgotten map */
179 forget_travel_flow();
181 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
182 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MON_LITE);
183 p_ptr->update |= (PU_MONSTERS);
184 p_ptr->redraw |= (PR_MAP);
185 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
189 * @brief 守りのルーン設置処理 /
190 * Leave a "glyph of warding" which prevents monster movement
191 * @return 実際に設置が行われた場合TRUEを返す
193 bool warding_glyph(void)
195 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
197 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
202 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
203 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_glyph;
205 note_spot(p_ptr->y, p_ptr->x);
206 lite_spot(p_ptr->y, p_ptr->x);
213 * @brief 爆発のルーン設置処理 /
214 * Leave an "explosive rune" which prevents monster movement
215 * @return 実際に設置が行われた場合TRUEを返す
217 bool explosive_rune(void)
219 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
221 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
226 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
227 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_explosive_rune;
229 note_spot(p_ptr->y, p_ptr->x);
230 lite_spot(p_ptr->y, p_ptr->x);
237 * @return 実際に設置が行われた場合TRUEを返す
239 bool place_mirror(void)
241 if (!cave_clean_bold(p_ptr->y, p_ptr->x))
243 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
247 /* Create a mirror */
248 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_OBJECT;
249 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].mimic = feat_mirror;
251 /* Turn on the light */
252 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info |= CAVE_GLOW;
254 note_spot(p_ptr->y, p_ptr->x);
255 lite_spot(p_ptr->y, p_ptr->x);
256 update_local_illumination(p_ptr->y, p_ptr->x);
262 * @brief プレイヤーの手による能動的な階段生成処理 /
263 * Create stairs at or move previously created stairs into the player location.
266 void stair_creation(void)
268 saved_floor_type *sf_ptr;
269 saved_floor_type *dest_sf_ptr;
273 FLOOR_IDX dest_floor_id = 0;
276 /* Forbid up staircases on Ironman mode */
277 if (ironman_downward) up = FALSE;
279 /* Forbid down staircases on quest level */
280 if (quest_number(current_floor_ptr->dun_level) || (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth)) down = FALSE;
282 /* No effect out of standard dungeon floor */
283 if (!current_floor_ptr->dun_level || (!up && !down) ||
284 (p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) ||
285 p_ptr->inside_arena || p_ptr->phase_out)
288 msg_print(_("効果がありません!", "There is no effect!"));
292 /* Artifacts resists */
293 if (!cave_valid_bold(p_ptr->y, p_ptr->x))
295 msg_print(_("床上のアイテムが呪文を跳ね返した。", "The object resists the spell."));
299 /* Destroy all objects in the grid */
300 delete_object(p_ptr->y, p_ptr->x);
302 /* Extract current floor data */
303 sf_ptr = get_sf_ptr(p_ptr->floor_id);
306 /* No floor id? -- Create now! */
307 p_ptr->floor_id = get_new_floor_id();
308 sf_ptr = get_sf_ptr(p_ptr->floor_id);
311 /* Choose randomly */
314 if (randint0(100) < 50) up = FALSE;
318 /* Destination is already fixed */
321 if (sf_ptr->upper_floor_id) dest_floor_id = sf_ptr->upper_floor_id;
325 if (sf_ptr->lower_floor_id) dest_floor_id = sf_ptr->lower_floor_id;
329 /* Search old stairs leading to the destination */
334 for (y = 0; y < current_floor_ptr->height; y++)
336 for (x = 0; x < current_floor_ptr->width; x++)
338 grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
340 if (!g_ptr->special) continue;
341 if (feat_uses_special(g_ptr->feat)) continue;
342 if (g_ptr->special != dest_floor_id) continue;
344 /* Remove old stairs */
346 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
351 /* No old destination -- Get new one now */
354 dest_floor_id = get_new_floor_id();
358 sf_ptr->upper_floor_id = dest_floor_id;
360 sf_ptr->lower_floor_id = dest_floor_id;
363 /* Extract destination floor data */
364 dest_sf_ptr = get_sf_ptr(dest_floor_id);
367 /* Create a staircase */
370 cave_set_feat(p_ptr->y, p_ptr->x,
371 (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level <= current_floor_ptr->dun_level - 2)) ?
372 feat_state(feat_up_stair, FF_SHAFT) : feat_up_stair);
376 cave_set_feat(p_ptr->y, p_ptr->x,
377 (dest_sf_ptr->last_visit && (dest_sf_ptr->dun_level >= current_floor_ptr->dun_level + 2)) ?
378 feat_state(feat_down_stair, FF_SHAFT) : feat_down_stair);
382 /* Connect this stairs to the destination */
383 current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].special = dest_floor_id;
387 * Hack -- map the current panel (plus some) ala "magic mapping"
389 void map_area(POSITION range)
397 if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
400 for (y = 1; y < current_floor_ptr->height - 1; y++)
402 for (x = 1; x < current_floor_ptr->width - 1; x++)
404 if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
406 g_ptr = ¤t_floor_ptr->grid_array[y][x];
408 /* Memorize terrain of the grid */
409 g_ptr->info |= (CAVE_KNOWN);
411 /* Feature code (applying "mimic" field) */
412 feat = get_feat_mimic(g_ptr);
413 f_ptr = &f_info[feat];
415 /* All non-walls are "checked" */
416 if (!have_flag(f_ptr->flags, FF_WALL))
418 /* Memorize normal features */
419 if (have_flag(f_ptr->flags, FF_REMEMBER))
421 /* Memorize the object */
422 g_ptr->info |= (CAVE_MARK);
425 /* Memorize known walls */
426 for (i = 0; i < 8; i++)
428 g_ptr = ¤t_floor_ptr->grid_array[y + ddy_ddd[i]][x + ddx_ddd[i]];
430 /* Feature code (applying "mimic" field) */
431 feat = get_feat_mimic(g_ptr);
432 f_ptr = &f_info[feat];
434 /* Memorize walls (etc) */
435 if (have_flag(f_ptr->flags, FF_REMEMBER))
437 /* Memorize the walls */
438 g_ptr->info |= (CAVE_MARK);
445 p_ptr->redraw |= (PR_MAP);
446 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
452 * @brief *破壊*処理を行う / The spell of destruction
456 * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
457 * @return 効力があった場合TRUEを返す
460 * This spell "deletes" monsters (instead of "killing" them).
462 * Later we may use one function for both "destruction" and
463 * "earthquake" by using the "full" to select "destruction".
466 bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
473 /* Prevent destruction of quest levels and town */
474 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
479 /* Lose monster light */
480 if (!in_generate) clear_mon_lite();
482 /* Big area of affect */
483 for (y = (y1 - r); y <= (y1 + r); y++)
485 for (x = (x1 - r); x <= (x1 + r); x++)
487 if (!in_bounds(y, x)) continue;
489 /* Extract the distance */
490 k = distance(y1, x1, y, x);
492 /* Stay in the circle of death */
494 g_ptr = ¤t_floor_ptr->grid_array[y][x];
496 /* Lose room and vault */
497 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
499 /* Lose light and knowledge */
500 g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
502 if (!in_generate) /* Normal */
505 g_ptr->info &= ~(CAVE_UNSAFE);
507 /* Hack -- Notice player affect */
508 if (player_bold(y, x))
510 /* Hurt the player later */
513 /* Do not hurt this grid */
518 /* Hack -- Skip the epicenter */
519 if ((y == y1) && (x == x1)) continue;
523 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
524 monster_race *r_ptr = &r_info[m_ptr->r_idx];
526 if (in_generate) /* In generation */
528 /* Delete the monster (if any) */
529 delete_monster(y, x);
531 else if (r_ptr->flags1 & RF1_QUESTOR)
533 /* Heal the monster */
534 m_ptr->hp = m_ptr->maxhp;
536 /* Try to teleport away quest monsters */
537 if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
541 if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
543 GAME_TEXT m_name[MAX_NLEN];
545 monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
546 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
549 /* Delete the monster (if any) */
550 delete_monster(y, x);
554 /* During generation, destroyed artifacts are "preserved" */
555 if (preserve_mode || in_generate)
557 OBJECT_IDX this_o_idx, next_o_idx = 0;
559 /* Scan all objects in the grid */
560 for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
563 o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
564 next_o_idx = o_ptr->next_o_idx;
566 /* Hack -- Preserve unknown artifacts */
567 if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
569 /* Mega-Hack -- Preserve the artifact */
570 a_info[o_ptr->name1].cur_num = 0;
572 if (in_generate && cheat_peek)
574 GAME_TEXT o_name[MAX_NLEN];
575 object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
576 msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
579 else if (in_generate && cheat_peek && o_ptr->art_name)
581 msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
582 "One of the random artifacts was *destroyed* during generation."));
589 /* Destroy "non-permanent" grids */
590 if (!cave_perma_grid(g_ptr))
592 /* Wall (or floor) type */
595 if (!in_generate) /* Normal */
599 /* Create granite wall */
600 cave_set_feat(y, x, feat_granite);
604 /* Create quartz vein */
605 cave_set_feat(y, x, feat_quartz_vein);
609 /* Create magma vein */
610 cave_set_feat(y, x, feat_magma_vein);
615 cave_set_feat(y, x, feat_ground_type[randint0(100)]);
618 else /* In generation */
622 /* Create granite wall */
623 place_extra_grid(g_ptr);
627 /* Create quartz vein */
628 g_ptr->feat = feat_quartz_vein;
632 /* Create magma vein */
633 g_ptr->feat = feat_magma_vein;
638 place_floor_grid(g_ptr);
641 /* Clear garbage of hidden trap or door */
650 /* Process "re-glowing" */
651 for (y = (y1 - r); y <= (y1 + r); y++)
653 for (x = (x1 - r); x <= (x1 + r); x++)
655 if (!in_bounds(y, x)) continue;
657 /* Extract the distance */
658 k = distance(y1, x1, y, x);
660 /* Stay in the circle of death */
662 g_ptr = ¤t_floor_ptr->grid_array[y][x];
664 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
665 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
671 for (i = 0; i < 9; i++)
675 if (!in_bounds2(yy, xx)) continue;
676 cc_ptr = ¤t_floor_ptr->grid_array[yy][xx];
677 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
679 g_ptr->info |= CAVE_GLOW;
687 /* Hack -- Affect player */
690 msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
692 /* Blind the player */
693 if (!p_ptr->resist_blind && !p_ptr->resist_lite)
696 (void)set_blind(p_ptr, p_ptr->blind + 10 + randint1(10));
702 /* Mega-Hack -- Forget the view and lite */
703 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
704 p_ptr->redraw |= (PR_MAP);
705 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
707 if (p_ptr->special_defense & NINJA_S_STEALTH)
709 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
719 * @brief 地震処理(サブルーチン) /
720 * Induce an "earthquake" of the given radius at the given location.
721 * @return 効力があった場合TRUEを返す
725 * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
729 * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
731 * The player will take damage and "jump" into a safe grid if possible,
732 * otherwise, he will "tunnel" through the rubble instantaneously.
734 * Monsters will take damage, and "jump" into a safe grid if possible,
735 * otherwise they will be "buried" in the rubble, disappearing from
736 * the level in the same way that they do when genocided.
738 * Note that thus the player and monsters (except eaters of walls and
739 * passers through walls) will never occupy the same grid as a wall.
740 * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
741 * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
742 * This has allowed massive simplification of the "monster" code.
745 bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
749 POSITION y, x, yy, xx, dy, dx;
752 POSITION sy = 0, sx = 0;
757 /* Prevent destruction of quest levels and town */
758 if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
763 /* Paranoia -- Enforce maximum range */
766 /* Clear the "maximal blast" area */
767 for (y = 0; y < 32; y++)
769 for (x = 0; x < 32; x++)
775 /* Check around the epicenter */
776 for (dy = -r; dy <= r; dy++)
778 for (dx = -r; dx <= r; dx++)
783 if (!in_bounds(yy, xx)) continue;
785 /* Skip distant grids */
786 if (distance(cy, cx, yy, xx) > r) continue;
787 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
789 /* Lose room and vault / Lose light and knowledge */
790 g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
791 g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
793 /* Skip the epicenter */
794 if (!dx && !dy) continue;
796 /* Skip most grids */
797 if (randint0(100) < 85) continue;
799 /* Damage this grid */
800 map[16 + yy - cy][16 + xx - cx] = TRUE;
802 /* Hack -- Take note of player damage */
803 if (player_bold(yy, xx)) hurt = TRUE;
807 /* First, affect the player (if necessary) */
808 if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
810 /* Check around the player */
811 for (i = 0; i < 8; i++)
813 y = p_ptr->y + ddy_ddd[i];
814 x = p_ptr->x + ddx_ddd[i];
816 /* Skip non-empty grids */
817 if (!cave_empty_bold(y, x)) continue;
819 /* Important -- Skip "quake" grids */
820 if (map[16 + y - cy][16 + x - cx]) continue;
822 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
824 /* Count "safe" grids */
827 /* Randomize choice */
828 if (randint0(sn) > 0) continue;
830 /* Save the safe location */
839 msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
844 msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
849 msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
854 /* Hurt the player a lot */
857 /* Message and damage */
858 msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
862 /* Destroy the grid, and push the player to safety */
865 /* Calculate results */
870 msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
876 msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
877 damage = damroll(10, 4);
878 (void)set_stun(p_ptr, p_ptr->stun + randint1(50));
883 msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
884 damage = damroll(10, 4);
885 (void)set_stun(p_ptr, p_ptr->stun + randint1(50));
890 /* Move the player to the safe location */
891 (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
894 /* Important -- no wall on player */
895 map[16 + p_ptr->y - cy][16 + p_ptr->x - cx] = FALSE;
903 GAME_TEXT m_name[MAX_NLEN];
904 monster_type *m_ptr = ¤t_floor_ptr->m_list[m_idx];
905 monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
906 killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
910 killer = _("地震", "an earthquake");
913 take_hit(DAMAGE_ATTACK, damage, killer, -1);
917 /* Examine the quaked region */
918 for (dy = -r; dy <= r; dy++)
920 for (dx = -r; dx <= r; dx++)
925 /* Skip unaffected grids */
926 if (!map[16 + yy - cy][16 + xx - cx]) continue;
927 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
929 if (g_ptr->m_idx == p_ptr->riding) continue;
931 /* Process monsters */
934 monster_type *m_ptr = ¤t_floor_ptr->m_list[g_ptr->m_idx];
935 monster_race *r_ptr = &r_info[m_ptr->r_idx];
938 if (r_ptr->flags1 & RF1_QUESTOR)
940 /* No wall on quest monsters */
941 map[16 + yy - cy][16 + xx - cx] = FALSE;
946 /* Most monsters cannot co-exist with rock */
947 if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
948 !(r_ptr->flags2 & (RF2_PASS_WALL)))
950 GAME_TEXT m_name[MAX_NLEN];
952 /* Assume not safe */
955 /* Monster can move to escape the wall */
956 if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
958 /* Look for safety */
959 for (i = 0; i < 8; i++)
964 /* Skip non-empty grids */
965 if (!cave_empty_bold(y, x)) continue;
967 /* Hack -- no safety on glyph of warding */
968 if (is_glyph_grid(¤t_floor_ptr->grid_array[y][x])) continue;
969 if (is_explosive_rune_grid(¤t_floor_ptr->grid_array[y][x])) continue;
971 /* ... nor on the Pattern */
972 if (pattern_tile(y, x)) continue;
974 /* Important -- Skip "quake" grids */
975 if (map[16 + y - cy][16 + x - cx]) continue;
977 if (current_floor_ptr->grid_array[y][x].m_idx) continue;
978 if (player_bold(y, x)) continue;
980 /* Count "safe" grids */
983 /* Randomize choice */
984 if (randint0(sn) > 0) continue;
986 /* Save the safe grid */
991 monster_desc(m_name, m_ptr, 0);
994 if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
996 /* Take damage from the quake */
997 damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
999 /* Monster is certainly awake */
1000 (void)set_monster_csleep(g_ptr->m_idx, 0);
1002 /* Apply damage directly */
1003 m_ptr->hp -= damage;
1005 /* Delete (not kill) "dead" monsters */
1008 if (!ignore_unview || is_seen(m_ptr))
1009 msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1013 if (record_named_pet && is_pet(¤t_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
1015 char m2_name[MAX_NLEN];
1017 monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1018 do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1022 delete_monster(yy, xx);
1024 /* No longer safe */
1028 /* Hack -- Escape from the rock */
1031 IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1033 /* Update the old location */
1034 current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1036 /* Update the new location */
1037 current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1039 /* Move the monster */
1043 update_monster(m_idx, TRUE);
1052 /* Lose monster light */
1055 /* Examine the quaked region */
1056 for (dy = -r; dy <= r; dy++)
1058 for (dx = -r; dx <= r; dx++)
1063 /* Skip unaffected grids */
1064 if (!map[16 + yy - cy][16 + xx - cx]) continue;
1066 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1068 /* Paranoia -- never affect player */
1069 /* if (player_bold(yy, xx)) continue; */
1071 /* Destroy location (if valid) */
1072 if (cave_valid_bold(yy, xx))
1074 delete_object(yy, xx);
1076 /* Wall (or floor) type */
1077 t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
1082 /* Create granite wall */
1083 cave_set_feat(yy, xx, feat_granite);
1089 /* Create quartz vein */
1090 cave_set_feat(yy, xx, feat_quartz_vein);
1096 /* Create magma vein */
1097 cave_set_feat(yy, xx, feat_magma_vein);
1104 cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
1110 /* Process "re-glowing" */
1111 for (dy = -r; dy <= r; dy++)
1113 for (dx = -r; dx <= r; dx++)
1118 if (!in_bounds(yy, xx)) continue;
1120 /* Skip distant grids */
1121 if (distance(cy, cx, yy, xx) > r) continue;
1122 g_ptr = ¤t_floor_ptr->grid_array[yy][xx];
1124 if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1125 else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1131 for (ii = 0; ii < 9; ii++)
1133 yyy = yy + ddy_ddd[ii];
1134 xxx = xx + ddx_ddd[ii];
1135 if (!in_bounds2(yyy, xxx)) continue;
1136 cc_ptr = ¤t_floor_ptr->grid_array[yyy][xxx];
1137 if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1139 g_ptr->info |= CAVE_GLOW;
1147 /* Mega-Hack -- Forget the view and lite */
1148 p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1149 p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
1150 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1152 if (p_ptr->special_defense & NINJA_S_STEALTH)
1154 if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);