• R/O
  • HTTP
  • SSH
  • HTTPS

hengband: Commit

変愚蛮怒のメインリポジトリです


Commit MetaInfo

Revision2124f2596bd0e4e227cbb57d5a7fd9cc36aa6ad3 (tree)
Time2019-06-14 01:50:58
Authordeskull <deskull@user...>
Commiterdeskull

Log Message

[Refactor] #37353 *破壊*と地震の処理を spells-floor.c/h へ移動.

Change Summary

Incremental Difference

--- a/src/floor-streams.c
+++ b/src/floor-streams.c
@@ -29,6 +29,7 @@
2929 #include "object-flavor.h"
3030 #include "object-hook.h"
3131 #include "spells.h"
32+#include "spells-floor.h"
3233
3334
3435 /*!
--- a/src/melee1.c
+++ b/src/melee1.c
@@ -43,6 +43,7 @@
4343 #include "player-personality.h"
4444 #include "view-mainwindow.h"
4545 #include "world.h"
46+#include "spells-floor.h"
4647
4748
4849 /*!
--- a/src/monster-process.c
+++ b/src/monster-process.c
@@ -21,6 +21,7 @@
2121 #include "creature.h"
2222 #include "melee.h"
2323 #include "spells.h"
24+#include "spells-floor.h"
2425 #include "spells-summon.h"
2526 #include "quest.h"
2627 #include "avatar.h"
--- a/src/mutation.c
+++ b/src/mutation.c
@@ -27,6 +27,7 @@
2727 #include "player-class.h"
2828 #include "player-damage.h"
2929 #include "spells-status.h"
30+#include "spells-floor.h"
3031 #include "object-hook.h"
3132 #include "spells.h"
3233 #include "cmd-basic.h"
--- a/src/patron.c
+++ b/src/patron.c
@@ -21,6 +21,7 @@
2121 #include "spells-summon.h"
2222 #include "spells-object.h"
2323 #include "spells-status.h"
24+#include "spells-floor.h"
2425 #include "floor.h"
2526
2627 #ifdef JP
--- a/src/player-move.h
+++ b/src/player-move.h
@@ -9,7 +9,17 @@
99 extern void disturb(bool stop_search, bool flush_output);
1010 extern void move_player(DIRECTION dir, bool do_pickup, bool break_trap);
1111 extern void run_step(DIRECTION dir);
12+
13+#define MPE_STAYING 0x00000001
14+#define MPE_FORGET_FLOW 0x00000002
15+#define MPE_HANDLE_STUFF 0x00000004
16+#define MPE_ENERGY_USE 0x00000008
17+#define MPE_DONT_PICKUP 0x00000010
18+#define MPE_DO_PICKUP 0x00000020
19+#define MPE_BREAK_TRAP 0x00000040
20+#define MPE_DONT_SWAP_MON 0x00000080
1221 extern bool move_player_effect(POSITION ny, POSITION nx, BIT_FLAGS mpe_mode);
22+
1323 extern void py_pickup_aux(OBJECT_IDX o_idx);
1424 extern bool pattern_seq(POSITION c_y, POSITION c_x, POSITION n_y, POSITION n_x);
1525 extern bool trap_can_be_ignored(FEAT_IDX feat);
@@ -32,19 +42,6 @@ extern void travel_step(void);
3242 #define PATTERN_TILE_TELEPORT 7
3343 #define PATTERN_TILE_WRECKED 8
3444
35-/*
36- * Bit flags for move_player_effect()
37- */
38-#define MPE_STAYING 0x00000001
39-#define MPE_FORGET_FLOW 0x00000002
40-#define MPE_HANDLE_STUFF 0x00000004
41-#define MPE_ENERGY_USE 0x00000008
42-#define MPE_DONT_PICKUP 0x00000010
43-#define MPE_DO_PICKUP 0x00000020
44-#define MPE_BREAK_TRAP 0x00000040
45-#define MPE_DONT_SWAP_MON 0x00000080
46-
47-
4845
4946 #ifdef TRAVEL
5047 /*
--- a/src/realm-chaos.c
+++ b/src/realm-chaos.c
@@ -6,6 +6,7 @@
66 #include "player-effects.h"
77 #include "spells-summon.h"
88 #include "spells-status.h"
9+#include "spells-floor.h"
910 #include "spells.h"
1011 #include "targeting.h"
1112 #include "view-mainwindow.h"
--- a/src/realm-crusade.c
+++ b/src/realm-crusade.c
@@ -7,6 +7,7 @@
77 #include "spells.h"
88 #include "spells-summon.h"
99 #include "spells-status.h"
10+#include "spells-floor.h"
1011 #include "player-class.h"
1112 #include "player-effects.h"
1213 #include "targeting.h"
--- a/src/realm-hissatsu.c
+++ b/src/realm-hissatsu.c
@@ -19,6 +19,7 @@
1919 #include "grid.h"
2020 #include "targeting.h"
2121 #include "view-mainwindow.h"
22+#include "spells-floor.h"
2223
2324 /*!
2425 * @brief 剣術の各処理を行う
--- a/src/spells-floor.c
+++ b/src/spells-floor.c
@@ -3,15 +3,28 @@
33
44 #include "dungeon.h"
55 #include "floor.h"
6-#include "spells-floor.h"
76 #include "grid.h"
87 #include "quest.h"
8+#include "artifact.h"
9+#include "objectkind.h"
10+#include "object-flavor.h"
11+#include "object-hook.h"
12+
913 #include "cmd-basic.h"
14+#include "cmd-dump.h"
15+
16+#include "floor-events.h"
1017 #include "floor-save.h"
18+#include "player-damage.h"
1119 #include "player-effects.h"
20+#include "player-move.h"
1221 #include "feature.h"
1322 #include "view-mainwindow.h"
14-#include "object-hook.h"
23+
24+#include "monster-status.h"
25+
26+#include "spells.h"
27+#include "spells-floor.h"
1528
1629 /*
1730 * Light up the dungeon using "clairvoyance"
@@ -219,7 +232,6 @@ bool explosive_rune(void)
219232 return TRUE;
220233 }
221234
222-
223235 /*!
224236 * @brief 鏡設置処理
225237 * @return 実際に設置が行われた場合TRUEを返す
@@ -433,3 +445,715 @@ void map_area(POSITION range)
433445 p_ptr->redraw |= (PR_MAP);
434446 p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
435447 }
448+
449+
450+
451+/*!
452+ * @brief *破壊*処理を行う / The spell of destruction
453+ * @param y1 破壊の中心Y座標
454+ * @param x1 破壊の中心X座標
455+ * @param r 破壊の半径
456+ * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
457+ * @return 効力があった場合TRUEを返す
458+ * @details
459+ * <pre>
460+ * This spell "deletes" monsters (instead of "killing" them).
461+ *
462+ * Later we may use one function for both "destruction" and
463+ * "earthquake" by using the "full" to select "destruction".
464+ * </pre>
465+ */
466+bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
467+{
468+ POSITION y, x;
469+ int k, t;
470+ grid_type *g_ptr;
471+ bool flag = FALSE;
472+
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)
475+ {
476+ return (FALSE);
477+ }
478+
479+ /* Lose monster light */
480+ if (!in_generate) clear_mon_lite();
481+
482+ /* Big area of affect */
483+ for (y = (y1 - r); y <= (y1 + r); y++)
484+ {
485+ for (x = (x1 - r); x <= (x1 + r); x++)
486+ {
487+ if (!in_bounds(y, x)) continue;
488+
489+ /* Extract the distance */
490+ k = distance(y1, x1, y, x);
491+
492+ /* Stay in the circle of death */
493+ if (k > r) continue;
494+ g_ptr = &current_floor_ptr->grid_array[y][x];
495+
496+ /* Lose room and vault */
497+ g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
498+
499+ /* Lose light and knowledge */
500+ g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
501+
502+ if (!in_generate) /* Normal */
503+ {
504+ /* Lose unsafety */
505+ g_ptr->info &= ~(CAVE_UNSAFE);
506+
507+ /* Hack -- Notice player affect */
508+ if (player_bold(y, x))
509+ {
510+ /* Hurt the player later */
511+ flag = TRUE;
512+
513+ /* Do not hurt this grid */
514+ continue;
515+ }
516+ }
517+
518+ /* Hack -- Skip the epicenter */
519+ if ((y == y1) && (x == x1)) continue;
520+
521+ if (g_ptr->m_idx)
522+ {
523+ monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
524+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
525+
526+ if (in_generate) /* In generation */
527+ {
528+ /* Delete the monster (if any) */
529+ delete_monster(y, x);
530+ }
531+ else if (r_ptr->flags1 & RF1_QUESTOR)
532+ {
533+ /* Heal the monster */
534+ m_ptr->hp = m_ptr->maxhp;
535+
536+ /* Try to teleport away quest monsters */
537+ if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
538+ }
539+ else
540+ {
541+ if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
542+ {
543+ GAME_TEXT m_name[MAX_NLEN];
544+
545+ monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
546+ do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
547+ }
548+
549+ /* Delete the monster (if any) */
550+ delete_monster(y, x);
551+ }
552+ }
553+
554+ /* During generation, destroyed artifacts are "preserved" */
555+ if (preserve_mode || in_generate)
556+ {
557+ OBJECT_IDX this_o_idx, next_o_idx = 0;
558+
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)
561+ {
562+ object_type *o_ptr;
563+ o_ptr = &current_floor_ptr->o_list[this_o_idx];
564+ next_o_idx = o_ptr->next_o_idx;
565+
566+ /* Hack -- Preserve unknown artifacts */
567+ if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
568+ {
569+ /* Mega-Hack -- Preserve the artifact */
570+ a_info[o_ptr->name1].cur_num = 0;
571+
572+ if (in_generate && cheat_peek)
573+ {
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);
577+ }
578+ }
579+ else if (in_generate && cheat_peek && o_ptr->art_name)
580+ {
581+ msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
582+ "One of the random artifacts was *destroyed* during generation."));
583+ }
584+ }
585+ }
586+
587+ delete_object(y, x);
588+
589+ /* Destroy "non-permanent" grids */
590+ if (!cave_perma_grid(g_ptr))
591+ {
592+ /* Wall (or floor) type */
593+ t = randint0(200);
594+
595+ if (!in_generate) /* Normal */
596+ {
597+ if (t < 20)
598+ {
599+ /* Create granite wall */
600+ cave_set_feat(y, x, feat_granite);
601+ }
602+ else if (t < 70)
603+ {
604+ /* Create quartz vein */
605+ cave_set_feat(y, x, feat_quartz_vein);
606+ }
607+ else if (t < 100)
608+ {
609+ /* Create magma vein */
610+ cave_set_feat(y, x, feat_magma_vein);
611+ }
612+ else
613+ {
614+ /* Create floor */
615+ cave_set_feat(y, x, feat_ground_type[randint0(100)]);
616+ }
617+ }
618+ else /* In generation */
619+ {
620+ if (t < 20)
621+ {
622+ /* Create granite wall */
623+ place_extra_grid(g_ptr);
624+ }
625+ else if (t < 70)
626+ {
627+ /* Create quartz vein */
628+ g_ptr->feat = feat_quartz_vein;
629+ }
630+ else if (t < 100)
631+ {
632+ /* Create magma vein */
633+ g_ptr->feat = feat_magma_vein;
634+ }
635+ else
636+ {
637+ /* Create floor */
638+ place_floor_grid(g_ptr);
639+ }
640+
641+ /* Clear garbage of hidden trap or door */
642+ g_ptr->mimic = 0;
643+ }
644+ }
645+ }
646+ }
647+
648+ if (!in_generate)
649+ {
650+ /* Process "re-glowing" */
651+ for (y = (y1 - r); y <= (y1 + r); y++)
652+ {
653+ for (x = (x1 - r); x <= (x1 + r); x++)
654+ {
655+ if (!in_bounds(y, x)) continue;
656+
657+ /* Extract the distance */
658+ k = distance(y1, x1, y, x);
659+
660+ /* Stay in the circle of death */
661+ if (k > r) continue;
662+ g_ptr = &current_floor_ptr->grid_array[y][x];
663+
664+ if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
665+ else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
666+ {
667+ DIRECTION i;
668+ POSITION yy, xx;
669+ grid_type *cc_ptr;
670+
671+ for (i = 0; i < 9; i++)
672+ {
673+ yy = y + ddy_ddd[i];
674+ xx = x + ddx_ddd[i];
675+ if (!in_bounds2(yy, xx)) continue;
676+ cc_ptr = &current_floor_ptr->grid_array[yy][xx];
677+ if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
678+ {
679+ g_ptr->info |= CAVE_GLOW;
680+ break;
681+ }
682+ }
683+ }
684+ }
685+ }
686+
687+ /* Hack -- Affect player */
688+ if (flag)
689+ {
690+ msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
691+
692+ /* Blind the player */
693+ if (!p_ptr->resist_blind && !p_ptr->resist_lite)
694+ {
695+ /* Become blind */
696+ (void)set_blind(p_ptr->blind + 10 + randint1(10));
697+ }
698+ }
699+
700+ forget_flow();
701+
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);
706+
707+ if (p_ptr->special_defense & NINJA_S_STEALTH)
708+ {
709+ if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
710+ }
711+ }
712+
713+ /* Success */
714+ return (TRUE);
715+}
716+
717+
718+/*!
719+ * @brief 地震処理(サブルーチン) /
720+ * Induce an "earthquake" of the given radius at the given location.
721+ * @return 効力があった場合TRUEを返す
722+ * @param cy 中心Y座標
723+ * @param cx 中心X座標
724+ * @param r 効果半径
725+ * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
726+ * @details
727+ * <pre>
728+ *
729+ * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
730+ *
731+ * The player will take damage and "jump" into a safe grid if possible,
732+ * otherwise, he will "tunnel" through the rubble instantaneously.
733+ *
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.
737+ *
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.
743+ * </pre>
744+ */
745+bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
746+{
747+ DIRECTION i;
748+ int t;
749+ POSITION y, x, yy, xx, dy, dx;
750+ int damage = 0;
751+ int sn = 0;
752+ POSITION sy = 0, sx = 0;
753+ bool hurt = FALSE;
754+ grid_type *g_ptr;
755+ bool map[32][32];
756+
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)
759+ {
760+ return (FALSE);
761+ }
762+
763+ /* Paranoia -- Enforce maximum range */
764+ if (r > 12) r = 12;
765+
766+ /* Clear the "maximal blast" area */
767+ for (y = 0; y < 32; y++)
768+ {
769+ for (x = 0; x < 32; x++)
770+ {
771+ map[y][x] = FALSE;
772+ }
773+ }
774+
775+ /* Check around the epicenter */
776+ for (dy = -r; dy <= r; dy++)
777+ {
778+ for (dx = -r; dx <= r; dx++)
779+ {
780+ yy = cy + dy;
781+ xx = cx + dx;
782+
783+ if (!in_bounds(yy, xx)) continue;
784+
785+ /* Skip distant grids */
786+ if (distance(cy, cx, yy, xx) > r) continue;
787+ g_ptr = &current_floor_ptr->grid_array[yy][xx];
788+
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);
792+
793+ /* Skip the epicenter */
794+ if (!dx && !dy) continue;
795+
796+ /* Skip most grids */
797+ if (randint0(100) < 85) continue;
798+
799+ /* Damage this grid */
800+ map[16 + yy - cy][16 + xx - cx] = TRUE;
801+
802+ /* Hack -- Take note of player damage */
803+ if (player_bold(yy, xx)) hurt = TRUE;
804+ }
805+ }
806+
807+ /* First, affect the player (if necessary) */
808+ if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
809+ {
810+ /* Check around the player */
811+ for (i = 0; i < 8; i++)
812+ {
813+ y = p_ptr->y + ddy_ddd[i];
814+ x = p_ptr->x + ddx_ddd[i];
815+
816+ /* Skip non-empty grids */
817+ if (!cave_empty_bold(y, x)) continue;
818+
819+ /* Important -- Skip "quake" grids */
820+ if (map[16 + y - cy][16 + x - cx]) continue;
821+
822+ if (current_floor_ptr->grid_array[y][x].m_idx) continue;
823+
824+ /* Count "safe" grids */
825+ sn++;
826+
827+ /* Randomize choice */
828+ if (randint0(sn) > 0) continue;
829+
830+ /* Save the safe location */
831+ sy = y; sx = x;
832+ }
833+
834+ /* Random message */
835+ switch (randint1(3))
836+ {
837+ case 1:
838+ {
839+ msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
840+ break;
841+ }
842+ case 2:
843+ {
844+ msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
845+ break;
846+ }
847+ default:
848+ {
849+ msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
850+ break;
851+ }
852+ }
853+
854+ /* Hurt the player a lot */
855+ if (!sn)
856+ {
857+ /* Message and damage */
858+ msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
859+ damage = 200;
860+ }
861+
862+ /* Destroy the grid, and push the player to safety */
863+ else
864+ {
865+ /* Calculate results */
866+ switch (randint1(3))
867+ {
868+ case 1:
869+ {
870+ msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
871+ damage = 0;
872+ break;
873+ }
874+ case 2:
875+ {
876+ msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
877+ damage = damroll(10, 4);
878+ (void)set_stun(p_ptr->stun + randint1(50));
879+ break;
880+ }
881+ case 3:
882+ {
883+ msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
884+ damage = damroll(10, 4);
885+ (void)set_stun(p_ptr->stun + randint1(50));
886+ break;
887+ }
888+ }
889+
890+ /* Move the player to the safe location */
891+ (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
892+ }
893+
894+ /* Important -- no wall on player */
895+ map[16 + p_ptr->y - cy][16 + p_ptr->x - cx] = FALSE;
896+
897+ if (damage)
898+ {
899+ concptr killer;
900+
901+ if (m_idx)
902+ {
903+ GAME_TEXT m_name[MAX_NLEN];
904+ monster_type *m_ptr = &current_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);
907+ }
908+ else
909+ {
910+ killer = _("地震", "an earthquake");
911+ }
912+
913+ take_hit(DAMAGE_ATTACK, damage, killer, -1);
914+ }
915+ }
916+
917+ /* Examine the quaked region */
918+ for (dy = -r; dy <= r; dy++)
919+ {
920+ for (dx = -r; dx <= r; dx++)
921+ {
922+ yy = cy + dy;
923+ xx = cx + dx;
924+
925+ /* Skip unaffected grids */
926+ if (!map[16 + yy - cy][16 + xx - cx]) continue;
927+ g_ptr = &current_floor_ptr->grid_array[yy][xx];
928+
929+ if (g_ptr->m_idx == p_ptr->riding) continue;
930+
931+ /* Process monsters */
932+ if (g_ptr->m_idx)
933+ {
934+ monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
935+ monster_race *r_ptr = &r_info[m_ptr->r_idx];
936+
937+ /* Quest monsters */
938+ if (r_ptr->flags1 & RF1_QUESTOR)
939+ {
940+ /* No wall on quest monsters */
941+ map[16 + yy - cy][16 + xx - cx] = FALSE;
942+
943+ continue;
944+ }
945+
946+ /* Most monsters cannot co-exist with rock */
947+ if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
948+ !(r_ptr->flags2 & (RF2_PASS_WALL)))
949+ {
950+ GAME_TEXT m_name[MAX_NLEN];
951+
952+ /* Assume not safe */
953+ sn = 0;
954+
955+ /* Monster can move to escape the wall */
956+ if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
957+ {
958+ /* Look for safety */
959+ for (i = 0; i < 8; i++)
960+ {
961+ y = yy + ddy_ddd[i];
962+ x = xx + ddx_ddd[i];
963+
964+ /* Skip non-empty grids */
965+ if (!cave_empty_bold(y, x)) continue;
966+
967+ /* Hack -- no safety on glyph of warding */
968+ if (is_glyph_grid(&current_floor_ptr->grid_array[y][x])) continue;
969+ if (is_explosive_rune_grid(&current_floor_ptr->grid_array[y][x])) continue;
970+
971+ /* ... nor on the Pattern */
972+ if (pattern_tile(y, x)) continue;
973+
974+ /* Important -- Skip "quake" grids */
975+ if (map[16 + y - cy][16 + x - cx]) continue;
976+
977+ if (current_floor_ptr->grid_array[y][x].m_idx) continue;
978+ if (player_bold(y, x)) continue;
979+
980+ /* Count "safe" grids */
981+ sn++;
982+
983+ /* Randomize choice */
984+ if (randint0(sn) > 0) continue;
985+
986+ /* Save the safe grid */
987+ sy = y; sx = x;
988+ }
989+ }
990+
991+ monster_desc(m_name, m_ptr, 0);
992+
993+ /* Scream in pain */
994+ if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
995+
996+ /* Take damage from the quake */
997+ damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
998+
999+ /* Monster is certainly awake */
1000+ (void)set_monster_csleep(g_ptr->m_idx, 0);
1001+
1002+ /* Apply damage directly */
1003+ m_ptr->hp -= damage;
1004+
1005+ /* Delete (not kill) "dead" monsters */
1006+ if (m_ptr->hp < 0)
1007+ {
1008+ if (!ignore_unview || is_seen(m_ptr))
1009+ msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1010+
1011+ if (g_ptr->m_idx)
1012+ {
1013+ if (record_named_pet && is_pet(&current_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
1014+ {
1015+ char m2_name[MAX_NLEN];
1016+
1017+ monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1018+ do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1019+ }
1020+ }
1021+
1022+ delete_monster(yy, xx);
1023+
1024+ /* No longer safe */
1025+ sn = 0;
1026+ }
1027+
1028+ /* Hack -- Escape from the rock */
1029+ if (sn)
1030+ {
1031+ IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1032+
1033+ /* Update the old location */
1034+ current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1035+
1036+ /* Update the new location */
1037+ current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1038+
1039+ /* Move the monster */
1040+ m_ptr->fy = sy;
1041+ m_ptr->fx = sx;
1042+
1043+ update_monster(m_idx, TRUE);
1044+ lite_spot(yy, xx);
1045+ lite_spot(sy, sx);
1046+ }
1047+ }
1048+ }
1049+ }
1050+ }
1051+
1052+ /* Lose monster light */
1053+ clear_mon_lite();
1054+
1055+ /* Examine the quaked region */
1056+ for (dy = -r; dy <= r; dy++)
1057+ {
1058+ for (dx = -r; dx <= r; dx++)
1059+ {
1060+ yy = cy + dy;
1061+ xx = cx + dx;
1062+
1063+ /* Skip unaffected grids */
1064+ if (!map[16 + yy - cy][16 + xx - cx]) continue;
1065+
1066+ g_ptr = &current_floor_ptr->grid_array[yy][xx];
1067+
1068+ /* Paranoia -- never affect player */
1069+/* if (player_bold(yy, xx)) continue; */
1070+
1071+ /* Destroy location (if valid) */
1072+ if (cave_valid_bold(yy, xx))
1073+ {
1074+ delete_object(yy, xx);
1075+
1076+ /* Wall (or floor) type */
1077+ t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
1078+
1079+ /* Granite */
1080+ if (t < 20)
1081+ {
1082+ /* Create granite wall */
1083+ cave_set_feat(yy, xx, feat_granite);
1084+ }
1085+
1086+ /* Quartz */
1087+ else if (t < 70)
1088+ {
1089+ /* Create quartz vein */
1090+ cave_set_feat(yy, xx, feat_quartz_vein);
1091+ }
1092+
1093+ /* Magma */
1094+ else if (t < 100)
1095+ {
1096+ /* Create magma vein */
1097+ cave_set_feat(yy, xx, feat_magma_vein);
1098+ }
1099+
1100+ /* Floor */
1101+ else
1102+ {
1103+ /* Create floor */
1104+ cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
1105+ }
1106+ }
1107+ }
1108+ }
1109+
1110+ /* Process "re-glowing" */
1111+ for (dy = -r; dy <= r; dy++)
1112+ {
1113+ for (dx = -r; dx <= r; dx++)
1114+ {
1115+ yy = cy + dy;
1116+ xx = cx + dx;
1117+
1118+ if (!in_bounds(yy, xx)) continue;
1119+
1120+ /* Skip distant grids */
1121+ if (distance(cy, cx, yy, xx) > r) continue;
1122+ g_ptr = &current_floor_ptr->grid_array[yy][xx];
1123+
1124+ if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1125+ else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1126+ {
1127+ DIRECTION ii;
1128+ POSITION yyy, xxx;
1129+ grid_type *cc_ptr;
1130+
1131+ for (ii = 0; ii < 9; ii++)
1132+ {
1133+ yyy = yy + ddy_ddd[ii];
1134+ xxx = xx + ddx_ddd[ii];
1135+ if (!in_bounds2(yyy, xxx)) continue;
1136+ cc_ptr = &current_floor_ptr->grid_array[yyy][xxx];
1137+ if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1138+ {
1139+ g_ptr->info |= CAVE_GLOW;
1140+ break;
1141+ }
1142+ }
1143+ }
1144+ }
1145+ }
1146+
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);
1151+
1152+ if (p_ptr->special_defense & NINJA_S_STEALTH)
1153+ {
1154+ if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1155+ }
1156+
1157+ /* Success */
1158+ return (TRUE);
1159+}
--- a/src/spells-floor.h
+++ b/src/spells-floor.h
@@ -7,3 +7,5 @@ extern bool explosive_rune(void);
77 extern bool place_mirror(void);
88 extern void stair_creation(void);
99 extern void map_area(POSITION range);
10+extern bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate);
11+extern bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx);
\ No newline at end of file
--- a/src/spells.h
+++ b/src/spells.h
@@ -192,8 +192,6 @@ extern bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
192192 extern bool unleash_mana_storm(player_type *creature_ptr, bool powerful);
193193 extern bool crusade(void);
194194 extern bool turn_undead(void);
195-extern bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate);
196-extern bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx);
197195 extern void lite_room(POSITION y1, POSITION x1);
198196 extern bool starlight(bool magic);
199197 extern void unlite_room(POSITION y1, POSITION x1);
--- a/src/spells2.c
+++ b/src/spells2.c
@@ -1361,718 +1361,6 @@ bool probing(void)
13611361 return (probe);
13621362 }
13631363
1364-
1365-
1366-/*!
1367- * @brief *破壊*処理を行う / The spell of destruction
1368- * @param y1 破壊の中心Y座標
1369- * @param x1 破壊の中心X座標
1370- * @param r 破壊の半径
1371- * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
1372- * @return 効力があった場合TRUEを返す
1373- * @details
1374- * <pre>
1375- * This spell "deletes" monsters (instead of "killing" them).
1376- *
1377- * Later we may use one function for both "destruction" and
1378- * "earthquake" by using the "full" to select "destruction".
1379- * </pre>
1380- */
1381-bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
1382-{
1383- POSITION y, x;
1384- int k, t;
1385- grid_type *g_ptr;
1386- bool flag = FALSE;
1387-
1388- /* Prevent destruction of quest levels and town */
1389- if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1390- {
1391- return (FALSE);
1392- }
1393-
1394- /* Lose monster light */
1395- if (!in_generate) clear_mon_lite();
1396-
1397- /* Big area of affect */
1398- for (y = (y1 - r); y <= (y1 + r); y++)
1399- {
1400- for (x = (x1 - r); x <= (x1 + r); x++)
1401- {
1402- if (!in_bounds(y, x)) continue;
1403-
1404- /* Extract the distance */
1405- k = distance(y1, x1, y, x);
1406-
1407- /* Stay in the circle of death */
1408- if (k > r) continue;
1409- g_ptr = &current_floor_ptr->grid_array[y][x];
1410-
1411- /* Lose room and vault */
1412- g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
1413-
1414- /* Lose light and knowledge */
1415- g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
1416-
1417- if (!in_generate) /* Normal */
1418- {
1419- /* Lose unsafety */
1420- g_ptr->info &= ~(CAVE_UNSAFE);
1421-
1422- /* Hack -- Notice player affect */
1423- if (player_bold(y, x))
1424- {
1425- /* Hurt the player later */
1426- flag = TRUE;
1427-
1428- /* Do not hurt this grid */
1429- continue;
1430- }
1431- }
1432-
1433- /* Hack -- Skip the epicenter */
1434- if ((y == y1) && (x == x1)) continue;
1435-
1436- if (g_ptr->m_idx)
1437- {
1438- monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
1439- monster_race *r_ptr = &r_info[m_ptr->r_idx];
1440-
1441- if (in_generate) /* In generation */
1442- {
1443- /* Delete the monster (if any) */
1444- delete_monster(y, x);
1445- }
1446- else if (r_ptr->flags1 & RF1_QUESTOR)
1447- {
1448- /* Heal the monster */
1449- m_ptr->hp = m_ptr->maxhp;
1450-
1451- /* Try to teleport away quest monsters */
1452- if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
1453- }
1454- else
1455- {
1456- if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
1457- {
1458- GAME_TEXT m_name[MAX_NLEN];
1459-
1460- monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
1461- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
1462- }
1463-
1464- /* Delete the monster (if any) */
1465- delete_monster(y, x);
1466- }
1467- }
1468-
1469- /* During generation, destroyed artifacts are "preserved" */
1470- if (preserve_mode || in_generate)
1471- {
1472- OBJECT_IDX this_o_idx, next_o_idx = 0;
1473-
1474- /* Scan all objects in the grid */
1475- for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
1476- {
1477- object_type *o_ptr;
1478- o_ptr = &current_floor_ptr->o_list[this_o_idx];
1479- next_o_idx = o_ptr->next_o_idx;
1480-
1481- /* Hack -- Preserve unknown artifacts */
1482- if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
1483- {
1484- /* Mega-Hack -- Preserve the artifact */
1485- a_info[o_ptr->name1].cur_num = 0;
1486-
1487- if (in_generate && cheat_peek)
1488- {
1489- GAME_TEXT o_name[MAX_NLEN];
1490- object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
1491- msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
1492- }
1493- }
1494- else if (in_generate && cheat_peek && o_ptr->art_name)
1495- {
1496- msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。",
1497- "One of the random artifacts was *destroyed* during generation."));
1498- }
1499- }
1500- }
1501-
1502- delete_object(y, x);
1503-
1504- /* Destroy "non-permanent" grids */
1505- if (!cave_perma_grid(g_ptr))
1506- {
1507- /* Wall (or floor) type */
1508- t = randint0(200);
1509-
1510- if (!in_generate) /* Normal */
1511- {
1512- if (t < 20)
1513- {
1514- /* Create granite wall */
1515- cave_set_feat(y, x, feat_granite);
1516- }
1517- else if (t < 70)
1518- {
1519- /* Create quartz vein */
1520- cave_set_feat(y, x, feat_quartz_vein);
1521- }
1522- else if (t < 100)
1523- {
1524- /* Create magma vein */
1525- cave_set_feat(y, x, feat_magma_vein);
1526- }
1527- else
1528- {
1529- /* Create floor */
1530- cave_set_feat(y, x, feat_ground_type[randint0(100)]);
1531- }
1532- }
1533- else /* In generation */
1534- {
1535- if (t < 20)
1536- {
1537- /* Create granite wall */
1538- place_extra_grid(g_ptr);
1539- }
1540- else if (t < 70)
1541- {
1542- /* Create quartz vein */
1543- g_ptr->feat = feat_quartz_vein;
1544- }
1545- else if (t < 100)
1546- {
1547- /* Create magma vein */
1548- g_ptr->feat = feat_magma_vein;
1549- }
1550- else
1551- {
1552- /* Create floor */
1553- place_floor_grid(g_ptr);
1554- }
1555-
1556- /* Clear garbage of hidden trap or door */
1557- g_ptr->mimic = 0;
1558- }
1559- }
1560- }
1561- }
1562-
1563- if (!in_generate)
1564- {
1565- /* Process "re-glowing" */
1566- for (y = (y1 - r); y <= (y1 + r); y++)
1567- {
1568- for (x = (x1 - r); x <= (x1 + r); x++)
1569- {
1570- if (!in_bounds(y, x)) continue;
1571-
1572- /* Extract the distance */
1573- k = distance(y1, x1, y, x);
1574-
1575- /* Stay in the circle of death */
1576- if (k > r) continue;
1577- g_ptr = &current_floor_ptr->grid_array[y][x];
1578-
1579- if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
1580- else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
1581- {
1582- DIRECTION i;
1583- POSITION yy, xx;
1584- grid_type *cc_ptr;
1585-
1586- for (i = 0; i < 9; i++)
1587- {
1588- yy = y + ddy_ddd[i];
1589- xx = x + ddx_ddd[i];
1590- if (!in_bounds2(yy, xx)) continue;
1591- cc_ptr = &current_floor_ptr->grid_array[yy][xx];
1592- if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
1593- {
1594- g_ptr->info |= CAVE_GLOW;
1595- break;
1596- }
1597- }
1598- }
1599- }
1600- }
1601-
1602- /* Hack -- Affect player */
1603- if (flag)
1604- {
1605- msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
1606-
1607- /* Blind the player */
1608- if (!p_ptr->resist_blind && !p_ptr->resist_lite)
1609- {
1610- /* Become blind */
1611- (void)set_blind(p_ptr->blind + 10 + randint1(10));
1612- }
1613- }
1614-
1615- forget_flow();
1616-
1617- /* Mega-Hack -- Forget the view and lite */
1618- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
1619- p_ptr->redraw |= (PR_MAP);
1620- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
1621-
1622- if (p_ptr->special_defense & NINJA_S_STEALTH)
1623- {
1624- if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
1625- }
1626- }
1627-
1628- /* Success */
1629- return (TRUE);
1630-}
1631-
1632-
1633-/*!
1634- * @brief 地震処理(サブルーチン) /
1635- * Induce an "earthquake" of the given radius at the given location.
1636- * @return 効力があった場合TRUEを返す
1637- * @param cy 中心Y座標
1638- * @param cx 中心X座標
1639- * @param r 効果半径
1640- * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
1641- * @details
1642- * <pre>
1643- *
1644- * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
1645- *
1646- * The player will take damage and "jump" into a safe grid if possible,
1647- * otherwise, he will "tunnel" through the rubble instantaneously.
1648- *
1649- * Monsters will take damage, and "jump" into a safe grid if possible,
1650- * otherwise they will be "buried" in the rubble, disappearing from
1651- * the level in the same way that they do when genocided.
1652- *
1653- * Note that thus the player and monsters (except eaters of walls and
1654- * passers through walls) will never occupy the same grid as a wall.
1655- * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
1656- * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
1657- * This has allowed massive simplification of the "monster" code.
1658- * </pre>
1659- */
1660-bool earthquake(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
1661-{
1662- DIRECTION i;
1663- int t;
1664- POSITION y, x, yy, xx, dy, dx;
1665- int damage = 0;
1666- int sn = 0;
1667- POSITION sy = 0, sx = 0;
1668- bool hurt = FALSE;
1669- grid_type *g_ptr;
1670- bool map[32][32];
1671-
1672- /* Prevent destruction of quest levels and town */
1673- if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
1674- {
1675- return (FALSE);
1676- }
1677-
1678- /* Paranoia -- Enforce maximum range */
1679- if (r > 12) r = 12;
1680-
1681- /* Clear the "maximal blast" area */
1682- for (y = 0; y < 32; y++)
1683- {
1684- for (x = 0; x < 32; x++)
1685- {
1686- map[y][x] = FALSE;
1687- }
1688- }
1689-
1690- /* Check around the epicenter */
1691- for (dy = -r; dy <= r; dy++)
1692- {
1693- for (dx = -r; dx <= r; dx++)
1694- {
1695- yy = cy + dy;
1696- xx = cx + dx;
1697-
1698- if (!in_bounds(yy, xx)) continue;
1699-
1700- /* Skip distant grids */
1701- if (distance(cy, cx, yy, xx) > r) continue;
1702- g_ptr = &current_floor_ptr->grid_array[yy][xx];
1703-
1704- /* Lose room and vault / Lose light and knowledge */
1705- g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
1706- g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
1707-
1708- /* Skip the epicenter */
1709- if (!dx && !dy) continue;
1710-
1711- /* Skip most grids */
1712- if (randint0(100) < 85) continue;
1713-
1714- /* Damage this grid */
1715- map[16+yy-cy][16+xx-cx] = TRUE;
1716-
1717- /* Hack -- Take note of player damage */
1718- if (player_bold(yy, xx)) hurt = TRUE;
1719- }
1720- }
1721-
1722- /* First, affect the player (if necessary) */
1723- if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
1724- {
1725- /* Check around the player */
1726- for (i = 0; i < 8; i++)
1727- {
1728- y = p_ptr->y + ddy_ddd[i];
1729- x = p_ptr->x + ddx_ddd[i];
1730-
1731- /* Skip non-empty grids */
1732- if (!cave_empty_bold(y, x)) continue;
1733-
1734- /* Important -- Skip "quake" grids */
1735- if (map[16+y-cy][16+x-cx]) continue;
1736-
1737- if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1738-
1739- /* Count "safe" grids */
1740- sn++;
1741-
1742- /* Randomize choice */
1743- if (randint0(sn) > 0) continue;
1744-
1745- /* Save the safe location */
1746- sy = y; sx = x;
1747- }
1748-
1749- /* Random message */
1750- switch (randint1(3))
1751- {
1752- case 1:
1753- {
1754- msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
1755- break;
1756- }
1757- case 2:
1758- {
1759- msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
1760- break;
1761- }
1762- default:
1763- {
1764- msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes! You are pummeled with debris!"));
1765- break;
1766- }
1767- }
1768-
1769- /* Hurt the player a lot */
1770- if (!sn)
1771- {
1772- /* Message and damage */
1773- msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
1774- damage = 200;
1775- }
1776-
1777- /* Destroy the grid, and push the player to safety */
1778- else
1779- {
1780- /* Calculate results */
1781- switch (randint1(3))
1782- {
1783- case 1:
1784- {
1785- msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
1786- damage = 0;
1787- break;
1788- }
1789- case 2:
1790- {
1791- msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
1792- damage = damroll(10, 4);
1793- (void)set_stun(p_ptr->stun + randint1(50));
1794- break;
1795- }
1796- case 3:
1797- {
1798- msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
1799- damage = damroll(10, 4);
1800- (void)set_stun(p_ptr->stun + randint1(50));
1801- break;
1802- }
1803- }
1804-
1805- /* Move the player to the safe location */
1806- (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
1807- }
1808-
1809- /* Important -- no wall on player */
1810- map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
1811-
1812- if (damage)
1813- {
1814- concptr killer;
1815-
1816- if (m_idx)
1817- {
1818- GAME_TEXT m_name[MAX_NLEN];
1819- monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
1820- monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
1821- killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
1822- }
1823- else
1824- {
1825- killer = _("地震", "an earthquake");
1826- }
1827-
1828- take_hit(DAMAGE_ATTACK, damage, killer, -1);
1829- }
1830- }
1831-
1832- /* Examine the quaked region */
1833- for (dy = -r; dy <= r; dy++)
1834- {
1835- for (dx = -r; dx <= r; dx++)
1836- {
1837- yy = cy + dy;
1838- xx = cx + dx;
1839-
1840- /* Skip unaffected grids */
1841- if (!map[16+yy-cy][16+xx-cx]) continue;
1842- g_ptr = &current_floor_ptr->grid_array[yy][xx];
1843-
1844- if (g_ptr->m_idx == p_ptr->riding) continue;
1845-
1846- /* Process monsters */
1847- if (g_ptr->m_idx)
1848- {
1849- monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
1850- monster_race *r_ptr = &r_info[m_ptr->r_idx];
1851-
1852- /* Quest monsters */
1853- if (r_ptr->flags1 & RF1_QUESTOR)
1854- {
1855- /* No wall on quest monsters */
1856- map[16+yy-cy][16+xx-cx] = FALSE;
1857-
1858- continue;
1859- }
1860-
1861- /* Most monsters cannot co-exist with rock */
1862- if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
1863- !(r_ptr->flags2 & (RF2_PASS_WALL)))
1864- {
1865- GAME_TEXT m_name[MAX_NLEN];
1866-
1867- /* Assume not safe */
1868- sn = 0;
1869-
1870- /* Monster can move to escape the wall */
1871- if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
1872- {
1873- /* Look for safety */
1874- for (i = 0; i < 8; i++)
1875- {
1876- y = yy + ddy_ddd[i];
1877- x = xx + ddx_ddd[i];
1878-
1879- /* Skip non-empty grids */
1880- if (!cave_empty_bold(y, x)) continue;
1881-
1882- /* Hack -- no safety on glyph of warding */
1883- if (is_glyph_grid(&current_floor_ptr->grid_array[y][x])) continue;
1884- if (is_explosive_rune_grid(&current_floor_ptr->grid_array[y][x])) continue;
1885-
1886- /* ... nor on the Pattern */
1887- if (pattern_tile(y, x)) continue;
1888-
1889- /* Important -- Skip "quake" grids */
1890- if (map[16+y-cy][16+x-cx]) continue;
1891-
1892- if (current_floor_ptr->grid_array[y][x].m_idx) continue;
1893- if (player_bold(y, x)) continue;
1894-
1895- /* Count "safe" grids */
1896- sn++;
1897-
1898- /* Randomize choice */
1899- if (randint0(sn) > 0) continue;
1900-
1901- /* Save the safe grid */
1902- sy = y; sx = x;
1903- }
1904- }
1905-
1906- monster_desc(m_name, m_ptr, 0);
1907-
1908- /* Scream in pain */
1909- if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
1910-
1911- /* Take damage from the quake */
1912- damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
1913-
1914- /* Monster is certainly awake */
1915- (void)set_monster_csleep(g_ptr->m_idx, 0);
1916-
1917- /* Apply damage directly */
1918- m_ptr->hp -= damage;
1919-
1920- /* Delete (not kill) "dead" monsters */
1921- if (m_ptr->hp < 0)
1922- {
1923- if (!ignore_unview || is_seen(m_ptr))
1924- msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
1925-
1926- if (g_ptr->m_idx)
1927- {
1928- if (record_named_pet && is_pet(&current_floor_ptr->m_list[g_ptr->m_idx]) && current_floor_ptr->m_list[g_ptr->m_idx].nickname)
1929- {
1930- char m2_name[MAX_NLEN];
1931-
1932- monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
1933- do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
1934- }
1935- }
1936-
1937- delete_monster(yy, xx);
1938-
1939- /* No longer safe */
1940- sn = 0;
1941- }
1942-
1943- /* Hack -- Escape from the rock */
1944- if (sn)
1945- {
1946- IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
1947-
1948- /* Update the old location */
1949- current_floor_ptr->grid_array[yy][xx].m_idx = 0;
1950-
1951- /* Update the new location */
1952- current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
1953-
1954- /* Move the monster */
1955- m_ptr->fy = sy;
1956- m_ptr->fx = sx;
1957-
1958- update_monster(m_idx, TRUE);
1959- lite_spot(yy, xx);
1960- lite_spot(sy, sx);
1961- }
1962- }
1963- }
1964- }
1965- }
1966-
1967- /* Lose monster light */
1968- clear_mon_lite();
1969-
1970- /* Examine the quaked region */
1971- for (dy = -r; dy <= r; dy++)
1972- {
1973- for (dx = -r; dx <= r; dx++)
1974- {
1975- yy = cy + dy;
1976- xx = cx + dx;
1977-
1978- /* Skip unaffected grids */
1979- if (!map[16+yy-cy][16+xx-cx]) continue;
1980-
1981- g_ptr = &current_floor_ptr->grid_array[yy][xx];
1982-
1983- /* Paranoia -- never affect player */
1984-/* if (player_bold(yy, xx)) continue; */
1985-
1986- /* Destroy location (if valid) */
1987- if (cave_valid_bold(yy, xx))
1988- {
1989- delete_object(yy, xx);
1990-
1991- /* Wall (or floor) type */
1992- t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
1993-
1994- /* Granite */
1995- if (t < 20)
1996- {
1997- /* Create granite wall */
1998- cave_set_feat(yy, xx, feat_granite);
1999- }
2000-
2001- /* Quartz */
2002- else if (t < 70)
2003- {
2004- /* Create quartz vein */
2005- cave_set_feat(yy, xx, feat_quartz_vein);
2006- }
2007-
2008- /* Magma */
2009- else if (t < 100)
2010- {
2011- /* Create magma vein */
2012- cave_set_feat(yy, xx, feat_magma_vein);
2013- }
2014-
2015- /* Floor */
2016- else
2017- {
2018- /* Create floor */
2019- cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
2020- }
2021- }
2022- }
2023- }
2024-
2025- /* Process "re-glowing" */
2026- for (dy = -r; dy <= r; dy++)
2027- {
2028- for (dx = -r; dx <= r; dx++)
2029- {
2030- yy = cy + dy;
2031- xx = cx + dx;
2032-
2033- if (!in_bounds(yy, xx)) continue;
2034-
2035- /* Skip distant grids */
2036- if (distance(cy, cx, yy, xx) > r) continue;
2037- g_ptr = &current_floor_ptr->grid_array[yy][xx];
2038-
2039- if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
2040- else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
2041- {
2042- DIRECTION ii;
2043- POSITION yyy, xxx;
2044- grid_type *cc_ptr;
2045-
2046- for (ii = 0; ii < 9; ii++)
2047- {
2048- yyy = yy + ddy_ddd[ii];
2049- xxx = xx + ddx_ddd[ii];
2050- if (!in_bounds2(yyy, xxx)) continue;
2051- cc_ptr = &current_floor_ptr->grid_array[yyy][xxx];
2052- if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
2053- {
2054- g_ptr->info |= CAVE_GLOW;
2055- break;
2056- }
2057- }
2058- }
2059- }
2060- }
2061-
2062- /* Mega-Hack -- Forget the view and lite */
2063- p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
2064- p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
2065- p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
2066-
2067- if (p_ptr->special_defense & NINJA_S_STEALTH)
2068- {
2069- if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
2070- }
2071-
2072- /* Success */
2073- return (TRUE);
2074-}
2075-
20761364 /*!
20771365 * @brief ペット爆破処理 /
20781366 * @return なし
Show on old repository browser