OSDN Git Service

[Refactor] #37353 inside_arena を player_type から floor_type へ移動. / Move inside_arena...
[hengband/hengband.git] / src / spells2.c
index db281fb..9481e62 100644 (file)
  */
 
 #include "angband.h"
+#include "core.h"
+#include "util.h"
+
+#include "creature.h"
+
+#include "artifact.h"
 #include "cmd-pet.h"
+#include "cmd-dump.h"
+#include "floor.h"
 #include "grid.h"
 #include "trap.h"
 #include "monsterrace-hook.h"
 #include "melee.h"
 #include "world.h"
+#include "spells.h"
 #include "spells-summon.h"
 #include "mutation.h"
 #include "quest.h"
 #include "spells-status.h"
 #include "spells-floor.h"
 #include "realm-hex.h"
+#include "autopick.h"
+#include "object-flavor.h"
 #include "object-hook.h"
 #include "monster-status.h"
+#include "player-move.h"
 #include "player-status.h"
+#include "player-effects.h"
+#include "player-skill.h"
+#include "player-class.h"
+#include "player-damage.h"
+#include "player-inventory.h"
+
+#include "dungeon.h"
+#include "floor-events.h"
+#include "feature.h"
+#include "view-mainwindow.h"
+#include "objectkind.h"
+#include "monsterrace.h"
+#include "targeting.h"
+#include "realm-song.h"
+#include "english.h"
 
 /*!
  * @brief プレイヤー周辺の地形を感知する
@@ -46,13 +73,13 @@ static bool detect_feat_flag(POSITION range, int flag, bool known)
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        /* Scan the current panel */
-       for (y = 1; y < current_floor_ptr->height - 1; y++)
+       for (y = 1; y < p_ptr->current_floor_ptr->height - 1; y++)
        {
-               for (x = 1; x <= current_floor_ptr->width - 1; x++)
+               for (x = 1; x <= p_ptr->current_floor_ptr->width - 1; x++)
                {
                        int dist = distance(p_ptr->y, p_ptr->x, y, x);
                        if (dist > range) continue;
-                       g_ptr = &current_floor_ptr->grid_array[y][x];
+                       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
                        /* Hack -- Safe */
                        if (flag == FF_TRAP)
@@ -68,17 +95,11 @@ static bool detect_feat_flag(POSITION range, int flag, bool known)
                                }
                        }
 
-                       /* Detect flags */
                        if (cave_have_flag_grid(g_ptr, flag))
                        {
-                               /* Detect secrets */
                                disclose_grid(y, x);
-
-                               /* Hack -- Memorize */
                                g_ptr->info |= (CAVE_MARK);
-
                                lite_spot(y, x);
-
                                detect = TRUE;
                        }
                }
