OSDN Git Service

[Refactor] #38997 is_known_trap() とis_hidden_door()にplayer_type * 引数を追加 / Added playe...
[hengband/hengband.git] / src / realm-hissatsu.c
index ab2c8aa..4e5b53d 100644 (file)
 #include "targeting.h"
 #include "view-mainwindow.h"
 #include "spells-floor.h"
+#include "world.h"
 
 /*!
 * @brief 剣術の各処理を行う
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param spell 剣術ID
 * @param mode 処理内容 (SPELL_NAME / SPELL_DESC / SPELL_CAST)
 * @return SPELL_NAME / SPELL_DESC 時には文字列ポインタを返す。SPELL_CAST時はNULL文字列を返す。
 */
-concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
+concptr do_hissatsu_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode)
 {
        bool name = (mode == SPELL_NAME) ? TRUE : FALSE;
        bool desc = (mode == SPELL_DESC) ? TRUE : FALSE;
        bool cast = (mode == SPELL_CAST) ? TRUE : FALSE;
 
        DIRECTION dir;
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = caster_ptr->lev;
 
        switch (spell)
        {
@@ -45,9 +47,9 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        project_length = 2;
-                       if (!get_aim_dir(&dir)) return NULL;
+                       if (!get_aim_dir(caster_ptr, &dir)) return NULL;
 
-                       project_hook(GF_ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL);
+                       project_hook(caster_ptr, GF_ATTACK, dir, HISSATSU_2, PROJECT_STOP | PROJECT_KILL);
                }
                break;
 
@@ -60,7 +62,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        DIRECTION cdir;
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (cdir = 0; cdir < 8; cdir++)
@@ -70,24 +72,24 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        if (cdir == 8) return NULL;
 
-                       y = p_ptr->y + ddy_cdd[cdir];
-                       x = p_ptr->x + ddx_cdd[cdir];
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, 0);
+                       y = caster_ptr->y + ddy_cdd[cdir];
+                       x = caster_ptr->x + ddx_cdd[cdir];
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
 
-                       y = p_ptr->y + ddy_cdd[(cdir + 7) % 8];
-                       x = p_ptr->x + ddx_cdd[(cdir + 7) % 8];
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, 0);
+                       y = caster_ptr->y + ddy_cdd[(cdir + 7) % 8];
+                       x = caster_ptr->x + ddx_cdd[(cdir + 7) % 8];
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
 
-                       y = p_ptr->y + ddy_cdd[(cdir + 1) % 8];
-                       x = p_ptr->x + ddx_cdd[(cdir + 1) % 8];
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, 0);
+                       y = caster_ptr->y + ddy_cdd[(cdir + 1) % 8];
+                       x = caster_ptr->x + ddx_cdd[(cdir + 1) % 8];
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, 0);
                        else
                                msg_print(_("攻撃は空を切った。", "You attack the empty air."));
                }
@@ -100,7 +102,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       if (!do_cmd_throw(p_ptr, 1, TRUE, -1)) return NULL;
+                       if (!do_cmd_throw(caster_ptr, 1, TRUE, -1)) return NULL;
                }
                break;
 
@@ -112,14 +114,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_FIRE);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_FIRE);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -134,7 +136,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       detect_monsters_mind(DETECT_RAD_DEFAULT);
+                       detect_monsters_mind(caster_ptr, DETECT_RAD_DEFAULT);
                }
                break;
 
@@ -146,14 +148,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_MINEUCHI);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_MINEUCHI);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -169,13 +171,13 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       if (p_ptr->riding)
+                       if (caster_ptr->riding)
                        {
                                msg_print(_("乗馬中には無理だ。", "You cannot do it when riding."));
                                return NULL;
                        }
                        msg_print(_("相手の攻撃に対して身構えた。", "You prepare to counter blow."));
-                       p_ptr->counter = TRUE;
+                       caster_ptr->counter = TRUE;
                }
                break;
 
