OSDN Git Service

[Fix] #39670 現状把握している限りの関数宣言と定義のファイル齟齬を修正. / Fix mismatch between function definition...
[hengband/hengband.git] / src / spells2.c
index a21319d..4e953ee 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "spells-status.h"
 #include "spells-floor.h"
+#include "spells-diceroll.h"
 #include "realm-hex.h"
 #include "autopick.h"
 #include "object-flavor.h"
@@ -59,6 +60,7 @@
 
 /*!
  * @brief プレイヤー周辺の地形を感知する
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @param flag 特定地形ID
  * @param known 地形から危険フラグを外すならTRUE
@@ -97,19 +99,21 @@ static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag,
 
                        if (cave_have_flag_grid(g_ptr, flag))
                        {
-                               disclose_grid(y, x);
+                               disclose_grid(caster_ptr->current_floor_ptr, y, x);
                                g_ptr->info |= (CAVE_MARK);
                                lite_spot(y, x);
                                detect = TRUE;
                        }
                }
        }
+
        return detect;
 }
 
 
 /*!
  * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
  * @return 効力があった場合TRUEを返す
@@ -125,66 +129,74 @@ bool detect_traps(player_type *caster_ptr, POSITION range, bool known)
        {
                msg_print(_("トラップの存在を感じとった!", "You sense the presence of traps!"));
        }
+
        return detect;
 }
 
 
 /*!
  * @brief プレイヤー周辺のドアを感知する / Detect all doors on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_doors(POSITION range)
+bool detect_doors(player_type *caster_ptr, POSITION range)
 {
-       bool detect = detect_feat_flag(p_ptr, range, FF_DOOR, TRUE);
+       bool detect = detect_feat_flag(caster_ptr, range, FF_DOOR, TRUE);
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
        if (detect)
        {
                msg_print(_("ドアの存在を感じとった!", "You sense the presence of doors!"));
        }
+
        return detect;
 }
 
 
 /*!
  * @brief プレイヤー周辺の階段を感知する / Detect all stairs on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_stairs(POSITION range)
+bool detect_stairs(player_type *caster_ptr, POSITION range)
 {
-       bool detect = detect_feat_flag(p_ptr, range, FF_STAIRS, TRUE);
+       bool detect = detect_feat_flag(caster_ptr, range, FF_STAIRS, TRUE);
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 0) detect = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 0) detect = FALSE;
        if (detect)
        {
                msg_print(_("階段の存在を感じとった!", "You sense the presence of stairs!"));
        }
+
        return detect;
 }
 
 
 /*!
  * @brief プレイヤー周辺の地形財宝を感知する / Detect any treasure on the current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_treasure(POSITION range)
+bool detect_treasure(player_type *caster_ptr, POSITION range)
 {
-       bool detect = detect_feat_flag(p_ptr, range, FF_HAS_GOLD, TRUE);
+       bool detect = detect_feat_flag(caster_ptr, range, FF_HAS_GOLD, TRUE);
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
        if (detect)
        {
                msg_print(_("埋蔵された財宝の存在を感じとった!", "You sense the presence of buried treasure!"));
        }
+
        return detect;
 }
 
 
 /*!
  * @brief プレイヤー周辺のアイテム財宝を感知する / Detect all "gold" objects on the current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
@@ -227,20 +239,22 @@ bool detect_objects_gold(player_type *caster_ptr, POSITION range)
                msg_print(_("財宝の存在を感じとった!", "You sense the presence of treasure!"));
        }
 
-       if (detect_monsters_string(range, "$"))
+       if (detect_monsters_string(caster_ptr, range, "$"))
        {
                detect = TRUE;
        }
+
        return (detect);
 }
 
 
 /*!
  * @brief 通常のアイテムオブジェクトを感知する / Detect all "normal" objects on the current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_objects_normal(POSITION range)
+bool detect_objects_normal(player_type *caster_ptr, POSITION range)
 {
        OBJECT_IDX i;
        POSITION y, x;
@@ -248,12 +262,12 @@ bool detect_objects_normal(POSITION range)
 
        bool detect = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        /* Scan objects */
-       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
+               object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
 
                if (!OBJECT_IS_VALID(o_ptr)) continue;
                if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
@@ -262,7 +276,7 @@ bool detect_objects_normal(POSITION range)
                x = o_ptr->ix;
 
                /* Only detect nearby objects */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range2) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
 
                /* Detect "real" objects */
                if (o_ptr->tval != TV_GOLD)
@@ -273,22 +287,24 @@ bool detect_objects_normal(POSITION range)
                }
        }
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 6) detect = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 6) detect = FALSE;
        if (detect)
        {
                msg_print(_("アイテムの存在を感じとった!", "You sense the presence of objects!"));
        }
 
-       if (detect_monsters_string(range, "!=?|/`"))
+       if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
        {
                detect = TRUE;
        }
+
        return (detect);
 }
 
 
 /*!
  * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  * @details
@@ -300,7 +316,7 @@ bool detect_objects_normal(POSITION range)
  * It can probably be argued that this function is now too powerful.
  * </pre>
  */
-bool detect_objects_magic(POSITION range)
+bool detect_objects_magic(player_type *caster_ptr, POSITION range)
 {
        OBJECT_TYPE_VALUE tv;
        OBJECT_IDX i;
@@ -308,12 +324,12 @@ bool detect_objects_magic(POSITION range)
 
        bool detect = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
        /* Scan all objects */
-       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
        {
-               object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[i];
+               object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
 
                if (!OBJECT_IS_VALID(o_ptr)) continue;
                if (OBJECT_IS_HELD_MONSTER(o_ptr)) continue;
@@ -322,7 +338,7 @@ bool detect_objects_magic(POSITION range)
                x = o_ptr->ix;
 
                /* Only detect nearby objects */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Examine the tval */
                tv = o_ptr->tval;
@@ -359,32 +375,33 @@ bool detect_objects_magic(POSITION range)
                        detect = TRUE;
                }
        }
+
        if (detect)
        {
                msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
        }
 
-       /* Return result */
        return (detect);
 }
 
 
 /*!
  * @brief 一般のモンスターを感知する / Detect all "normal" monsters on the current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_normal(POSITION range)
+bool detect_monsters_normal(player_type *caster_ptr, POSITION range)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -392,45 +409,47 @@ bool detect_monsters_normal(POSITION range)
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect all non-invisible monsters */
-               if (!(r_ptr->flags2 & RF2_INVISIBLE) || p_ptr->see_inv)
+               if (!(r_ptr->flags2 & RF2_INVISIBLE) || caster_ptr->see_inv)
                {
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
        if (flag)
        {
                msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
        }
+
        return (flag);
 }
 
 
 /*!
  * @brief 不可視のモンスターを感知する / Detect all "invisible" monsters around the player
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_invis(POSITION range)
+bool detect_monsters_invis(player_type *caster_ptr, POSITION range)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
                if (!monster_is_valid(m_ptr)) continue;
@@ -439,50 +458,52 @@ bool detect_monsters_invis(POSITION range)
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect invisible monsters */
                if (r_ptr->flags2 & RF2_INVISIBLE)
                {
                        /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (caster_ptr->monster_race_idx == m_ptr->r_idx)
                        {
-                               p_ptr->window |= (PW_MONSTER);
+                               caster_ptr->window |= (PW_MONSTER);
                        }
 
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
        if (flag)
        {
                msg_print(_("透明な生物の存在を感じとった!", "You sense the presence of invisible creatures!"));
        }
+
        return (flag);
 }
 
 /*!
  * @brief 邪悪なモンスターを感知する / Detect all "evil" monsters on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_evil(POSITION range)
+bool detect_monsters_evil(player_type *caster_ptr, POSITION range)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -490,7 +511,7 @@ bool detect_monsters_evil(POSITION range)
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect evil monsters */
                if (r_ptr->flags3 & RF3_EVIL)
@@ -501,9 +522,9 @@ bool detect_monsters_evil(POSITION range)
                                r_ptr->r_flags3 |= (RF3_EVIL);
 
                                /* Update monster recall window */
-                               if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                               if (caster_ptr->monster_race_idx == m_ptr->r_idx)
                                {
-                                       p_ptr->window |= (PW_MONSTER);
+                                       caster_ptr->window |= (PW_MONSTER);
                                }
                        }
 
@@ -511,81 +532,87 @@ bool detect_monsters_evil(POSITION range)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
+
        if (flag)
        {
                msg_print(_("邪悪なる生物の存在を感じとった!", "You sense the presence of evil creatures!"));
        }
