OSDN Git Service

[Refactor] #38997 teleport_player() に player_type * 引数を追加. / Add player_type * argume...
[hengband/hengband.git] / src / spells3.c
index 9673260..cab7594 100644 (file)
@@ -31,6 +31,7 @@
 #include "player-status.h"
 #include "player-class.h"
 #include "player-damage.h"
+#include "player-inventory.h"
 #include "spells-summon.h"
 #include "quest.h"
 #include "artifact.h"
@@ -57,8 +58,6 @@
 #include "autopick.h"
 #include "targeting.h"
 
-#include "spells-object.h" // temp for brand_weapon()
-
 
 /*! テレポート先探索の試行数 / Maximum number of tries for teleporting */
 #define MAX_TRIES 100
@@ -75,7 +74,7 @@
  * Attempt to move the monster at least "dis/2" grids away.
  * But allow variation to prevent infinite loops.
  */
-bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
+bool teleport_away(player_type *caster_ptr, MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
 {
        POSITION oy, ox, d, i, min;
        int tries = 0;
@@ -83,7 +82,7 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
 
        bool look = TRUE;
 
-       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
        if (!monster_is_valid(m_ptr)) return (FALSE);
 
        oy = m_ptr->fy;
@@ -93,10 +92,10 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
        min = dis / 2;
 
        if ((mode & TELEPORT_DEC_VALOUR) &&
-           (((p_ptr->chp * 10) / p_ptr->mhp) > 5) &&
-               (4+randint1(5) < ((p_ptr->chp * 10) / p_ptr->mhp)))
+           (((caster_ptr->chp * 10) / caster_ptr->mhp) > 5) &&
+               (4+randint1(5) < ((caster_ptr->chp * 10) / caster_ptr->mhp)))
        {
-               chg_virtue(V_VALOUR, -1);
+               chg_virtue(caster_ptr, V_VALOUR, -1);
        }
 
        /* Look until done */
@@ -120,13 +119,13 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
                        }
 
                        /* Ignore illegal locations */
-                       if (!in_bounds(ny, nx)) continue;
+                       if (!in_bounds(caster_ptr->current_floor_ptr, ny, nx)) continue;
 
                        if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
 
                        /* No teleporting into vaults and such */
-                       if (!(p_ptr->inside_quest || p_ptr->inside_arena))
-                               if (current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue;
+                       if (!(caster_ptr->current_floor_ptr->inside_quest || caster_ptr->current_floor_ptr->inside_arena))
+                               if (caster_ptr->current_floor_ptr->grid_array[ny][nx].info & CAVE_ICKY) continue;
 
                        /* This grid looks good */
                        look = FALSE;
@@ -148,10 +147,10 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
        sound(SOUND_TPOTHER);
 
        /* Update the old location */
-       current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+       caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
 
        /* Update the new location */
-       current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
+       caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
 
        /* Move the monster */
        m_ptr->fy = ny;
@@ -160,12 +159,12 @@ bool teleport_away(MONSTER_IDX m_idx, POSITION dis, BIT_FLAGS mode)
        /* Forget the counter target */
        reset_target(m_ptr);
 
-       update_monster(m_idx, TRUE);
+       update_monster(caster_ptr, m_idx, TRUE);
        lite_spot(oy, ox);
        lite_spot(ny, nx);
 
        if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
-               p_ptr->update |= (PU_MON_LITE);
+               caster_ptr->update |= (PU_MON_LITE);
 
        return (TRUE);
 }
@@ -188,7 +187,7 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power,
        int attempts = 500;
        POSITION dis = 2;
        bool look = TRUE;
-       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
        if(!m_ptr->r_idx) return;
 
        /* "Skill" test */
@@ -221,12 +220,12 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power,
                        }
 
                        /* Ignore illegal locations */
-                       if (!in_bounds(ny, nx)) continue;
+                       if (!in_bounds(p_ptr->current_floor_ptr, ny, nx)) continue;
 
                        if (!cave_monster_teleportable_bold(m_idx, ny, nx, mode)) continue;
 
                        /* No teleporting into vaults and such */
-                       /* if (current_floor_ptr->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */
+                       /* if (p_ptr->current_floor_ptr->grid_array[ny][nx].info & (CAVE_ICKY)) continue; */
 
                        /* This grid looks good */
                        look = FALSE;
@@ -247,16 +246,16 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power,
        sound(SOUND_TPOTHER);
 
        /* Update the old location */
-       current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+       p_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
 
        /* Update the new location */
-       current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
+       p_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
 
        /* Move the monster */
        m_ptr->fy = ny;
        m_ptr->fx = nx;
 
-       update_monster(m_idx, TRUE);
+       update_monster(p_ptr, m_idx, TRUE);
        lite_spot(oy, ox);
        lite_spot(ny, nx);
 