@@ -188,36 +190,36 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (p_ptr->riding)
+                       if (caster_ptr->riding)
                        {
                                msg_print(_("乗馬中には無理だ。", "You cannot do it when riding."));
                                return NULL;
                        }
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
 
                        if (dir == 5) return NULL;
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (!current_floor_ptr->grid_array[y][x].m_idx)
+                       if (!caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                                return NULL;
                        }
 
-                       py_attack(y, x, 0);
+                       py_attack(caster_ptr, y, x, 0);
 
-                       if (!player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(current_floor_ptr->grid_array[y][x].feat))
+                       if (!player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) || is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat))
                                break;
 
                        y += ddy[dir];
                        x += ddx[dir];
 
-                       if (player_can_enter(current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(current_floor_ptr->grid_array[y][x].feat) && !current_floor_ptr->grid_array[y][x].m_idx)
+                       if (player_can_enter(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat, 0) && !is_trap(caster_ptr, caster_ptr->current_floor_ptr->grid_array[y][x].feat) && !caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                        {
                                msg_print(NULL);
-                               (void)move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
+                               (void)move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
                        }
                }
                break;
@@ -230,14 +232,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_POISON);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_POISON);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -255,14 +257,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_ZANMA);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_ZANMA);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -279,39 +281,39 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, 0);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, 0);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                                return NULL;
                        }
-                       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
+                       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
                        {
                                return "";
                        }
-                       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];
                                GAME_TEXT m_name[MAX_NLEN];
 
-                               monster_desc(m_name, m_ptr, 0);
+                               monster_desc(caster_ptr, m_name, m_ptr, 0);
 
                                for (i = 0; i < 5; i++)
                                {
                                        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;
@@ -321,17 +323,17 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                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);
-                                       lite_spot(oy, ox);
-                                       lite_spot(ty, tx);
+                                       update_monster(caster_ptr, m_idx, TRUE);
+                                       lite_spot(caster_ptr, oy, ox);
+                                       lite_spot(caster_ptr, ty, tx);
 
                                        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);
                                }
                        }
                }
@@ -346,11 +348,11 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        if (plev > 44)
                        {
-                               if (!identify_fully(TRUE)) return NULL;
+                               if (!identify_fully(caster_ptr, TRUE)) return NULL;
                        }
                        else
                        {
-                               if (!ident_spell(TRUE)) return NULL;
+                               if (!ident_spell(caster_ptr, TRUE)) return NULL;
                        }
                }
                break;
@@ -363,20 +365,20 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_HAGAN);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_HAGAN);
 
-                       if (!cave_have_flag_bold(y, x, FF_HURT_ROCK)) break;
+                       if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_HURT_ROCK)) break;
 
                        /* Destroy the feature */
-                       cave_alter_feat(y, x, FF_HURT_ROCK);
-                       p_ptr->update |= (PU_FLOW);
+                       cave_alter_feat(caster_ptr, y, x, FF_HURT_ROCK);
+                       caster_ptr->update |= (PU_FLOW);
                }
                break;
 
@@ -389,14 +391,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_COLD);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_COLD);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -414,14 +416,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_KYUSHO);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_KYUSHO);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -439,14 +441,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_MAJIN);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_MAJIN);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -464,20 +466,20 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_SUTEMI);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_SUTEMI);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                                return NULL;
                        }
-                       p_ptr->sutemi = TRUE;
+                       caster_ptr->sutemi = TRUE;
                }
                break;
 
@@ -490,14 +492,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_ELEC);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_ELEC);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -512,7 +514,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                if (cast)
                {
-                       if (!rush_attack(NULL)) return NULL;
+                       if (!rush_attack(caster_ptr, NULL)) return NULL;
                }
                break;
 
@@ -528,29 +530,29 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        grid_type       *g_ptr;
                        monster_type    *m_ptr;
 
-                       if (p_ptr->cut < 300)
-                               set_cut(p_ptr,p_ptr->cut + 300);
+                       if (caster_ptr->cut < 300)
+                               set_cut(caster_ptr,caster_ptr->cut + 300);
                        else
-                               set_cut(p_ptr,p_ptr->cut * 2);
+                               set_cut(caster_ptr,caster_ptr->cut * 2);
 
                        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)))