+
        return (flag);
 }
 
 /*!
  * @brief 無生命のモンスターを感知する(アンデッド、悪魔系を含む) / Detect all "nonliving", "undead" or "demonic" monsters on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_nonliving(POSITION range)
+bool detect_monsters_nonliving(player_type *caster_ptr, POSITION range)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                y = m_ptr->fy;
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect non-living monsters */
                if (!monster_living(m_ptr->r_idx))
                {
                        /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (caster_ptr->monster_race_idx == m_ptr->r_idx)
                        {
-                               p_ptr->window |= (PW_MONSTER);
+                               caster_ptr->window |= (PW_MONSTER);
                        }
 
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
+
        if (flag)
        {
                msg_print(_("自然でないモンスターの存在を感じた!", "You sense the presence of unnatural beings!"));
        }
+
        return (flag);
 }
 
 /*!
  * @brief 精神のあるモンスターを感知する / Detect all monsters it has mind on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_mind(POSITION range)
+bool detect_monsters_mind(player_type *caster_ptr, POSITION range)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -593,50 +620,53 @@ bool detect_monsters_mind(POSITION range)
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect non-living monsters */
                if (!(r_ptr->flags2 & RF2_EMPTY_MIND))
                {
                        /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (caster_ptr->monster_race_idx == m_ptr->r_idx)
                        {
-                               p_ptr->window |= (PW_MONSTER);
+                               caster_ptr->window |= (PW_MONSTER);
                        }
 
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
+
        if (flag)
        {
                msg_print(_("殺気を感じとった!", "You sense the presence of someone's mind!"));
        }
+
        return (flag);
 }
 
 
 /*!
  * @brief 該当シンボルのモンスターを感知する / Detect all (string) monsters on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @param Match 対応シンボルの混じったモンスター文字列(複数指定化)
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_string(POSITION range, concptr Match)
+bool detect_monsters_string(player_type *caster_ptr, POSITION range, concptr Match)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -644,52 +674,54 @@ bool detect_monsters_string(POSITION range, concptr Match)
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect monsters with the same symbol */
                if (my_strchr(Match, r_ptr->d_char))
                {
                        /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (caster_ptr->monster_race_idx == m_ptr->r_idx)
                        {
-                               p_ptr->window |= (PW_MONSTER);
+                               caster_ptr->window |= (PW_MONSTER);
                        }
 
                        /* Repair visibility later */
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
 
-       if (music_singing(p_ptr, MUSIC_DETECT) && SINGING_COUNT(p_ptr) > 3) flag = FALSE;
+       if (music_singing(caster_ptr, MUSIC_DETECT) && SINGING_COUNT(caster_ptr) > 3) flag = FALSE;
        if (flag)
        {
                msg_print(_("モンスターの存在を感じとった!", "You sense the presence of monsters!"));
        }
+
        return (flag);
 }
 
 /*!
  * @brief flags3に対応するモンスターを感知する / A "generic" detect monsters routine, tagged to flags3
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @param match_flag 感知フラグ
  * @return 効力があった場合TRUEを返す
  */
-bool detect_monsters_xxx(POSITION range, u32b match_flag)
+bool detect_monsters_xxx(player_type *caster_ptr, POSITION range, u32b match_flag)
 {
        MONSTER_IDX i;
        POSITION y, x;
        bool flag = FALSE;
        concptr desc_monsters = _("変なモンスター", "weird monsters");
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
@@ -697,7 +729,7 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
                x = m_ptr->fx;
 
                /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
                /* Detect evil monsters */
                if (r_ptr->flags3 & (match_flag))
@@ -708,9 +740,9 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
                                r_ptr->r_flags3 |= (match_flag);
 
                                /* Update monster recall window */
-                               if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                               if (caster_ptr->monster_race_idx == m_ptr->r_idx)
                                {
-                                       p_ptr->window |= (PW_MONSTER);
+                                       caster_ptr->window |= (PW_MONSTER);
                                }
                        }
 
@@ -718,10 +750,11 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
                        repair_monsters = TRUE;
 
                        m_ptr->mflag2 |= (MFLAG2_MARK | MFLAG2_SHOW);
-                       update_monster(p_ptr, i, FALSE);
+                       update_monster(caster_ptr, i, FALSE);
                        flag = TRUE;
                }
        }
+
        if (flag)
        {
                switch (match_flag)
@@ -737,31 +770,33 @@ bool detect_monsters_xxx(POSITION range, u32b match_flag)
                msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
                msg_print(NULL);
        }
+
        return (flag);
 }
 
 
 /*!
  * @brief 全感知処理 / Detect everything
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  */
-bool detect_all(POSITION range)
+bool detect_all(player_type *caster_ptr, POSITION range)
 {
        bool detect = FALSE;
 
        /* Detect everything */
-       if (detect_traps(p_ptr, range, TRUE)) detect = TRUE;
-       if (detect_doors(range)) detect = TRUE;
-       if (detect_stairs(range)) detect = TRUE;
+       if (detect_traps(caster_ptr, range, TRUE)) detect = TRUE;
+       if (detect_doors(caster_ptr, range)) detect = TRUE;
+       if (detect_stairs(caster_ptr, range)) detect = TRUE;
 
        /* There are too many hidden treasure.  So... */
        /* if (detect_treasure(range)) detect = TRUE; */
 
-       if (detect_objects_gold(p_ptr, range)) detect = TRUE;
-       if (detect_objects_normal(range)) detect = TRUE;
-       if (detect_monsters_invis(range)) detect = TRUE;
-       if (detect_monsters_normal(range)) detect = TRUE;
+       if (detect_objects_gold(caster_ptr, range)) detect = TRUE;
+       if (detect_objects_normal(caster_ptr, range)) detect = TRUE;
+       if (detect_monsters_invis(caster_ptr, range)) detect = TRUE;
+       if (detect_monsters_normal(caster_ptr, range)) detect = TRUE;
        return (detect);
 }
 
@@ -819,46 +854,55 @@ bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
                /* Jump directly to the target monster */
                if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
        }
+
        return (obvious);
 }
 
 
 /*!
  * @brief 視界内モンスターを加速する処理 / Speed monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool speed_monsters(void)
+bool speed_monsters(player_type *caster_ptr)
 {
-       return (project_all_los(p_ptr, GF_OLD_SPEED, p_ptr->lev));
+       return (project_all_los(caster_ptr, GF_OLD_SPEED, caster_ptr->lev));
 }
 
+
 /*!
  * @brief 視界内モンスターを加速する処理 / Slow monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool slow_monsters(int power)
+bool slow_monsters(player_type *caster_ptr, int power)
 {
-       return (project_all_los(p_ptr, GF_OLD_SLOW, power));
+       return (project_all_los(caster_ptr, GF_OLD_SLOW, power));
 }
 
+
 /*!
  * @brief 視界内モンスターを眠らせる処理 / Sleep monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool sleep_monsters(int power)
+bool sleep_monsters(player_type *caster_ptr, int power)
 {
-       return (project_all_los(p_ptr, GF_OLD_SLEEP, power));
+       return (project_all_los(caster_ptr, GF_OLD_SLEEP, power));
 }
 
+
 /*!
  * @brief 視界内の邪悪なモンスターをテレポート・アウェイさせる処理 / Banish evil monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool banish_evil(int dist)
+bool banish_evil(player_type *caster_ptr, int dist)
 {
-       return (project_all_los(p_ptr, GF_AWAY_EVIL, dist));
+       return (project_all_los(caster_ptr, GF_AWAY_EVIL, dist));
 }
 
+
 /*!
  * @brief 視界内のアンデッド・モンスターを恐怖させる処理 / Turn undead
  * @return 効力があった場合TRUEを返す
@@ -871,59 +915,69 @@ bool turn_undead(player_type *caster_ptr)
        return tester;
 }
 
+
 /*!
  * @brief 視界内のアンデッド・モンスターにダメージを与える処理 / Dispel undead monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool dispel_undead(HIT_POINT dam)
+bool dispel_undead(player_type *caster_ptr, HIT_POINT dam)
 {
-       bool tester = (project_all_los(p_ptr, GF_DISP_UNDEAD, dam));
+       bool tester = (project_all_los(caster_ptr, GF_DISP_UNDEAD, dam));
        if (tester)
-               chg_virtue(p_ptr, V_UNLIFE, -2);
+               chg_virtue(caster_ptr, V_UNLIFE, -2);
        return tester;
 }
 
+
 /*!
  * @brief 視界内の邪悪なモンスターにダメージを与える処理 / Dispel evil monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool dispel_evil(HIT_POINT dam)
+bool dispel_evil(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_DISP_EVIL, dam));
+       return (project_all_los(caster_ptr, GF_DISP_EVIL, dam));
 }
 
+
 /*!
  * @brief 視界内の善良なモンスターにダメージを与える処理 / Dispel good monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool dispel_good(HIT_POINT dam)
+bool dispel_good(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_DISP_GOOD, dam));
+       return (project_all_los(caster_ptr, GF_DISP_GOOD, dam));
 }
 
+
 /*!
  * @brief 視界内のあらゆるモンスターにダメージを与える処理 / Dispel all monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool dispel_monsters(HIT_POINT dam)
+bool dispel_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_DISP_ALL, dam));
+       return (project_all_los(caster_ptr, GF_DISP_ALL, dam));
 }
 
+
 bool cleansing_nova(player_type *creature_ptr, bool magic, bool powerful)
 {
        bool ident = FALSE;
-       if (dispel_evil(powerful ? 225 : 150)) ident = TRUE;
+       if (dispel_evil(creature_ptr, powerful ? 225 : 150)) ident = TRUE;
        int k = 3 * creature_ptr->lev;
-       if (set_protevil(p_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
-       if (set_poisoned(p_ptr, 0)) ident = TRUE;
-       if (set_afraid(p_ptr, 0)) ident = TRUE;
-       if (hp_player(p_ptr, 50)) ident = TRUE;
-       if (set_stun(p_ptr, 0)) ident = TRUE;
-       if (set_cut(p_ptr,0)) ident = TRUE;
+       if (set_protevil(creature_ptr, (magic ? 0 : creature_ptr->protevil) + randint1(25) + k, FALSE)) ident = TRUE;
+       if (set_poisoned(creature_ptr, 0)) ident = TRUE;
+       if (set_afraid(creature_ptr, 0)) ident = TRUE;
+       if (hp_player(creature_ptr, 50)) ident = TRUE;
+       if (set_stun(creature_ptr, 0)) ident = TRUE;
+       if (set_cut(creature_ptr,0)) ident = TRUE;
        return ident;
 }
 
+
 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
 {
        msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
@@ -931,31 +985,38 @@ bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
        (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
        if ((creature_ptr->pclass != CLASS_MAGE) && (creature_ptr->pclass != CLASS_HIGH_MAGE) && (creature_ptr->pclass != CLASS_SORCERER) && (creature_ptr->pclass != CLASS_MAGIC_EATER) && (creature_ptr->pclass != CLASS_BLUE_MAGE))
        {
-               (void)take_hit(p_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
+               (void)take_hit(creature_ptr, DAMAGE_NOESCAPE, 50, _("コントロールし難い強力な魔力の解放", "unleashing magics too mighty to control"), -1);
        }
+
        return TRUE;
 }
 
+
 /*!
  * @brief 視界内の生命のあるモンスターにダメージを与える処理 / Dispel 'living' monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool dispel_living(HIT_POINT dam)
+bool dispel_living(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_DISP_LIVING, dam));
+       return (project_all_los(caster_ptr, GF_DISP_LIVING, dam));
 }
 
+
 /*!
  * @brief 視界内の悪魔系モンスターにダメージを与える処理 / Dispel 'living' monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
-bool dispel_demons(HIT_POINT dam)
+bool dispel_demons(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_DISP_DEMON, dam));
+       return (project_all_los(caster_ptr, GF_DISP_DEMON, dam));
 }
 
+
 /*!
  * @brief 視界内のモンスターに「聖戦」効果を与える処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 効力があった場合TRUEを返す
  */
 bool crusade(player_type *caster_ptr)