@@ -99,7 +120,7 @@ bool detect_traps(POSITION range, bool known)
 
        if (known) p_ptr->dtrap = TRUE;
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
        if (detect)
        {
                msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
@@ -117,7 +138,7 @@ bool detect_doors(POSITION range)
 {
        bool detect = detect_feat_flag(range, FF_DOOR, TRUE);
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
        if (detect)
        {
                msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
@@ -135,7 +156,7 @@ bool detect_stairs(POSITION range)
 {
        bool detect = detect_feat_flag(range, FF_STAIRS, TRUE);
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
        if (detect)
        {
                msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
@@ -153,7 +174,7 @@ bool detect_treasure(POSITION range)
 {
        bool detect = detect_feat_flag(range, FF_HAS_GOLD, TRUE);
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
        if (detect)
        {
                msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
@@ -178,15 +199,12 @@ bool detect_objects_gold(POSITION range)
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        /* Scan objects */
-       for (i = 1; i < o_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &current_floor_ptr->o_list[i];
-
-               /* Skip dead objects */
-               if (!o_ptr->k_idx) continue;
+               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
 
-               /* Skip held objects */
-               if (o_ptr->held_m_idx) continue;
+               if (!OBJECT_IS_VALID(o_ptr)) continue;
+               if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
 
                y = o_ptr->iy;
                x = o_ptr->ix;
@@ -203,7 +221,7 @@ bool detect_objects_gold(POSITION range)
                }
        }
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
        if (detect)
        {
                msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
@@ -233,15 +251,12 @@ bool detect_objects_normal(POSITION range)
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        /* Scan objects */
-       for (i = 1; i < o_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &current_floor_ptr->o_list[i];
+               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
 
-               /* Skip dead objects */
-               if (!o_ptr->k_idx) continue;
-
-               /* Skip held objects */
-               if (o_ptr->held_m_idx) continue;
+               if (!OBJECT_IS_VALID(o_ptr)) continue;
+               if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
 
                y = o_ptr->iy;
                x = o_ptr->ix;
@@ -258,7 +273,7 @@ bool detect_objects_normal(POSITION range)
                }
        }
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
        if (detect)
        {
                msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
@@ -296,15 +311,12 @@ bool detect_objects_magic(POSITION range)
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        /* Scan all objects */
-       for (i = 1; i < o_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &current_floor_ptr->o_list[i];
-
-               /* Skip dead objects */
-               if (!o_ptr->k_idx) continue;
+               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
 
-               /* Skip held objects */
-               if (o_ptr->held_m_idx) continue;
+               if (!OBJECT_IS_VALID(o_ptr)) continue;
+               if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
 
                y = o_ptr->iy;
                x = o_ptr->ix;
@@ -370,9 +382,9 @@ bool detect_monsters_normal(POSITION range)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -389,12 +401,12 @@ bool detect_monsters_normal(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
        if (flag)
        {
                msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
@@ -416,9 +428,9 @@ bool detect_monsters_invis(POSITION range)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                if (!monster_is_valid(m_ptr)) continue;
@@ -442,12 +454,12 @@ bool detect_monsters_invis(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
        if (flag)
        {
                msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
@@ -468,9 +480,9 @@ bool detect_monsters_evil(POSITION range)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -499,7 +511,7 @@ bool detect_monsters_evil(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -523,9 +535,9 @@ bool detect_monsters_nonliving(POSITION range)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
@@ -547,7 +559,7 @@ bool detect_monsters_nonliving(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -571,9 +583,9 @@ bool detect_monsters_mind(POSITION range)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -596,7 +608,7 @@ bool detect_monsters_mind(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -622,9 +634,9 @@ bool detect_monsters_string(POSITION range, concptr Match)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -647,12 +659,12 @@ bool detect_monsters_string(POSITION range, concptr Match)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
 
-       if (music_singing(MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
+       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
        if (flag)
        {
                msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
@@ -675,9 +687,9 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
 
        if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -706,7 +718,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(i, FALSE);
+                       update_monster(p_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
@@ -775,25 +787,25 @@ bool project_all_los(EFFECT_ID typ, HIT_POINT dam)
        bool obvious = FALSE;
 
        /* Mark all (nearby) monsters */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
 
                /* Require line of sight */
-               if (!player_has_los_bold(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)) continue;
+               if (!player_has_los_bold(p_ptr, y, x) || !projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x)) continue;
 
                /* Mark the monster */
                m_ptr->mflag |= (MFLAG_LOS);
        }
 
        /* Affect all marked monsters */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
 
                /* Skip unmarked monsters */
                if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
@@ -855,7 +867,7 @@ bool turn_undead(void)
 {
        bool tester = (project_all_los(GF_TURN_UNDEAD, p_ptr->lev));
        if (tester)
-               chg_virtue(V_UNLIFE, -1);
+               chg_virtue(p_ptr, V_UNLIFE, -1);
        return tester;
 }
 
@@ -867,7 +879,7 @@ bool dispel_undead(HIT_POINT dam)
 {
        bool tester = (project_all_los(GF_DISP_UNDEAD, dam));
        if (tester)
-               chg_virtue(V_UNLIFE, -2);
+               chg_virtue(p_ptr, V_UNLIFE, -2);
        return tester;
 }
 
@@ -903,12 +915,12 @@ bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
        bool ident = FALSE;
        if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
        int k = 3 * creature_ptr->lev;
-       if (set_protevil((magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
-       if (set_poisoned(0)) ident = TRUE;
-       if (set_afraid(0)) ident = TRUE;
-       if (hp_player(50)) ident = TRUE;
-       if (set_stun(0)) ident = TRUE;
-       if (set_cut(0)) ident = TRUE;
+       if (set_protevil(p_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
+       if (set_poisoned(p_ptr, 0)) ident = TRUE;
+       if (set_afraid(p_ptr, 0)) ident = TRUE;
+       if (hp_player(p_ptr, 50)) ident = TRUE;
+       if (set_stun(p_ptr, 0)) ident = TRUE;
+       if (set_cut(p_ptr,0)) ident = TRUE;
        return ident;
 }
 
@@ -919,7 +931,7 @@ bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
        (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
        if ((creature_ptr->pclass != CLASS_MAGE) && (creature_ptr->pclass != CLASS_HIGH_MAGE) && (creature_ptr->pclass != CLASS_SORCERER) && (creature_ptr->pclass != CLASS_MAGIC_EATER) && (creature_ptr->pclass != CLASS_BLUE_MAGE))
        {
-               (void)take_hit(DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
+               (void)take_hit(p_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
        }
        return TRUE;
 }
@@ -963,9 +975,9 @@ void aggravate_monsters(MONSTER_IDX who)
        bool speed = FALSE;
 
        /* Aggravate everyone nearby */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip aggravating monster (or player) */
@@ -984,7 +996,7 @@ void aggravate_monsters(MONSTER_IDX who)
                }
 
                /* Speed up monsters in line of sight */
-               if (player_has_los_bold(m_ptr->fy, m_ptr->fx))
+               if (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx))
                {
                        if (!is_pet(m_ptr))
                        {
@@ -1012,7 +1024,7 @@ void aggravate_monsters(MONSTER_IDX who)
 bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
 {
        int          msec = delay_factor * delay_factor * delay_factor;
-       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
        bool         resist = FALSE;
 
@@ -1022,7 +1034,7 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side,
        if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
        else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
        else if (m_idx == p_ptr->riding) resist = TRUE;
-       else if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle) resist = TRUE;
+       else if ((p_ptr->current_floor_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->current_floor_ptr->inside_arena || p_ptr->phase_out) resist = TRUE;
        else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
        else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
 
@@ -1033,7 +1045,7 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side,
                        GAME_TEXT m_name[MAX_NLEN];
 
                        monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
+                       exe_write_diary(p_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
                }
 
                delete_monster_idx(m_idx);
@@ -1070,7 +1082,7 @@ bool genocide_aux(MONSTER_IDX m_idx, int power, bool player_cast, int dam_side,
 
        if (player_cast)
        {
-               take_hit(DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
+               take_hit(p_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
        }
 
        /* Visual feedback */
@@ -1101,7 +1113,7 @@ bool symbol_genocide(int power, bool player_cast)
        bool result = FALSE;
 
        /* Prevent genocide in quest levels */
-       if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       if ((p_ptr->current_floor_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->current_floor_ptr->inside_arena || p_ptr->phase_out)
        {
                msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
                return (FALSE);
@@ -1111,9 +1123,9 @@ bool symbol_genocide(int power, bool player_cast)
        while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
 
        /* Delete the monsters of that "type" */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -1125,8 +1137,8 @@ bool symbol_genocide(int power, bool player_cast)
 
        if (result)
        {
-               chg_virtue(V_VITALITY, -2);
-               chg_virtue(V_CHANCE, -1);
+               chg_virtue(p_ptr, V_VITALITY, -2);
+               chg_virtue(p_ptr, V_CHANCE, -1);
        }
 
        return result;
@@ -1145,15 +1157,15 @@ bool mass_genocide(int power, bool player_cast)
        bool result = FALSE;
 
        /* Prevent mass genocide in quest levels */
-       if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       if ((p_ptr->current_floor_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->current_floor_ptr->inside_arena || p_ptr->phase_out)
        {
                return (FALSE);
        }
 
        /* Delete the (nearby) monsters */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip distant monsters */
@@ -1165,8 +1177,8 @@ bool mass_genocide(int power, bool player_cast)
 
        if (result)
        {
-               chg_virtue(V_VITALITY, -2);
-               chg_virtue(V_CHANCE, -1);
+               chg_virtue(p_ptr, V_VITALITY, -2);
+               chg_virtue(p_ptr, V_CHANCE, -1);
        }
 
        return result;
@@ -1185,15 +1197,15 @@ bool mass_genocide_undead(int power, bool player_cast)
        bool result = FALSE;
 
        /* Prevent mass genocide in quest levels */
-       if ((p_ptr->inside_quest && !random_quest_number(current_floor_ptr->dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
+       if ((p_ptr->current_floor_ptr->inside_quest && !random_quest_number(p_ptr->current_floor_ptr->dun_level)) || p_ptr->current_floor_ptr->inside_arena || p_ptr->phase_out)
        {
                return (FALSE);
        }
 
        /* Delete the (nearby) monsters */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -1208,8 +1220,8 @@ bool mass_genocide_undead(int power, bool player_cast)
 
        if (result)
        {
-               chg_virtue(V_UNLIFE, -2);
-               chg_virtue(V_CHANCE, -1);
+               chg_virtue(p_ptr, V_UNLIFE, -2);
+               chg_virtue(p_ptr, V_CHANCE, -1);
        }
 
        return result;
@@ -1235,14 +1247,14 @@ bool probing(void)
        Term->scr->cv = 1;
 
        /* Probe all (nearby) monsters */
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Require line of sight */
-               if (!player_has_los_bold(m_ptr->fy, m_ptr->fx)) continue;
+               if (!player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx)) continue;
 
                /* Probe visible monsters */
                if (m_ptr->ml)
@@ -1277,7 +1289,7 @@ bool probing(void)
                        if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
                        else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
                        else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
-                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) _(align = "中立(善悪)", "neutral(good&evil)");
+                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
                        else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
                        else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
                        else align = _("中立", "neutral");
@@ -1344,745 +1356,12 @@ bool probing(void)
 
        if (probe)
        {
-               chg_virtue(V_KNOWLEDGE, 1);
+               chg_virtue(p_ptr, V_KNOWLEDGE, 1);
                msg_print(_("これで全部です。", "That's all."));
        }
        return (probe);
 }
 
-
-
-/*!
- * @brief *破壊*処理を行う / The spell of destruction
- * @param y1 破壊の中心Y座標
- * @param x1 破壊の中心X座標 
- * @param r 破壊の半径
- * @param in_generate ダンジョンフロア生成中の処理ならばTRUE
- * @return 効力があった場合TRUEを返す
- * @details
- * <pre>
- * This spell "deletes" monsters (instead of "killing" them).
- *
- * Later we may use one function for both "destruction" and
- * "earthquake" by using the "full" to select "destruction".
- * </pre>
- */
-bool destroy_area(POSITION y1, POSITION x1, POSITION r, bool in_generate)
-{
-       POSITION y, x;
-       int k, t;
-       grid_type *g_ptr;
-       bool flag = FALSE;
-
-       /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
-       {
-               return (FALSE);
-       }
-
-       /* Lose monster light */
-       if (!in_generate) clear_mon_lite();
-
-       /* Big area of affect */
-       for (y = (y1 - r); y <= (y1 + r); y++)
-       {
-               for (x = (x1 - r); x <= (x1 + r); x++)
-               {
-                       /* Skip illegal grids */
-                       if (!in_bounds(y, x)) continue;
-
-                       /* Extract the distance */
-                       k = distance(y1, x1, y, x);
-
-                       /* Stay in the circle of death */
-                       if (k > r) continue;
-                       g_ptr = &current_floor_ptr->grid_array[y][x];
-
-                       /* Lose room and vault */
-                       g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
-
-                       /* Lose light and knowledge */
-                       g_ptr->info &= ~(CAVE_MARK | CAVE_GLOW | CAVE_KNOWN);
-
-                       if (!in_generate) /* Normal */
-                       {
-                               /* Lose unsafety */
-                               g_ptr->info &= ~(CAVE_UNSAFE);
-
-                               /* Hack -- Notice player affect */
-                               if (player_bold(y, x))
-                               {
-                                       /* Hurt the player later */
-                                       flag = TRUE;
-
-                                       /* Do not hurt this grid */
-                                       continue;
-                               }
-                       }
-
-                       /* Hack -- Skip the epicenter */
-                       if ((y == y1) && (x == x1)) continue;
-
-                       if (g_ptr->m_idx)
-                       {
-                               monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
-                               monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-                               if (in_generate) /* In generation */
-                               {
-                                       /* Delete the monster (if any) */
-                                       delete_monster(y, x);
-                               }
-                               else if (r_ptr->flags1 & RF1_QUESTOR)
-                               {
-                                       /* Heal the monster */
-                                       m_ptr->hp = m_ptr->maxhp;
-
-                                       /* Try to teleport away quest monsters */
-                                       if (!teleport_away(g_ptr->m_idx, (r * 2) + 1, TELEPORT_DEC_VALOUR)) continue;
-                               }
-                               else
-                               {
-                                       if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
-                                       {
-                                               GAME_TEXT m_name[MAX_NLEN];
-
-                                               monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_DESTROY, m_name);
-                                       }
-
-                                       /* Delete the monster (if any) */
-                                       delete_monster(y, x);
-                               }
-                       }
-
-                       /* During generation, destroyed artifacts are "preserved" */
-                       if (preserve_mode || in_generate)
-                       {
-                               OBJECT_IDX this_o_idx, next_o_idx = 0;
-
-                               /* Scan all objects in the grid */
-                               for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
-                               {
-                                       object_type *o_ptr;
-                                       o_ptr = &current_floor_ptr->o_list[this_o_idx];
-                                       next_o_idx = o_ptr->next_o_idx;
-
-                                       /* Hack -- Preserve unknown artifacts */
-                                       if (object_is_fixed_artifact(o_ptr) && (!object_is_known(o_ptr) || in_generate))
-                                       {
-                                               /* Mega-Hack -- Preserve the artifact */
-                                               a_info[o_ptr->name1].cur_num = 0;
-
-                                               if (in_generate && cheat_peek)
-                                               {
-                                                       GAME_TEXT o_name[MAX_NLEN];
-                                                       object_desc(o_name, o_ptr, (OD_NAME_ONLY | OD_STORE));
-                                                       msg_format(_("伝説のアイテム (%s) は生成中に*破壊*された。", "Artifact (%s) was *destroyed* during generation."), o_name);
-                                               }
-                                       }
-                                       else if (in_generate && cheat_peek && o_ptr->art_name)
-                                       {
-                                               msg_print(_("ランダム・アーティファクトの1つは生成中に*破壊*された。", 
-                                                                       "One of the random artifacts was *destroyed* during generation."));
-                                       }
-                               }
-                       }
-
-                       delete_object(y, x);
-
-                       /* Destroy "non-permanent" grids */
-                       if (!cave_perma_grid(g_ptr))
-                       {
-                               /* Wall (or floor) type */
-                               t = randint0(200);
-
-                               if (!in_generate) /* Normal */
-                               {
-                                       if (t < 20)
-                                       {
-                                               /* Create granite wall */
-                                               cave_set_feat(y, x, feat_granite);
-                                       }
-                                       else if (t < 70)
-                                       {
-                                               /* Create quartz vein */
-                                               cave_set_feat(y, x, feat_quartz_vein);
-                                       }
-                                       else if (t < 100)
-                                       {
-                                               /* Create magma vein */
-                                               cave_set_feat(y, x, feat_magma_vein);
-                                       }
-                                       else
-                                       {
-                                               /* Create floor */
-                                               cave_set_feat(y, x, feat_ground_type[randint0(100)]);
-                                       }
-                               }
-                               else /* In generation */
-                               {
-                                       if (t < 20)
-                                       {
-                                               /* Create granite wall */
-                                               place_extra_grid(g_ptr);
-                                       }
-                                       else if (t < 70)
-                                       {
-                                               /* Create quartz vein */
-                                               g_ptr->feat = feat_quartz_vein;
-                                       }
-                                       else if (t < 100)
-                                       {
-                                               /* Create magma vein */
-                                               g_ptr->feat = feat_magma_vein;
-                                       }
-                                       else
-                                       {
-                                               /* Create floor */
-                                               place_floor_grid(g_ptr);
-                                       }
-
-                                       /* Clear garbage of hidden trap or door */
-                                       g_ptr->mimic = 0;
-                               }
-                       }
-               }
-       }
-
-       if (!in_generate)
-       {
-               /* Process "re-glowing" */
-               for (y = (y1 - r); y <= (y1 + r); y++)
-               {
-                       for (x = (x1 - r); x <= (x1 + r); x++)
-                       {
-                               /* Skip illegal grids */
-                               if (!in_bounds(y, x)) continue;
-
-                               /* Extract the distance */
-                               k = distance(y1, x1, y, x);
-
-                               /* Stay in the circle of death */
-                               if (k > r) continue;
-                               g_ptr = &current_floor_ptr->grid_array[y][x];
-
-                               if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
-                               else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
-                               {
-                                       DIRECTION i;
-                                       POSITION yy, xx;
-                                       grid_type *cc_ptr;
-
-                                       for (i = 0; i < 9; i++)
-                                       {
-                                               yy = y + ddy_ddd[i];
-                                               xx = x + ddx_ddd[i];
-                                               if (!in_bounds2(yy, xx)) continue;
-                                               cc_ptr = &current_floor_ptr->grid_array[yy][xx];
-                                               if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
-                                               {
-                                                       g_ptr->info |= CAVE_GLOW;
-                                                       break;
-                                               }
-                                       }
-                               }
-                       }
-               }
-
-               /* Hack -- Affect player */
-               if (flag)
-               {
-                       msg_print(_("燃えるような閃光が発生した!", "There is a searing blast of light!"));
-
-                       /* Blind the player */
-                       if (!p_ptr->resist_blind && !p_ptr->resist_lite)
-                       {
-                               /* Become blind */
-                               (void)set_blind(p_ptr->blind + 10 + randint1(10));
-                       }
-               }
-
-               forget_flow();
-
-               /* Mega-Hack -- Forget the view and lite */
-               p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
-               p_ptr->redraw |= (PR_MAP);
-               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-               if (p_ptr->special_defense & NINJA_S_STEALTH)
-               {
-                       if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
-               }
-       }
-
-       /* Success */
-       return (TRUE);
-}
-
-
-/*!
- * @brief 地震処理(サブルーチン) /
- * Induce an "earthquake" of the given radius at the given location.
- * @return 効力があった場合TRUEを返す
- * @param cy 中心Y座標
- * @param cx 中心X座標
- * @param r 効果半径
- * @param m_idx 地震を起こしたモンスターID(0ならばプレイヤー)
- * @details
- * <pre>
- *
- * This will current_world_ptr->game_turn some walls into floors and some floors into walls.
- *
- * The player will take damage and "jump" into a safe grid if possible,
- * otherwise, he will "tunnel" through the rubble instantaneously.
- *
- * Monsters will take damage, and "jump" into a safe grid if possible,
- * otherwise they will be "buried" in the rubble, disappearing from
- * the level in the same way that they do when genocided.
- *
- * Note that thus the player and monsters (except eaters of walls and
- * passers through walls) will never occupy the same grid as a wall.
- * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even
- * for a single current_world_ptr->game_turn, unless that monster can pass_walls or kill_walls.
- * This has allowed massive simplification of the "monster" code.
- * </pre>
- */
-bool earthquake_aux(POSITION cy, POSITION cx, POSITION r, MONSTER_IDX m_idx)
-{
-       DIRECTION i;
-       int t;
-       POSITION y, x, yy, xx, dy, dx;
-       int damage = 0;
-       int sn = 0;
-       POSITION sy = 0, sx = 0;
-       bool hurt = FALSE;
-       grid_type *g_ptr;
-       bool map[32][32];
-
-       /* Prevent destruction of quest levels and town */
-       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
-       {
-               return (FALSE);
-       }
-
-       /* Paranoia -- Enforce maximum range */
-       if (r > 12) r = 12;
-
-       /* Clear the "maximal blast" area */
-       for (y = 0; y < 32; y++)
-       {
-               for (x = 0; x < 32; x++)
-               {
-                       map[y][x] = FALSE;
-               }
-       }
-
-       /* Check around the epicenter */
-       for (dy = -r; dy <= r; dy++)
-       {
-               for (dx = -r; dx <= r; dx++)
-               {
-                       /* Extract the location */
-                       yy = cy + dy;
-                       xx = cx + dx;
-
-                       /* Skip illegal grids */
-                       if (!in_bounds(yy, xx)) continue;
-
-                       /* Skip distant grids */
-                       if (distance(cy, cx, yy, xx) > r) continue;
-                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
-
-                       /* Lose room and vault / Lose light and knowledge */
-                       g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY | CAVE_UNSAFE);
-                       g_ptr->info &= ~(CAVE_GLOW | CAVE_MARK | CAVE_KNOWN);
-
-                       /* Skip the epicenter */
-                       if (!dx && !dy) continue;
-
-                       /* Skip most grids */
-                       if (randint0(100) < 85) continue;
-
-                       /* Damage this grid */
-                       map[16+yy-cy][16+xx-cx] = TRUE;
-
-                       /* Hack -- Take note of player damage */
-                       if (player_bold(yy, xx)) hurt = TRUE;
-               }
-       }
-
-       /* First, affect the player (if necessary) */
-       if (hurt && !p_ptr->pass_wall && !p_ptr->kill_wall)
-       {
-               /* Check around the player */
-               for (i = 0; i < 8; i++)
-               {
-                       y = p_ptr->y + ddy_ddd[i];
-                       x = p_ptr->x + ddx_ddd[i];
-
-                       /* Skip non-empty grids */
-                       if (!cave_empty_bold(y, x)) continue;
-
-                       /* Important -- Skip "quake" grids */
-                       if (map[16+y-cy][16+x-cx]) continue;
-
-                       if (current_floor_ptr->grid_array[y][x].m_idx) continue;
-
-                       /* Count "safe" grids */
-                       sn++;
-
-                       /* Randomize choice */
-                       if (randint0(sn) > 0) continue;
-
-                       /* Save the safe location */
-                       sy = y; sx = x;
-               }
-
-               /* Random message */
-               switch (randint1(3))
-               {
-                       case 1:
-                       {
-                               msg_print(_("ダンジョンの壁が崩れた!", "The current_floor_ptr->grid_array ceiling collapses!"));
-                               break;
-                       }
-                       case 2:
-                       {
-                               msg_print(_("ダンジョンの床が不自然にねじ曲がった!", "The current_floor_ptr->grid_array floor twists in an unnatural way!"));
-                               break;
-                       }
-                       default:
-                       {
-                               msg_print(_("ダンジョンが揺れた!崩れた岩が頭に降ってきた!", "The current_floor_ptr->grid_array quakes!  You are pummeled with debris!"));
-                               break;
-                       }
-               }
-
-               /* Hurt the player a lot */
-               if (!sn)
-               {
-                       /* Message and damage */
-                       msg_print(_("あなたはひどい怪我を負った!", "You are severely crushed!"));
-                       damage = 200;
-               }
-
-               /* Destroy the grid, and push the player to safety */
-               else
-               {
-                       /* Calculate results */
-                       switch (randint1(3))
-                       {
-                               case 1:
-                               {
-                                       msg_print(_("降り注ぐ岩をうまく避けた!", "You nimbly dodge the blast!"));
-                                       damage = 0;
-                                       break;
-                               }
-                               case 2:
-                               {
-                                       msg_print(_("岩石があなたに直撃した!", "You are bashed by rubble!"));
-                                       damage = damroll(10, 4);
-                                       (void)set_stun(p_ptr->stun + randint1(50));
-                                       break;
-                               }
-                               case 3:
-                               {
-                                       msg_print(_("あなたは床と壁との間に挟まれてしまった!", "You are crushed between the floor and ceiling!"));
-                                       damage = damroll(10, 4);
-                                       (void)set_stun(p_ptr->stun + randint1(50));
-                                       break;
-                               }
-                       }
-
-                       /* Move the player to the safe location */
-                       (void)move_player_effect(sy, sx, MPE_DONT_PICKUP);
-               }
-
-               /* Important -- no wall on player */
-               map[16+p_ptr->y-cy][16+p_ptr->x-cx] = FALSE;
-
-               if (damage)
-               {
-                       concptr killer;
-
-                       if (m_idx)
-                       {
-                               GAME_TEXT m_name[MAX_NLEN];
-                               monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
-                               monster_desc(m_name, m_ptr, MD_WRONGDOER_NAME);
-                               killer = format(_("%sの起こした地震", "an earthquake caused by %s"), m_name);
-                       }
-                       else
-                       {
-                               killer = _("地震", "an earthquake");
-                       }
-
-                       take_hit(DAMAGE_ATTACK, damage, killer, -1);
-               }
-       }
-
-       /* Examine the quaked region */
-       for (dy = -r; dy <= r; dy++)
-       {
-               for (dx = -r; dx <= r; dx++)
-               {
-                       /* Extract the location */
-                       yy = cy + dy;
-                       xx = cx + dx;
-
-                       /* Skip unaffected grids */
-                       if (!map[16+yy-cy][16+xx-cx]) continue;
-                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
-
-                       if (g_ptr->m_idx == p_ptr->riding) continue;
-
-                       /* Process monsters */
-                       if (g_ptr->m_idx)
-                       {
-                               monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
-                               monster_race *r_ptr = &r_info[m_ptr->r_idx];
-
-                               /* Quest monsters */
-                               if (r_ptr->flags1 & RF1_QUESTOR)
-                               {
-                                       /* No wall on quest monsters */
-                                       map[16+yy-cy][16+xx-cx] = FALSE;
-
-                                       continue;
-                               }
-
-                               /* Most monsters cannot co-exist with rock */
-                               if (!(r_ptr->flags2 & (RF2_KILL_WALL)) &&
-                                   !(r_ptr->flags2 & (RF2_PASS_WALL)))
-                               {
-                                       GAME_TEXT m_name[MAX_NLEN];
-
-                                       /* Assume not safe */
-                                       sn = 0;
-
-                                       /* Monster can move to escape the wall */
-                                       if (!(r_ptr->flags1 & (RF1_NEVER_MOVE)))
-                                       {
-                                               /* Look for safety */
-                                               for (i = 0; i < 8; i++)
-                                               {
-                                                       y = yy + ddy_ddd[i];
-                                                       x = xx + ddx_ddd[i];
-
-                                                       /* Skip non-empty grids */
-                                                       if (!cave_empty_bold(y, x)) continue;
-
-                                                       /* Hack -- no safety on glyph of warding */
-                                                       if (is_glyph_grid(&current_floor_ptr->grid_array[y][x])) continue;
-                                                       if (is_explosive_rune_grid(&current_floor_ptr->grid_array[y][x])) continue;
-
-                                                       /* ... nor on the Pattern */
-                                                       if (pattern_tile(y, x)) continue;
-
-                                                       /* Important -- Skip "quake" grids */
-                                                       if (map[16+y-cy][16+x-cx]) continue;
-
-                                                       if (current_floor_ptr->grid_array[y][x].m_idx) continue;
-                                                       if (player_bold(y, x)) continue;
-
-                                                       /* Count "safe" grids */
-                                                       sn++;
-
-                                                       /* Randomize choice */
-                                                       if (randint0(sn) > 0) continue;
-
-                                                       /* Save the safe grid */
-                                                       sy = y; sx = x;
-                                               }
-                                       }
-
-                                       monster_desc(m_name, m_ptr, 0);
-
-                                       /* Scream in pain */
-                                       if (!ignore_unview || is_seen(m_ptr)) msg_format(_("%^sは苦痛で泣きわめいた!", "%^s wails out in pain!"), m_name);
-
-                                       /* Take damage from the quake */
-                                       damage = (sn ? damroll(4, 8) : (m_ptr->hp + 1));
-
-                                       /* Monster is certainly awake */
-                                       (void)set_monster_csleep(g_ptr->m_idx, 0);
-
-                                       /* Apply damage directly */
-                                       m_ptr->hp -= damage;
-
-                                       /* Delete (not kill) "dead" monsters */
-                                       if (m_ptr->hp < 0)
-                                       {
-                                               if (!ignore_unview || is_seen(m_ptr)) 
-                                                       msg_format(_("%^sは岩石に埋もれてしまった!", "%^s is embedded in the rock!"), m_name);
-
-                                               if (g_ptr->m_idx)
-                                               {
-                                                       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)
-                                                       {
-                                                               char m2_name[MAX_NLEN];
-
-                                                               monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
-                                                               do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_EARTHQUAKE, m2_name);
-                                                       }
-                                               }
-
-                                               delete_monster(yy, xx);
-
-                                               /* No longer safe */
-                                               sn = 0;
-                                       }
-
-                                       /* Hack -- Escape from the rock */
-                                       if (sn)
-                                       {
-                                               IDX m_idx_aux = current_floor_ptr->grid_array[yy][xx].m_idx;
-
-                                               /* Update the old location */
-                                               current_floor_ptr->grid_array[yy][xx].m_idx = 0;
-
-                                               /* Update the new location */
-                                               current_floor_ptr->grid_array[sy][sx].m_idx = m_idx_aux;
-
-                                               /* Move the monster */
-                                               m_ptr->fy = sy;
-                                               m_ptr->fx = sx;
-
-                                               update_monster(m_idx, TRUE);
-                                               lite_spot(yy, xx);
-                                               lite_spot(sy, sx);
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /* Lose monster light */
-       clear_mon_lite();
-
-       /* Examine the quaked region */
-       for (dy = -r; dy <= r; dy++)
-       {
-               for (dx = -r; dx <= r; dx++)
-               {
-                       /* Extract the location */
-                       yy = cy + dy;
-                       xx = cx + dx;
-
-                       /* Skip unaffected grids */
-                       if (!map[16+yy-cy][16+xx-cx]) continue;
-
-                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
-
-                       /* Paranoia -- never affect player */
-/*                     if (player_bold(yy, xx)) continue; */
-
-                       /* Destroy location (if valid) */
-                       if (cave_valid_bold(yy, xx))
-                       {
-                               delete_object(yy, xx);
-
-                               /* Wall (or floor) type */
-                               t = cave_have_flag_bold(yy, xx, FF_PROJECT) ? randint0(100) : 200;
-
-                               /* Granite */
-                               if (t < 20)
-                               {
-                                       /* Create granite wall */
-                                       cave_set_feat(yy, xx, feat_granite);
-                               }
-
-                               /* Quartz */
-                               else if (t < 70)
-                               {
-                                       /* Create quartz vein */
-                                       cave_set_feat(yy, xx, feat_quartz_vein);
-                               }
-
-                               /* Magma */
-                               else if (t < 100)
-                               {
-                                       /* Create magma vein */
-                                       cave_set_feat(yy, xx, feat_magma_vein);
-                               }
-
-                               /* Floor */
-                               else
-                               {
-                                       /* Create floor */
-                                       cave_set_feat(yy, xx, feat_ground_type[randint0(100)]);
-                               }
-                       }
-               }
-       }
-
-       /* Process "re-glowing" */
-       for (dy = -r; dy <= r; dy++)
-       {
-               for (dx = -r; dx <= r; dx++)
-               {
-                       /* Extract the location */
-                       yy = cy + dy;
-                       xx = cx + dx;
-
-                       /* Skip illegal grids */
-                       if (!in_bounds(yy, xx)) continue;
-
-                       /* Skip distant grids */
-                       if (distance(cy, cx, yy, xx) > r) continue;
-                       g_ptr = &current_floor_ptr->grid_array[yy][xx];
-
-                       if (is_mirror_grid(g_ptr)) g_ptr->info |= CAVE_GLOW;
-                       else if (!(d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS))
-                       {
-                               DIRECTION ii;
-                               POSITION yyy, xxx;
-                               grid_type *cc_ptr;
-
-                               for (ii = 0; ii < 9; ii++)
-                               {
-                                       yyy = yy + ddy_ddd[ii];
-                                       xxx = xx + ddx_ddd[ii];
-                                       if (!in_bounds2(yyy, xxx)) continue;
-                                       cc_ptr = &current_floor_ptr->grid_array[yyy][xxx];
-                                       if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
-                                       {
-                                               g_ptr->info |= CAVE_GLOW;
-                                               break;
-                                       }
-                               }
-                       }
-               }
-       }
-
-       /* Mega-Hack -- Forget the view and lite */
-       p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
-       p_ptr->redraw |= (PR_HEALTH | PR_UHEALTH | PR_MAP);
-       p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-       if (p_ptr->special_defense & NINJA_S_STEALTH)
-       {
-               if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
-       }
-
-       /* Success */
-       return (TRUE);
-}
-
-/*!
- * @brief 地震処理(プレイヤーの中心発動) /
- * Induce an "earthquake" of the given radius at the given location.
- * @return 効力があった場合TRUEを返す
- * @param cy 中心Y座標
- * @param cx 中心X座標
- * @param r 効果半径
- */
-bool earthquake(POSITION cy, POSITION cx, POSITION r)
-{
-       return earthquake_aux(cy, cx, r, 0);
-}
-
 /*!
  * @brief ペット爆破処理 /
  * @return なし
@@ -2092,9 +1371,9 @@ void discharge_minion(void)
        MONSTER_IDX i;
        bool okay = TRUE;
 
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
                if (m_ptr->nickname) okay = FALSE;
        }
@@ -2103,10 +1382,10 @@ void discharge_minion(void)
                if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
                        return;
        }
-       for (i = 1; i < m_max; i++)
+       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
        {
                HIT_POINT dam;
-               monster_type *m_ptr = &current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr;
 
                if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
@@ -2133,7 +1412,7 @@ void discharge_minion(void)
                        GAME_TEXT m_name[MAX_NLEN];
 
                        monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
+                       exe_write_diary(p_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
                }
 
                delete_monster_idx(i);
@@ -2167,7 +1446,7 @@ static void cave_temp_room_lite(void)
                POSITION y = tmp_pos.y[i];
                POSITION x = tmp_pos.x[i];
 
-               grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+               grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
                /* No longer in the array */
                g_ptr->info &= ~(CAVE_TEMP);
@@ -2182,9 +1461,9 @@ static void cave_temp_room_lite(void)
                if (g_ptr->m_idx)
                {
                        PERCENTAGE chance = 25;
-                       monster_type    *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+                       monster_type    *m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
                        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-                       update_monster(g_ptr->m_idx, FALSE);
+                       update_monster(p_ptr, g_ptr->m_idx, FALSE);
 
                        /* Stupid monsters rarely wake up */
                        if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
@@ -2210,7 +1489,7 @@ static void cave_temp_room_lite(void)
 
                note_spot(y, x);
                lite_spot(y, x);
-               update_local_illumination(y, x);
+               update_local_illumination(p_ptr, y, x);
        }
 
        /* None left */
@@ -2242,7 +1521,7 @@ static void cave_temp_room_unlite(void)
                POSITION x = tmp_pos.x[i];
                int j;
 
-               grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
+               grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
                bool do_dark = !is_mirror_grid(g_ptr);
 
                /* No longer in the array */
@@ -2251,16 +1530,16 @@ static void cave_temp_room_unlite(void)
                /* Darken the grid */
                if (do_dark)
                {
-                       if (current_floor_ptr->dun_level || !is_daytime())
+                       if (p_ptr->current_floor_ptr->dun_level || !is_daytime())
                        {
                                for (j = 0; j < 9; j++)
                                {
                                        POSITION by = y + ddy_ddd[j];
                                        POSITION bx = x + ddx_ddd[j];
 
-                                       if (in_bounds2(by, bx))
+                                       if (in_bounds2(p_ptr->current_floor_ptr, by, bx))
                                        {
-                                               grid_type *cc_ptr = &current_floor_ptr->grid_array[by][bx];
+                                               grid_type *cc_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx];
 
                                                if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                                {
@@ -2286,11 +1565,11 @@ static void cave_temp_room_unlite(void)
                        /* Process affected monsters */
                        if (g_ptr->m_idx)
                        {
-                               update_monster(g_ptr->m_idx, FALSE);
+                               update_monster(p_ptr, g_ptr->m_idx, FALSE);
                        }
 
                        lite_spot(y, x);
-                       update_local_illumination(y, x);
+                       update_local_illumination(p_ptr, y, x);
                }
        }
 
@@ -2374,7 +1653,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
 static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
 {
        grid_type *g_ptr;
-       g_ptr = &current_floor_ptr->grid_array[y][x];
+       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
        /* Avoid infinite recursion */
        if (g_ptr->info & (CAVE_TEMP)) return;
@@ -2385,7 +1664,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
                if (only_room) return;
 
                /* Verify */
-               if (!in_bounds2(y, x)) return;
+               if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return;
 
                /* Do not exceed the maximum spell range */
                if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
@@ -2399,7 +1678,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
                 * properly.
                 * This leaves only a check for 6 bounding walls!
                 */
-               if (in_bounds(y, x) && pass_bold(y, x) &&
+               if (in_bounds(p_ptr->current_floor_ptr, y, x) && pass_bold(y, x) &&
                    (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
        }
 
@@ -2423,7 +1702,7 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
  */
 static bool cave_pass_lite_bold(POSITION y, POSITION x)
 {
-       return cave_los_bold(y, x);
+       return cave_los_bold(p_ptr->current_floor_ptr, y, x);
 }
 
 /*!
@@ -2501,7 +1780,7 @@ void lite_room(POSITION y1, POSITION x1)
 
        if (p_ptr->special_defense & NINJA_S_STEALTH)
        {
-               if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(FALSE);
+               if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE);
        }
 }
 
@@ -2564,7 +1843,7 @@ bool starlight(bool magic)
                {
                        scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
                        if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
-                       if (!player_bold(y, x)) break;
+                       if (!player_bold(p_ptr, y, x)) break;
                }
 
                project(0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
@@ -2873,7 +2152,7 @@ bool teleport_swap(DIRECTION dir)
                tx = p_ptr->x + ddx[dir];
                ty = p_ptr->y + ddy[dir];
        }
-       g_ptr = &current_floor_ptr->grid_array[ty][tx];
+       g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
 
        if (p_ptr->anti_tele)
        {
@@ -2893,7 +2172,7 @@ bool teleport_swap(DIRECTION dir)
                return FALSE;
        }
 
-       m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+       m_ptr = &p_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
        (void)set_monster_csleep(g_ptr->m_idx, 0);
@@ -2908,7 +2187,7 @@ bool teleport_swap(DIRECTION dir)
        sound(SOUND_TELEPORT);
 
        /* Swap the player and monster */
-       (void)move_player_effect(ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(p_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 
        /* Success */
        return TRUE;
@@ -3279,7 +2558,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        if (!(*count))
                        {
                                msg_print(_("地面が揺れた...", "The ground trembles..."));
-                               earthquake(p_ptr->y, p_ptr->x, 5 + randint0(10));
+                               earthquake(p_ptr, p_ptr->y, p_ptr->x, 5 + randint0(10), 0);
                                if (!one_in_(6)) break;
                        }
                case 30: case 31:
@@ -3288,7 +2567,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                                HIT_POINT dam = damroll(10, 10);
                                msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
                                project(0, 8, p_ptr->y, p_ptr->x, dam, GF_MANA, flg, -1);
-                               take_hit(DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
+                               take_hit(p_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
                                if (!one_in_(6)) break;
                        }
                case 32: case 33:
@@ -3305,7 +2584,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        if (!randint0(7))
                        {
                                project(0, 7, p_ptr->y, p_ptr->x, 50, GF_KILL_WALL, flg, -1);
-                               take_hit(DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
+                               take_hit(p_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
                        }
                        if (!one_in_(6)) break;
                case 1: case 2: case 3: case 16: case 17:
@@ -3315,11 +2594,11 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        (*count) += activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
                        if (!one_in_(6)) break;
                case 7: case 8: case 9: case 18:
-                       (*count) += summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+                       (*count) += summon_specific(0, p_ptr->y, p_ptr->x, p_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        if (!one_in_(6)) break;
                case 10: case 11: case 12:
                        msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
-                       lose_exp(p_ptr->exp / 16);
+                       lose_exp(p_ptr, p_ptr->exp / 16);
                        if (!one_in_(6)) break;
                case 13: case 14: case 15: case 19: case 20:
                        if (stop_ty || (p_ptr->free_act && (randint1(125) < p_ptr->skill_sav)) || (p_ptr->pclass == CLASS_BERSERKER))
@@ -3330,24 +2609,24 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        {
                                msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
                                if (p_ptr->free_act)
-                                       set_paralyzed(p_ptr->paralyzed + randint1(3));
+                                       set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(3));
                                else
-                                       set_paralyzed(p_ptr->paralyzed + randint1(13));
+                                       set_paralyzed(p_ptr, p_ptr->paralyzed + randint1(13));
                                stop_ty = TRUE;
                        }
                        if (!one_in_(6)) break;
                case 21: case 22: case 23:
-                       (void)do_dec_stat(randint0(6));
+                       (void)do_dec_stat(p_ptr, randint0(6));
                        if (!one_in_(6)) break;
                case 24:
                        msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
-                       lose_all_info();
+                       lose_all_info(p_ptr);
                        if (!one_in_(6)) break;
                case 25:
                        /*
                         * Only summon Cyberdemons deep in the dungeon.
                         */
-                       if ((current_floor_ptr->dun_level > 65) && !stop_ty)
+                       if ((p_ptr->current_floor_ptr->dun_level > 65) && !stop_ty)
                        {
                                (*count) += summon_cyber(-1, p_ptr->y, p_ptr->x);
                                stop_ty = TRUE;
@@ -3359,7 +2638,7 @@ bool activate_ty_curse(bool stop_ty, int *count)
                        {
                                do
                                {
-                                       (void)do_dec_stat(i);
+                                       (void)do_dec_stat(p_ptr, i);
                                }
                                while (one_in_(2));
 
@@ -3402,58 +2681,58 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
 
        if (!pet) mode |= PM_NO_PET;
 
-       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level);
+       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : p_ptr->current_floor_ptr->dun_level);
 
-       for (i = 0; i < (randint1(7) + (current_floor_ptr->dun_level / 40)); i++)
+       for (i = 0; i < (randint1(7) + (p_ptr->current_floor_ptr->dun_level / 40)); i++)
        {
-               switch (randint1(25) + (current_floor_ptr->dun_level / 20))
+               switch (randint1(25) + (p_ptr->current_floor_ptr->dun_level / 20))
                {
                        case 1: case 2:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
                                break;
                        case 3: case 4:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
                                break;
                        case 5: case 6:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
                                break;
                        case 7: case 8:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
                                break;
                        case 9: case 10:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
                                break;
                        case 11: case 12:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
                                break;
                        case 13: case 14:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
                                break;
                        case 15: case 16:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
                                break;
                        case 17:
                                if (can_pet) break;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE), '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
                                break;
                        case 18: case 19:
                                if (can_pet) break;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE), '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
                                break;
                        case 20: case 21:
                                if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
                                break;
                        case 22: case 23:
                                if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
                                break;
                        case 24:
-                               count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
                                break;
                        default:
                                if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode, '\0');
+                               count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
                }
        }
 
@@ -3478,7 +2757,7 @@ void wall_breaker(void)
 
                        if (!cave_have_flag_bold(y, x, FF_PROJECT)) continue;
 
-                       if (!player_bold(y, x)) break;
+                       if (!player_bold(p_ptr, y, x)) break;
                }
 
                project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
@@ -3486,7 +2765,7 @@ void wall_breaker(void)
        }
        else if (randint1(100) > 30)
        {
-               earthquake(p_ptr->y, p_ptr->x, 1);
+               earthquake(p_ptr, p_ptr->y, p_ptr->x, 1, 0);
        }
        else
        {
@@ -3498,7 +2777,7 @@ void wall_breaker(void)
                        {
                                scatter(&y, &x, p_ptr->y, p_ptr->x, 10, 0);
 
-                               if (!player_bold(y, x)) break;
+                               if (!player_bold(p_ptr, y, x)) break;
                        }
 
                        project(0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
@@ -3740,7 +3019,7 @@ bool rush_attack(bool *mdeath)
                ty = target_row;
        }
 
-       if (in_bounds(ty, tx)) tm_idx = current_floor_ptr->grid_array[ty][tx].m_idx;
+       if (in_bounds(p_ptr->current_floor_ptr, ty, tx)) tm_idx = p_ptr->current_floor_ptr->grid_array[ty][tx].m_idx;
 
        path_n = project_path(path_g, project_length, p_ptr->y, p_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
        project_length = 0;
@@ -3760,7 +3039,7 @@ bool rush_attack(bool *mdeath)
                int ny = GRID_Y(path_g[i]);
                int nx = GRID_X(path_g[i]);
 
-               if (cave_empty_bold(ny, nx) && player_can_enter(current_floor_ptr->grid_array[ny][nx].feat, 0))
+               if (cave_empty_bold(p_ptr->current_floor_ptr, ny, nx) && player_can_enter(p_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0))
                {
                        ty = ny;
                        tx = nx;
@@ -3769,7 +3048,7 @@ bool rush_attack(bool *mdeath)
                        continue;
                }
 
-               if (!current_floor_ptr->grid_array[ny][nx].m_idx)
+               if (!p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
                {
                        if (tm_idx)
                        {
@@ -3785,13 +3064,13 @@ bool rush_attack(bool *mdeath)
                }
 
                /* Move player before updating the monster */
-               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
-               update_monster(current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
+               if (!player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
+               update_monster(p_ptr, p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
 
                /* Found a monster */
-               m_ptr = &current_floor_ptr->m_list[current_floor_ptr->grid_array[ny][nx].m_idx];
+               m_ptr = &p_ptr->current_floor_ptr->m_list[p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx];
 
-               if (tm_idx != current_floor_ptr->grid_array[ny][nx].m_idx)
+               if (tm_idx != p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
                {
 #ifdef JP
                        msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
@@ -3799,7 +3078,7 @@ bool rush_attack(bool *mdeath)
                        msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
 #endif
                }
-               else if (!player_bold(ty, tx))
+               else if (!player_bold(p_ptr, ty, tx))
                {
                        /* Hold the monster name */
                        GAME_TEXT m_name[MAX_NLEN];
@@ -3809,14 +3088,14 @@ bool rush_attack(bool *mdeath)
                        msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
                }
 
-               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+               if (!player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
                moved = TRUE;
-               tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
+               tmp_mdeath = py_attack(p_ptr, ny, nx, HISSATSU_NYUSIN);
 
                break;
        }
 
-       if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, TELEPORT_NONMAGICAL);
+       if (!moved && !player_bold(p_ptr, ty, tx)) teleport_player_to(p_ptr, ty, tx, TELEPORT_NONMAGICAL);
 
        if (mdeath) *mdeath = tmp_mdeath;
        return TRUE;
@@ -3832,11 +3111,11 @@ void remove_all_mirrors(bool explode)
 {
        POSITION x, y;
 
-       for (x = 0; x < current_floor_ptr->width; x++)
+       for (x = 0; x < p_ptr->current_floor_ptr->width; x++)
        {
-               for (y = 0; y < current_floor_ptr->height; y++)
+               for (y = 0; y < p_ptr->current_floor_ptr->height; y++)
                {
-                       if (is_mirror_grid(&current_floor_ptr->grid_array[y][x]))
+                       if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[y][x]))
                        {
                                remove_mirror(y, x);
                                if (explode)
@@ -3853,7 +3132,7 @@ void remove_all_mirrors(bool explode)
  * @param dir 発動の方向ID
  * @return なし
  */
-void ring_of_power(DIRECTION dir)
+void ring_of_power(player_type *caster_ptr, DIRECTION dir)
 {
        /* Pick a random effect */
        switch (randint1(10))
@@ -3865,17 +3144,17 @@ void ring_of_power(DIRECTION dir)
                sound(SOUND_EVIL);
 
                /* Decrease all stats (permanently) */
-               (void)dec_stat(A_STR, 50, TRUE);
-               (void)dec_stat(A_INT, 50, TRUE);
-               (void)dec_stat(A_WIS, 50, TRUE);
-               (void)dec_stat(A_DEX, 50, TRUE);
-               (void)dec_stat(A_CON, 50, TRUE);
-               (void)dec_stat(A_CHR, 50, TRUE);
+               (void)dec_stat(caster_ptr, A_STR, 50, TRUE);
+               (void)dec_stat(caster_ptr, A_INT, 50, TRUE);
+               (void)dec_stat(caster_ptr, A_WIS, 50, TRUE);
+               (void)dec_stat(caster_ptr, A_DEX, 50, TRUE);
+               (void)dec_stat(caster_ptr, A_CON, 50, TRUE);
+               (void)dec_stat(caster_ptr, A_CHR, 50, TRUE);
 
                /* Lose some experience (permanently) */
-               p_ptr->exp -= (p_ptr->exp / 4);
-               p_ptr->max_exp -= (p_ptr->exp / 4);
-               check_experience();
+               caster_ptr->exp -= (caster_ptr->exp / 4);
+               caster_ptr->max_exp -= (caster_ptr->exp / 4);
+               check_experience(caster_ptr);
 
                break;
        }
@@ -3967,7 +3246,7 @@ void wild_magic(int spell)
                aggravate_monsters(0);
                break;
        case 26:
-               earthquake(p_ptr->y, p_ptr->x, 5);
+               earthquake(p_ptr, p_ptr->y, p_ptr->x, 5, 0);
                break;
        case 27:
        case 28:
@@ -3975,10 +3254,10 @@ void wild_magic(int spell)
                break;
        case 29:
        case 30:
-               apply_disenchant(1);
+               apply_disenchant(p_ptr, 1);
                break;
        case 31:
-               lose_all_info();
+               lose_all_info(p_ptr);
                break;
        case 32:
                fire_ball(GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
@@ -3990,7 +3269,7 @@ void wild_magic(int spell)
        case 35:
                while (counter++ < 8)
                {
-                       (void)summon_specific(0, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET), '\0');
+                       (void)summon_specific(0, p_ptr->y, p_ptr->x, (p_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
                }
                break;
        case 36:
@@ -4043,7 +3322,7 @@ void cast_meteor(HIT_POINT dam, POSITION rad)
 
                        if (d >= 9) continue;
 
-                       if (!in_bounds(y, x) || !projectable(p_ptr->y, p_ptr->x, y, x)
+                       if (!in_bounds(p_ptr->current_floor_ptr, y, x) || !projectable(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, y, x)
                                || !cave_have_flag_bold(y, x, FF_PROJECT)) continue;
 
                        /* Valid position */
@@ -4103,7 +3382,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
                if (!cave_have_flag_bold(ny, nx, FF_PROJECT)) break;
 
                /* Stopped by monsters */
-               if ((dir != 5) && current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
+               if ((dir != 5) && p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
 
                /* Save the new location */
                x = nx;
@@ -4135,7 +3414,7 @@ bool cast_wrath_of_the_god(HIT_POINT dam, POSITION rad)
                if (count < 0) continue;
 
                /* Cannot penetrate perm walls */
-               if (!in_bounds(y, x) ||
+               if (!in_bounds(p_ptr->current_floor_ptr, y, x) ||
                        cave_stop_disintegration(y, x) ||
                        !in_disintegration_range(ty, tx, y, x))
                        continue;
@@ -4161,7 +3440,7 @@ void cast_wonder(DIRECTION dir)
 {
        PLAYER_LEVEL plev = p_ptr->lev;
        int die = randint1(100) + plev / 5;
-       int vir = virtue_number(V_CHANCE);
+       int vir = virtue_number(p_ptr, V_CHANCE);
 
        if (vir)
        {
@@ -4176,7 +3455,7 @@ void cast_wonder(DIRECTION dir)
        }
 
        if (die < 26)
-               chg_virtue(V_CHANCE, 1);
+               chg_virtue(p_ptr, V_CHANCE, 1);
 
        if (die > 100)
        {
@@ -4213,11 +3492,11 @@ void cast_wonder(DIRECTION dir)
        else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
        else if (die < 104)
        {
-               earthquake(p_ptr->y, p_ptr->x, 12);
+               earthquake(p_ptr, p_ptr->y, p_ptr->x, 12, 0);
        }
        else if (die < 106)
        {
-               (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
+               (void)destroy_area(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
        }
        else if (die < 108)
        {
@@ -4229,7 +3508,7 @@ void cast_wonder(DIRECTION dir)
                dispel_monsters(150);
                slow_monsters(plev);
                sleep_monsters(plev);
-               hp_player(300);
+               hp_player(p_ptr, 300);
        }
 }
 
@@ -4239,27 +3518,27 @@ void cast_wonder(DIRECTION dir)
 * @param dir 方向ID
 * @return なし
 */
-void cast_invoke_spirits(DIRECTION dir)
+void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
 {
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = caster_ptr->lev;
        int die = randint1(100) + plev / 5;
-       int vir = virtue_number(V_CHANCE);
+       int vir = virtue_number(caster_ptr, V_CHANCE);
 
        if (vir)
        {
-               if (p_ptr->virtues[vir - 1] > 0)
+               if (caster_ptr->virtues[vir - 1] > 0)
                {
-                       while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
+                       while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
                }
                else
                {
-                       while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
+                       while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
                }
        }
 
        msg_print(_("あなたは死者たちの力を招集した...", "You call on the power of the dead..."));
        if (die < 26)
-               chg_virtue(V_CHANCE, 1);
+               chg_virtue(caster_ptr, V_CHANCE, 1);
 
        if (die > 100)
        {
@@ -4271,21 +3550,21 @@ void cast_invoke_spirits(DIRECTION dir)
                msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
                        "Oh no! Mouldering forms rise from the earth around you!"));
 
-               (void)summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
-               chg_virtue(V_UNLIFE, 1);
+               (void)summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+               chg_virtue(caster_ptr, V_UNLIFE, 1);
        }
        else if (die < 14)
        {
                msg_print(_("名状し難い邪悪な存在があなたの心を通り過ぎて行った...", "An unnamable evil brushes against your mind..."));
 
-               set_afraid(p_ptr->afraid + randint1(4) + 4);
+               set_afraid(caster_ptr, caster_ptr->afraid + randint1(4) + 4);
        }
        else if (die < 26)
        {
                msg_print(_("あなたの頭に大量の幽霊たちの騒々しい声が押し寄せてきた...",
                        "Your head is invaded by a horde of gibbering spectral voices..."));
 
-               set_confused(p_ptr->confused + randint1(4) + 4);
+               set_confused(caster_ptr, caster_ptr->confused + randint1(4) + 4);
        }
        else if (die < 31)
        {
@@ -4354,11 +3633,11 @@ void cast_invoke_spirits(DIRECTION dir)
        }
        else if (die < 104)
        {
-               earthquake(p_ptr->y, p_ptr->x, 12);
+               earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
        }
        else if (die < 106)
        {
-               (void)destroy_area(p_ptr->y, p_ptr->x, 13 + randint0(5), FALSE);
+               (void)destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
        }
        else if (die < 108)
        {
@@ -4373,7 +3652,7 @@ void cast_invoke_spirits(DIRECTION dir)
                dispel_monsters(150);
                slow_monsters(plev);
                sleep_monsters(plev);
-               hp_player(300);
+               hp_player(caster_ptr, 300);
        }
 
        if (die < 31)
@@ -4387,18 +3666,18 @@ void cast_invoke_spirits(DIRECTION dir)
 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
 * @return なし
 */
-void cast_shuffle(void)
+void cast_shuffle(player_type *caster_ptr)
 {
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = caster_ptr->lev;
        DIRECTION dir;
        int die;
-       int vir = virtue_number(V_CHANCE);
+       int vir = virtue_number(caster_ptr, V_CHANCE);
        int i;
 
        /* Card sharks and high mages get a level bonus */
-       if ((p_ptr->pclass == CLASS_ROGUE) ||
-               (p_ptr->pclass == CLASS_HIGH_MAGE) ||
-               (p_ptr->pclass == CLASS_SORCERER))
+       if ((caster_ptr->pclass == CLASS_ROGUE) ||
+               (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
+               (caster_ptr->pclass == CLASS_SORCERER))
                die = (randint1(110)) + plev / 5;
        else
                die = randint1(120);
@@ -4406,32 +3685,32 @@ void cast_shuffle(void)
 
        if (vir)
        {
-               if (p_ptr->virtues[vir - 1] > 0)
+               if (caster_ptr->virtues[vir - 1] > 0)
                {
-                       while (randint1(400) < p_ptr->virtues[vir - 1]) die++;
+                       while (randint1(400) < caster_ptr->virtues[vir - 1]) die++;
                }
                else
                {
-                       while (randint1(400) < (0 - p_ptr->virtues[vir - 1])) die--;
+                       while (randint1(400) < (0 - caster_ptr->virtues[vir - 1])) die--;
                }
        }
 
        msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
 
        if (die < 30)
-               chg_virtue(V_CHANCE, 1);
+               chg_virtue(caster_ptr, V_CHANCE, 1);
 
        if (die < 7)
        {
                msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
 
                for (i = 0; i < randint1(3); i++)
-                       activate_hi_summon(p_ptr->y, p_ptr->x, FALSE);
+                       activate_hi_summon(caster_ptr->y, caster_ptr->x, FALSE);
        }
        else if (die < 14)
        {
                msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
-               summon_specific(0, p_ptr->y, p_ptr->x, current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET), '\0');
+               summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
        }
        else if (die < 18)
        {
@@ -4447,13 +3726,13 @@ void cast_shuffle(void)
        else if (die < 26)
        {
                msg_print(_("《愚者》だ。", "It's the Fool."));
-               do_dec_stat(A_INT);
-               do_dec_stat(A_WIS);
+               do_dec_stat(caster_ptr, A_INT);
+               do_dec_stat(caster_ptr, A_WIS);
        }
        else if (die < 30)
        {
                msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
-               trump_summoning(1, FALSE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
+               trump_summoning(1, FALSE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
        }
        else if (die < 33)
        {
@@ -4473,7 +3752,7 @@ void cast_shuffle(void)
        else if (die < 42)
        {
                msg_print(_("《正義》だ。", "It's Justice."));
-               set_blessed(p_ptr->lev, FALSE);
+               set_blessed(caster_ptr, caster_ptr->lev, FALSE);
        }
        else if (die < 47)
        {
@@ -4499,34 +3778,34 @@ void cast_shuffle(void)
        {
                msg_print(_("《塔》だ。", "It's the Tower."));
 
-               earthquake(p_ptr->y, p_ptr->x, 5);
+               earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
        }
        else if (die < 82)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
+               trump_summoning(1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
        }
        else if (die < 84)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
+               trump_summoning(1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
        }
        else if (die < 86)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
+               trump_summoning(1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
        }
        else if (die < 88)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(1, TRUE, p_ptr->y, p_ptr->x, (current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
+               trump_summoning(1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
        }
        else if (die < 96)
        {
                msg_print(_("《恋人》だ。", "It's the Lovers."));
 
                if (get_aim_dir(&dir))
-                       charm_monster(dir, MIN(p_ptr->lev, 20));
+                       charm_monster(dir, MIN(caster_ptr->lev, 20));
        }
        else if (die < 101)
        {
@@ -4536,25 +3815,25 @@ void cast_shuffle(void)
        else if (die < 111)
        {
                msg_print(_("《審判》だ。", "It's the Judgement."));
-               roll_hitdice(p_ptr, 0L);
-               lose_all_mutations();
+               roll_hitdice(caster_ptr, 0L);
+               lose_all_mutations(caster_ptr);
        }
        else if (die < 120)
        {
                msg_print(_("《太陽》だ。", "It's the Sun."));
-               chg_virtue(V_KNOWLEDGE, 1);
-               chg_virtue(V_ENLIGHTEN, 1);
-               wiz_lite(FALSE);
+               chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
+               chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
+               wiz_lite(caster_ptr, FALSE);
        }
        else
        {
                msg_print(_("《世界》だ。", "It's the World."));
-               if (p_ptr->exp < PY_MAX_EXP)
+               if (caster_ptr->exp < PY_MAX_EXP)
                {
-                       s32b ee = (p_ptr->exp / 25) + 1;
+                       s32b ee = (caster_ptr->exp / 25) + 1;
                        if (ee > 5000) ee = 5000;
                        msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
-                       gain_exp(ee);
+                       gain_exp(caster_ptr, ee);
                }
        }
 }
@@ -4565,19 +3844,19 @@ void cast_shuffle(void)
  */
 void stop_mouth(void)
 {
-       if (music_singing_any()) stop_singing(p_ptr);
-       if (hex_spelling_any()) stop_hex_spell_all();
+       if (music_singing_any(p_ptr)) stop_singing(p_ptr);
+       if (hex_spelling_any(p_ptr)) stop_hex_spell_all();
 }
 
 
-bool_hack vampirism(void)
+bool_hack vampirism(player_type *caster_ptr)
 {
        DIRECTION dir;
        POSITION x, y;
        int dummy;
        grid_type *g_ptr;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
        {
                msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
                return FALSE;
@@ -4585,9 +3864,9 @@ bool_hack vampirism(void)
 
        /* Only works on adjacent monsters */
        if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
-       y = p_ptr->y + ddy[dir];
-       x = p_ptr->x + ddx[dir];
-       g_ptr = &current_floor_ptr->grid_array[y][x];
+       y = caster_ptr->y + ddy[dir];
+       x = caster_ptr->x + ddx[dir];
+       g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
 
        stop_mouth();
 
@@ -4599,13 +3878,13 @@ bool_hack vampirism(void)
 
        msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
 
-       dummy = p_ptr->lev * 2;
+       dummy = caster_ptr->lev * 2;
 
        if (hypodynamic_bolt(dir, dummy))
        {
-               if (p_ptr->food < PY_FOOD_FULL)
+               if (caster_ptr->food < PY_FOOD_FULL)
                        /* No heal if we are "full" */
-                       (void)hp_player(dummy);
+                       (void)hp_player(caster_ptr, dummy);
                else
                        msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
 
@@ -4613,9 +3892,9 @@ bool_hack vampirism(void)
                /* A Food ration gives 5000 food points (by contrast) */
                /* Don't ever get more than "Full" this way */
                /* But if we ARE Gorged,  it won't cure us */
-               dummy = p_ptr->food + MIN(5000, 100 * dummy);
-               if (p_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
-                       (void)set_food(dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
+               dummy = caster_ptr->food + MIN(5000, 100 * dummy);
+               if (caster_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
+                       (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
        }
        else
                msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
@@ -4630,9 +3909,9 @@ bool panic_hit(void)
        if (!get_direction(&dir, FALSE, FALSE)) return FALSE;
        y = p_ptr->y + ddy[dir];
        x = p_ptr->x + ddx[dir];
-       if (current_floor_ptr->grid_array[y][x].m_idx)
+       if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx)
        {
-               py_attack(y, x, 0);
+               py_attack(p_ptr, y, x, 0);
                if (randint0(p_ptr->skill_dis) < 7)
                        msg_print(_("うまく逃げられなかった。", "You failed to run away."));
                else
@@ -4649,7 +3928,7 @@ bool panic_hit(void)
 }
 
 /*!
-* @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
+* @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the p_ptr->inventory_list (or on the floor)
 * @return なし
 * @note
 * currently this function allows pseudo-id of any object,
@@ -4672,7 +3951,7 @@ bool psychometry(void)
        q = _("どのアイテムを調べますか?", "Meditate on which item? ");
        s = _("調べるアイテムがありません。", "You have nothing appropriate.");
 
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT));
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return (FALSE);
 
        /* It is fully known, no information needed */
@@ -4933,11 +4212,11 @@ void hayagake(player_type *creature_ptr)
 {
        if (creature_ptr->action == ACTION_HAYAGAKE)
        {
-               set_action(ACTION_NONE);
+               set_action(creature_ptr, ACTION_NONE);
        }
        else
        {
-               grid_type *g_ptr = &current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
+               grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
                feature_type *f_ptr = &f_info[g_ptr->feat];
 
                if (!have_flag(f_ptr->flags, FF_PROJECT) ||
@@ -4947,7 +4226,7 @@ void hayagake(player_type *creature_ptr)
                }
                else
                {
-                       set_action(ACTION_HAYAGAKE);
+                       set_action(creature_ptr, ACTION_HAYAGAKE);
                }
        }
        creature_ptr->energy_use = 0;
@@ -4961,7 +4240,7 @@ bool double_attack(player_type *creature_ptr)
        if (!get_rep_dir(&dir, FALSE)) return FALSE;
        y = creature_ptr->y + ddy[dir];
        x = creature_ptr->x + ddx[dir];
-       if (current_floor_ptr->grid_array[y][x].m_idx)
+       if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
        {
                if (one_in_(3))
                        msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
@@ -4973,11 +4252,11 @@ bool double_attack(player_type *creature_ptr)
                        msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
                                "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
 
-               py_attack(y, x, 0);
-               if (current_floor_ptr->grid_array[y][x].m_idx)
+               py_attack(creature_ptr, y, x, 0);
+               if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                {
                        handle_stuff();
-                       py_attack(y, x, 0);
+                       py_attack(creature_ptr, y, x, 0);
                }
                creature_ptr->energy_need += ENERGY_NEED();
        }
@@ -4991,7 +4270,7 @@ bool double_attack(player_type *creature_ptr)
 
 bool comvert_hp_to_mp(player_type *creature_ptr)
 {
-       int gain_sp = take_hit(DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
+       int gain_sp = take_hit(p_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
        if (gain_sp)
        {
                creature_ptr->csp += gain_sp;
@@ -5014,7 +4293,7 @@ bool comvert_mp_to_hp(player_type *creature_ptr)
        if (creature_ptr->csp >= creature_ptr->lev / 5)
        {
                creature_ptr->csp -= creature_ptr->lev / 5;
-               hp_player(creature_ptr->lev);
+               hp_player(p_ptr, creature_ptr->lev);
        }
        else
        {
@@ -5042,7 +4321,7 @@ bool mirror_concentration(player_type *creature_ptr)
                msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
                return FALSE;
        }
-       if (is_mirror_grid(&current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
+       if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
        {
                msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
 
@@ -5073,11 +4352,11 @@ bool sword_dancing(player_type *creature_ptr)
                dir = randint0(8);
                y = creature_ptr->y + ddy_ddd[dir];
                x = creature_ptr->x + ddx_ddd[dir];
-               g_ptr = &current_floor_ptr->grid_array[y][x];
+               g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
 
                /* Hack -- attack monsters */
                if (g_ptr->m_idx)
-                       py_attack(y, x, 0);
+                       py_attack(p_ptr, y, x, 0);
                else
                {
                        msg_print(_("攻撃が空をきった。", "You attack the empty air."));
@@ -5109,9 +4388,9 @@ bool rodeo(player_type *creature_ptr)
                msg_print(_("今は乗馬中だ。", "You ARE riding."));
                return FALSE;
        }
-       if (!do_riding(TRUE)) return TRUE;
+       if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
 
-       m_ptr = &current_floor_ptr->m_list[creature_ptr->riding];
+       m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        msg_format(_("%sに乗った。", "You ride on %s."), m_name);
@@ -5123,7 +4402,7 @@ bool rodeo(player_type *creature_ptr)
        if (r_ptr->flags1 & RF1_UNIQUE) rlev = rlev * 3 / 2;
        if (rlev > 60) rlev = 60 + (rlev - 60) / 2;
        if ((randint1(creature_ptr->skill_exp[GINOU_RIDING] / 120 + creature_ptr->lev * 2 / 3) > rlev)
-               && one_in_(2) && !creature_ptr->inside_arena && !creature_ptr->inside_battle
+               && one_in_(2) && !creature_ptr->current_floor_ptr->inside_arena && !creature_ptr->phase_out
                && !(r_ptr->flags7 & (RF7_GUARDIAN)) && !(r_ptr->flags1 & (RF1_QUESTOR))
                && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
        {
@@ -5133,7 +4412,7 @@ bool rodeo(player_type *creature_ptr)
        else
        {
                msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
-               rakuba(1, TRUE);
+               rakuba(p_ptr, 1, TRUE);
                /* 落馬処理に失敗してもとにかく乗馬解除 */
                creature_ptr->riding = 0;
        }