+                               if (g_ptr->m_idx && (m_ptr->ml || cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)))
                                {
                                        if (!monster_living(m_ptr->r_idx))
                                        {
                                                GAME_TEXT m_name[MAX_NLEN];
 
-                                               monster_desc(m_name, m_ptr, 0);
+                                               monster_desc(caster_ptr, m_name, m_ptr, 0);
                                                msg_format(_("%sには効果がない!", "%s is unharmed!"), m_name);
                                        }
-                                       else py_attack(y, x, HISSATSU_SEKIRYUKA);
+                                       else py_attack(caster_ptr, y, x, HISSATSU_SEKIRYUKA);
                                }
                        }
                }
@@ -564,16 +566,16 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_QUAKE);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_QUAKE);
                        else
-                               earthquake(p_ptr->y, p_ptr->x, 10, 0);
+                               earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 10, 0);
                }
                break;
 
@@ -586,14 +588,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        int total_damage = 0, basedam, i;
                        BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
-                       if (!get_aim_dir(&dir)) return NULL;
+                       if (!get_aim_dir(caster_ptr, &dir)) return NULL;
                        msg_print(_("武器を大きく振り下ろした。", "You swing your weapon downward."));
                        for (i = 0; i < 2; i++)
                        {
                                int damage;
 
-                               if (!has_melee_weapon(p_ptr, INVEN_RARM + i)) break;
-                               o_ptr = &p_ptr->inventory_list[INVEN_RARM + i];
+                               if (!has_melee_weapon(caster_ptr, INVEN_RARM + i)) break;
+                               o_ptr = &caster_ptr->inventory_list[INVEN_RARM + i];
                                basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
                                damage = o_ptr->to_d * 100;
                                object_flags(o_ptr, flgs);
@@ -610,11 +612,11 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                        basedam /= 9;
                                }
                                damage += basedam;
-                               damage *= p_ptr->num_blow[i];
+                               damage *= caster_ptr->num_blow[i];
                                total_damage += damage / 200;
                                if (i) total_damage = total_damage * 7 / 10;
                        }
-                       fire_beam(GF_FORCE, dir, total_damage);
+                       fire_beam(caster_ptr, GF_FORCE, dir, total_damage);
                }
                break;
 
@@ -626,8 +628,8 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        msg_print(_("雄叫びをあげた!", "You roar out!"));
-                       project_all_los(GF_SOUND, randint1(plev * 3));
-                       aggravate_monsters(0);
+                       project_all_los(caster_ptr, GF_SOUND, randint1(plev * 3));
+                       aggravate_monsters(caster_ptr, 0);
                }
                break;
 
@@ -639,7 +641,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        int i;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
                        for (i = 0; i < 3; i++)
@@ -650,19 +652,19 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                grid_type *g_ptr;
                                monster_type *m_ptr;
 
-                               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];
 
                                if (g_ptr->m_idx)
-                                       py_attack(y, x, HISSATSU_3DAN);
+                                       py_attack(caster_ptr, y, x, HISSATSU_3DAN);
                                else
                                {
                                        msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                                        return NULL;
                                }
 
-                               if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
+                               if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
                                {
                                        return "";
                                }
@@ -673,7 +675,7 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                ny = y + ddy[dir];
                                nx = x + ddx[dir];
                                m_idx = g_ptr->m_idx;
-                               m_ptr = &current_floor_ptr->m_list[m_idx];
+                               m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
 
                                /* Monster cannot move back? */
                                if (!monster_can_enter(ny, nx, &r_info[m_ptr->r_idx], 0))
@@ -684,22 +686,22 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                }
 
                                g_ptr->m_idx = 0;
-                               current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
+                               caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx = m_idx;
                                m_ptr->fy = ny;
                                m_ptr->fx = nx;
 
-                               update_monster(m_idx, TRUE);
+                               update_monster(caster_ptr, m_idx, TRUE);
 
                                /* Redraw the old spot */