@@ -963,21 +1024,23 @@ bool crusade(player_type *caster_ptr)
        return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev*4));
 }
 
+
 /*!
  * @brief 視界内モンスターを怒らせる処理 / Wake up all monsters, and speed up "los" monsters.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param who 怒らせる原因を起こしたモンスター(0ならばプレイヤー)
  * @return なし
  */
-void aggravate_monsters(MONSTER_IDX who)
+void aggravate_monsters(player_type *caster_ptr, MONSTER_IDX who)
 {
        MONSTER_IDX i;
        bool sleep = FALSE;
        bool speed = FALSE;
 
        /* Aggravate everyone nearby */
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Skip aggravating monster (or player) */
@@ -996,7 +1059,7 @@ void aggravate_monsters(MONSTER_IDX who)
                }
 
                /* Speed up monsters in line of sight */
-               if (player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx))
+               if (player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx))
                {
                        if (!is_pet(m_ptr))
                        {
@@ -1008,7 +1071,7 @@ void aggravate_monsters(MONSTER_IDX who)
 
        if (speed) msg_print(_("付近で何かが突如興奮したような感じを受けた!", "You feel a sudden stirring nearby!"));
        else if (sleep) msg_print(_("何かが突如興奮したような騒々しい音が遠くに聞こえた!", "You hear a sudden stirring in the distance!"));
-       if (p_ptr->riding) p_ptr->update |= PU_BONUS;
+       if (caster_ptr->riding) caster_ptr->update |= PU_BONUS;
 }
 
 
@@ -1061,6 +1124,7 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl
                {
                        msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
                }
+
                if (MON_CSLEEP(m_ptr))
                {
                        (void)set_monster_csleep(m_idx, 0);
@@ -1069,6 +1133,7 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl
                                msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
                        }
                }
+
                if (is_friendly(m_ptr) && !is_pet(m_ptr))
                {
                        if (see_m)
@@ -1077,6 +1142,7 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl
                        }
                        set_hostile(m_ptr);
                }
+
                if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
        }
 
@@ -1232,7 +1298,7 @@ bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
  * @brief 周辺モンスターを調査する / Probe nearby monsters
  * @return 効力があった場合TRUEを返す
  */
-bool probing(void)
+bool probing(player_type *caster_ptr)
 {
        int i;
        int speed; /* TODO */
@@ -1247,14 +1313,14 @@ bool probing(void)
        Term->scr->cv = 1;
 
        /* Probe all (nearby) monsters */
-       for (i = 1; i < p_ptr->current_floor_ptr->m_max; i++)
+       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[i];
+               monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                monster_race *r_ptr = &r_info[m_ptr->r_idx];
                if (!monster_is_valid(m_ptr)) continue;
 
                /* Require line of sight */
-               if (!player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx)) continue;
+               if (!player_has_los_bold(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
 
                /* Probe visible monsters */
                if (m_ptr->ml)
@@ -1317,7 +1383,7 @@ bool probing(void)
                        /* HACK : Add the line to message buffer */
                        message_add(buf);
 
-                       p_ptr->window |= (PW_MESSAGE);
+                       caster_ptr->window |= (PW_MESSAGE);
                        handle_stuff();
 
                        if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
@@ -1356,12 +1422,14 @@ bool probing(void)
 
        if (probe)
        {
-               chg_virtue(p_ptr, V_KNOWLEDGE, 1);
+               chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
                msg_print(_("これで全部です。", "That's all."));
        }
+
        return (probe);
 }
 
+
 /*!
  * @brief ペット爆破処理 /
  * @return なし
@@ -1377,11 +1445,13 @@ void discharge_minion(player_type *caster_ptr)
                if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
                if (m_ptr->nickname) okay = FALSE;
        }
+
        if (!okay || caster_ptr->riding)
        {
                if (!get_check(_("本当に全ペットを爆破しますか?", "You will blast all pets. Are you sure? ")))
                        return;
        }
+
        for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
                HIT_POINT dam;
@@ -1421,7 +1491,9 @@ void discharge_minion(player_type *caster_ptr)
 
 
 /*!
+ * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
  * @brief 部屋全体を照らすサブルーチン
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
@@ -1436,7 +1508,7 @@ void discharge_minion(player_type *caster_ptr)
  * STUPID monsters wake up 1/10 the time when illuminated
  * </pre>
  */
-static void cave_temp_room_lite(void)
+static void cave_temp_room_lite(player_type *caster_ptr)
 {
        int i;
 
@@ -1446,7 +1518,7 @@ static void cave_temp_room_lite(void)
                POSITION y = tmp_pos.y[i];
                POSITION x = tmp_pos.x[i];
 
-               grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+               grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
 
                /* No longer in the array */
                g_ptr->info &= ~(CAVE_TEMP);
@@ -1461,9 +1533,9 @@ static void cave_temp_room_lite(void)
                if (g_ptr->m_idx)
                {
                        PERCENTAGE chance = 25;
-                       monster_type    *m_ptr = &p_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];
                        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
-                       update_monster(p_ptr, g_ptr->m_idx, FALSE);
+                       update_monster(caster_ptr, g_ptr->m_idx, FALSE);
 
                        /* Stupid monsters rarely wake up */
                        if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
@@ -1489,17 +1561,17 @@ static void cave_temp_room_lite(void)
 
                note_spot(y, x);
                lite_spot(y, x);
-               update_local_illumination(p_ptr, y, x);
+               update_local_illumination(caster_ptr, y, x);
        }
 
-       /* None left */
        tmp_pos.n = 0;
 }
 
 
-
 /*!
+ * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
  * @brief 部屋全体を暗くするサブルーチン
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
@@ -1510,7 +1582,7 @@ static void cave_temp_room_lite(void)
  * Also, process all affected monsters
  * </pre>
  */