@@ -287,21 +286,21 @@ void teleport_monster_to(MONSTER_IDX m_idx, POSITION ty, POSITION tx, int power,
  * </pre>
  */
 
-bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
+bool teleport_player_aux(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode)
 {
        int candidates_at[MAX_TELEPORT_DISTANCE + 1];
        int total_candidates, cur_candidates;
        POSITION y = 0, x = 0;
        int min, pick, i;
 
-       int left = MAX(1, p_ptr->x - dis);
-       int right = MIN(current_floor_ptr->width - 2, p_ptr->x + dis);
-       int top = MAX(1, p_ptr->y - dis);
-       int bottom = MIN(current_floor_ptr->height - 2, p_ptr->y + dis);
+       int left = MAX(1, creature_ptr->x - dis);
+       int right = MIN(creature_ptr->current_floor_ptr->width - 2, creature_ptr->x + dis);
+       int top = MAX(1, creature_ptr->y - dis);
+       int bottom = MIN(creature_ptr->current_floor_ptr->height - 2, creature_ptr->y + dis);
 
-       if (p_ptr->wild_mode) return FALSE;
+       if (creature_ptr->wild_mode) return FALSE;
 
-       if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
+       if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
        {
                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                return FALSE;
@@ -326,7 +325,7 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
                        if (!cave_player_teleportable_bold(y, x, mode)) continue;
 
                        /* Calculate distance */
-                       d = distance(p_ptr->y, p_ptr->x, y, x);
+                       d = distance(creature_ptr->y, creature_ptr->x, y, x);
 
                        /* Skip too far locations */
                        if (d > dis) continue;
@@ -365,7 +364,7 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
                        if (!cave_player_teleportable_bold(y, x, mode)) continue;
 
                        /* Calculate distance */
-                       d = distance(p_ptr->y, p_ptr->x, y, x);
+                       d = distance(creature_ptr->y, creature_ptr->x, y, x);
 
                        /* Skip too far locations */
                        if (d > dis) continue;
@@ -382,16 +381,16 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
                if (!pick) break;
        }
 
-       if (player_bold(y, x)) return FALSE;
+       if (player_bold(creature_ptr, y, x)) return FALSE;
 
        sound(SOUND_TELEPORT);
 
 #ifdef JP
-       if ((p_ptr->pseikaku == SEIKAKU_COMBAT) || (p_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
-               msg_format("『こっちだぁ、%s』", p_ptr->name);
+       if ((creature_ptr->pseikaku == SEIKAKU_COMBAT) || (creature_ptr->inventory_list[INVEN_BOW].name1 == ART_CRIMSON))
+               msg_format("『こっちだぁ、%s』", creature_ptr->name);
 #endif
 
-       (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(creature_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
        return TRUE;
 }
 
@@ -401,25 +400,25 @@ bool teleport_player_aux(POSITION dis, BIT_FLAGS mode)
  * @param mode オプション
  * @return なし
  */
-void teleport_player(POSITION dis, BIT_FLAGS mode)
+void teleport_player(player_type *creature_ptr, POSITION dis, BIT_FLAGS mode)
 {
        POSITION yy, xx;
-       POSITION oy = p_ptr->y;
-       POSITION ox = p_ptr->x;
+       POSITION oy = creature_ptr->y;
+       POSITION ox = creature_ptr->x;
 
-       if (!teleport_player_aux(dis, mode)) return;
+       if (!teleport_player_aux(creature_ptr, dis, mode)) return;
 
        /* Monsters with teleport ability may follow the player */
        for (xx = -1; xx < 2; xx++)
        {
                for (yy = -1; yy < 2; yy++)
                {
-                       MONSTER_IDX tmp_m_idx = current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
+                       MONSTER_IDX tmp_m_idx = creature_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
 
                        /* A monster except your mount may follow */
-                       if (tmp_m_idx && (p_ptr->riding != tmp_m_idx))
+                       if (tmp_m_idx && (creature_ptr->riding != tmp_m_idx))
                        {
-                               monster_type *m_ptr = &current_floor_ptr->m_list[tmp_m_idx];
+                               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[tmp_m_idx];
                                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                                /*
@@ -429,7 +428,7 @@ void teleport_player(POSITION dis, BIT_FLAGS mode)
                                if ((r_ptr->a_ability_flags2 & RF6_TPORT) &&
                                    !(r_ptr->flagsr & RFR_RES_TELE))
                                {
-                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, p_ptr->y, p_ptr->x, r_ptr->level, 0L);
+                                       if (!MON_CSLEEP(m_ptr)) teleport_monster_to(tmp_m_idx, creature_ptr->y, creature_ptr->x, r_ptr->level, 0L);
                                }
                        }
                }
@@ -449,19 +448,19 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis)
        POSITION oy = p_ptr->y;
        POSITION ox = p_ptr->x;
 
-       if (!teleport_player_aux(dis, TELEPORT_PASSIVE)) return;
+       if (!teleport_player_aux(p_ptr, dis, TELEPORT_PASSIVE)) return;
 
        /* Monsters with teleport ability may follow the player */
        for (xx = -1; xx < 2; xx++)
        {
                for (yy = -1; yy < 2; yy++)
                {
-                       MONSTER_IDX tmp_m_idx = current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
+                       MONSTER_IDX tmp_m_idx = p_ptr->current_floor_ptr->grid_array[oy+yy][ox+xx].m_idx;
 
                        /* A monster except your mount or caster may follow */
                        if (tmp_m_idx && (p_ptr->riding != tmp_m_idx) && (m_idx != tmp_m_idx))
                        {
-                               monster_type *m_ptr = &current_floor_ptr->m_list[tmp_m_idx];
+                               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[tmp_m_idx];
                                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                                /*
@@ -492,12 +491,12 @@ void teleport_player_away(MONSTER_IDX m_idx, POSITION dis)
  * This function allows teleporting into vaults (!)
  * </pre>
  */
-void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
+void teleport_player_to(player_type *creature_ptr, POSITION ny, POSITION nx, BIT_FLAGS mode)
 {
        POSITION y, x;
        POSITION dis = 0, ctr = 0;
 
-       if (p_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
+       if (creature_ptr->anti_tele && !(mode & TELEPORT_NONMAGICAL))
        {
                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                return;
@@ -511,11 +510,11 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
                {
                        y = (POSITION)rand_spread(ny, dis);
                        x = (POSITION)rand_spread(nx, dis);
-                       if (in_bounds(y, x)) break;
+                       if (in_bounds(creature_ptr->current_floor_ptr, y, x)) break;
                }
 
                /* Accept any grid when wizard mode */
-               if (p_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!current_floor_ptr->grid_array[y][x].m_idx || (current_floor_ptr->grid_array[y][x].m_idx == p_ptr->riding))) break;
+               if (current_world_ptr->wizard && !(mode & TELEPORT_PASSIVE) && (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx || (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx == creature_ptr->riding))) break;
 
                /* Accept teleportable floor grids */
                if (cave_player_teleportable_bold(y, x, mode)) break;
@@ -529,21 +528,21 @@ void teleport_player_to(POSITION ny, POSITION nx, BIT_FLAGS mode)
        }
 
        sound(SOUND_TELEPORT);
-       (void)move_player_effect(y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+       (void)move_player_effect(creature_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
 }
 
 
 void teleport_away_followable(MONSTER_IDX m_idx)
 {
-       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
        POSITION oldfy = m_ptr->fy;
        POSITION oldfx = m_ptr->fx;
        bool old_ml = m_ptr->ml;
        POSITION old_cdis = m_ptr->cdis;
 
-       teleport_away(m_idx, MAX_SIGHT * 2 + 5, 0L);
+       teleport_away(p_ptr, m_idx, MAX_SIGHT * 2 + 5, 0L);
 
-       if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->y, p_ptr->x, oldfy, oldfx))
+       if (old_ml && (old_cdis <= MAX_SIGHT) && !current_world_ptr->timewalk_m_idx && !p_ptr->phase_out && los(p_ptr->current_floor_ptr, p_ptr->y, p_ptr->x, oldfy, oldfx))
        {
                bool follow = FALSE;
 
@@ -575,10 +574,10 @@ void teleport_away_followable(MONSTER_IDX m_idx)
                        {
                                if (one_in_(3))
                                {
-                                       teleport_player(200, TELEPORT_PASSIVE);
+                                       teleport_player(p_ptr, 200, TELEPORT_PASSIVE);
                                        msg_print(_("失敗!", "Failed!"));
                                }
-                               else teleport_player_to(m_ptr->fy, m_ptr->fx, 0L);
+                               else teleport_player_to(p_ptr, m_ptr->fy, m_ptr->fx, 0L);
                                p_ptr->energy_need += ENERGY_NEED();
                        }
                }
@@ -594,11 +593,11 @@ bool teleport_level_other(player_type *creature_ptr)
        GAME_TEXT m_name[MAX_NLEN];
 
        if (!target_set(TARGET_KILL)) return FALSE;
-       target_m_idx = current_floor_ptr->grid_array[target_row][target_col].m_idx;
+       target_m_idx = p_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
        if (!target_m_idx) return TRUE;
-       if (!player_has_los_bold(target_row, target_col)) return TRUE;
-       if (!projectable(creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
-       m_ptr = &current_floor_ptr->m_list[target_m_idx];
+       if (!player_has_los_bold(p_ptr, target_row, target_col)) return TRUE;
+       if (!projectable(creature_ptr->current_floor_ptr, creature_ptr->y, creature_ptr->x, target_row, target_col)) return TRUE;
+       m_ptr = &p_ptr->current_floor_ptr->m_list[target_m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
        monster_desc(m_name, m_ptr, 0);
        msg_format(_("%^sの足を指さした。", "You gesture at %^s's feet."), m_name);
@@ -608,7 +607,7 @@ bool teleport_level_other(player_type *creature_ptr)
        {
                msg_format(_("しかし効果がなかった!", "%^s is unaffected!"), m_name);
        }
-       else teleport_level(target_m_idx);
+       else teleport_level(creature_ptr, target_m_idx);
        return TRUE;
 }
 
@@ -618,11 +617,11 @@ bool teleport_level_other(player_type *creature_ptr)
  * @param m_idx テレポートの対象となるモンスターID(0ならばプレイヤー) / If m_idx <= 0, target is player.
  * @return なし
  */
-void teleport_level(MONSTER_IDX m_idx)
+void teleport_level(player_type *creature_ptr, MONSTER_IDX m_idx)
 {
-       bool         go_up;
+       bool go_up;
        GAME_TEXT m_name[160];
-       bool         see_m = TRUE;
+       bool see_m = TRUE;
 
        if (m_idx <= 0) /* To player */
        {
@@ -630,7 +629,7 @@ void teleport_level(MONSTER_IDX m_idx)
        }
        else /* To monster */
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
 
                /* Get the monster name (or "it") */
                monster_desc(m_name, m_ptr, 0);
@@ -645,7 +644,7 @@ void teleport_level(MONSTER_IDX m_idx)
                return;
        }
 
-       if ((m_idx <= 0) && p_ptr->anti_tele) /* To player */
+       if ((m_idx <= 0) && creature_ptr->anti_tele) /* To player */
        {
                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                return;
@@ -655,14 +654,14 @@ void teleport_level(MONSTER_IDX m_idx)
        if (randint0(100) < 50) go_up = TRUE;
        else go_up = FALSE;
 
-       if ((m_idx <= 0) && p_ptr->wizard)
+       if ((m_idx <= 0) && current_world_ptr->wizard)
        {
                if (get_check("Force to go up? ")) go_up = TRUE;
                else if (get_check("Force to go down? ")) go_up = FALSE;
        }
 
        /* Down only */ 
-       if ((ironman_downward && (m_idx <= 0)) || (current_floor_ptr->dun_level <= d_info[p_ptr->dungeon_idx].mindepth))
+       if ((ironman_downward && (m_idx <= 0)) || (creature_ptr->current_floor_ptr->dun_level <= d_info[creature_ptr->dungeon_idx].mindepth))
        {
 #ifdef JP
                if (see_m) msg_format("%^sは床を突き破って沈んでいく。", m_name);
@@ -671,32 +670,32 @@ void teleport_level(MONSTER_IDX m_idx)
 #endif
                if (m_idx <= 0) /* To player */
                {
-                       if (!current_floor_ptr->dun_level)
+                       if (!creature_ptr->current_floor_ptr->dun_level)
                        {
-                               p_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : p_ptr->recall_dungeon;
-                               p_ptr->oldpy = p_ptr->y;
-                               p_ptr->oldpx = p_ptr->x;
+                               creature_ptr->dungeon_idx = ironman_downward ? DUNGEON_ANGBAND : creature_ptr->recall_dungeon;
+                               creature_ptr->oldpy = creature_ptr->y;
+                               creature_ptr->oldpx = creature_ptr->x;
                        }
 
-                       if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
 
                        if (autosave_l) do_cmd_save_game(TRUE);
 
-                       if (!current_floor_ptr->dun_level)
+                       if (!creature_ptr->current_floor_ptr->dun_level)
                        {
-                               current_floor_ptr->dun_level = d_info[p_ptr->dungeon_idx].mindepth;
+                               creature_ptr->current_floor_ptr->dun_level = d_info[creature_ptr->dungeon_idx].mindepth;
                                prepare_change_floor_mode(CFM_RAND_PLACE);
                        }
                        else
                        {
                                prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
                        }
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->leaving = TRUE;
                }
        }
 
        /* Up only */
-       else if (quest_number(current_floor_ptr->dun_level) || (current_floor_ptr->dun_level >= d_info[p_ptr->dungeon_idx].maxdepth))
+       else if (quest_number(creature_ptr->current_floor_ptr->dun_level) || (creature_ptr->current_floor_ptr->dun_level >= d_info[creature_ptr->dungeon_idx].maxdepth))
        {
 #ifdef JP
                if (see_m) msg_format("%^sは天井を突き破って宙へ浮いていく。", m_name);
@@ -707,15 +706,15 @@ void teleport_level(MONSTER_IDX m_idx)
 
                if (m_idx <= 0) /* To player */
                {
-                       if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
 
                        if (autosave_l) do_cmd_save_game(TRUE);
 
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
 
                        leave_quest_check();
-                       p_ptr->inside_quest = 0;
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->current_floor_ptr->inside_quest = 0;
+                       creature_ptr->leaving = TRUE;
                }
        }
        else if (go_up)
@@ -729,12 +728,12 @@ void teleport_level(MONSTER_IDX m_idx)
 
                if (m_idx <= 0) /* To player */
                {
-                       if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, -1, NULL);
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, -1, NULL);
 
                        if (autosave_l) do_cmd_save_game(TRUE);
 
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_UP | CFM_RAND_PLACE | CFM_RAND_CONNECT);
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->leaving = TRUE;
                }
        }
        else
@@ -748,19 +747,19 @@ void teleport_level(MONSTER_IDX m_idx)
                if (m_idx <= 0) /* To player */
                {
                        /* Never reach this code on the surface */
-                       /* if (!current_floor_ptr->dun_level) p_ptr->dungeon_idx = p_ptr->recall_dungeon; */
-                       if (record_stair) do_cmd_write_nikki(NIKKI_TELE_LEV, 1, NULL);
+                       /* if (!creature_ptr->current_floor_ptr->dun_level) creature_ptr->dungeon_idx = creature_ptr->recall_dungeon; */
+                       if (record_stair) exe_write_diary(creature_ptr, NIKKI_TELE_LEV, 1, NULL);
                        if (autosave_l) do_cmd_save_game(TRUE);
 
                        prepare_change_floor_mode(CFM_SAVE_FLOORS | CFM_DOWN | CFM_RAND_PLACE | CFM_RAND_CONNECT);
-                       p_ptr->leaving = TRUE;
+                       creature_ptr->leaving = TRUE;
                }
        }
 
        /* Monster level teleportation is simple deleting now */
        if (m_idx > 0)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+               monster_type *m_ptr = &creature_ptr->current_floor_ptr->m_list[m_idx];
 
                check_quest_completion(m_ptr);
 
@@ -769,7 +768,7 @@ void teleport_level(MONSTER_IDX m_idx)
                        char m2_name[MAX_NLEN];
 
                        monster_desc(m2_name, m_ptr, MD_INDEF_VISIBLE);
-                       do_cmd_write_nikki(NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
+                       exe_write_diary(creature_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_TELE_LEVEL, m2_name);
                }
 
                delete_monster_idx(m_idx);
@@ -792,25 +791,25 @@ bool recall_player(player_type *creature_ptr, TIME_EFFECT turns)
         */
 
        /* Ironman option */
-       if (creature_ptr->inside_arena || ironman_downward)
+       if (creature_ptr->current_floor_ptr->inside_arena || ironman_downward)
        {
                msg_print(_("何も起こらなかった。", "Nothing happens."));
                return TRUE;
        }
 
-       if (current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > current_floor_ptr->dun_level) && !creature_ptr->inside_quest && !creature_ptr->word_recall)
+       if (p_ptr->current_floor_ptr->dun_level && (max_dlv[p_ptr->dungeon_idx] > p_ptr->current_floor_ptr->dun_level) && !creature_ptr->current_floor_ptr->inside_quest && !creature_ptr->word_recall)
        {
                if (get_check(_("ここは最深到達階より浅い階です。この階に戻って来ますか? ", "Reset recall depth? ")))
                {
-                       max_dlv[p_ptr->dungeon_idx] = current_floor_ptr->dun_level;
+                       max_dlv[p_ptr->dungeon_idx] = p_ptr->current_floor_ptr->dun_level;
                        if (record_maxdepth)
-                               do_cmd_write_nikki(NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon"));
+                               exe_write_diary(p_ptr, NIKKI_TRUMP, p_ptr->dungeon_idx, _("帰還のときに", "when recall from dungeon"));
                }
 
        }
        if (!creature_ptr->word_recall)
        {
-               if (!current_floor_ptr->dun_level)
+               if (!p_ptr->current_floor_ptr->dun_level)
                {
                        DUNGEON_IDX select_dungeon;
                        select_dungeon = choose_dungeon(_("に帰還", "recall"), 2, 14);
@@ -857,7 +856,7 @@ bool free_level_recall(player_type *creature_ptr)
                creature_ptr->recall_dungeon = select_dungeon;
                max_dlv[creature_ptr->recall_dungeon] = ((amt > d_info[select_dungeon].maxdepth) ? d_info[select_dungeon].maxdepth : ((amt < d_info[select_dungeon].mindepth) ? d_info[select_dungeon].mindepth : amt));
                if (record_maxdepth)
-                       do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
+                       exe_write_diary(p_ptr, NIKKI_TRUMP, select_dungeon, _("トランプタワーで", "at Trump Tower"));
 
                msg_print(_("回りの大気が張りつめてきた...", "The air about you becomes charged..."));
 
@@ -893,7 +892,7 @@ bool reset_recall(void)
                (int)d_info[select_dungeon].mindepth, (int)max_dlv[select_dungeon]);
 
        /* Default */
-       sprintf(tmp_val, "%d", (int)MAX(current_floor_ptr->dun_level, 1));
+       sprintf(tmp_val, "%d", (int)MAX(p_ptr->current_floor_ptr->dun_level, 1));
 
        /* Ask for a level */
        if (get_string(ppp, tmp_val, 10))
@@ -907,7 +906,7 @@ bool reset_recall(void)
                max_dlv[select_dungeon] = dummy;
 
                if (record_maxdepth)
-                       do_cmd_write_nikki(NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
+                       exe_write_diary(p_ptr, NIKKI_TRUMP, select_dungeon, _("フロア・リセットで", "using a scroll of reset recall"));
                                        /* Accept request */
 #ifdef JP
                msg_format("%sの帰還レベルを %d 階にセット。", d_name+d_info[select_dungeon].name, dummy, dummy * 50);
@@ -931,9 +930,9 @@ bool reset_recall(void)
  * @return 劣化処理に関するメッセージが発せられた場合はTRUEを返す /
  * Return "TRUE" if the player notices anything
  */
-bool apply_disenchant(BIT_FLAGS mode)
+bool apply_disenchant(player_type *target_ptr, BIT_FLAGS mode)
 {
-       int             t = 0;
+       int t = 0;
        object_type *o_ptr;
        GAME_TEXT o_name[MAX_NLEN];
        int to_h, to_d, to_a, pval;
@@ -951,7 +950,7 @@ bool apply_disenchant(BIT_FLAGS mode)
                case 8: t = INVEN_FEET; break;
        }
 
-       o_ptr = &p_ptr->inventory_list[t];
+       o_ptr = &target_ptr->inventory_list[t];
 
        /* No item, nothing happens */
        if (!o_ptr->k_idx) return (FALSE);
@@ -1014,12 +1013,12 @@ bool apply_disenchant(BIT_FLAGS mode)
                        ((o_ptr->number != 1) ? "were" : "was"));
 #endif
 
-               chg_virtue(V_HARMONY, 1);
-               chg_virtue(V_ENCHANT, -2);
-               p_ptr->update |= (PU_BONUS);
-               p_ptr->window |= (PW_EQUIP | PW_PLAYER);
+               chg_virtue(target_ptr, V_HARMONY, 1);
+               chg_virtue(target_ptr, V_ENCHANT, -2);
+               target_ptr->update |= (PU_BONUS);
+               target_ptr->window |= (PW_EQUIP | PW_PLAYER);
 
-               calc_android_exp();
+               calc_android_exp(target_ptr);
        }
 
        return (TRUE);
@@ -1027,155 +1026,13 @@ bool apply_disenchant(BIT_FLAGS mode)
 
 
 /*!
- * @brief 武器へのエゴ付加処理 /
- * Brand the current weapon
- * @param brand_type エゴ化ID(e_info.txtとは連動していない)
- * @return なし
- */
-void brand_weapon(int brand_type)
-{
-       OBJECT_IDX item;
-       object_type *o_ptr;
-       concptr q, s;
-
-       /* Assume enchant weapon */
-       item_tester_hook = object_allow_enchant_melee_weapon;
-
-       q = _("どの武器を強化しますか? ", "Enchant which weapon? ");
-       s = _("強化できる武器がない。", "You have nothing to enchant.");
-
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | IGNORE_BOTHHAND_SLOT), 0);
-       if (!o_ptr) return;
-
-       /* you can never modify artifacts / ego-items */
-       /* you can never modify cursed items */
-       /* TY: You _can_ modify broken items (if you're silly enough) */
-       if (o_ptr->k_idx && !object_is_artifact(o_ptr) && !object_is_ego(o_ptr) &&
-           !object_is_cursed(o_ptr) &&
-           !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DOKUBARI)) &&
-           !((o_ptr->tval == TV_POLEARM) && (o_ptr->sval == SV_DEATH_SCYTHE)) &&
-           !((o_ptr->tval == TV_SWORD) && (o_ptr->sval == SV_DIAMOND_EDGE)))
-       {
-               concptr act = NULL;
-
-               /* Let's get the name before it is changed... */
-               GAME_TEXT o_name[MAX_NLEN];
-               object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
-
-               switch (brand_type)
-               {
-               case 17:
-                       if (o_ptr->tval == TV_SWORD)
-                       {
-                               act = _("は鋭さを増した!", "becomes very sharp!");
-
-                               o_ptr->name2 = EGO_SHARPNESS;
-                               o_ptr->pval = (PARAMETER_VALUE)m_bonus(5, current_floor_ptr->dun_level) + 1;
-
-                               if ((o_ptr->sval == SV_HAYABUSA) && (o_ptr->pval > 2))
-                                       o_ptr->pval = 2;
-                       }
-                       else
-                       {
-                               act = _("は破壊力を増した!", "seems very powerful.");
-                               o_ptr->name2 = EGO_EARTHQUAKES;
-                               o_ptr->pval = (PARAMETER_VALUE)m_bonus(3, current_floor_ptr->dun_level);
-                       }
-                       break;
-               case 16:
-                       act = _("は人間の血を求めている!", "seems to be looking for humans!");
-                       o_ptr->name2 = EGO_KILL_HUMAN;
-                       break;
-               case 15:
-                       act = _("は電撃に覆われた!", "covered with lightning!");
-                       o_ptr->name2 = EGO_BRAND_ELEC;
-                       break;
-               case 14:
-                       act = _("は酸に覆われた!", "coated with acid!");
-                       o_ptr->name2 = EGO_BRAND_ACID;
-                       break;
-               case 13:
-                       act = _("は邪悪なる怪物を求めている!", "seems to be looking for evil monsters!");
-                       o_ptr->name2 = EGO_KILL_EVIL;
-                       break;
-               case 12:
-                       act = _("は異世界の住人の肉体を求めている!", "seems to be looking for demons!");
-                       o_ptr->name2 = EGO_KILL_DEMON;
-                       break;
-               case 11:
-                       act = _("は屍を求めている!", "seems to be looking for undead!");
-                       o_ptr->name2 = EGO_KILL_UNDEAD;
-                       break;
-               case 10:
-                       act = _("は動物の血を求めている!", "seems to be looking for animals!");
-                       o_ptr->name2 = EGO_KILL_ANIMAL;
-                       break;
-               case 9:
-                       act = _("はドラゴンの血を求めている!", "seems to be looking for dragons!");
-                       o_ptr->name2 = EGO_KILL_DRAGON;
-                       break;
-               case 8:
-                       act = _("はトロルの血を求めている!", "seems to be looking for troll!s");
-                       o_ptr->name2 = EGO_KILL_TROLL;
-                       break;
-               case 7:
-                       act = _("はオークの血を求めている!", "seems to be looking for orcs!");
-                       o_ptr->name2 = EGO_KILL_ORC;
-                       break;
-               case 6:
-                       act = _("は巨人の血を求めている!", "seems to be looking for giants!");
-                       o_ptr->name2 = EGO_KILL_GIANT;
-                       break;
-               case 5:
-                       act = _("は非常に不安定になったようだ。", "seems very unstable now.");
-                       o_ptr->name2 = EGO_TRUMP;
-                       o_ptr->pval = randint1(2);
-                       break;
-               case 4:
-                       act = _("は血を求めている!", "thirsts for blood!");
-                       o_ptr->name2 = EGO_VAMPIRIC;
-                       break;
-               case 3:
-                       act = _("は毒に覆われた。", "is coated with poison.");
-                       o_ptr->name2 = EGO_BRAND_POIS;
-                       break;
-               case 2:
-                       act = _("は純ログルスに飲み込まれた。", "is engulfed in raw Logrus!");
-                       o_ptr->name2 = EGO_CHAOTIC;
-                       break;
-               case 1:
-                       act = _("は炎のシールドに覆われた!", "is covered in a fiery shield!");
-                       o_ptr->name2 = EGO_BRAND_FIRE;
-                       break;
-               default:
-                       act = _("は深く冷たいブルーに輝いた!", "glows deep, icy blue!");
-                       o_ptr->name2 = EGO_BRAND_COLD;
-                       break;
-               }
-
-               msg_format(_("あなたの%s%s", "Your %s %s"), o_name, act);
-               enchant(o_ptr, randint0(3) + 4, ENCH_TOHIT | ENCH_TODAM);
-
-               o_ptr->discount = 99;
-               chg_virtue(V_ENCHANT, 2);
-       }
-       else
-       {
-               if (flush_failure) flush();
-
-               msg_print(_("属性付加に失敗した。", "The Branding failed."));
-               chg_virtue(V_ENCHANT, -2);
-       }
-       calc_android_exp();
-}
-
-
-/*!
  * @brief 虚無招来によるフロア中の全壁除去処理 /
  * Vanish all walls in this floor
+ * @params floor_ptr 対象となるフロアの対象ポインタ
+ * @params subject_ptr 現象を主観するクリーチャーの参照ポインタ
  * @return 実際に処理が反映された場合TRUE
  */
-static bool vanish_dungeon(void)
+static bool vanish_dungeon(floor_type *floor_ptr, player_type *subject_ptr)
 {
        POSITION y, x;
        grid_type *g_ptr;
@@ -1184,17 +1041,17 @@ static bool vanish_dungeon(void)
        GAME_TEXT m_name[MAX_NLEN];
 
        /* Prevent vasishing of quest levels and town */
-       if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
+       if ((subject_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(subject_ptr->current_floor_ptr->inside_quest)) || !floor_ptr->dun_level)
        {
                return FALSE;
        }
 
        /* Scan all normal grids */
-       for (y = 1; y < current_floor_ptr->height - 1; y++)
+       for (y = 1; y < floor_ptr->height - 1; y++)
        {
-               for (x = 1; x < current_floor_ptr->width - 1; x++)
+               for (x = 1; x < floor_ptr->width - 1; x++)
                {
-                       g_ptr = &current_floor_ptr->grid_array[y][x];
+                       g_ptr = &floor_ptr->grid_array[y][x];
 
                        /* Seeing true feature code (ignore mimic) */
                        f_ptr = &f_info[g_ptr->feat];
@@ -1202,7 +1059,7 @@ static bool vanish_dungeon(void)
                        /* Lose room and vault */
                        g_ptr->info &= ~(CAVE_ROOM | CAVE_ICKY);
 
-                       m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+                       m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
 
                        /* Awake monster */
                        if (g_ptr->m_idx && MON_CSLEEP(m_ptr))
@@ -1223,9 +1080,9 @@ static bool vanish_dungeon(void)
        }
 
        /* Special boundary walls -- Top and bottom */
-       for (x = 0; x < current_floor_ptr->width; x++)
+       for (x = 0; x < floor_ptr->width; x++)
        {
-               g_ptr = &current_floor_ptr->grid_array[0][x];
+               g_ptr = &floor_ptr->grid_array[0][x];
                f_ptr = &f_info[g_ptr->mimic];
 
                /* Lose room and vault */
@@ -1240,7 +1097,7 @@ static bool vanish_dungeon(void)
                        if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
                }
 
-               g_ptr = &current_floor_ptr->grid_array[current_floor_ptr->height - 1][x];
+               g_ptr = &floor_ptr->grid_array[floor_ptr->height - 1][x];
                f_ptr = &f_info[g_ptr->mimic];
 
                /* Lose room and vault */
@@ -1257,9 +1114,9 @@ static bool vanish_dungeon(void)
        }
 
        /* Special boundary walls -- Left and right */
-       for (y = 1; y < (current_floor_ptr->height - 1); y++)
+       for (y = 1; y < (floor_ptr->height - 1); y++)
        {
-               g_ptr = &current_floor_ptr->grid_array[y][0];
+               g_ptr = &floor_ptr->grid_array[y][0];
                f_ptr = &f_info[g_ptr->mimic];
 
                /* Lose room and vault */
@@ -1274,7 +1131,7 @@ static bool vanish_dungeon(void)
                        if (!have_flag(f_info[g_ptr->mimic].flags, FF_REMEMBER)) g_ptr->info &= ~(CAVE_MARK);
                }
 
-               g_ptr = &current_floor_ptr->grid_array[y][current_floor_ptr->width - 1];
+               g_ptr = &floor_ptr->grid_array[y][floor_ptr->width - 1];
                f_ptr = &f_info[g_ptr->mimic];
 
                /* Lose room and vault */
@@ -1291,9 +1148,9 @@ static bool vanish_dungeon(void)
        }
 
        /* 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);
+       subject_ptr->update |= (PU_UN_VIEW | PU_UN_LITE | PU_VIEW | PU_LITE | PU_FLOW | PU_MON_LITE | PU_MONSTERS);
+       subject_ptr->redraw |= (PR_MAP);
+       subject_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
 
        return TRUE;
 }
@@ -1301,8 +1158,10 @@ static bool vanish_dungeon(void)
 /*!
  * @brief 虚無招来処理 /
  * @return なし
+ * @details
+ * Sorry, it becomes not (void)...
  */
-void call_the_(void)
+void call_the_void(player_type *caster_ptr)
 {
        int i;
        grid_type *g_ptr;
@@ -1310,7 +1169,7 @@ void call_the_(void)
 
        for (i = 0; i < 9; i++)
        {
-               g_ptr = &current_floor_ptr->grid_array[p_ptr->y + ddy_ddd[i]][p_ptr->x + ddx_ddd[i]];
+               g_ptr = &caster_ptr->current_floor_ptr->grid_array[caster_ptr->y + ddy_ddd[i]][caster_ptr->x + ddx_ddd[i]];
 
                if (!cave_have_flag_grid(g_ptr, FF_PROJECT))
                {
@@ -1342,7 +1201,7 @@ void call_the_(void)
        }
 
        /* Prevent destruction of quest levels and town */
-       else if ((p_ptr->inside_quest && is_fixed_quest_idx(p_ptr->inside_quest)) || !current_floor_ptr->dun_level)
+       else if ((caster_ptr->current_floor_ptr->inside_quest && is_fixed_quest_idx(caster_ptr->current_floor_ptr->inside_quest)) || !caster_ptr->current_floor_ptr->dun_level)
        {
                msg_print(_("地面が揺れた。", "The ground trembles."));
        }
@@ -1361,17 +1220,17 @@ void call_the_(void)
 
                if (one_in_(666))
                {
-                       if (!vanish_dungeon()) msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon silences a moment."));
+                       if (!vanish_dungeon(caster_ptr->current_floor_ptr, caster_ptr)) msg_print(_("ダンジョンは一瞬静まり返った。", "The dungeon silences a moment."));
                }
                else
                {
-                       if (destroy_area(p_ptr->y, p_ptr->x, 15 + p_ptr->lev + randint0(11), FALSE))
+                       if (destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 15 + caster_ptr->lev + randint0(11), FALSE))
                                msg_print(_("ダンジョンが崩壊した...", "The dungeon collapses..."));
                        else
                                msg_print(_("ダンジョンは大きく揺れた。", "The dungeon trembles."));
                }
 
-               take_hit(DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
+               take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(150), _("自殺的な虚無招来", "a suicidal Call the Void"), -1);
        }
 }
 
@@ -1384,7 +1243,7 @@ void call_the_(void)
  * @param require_los 射線の通りを要求するならばTRUE
  * @return なし
  */
-void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
+void fetch(player_type *caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los)
 {
        POSITION ty, tx;
        OBJECT_IDX i;
@@ -1393,7 +1252,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        GAME_TEXT o_name[MAX_NLEN];
 
        /* Check to see if an object is already there */
-       if (current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx)
+       if (caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx)
        {
                msg_print(_("自分の足の下にある物は取れません。", "You can't fetch when you're already standing on something."));
                return;
@@ -1405,13 +1264,13 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
                tx = target_col;
                ty = target_row;
 
-               if (distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE)
+               if (distance(caster_ptr->y, caster_ptr->x, ty, tx) > MAX_RANGE)
                {
                        msg_print(_("そんなに遠くにある物は取れません!", "You can't fetch something that far away!"));
                        return;
                }
 
-               g_ptr = &current_floor_ptr->grid_array[ty][tx];
+               g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
 
                /* We need an item to fetch */
                if (!g_ptr->o_idx)
@@ -1430,12 +1289,12 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
                /* We need to see the item */
                if (require_los)
                {
-                       if (!player_has_los_bold(ty, tx))
+                       if (!player_has_los_bold(p_ptr, ty, tx))
                        {
                                msg_print(_("そこはあなたの視界に入っていません。", "You have no direct line of sight to that location."));
                                return;
                        }
-                       else if (!projectable(p_ptr->y, p_ptr->x, ty, tx))
+                       else if (!projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, ty, tx))
                        {
                                msg_print(_("そこは壁の向こうです。", "You have no direct line of sight to that location."));
                                return;
@@ -1444,21 +1303,21 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
        }
        else
        {
-               ty = p_ptr->y; 
-               tx = p_ptr->x;
+               ty = caster_ptr->y; 
+               tx = caster_ptr->x;
                do
                {
                        ty += ddy[dir];
                        tx += ddx[dir];
-                       g_ptr = &current_floor_ptr->grid_array[ty][tx];
+                       g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
 
-                       if ((distance(p_ptr->y, p_ptr->x, ty, tx) > MAX_RANGE) ||
+                       if ((distance(caster_ptr->y, caster_ptr->x, ty, tx) > MAX_RANGE) ||
                                !cave_have_flag_bold(ty, tx, FF_PROJECT)) return;
                }
                while (!g_ptr->o_idx);
        }
 
-       o_ptr = &current_floor_ptr->o_list[g_ptr->o_idx];
+       o_ptr = &caster_ptr->current_floor_ptr->o_list[g_ptr->o_idx];
 
        if (o_ptr->weight > wgt)
        {
@@ -1469,17 +1328,17 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
 
        i = g_ptr->o_idx;
        g_ptr->o_idx = o_ptr->next_o_idx;
-       current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].o_idx = i; /* 'move' it */
+       caster_ptr->current_floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].o_idx = i; /* 'move' it */
 
        o_ptr->next_o_idx = 0;
-       o_ptr->iy = p_ptr->y;
-       o_ptr->ix = p_ptr->x;
+       o_ptr->iy = caster_ptr->y;
+       o_ptr->ix = caster_ptr->x;
 
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
        msg_format(_("%^sがあなたの足元に飛んできた。", "%^s flies through the air to your feet."), o_name);
 
-       note_spot(p_ptr->y, p_ptr->x);
-       p_ptr->redraw |= PR_MAP;
+       note_spot(caster_ptr->y, caster_ptr->x);
+       caster_ptr->redraw |= PR_MAP;
 }
 
 /*!
@@ -1489,7 +1348,7 @@ void fetch(DIRECTION dir, WEIGHT wgt, bool require_los)
 void alter_reality(void)
 {
        /* Ironman option */
-       if (p_ptr->inside_arena || ironman_downward)
+       if (p_ptr->current_floor_ptr->inside_arena || ironman_downward)
        {
                msg_print(_("何も起こらなかった。", "Nothing happens."));
                return;
@@ -1551,14 +1410,14 @@ void identify_pack(void)
  * will not be uncursed.
  * </pre>
  */
-static int remove_curse_aux(int all)
+static int remove_curse_aux(player_type *creature_ptr, int all)
 {
        int i, cnt = 0;
 
        /* Attempt to uncurse items being worn */
        for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
        {
-               object_type *o_ptr = &p_ptr->inventory_list[i];
+               object_type *o_ptr = &creature_ptr->inventory_list[i];
                if (!o_ptr->k_idx) continue;
 
                /* Uncursed already */
@@ -1578,8 +1437,8 @@ static int remove_curse_aux(int all)
                o_ptr->ident |= (IDENT_SENSE);
                o_ptr->feeling = FEEL_NONE;
 
-               p_ptr->update |= (PU_BONUS);
-               p_ptr->window |= (PW_EQUIP);
+               creature_ptr->update |= (PU_BONUS);
+               creature_ptr->window |= (PW_EQUIP);
 
                /* Count the uncursings */
                cnt++;
@@ -1599,9 +1458,9 @@ static int remove_curse_aux(int all)
  * Remove most curses
  * @return 解呪に成功した装備数
  */
-int remove_curse(void)
+int remove_curse(player_type *caster_ptr)
 {
-       return (remove_curse_aux(FALSE));
+       return (remove_curse_aux(caster_ptr, FALSE));
 }
 
 /*!
@@ -1609,9 +1468,9 @@ int remove_curse(void)
  * Remove all curses
  * @return 解呪に成功した装備数
  */
-int remove_all_curse(void)
+int remove_all_curse(player_type *caster_ptr)
 {
-       return (remove_curse_aux(TRUE));
+       return (remove_curse_aux(caster_ptr, TRUE));
 }
 
 
@@ -1639,7 +1498,7 @@ bool alchemy(void)
        q = _("どのアイテムを金に変えますか?", "Turn which item to gold? ");
        s = _("金に変えられる物がありません。", "You have nothing to current_world_ptr->game_turn to gold.");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
        if (!o_ptr) return (FALSE);
 
        /* See how many items */
@@ -1733,7 +1592,7 @@ bool artifact_scroll(void)
        q = _("どのアイテムを強化しますか? ", "Enchant which item? ");
        s = _("強化できるアイテムがない。", "You have nothing to enchant.");
 
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return (FALSE);
 
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
@@ -1797,7 +1656,7 @@ bool artifact_scroll(void)
                                floor_item_increase(0 - item, 1 - (o_ptr->number));
                        }
                }
-               okay = create_artifact(o_ptr, TRUE);
+               okay = become_random_artifact(o_ptr, TRUE);
        }
 
        /* Failure */
@@ -1805,19 +1664,19 @@ bool artifact_scroll(void)
        {
                if (flush_failure) flush();
                msg_print(_("強化に失敗した。", "The enchantment failed."));
-               if (one_in_(3)) chg_virtue(V_ENCHANT, -1);
+               if (one_in_(3)) chg_virtue(p_ptr, V_ENCHANT, -1);
        }
        else
        {
                if (record_rand_art)
                {
                        object_desc(o_name, o_ptr, OD_NAME_ONLY);
-                       do_cmd_write_nikki(NIKKI_ART_SCROLL, 0, o_name);
+                       exe_write_diary(p_ptr, NIKKI_ART_SCROLL, 0, o_name);
                }
-               chg_virtue(V_ENCHANT, 1);
+               chg_virtue(p_ptr, V_ENCHANT, 1);
        }
 
-       calc_android_exp();
+       calc_android_exp(p_ptr);
 
        /* Something happened */
        return (TRUE);
@@ -1843,7 +1702,7 @@ bool identify_item(object_type *o_ptr)
        if (!(o_ptr->ident & (IDENT_MENTAL)))
        {
                if (object_is_artifact(o_ptr) || one_in_(5))
-                       chg_virtue(V_KNOWLEDGE, 1);
+                       chg_virtue(p_ptr, V_KNOWLEDGE, 1);
        }
 
        object_aware(o_ptr);
@@ -1859,9 +1718,9 @@ bool identify_item(object_type *o_ptr)
        object_desc(o_name, o_ptr, OD_NAME_ONLY);
 
        if(record_fix_art && !old_known && object_is_fixed_artifact(o_ptr))
-               do_cmd_write_nikki(NIKKI_ART, 0, o_name);
+               exe_write_diary(p_ptr, NIKKI_ART, 0, o_name);
        if(record_rand_art && !old_known && o_ptr->art_name)
-               do_cmd_write_nikki(NIKKI_ART, 0, o_name);
+               exe_write_diary(p_ptr, NIKKI_ART, 0, o_name);
 
        return old_known;
 }
@@ -1904,7 +1763,7 @@ bool ident_spell(bool only_equip)
 
        s = _("鑑定するべきアイテムがない。", "You have nothing to identify.");
 
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return (FALSE);
 
        old_known = identify_item(o_ptr);
@@ -1954,7 +1813,7 @@ bool mundane_spell(bool only_equip)
        q = _("どれを使いますか?", "Use which item? ");
        s = _("使えるものがありません。", "You have nothing you can use.");
 
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return (FALSE);
 
        msg_print(_("まばゆい閃光が走った!", "There is a bright flash of light!"));
@@ -1976,7 +1835,7 @@ bool mundane_spell(bool only_equip)
                o_ptr->inscription = inscription;
                if (item >= 0) p_ptr->total_weight += (o_ptr->weight - weight);
        }
-       calc_android_exp();
+       calc_android_exp(p_ptr);
 
        /* Something happened */
        return TRUE;
@@ -2020,7 +1879,7 @@ bool identify_fully(bool only_equip)
 
        s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*.");
 
-       o_ptr = choose_object(&item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
        if (!o_ptr) return (FALSE);
 
        old_known = identify_item(o_ptr);
@@ -2097,7 +1956,7 @@ bool recharge(int power)
        q = _("どのアイテムに魔力を充填しますか? ", "Recharge which item? ");
        s = _("魔力を充填すべきアイテムがない。", "You have nothing to recharge.");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+       o_ptr = choose_object(p_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
        if (!o_ptr) return (FALSE);
 
        /* Get the object kind. */
@@ -2346,14 +2205,15 @@ bool recharge(int power)
 
 
 /*!
- * @brief ã\83\97ã\83¬ã\82¤ã\83¤ã\83¼ã\81®全既知呪文を表示する /
+ * @brief ã\82¯ã\83ªã\83¼ã\83\81ã\83£ã\83¼全既知呪文を表示する /
  * Hack -- Display all known spells in a window
+ * @param caster_ptr 術者の参照ポインタ
  * return なし
  * @details
  * Need to analyze size of the window.
  * Need more color coding.
  */
-void display_spell_list(void)
+void display_spell_list(player_type *caster_ptr)
 {
        int i, j;
        TERM_LEN y, x;
@@ -2365,24 +2225,24 @@ void display_spell_list(void)
        clear_from(0);
 
        /* They have too many spells to list */
-       if (p_ptr->pclass == CLASS_SORCERER) return;
-       if (p_ptr->pclass == CLASS_RED_MAGE) return;
+       if (caster_ptr->pclass == CLASS_SORCERER) return;
+       if (caster_ptr->pclass == CLASS_RED_MAGE) return;
 
-       if (p_ptr->pclass == CLASS_SNIPER)
+       if (caster_ptr->pclass == CLASS_SNIPER)
        {
-               display_snipe_list();
+               display_snipe_list(caster_ptr);
                return;
        }
 
        /* mind.c type classes */
-       if ((p_ptr->pclass == CLASS_MINDCRAFTER) ||
-           (p_ptr->pclass == CLASS_BERSERKER) ||
-           (p_ptr->pclass == CLASS_NINJA) ||
-           (p_ptr->pclass == CLASS_MIRROR_MASTER) ||
-           (p_ptr->pclass == CLASS_FORCETRAINER))
+       if ((caster_ptr->pclass == CLASS_MINDCRAFTER) ||
+           (caster_ptr->pclass == CLASS_BERSERKER) ||
+           (caster_ptr->pclass == CLASS_NINJA) ||
+           (caster_ptr->pclass == CLASS_MIRROR_MASTER) ||
+           (caster_ptr->pclass == CLASS_FORCETRAINER))
        {
                PERCENTAGE minfail = 0;
-               PLAYER_LEVEL plev = p_ptr->lev;
+               PLAYER_LEVEL plev = caster_ptr->lev;
                PERCENTAGE chance = 0;
                mind_type       spell;
                char            comment[80];
@@ -2398,7 +2258,7 @@ void display_spell_list(void)
                put_str(_("名前", "Name"), y, x + 5);
                put_str(_("Lv   MP 失率 効果", "Lv Mana Fail Info"), y, x + 35);
 
-               switch(p_ptr->pclass)
+               switch(caster_ptr->pclass)
                {
                case CLASS_MINDCRAFTER: use_mind = MIND_MINDCRAFTER;break;
                case CLASS_FORCETRAINER:          use_mind = MIND_KI;break;
@@ -2421,24 +2281,24 @@ void display_spell_list(void)
                        chance = spell.fail;
 
                        /* Reduce failure rate by "effective" level adjustment */
-                       chance -= 3 * (p_ptr->lev - spell.min_lev);
+                       chance -= 3 * (caster_ptr->lev - spell.min_lev);
 
                        /* Reduce failure rate by INT/WIS adjustment */
-                       chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
+                       chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
 
                        if (!use_hp)
                        {
                                /* Not enough mana to cast */
-                               if (spell.mana_cost > p_ptr->csp)
+                               if (spell.mana_cost > caster_ptr->csp)
                                {
-                                       chance += 5 * (spell.mana_cost - p_ptr->csp);
+                                       chance += 5 * (spell.mana_cost - caster_ptr->csp);
                                        a = TERM_ORANGE;
                                }
                        }
                        else
                        {
                                /* Not enough hp to cast */
-                               if (spell.mana_cost > p_ptr->chp)
+                               if (spell.mana_cost > caster_ptr->chp)
                                {
                                        chance += 100;
                                        a = TERM_RED;
@@ -2446,14 +2306,14 @@ void display_spell_list(void)
                        }
 
                        /* Extract the minimum failure rate */
-                       minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
+                       minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
 
                        /* Minimum failure rate */
                        if (chance < minfail) chance = minfail;
 
                        /* Stunning makes spells harder */
-                       if (p_ptr->stun > 50) chance += 25;
-                       else if (p_ptr->stun) chance += 15;
+                       if (caster_ptr->stun > 50) chance += 25;
+                       else if (caster_ptr->stun) chance += 15;
 
                        /* Always a 5 percent chance of working */
                        if (chance > 95) chance = 95;
@@ -2472,12 +2332,12 @@ void display_spell_list(void)
        }
 
        /* Cannot read spellbooks */
-       if (REALM_NONE == p_ptr->realm1) return;
+       if (REALM_NONE == caster_ptr->realm1) return;
 
        /* Normal spellcaster with books */
 
        /* Scan books */
-       for (j = 0; j < ((p_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
+       for (j = 0; j < ((caster_ptr->realm2 > REALM_NONE) ? 2 : 1); j++)
        {
                int n = 0;
 
@@ -2496,16 +2356,16 @@ void display_spell_list(void)
                        byte a = TERM_WHITE;
 
                        /* Access the spell */
-                       if (!is_magic((j < 1) ? p_ptr->realm1 : p_ptr->realm2))
+                       if (!is_magic((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2))
                        {
-                               s_ptr = &technic_info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - MIN_TECHNIC][i % 32];
+                               s_ptr = &technic_info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - MIN_TECHNIC][i % 32];
                        }
                        else
                        {
-                               s_ptr = &mp_ptr->info[((j < 1) ? p_ptr->realm1 : p_ptr->realm2) - 1][i % 32];
+                               s_ptr = &mp_ptr->info[((j < 1) ? caster_ptr->realm1 : caster_ptr->realm2) - 1][i % 32];
                        }
 
-                       strcpy(name, do_spell((j < 1) ? p_ptr->realm1 : p_ptr->realm2, i % 32, SPELL_NAME));
+                       strcpy(name, exe_spell(caster_ptr, (j < 1) ? caster_ptr->realm1 : caster_ptr->realm2, i % 32, SPELL_NAME));
 
                        /* Illegible */
                        if (s_ptr->slevel >= 99)
@@ -2519,8 +2379,8 @@ void display_spell_list(void)
 
                        /* Forgotten */
                        else if ((j < 1) ?
-                               ((p_ptr->spell_forgotten1 & (1L << i))) :
-                               ((p_ptr->spell_forgotten2 & (1L << (i % 32)))))
+                               ((caster_ptr->spell_forgotten1 & (1L << i))) :
+                               ((caster_ptr->spell_forgotten2 & (1L << (i % 32)))))
                        {
                                /* Forgotten */
                                a = TERM_ORANGE;
@@ -2528,8 +2388,8 @@ void display_spell_list(void)
 
                        /* Unknown */
                        else if (!((j < 1) ?
-                               (p_ptr->spell_learned1 & (1L << i)) :
-                               (p_ptr->spell_learned2 & (1L << (i % 32)))))
+                               (caster_ptr->spell_learned1 & (1L << i)) :
+                               (caster_ptr->spell_learned2 & (1L << (i % 32)))))
                        {
                                /* Unknown */
                                a = TERM_RED;
@@ -2537,8 +2397,8 @@ void display_spell_list(void)
 
                        /* Untried */
                        else if (!((j < 1) ?
-                               (p_ptr->spell_worked1 & (1L << i)) :
-                               (p_ptr->spell_worked2 & (1L << (i % 32)))))
+                               (caster_ptr->spell_worked1 & (1L << i)) :
+                               (caster_ptr->spell_worked2 & (1L << (i % 32)))))
                        {
                                /* Untried */
                                a = TERM_YELLOW;
@@ -2568,12 +2428,12 @@ void display_spell_list(void)
  * @param use_realm 魔法領域
  * @return 経験値
  */
-EXP experience_of_spell(SPELL_IDX spell, REALM_IDX use_realm)
+EXP experience_of_spell(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm)
 {
-       if (p_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
-       else if (p_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
-       else if (use_realm == p_ptr->realm1) return p_ptr->spell_exp[spell];
-       else if (use_realm == p_ptr->realm2) return p_ptr->spell_exp[spell + 32];
+       if (caster_ptr->pclass == CLASS_SORCERER) return SPELL_EXP_MASTER;
+       else if (caster_ptr->pclass == CLASS_RED_MAGE) return SPELL_EXP_SKILLED;
+       else if (use_realm == caster_ptr->realm1) return caster_ptr->spell_exp[spell];
+       else if (use_realm == caster_ptr->realm2) return caster_ptr->spell_exp[spell + 32];
        else return 0;
 }
 
@@ -2599,7 +2459,7 @@ MANA_POINT mod_need_mana(MANA_POINT need_mana, SPELL_IDX spell, REALM_IDX realm)
                 * need_mana defaults if spell exp equals SPELL_EXP_EXPERT and !p_ptr->dec_mana.
                 * MANA_CONST is used to calculate need_mana effected from spell proficiency.
                 */
-               need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(spell, realm)) + (MANA_CONST - 1);
+               need_mana = need_mana * (MANA_CONST + SPELL_EXP_EXPERT - experience_of_spell(p_ptr, spell, realm)) + (MANA_CONST - 1);
                need_mana *= p_ptr->dec_mana ? DEC_MANA_DIV : MANA_DIV;
                need_mana /= MANA_CONST * MANA_DIV;
                if (need_mana < 1) need_mana = 1;
@@ -2627,15 +2487,15 @@ MANA_POINT mod_need_mana(MANA_POINT need_mana, SPELL_IDX spell, REALM_IDX realm)
  * @return 失敗率(%)
  * @todo 統合を検討
  */
-PERCENTAGE mod_spell_chance_1(PERCENTAGE chance)
+PERCENTAGE mod_spell_chance_1(player_type *caster_ptr, PERCENTAGE chance)
 {
-       chance += p_ptr->to_m_chance;
+       chance += caster_ptr->to_m_chance;
 
-       if (p_ptr->heavy_spell) chance += 20;
+       if (caster_ptr->heavy_spell) chance += 20;
 
-       if (p_ptr->dec_mana && p_ptr->easy_spell) chance -= 4;
-       else if (p_ptr->easy_spell) chance -= 3;
-       else if (p_ptr->dec_mana) chance -= 2;
+       if (caster_ptr->dec_mana && caster_ptr->easy_spell) chance -= 4;
+       else if (caster_ptr->easy_spell) chance -= 3;
+       else if (caster_ptr->dec_mana) chance -= 2;
 
        return chance;
 }
@@ -2652,12 +2512,10 @@ PERCENTAGE mod_spell_chance_1(PERCENTAGE chance)
  * Note: variable "chance" cannot be negative.
  * @todo 統合を検討
  */
-PERCENTAGE mod_spell_chance_2(PERCENTAGE chance)
+PERCENTAGE mod_spell_chance_2(player_type *caster_ptr, PERCENTAGE chance)
 {
-       if (p_ptr->dec_mana) chance--;
-
-       if (p_ptr->heavy_spell) chance += 5;
-
+       if (caster_ptr->dec_mana) chance--;
+       if (caster_ptr->heavy_spell) chance += 5;
        return MAX(chance, 0);
 }
 
@@ -2669,7 +2527,7 @@ PERCENTAGE mod_spell_chance_2(PERCENTAGE chance)
  * @param use_realm 魔法領域ID
  * @return 失敗率(%)
  */
-PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
+PERCENTAGE spell_chance(player_type *caster_ptr, SPELL_IDX spell, REALM_IDX use_realm)
 {
        PERCENTAGE chance, minfail;
        const magic_type *s_ptr;
@@ -2696,27 +2554,27 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
        chance = s_ptr->sfail;
 
        /* Reduce failure rate by "effective" level adjustment */
-       chance -= 3 * (p_ptr->lev - s_ptr->slevel);
+       chance -= 3 * (caster_ptr->lev - s_ptr->slevel);
 
        /* Reduce failure rate by INT/WIS adjustment */
-       chance -= 3 * (adj_mag_stat[p_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
+       chance -= 3 * (adj_mag_stat[caster_ptr->stat_ind[mp_ptr->spell_stat]] - 1);
 
-       if (p_ptr->riding)
-               chance += (MAX(r_info[current_floor_ptr->m_list[p_ptr->riding].r_idx].level - p_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
+       if (caster_ptr->riding)
+               chance += (MAX(r_info[caster_ptr->current_floor_ptr->m_list[caster_ptr->riding].r_idx].level - caster_ptr->skill_exp[GINOU_RIDING] / 100 - 10, 0));
 
        /* Extract mana consumption rate */
        need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
 
        /* Not enough mana to cast */
-       if (need_mana > p_ptr->csp)
+       if (need_mana > caster_ptr->csp)
        {
-               chance += 5 * (need_mana - p_ptr->csp);
+               chance += 5 * (need_mana - caster_ptr->csp);
        }
 
-       if ((use_realm != p_ptr->realm1) && ((p_ptr->pclass == CLASS_MAGE) || (p_ptr->pclass == CLASS_PRIEST))) chance += 5;
+       if ((use_realm != caster_ptr->realm1) && ((caster_ptr->pclass == CLASS_MAGE) || (caster_ptr->pclass == CLASS_PRIEST))) chance += 5;
 
        /* Extract the minimum failure rate */
-       minfail = adj_mag_fail[p_ptr->stat_ind[mp_ptr->spell_stat]];
+       minfail = adj_mag_fail[caster_ptr->stat_ind[mp_ptr->spell_stat]];
 
        /*
         * Non mage/priest characters never get too good
@@ -2728,22 +2586,22 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
        }
 
        /* Hack -- Priest prayer penalty for "edged" weapons  -DGK */
-       if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[0]) chance += 25;
-       if (((p_ptr->pclass == CLASS_PRIEST) || (p_ptr->pclass == CLASS_SORCERER)) && p_ptr->icky_wield[1]) chance += 25;
+       if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[0]) chance += 25;
+       if (((caster_ptr->pclass == CLASS_PRIEST) || (caster_ptr->pclass == CLASS_SORCERER)) && caster_ptr->icky_wield[1]) chance += 25;
 
-       chance = mod_spell_chance_1(chance);
+       chance = mod_spell_chance_1(caster_ptr, chance);
 
        /* Goodness or evilness gives a penalty to failure rate */
        switch (use_realm)
        {
        case REALM_NATURE:
-               if ((p_ptr->align > 50) || (p_ptr->align < -50)) chance += penalty;
+               if ((caster_ptr->align > 50) || (caster_ptr->align < -50)) chance += penalty;
                break;
        case REALM_LIFE: case REALM_CRUSADE:
-               if (p_ptr->align < -20) chance += penalty;
+               if (caster_ptr->align < -20) chance += penalty;
                break;
        case REALM_DEATH: case REALM_DAEMON: case REALM_HEX:
-               if (p_ptr->align > 20) chance += penalty;
+               if (caster_ptr->align > 20) chance += penalty;
                break;
        }
 
@@ -2751,22 +2609,22 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
        if (chance < minfail) chance = minfail;
 
        /* Stunning makes spells harder */
-       if (p_ptr->stun > 50) chance += 25;
-       else if (p_ptr->stun) chance += 15;
+       if (caster_ptr->stun > 50) chance += 25;
+       else if (caster_ptr->stun) chance += 15;
 
        /* Always a 5 percent chance of working */
        if (chance > 95) chance = 95;
 
-       if ((use_realm == p_ptr->realm1) || (use_realm == p_ptr->realm2)
-           || (p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
+       if ((use_realm == caster_ptr->realm1) || (use_realm == caster_ptr->realm2)
+           || (caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE))
        {
-               EXP exp = experience_of_spell(spell, use_realm);
+               EXP exp = experience_of_spell(caster_ptr, spell, use_realm);
                if (exp >= SPELL_EXP_EXPERT) chance--;
                if (exp >= SPELL_EXP_MASTER) chance--;
        }
 
        /* Return the chance */
-       return mod_spell_chance_2(chance);
+       return mod_spell_chance_2(caster_ptr, chance);
 }
 
 
@@ -2775,6 +2633,7 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
  * @brief 呪文情報の表示処理 /
  * Print a list of spells (for browsing or casting or viewing)
  * @param target_spell 呪文ID                    
+ * @param caster_ptr 術者の参照ポインタ
  * @param spells 表示するスペルID配列の参照ポインタ
  * @param num 表示するスペルの数(spellsの要素数)
  * @param y 表示メッセージ左上Y座標
@@ -2782,7 +2641,7 @@ PERCENTAGE spell_chance(SPELL_IDX spell, REALM_IDX use_realm)
  * @param use_realm 魔法領域ID
  * @return なし
  */
-void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX use_realm)
+void print_spells(player_type* caster_ptr, SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y, TERM_LEN x, REALM_IDX use_realm)
 {
        int i;
        SPELL_IDX spell;
@@ -2797,7 +2656,7 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
        char buf[256];
        bool max = FALSE;
 
-       if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && p_ptr->wizard)
+       if (((use_realm <= REALM_NONE) || (use_realm > MAX_REALM)) && current_world_ptr->wizard)
        msg_print(_("警告! print_spell が領域なしに呼ばれた", "Warning! print_spells called with null realm"));
 
        /* Title the list */
@@ -2810,9 +2669,9 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
        put_str(_("名前", "Name"), y, x + 5);
        put_str(buf, y, x + 29);
 
-       if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
-       else if (use_realm == p_ptr->realm1) increment = 0;
-       else if (use_realm == p_ptr->realm2) increment = 32;
+       if ((caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE)) increment = 0;
+       else if (use_realm == caster_ptr->realm1) increment = 0;
+       else if (use_realm == caster_ptr->realm2) increment = 32;
 
        /* Dump the spells */
        for (i = 0; i < num; i++)
@@ -2832,7 +2691,7 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
                        need_mana = s_ptr->smana;
                else
                {
-                       EXP exp = experience_of_spell(spell, use_realm);
+                       EXP exp = experience_of_spell(caster_ptr, spell, use_realm);
 
                        /* Extract mana consumption rate */
                        need_mana = mod_need_mana(s_ptr->smana, spell, use_realm);
@@ -2844,7 +2703,7 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
                        if (!increment && (exp_level == EXP_LEVEL_MASTER)) max = TRUE;
                        else if ((increment == 32) && (exp_level >= EXP_LEVEL_EXPERT)) max = TRUE;
                        else if (s_ptr->slevel >= 99) max = TRUE;
-                       else if ((p_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
+                       else if ((caster_ptr->pclass == CLASS_RED_MAGE) && (exp_level >= EXP_LEVEL_SKILLED)) max = TRUE;
 
                        strncpy(ryakuji, exp_level_str[exp_level], 4);
                        ryakuji[3] = ']';
@@ -2870,7 +2729,7 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
                /* XXX XXX Could label spells above the players level */
 
                /* Get extra info */
-               strcpy(info, do_spell(use_realm, spell, SPELL_INFO));
+               strcpy(info, exe_spell(caster_ptr, use_realm, spell, SPELL_INFO));
 
                /* Use that info */
                comment = info;
@@ -2879,41 +2738,41 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
                line_attr = TERM_WHITE;
 
                /* Analyze the spell */
-               if ((p_ptr->pclass == CLASS_SORCERER) || (p_ptr->pclass == CLASS_RED_MAGE))
+               if ((caster_ptr->pclass == CLASS_SORCERER) || (caster_ptr->pclass == CLASS_RED_MAGE))
                {
-                       if (s_ptr->slevel > p_ptr->max_plv)
+                       if (s_ptr->slevel > caster_ptr->max_plv)
                        {
                                comment = _("未知", "unknown");
                                line_attr = TERM_L_BLUE;
                        }
-                       else if (s_ptr->slevel > p_ptr->lev)
+                       else if (s_ptr->slevel > caster_ptr->lev)
                        {
                                comment = _("忘却", "forgotten");
                                line_attr = TERM_YELLOW;
                        }
                }
-               else if ((use_realm != p_ptr->realm1) && (use_realm != p_ptr->realm2))
+               else if ((use_realm != caster_ptr->realm1) && (use_realm != caster_ptr->realm2))
                {
                        comment = _("未知", "unknown");
                        line_attr = TERM_L_BLUE;
                }
-               else if ((use_realm == p_ptr->realm1) ?
-                   ((p_ptr->spell_forgotten1 & (1L << spell))) :
-                   ((p_ptr->spell_forgotten2 & (1L << spell))))
+               else if ((use_realm == caster_ptr->realm1) ?
+                   ((caster_ptr->spell_forgotten1 & (1L << spell))) :
+                   ((caster_ptr->spell_forgotten2 & (1L << spell))))
                {
                        comment = _("忘却", "forgotten");
                        line_attr = TERM_YELLOW;
                }
-               else if (!((use_realm == p_ptr->realm1) ?
-                   (p_ptr->spell_learned1 & (1L << spell)) :
-                   (p_ptr->spell_learned2 & (1L << spell))))
+               else if (!((use_realm == caster_ptr->realm1) ?
+                   (caster_ptr->spell_learned1 & (1L << spell)) :
+                   (caster_ptr->spell_learned2 & (1L << spell))))
                {
                        comment = _("未知", "unknown");
                        line_attr = TERM_L_BLUE;
                }
-               else if (!((use_realm == p_ptr->realm1) ?
-                   (p_ptr->spell_worked1 & (1L << spell)) :
-                   (p_ptr->spell_worked2 & (1L << spell))))
+               else if (!((use_realm == caster_ptr->realm1) ?
+                   (caster_ptr->spell_worked1 & (1L << spell)) :
+                   (caster_ptr->spell_worked2 & (1L << spell))))
                {
                        comment = _("未経験", "untried");
                        line_attr = TERM_L_GREEN;
@@ -2923,15 +2782,15 @@ void print_spells(SPELL_IDX target_spell, SPELL_IDX *spells, int num, TERM_LEN y
                if (use_realm == REALM_HISSATSU)
                {
                        strcat(out_val, format("%-25s %2d %4d",
-                           do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
+                           exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */
                            s_ptr->slevel, need_mana));
                }
                else
                {
                        strcat(out_val, format("%-25s%c%-4s %2d %4d %3d%% %s",
-                           do_spell(use_realm, spell, SPELL_NAME), /* realm, spell */
+                           exe_spell(caster_ptr, use_realm, spell, SPELL_NAME), /* realm, spell */
                            (max ? '!' : ' '), ryakuji,
-                           s_ptr->slevel, need_mana, spell_chance(spell, use_realm), comment));
+                           s_ptr->slevel, need_mana, spell_chance(caster_ptr, spell, use_realm), comment));
                }
                c_prt(line_attr, out_val, y + i + 1, x);
        }
@@ -2968,7 +2827,7 @@ static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx)
        for (i = 0; i < 1000; i++)
        {
                /* Pick a new race, using a level calculation */
-               r = get_mon_num((current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
+               r = get_mon_num((p_ptr->current_floor_ptr->dun_level + r_ptr->level) / 2 + 5);
 
                /* Handle failure */
                if (!r) break;
@@ -2996,20 +2855,20 @@ static MONRACE_IDX poly_r_idx(MONRACE_IDX r_idx)
  * @param x 指定のX座標
  * @return 実際に変身したらTRUEを返す
  */
-bool polymorph_monster(POSITION y, POSITION x)
+bool polymorph_monster(player_type *caster_ptr, POSITION y, POSITION x)
 {
-       grid_type *g_ptr = &current_floor_ptr->grid_array[y][x];
-       monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+       grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
+       monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
        bool polymorphed = FALSE;
        MONRACE_IDX new_r_idx;
        MONRACE_IDX old_r_idx = m_ptr->r_idx;
        bool targeted = (target_who == g_ptr->m_idx) ? TRUE : FALSE;
-       bool health_tracked = (p_ptr->health_who == g_ptr->m_idx) ? TRUE : FALSE;
+       bool health_tracked = (caster_ptr->health_who == g_ptr->m_idx) ? TRUE : FALSE;
        monster_type back_m;
 
-       if (p_ptr->inside_arena || p_ptr->phase_out) return (FALSE);
+       if (caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) return (FALSE);
 
-       if ((p_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
+       if ((caster_ptr->riding == g_ptr->m_idx) || (m_ptr->mflag2 & MFLAG2_KAGE)) return (FALSE);
 
        /* Memorize the monster before polymorphing */
        back_m = *m_ptr;
@@ -3038,9 +2897,9 @@ bool polymorph_monster(POSITION y, POSITION x)
                /* Create a new monster (no groups) */
                if (place_monster_aux(0, y, x, new_r_idx, mode))
                {
-                       current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname;
-                       current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx;
-                       current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx;
+                       caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii].nickname = back_m.nickname;
+                       caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii].parent_m_idx = back_m.parent_m_idx;
+                       caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii].hold_o_idx = back_m.hold_o_idx;
 
                        /* Success */
                        polymorphed = TRUE;
@@ -3050,7 +2909,7 @@ bool polymorph_monster(POSITION y, POSITION x)
                        /* Placing the new monster failed */
                        if (place_monster_aux(0, y, x, old_r_idx, (mode | PM_NO_KAGE | PM_IGNORE_TERRAIN)))
                        {
-                               current_floor_ptr->m_list[hack_m_idx_ii] = back_m;
+                               caster_ptr->current_floor_ptr->m_list[hack_m_idx_ii] = back_m;
 
                                /* Re-initialize monster process */
                                mproc_init();
@@ -3063,7 +2922,7 @@ bool polymorph_monster(POSITION y, POSITION x)
                {
                        for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
                        {
-                               object_type *o_ptr = &current_floor_ptr->o_list[this_o_idx];
+                               object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[this_o_idx];
                                next_o_idx = o_ptr->next_o_idx;
 
                                /* Held by new monster */
@@ -3074,7 +2933,7 @@ bool polymorph_monster(POSITION y, POSITION x)
                {
                        for (this_o_idx = back_m.hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
                        {
-                               next_o_idx = current_floor_ptr->o_list[this_o_idx].next_o_idx;
+                               next_o_idx = caster_ptr->current_floor_ptr->o_list[this_o_idx].next_o_idx;
                                delete_object_idx(this_o_idx);
                        }
                }
@@ -3104,14 +2963,14 @@ static bool dimension_door_aux(DEPTH x, DEPTH y)
            (!randint0(plev / 10 + 10)))
        {
                p_ptr->energy_need += (s16b)((s32b)(60 - plev) * ENERGY_NEED() / 100L);
-               teleport_player((plev + 2) * 2, TELEPORT_PASSIVE);
+               teleport_player(p_ptr, (plev + 2) * 2, TELEPORT_PASSIVE);
 
                /* Failed */
                return FALSE;
        }
        else
        {
-               teleport_player_to(y, x, 0L);
+               teleport_player_to(p_ptr, y, x, 0L);
 
                /* Success */
                return TRUE;
@@ -3163,7 +3022,7 @@ bool mirror_tunnel(void)
  * @param power 基本効力
  * @return ターンを消費した場合TRUEを返す
  */
-bool eat_magic(int power)
+bool eat_magic(player_type *caster_ptr, int power)
 {
        object_type *o_ptr;
        object_kind *k_ptr;
@@ -3182,7 +3041,7 @@ bool eat_magic(int power)
        q = _("どのアイテムから魔力を吸収しますか?", "Drain which item? ");
        s = _("魔力を吸収できるアイテムがありません。", "You have nothing to drain.");
 
-       o_ptr = choose_object(&item, q, s, (USE_INVEN | USE_FLOOR), 0);
+       o_ptr = choose_object(caster_ptr, &item, q, s, (USE_INVEN | USE_FLOOR), 0);
        if (!o_ptr) return FALSE;
 
        k_ptr = &k_info[o_ptr->k_idx];
@@ -3206,7 +3065,7 @@ bool eat_magic(int power)
                        }
                        else
                        {
-                               p_ptr->csp += lev;
+                               caster_ptr->csp += lev;
                                o_ptr->timeout += k_ptr->pval;
                        }
                }
@@ -3227,7 +3086,7 @@ bool eat_magic(int power)
                {
                        if (o_ptr->pval > 0)
                        {
-                               p_ptr->csp += lev / 2;
+                               caster_ptr->csp += lev / 2;
                                o_ptr->pval --;
 
                                /* XXX Hack -- unstack if necessary */
@@ -3246,7 +3105,7 @@ bool eat_magic(int power)
 
                                        /* Unstack the used item */
                                        o_ptr->number--;
-                                       p_ptr->total_weight -= q_ptr->weight;
+                                       caster_ptr->total_weight -= q_ptr->weight;
                                        item = inven_carry(q_ptr);
 
                                        msg_print(_("杖をまとめなおした。", "You unstack your staff."));
@@ -3285,7 +3144,7 @@ bool eat_magic(int power)
                        /*** Determine Seriousness of Failure ***/
 
                        /* Mages recharge objects more safely. */
-                       if (IS_WIZARD_CLASS(p_ptr))
+                       if (IS_WIZARD_CLASS(caster_ptr))
                        {
                                /* 10% chance to blow up one rod, otherwise draining. */
                                if (o_ptr->tval == TV_ROD)
@@ -3363,7 +3222,7 @@ bool eat_magic(int power)
                                        msg_format(_("乱暴な魔法のために%sが何本か壊れた!", "Wild magic consumes your %s!"), o_name);
                                }
                                
-                               /* Reduce and describe p_ptr->inventory_list */
+                               /* Reduce and describe caster_ptr->inventory_list */
                                if (item >= 0)
                                {
                                        inven_item_increase(item, -1);
@@ -3388,7 +3247,7 @@ bool eat_magic(int power)
                                else
                                        msg_format(_("乱暴な魔法のために%sが壊れた!", "Wild magic consumes your %s!"), o_name);
 
-                               /* Reduce and describe p_ptr->inventory_list */
+                               /* Reduce and describe caster_ptr->inventory_list */
                                if (item >= 0)
                                {
                                        inven_item_increase(item, -999);
@@ -3407,14 +3266,14 @@ bool eat_magic(int power)
                }
        }
 
-       if (p_ptr->csp > p_ptr->msp)
+       if (caster_ptr->csp > caster_ptr->msp)
        {
-               p_ptr->csp = p_ptr->msp;
+               caster_ptr->csp = caster_ptr->msp;
        }
 
-       p_ptr->redraw |= (PR_MANA);
-       p_ptr->update |= (PU_COMBINE | PU_REORDER);
-       p_ptr->window |= (PW_INVEN);
+       caster_ptr->redraw |= (PR_MANA);
+       caster_ptr->update |= (PU_COMBINE | PU_REORDER);
+       caster_ptr->window |= (PW_INVEN);
 
        return TRUE;
 }
@@ -3426,7 +3285,7 @@ bool eat_magic(int power)
  * @param px プレイヤーX座標
  * @return なし
  */
-void massacre(void)
+void massacre(player_type *caster_ptr)
 {
        POSITION x, y;
        grid_type *g_ptr;
@@ -3435,18 +3294,18 @@ void massacre(void)
 
        for (dir = 0; dir < 8; dir++)
        {
-               y = p_ptr->y + ddy_ddd[dir];
-               x = p_ptr->x + ddx_ddd[dir];
-               g_ptr = &current_floor_ptr->grid_array[y][x];
-               m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+               y = caster_ptr->y + ddy_ddd[dir];
+               x = caster_ptr->x + ddx_ddd[dir];
+               g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
+               m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
 
                /* Hack -- attack monsters */
                if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(y, x, FF_PROJECT)))
-                       py_attack(y, x, 0);
+                       py_attack(caster_ptr, y, x, 0);
        }
 }
 
-bool eat_lock(void)
+bool eat_lock(player_type *caster_ptr)
 {
        POSITION x, y;
        grid_type *g_ptr;
@@ -3454,9 +3313,9 @@ bool eat_lock(void)
        DIRECTION dir;
 
        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];
        f_ptr = &f_info[g_ptr->feat];
        mimic_f_ptr = &f_info[get_feat_mimic(g_ptr)];
 
@@ -3472,10 +3331,10 @@ bool eat_lock(void)
        }
        else if (g_ptr->m_idx)
        {
-               monster_type *m_ptr = &current_floor_ptr->m_list[g_ptr->m_idx];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
                msg_print(_("何かが邪魔しています!", "There's something in the way!"));
 
-               if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(y, x, 0);
+               if (!m_ptr->ml || !is_pet(m_ptr)) py_attack(caster_ptr, y, x, 0);
        }
        else if (have_flag(f_ptr->flags, FF_TREE))
        {
@@ -3487,49 +3346,49 @@ bool eat_lock(void)
        }
        else if (have_flag(f_ptr->flags, FF_DOOR) || have_flag(f_ptr->flags, FF_CAN_DIG))
        {
-               (void)set_food(p_ptr->food + 3000);
+               (void)set_food(caster_ptr, caster_ptr->food + 3000);
        }
        else if (have_flag(f_ptr->flags, FF_MAY_HAVE_GOLD) || have_flag(f_ptr->flags, FF_HAS_GOLD))
        {
-               (void)set_food(p_ptr->food + 5000);
+               (void)set_food(caster_ptr, caster_ptr->food + 5000);
        }
        else
        {
                msg_format(_("この%sはとてもおいしい!", "This %s is very filling!"), f_name + mimic_f_ptr->name);
-               (void)set_food(p_ptr->food + 10000);
+               (void)set_food(caster_ptr, caster_ptr->food + 10000);
        }
 
        /* Destroy the wall */
        cave_alter_feat(y, x, FF_HURT_ROCK);
 
-       (void)move_player_effect(y, x, MPE_DONT_PICKUP);
+       (void)move_player_effect(caster_ptr, y, x, MPE_DONT_PICKUP);
        return TRUE;
 }
 
 
-bool shock_power(void)
+bool shock_power(player_type *caster_ptr)
 {
        DIRECTION dir;
        POSITION y, x;
        HIT_POINT dam;
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = caster_ptr->lev;
        int boost = P_PTR_KI;
-       if (heavy_armor()) boost /= 2;
+       if (heavy_armor(caster_ptr)) boost /= 2;
 
        project_length = 1;
        if (!get_aim_dir(&dir)) return FALSE;
 
-       y = p_ptr->y + ddy[dir];
-       x = p_ptr->x + ddx[dir];
+       y = caster_ptr->y + ddy[dir];
+       x = caster_ptr->x + ddx[dir];
        dam = damroll(8 + ((plev - 5) / 4) + boost / 12, 8);
        fire_beam(GF_MISSILE, dir, dam);
-       if (current_floor_ptr->grid_array[y][x].m_idx)
+       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
        {
                int i;
                POSITION ty = y, tx = x;
                POSITION oy = y, ox = x;
-               MONSTER_IDX m_idx = current_floor_ptr->grid_array[y][x].m_idx;
-               monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
+               MONSTER_IDX m_idx = caster_ptr->current_floor_ptr->grid_array[y][x].m_idx;
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                GAME_TEXT m_name[MAX_NLEN];
 
@@ -3545,7 +3404,7 @@ bool shock_power(void)
                        {
                                y += ddy[dir];
                                x += ddx[dir];
-                               if (cave_empty_bold(y, x))
+                               if (cave_empty_bold(caster_ptr->current_floor_ptr, y, x))
                                {
                                        ty = y;
                                        tx = x;
@@ -3555,17 +3414,17 @@ bool shock_power(void)
                        if ((ty != oy) || (tx != ox))
                        {
                                msg_format(_("%sを吹き飛ばした!", "You blow %s away!"), m_name);
-                               current_floor_ptr->grid_array[oy][ox].m_idx = 0;
-                               current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
+                               caster_ptr->current_floor_ptr->grid_array[oy][ox].m_idx = 0;
+                               caster_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx;
                                m_ptr->fy = ty;
                                m_ptr->fx = tx;
 
-                               update_monster(m_idx, TRUE);
+                               update_monster(caster_ptr, m_idx, TRUE);
                                lite_spot(oy, ox);
                                lite_spot(ty, tx);
 
                                if (r_ptr->flags7 & (RF7_LITE_MASK | RF7_DARK_MASK))
-                                       p_ptr->update |= (PU_MON_LITE);
+                                       caster_ptr->update |= (PU_MON_LITE);
                        }
                }
        }
@@ -3575,11 +3434,11 @@ bool shock_power(void)
 bool booze(player_type *creature_ptr)
 {
        bool ident = FALSE;
-       if (creature_ptr->pclass != CLASS_MONK) chg_virtue(V_HARMONY, -1);
+       if (creature_ptr->pclass != CLASS_MONK) chg_virtue(p_ptr, V_HARMONY, -1);
        else if (!creature_ptr->resist_conf) creature_ptr->special_attack |= ATTACK_SUIKEN;
        if (!creature_ptr->resist_conf)
        {
-               if (set_confused(randint0(20) + 15))
+               if (set_confused(p_ptr, randint0(20) + 15))
                {
                        ident = TRUE;
                }
@@ -3589,7 +3448,7 @@ bool booze(player_type *creature_ptr)
        {
                if (one_in_(2))
                {
-                       if (set_image(creature_ptr->image + randint0(150) + 150))
+                       if (set_image(p_ptr, creature_ptr->image + randint0(150) + 150))
                        {
                                ident = TRUE;
                        }
@@ -3597,10 +3456,10 @@ bool booze(player_type *creature_ptr)
                if (one_in_(13) && (creature_ptr->pclass != CLASS_MONK))
                {
                        ident = TRUE;
-                       if (one_in_(3)) lose_all_info();
-                       else wiz_dark();
-                       (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
-                       wiz_dark();
+                       if (one_in_(3)) lose_all_info(p_ptr);
+                       else wiz_dark(creature_ptr);
+                       (void)teleport_player_aux(creature_ptr, 100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
+                       wiz_dark(creature_ptr);
                        msg_print(_("知らない場所で目が醒めた。頭痛がする。", "You wake up somewhere with a sore head..."));
                        msg_print(_("何も思い出せない。どうやってここへ来たのかも分からない!", "You can't remember a thing, or how you got here!"));
                }
@@ -3611,16 +3470,16 @@ bool booze(player_type *creature_ptr)
 bool detonation(player_type *creature_ptr)
 {
        msg_print(_("体の中で激しい爆発が起きた!", "Massive explosions rupture your body!"));
-       take_hit(DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
-       (void)set_stun(creature_ptr->stun + 75);
-       (void)set_cut(creature_ptr->cut + 5000);
+       take_hit(p_ptr, DAMAGE_NOESCAPE, damroll(50, 20), _("爆発の薬", "a potion of Detonation"), -1);
+       (void)set_stun(p_ptr, creature_ptr->stun + 75);
+       (void)set_cut(p_ptr,creature_ptr->cut + 5000);
        return TRUE;
 }
 
-void blood_curse_to_enemy(MONSTER_IDX m_idx)
+void blood_curse_to_enemy(player_type *caster_ptr, MONSTER_IDX m_idx)
 {
-       monster_type *m_ptr = &current_floor_ptr->m_list[m_idx];
-       grid_type *g_ptr = &current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
+       monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
+       grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
        BIT_FLAGS curse_flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
        int count = 0;
        do
@@ -3631,7 +3490,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
                        if (!count)
                        {
                                msg_print(_("地面が揺れた...", "The ground trembles..."));
-                               earthquake(m_ptr->fy, m_ptr->fx, 4 + randint0(4), 0);
+                               earthquake(caster_ptr, m_ptr->fy, m_ptr->fx, 4 + randint0(4), 0);
                                if (!one_in_(6)) break;
                        }
                case 3: case 4: case 5: case 6:
@@ -3648,7 +3507,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
                        {
                                msg_print(_("空間が歪んだ!", "Space warps about you!"));
 
-                               if (m_ptr->r_idx) teleport_away(g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
+                               if (m_ptr->r_idx) teleport_away(caster_ptr, g_ptr->m_idx, damroll(10, 10), TELEPORT_PASSIVE);
                                if (one_in_(13)) count += activate_hi_summon(m_ptr->fy, m_ptr->fx, TRUE);
                                if (!one_in_(6)) break;
                        }
@@ -3670,15 +3529,15 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
                        if (pet) mode |= PM_FORCE_PET;
                        else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
 
-                       count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : current_floor_ptr->dun_level), 0, mode);
+                       count += summon_specific((pet ? -1 : 0), caster_ptr->y, caster_ptr->x, (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : caster_ptr->current_floor_ptr->dun_level), 0, mode);
                        if (!one_in_(6)) break;
                }
                case 23: case 24: case 25:
-                       if (p_ptr->hold_exp && (randint0(100) < 75)) break;
+                       if (caster_ptr->hold_exp && (randint0(100) < 75)) break;
                        msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
 
-                       if (p_ptr->hold_exp) lose_exp(p_ptr->exp / 160);
-                       else lose_exp(p_ptr->exp / 16);
+                       if (caster_ptr->hold_exp) lose_exp(caster_ptr, caster_ptr->exp / 160);
+                       else lose_exp(caster_ptr, caster_ptr->exp / 16);
                        if (!one_in_(6)) break;
                case 26: case 27: case 28:
                {
@@ -3689,7 +3548,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
                                {
                                        do
                                        {
-                                               (void)do_dec_stat(i);
+                                               (void)do_dec_stat(caster_ptr, i);
                                        } while (one_in_(2));
 
                                        i++;
@@ -3697,7 +3556,7 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
                        }
                        else
                        {
-                               (void)do_dec_stat(randint0(6));
+                               (void)do_dec_stat(caster_ptr, randint0(6));
                        }
                        break;
                }
@@ -3705,8 +3564,15 @@ void blood_curse_to_enemy(MONSTER_IDX m_idx)
        } while (one_in_(5));
 }
 
-
-bool fire_crimson(void)
+/*!
+ * @brief クリムゾンを発射する / Fire Crimson, evoluting gun.
+ @ @param shooter_ptr 射撃を行うクリーチャー参照
+ * @return キャンセルした場合 false.
+ * @details
+ * Need to analyze size of the window.
+ * Need more color coding.
+ */
+bool fire_crimson(player_type *shooter_ptr)
 {
        int num = 1;
        int i;
@@ -3717,8 +3583,8 @@ bool fire_crimson(void)
        if (!get_aim_dir(&dir)) return FALSE;
 
        /* Use the given direction */
-       tx = p_ptr->x + 99 * ddx[dir];
-       ty = p_ptr->y + 99 * ddy[dir];
+       tx = shooter_ptr->x + 99 * ddx[dir];
+       ty = shooter_ptr->y + 99 * ddy[dir];
 
        /* Hack -- Use an actual "target" */
        if ((dir == 5) && target_okay())
@@ -3727,20 +3593,20 @@ bool fire_crimson(void)
                ty = target_row;
        }
 
-       if (p_ptr->pclass == CLASS_ARCHER)
+       if (shooter_ptr->pclass == CLASS_ARCHER)
        {
                /* Extra shot at level 10 */
-               if (p_ptr->lev >= 10) num++;
+               if (shooter_ptr->lev >= 10) num++;
 
                /* Extra shot at level 30 */
-               if (p_ptr->lev >= 30) num++;
+               if (shooter_ptr->lev >= 30) num++;
 
                /* Extra shot at level 45 */
-               if (p_ptr->lev >= 45) num++;
+               if (shooter_ptr->lev >= 45) num++;
        }
 
        for (i = 0; i < num; i++)
-               project(0, p_ptr->lev / 20 + 1, ty, tx, p_ptr->lev*p_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
+               project(0, shooter_ptr->lev / 20 + 1, ty, tx, shooter_ptr->lev*shooter_ptr->lev * 6 / 50, GF_ROCKET, flg, -1);
 
        return TRUE;
 }
@@ -3750,19 +3616,19 @@ bool fire_crimson(void)
  * @brief 町間のテレポートを行うメインルーチン。
  * @return テレポート処理を決定したか否か
  */
-bool tele_town(void)
+bool tele_town(player_type *caster_ptr)
 {
        int i;
        POSITION x, y;
        int num = 0;
 
-       if (current_floor_ptr->dun_level)
+       if (caster_ptr->current_floor_ptr->dun_level)
        {
                msg_print(_("この魔法は地上でしか使えない!", "This spell can only be used on the surface!"));
                return FALSE;
        }
 
-       if (p_ptr->inside_arena || p_ptr->phase_out)
+       if (caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
        {
                msg_print(_("この魔法は外でしか使えない!", "This spell can only be used outside!"));
                return FALSE;
@@ -3775,7 +3641,7 @@ bool tele_town(void)
        {
                char buf[80];
 
-               if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == p_ptr->town_num) || !(p_ptr->visit & (1L << (i - 1)))) continue;
+               if ((i == NO_TOWN) || (i == SECRET_TOWN) || (i == caster_ptr->town_num) || !(caster_ptr->visit & (1L << (i - 1)))) continue;
 
                sprintf(buf, "%c) %-20s", I2A(i - 1), town_info[i].name);
                prt(buf, 5 + i, 5);
@@ -3801,7 +3667,7 @@ bool tele_town(void)
                        return FALSE;
                }
                else if ((i < 'a') || (i > ('a' + max_towns - 2))) continue;
-               else if (((i - 'a' + 1) == p_ptr->town_num) || ((i - 'a' + 1) == NO_TOWN) || ((i - 'a' + 1) == SECRET_TOWN) || !(p_ptr->visit & (1L << (i - 'a')))) continue;
+               else if (((i - 'a' + 1) == caster_ptr->town_num) || ((i - 'a' + 1) == NO_TOWN) || ((i - 'a' + 1) == SECRET_TOWN) || !(caster_ptr->visit & (1L << (i - 'a')))) continue;
                break;
        }
 
@@ -3811,15 +3677,15 @@ bool tele_town(void)
                {
                        if (wilderness[y][x].town == (i - 'a' + 1))
                        {
-                               p_ptr->wilderness_y = y;
-                               p_ptr->wilderness_x = x;
+                               caster_ptr->wilderness_y = y;
+                               caster_ptr->wilderness_x = x;
                        }
                }
        }
 
-       p_ptr->leaving = TRUE;
-       p_ptr->leave_bldg = TRUE;
-       p_ptr->teleport_town = TRUE;
+       caster_ptr->leaving = TRUE;
+       caster_ptr->leave_bldg = TRUE;
+       caster_ptr->teleport_town = TRUE;
        screen_load();
        return TRUE;
 }