-                               lite_spot(y, x);
+                               lite_spot(caster_ptr, y, x);
 
                                /* Redraw the new spot */
-                               lite_spot(ny, nx);
+                               lite_spot(caster_ptr, ny, nx);
 
                                /* Player can move forward? */
-                               if (player_can_enter(g_ptr->feat, 0))
+                               if (player_can_enter(caster_ptr, g_ptr->feat, 0))
                                {
-                                       if (!move_player_effect(p_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
+                                       if (!move_player_effect(caster_ptr, y, x, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP)) break;
                                }
                                else
                                {
@@ -721,14 +723,14 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_DRAIN);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_DRAIN);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
@@ -744,9 +746,9 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                if (cast)
                {
                        msg_print(_("武器を不規則に揺らした...", "You irregularly wave your weapon..."));
-                       project_all_los(GF_ENGETSU, plev * 4);
-                       project_all_los(GF_ENGETSU, plev * 4);
-                       project_all_los(GF_ENGETSU, plev * 4);
+                       project_all_los(caster_ptr, GF_ENGETSU, plev * 4);
+                       project_all_los(caster_ptr, GF_ENGETSU, plev * 4);
+                       project_all_los(caster_ptr, GF_ENGETSU, plev * 4);
                }
                break;
 
@@ -763,27 +765,27 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
 
                        do
                        {
-                               if (!rush_attack(&mdeath)) break;
+                               if (!rush_attack(caster_ptr, &mdeath)) break;
                                if (is_new)
                                {
                                        /* Reserve needed mana point */
-                                       p_ptr->csp -= technic_info[REALM_HISSATSU - MIN_TECHNIC][26].smana;
+                                       caster_ptr->csp -= technic_info[REALM_HISSATSU - MIN_TECHNIC][26].smana;
                                        is_new = FALSE;
                                }
                                else
-                                       p_ptr->csp -= mana_cost_per_monster;
+                                       caster_ptr->csp -= mana_cost_per_monster;
 
                                if (!mdeath) break;
                                command_dir = 0;
 
-                               p_ptr->redraw |= PR_MANA;
-                               handle_stuff();
-                       } while (p_ptr->csp > mana_cost_per_monster);
+                               caster_ptr->redraw |= PR_MANA;
+                               handle_stuff(caster_ptr);
+                       } while (caster_ptr->csp > mana_cost_per_monster);
 
                        if (is_new) return NULL;
 
                        /* Restore reserved mana */
-                       p_ptr->csp += technic_info[REALM_HISSATSU - MIN_TECHNIC][26].smana;
+                       caster_ptr->csp += technic_info[REALM_HISSATSU - MIN_TECHNIC][26].smana;
                }
                break;
 
@@ -796,22 +798,22 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!tgt_pt(&x, &y)) return NULL;
+                       if (!tgt_pt(caster_ptr, &x, &y)) return NULL;
 
-                       if (!cave_player_teleportable_bold(y, x, 0L) ||
-                               (distance(y, x, p_ptr->y, p_ptr->x) > MAX_SIGHT / 2) ||
-                               !projectable(p_ptr->y, p_ptr->x, y, x))
+                       if (!cave_player_teleportable_bold(caster_ptr, y, x, 0L) ||
+                               (distance(y, x, caster_ptr->y, caster_ptr->x) > MAX_SIGHT / 2) ||
+                               !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x))
                        {
                                msg_print(_("失敗!", "You cannot move to that place!"));
                                break;
                        }
-                       if (p_ptr->anti_tele)
+                       if (caster_ptr->anti_tele)
                        {
                                msg_print(_("不思議な力がテレポートを防いだ!", "A mysterious force prevents you from teleporting!"));
                                break;
                        }
-                       project(0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
-                       teleport_player_to(y, x, 0L);
+                       project(caster_ptr, 0, 0, y, x, HISSATSU_ISSEN, GF_ATTACK, PROJECT_BEAM | PROJECT_KILL, -1);
+                       teleport_player_to(caster_ptr, y, x, 0L);
                }
                break;
 
@@ -823,18 +825,18 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION x, y;
 