-static void cave_temp_room_unlite(void)
+static void cave_temp_room_unlite(player_type *caster_ptr)
 {
        int i;
 
@@ -1521,7 +1593,7 @@ static void cave_temp_room_unlite(void)
                POSITION x = tmp_pos.x[i];
                int j;
 
-               grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+               grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
                bool do_dark = !is_mirror_grid(g_ptr);
 
                /* No longer in the array */
@@ -1530,16 +1602,16 @@ static void cave_temp_room_unlite(void)
                /* Darken the grid */
                if (do_dark)
                {
-                       if (p_ptr->current_floor_ptr->dun_level || !is_daytime())
+                       if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
                        {
                                for (j = 0; j < 9; j++)
                                {
                                        POSITION by = y + ddy_ddd[j];
                                        POSITION bx = x + ddx_ddd[j];
 
-                                       if (in_bounds2(p_ptr->current_floor_ptr, by, bx))
+                                       if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
                                        {
-                                               grid_type *cc_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx];
+                                               grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
 
                                                if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                                {
@@ -1565,27 +1637,27 @@ static void cave_temp_room_unlite(void)
                        /* Process affected monsters */
                        if (g_ptr->m_idx)
                        {
-                               update_monster(p_ptr, g_ptr->m_idx, FALSE);
+                               update_monster(caster_ptr, g_ptr->m_idx, FALSE);
                        }
 
                        lite_spot(y, x);
-                       update_local_illumination(p_ptr, y, x);
+                       update_local_illumination(caster_ptr, y, x);
                }
        }
 
-       /* None left */
        tmp_pos.n = 0;
 }
 
 
 /*!
  * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
+ * @param floor_ptr 配置するフロアの参照ポインタ
  * @param cy Y座標
  * @param cx X座標
  * @param pass_bold 地形条件を返す関数ポインタ
  * @return 該当地形の数
  */
-static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
+static int next_to_open(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
 {
        int i;
        POSITION y, x;
@@ -1598,7 +1670,7 @@ static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, PO
                x = cx + ddx_cdd[i % 8];
 
                /* Found a wall, break the length */
-               if (!pass_bold(y, x))
+               if (!pass_bold(floor_ptr, y, x))
                {
                        /* Track best length */
                        if (len > blen)
@@ -1617,14 +1689,16 @@ static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, PO
        return (MAX(len, blen));
 }
 
+
 /*!
  * @brief 周辺に関数ポインタの条件に該当する地形がいくつあるかを計算する / Determine how much contiguous open space this grid is next to
+ * @param floor_ptr 配置するフロアの参照ポインタ
  * @param cy Y座標
  * @param cx X座標
  * @param pass_bold 地形条件を返す関数ポインタ
  * @return 該当地形の数
  */
-static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, POSITION))
+static int next_to_walls_adj(floor_type *floor_ptr, POSITION cy, POSITION cx, bool (*pass_bold)(floor_type*, POSITION, POSITION))
 {
        DIRECTION i;
        POSITION y, x;
@@ -1635,7 +1709,7 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
                y = cy + ddy_ddd[i];
                x = cx + ddx_ddd[i];
 
-               if (!pass_bold(y, x)) c++;
+               if (!pass_bold(floor_ptr, y, x)) c++;
        }
 
        return c;
@@ -1644,16 +1718,18 @@ static int next_to_walls_adj(POSITION cy, POSITION cx, bool (*pass_bold)(POSITIO
 
 /*!
  * @brief 部屋内にある一点の周囲に該当する地形数かいくつあるかをグローバル変数tmp_pos.nに返す / Aux function -- see below
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y 部屋内のy座標1点
  * @param x 部屋内のx座標1点
  * @param only_room 部屋内地形のみをチェック対象にするならば TRUE
  * @param pass_bold 地形条件を返す関数ポインタ
  * @return 該当地形の数
  */
-static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pass_bold)(POSITION, POSITION))
+static void cave_temp_room_aux(player_type *caster_ptr, POSITION y, POSITION x, bool only_room, bool (*pass_bold)(floor_type*, POSITION, POSITION))
 {
        grid_type *g_ptr;
-       g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+       g_ptr = &floor_ptr->grid_array[y][x];
 
        /* Avoid infinite recursion */
        if (g_ptr->info & (CAVE_TEMP)) return;
@@ -1664,10 +1740,10 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
                if (only_room) return;
 
                /* Verify */
-               if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return;
+               if (!in_bounds2(floor_ptr, y, x)) return;
 
                /* Do not exceed the maximum spell range */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
 
                /* Verify this grid */
                /*
@@ -1678,8 +1754,8 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
                 * properly.
                 * This leaves only a check for 6 bounding walls!
                 */
-               if (in_bounds(p_ptr->current_floor_ptr, y, x) && pass_bold(y, x) &&
-                   (next_to_walls_adj(y, x, pass_bold) == 6) && (next_to_open(y, x, pass_bold) <= 1)) return;
+               if (in_bounds(floor_ptr, y, x) && pass_bold(floor_ptr, y, x) &&
+                   (next_to_walls_adj(floor_ptr, y, x, pass_bold) == 6) && (next_to_open(floor_ptr, y, x, pass_bold) <= 1)) return;
        }
 
        /* Paranoia -- verify space */
@@ -1694,110 +1770,121 @@ static void cave_temp_room_aux(POSITION y, POSITION x, bool only_room, bool (*pa
        tmp_pos.n++;
 }
 
+
 /*!
+ * todo このシンタックスシュガーは不要だが、関数ポインタなので安易には消せず……
  * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
+ * @param floor_ptr 配置するフロアの参照ポインタ
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return 光を通すならばtrueを返す。
  */
-static bool cave_pass_lite_bold(POSITION y, POSITION x)
+static bool cave_pass_lite_bold(floor_type *floor_ptr, POSITION y, POSITION x)
 {
-       return cave_los_bold(p_ptr->current_floor_ptr, y, x);
+       return cave_los_bold(floor_ptr, y, x);
 }
 
+
 /*!
  * @brief 部屋内にある一点の周囲がいくつ光を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
- * @param y 指定Y座標
+* @param caster_ptr プレーヤーへの参照ポインタ
+  * @param y 指定Y座標
  * @param x 指定X座標
  * @return なし
  */
-static void cave_temp_lite_room_aux(POSITION y, POSITION x)
+static void cave_temp_lite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
 {
-       cave_temp_room_aux(y, x, FALSE, cave_pass_lite_bold);
+       cave_temp_room_aux(caster_ptr, y, x, FALSE, cave_pass_lite_bold);
 }
 
+
 /*!
  * @brief 指定のマスが光を通さず射線のみを通すかを返す。 / Aux function -- see below
+ * @param floor_ptr 配置するフロアの参照ポインタ
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return 射線を通すならばtrueを返す。
  */
-static bool cave_pass_dark_bold(POSITION y, POSITION x)
+static bool cave_pass_dark_bold(floor_type *floor_ptr, POSITION y, POSITION x)
 {
-       return cave_have_flag_bold(p_ptr->current_floor_ptr, y, x, FF_PROJECT);
+       return cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT);
 }
 
 
 /*!
  * @brief 部屋内にある一点の周囲がいくつ射線を通すかをグローバル変数tmp_pos.nに返す / Aux function -- see below
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y 指定Y座標
  * @param x 指定X座標
  * @return なし
  */
-static void cave_temp_unlite_room_aux(POSITION y, POSITION x)
+static void cave_temp_unlite_room_aux(player_type *caster_ptr, POSITION y, POSITION x)
 {
-       cave_temp_room_aux(y, x, TRUE, cave_pass_dark_bold);
+       cave_temp_room_aux(caster_ptr, y, x, TRUE, cave_pass_dark_bold);
 }
 
 
 /*!
  * @brief 指定された部屋内を照らす / Illuminate any room containing the given location.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y1 指定Y座標
  * @param x1 指定X座標
  * @return なし
  */
-void lite_room(POSITION y1, POSITION x1)
+void lite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
 {
        int i;
        POSITION x, y;
 
        /* Add the initial grid */
-       cave_temp_lite_room_aux(y1, x1);
+       cave_temp_lite_room_aux(caster_ptr, y1, x1);
 
        /* While grids are in the queue, add their neighbors */
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
        for (i = 0; i < tmp_pos.n; i++)
        {
                x = tmp_pos.x[i], y = tmp_pos.y[i];
 
                /* Walls get lit, but stop light */
-               if (!cave_pass_lite_bold(y, x)) continue;
+               if (!cave_pass_lite_bold(floor_ptr, y, x)) continue;
 
                /* Spread adjacent */
-               cave_temp_lite_room_aux(y + 1, x);
-               cave_temp_lite_room_aux(y - 1, x);
-               cave_temp_lite_room_aux(y, x + 1);
-               cave_temp_lite_room_aux(y, x - 1);
+               cave_temp_lite_room_aux(caster_ptr, y + 1, x);
+               cave_temp_lite_room_aux(caster_ptr, y - 1, x);
+               cave_temp_lite_room_aux(caster_ptr, y, x + 1);
+               cave_temp_lite_room_aux(caster_ptr, y, x - 1);
 
                /* Spread diagonal */
-               cave_temp_lite_room_aux(y + 1, x + 1);
-               cave_temp_lite_room_aux(y - 1, x - 1);
-               cave_temp_lite_room_aux(y - 1, x + 1);
-               cave_temp_lite_room_aux(y + 1, x - 1);
+               cave_temp_lite_room_aux(caster_ptr, y + 1, x + 1);
+               cave_temp_lite_room_aux(caster_ptr, y - 1, x - 1);
+               cave_temp_lite_room_aux(caster_ptr, y - 1, x + 1);
+               cave_temp_lite_room_aux(caster_ptr, y + 1, x - 1);
        }
 
        /* Now, lite them all up at once */
-       cave_temp_room_lite();
+       cave_temp_room_lite(caster_ptr);
 
-       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       if (caster_ptr->special_defense & NINJA_S_STEALTH)
        {
-               if (p_ptr->current_floor_ptr->grid_array[p_ptr->y][p_ptr->x].info & CAVE_GLOW) set_superstealth(p_ptr, FALSE);
+               if (floor_ptr->grid_array[caster_ptr->y][caster_ptr->x].info & CAVE_GLOW) set_superstealth(caster_ptr, FALSE);
        }
 }
 
 
 /*!
  * @brief 指定された部屋内を暗くする / Darken all rooms containing the given location
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y1 指定Y座標
  * @param x1 指定X座標
  * @return なし
  */
-void unlite_room(POSITION y1, POSITION x1)
+void unlite_room(player_type *caster_ptr, POSITION y1, POSITION x1)
 {
        int i;
        POSITION x, y;
 
        /* Add the initial grid */
-       cave_temp_unlite_room_aux(y1, x1);
+       cave_temp_unlite_room_aux(caster_ptr, y1, x1);
 
        /* Spread, breadth first */
        for (i = 0; i < tmp_pos.n; i++)
@@ -1805,80 +1892,89 @@ void unlite_room(POSITION y1, POSITION x1)
                x = tmp_pos.x[i], y = tmp_pos.y[i];
 
                /* Walls get dark, but stop darkness */
-               if (!cave_pass_dark_bold(y, x)) continue;
+               if (!cave_pass_dark_bold(caster_ptr->current_floor_ptr, y, x)) continue;
 
                /* Spread adjacent */
-               cave_temp_unlite_room_aux(y + 1, x);
-               cave_temp_unlite_room_aux(y - 1, x);
-               cave_temp_unlite_room_aux(y, x + 1);
-               cave_temp_unlite_room_aux(y, x - 1);
+               cave_temp_unlite_room_aux(caster_ptr, y + 1, x);
+               cave_temp_unlite_room_aux(caster_ptr, y - 1, x);
+               cave_temp_unlite_room_aux(caster_ptr, y, x + 1);
+               cave_temp_unlite_room_aux(caster_ptr, y, x - 1);
 
                /* Spread diagonal */
-               cave_temp_unlite_room_aux(y + 1, x + 1);
-               cave_temp_unlite_room_aux(y - 1, x - 1);
-               cave_temp_unlite_room_aux(y - 1, x + 1);
-               cave_temp_unlite_room_aux(y + 1, x - 1);
+               cave_temp_unlite_room_aux(caster_ptr, y + 1, x + 1);
+               cave_temp_unlite_room_aux(caster_ptr, y - 1, x - 1);
+               cave_temp_unlite_room_aux(caster_ptr, y - 1, x + 1);
+               cave_temp_unlite_room_aux(caster_ptr, y + 1, x - 1);
        }
 
        /* Now, darken them all at once */
-       cave_temp_room_unlite();
+       cave_temp_room_unlite(caster_ptr);
 }
 
-bool starlight(bool magic)
+
+/*!
+ * @brief スターライトの効果を発生させる
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
+ * @return 常にTRUE
+ */
+bool starlight(player_type *caster_ptr, bool magic)
 {
        HIT_POINT num = damroll(5, 3);
        POSITION y = 0, x = 0;
        int k;
        int attempts;
 
-       if (!p_ptr->blind && !magic)
+       if (!caster_ptr->blind && !magic)
        {
                msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
        }
+
        for (k = 0; k < num; k++)
        {
                attempts = 1000;
 
                while (attempts--)
                {
-                       scatter(&y, &x, p_ptr->y, p_ptr->x, 4, PROJECT_LOS);
-                       if (!cave_have_flag_bold(p_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
-                       if (!player_bold(p_ptr, y, x)) break;
+                       scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, PROJECT_LOS);
+                       if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
+                       if (!player_bold(caster_ptr, y, x)) break;
                }
 
-               project(p_ptr, 0, 0, y, x, damroll(6 + p_ptr->lev / 8, 10), GF_LITE_WEAK,
+               project(caster_ptr, 0, 0, y, x, damroll(6 + caster_ptr->lev / 8, 10), GF_LITE_WEAK,
                        (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_KILL | PROJECT_LOS), -1);
        }
+
        return TRUE;
 }
 
 
-
 /*!
  * @brief プレイヤー位置を中心にLITE_WEAK属性を通じた照明処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 威力
  * @param rad 効果半径
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool lite_area(HIT_POINT dam, POSITION rad)
+bool lite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
 
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS)
        {
                msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorb your light."));
                return FALSE;
        }
 
-       if (!p_ptr->blind)
+       if (!caster_ptr->blind)
        {
                msg_print(_("白い光が辺りを覆った。", "You are surrounded by a white light."));
        }
 
        /* Hook into the "project()" function */
-       (void)project(p_ptr, 0, rad, p_ptr->y, p_ptr->x, dam, GF_LITE_WEAK, flg, -1);
+       (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_LITE_WEAK, flg, -1);
 
-       lite_room(p_ptr->y, p_ptr->x);
+       lite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
 
        /* Assume seen */
        return (TRUE);
@@ -1887,32 +1983,33 @@ bool lite_area(HIT_POINT dam, POSITION rad)
 
 /*!
  * @brief プレイヤー位置を中心にLITE_DARK属性を通じた消灯処理を行う / Hack -- call light around the player Affect all monsters in the projection radius
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 威力
  * @param rad 効果半径
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool unlite_area(HIT_POINT dam, POSITION rad)
+bool unlite_area(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
 
-       if (!p_ptr->blind)
+       if (!caster_ptr->blind)
        {
                msg_print(_("暗闇が辺りを覆った。", "Darkness surrounds you."));
        }
 
        /* Hook into the "project()" function */
-       (void)project(p_ptr, 0, rad, p_ptr->y, p_ptr->x, dam, GF_DARK_WEAK, flg, -1);
+       (void)project(caster_ptr, 0, rad, caster_ptr->y, caster_ptr->x, dam, GF_DARK_WEAK, flg, -1);
 
-       unlite_room(p_ptr->y, p_ptr->x);
+       unlite_room(caster_ptr, caster_ptr->y, caster_ptr->x);
 
        /* Assume seen */
        return (TRUE);
 }
 
 
-
 /*!
  * @brief ボール系スペルの発動 / Cast a ball spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -1948,8 +2045,10 @@ bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT
        return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
 }
 
+
 /*!
 * @brief ブレス系スペルの発動 / Cast a breath spell
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param typ 効果属性
 * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
 * @param dam 威力
@@ -1970,6 +2069,7 @@ bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POIN
 
 /*!
  * @brief ロケット系スペルの発動(詳細な差は確認中) / Cast a ball spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2005,6 +2105,7 @@ bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POIN
 
 /*!
  * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2041,6 +2142,7 @@ bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_P
 
 /*!
  * @brief メテオ系スペルの発動 / Cast a meteor spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
  * @param typ 効果属性
  * @param dam 威力
@@ -2057,17 +2159,18 @@ bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_P
  * Option to hurt the player.
  * </pre>
  */
-bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
+bool fire_meteor(player_type *caster_ptr, MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POINT dam, POSITION rad)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
 
        /* Analyze the "target" and the caster. */
-       return (project(p_ptr, who, rad, y, x, dam, typ, flg, -1));
+       return (project(caster_ptr, who, rad, y, x, dam, typ, flg, -1));
 }
 
 
 /*!
  * @brief ブラスト系スペルの発動 / Cast a blast spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dd 威力ダイス数
@@ -2132,6 +2235,7 @@ bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMB
 
 /*!
  * @brief モンスターとの位置交換処理 / Switch position with a monster.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2196,6 +2300,7 @@ bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
 
 /*!
  * @brief 指定方向に飛び道具を飛ばす(フラグ任意指定) / Hack -- apply a "project()" in a direction (or at the target)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2227,6 +2332,7 @@ bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POI
 
 /*!
  * @brief ボルト系スペルの発動 / Cast a bolt spell.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2247,6 +2353,7 @@ bool fire_bolt(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT
 
 /*!
  * @brief ビーム系スペルの発動 / Cast a beam spell.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2266,6 +2373,7 @@ bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT
 
 /*!
  * @brief 確率に応じたボルト系/ビーム系スペルの発動 / Cast a bolt spell, or rarely, a beam spell.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param prob ビーム化する確率(%)
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
@@ -2277,156 +2385,181 @@ bool fire_beam(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT
  * Affect monsters, grids and objects.
  * </pre>
  */
-bool fire_bolt_or_beam(PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
+bool fire_bolt_or_beam(player_type *caster_ptr, PERCENTAGE prob, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam)
 {
        if (randint0(100) < prob)
        {
-               return (fire_beam(p_ptr, typ, dir, dam));
+               return (fire_beam(caster_ptr, typ, dir, dam));
        }
        else
        {
-               return (fire_bolt(p_ptr, typ, dir, dam));
+               return (fire_bolt(caster_ptr, typ, dir, dam));
        }
 }
 
+
 /*!
  * @brief LITE_WEAK属性による光源ビーム処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool lite_line(DIRECTION dir, HIT_POINT dam)
+bool lite_line(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
 {
        BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_LITE_WEAK, dir, dam, flg));
+       return (project_hook(caster_ptr, GF_LITE_WEAK, dir, dam, flg));
 }
 
+
 /*!
  * @brief 衰弱ボルト処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool hypodynamic_bolt(DIRECTION dir, HIT_POINT dam)
+bool hypodynamic_bolt(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-       return (project_hook(p_ptr, GF_HYPODYNAMIA, dir, dam, flg));
+       return (project_hook(caster_ptr, GF_HYPODYNAMIA, dir, dam, flg));
 }
 
+
 /*!
  * @brief 岩石溶解処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool wall_to_mud(DIRECTION dir, HIT_POINT dam)
+bool wall_to_mud(player_type *caster_ptr, DIRECTION dir, HIT_POINT dam)
 {
        BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_KILL_WALL, dir, dam, flg));
+       return (project_hook(caster_ptr, GF_KILL_WALL, dir, dam, flg));
 }
 
+
 /*!
  * @brief 魔法の施錠処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool wizard_lock(DIRECTION dir)
+bool wizard_lock(player_type *caster_ptr, DIRECTION dir)
 {
        BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
+       return (project_hook(caster_ptr, GF_JAM_DOOR, dir, 20 + randint1(30), flg));
 }
 
+
 /*!
  * @brief ドア破壊処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool destroy_door(DIRECTION dir)
+bool destroy_door(player_type *caster_ptr, DIRECTION dir)
 {
        BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
-       return (project_hook(p_ptr, GF_KILL_DOOR, dir, 0, flg));
+       return (project_hook(caster_ptr, GF_KILL_DOOR, dir, 0, flg));
 }
 
+
 /*!
  * @brief トラップ解除処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool disarm_trap(DIRECTION dir)
+bool disarm_trap(player_type *caster_ptr, DIRECTION dir)
 {
        BIT_FLAGS flg = PROJECT_BEAM | PROJECT_GRID | PROJECT_ITEM;
-       return (project_hook(p_ptr, GF_KILL_TRAP, dir, 0, flg));
+       return (project_hook(caster_ptr, GF_KILL_TRAP, dir, 0, flg));
 }
 
 
 /*!
  * @brief 死の光線処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev プレイヤーレベル(効力はplev*200)
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool death_ray(DIRECTION dir, PLAYER_LEVEL plev)
+bool death_ray(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE;
-       return (project_hook(p_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
+       return (project_hook(caster_ptr, GF_DEATH_RAY, dir, plev * 200, flg));
 }
 
+
 /*!
  * @brief モンスター用テレポート処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param distance 移動距離
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool teleport_monster(DIRECTION dir, int distance)
+bool teleport_monster(player_type *caster_ptr, DIRECTION dir, int distance)
 {
        BIT_FLAGS flg = PROJECT_BEAM | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_AWAY_ALL, dir, distance, flg));
+       return (project_hook(caster_ptr, GF_AWAY_ALL, dir, distance, flg));
 }
 
+
 /*!
  * @brief ドア生成処理(プレイヤー中心に周囲1マス) / Hooks -- affect adjacent grids (radius 1 ball attack)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool door_creation(void)
+bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-       return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_DOOR, flg, -1));
+       return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_DOOR, flg, -1));
 }
 
+
 /*!
  * @brief トラップ生成処理(起点から周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y 起点Y座標
  * @param x 起点X座標
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool trap_creation(POSITION y, POSITION x)
+bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-       return (project(p_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
+       return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
 }
 
+
 /*!
  * @brief 森林生成処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool tree_creation(void)
+bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-       return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_TREE, flg, -1));
+       return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
 }
 
+
 /*!
  * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool glyph_creation(void)
+bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM;
-       return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_MAKE_GLYPH, flg, -1));
+       return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_GLYPH, flg, -1));
 }
 
+
 /*!
  * @brief 壁生成処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool wall_stone(void)
@@ -2438,8 +2571,10 @@ bool wall_stone(void)
        return dummy;
 }
 
+
 /*!
  * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool destroy_doors_touch(void)
@@ -2448,8 +2583,10 @@ bool destroy_doors_touch(void)
        return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
 }
 
+
 /*!
  * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool disarm_traps_touch(void)
@@ -2458,8 +2595,10 @@ bool disarm_traps_touch(void)
        return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
 }
 
+
 /*!
  * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool sleep_monsters_touch(void)
@@ -2471,6 +2610,7 @@ bool sleep_monsters_touch(void)
 
 /*!
  * @brief 死者復活処理(起点より周囲5マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param who 術者モンスターID(0ならばプレイヤー)
  * @param y 起点Y座標
  * @param x 起点X座標
@@ -2482,6 +2622,7 @@ bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
        return (project(p_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
 }
 
+
 /*!
  * @brief 混沌招来処理
  * @return 作用が実際にあった場合TRUEを返す
@@ -2534,8 +2675,10 @@ void call_chaos(player_type *caster_ptr)
        }
 }
 
+
 /*!
  * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
+ * @param target_ptr プレーヤーへの参照ポインタ
  * @param stop_ty 再帰処理停止フラグ
  * @param count 発動回数
  * @return 作用が実際にあった場合TRUEを返す
@@ -2547,11 +2690,12 @@ void call_chaos(player_type *caster_ptr)
  */
 bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
 {
-       int i = 0;
        BIT_FLAGS flg = (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP);
 
-       do
+       bool is_first_curse = TRUE;
+       while (is_first_curse || one_in_(3) && !stop_ty)
        {
+               is_first_curse = FALSE;
                switch (randint1(34))
                {
                case 28: case 29:
@@ -2586,9 +2730,10 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                                project(target_ptr, 0, 7, target_ptr->y, target_ptr->x, 50, GF_KILL_WALL, flg, -1);
                                take_hit(target_ptr, DAMAGE_NOESCAPE, 50, _("エネルギーのうねり", "surge of energy"), -1);
                        }
+
                        if (!one_in_(6)) break;
                case 1: case 2: case 3: case 16: case 17:
-                       aggravate_monsters(0);
+                       aggravate_monsters(target_ptr, 0);
                        if (!one_in_(6)) break;
                case 4: case 5: case 6:
                        (*count) += activate_hi_summon(target_ptr->y, target_ptr->x, FALSE);
@@ -2614,6 +2759,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                                        set_paralyzed(target_ptr, target_ptr->paralyzed + randint1(13));
                                stop_ty = TRUE;
                        }
+
                        if (!one_in_(6)) break;
                case 21: case 22: case 23:
                        (void)do_dec_stat(target_ptr, randint0(6));
@@ -2632,27 +2778,28 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                                stop_ty = TRUE;
                                break;
                        }
+
                        if (!one_in_(6)) break;
                default:
-                       while (i < A_MAX)
+                       for (int i = 0; i < A_MAX; i++)
                        {
-                               do
+                               bool is_first_dec_stat = TRUE;
+                               while (is_first_dec_stat || one_in_(2))
                                {
+                                       is_first_dec_stat = FALSE;
                                        (void)do_dec_stat(target_ptr, i);
                                }
-                               while (one_in_(2));
-
-                               i++;
                        }
                }
        }
-       while (one_in_(3) && !stop_ty);
 
        return stop_ty;
 }
 
+
 /*!
  * @brief HI_SUMMON(上級召喚)処理発動
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y 召喚位置Y座標
  * @param x 召喚位置X座標
  * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
@@ -2739,8 +2886,10 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
        return count;
 }
 
+
 /*!
  * @brief 周辺破壊効果(プレイヤー中心)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 void wall_breaker(player_type *caster_ptr)
@@ -2789,6 +2938,7 @@ void wall_breaker(player_type *caster_ptr)
 
 /*!
  * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2800,6 +2950,7 @@ bool confuse_monsters(HIT_POINT dam)
 
 /*!
  * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2811,6 +2962,7 @@ bool charm_monsters(HIT_POINT dam)
 
 /*!
  * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2822,6 +2974,7 @@ bool charm_animals(HIT_POINT dam)
 
 /*!
  * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2833,6 +2986,7 @@ bool stun_monsters(HIT_POINT dam)
 
 /*!
  * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2844,6 +2998,7 @@ bool stasis_monsters(HIT_POINT dam)
 
 /*!
  * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2855,6 +3010,7 @@ bool mindblast_monsters(HIT_POINT dam)
 
 /*!
  * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dist 効力(距離)
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2866,6 +3022,7 @@ bool banish_monsters(int dist)
 
 /*!
  * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2877,6 +3034,7 @@ bool turn_evil(HIT_POINT dam)
 
 /*!
  * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2888,6 +3046,7 @@ bool turn_monsters(HIT_POINT dam)
 
 /*!
  * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool deathray_monsters(void)
@@ -2895,8 +3054,10 @@ bool deathray_monsters(void)
        return (project_all_los(p_ptr, GF_DEATH_RAY, p_ptr->lev * 200));
 }
 
+
 /*!
  * @brief チャーム・モンスター(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
@@ -2907,8 +3068,10 @@ bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
        return (project_hook(p_ptr, GF_CHARM, dir, plev, flg));
 }
 
+
 /*!
  * @brief アンデッド支配(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
@@ -2919,8 +3082,10 @@ bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
        return (project_hook(p_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
 }
 
+
 /*!
  * @brief 悪魔支配(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
@@ -2931,8 +3096,10 @@ bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
        return (project_hook(p_ptr, GF_CONTROL_DEMON, dir, plev, flg));
 }
 
+
 /*!
  * @brief 動物支配(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
@@ -2946,6 +3113,7 @@ bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
 
 /*!
  * @brief 変わり身処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param success 判定成功上の処理ならばTRUE
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2990,6 +3158,7 @@ bool kawarimi(player_type *caster_ptr, bool success)
 
 /*!
  * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param mdeath 目標モンスターが死亡したかを返す
  * @return 作用が実際にあった場合TRUEを返す /  Return value is for checking "done"
  */