-                       if (!get_rep_dir(&dir, FALSE)) return NULL;
+                       if (!get_rep_dir(caster_ptr, &dir, FALSE)) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                        {
-                               py_attack(y, x, 0);
-                               if (current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, 0);
+                               if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
                                {
-                                       handle_stuff();
-                                       py_attack(y, x, 0);
+                                       handle_stuff(caster_ptr);
+                                       py_attack(caster_ptr, y, x, 0);
                                }
                        }
                        else
@@ -856,13 +858,13 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        BIT_FLAGS flgs[TR_FLAG_SIZE];
                        object_type *o_ptr;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
+                       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
                        {
                                msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
                                return "";
@@ -871,8 +873,8 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        for (i = 0; i < 2; i++)
                        {
                                int damage;
-                               if (!has_melee_weapon(p_ptr, INVEN_RARM + i)) break;
-                               o_ptr = &p_ptr->inventory_list[INVEN_RARM + i];
+                               if (!has_melee_weapon(caster_ptr, INVEN_RARM + i)) break;
+                               o_ptr = &caster_ptr->inventory_list[INVEN_RARM + i];
                                basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
                                damage = o_ptr->to_d * 100;
                                object_flags(o_ptr, flgs);
@@ -889,11 +891,11 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                                        basedam /= 9;
                                }
                                damage += basedam;
-                               damage += p_ptr->to_d[i] * 100;
-                               damage *= p_ptr->num_blow[i];
+                               damage += caster_ptr->to_d[i] * 100;
+                               damage *= caster_ptr->num_blow[i];
                                total_damage += (damage / 100);
                        }
-                       project(0, (cave_have_flag_bold(y, x, FF_PROJECT) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
+                       project(caster_ptr, 0, (cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT) ? 5 : 0), y, x, total_damage * 3 / 2, GF_METEOR, PROJECT_KILL | PROJECT_JUMP | PROJECT_ITEM, -1);
                }
                break;
 
@@ -906,20 +908,20 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                {
                        POSITION y, x;
 
-                       if (!get_direction(&dir, FALSE, FALSE)) return NULL;
+                       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return NULL;
                        if (dir == 5) return NULL;
 
-                       y = p_ptr->y + ddy[dir];
-                       x = p_ptr->x + ddx[dir];
+                       y = caster_ptr->y + ddy[dir];
+                       x = caster_ptr->x + ddx[dir];
 
-                       if (current_floor_ptr->grid_array[y][x].m_idx)
-                               py_attack(y, x, HISSATSU_UNDEAD);
+                       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+                               py_attack(caster_ptr, y, x, HISSATSU_UNDEAD);
                        else
                        {
                                msg_print(_("その方向にはモンスターはいません。", "There is no monster."));
                                return NULL;
                        }
-                       take_hit(p_ptr, DAMAGE_NOESCAPE, 100 + randint1(100), _("慶雲鬼忍剣を使った衝撃", "exhaustion on using Keiun-Kininken"), -1);
+                       take_hit(caster_ptr, DAMAGE_NOESCAPE, 100 + randint1(100), _("慶雲鬼忍剣を使った衝撃", "exhaustion on using Keiun-Kininken"), -1);
                }
                break;
 
@@ -938,15 +940,15 @@ concptr do_hissatsu_spell(SPELL_IDX spell, BIT_FLAGS mode)
                        i = inkey();
                        prt("", 0, 0);
                        if (i != '@') return NULL;
-                       if (p_ptr->total_winner)
+                       if (current_world_ptr->total_winner)
                        {
-                               take_hit(p_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1);
-                               p_ptr->total_winner = TRUE;
+                               take_hit(caster_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1);
+                               current_world_ptr->total_winner = TRUE;
                        }
                        else
                        {
                                msg_print(_("武士道とは、死ぬことと見つけたり。", "Meaning of Bushi-do is found in the death."));
-                               take_hit(p_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1);
+                               take_hit(caster_ptr, DAMAGE_FORCE, 9999, "Seppuku", -1);
                        }
                }
                break;