@@ -3104,6 +3273,7 @@ bool rush_attack(player_type *attacker_ptr, bool *mdeath)
 
 /*!
  * @brief 全鏡の消去 / Remove all mirrors in this floor
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param explode 爆発処理を伴うならばTRUE
  * @return なし
  */
@@ -3126,9 +3296,11 @@ void remove_all_mirrors(player_type *caster_ptr, bool explode)
        }
 }
 
+
 /*!
  * @brief 『一つの指輪』の効果処理 /
  * Hack -- activate the ring of power
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 発動の方向ID
  * @return なし
  */
@@ -3162,7 +3334,7 @@ void ring_of_power(player_type *caster_ptr, DIRECTION dir)
        case 3:
        {
                msg_print(_("あなたは強力なオーラに包み込まれた。", "You are surrounded by a powerful aura."));
-               dispel_monsters(1000);
+               dispel_monsters(caster_ptr, 1000);
                break;
        }
 
@@ -3185,8 +3357,10 @@ void ring_of_power(player_type *caster_ptr, DIRECTION dir)
        }
 }
 
+
 /*!
 * @brief 運命の輪、並びにカオス的な効果の発動
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param spell ランダムな効果を選択するための基準ID
 * @return なし
 */
@@ -3217,12 +3391,12 @@ void wild_magic(player_type *caster_ptr, int spell)
        case 9:
        case 10:
        case 11:
-               unlite_area(10, 3);
+               unlite_area(caster_ptr, 10, 3);
                break;
        case 12:
        case 13:
        case 14:
-               lite_area(damroll(2, 3), 2);
+               lite_area(caster_ptr, damroll(2, 3), 2);
                break;
        case 15:
                destroy_doors_touch();
@@ -3234,16 +3408,16 @@ void wild_magic(player_type *caster_ptr, int spell)
                break;
        case 19:
        case 20:
-               trap_creation(caster_ptr->y, caster_ptr->x);
+               trap_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
                break;
        case 21:
        case 22:
-               door_creation();
+               door_creation(caster_ptr, caster_ptr->y, caster_ptr->x);
                break;
        case 23:
        case 24:
        case 25:
-               aggravate_monsters(0);
+               aggravate_monsters(caster_ptr, 0);
                break;
        case 26:
                earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
@@ -3286,13 +3460,13 @@ void wild_magic(player_type *caster_ptr, int spell)
                break;
        }
        }
-
-       return;
 }
 
+
 /*!
 * @brief カオス魔法「流星群」の処理としてプレイヤーを中心に隕石落下処理を10+1d10回繰り返す。
 * / Drop 10+1d10 meteor ball at random places near the player
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dam ダメージ
 * @param rad 効力の半径
 * @return なし
@@ -3338,6 +3512,7 @@ void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 
 /*!
 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dam ダメージ
 * @param rad 効力の半径
 * @return ターゲットを指定し、実行したならばTRUEを返す。
@@ -3388,6 +3563,7 @@ bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
                x = nx;
                y = ny;
        }
+
        tx = x;
        ty = y;
 
@@ -3416,7 +3592,7 @@ bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
                /* Cannot penetrate perm walls */
                if (!in_bounds(caster_ptr->current_floor_ptr, y, x) ||
                        cave_stop_disintegration(caster_ptr->current_floor_ptr, y, x) ||
-                       !in_disintegration_range(ty, tx, y, x))
+                       !in_disintegration_range(caster_ptr->current_floor_ptr, ty, tx, y, x))
                        continue;
 
                project(caster_ptr, 0, rad, y, x, dam, GF_DISINTEGRATE, PROJECT_JUMP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
@@ -3427,6 +3603,7 @@ bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 
 /*!
 * @brief 「ワンダー」のランダムな効果を決定して処理する。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dir 方向ID
 * @return なし
 * @details
@@ -3467,29 +3644,29 @@ void cast_wonder(player_type *caster_ptr, DIRECTION dir)
        else if (die < 26) heal_monster(dir, damroll(4, 6));
        else if (die < 31) poly_monster(dir, plev);
        else if (die < 36)
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
                        damroll(3 + ((plev - 1) / 5), 4));
        else if (die < 41) confuse_monster(dir, plev);
        else if (die < 46) fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
-       else if (die < 51) (void)lite_line(dir, damroll(6, 8));
+       else if (die < 51) (void)lite_line(caster_ptr, dir, damroll(6, 8));
        else if (die < 56)
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_ELEC, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
                        damroll(3 + ((plev - 5) / 4), 8));
        else if (die < 61)
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_COLD, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
                        damroll(5 + ((plev - 5) / 4), 8));
        else if (die < 66)
-               fire_bolt_or_beam(beam_chance(caster_ptr), GF_ACID, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
                        damroll(6 + ((plev - 5) / 4), 8));
        else if (die < 71)
-               fire_bolt_or_beam(beam_chance(caster_ptr), GF_FIRE, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
                        damroll(8 + ((plev - 5) / 4), 8));
-       else if (die < 76) hypodynamic_bolt(dir, 75);
+       else if (die < 76) hypodynamic_bolt(caster_ptr, dir, 75);
        else if (die < 81) fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
        else if (die < 86) fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
        else if (die < 91) fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
        else if (die < 96) fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
-       else if (die < 101) hypodynamic_bolt(dir, 100 + plev);
+       else if (die < 101) hypodynamic_bolt(caster_ptr, dir, 100 + plev);
        else if (die < 104)
        {
                earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
@@ -3502,12 +3679,15 @@ void cast_wonder(player_type *caster_ptr, DIRECTION dir)
        {
                symbol_genocide(caster_ptr, plev + 50, TRUE);
        }
-       else if (die < 110) dispel_monsters(120);
+       else if (die < 110)
+       {
+               dispel_monsters(caster_ptr, 120);
+       }
        else /* RARE */
        {
-               dispel_monsters(150);
-               slow_monsters(plev);
-               sleep_monsters(plev);
+               dispel_monsters(caster_ptr, 150);
+               slow_monsters(caster_ptr, plev);
+               sleep_monsters(caster_ptr, plev);
                hp_player(caster_ptr, 300);
        }
 }
@@ -3515,6 +3695,7 @@ void cast_wonder(player_type *caster_ptr, DIRECTION dir)
 
 /*!
 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dir 方向ID
 * @return なし
 */
@@ -3572,7 +3753,7 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
        else if (die < 36)
        {
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_MISSILE, dir,
                        damroll(3 + ((plev - 1) / 5), 4));
        }
        else if (die < 41)
@@ -3585,31 +3766,31 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
        else if (die < 51)
        {
-               (void)lite_line(dir, damroll(6, 8));
+               (void)lite_line(caster_ptr, dir, damroll(6, 8));
        }
        else if (die < 56)
        {
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_ELEC, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_ELEC, dir,
                        damroll(3 + ((plev - 5) / 4), 8));
        }
        else if (die < 61)
        {
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_COLD, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr) - 10, GF_COLD, dir,
                        damroll(5 + ((plev - 5) / 4), 8));
        }
        else if (die < 66)
        {
-               fire_bolt_or_beam(beam_chance(caster_ptr), GF_ACID, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_ACID, dir,
                        damroll(6 + ((plev - 5) / 4), 8));
        }
        else if (die < 71)
        {
-               fire_bolt_or_beam(beam_chance(caster_ptr), GF_FIRE, dir,
+               fire_bolt_or_beam(caster_ptr, beam_chance(caster_ptr), GF_FIRE, dir,
                        damroll(8 + ((plev - 5) / 4), 8));
        }
        else if (die < 76)
        {
-               hypodynamic_bolt(dir, 75);
+               hypodynamic_bolt(caster_ptr, dir, 75);
        }
        else if (die < 81)
        {
@@ -3629,7 +3810,7 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
        else if (die < 101)
        {
-               hypodynamic_bolt(dir, 100 + plev);
+               hypodynamic_bolt(caster_ptr, dir, 100 + plev);
        }
        else if (die < 104)
        {
@@ -3641,17 +3822,17 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
        else if (die < 108)
        {
-               symbol_genocide(p_ptr, plev + 50, TRUE);
+               symbol_genocide(caster_ptr, plev + 50, TRUE);
        }
        else if (die < 110)
        {
-               dispel_monsters(120);
+               dispel_monsters(caster_ptr, 120);
        }
        else
        { /* RARE */
-               dispel_monsters(150);
-               slow_monsters(plev);
-               sleep_monsters(plev);
+               dispel_monsters(caster_ptr, 150);
+               slow_monsters(caster_ptr, plev);
+               sleep_monsters(caster_ptr, plev);
                hp_player(caster_ptr, 300);
        }
 
@@ -3664,6 +3845,7 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
 
 /*!
 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
 void cast_shuffle(player_type *caster_ptr)
@@ -3681,8 +3863,7 @@ void cast_shuffle(player_type *caster_ptr)
                die = (randint1(110)) + plev / 5;
        else
                die = randint1(120);
-
-
+       
        if (vir)
        {
                if (caster_ptr->virtues[vir - 1] > 0)
@@ -3721,7 +3902,7 @@ void cast_shuffle(player_type *caster_ptr)
        else if (die < 22)
        {
                msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
-               aggravate_monsters(0);
+               aggravate_monsters(caster_ptr, 0);
        }
        else if (die < 26)
        {
@@ -3737,7 +3918,7 @@ void cast_shuffle(player_type *caster_ptr)
        else if (die < 33)
        {
                msg_print(_("《月》だ。", "It's the Moon."));
-               unlite_area(10, 3);
+               unlite_area(caster_ptr, 10, 3);
        }
        else if (die < 38)
        {
@@ -3840,6 +4021,7 @@ void cast_shuffle(player_type *caster_ptr)
 
 /*!
  * @brief 口を使う継続的な処理を中断する
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  */
 void stop_mouth(player_type *caster_ptr)
@@ -3880,7 +4062,7 @@ bool_hack vampirism(player_type *caster_ptr)
 
        dummy = caster_ptr->lev * 2;
 
-       if (hypodynamic_bolt(dir, dummy))
+       if (hypodynamic_bolt(caster_ptr, dir, dummy))
        {
                if (caster_ptr->food < PY_FOOD_FULL)
                        /* No heal if we are "full" */
@@ -3901,6 +4083,7 @@ bool_hack vampirism(player_type *caster_ptr)
        return TRUE;
 }
 
+
 bool panic_hit(void)
 {
        DIRECTION dir;
@@ -3924,11 +4107,12 @@ bool panic_hit(void)
                msg_print(NULL);
                return FALSE;
        }
-
 }
 
+
 /*!
 * @brief 超能力者のサイコメトリー処理/ Forcibly pseudo-identify an object in the inventory (or on the floor)
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @return なし
 * @note
 * currently this function allows pseudo-id of any object,
@@ -4055,6 +4239,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_SHARDS;
                                Type_desc = _("破片", "shards");
                        }
+
                        break;
                case CLASS_MAGE:
                case CLASS_WARRIOR_MAGE:
@@ -4074,6 +4259,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_DISENCHANT;
                                Type_desc = _("劣化", "disenchantment");
                        }
+
                        break;
                case CLASS_CHAOS_WARRIOR:
                        if (!one_in_(3))
@@ -4086,6 +4272,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_CHAOS;
                                Type_desc = _("カオス", "chaos");
                        }
+
                        break;
                case CLASS_MONK:
                case CLASS_SAMURAI:
@@ -4100,6 +4287,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_SOUND;
                                Type_desc = _("轟音", "sound");
                        }
+
                        break;
                case CLASS_MINDCRAFTER:
                        if (!one_in_(3))
@@ -4112,6 +4300,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_PSI;
                                Type_desc = _("精神エネルギー", "mental energy");
                        }
+
                        break;
                case CLASS_PRIEST:
                case CLASS_PALADIN:
@@ -4125,6 +4314,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_HOLY_FIRE;
                                Type_desc = _("聖なる炎", "holy fire");
                        }
+
                        break;
                case CLASS_ROGUE:
                case CLASS_NINJA:
@@ -4138,6 +4328,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_POIS;
                                Type_desc = _("毒", "poison");
                        }
+
                        break;
                case CLASS_BARD:
                        if (!one_in_(3))
@@ -4150,6 +4341,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_CONFUSION;
                                Type_desc = _("混乱", "confusion");
                        }
+
                        break;
                }
        }
@@ -4161,6 +4353,7 @@ bool draconian_breath(player_type *creature_ptr)
        return TRUE;
 }
 
+
 bool android_inside_weapon(player_type *creature_ptr)
 {
        DIRECTION dir;
@@ -4190,9 +4383,11 @@ bool android_inside_weapon(player_type *creature_ptr)
                msg_print(_("ロケットを発射した。", "You fire a rocket."));
                fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
        }
+
        return TRUE;
 }
 
+
 bool create_ration(player_type *crature_ptr)
 {
        object_type *q_ptr;
@@ -4208,6 +4403,7 @@ bool create_ration(player_type *crature_ptr)
        return TRUE;
 }
 
+
 void hayagake(player_type *creature_ptr)
 {
        if (creature_ptr->action == ACTION_HAYAGAKE)
@@ -4229,9 +4425,11 @@ void hayagake(player_type *creature_ptr)
                        set_action(creature_ptr, ACTION_HAYAGAKE);
                }
        }
+
        creature_ptr->energy_use = 0;
 }
 
+
 bool double_attack(player_type *creature_ptr)
 {
        DIRECTION dir;
@@ -4265,9 +4463,11 @@ bool double_attack(player_type *creature_ptr)
                msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
                msg_print(NULL);
        }
+
        return TRUE;
 }
 
+
 bool comvert_hp_to_mp(player_type *creature_ptr)
 {
        int gain_sp = take_hit(p_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless convertion from HP to SP"), -1) / 5;
@@ -4284,10 +4484,12 @@ bool comvert_hp_to_mp(player_type *creature_ptr)
        {
                msg_print(_("変換に失敗した。", "You failed to convert."));
        }
+
        creature_ptr->redraw |= (PR_HP | PR_MANA);
        return TRUE;
 }
 
+
 bool comvert_mp_to_hp(player_type *creature_ptr)
 {
        if (creature_ptr->csp >= creature_ptr->lev / 5)
@@ -4299,10 +4501,12 @@ bool comvert_mp_to_hp(player_type *creature_ptr)
        {
                msg_print(_("変換に失敗した。", "You failed to convert."));
        }
+
        creature_ptr->redraw |= (PR_HP | PR_MANA);
        return TRUE;
 }
 
+
 bool demonic_breath(player_type *creature_ptr)
 {
        DIRECTION dir;
@@ -4314,6 +4518,7 @@ bool demonic_breath(player_type *creature_ptr)
        return TRUE;
 }
 
+
 bool mirror_concentration(player_type *creature_ptr)
 {
        if (total_friends)
@@ -4321,6 +4526,7 @@ bool mirror_concentration(player_type *creature_ptr)
                msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
                return FALSE;
        }
+
        if (is_mirror_grid(&p_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
        {
                msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
@@ -4337,9 +4543,11 @@ bool mirror_concentration(player_type *creature_ptr)
        {
                msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
        }
+
        return TRUE;
 }
 
+
 bool sword_dancing(player_type *creature_ptr)
 {
        DIRECTION dir;
@@ -4352,23 +4560,29 @@ bool sword_dancing(player_type *creature_ptr)
                dir = randint0(8);
                y = creature_ptr->y + ddy_ddd[dir];
                x = creature_ptr->x + ddx_ddd[dir];
-               g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
+               g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
 
                /* Hack -- attack monsters */
                if (g_ptr->m_idx)
-                       py_attack(p_ptr, y, x, 0);
+                       py_attack(creature_ptr, y, x, 0);
                else
                {
                        msg_print(_("攻撃が空をきった。", "You attack the empty air."));
                }
        }
+
        return TRUE;
 }
 
+/*!
+ * 幻惑の光
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return 常にTRUE
+*/
 bool confusing_light(player_type *creature_ptr)
 {
        msg_print(_("辺りを睨んだ...", "You glare nearby monsters..."));
-       slow_monsters(creature_ptr->lev);
+       slow_monsters(creature_ptr, creature_ptr->lev);
        stun_monsters(creature_ptr->lev * 4);
        confuse_monsters(creature_ptr->lev * 4);
        turn_monsters(creature_ptr->lev * 4);
@@ -4376,6 +4590,12 @@ bool confusing_light(player_type *creature_ptr)
        return TRUE;
 }
 
+
+/*!
+ * 荒馬慣らし
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return 結果はどうあれ騎乗したらTRUE
+*/
 bool rodeo(player_type *creature_ptr)
 {
        GAME_TEXT m_name[MAX_NLEN];
@@ -4388,6 +4608,7 @@ bool rodeo(player_type *creature_ptr)
                msg_print(_("今は乗馬中だ。", "You ARE riding."));
                return FALSE;
        }
+
        if (!do_cmd_riding(creature_ptr, TRUE)) return TRUE;
 
        m_ptr = &p_ptr->current_floor_ptr->m_list[creature_ptr->riding];
@@ -4416,9 +4637,11 @@ bool rodeo(player_type *creature_ptr)
                /* 落馬処理に失敗してもとにかく乗馬解除 */
                creature_ptr->riding = 0;
        }
+
        return TRUE;
 }
 
+
 bool clear_mind(player_type *creature_ptr)
 {
        if (total_friends)
@@ -4434,10 +4657,12 @@ bool clear_mind(player_type *creature_ptr)
                creature_ptr->csp = creature_ptr->msp;
                creature_ptr->csp_frac = 0;
        }
+
        creature_ptr->redraw |= (PR_MANA);
        return TRUE;
 }
 
+
 bool concentration(player_type *creature_ptr)
 {
        int max_csp = MAX(creature_ptr->msp * 4, creature_ptr->lev * 5 + 5);
@@ -4447,11 +4672,13 @@ bool concentration(player_type *creature_ptr)
                msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
                return FALSE;
        }
+
        if (creature_ptr->special_defense & KATA_MASK)
        {
                msg_print(_("今は構えに集中している。", "You need concentration on your form."));
                return FALSE;
        }
+
        msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
 
        creature_ptr->csp += creature_ptr->msp / 2;
@@ -4460,6 +4687,7 @@ bool concentration(player_type *creature_ptr)
                creature_ptr->csp = max_csp;
                creature_ptr->csp_frac = 0;
        }
+
        creature_ptr->redraw |= (PR_MANA);
        return TRUE;
 }