OSDN Git Service

[Refactor] #39963 Moved TELEPORT_* from spells.h to spells-util.h and made them enum...
[hengband/hengband.git] / src / spells2.c
index 995d86e..038a135 100644 (file)
 #include "angband.h"
 #include "core.h"
 #include "util.h"
+#include "main/sound-definitions-table.h"
 
 #include "creature.h"
 
 #include "artifact.h"
-#include "cmd-pet.h"
-#include "cmd-dump.h"
+#include "io/write-diary.h"
+#include "cmd/cmd-pet.h"
+#include "cmd/cmd-dump.h"
 #include "floor.h"
 #include "grid.h"
 #include "trap.h"
@@ -34,8 +36,9 @@
 
 #include "spells-status.h"
 #include "spells-floor.h"
-#include "realm-hex.h"
-#include "autopick.h"
+#include "spells-diceroll.h"
+#include "realm/realm-hex.h"
+#include "autopick/autopick.h"
 #include "object-flavor.h"
 #include "object-hook.h"
 #include "monster-status.h"
 #include "dungeon.h"
 #include "floor-events.h"
 #include "feature.h"
-#include "view-mainwindow.h"
-#include "objectkind.h"
+#include "view/display-main-window.h"
+#include "object/object-kind.h"
 #include "monsterrace.h"
 #include "targeting.h"
-#include "realm-song.h"
+#include "realm/realm-song.h"
 #include "english.h"
-
-/*!
- * @brief プレイヤー周辺の地形を感知する
- * @param range 効果範囲
- * @param flag 特定地形ID
- * @param known 地形から危険フラグを外すならTRUE
- * @return 効力があった場合TRUEを返す
- */
+#include "effect/spells-effect-util.h"
+#include "spell/spells-type.h"
+
+ /*!
+  * @brief プレイヤー周辺の地形を感知する
+  * @param caster_ptr プレーヤーへの参照ポインタ
+  * @param range 効果範囲
+  * @param flag 特定地形ID
+  * @param known 地形から危険フラグを外すならTRUE
+  * @return 効力があった場合TRUEを返す
+  */
 static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag, bool known)
 {
-       POSITION x, y;
-       bool detect = FALSE;
-       grid_type *g_ptr;
-
        if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
-       /* Scan the current panel */
-       for (y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
+       grid_type *g_ptr;
+       bool detect = FALSE;
+       for (POSITION y = 1; y < caster_ptr->current_floor_ptr->height - 1; y++)
        {
-               for (x = 1; x <= caster_ptr->current_floor_ptr->width - 1; x++)
+               for (POSITION x = 1; x <= caster_ptr->current_floor_ptr->width - 1; x++)
                {
                        int dist = distance(caster_ptr->y, caster_ptr->x, y, x);
                        if (dist > range) continue;
                        g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
-
-                       /* Hack -- Safe */
                        if (flag == FF_TRAP)
                        {
                                /* Mark as detected */
@@ -91,25 +92,27 @@ static bool detect_feat_flag(player_type *caster_ptr, POSITION range, int flag,
 
                                        g_ptr->info &= ~(CAVE_UNSAFE);
 
-                                       lite_spot(y, x);
+                                       lite_spot(caster_ptr, y, x);
                                }
                        }
 
                        if (cave_have_flag_grid(g_ptr, flag))
                        {
-                               disclose_grid(y, x);
+                               disclose_grid(caster_ptr, y, x);
                                g_ptr->info |= (CAVE_MARK);
-                               lite_spot(y, x);
+                               lite_spot(caster_ptr, y, x);
                                detect = TRUE;
                        }
                }
        }
+
        return detect;
 }
 
 
 /*!
  * @brief プレイヤー周辺のトラップを感知する / Detect all traps on current panel
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @param known 感知外範囲を超える警告フラグを立てる場合TRUEを返す
  * @return 効力があった場合TRUEを返す
@@ -125,81 +128,86 @@ 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を返す
  */
 bool detect_objects_gold(player_type *caster_ptr, POSITION range)
 {
-       OBJECT_IDX i;
-       POSITION y, x;
        POSITION range2 = range;
-
-       bool detect = FALSE;
-
        if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        /* Scan objects */
-       for (i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
+       bool detect = FALSE;
+       POSITION y, x;
+       for (OBJECT_IDX i = 1; i < caster_ptr->current_floor_ptr->o_max; i++)
        {
                object_type *o_ptr = &caster_ptr->current_floor_ptr->o_list[i];
 
@@ -208,15 +216,12 @@ bool detect_objects_gold(player_type *caster_ptr, POSITION range)
 
                y = o_ptr->iy;
                x = o_ptr->ix;
-
-               /* Only detect nearby objects */
                if (distance(caster_ptr->y, caster_ptr->x, y, x) > range2) continue;
 
-               /* Detect "gold" objects */
                if (o_ptr->tval == TV_GOLD)
                {
                        o_ptr->marked |= OM_FOUND;
-                       lite_spot(y, x);
+                       lite_spot(caster_ptr, y, x);
                        detect = TRUE;
                }
        }
@@ -227,123 +232,111 @@ 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);
+
+       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;
        POSITION range2 = range;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
 
        bool detect = FALSE;
-
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range2 /= 3;
-
-       /* Scan objects */
-       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+       for (OBJECT_IDX 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;
 
-               y = o_ptr->iy;
-               x = o_ptr->ix;
+               POSITION y = o_ptr->iy;
+               POSITION 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)
                {
                        o_ptr->marked |= OM_FOUND;
-                       lite_spot(y, x);
+                       lite_spot(caster_ptr, y, x);
                        detect = 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 objects!"));
        }
 
-       if (detect_monsters_string(range, "!=?|/`"))
+       if (detect_monsters_string(caster_ptr, range, "!=?|/`"))
        {
                detect = TRUE;
        }
-       return (detect);
+
+       return detect;
 }
 
 
 /*!
  * @brief 魔法効果のあるのアイテムオブジェクトを感知する / Detect all "magic" objects on the current panel.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param range 効果範囲
  * @return 効力があった場合TRUEを返す
  * @details
  * <pre>
  * This will light up all spaces with "magic" items, including artifacts,
- * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings,
+ * ego-items, potions, scrolls, books, rods, wands, staffs, amulets, rings,
  * and "enchanted" items of the "good" variety.
  *
  * 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;
-       POSITION y, x;
+       if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
 
+       OBJECT_TYPE_VALUE tv;
        bool detect = FALSE;
-
-       if (d_info[p_ptr->dungeon_idx].flags1 & DF1_DARKNESS) range /= 3;
-
-       /* Scan all objects */
-       for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
+       for (OBJECT_IDX 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;
 
-               y = o_ptr->iy;
-               x = o_ptr->ix;
+               POSITION y = o_ptr->iy;
+               POSITION 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;
-
-               /* Artifacts, misc magic items, or enchanted wearables */
                if (object_is_artifact(o_ptr) ||
                        object_is_ego(o_ptr) ||
-                   (tv == TV_WHISTLE) ||
-                   (tv == TV_AMULET) ||
+                       (tv == TV_WHISTLE) ||
+                       (tv == TV_AMULET) ||
                        (tv == TV_RING) ||
-                   (tv == TV_STAFF) ||
+                       (tv == TV_STAFF) ||
                        (tv == TV_WAND) ||
                        (tv == TV_ROD) ||
-                   (tv == TV_SCROLL) ||
+                       (tv == TV_SCROLL) ||
                        (tv == TV_POTION) ||
-                   (tv == TV_LIFE_BOOK) ||
+                       (tv == TV_LIFE_BOOK) ||
                        (tv == TV_SORCERY_BOOK) ||
-                   (tv == TV_NATURE_BOOK) ||
+                       (tv == TV_NATURE_BOOK) ||
                        (tv == TV_CHAOS_BOOK) ||
-                   (tv == TV_DEATH_BOOK) ||
-                   (tv == TV_TRUMP_BOOK) ||
+                       (tv == TV_DEATH_BOOK) ||
+                       (tv == TV_TRUMP_BOOK) ||
                        (tv == TV_ARCANE_BOOK) ||
                        (tv == TV_CRAFT_BOOK) ||
                        (tv == TV_DAEMON_BOOK) ||
@@ -351,417 +344,372 @@ bool detect_objects_magic(POSITION range)
                        (tv == TV_MUSIC_BOOK) ||
                        (tv == TV_HISSATSU_BOOK) ||
                        (tv == TV_HEX_BOOK) ||
-                   ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
+                       ((o_ptr->to_a > 0) || (o_ptr->to_h + o_ptr->to_d > 0)))
                {
-                       /* Memorize the item */
                        o_ptr->marked |= OM_FOUND;
-                       lite_spot(y, x);
+                       lite_spot(caster_ptr, y, x);
                        detect = TRUE;
                }
        }
+
        if (detect)
        {
                msg_print(_("魔法のアイテムの存在を感じとった!", "You sense the presence of magic objects!"));
        }
 
-       /* Return result */
-       return (detect);
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
-
-               /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > range) continue;
+               POSITION y = m_ptr->fy;
+               POSITION x = m_ptr->fx;
+               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);
+
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
+               POSITION y = m_ptr->fy;
+               POSITION 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);
+
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
+               POSITION y = m_ptr->fy;
+               POSITION 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)
                {
                        if (is_original_ap(m_ptr))
                        {
-                               /* Take note that they are evil */
                                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);
                                }
                        }
 
-                       /* 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 evil creatures!"));
        }
-       return (flag);
+
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
+               POSITION y = m_ptr->fy;
+               POSITION x = m_ptr->fx;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > range) continue;
 
-               /* Only detect nearby monsters */
-               if (distance(p_ptr->y, p_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);
+
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
+               POSITION y = m_ptr->fy;
+               POSITION 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);
+
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
+               POSITION y = m_ptr->fy;
+               POSITION 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);
+
+       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++)
+       bool flag = FALSE;
+       for (MONSTER_IDX 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;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
+               POSITION y = m_ptr->fy;
+               POSITION 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))
                {
                        if (is_original_ap(m_ptr))
                        {
-                               /* Take note that they are something */
                                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);
                                }
                        }
 
-                       /* 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;
                }
        }
+
+       concptr desc_monsters = _("変なモンスター", "weird monsters");
        if (flag)
        {
                switch (match_flag)
                {
-                       case RF3_DEMON:
+               case RF3_DEMON:
                        desc_monsters = _("デーモン", "demons");
-                               break;
-                       case RF3_UNDEAD:
+                       break;
+               case RF3_UNDEAD:
                        desc_monsters = _("アンデッド", "the undead");
-                               break;
+                       break;
                }
 
                msg_format(_("%sの存在を感じとった!", "You sense the presence of %s!"), desc_monsters);
                msg_print(NULL);
        }
-       return (flag);
+
+       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;
-
-       /* 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_traps(caster_ptr, range, TRUE)) detect = TRUE;
+       if (detect_doors(caster_ptr, range)) detect = TRUE;
+       if (detect_stairs(caster_ptr, 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);
 }
 
@@ -781,84 +729,80 @@ bool detect_all(POSITION range)
  */
 bool project_all_los(player_type *caster_ptr, EFFECT_ID typ, HIT_POINT dam)
 {
-       MONSTER_IDX i;
-       POSITION x, y;
-       BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
-       bool obvious = FALSE;
-
-       /* Mark all (nearby) monsters */
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; 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;
-
-               /* Require line of sight */
-               if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
+               POSITION y = m_ptr->fy;
+               POSITION x = m_ptr->fx;
+               if (!player_has_los_bold(caster_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)) continue;
 
-               /* Mark the monster */
                m_ptr->mflag |= (MFLAG_LOS);
        }
 
-       /* Affect all marked monsters */
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       BIT_FLAGS flg = PROJECT_JUMP | PROJECT_KILL | PROJECT_HIDE;
+       bool obvious = FALSE;
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
                monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-
-               /* Skip unmarked monsters */
                if (!(m_ptr->mflag & (MFLAG_LOS))) continue;
 
-               /* Remove mark */
                m_ptr->mflag &= ~(MFLAG_LOS);
+               POSITION y = m_ptr->fy;
+               POSITION x = m_ptr->fx;
 
-               y = m_ptr->fy;
-               x = m_ptr->fx;
-
-               /* Jump directly to the target monster */
                if (project(caster_ptr, 0, 0, y, x, dam, typ, flg, -1)) obvious = TRUE;
        }
-       return (obvious);
+
+       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,136 +815,167 @@ 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));
 }
 
+
+/*!
+ * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
+ * @brief 聖浄の杖の効果
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @magic 魔法の効果である場合TRUE (杖と同じ効果の呪文はあったか? 要調査)
+ * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
+ */
 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(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;
+       if (set_cut(creature_ptr, 0)) ident = TRUE;
        return ident;
 }
 
+
+/*!
+ * todo ここにこれがあるのは少し違和感、spells-staffonlyとかに分離したい
+ * @brief 魔力の嵐の杖の効果
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @powerful 効果が増強される時TRUE (TRUEになるタイミングはあるか? 要調査)
+ */
 bool unleash_mana_storm(player_type *creature_ptr, bool powerful)
 {
        msg_print(_("強力な魔力が敵を引き裂いた!", "Mighty magics rend your enemies!"));
        project(creature_ptr, 0, (powerful ? 7 : 5), creature_ptr->y, creature_ptr->x,
-       (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))
+               (randint1(200) + (powerful ? 500 : 300)) * 2, GF_MANA, PROJECT_KILL | PROJECT_ITEM | PROJECT_GRID, -1);
+
+       bool is_special_class = creature_ptr->pclass != CLASS_MAGE;
+       is_special_class &= creature_ptr->pclass != CLASS_HIGH_MAGE;
+       is_special_class &= creature_ptr->pclass != CLASS_SORCERER;
+       is_special_class &= creature_ptr->pclass != CLASS_MAGIC_EATER;
+       is_special_class &= creature_ptr->pclass != CLASS_BLUE_MAGE;
+       if (is_special_class)
        {
-               (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)
 {
-       return (project_all_los(caster_ptr, GF_CRUSADE, caster_ptr->lev*4));
+       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 (MONSTER_IDX 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) */
                if (i == who) continue;
 
-               /* Wake up nearby sleeping monsters */
                if (m_ptr->cdis < MAX_SIGHT * 2)
                {
-                       /* Wake up */
                        if (MON_CSLEEP(m_ptr))
                        {
-                               (void)set_monster_csleep(i, 0);
+                               (void)set_monster_csleep(caster_ptr, i, 0);
                                sleep = TRUE;
                        }
+
                        if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
                }
 
-               /* 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))
                        {
-                               (void)set_monster_fast(i, MON_FAST(m_ptr) + 100);
+                               (void)set_monster_fast(caster_ptr, i, MON_FAST(m_ptr) + 100);
                                speed = TRUE;
                        }
                }
@@ -1008,7 +983,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;
 }
 
 
@@ -1023,60 +998,58 @@ void aggravate_monsters(MONSTER_IDX who)
  */
 bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool player_cast, int dam_side, concptr spell_name)
 {
-       int          msec = delay_factor * delay_factor * delay_factor;
        monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
-       bool         resist = FALSE;
-
        if (is_pet(m_ptr) && !player_cast) return FALSE;
 
-       /* Hack -- Skip Unique Monsters or Quest Monsters */
+       bool resist = FALSE;
        if (r_ptr->flags1 & (RF1_UNIQUE | RF1_QUESTOR)) resist = TRUE;
        else if (r_ptr->flags7 & RF7_UNIQUE2) resist = TRUE;
        else if (m_idx == caster_ptr->riding) resist = TRUE;
-       else if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) resist = TRUE;
+       else if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr, caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out) resist = TRUE;
        else if (player_cast && (r_ptr->level > randint0(power))) resist = TRUE;
        else if (player_cast && (m_ptr->mflag2 & MFLAG2_NOGENO)) resist = TRUE;
-
        else
        {
                if (record_named_pet && is_pet(m_ptr) && m_ptr->nickname)
                {
                        GAME_TEXT m_name[MAX_NLEN];
-
-                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                       exe_write_diary(caster_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
+                       monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
+                       exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_GENOCIDE, m_name);
                }
 
-               delete_monster_idx(m_idx);
+               delete_monster_idx(caster_ptr, m_idx);
        }
 
        if (resist && player_cast)
        {
                bool see_m = is_seen(m_ptr);
                GAME_TEXT m_name[MAX_NLEN];
-
-               monster_desc(m_name, m_ptr, 0);
+               monster_desc(caster_ptr, m_name, m_ptr, 0);
                if (see_m)
                {
                        msg_format(_("%^sには効果がなかった。", "%^s is unaffected."), m_name);
                }
+
                if (MON_CSLEEP(m_ptr))
                {
-                       (void)set_monster_csleep(m_idx, 0);
+                       (void)set_monster_csleep(caster_ptr, m_idx, 0);
                        if (m_ptr->ml)
                        {
                                msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
                        }
                }
+
                if (is_friendly(m_ptr) && !is_pet(m_ptr))
                {
                        if (see_m)
                        {
                                msg_format(_("%sは怒った!", "%^s gets angry!"), m_name);
                        }
-                       set_hostile(m_ptr);
+
+                       set_hostile(caster_ptr, m_ptr);
                }
+
                if (one_in_(13)) m_ptr->mflag2 |= MFLAG2_NOGENO;
        }
 
@@ -1085,15 +1058,13 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl
                take_hit(caster_ptr, DAMAGE_GENO, randint1(dam_side), format(_("%^sの呪文を唱えた疲労", "the strain of casting %^s"), spell_name), -1);
        }
 
-       /* Visual feedback */
        move_cursor_relative(caster_ptr->y, caster_ptr->x);
-
        caster_ptr->redraw |= (PR_HP);
        caster_ptr->window |= (PW_PLAYER);
-
-       handle_stuff();
+       handle_stuff(caster_ptr);
        Term_fresh();
 
+       int msec = delay_factor * delay_factor * delay_factor;
        Term_xtra(TERM_XTRA_DELAY, msec);
 
        return !resist;
@@ -1108,28 +1079,24 @@ bool genocide_aux(player_type *caster_ptr, MONSTER_IDX m_idx, int power, bool pl
  */
 bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
 {
-       MONSTER_IDX i;
-       char typ;
-       bool result = FALSE;
-
-       /* Prevent genocide in quest levels */
-       if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+       bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
+       is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
+       is_special_floor |= caster_ptr->phase_out;
+       if (is_special_floor)
        {
                msg_print(_("何も起きないようだ……", "It seems nothing happen here..."));
-               return (FALSE);
+               return FALSE;
        }
 
-       /* Mega-Hack -- Get a monster symbol */
-       while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE)) ;
-
-       /* Delete the monsters of that "type" */
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       char typ;
+       while (!get_com(_("どの種類(文字)のモンスターを抹殺しますか: ", "Choose a monster race (by symbol) to genocide: "), &typ, FALSE));
+       bool result = FALSE;
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; 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;
-
-               /* Skip "wrong" monsters */
                if (r_ptr->d_char != typ) continue;
 
                result |= genocide_aux(caster_ptr, i, power, player_cast, 4, _("抹殺", "Genocide"));
@@ -1153,25 +1120,22 @@ bool symbol_genocide(player_type *caster_ptr, int power, bool player_cast)
  */
 bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
 {
-       MONSTER_IDX i;
-       bool result = FALSE;
-
-       /* Prevent mass genocide in quest levels */
-       if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+       bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
+       is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
+       is_special_floor |= caster_ptr->phase_out;
+       if (is_special_floor)
        {
-               return (FALSE);
+               return FALSE;
        }
 
-       /* Delete the (nearby) monsters */
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       bool result = FALSE;
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
                monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                if (!monster_is_valid(m_ptr)) continue;
-
-               /* Skip distant monsters */
                if (m_ptr->cdis > MAX_SIGHT) continue;
 
-               /* Note effect */
                result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("周辺抹殺", "Mass Genocide"));
        }
 
@@ -1193,28 +1157,24 @@ bool mass_genocide(player_type *caster_ptr, int power, bool player_cast)
  */
 bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
 {
-       MONSTER_IDX i;
-       bool result = FALSE;
-
-       /* Prevent mass genocide in quest levels */
-       if ((caster_ptr->current_floor_ptr->inside_quest && !random_quest_number(caster_ptr->current_floor_ptr->dun_level)) || caster_ptr->current_floor_ptr->inside_arena || caster_ptr->phase_out)
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+       bool is_special_floor = floor_ptr->inside_quest && !random_quest_number(caster_ptr, floor_ptr->dun_level);
+       is_special_floor |= caster_ptr->current_floor_ptr->inside_arena;
+       is_special_floor |= caster_ptr->phase_out;
+       if (is_special_floor)
        {
-               return (FALSE);
+               return FALSE;
        }
 
-       /* Delete the (nearby) monsters */
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       bool result = FALSE;
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; 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;
-
                if (!(r_ptr->flags3 & RF3_UNDEAD)) continue;
-
-               /* Skip distant monsters */
                if (m_ptr->cdis > MAX_SIGHT) continue;
 
-               /* Note effect */
                result |= genocide_aux(caster_ptr, i, power, player_cast, 3, _("アンデッド消滅", "Annihilate Undead"));
        }
 
@@ -1234,120 +1194,89 @@ bool mass_genocide_undead(player_type *caster_ptr, int power, bool player_cast)
  */
 bool probing(player_type *caster_ptr)
 {
-       int i;
-       int speed; /* TODO */
-       bool_hack cu, cv;
-       bool probe = FALSE;
-       char buf[256];
-       concptr align;
-
-       cu = Term->scr->cu;
-       cv = Term->scr->cv;
+       bool_hack cu = Term->scr->cu;
+       bool_hack cv = Term->scr->cv;
        Term->scr->cu = 0;
        Term->scr->cv = 1;
 
-       /* Probe all (nearby) monsters */
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       bool probe = FALSE;
+       int speed;
+       char buf[256];
+       concptr align;
+       for (int i = 1; i < caster_ptr->current_floor_ptr->m_max; 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(caster_ptr, m_ptr->fy, m_ptr->fx)) continue;
+               if (!m_ptr->ml) continue;
 
-               /* Probe visible monsters */
-               if (m_ptr->ml)
-               {
-                       GAME_TEXT m_name[MAX_NLEN];
-
-                       /* Start the message */
-                       if (!probe)
-                       {
-                               msg_print(_("調査中...", "Probing..."));
-                       }
-
-                       msg_print(NULL);
-
-                       if (!is_original_ap(m_ptr))
-                       {
-                               if (m_ptr->mflag2 & MFLAG2_KAGE)
-                                       m_ptr->mflag2 &= ~(MFLAG2_KAGE);
-
-                               m_ptr->ap_r_idx = m_ptr->r_idx;
-                               lite_spot(m_ptr->fy, m_ptr->fx);
-                       }
-                       /* Get "the monster" or "something" */
-                       monster_desc(m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
-
-                       speed = m_ptr->mspeed - 110;
-                       if (MON_FAST(m_ptr)) speed += 10;
-                       if (MON_SLOW(m_ptr)) speed -= 10;
-                       if (ironman_nightmare) speed += 5;
-
-                       /* Get the monster's alignment */
-                       if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
-                       else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
-                       else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
-                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
-                       else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
-                       else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
-                       else align = _("中立", "neutral");
-
-                       sprintf(buf,_("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
-                               m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
-
-                       if (r_ptr->next_r_idx)
-                       {
-                               strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
-                       }
-                       else
-                       {
-                               strcat(buf, "xxx ");
-                       }
+               GAME_TEXT m_name[MAX_NLEN];
+               if (!probe) msg_print(_("調査中...", "Probing..."));
+               msg_print(NULL);
 
-                       if (MON_CSLEEP(m_ptr)) strcat(buf,_("睡眠 ", "sleeping "));
-                       if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
-                       if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
-                       if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
-                       if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
-                       buf[strlen(buf)-1] = '\0';
-                       prt(buf, 0, 0);
+               if (!is_original_ap(m_ptr))
+               {
+                       if (m_ptr->mflag2 & MFLAG2_KAGE)
+                               m_ptr->mflag2 &= ~(MFLAG2_KAGE);
 
-                       /* HACK : Add the line to message buffer */
-                       message_add(buf);
+                       m_ptr->ap_r_idx = m_ptr->r_idx;
+                       lite_spot(caster_ptr, m_ptr->fy, m_ptr->fx);
+               }
 
-                       caster_ptr->window |= (PW_MESSAGE);
-                       handle_stuff();
+               monster_desc(caster_ptr, m_name, m_ptr, MD_IGNORE_HALLU | MD_INDEF_HIDDEN);
+               speed = m_ptr->mspeed - 110;
+               if (MON_FAST(m_ptr)) speed += 10;
+               if (MON_SLOW(m_ptr)) speed -= 10;
+               if (ironman_nightmare) speed += 5;
 
-                       if (m_ptr->ml) move_cursor_relative(m_ptr->fy, m_ptr->fx);
-                       inkey();
+               if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = _("善悪", "good&evil");
+               else if (r_ptr->flags3 & RF3_EVIL) align = _("邪悪", "evil");
+               else if (r_ptr->flags3 & RF3_GOOD) align = _("善良", "good");
+               else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = _("中立(善悪)", "neutral(good&evil)");
+               else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = _("中立(邪悪)", "neutral(evil)");
+               else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = _("中立(善良)", "neutral(good)");
+               else align = _("中立", "neutral");
 
-                       Term_erase(0, 0, 255);
+               sprintf(buf, _("%s ... 属性:%s HP:%d/%d AC:%d 速度:%s%d 経験:", "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:"),
+                       m_name, align, (int)m_ptr->hp, (int)m_ptr->maxhp, r_ptr->ac, (speed > 0) ? "+" : "", speed);
 
-                       /* Learn everything about this monster */
-                       if (lore_do_probe(m_ptr->r_idx))
-                       {
-                               /* Get base name of monster */
-                               strcpy(buf, (r_name + r_ptr->name));
+               if (r_ptr->next_r_idx)
+               {
+                       strcat(buf, format("%d/%d ", m_ptr->exp, r_ptr->next_exp));
+               }
+               else
+               {
+                       strcat(buf, "xxx ");
+               }
 
+               if (MON_CSLEEP(m_ptr)) strcat(buf, _("睡眠 ", "sleeping "));
+               if (MON_STUNNED(m_ptr)) strcat(buf, _("朦朧 ", "stunned "));
+               if (MON_MONFEAR(m_ptr)) strcat(buf, _("恐怖 ", "scared "));
+               if (MON_CONFUSED(m_ptr)) strcat(buf, _("混乱 ", "confused "));
+               if (MON_INVULNER(m_ptr)) strcat(buf, _("無敵 ", "invulnerable "));
+               buf[strlen(buf) - 1] = '\0';
+               prt(buf, 0, 0);
+
+               message_add(buf);
+               caster_ptr->window |= (PW_MESSAGE);
+               handle_stuff(caster_ptr);
+               move_cursor_relative(m_ptr->fy, m_ptr->fx);
+               inkey();
+               Term_erase(0, 0, 255);
+               if (lore_do_probe(caster_ptr, m_ptr->r_idx))
+               {
+                       strcpy(buf, (r_name + r_ptr->name));
 #ifdef JP
-                               /* Note that we learnt some new flags  -Mogami- */
-                               msg_format("%sについてさらに詳しくなった気がする。", buf);
+                       msg_format("%sについてさらに詳しくなった気がする。", buf);
 #else
-                               /* Pluralize it */
-                               plural_aux(buf);
-
-                               /* Note that we learnt some new flags  -Mogami- */
-                               msg_format("You now know more about %s.", buf);
+                       plural_aux(buf);
+                       msg_format("You now know more about %s.", buf);
 #endif
-                               /* Clear -more- prompt */
-                               msg_print(NULL);
-                       }
-
-                       /* Probe worked */
-                       probe = TRUE;
+                       msg_print(NULL);
                }
+
+               probe = TRUE;
        }
 
        Term->scr->cu = cu;
@@ -1359,69 +1288,71 @@ bool probing(player_type *caster_ptr)
                chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
                msg_print(_("これで全部です。", "That's all."));
        }
+
        return (probe);
 }
 
+
 /*!
  * @brief ペット爆破処理 /
  * @return なし
  */
 void discharge_minion(player_type *caster_ptr)
 {
-       MONSTER_IDX i;
        bool okay = TRUE;
-
-       for (i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
                monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
                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++)
+
+       for (MONSTER_IDX i = 1; i < caster_ptr->current_floor_ptr->m_max; i++)
        {
-               HIT_POINT dam;
                monster_type *m_ptr = &caster_ptr->current_floor_ptr->m_list[i];
-               monster_race *r_ptr;
-
                if (!m_ptr->r_idx || !is_pet(m_ptr)) continue;
-               r_ptr = &r_info[m_ptr->r_idx];
 
-               /* Uniques resist discharging */
+               monster_race *r_ptr;
+               r_ptr = &r_info[m_ptr->r_idx];
                if (r_ptr->flags1 & RF1_UNIQUE)
                {
                        GAME_TEXT m_name[MAX_NLEN];
-                       monster_desc(m_name, m_ptr, 0x00);
-                       msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists to be blasted, and run away."), m_name);
-                       delete_monster_idx(i);
+                       monster_desc(caster_ptr, m_name, m_ptr, 0x00);
+                       msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%^s resists being blasted and runs away."), m_name);
+                       delete_monster_idx(caster_ptr, i);
                        continue;
                }
-               dam = m_ptr->maxhp / 2;
+
+               HIT_POINT dam = m_ptr->maxhp / 2;
                if (dam > 100) dam = (dam - 100) / 2 + 100;
                if (dam > 400) dam = (dam - 400) / 2 + 400;
                if (dam > 800) dam = 800;
-               project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA, 
+               project(caster_ptr, i, 2 + (r_ptr->level / 20), m_ptr->fy, m_ptr->fx, dam, GF_PLASMA,
                        PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
 
                if (record_named_pet && m_ptr->nickname)
                {
                        GAME_TEXT m_name[MAX_NLEN];
 
-                       monster_desc(m_name, m_ptr, MD_INDEF_VISIBLE);
-                       exe_write_diary(caster_ptr, NIKKI_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
+                       monster_desc(caster_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
+                       exe_write_diary(caster_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_BLAST, m_name);
                }
 
-               delete_monster_idx(i);
+               delete_monster_idx(caster_ptr, i);
        }
 }
 
 
 /*!
+ * todo この辺、xとyが引数になっているが、caster_ptr->xとcaster_ptr->yで全て置き換えが効くはず……
  * @brief 部屋全体を照らすサブルーチン
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return なし
  * @details
  * <pre>
@@ -1436,70 +1367,49 @@ 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;
-
-       /* Clear them all */
-       for (i = 0; i < tmp_pos.n; i++)
+       for (int i = 0; i < tmp_pos.n; i++)
        {
                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];
-
-               /* No longer in the array */
+               grid_type *g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
                g_ptr->info &= ~(CAVE_TEMP);
-
-               /* Update only non-CAVE_GLOW grids */
-               /* if (g_ptr->info & (CAVE_GLOW)) continue; */
-
-               /* Perma-Lite */
                g_ptr->info |= (CAVE_GLOW);
-
-               /* Process affected monsters */
                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);
-
-                       /* Stupid monsters rarely wake up */
+                       update_monster(caster_ptr, g_ptr->m_idx, FALSE);
                        if (r_ptr->flags2 & (RF2_STUPID)) chance = 10;
-
-                       /* Smart monsters always wake up */
                        if (r_ptr->flags2 & (RF2_SMART)) chance = 100;
 
-                       /* Sometimes monsters wake up */
                        if (MON_CSLEEP(m_ptr) && (randint0(100) < chance))
                        {
-                               /* Wake up! */
-                               (void)set_monster_csleep(g_ptr->m_idx, 0);
-
-                               /* Notice the "waking up" */
+                               (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
                                if (m_ptr->ml)
                                {
                                        GAME_TEXT m_name[MAX_NLEN];
-                                       monster_desc(m_name, m_ptr, 0);
+                                       monster_desc(caster_ptr, m_name, m_ptr, 0);
                                        msg_format(_("%^sが目を覚ました。", "%^s wakes up."), m_name);
                                }
                        }
                }
 
-               note_spot(y, x);
-               lite_spot(y, x);
-               update_local_illumination(p_ptr, y, x);
+               note_spot(caster_ptr, y, x);
+               lite_spot(caster_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,97 +1420,77 @@ 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;
-
-       /* Clear them all */
-       for (i = 0; i < tmp_pos.n; i++)
+       for (int i = 0; i < tmp_pos.n; i++)
        {
                POSITION y = tmp_pos.y[i];
                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 */
                g_ptr->info &= ~(CAVE_TEMP);
+               if (!do_dark) continue;
 
-               /* Darken the grid */
-               if (do_dark)
+               if (caster_ptr->current_floor_ptr->dun_level || !is_daytime())
                {
-                       if (p_ptr->current_floor_ptr->dun_level || !is_daytime())
+                       for (int j = 0; j < 9; j++)
                        {
-                               for (j = 0; j < 9; j++)
+                               POSITION by = y + ddy_ddd[j];
+                               POSITION bx = x + ddx_ddd[j];
+
+                               if (in_bounds2(caster_ptr->current_floor_ptr, by, bx))
                                {
-                                       POSITION by = y + ddy_ddd[j];
-                                       POSITION bx = x + ddx_ddd[j];
+                                       grid_type *cc_ptr = &caster_ptr->current_floor_ptr->grid_array[by][bx];
 
-                                       if (in_bounds2(p_ptr->current_floor_ptr, by, bx))
+                                       if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
                                        {
-                                               grid_type *cc_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx];
-
-                                               if (have_flag(f_info[get_feat_mimic(cc_ptr)].flags, FF_GLOW))
-                                               {
-                                                       do_dark = FALSE;
-                                                       break;
-                                               }
+                                               do_dark = FALSE;
+                                               break;
                                        }
                                }
-
-                               if (!do_dark) continue;
                        }
 
-                       g_ptr->info &= ~(CAVE_GLOW);
-
-                       /* Hack -- Forget "boring" grids */
-                       if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
-                       {
-                               /* Forget the grid */
-                               if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
-                               note_spot(y, x);
-                       }
+                       if (!do_dark) continue;
+               }
 
-                       /* Process affected monsters */
-                       if (g_ptr->m_idx)
-                       {
-                               update_monster(p_ptr, g_ptr->m_idx, FALSE);
-                       }
+               g_ptr->info &= ~(CAVE_GLOW);
+               if (!have_flag(f_info[get_feat_mimic(g_ptr)].flags, FF_REMEMBER))
+               {
+                       if (!view_torch_grids) g_ptr->info &= ~(CAVE_MARK);
+                       note_spot(caster_ptr, y, x);
+               }
 
-                       lite_spot(y, x);
-                       update_local_illumination(p_ptr, y, x);
+               if (g_ptr->m_idx)
+               {
+                       update_monster(caster_ptr, g_ptr->m_idx, FALSE);
                }
+
+               lite_spot(caster_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;
        int len = 0;
        int blen = 0;
-
-       for (i = 0; i < 16; i++)
+       for (int i = 0; i < 16; i++)
        {
-               y = cy + ddy_cdd[i % 8];
-               x = cx + ddx_cdd[i % 8];
-
-               /* Found a wall, break the length */
-               if (!pass_bold(y, x))
+               POSITION y = cy + ddy_cdd[i % 8];
+               POSITION x = cx + ddx_cdd[i % 8];
+               if (!pass_bold(floor_ptr, y, x))
                {
-                       /* Track best length */
                        if (len > blen)
                        {
                                blen = len;
@@ -1614,28 +1504,28 @@ static int next_to_open(POSITION cy, POSITION cx, bool (*pass_bold)(POSITION, PO
                }
        }
 
-       return (MAX(len, blen));
+       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;
        int c = 0;
-
-       for (i = 0; i < 8; i++)
+       for (DIRECTION i = 0; i < 8; i++)
        {
                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,30 +1534,25 @@ 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];
-
-       /* Avoid infinite recursion */
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+       g_ptr = &floor_ptr->grid_array[y][x];
        if (g_ptr->info & (CAVE_TEMP)) return;
 
-       /* Do not "leave" the current room */
        if (!(g_ptr->info & (CAVE_ROOM)))
        {
                if (only_room) return;
-
-               /* Verify */
-               if (!in_bounds2(p_ptr->current_floor_ptr, y, x)) return;
-
-               /* Do not exceed the maximum spell range */
-               if (distance(p_ptr->y, p_ptr->x, y, x) > MAX_RANGE) return;
+               if (!in_bounds2(floor_ptr, y, x)) return;
+               if (distance(caster_ptr->y, caster_ptr->x, y, x) > MAX_RANGE) return;
 
                /* Verify this grid */
                /*
@@ -1678,241 +1563,217 @@ 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 */
        if (tmp_pos.n == TEMP_MAX) return;
 
-       /* Mark the grid as "seen" */
        g_ptr->info |= (CAVE_TEMP);
-
-       /* Add it to the "seen" set */
        tmp_pos.y[tmp_pos.n] = y;
        tmp_pos.x[tmp_pos.n] = x;
        tmp_pos.n++;
 }
 
-/*!
- * @brief 指定のマスが光を通すか(LOSフラグを持つか)を返す。 / Aux function -- see below
- * @param y 指定Y座標
- * @param x 指定X座標
- * @return 光を通すならばtrueを返す。
- */
-static bool cave_pass_lite_bold(POSITION y, POSITION x)
-{
-       return cave_los_bold(p_ptr->current_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_los_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);
-
-       /* While grids are in the queue, add their neighbors */
-       for (i = 0; i < tmp_pos.n; i++)
+       cave_temp_lite_room_aux(caster_ptr, y1, x1);
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+       for (int i = 0; i < tmp_pos.n; i++)
        {
-               x = tmp_pos.x[i], y = tmp_pos.y[i];
+               POSITION x = tmp_pos.x[i];
+               POSITION y = tmp_pos.y[i];
 
-               /* Walls get lit, but stop light */
-               if (!cave_pass_lite_bold(y, x)) continue;
+               if (!cave_los_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();
-
-       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       cave_temp_room_lite(caster_ptr);
+       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);
-
-       /* Spread, breadth first */
-       for (i = 0; i < tmp_pos.n; i++)
+       cave_temp_unlite_room_aux(caster_ptr, y1, x1);
+       for (int i = 0; i < tmp_pos.n; i++)
        {
-               x = tmp_pos.x[i], y = tmp_pos.y[i];
-
-               /* Walls get dark, but stop darkness */
-               if (!cave_pass_dark_bold(y, x)) continue;
+               POSITION x = tmp_pos.x[i];
+               POSITION y = tmp_pos.y[i];
+               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)
-{
-       HIT_POINT num = damroll(5, 3);
-       POSITION y = 0, x = 0;
-       int k;
-       int attempts;
 
-       if (!p_ptr->blind && !magic)
+/*!
+ * @brief スターライトの効果を発生させる
+ * @param caster_ptr プレーヤーへの参照ポインタ
+ * @param magic 魔法による効果であればTRUE、スターライトの杖による効果であればFALSE
+ * @return 常にTRUE
+ */
+bool starlight(player_type *caster_ptr, bool magic)
+{
+       if (!caster_ptr->blind && !magic)
        {
                msg_print(_("杖の先が明るく輝いた...", "The end of the staff glows brightly..."));
        }
-       for (k = 0; k < num; k++)
+
+       HIT_POINT num = damroll(5, 3);
+       int attempts;
+       POSITION y = 0, x = 0;
+       for (int 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(caster_ptr, &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."));
+               msg_print(_("ダンジョンが光を吸収した。", "The darkness of this dungeon absorbs 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);
+       BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
+       (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);
+       return TRUE;
 }
 
 
 /*!
  * @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);
+       BIT_FLAGS flg = PROJECT_GRID | PROJECT_KILL;
+       (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);
+       return TRUE;
 }
 
 
-
 /*!
  * @brief ボール系スペルの発動 / Cast a ball spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -1927,29 +1788,26 @@ bool unlite_area(HIT_POINT dam, POSITION rad)
  */
 bool fire_ball(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
 {
-       POSITION tx, ty;
-
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
+       if (typ == GF_CHARM_LIVING) flg |= PROJECT_HIDE;
 
-       if (typ == GF_CHARM_LIVING) flg|= PROJECT_HIDE;
-       /* Use the given direction */
-       tx = caster_ptr->x + 99 * ddx[dir];
-       ty = caster_ptr->y + 99 * ddy[dir];
+       POSITION tx = caster_ptr->x + 99 * ddx[dir];
+       POSITION ty = caster_ptr->y + 99 * ddy[dir];
 
-       /* Hack -- Use an actual "target" */
-       if ((dir == 5) && target_okay())
+       if ((dir == 5) && target_okay(caster_ptr))
        {
                flg &= ~(PROJECT_STOP);
                tx = target_col;
                ty = target_row;
        }
 
-       /* Analyze the "dir" and the "target".  Hurt items on floor. */
-       return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
+       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 +1828,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 威力
@@ -1984,27 +1843,22 @@ bool fire_breath(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POIN
  */
 bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
 {
-       POSITION tx, ty;
-       BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
-
-       /* Use the given direction */
-       tx = caster_ptr->x + 99 * ddx[dir];
-       ty = caster_ptr->y + 99 * ddy[dir];
-
-       /* Hack -- Use an actual "target" */
-       if ((dir == 5) && target_okay())
+       POSITION tx = caster_ptr->x + 99 * ddx[dir];
+       POSITION ty = caster_ptr->y + 99 * ddy[dir];
+       if ((dir == 5) && target_okay(caster_ptr))
        {
                tx = target_col;
                ty = target_row;
        }
 
-       /* Analyze the "dir" and the "target".  Hurt items on floor. */
+       BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL;
        return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
 }
 
 
 /*!
  * @brief ボール(ハイド)系スペルの発動 / Cast a ball spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2019,28 +1873,23 @@ bool fire_rocket(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POIN
  */
 bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, POSITION rad)
 {
-       POSITION tx, ty;
+       POSITION tx = caster_ptr->x + 99 * ddx[dir];
+       POSITION ty = caster_ptr->y + 99 * ddy[dir];
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_HIDE;
-
-       /* Use the given direction */
-       tx = caster_ptr->x + 99 * ddx[dir];
-       ty = caster_ptr->y + 99 * ddy[dir];
-
-       /* Hack -- Use an actual "target" */
-       if ((dir == 5) && target_okay())
+       if ((dir == 5) && target_okay(caster_ptr))
        {
                flg &= ~(PROJECT_STOP);
                tx = target_col;
                ty = target_row;
        }
 
-       /* Analyze the "dir" and the "target".  Hurt items on floor. */
        return (project(caster_ptr, 0, rad, ty, tx, dam, typ, flg, -1));
 }
 
 
 /*!
  * @brief メテオ系スペルの発動 / Cast a meteor spell
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param who スぺル詠唱者のモンスターID(0=プレイヤー)
  * @param typ 効果属性
  * @param dam 威力
@@ -2050,24 +1899,23 @@ bool fire_ball_hide(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_P
  * @return 作用が実際にあった場合TRUEを返す
  * @details
  * <pre>
- * Cast a meteor spell, defined as a ball spell cast by an arbitary monster, 
- * player, or outside source, that starts out at an arbitrary location, and 
- * leaving no trail from the "caster" to the target.  This function is 
+ * Cast a meteor spell, defined as a ball spell cast by an arbitary monster,
+ * player, or outside source, that starts out at an arbitrary location, and
+ * leaving no trail from the "caster" to the target.  This function is
  * especially useful for bombardments and similar. -LM-
  * 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 威力ダイス数
@@ -2078,25 +1926,9 @@ bool fire_meteor(MONSTER_IDX who, EFFECT_ID typ, POSITION y, POSITION x, HIT_POI
  */
 bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMBER dd, DICE_SID ds, int num, int dev)
 {
-       POSITION ly, lx;
-       int ld;
        POSITION ty, tx, y, x;
-       int i;
-
-       BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
-
-       /* Assume okay */
-       bool result = TRUE;
-
-       /* Use the given direction */
-       if (dir != 5)
-       {
-               ly = ty = caster_ptr->y + 20 * ddy[dir];
-               lx = tx = caster_ptr->x + 20 * ddx[dir];
-       }
-
-       /* Use an actual "target" */
-       else /* if (dir == 5) */
+       POSITION ly, lx;
+       if (dir == 5)
        {
                tx = target_col;
                ty = target_row;
@@ -2104,13 +1936,18 @@ bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMB
                lx = 20 * (tx - caster_ptr->x) + caster_ptr->x;
                ly = 20 * (ty - caster_ptr->y) + caster_ptr->y;
        }
+       else
+       {
+               ly = ty = caster_ptr->y + 20 * ddy[dir];
+               lx = tx = caster_ptr->x + 20 * ddx[dir];
+       }
 
-       ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
-
-       /* Blast */
-       for (i = 0; i < num; i++)
+       int ld = distance(caster_ptr->y, caster_ptr->x, ly, lx);
+       BIT_FLAGS flg = PROJECT_FAST | PROJECT_THRU | PROJECT_STOP | PROJECT_KILL | PROJECT_REFLECTABLE | PROJECT_GRID;
+       bool result = TRUE;
+       for (int i = 0; i < num; i++)
        {
-               while (1)
+               while (TRUE)
                {
                        /* Get targets for some bolts */
                        y = rand_spread(ly, ld * dev / 20);
@@ -2126,23 +1963,20 @@ bool fire_blast(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, DICE_NUMB
                }
        }
 
-       return (result);
+       return result;
 }
 
 
 /*!
  * @brief モンスターとの位置交換処理 / Switch position with a monster.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
 {
        POSITION tx, ty;
-       grid_type* g_ptr;
-       monster_type* m_ptr;
-       monster_race* r_ptr;
-
-       if ((dir == 5) && target_okay())
+       if ((dir == 5) && target_okay(caster_ptr))
        {
                tx = target_col;
                ty = target_row;
@@ -2152,7 +1986,6 @@ bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
                tx = caster_ptr->x + ddx[dir];
                ty = caster_ptr->y + ddy[dir];
        }
-       g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
 
        if (caster_ptr->anti_tele)
        {
@@ -2160,6 +1993,8 @@ bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
                return FALSE;
        }
 
+       grid_type* g_ptr;
+       g_ptr = &caster_ptr->current_floor_ptr->grid_array[ty][tx];
        if (!g_ptr->m_idx || (g_ptr->m_idx == caster_ptr->riding))
        {
                msg_print(_("それとは場所を交換できません。", "You can't trade places with that!"));
@@ -2172,30 +2007,29 @@ bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
                return FALSE;
        }
 
+       monster_type* m_ptr;
+       monster_race* r_ptr;
        m_ptr = &caster_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
-       (void)set_monster_csleep(g_ptr->m_idx, 0);
+       (void)set_monster_csleep(caster_ptr, g_ptr->m_idx, 0);
 
        if (r_ptr->flagsr & RFR_RES_TELE)
        {
                msg_print(_("テレポートを邪魔された!", "Your teleportation is blocked!"));
-               if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
+               if (is_original_ap_and_seen(caster_ptr, m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
                return FALSE;
        }
 
        sound(SOUND_TELEPORT);
-
-       /* Swap the player and monster */
        (void)move_player_effect(caster_ptr, ty, tx, MPE_FORGET_FLOW | MPE_HANDLE_STUFF | MPE_DONT_PICKUP);
-
-       /* Success */
        return TRUE;
 }
 
 
 /*!
  * @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 威力
@@ -2204,29 +2038,22 @@ bool teleport_swap(player_type *caster_ptr, DIRECTION dir)
  */
 bool project_hook(player_type *caster_ptr, EFFECT_ID typ, DIRECTION dir, HIT_POINT dam, BIT_FLAGS flg)
 {
-       POSITION tx, ty;
-
-       /* Pass through the target if needed */
        flg |= (PROJECT_THRU);
-
-       /* Use the given direction */
-       tx = caster_ptr->x + ddx[dir];
-       ty = caster_ptr->y + ddy[dir];
-
-       /* Hack -- Use an actual "target" */
-       if ((dir == 5) && target_okay())
+       POSITION tx = caster_ptr->x + ddx[dir];
+       POSITION ty = caster_ptr->y + ddy[dir];
+       if ((dir == 5) && target_okay(caster_ptr))
        {
                tx = target_col;
                ty = target_row;
        }
 
-       /* Analyze the "dir" and the "target", do NOT explode */
        return (project(caster_ptr, 0, 0, ty, tx, dam, typ, flg, -1));
 }
 
 
 /*!
  * @brief ボルト系スペルの発動 / Cast a bolt spell.
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param typ 効果属性
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param dam 威力
@@ -2247,6 +2074,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 +2094,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,114 +2106,129 @@ 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));
-       }
-       else
-       {
-               return (fire_bolt(p_ptr, typ, dir, dam));
+               return (fire_beam(caster_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(player_type *caster_ptr, POSITION y, POSITION x)
@@ -2393,8 +2237,10 @@ bool door_creation(player_type *caster_ptr, POSITION y, POSITION x)
        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を返す
@@ -2405,8 +2251,10 @@ bool trap_creation(player_type *caster_ptr, POSITION y, POSITION x)
        return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TRAP, flg, -1));
 }
 
+
 /*!
  * @brief 森林生成処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
@@ -2415,8 +2263,10 @@ bool tree_creation(player_type *caster_ptr, POSITION y, POSITION x)
        return (project(caster_ptr, 0, 1, y, x, 0, GF_MAKE_TREE, flg, -1));
 }
 
+
 /*!
  * @brief 魔法のルーン生成処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
@@ -2425,73 +2275,79 @@ bool glyph_creation(player_type *caster_ptr, POSITION y, POSITION x)
        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)
+bool wall_stone(player_type *caster_ptr)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-       bool dummy = (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_STONE_WALL, flg, -1));
-       p_ptr->update |= (PU_FLOW);
-       p_ptr->redraw |= (PR_MAP);
+       bool dummy = (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_STONE_WALL, flg, -1));
+       caster_ptr->update |= (PU_FLOW);
+       caster_ptr->redraw |= (PR_MAP);
        return dummy;
 }
 
+
 /*!
  * @brief ドア破壊処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool destroy_doors_touch(void)
+bool destroy_doors_touch(player_type *caster_ptr)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-       return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_DOOR, flg, -1));
+       return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_DOOR, flg, -1));
 }
 
+
 /*!
  * @brief トラップ解除処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool disarm_traps_touch(void)
+bool disarm_traps_touch(player_type *caster_ptr)
 {
        BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_HIDE;
-       return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, 0, GF_KILL_TRAP, flg, -1));
+       return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, 0, GF_KILL_TRAP, flg, -1));
 }
 
+
 /*!
  * @brief スリープモンスター処理(プレイヤー中心に周囲1マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool sleep_monsters_touch(void)
+bool sleep_monsters_touch(player_type *caster_ptr)
 {
        BIT_FLAGS flg = PROJECT_KILL | PROJECT_HIDE;
-       return (project(p_ptr, 0, 1, p_ptr->y, p_ptr->x, p_ptr->lev, GF_OLD_SLEEP, flg, -1));
+       return (project(caster_ptr, 0, 1, caster_ptr->y, caster_ptr->x, caster_ptr->lev, GF_OLD_SLEEP, flg, -1));
 }
 
 
 /*!
  * @brief 死者復活処理(起点より周囲5マス)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param who 術者モンスターID(0ならばプレイヤー)
  * @param y 起点Y座標
  * @param x 起点X座標
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool animate_dead(MONSTER_IDX who, POSITION y, POSITION x)
+bool animate_dead(player_type *caster_ptr, MONSTER_IDX who, POSITION y, POSITION x)
 {
        BIT_FLAGS flg = PROJECT_ITEM | PROJECT_HIDE;
-       return (project(p_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
+       return (project(caster_ptr, who, 5, y, x, 0, GF_ANIM_DEAD, flg, -1));
 }
 
+
 /*!
  * @brief 混沌招来処理
  * @return 作用が実際にあった場合TRUEを返す
  */
 void call_chaos(player_type *caster_ptr)
 {
-       int Chaos_type, dummy, dir;
-       PLAYER_LEVEL plev = caster_ptr->lev;
-       bool line_chaos = FALSE;
-
        int hurt_types[31] =
        {
                GF_ELEC,      GF_POIS,    GF_ACID,    GF_COLD,
@@ -2504,38 +2360,44 @@ void call_chaos(player_type *caster_ptr)
                GF_HELL_FIRE, GF_DISINTEGRATE, GF_PSY_SPEAR
        };
 
-       Chaos_type = hurt_types[randint0(31)];
+       int chaos_type = hurt_types[randint0(31)];
+       bool line_chaos = FALSE;
        if (one_in_(4)) line_chaos = TRUE;
 
+       int dir;
        if (one_in_(6))
        {
-               for (dummy = 1; dummy < 10; dummy++)
+               for (int dummy = 1; dummy < 10; dummy++)
                {
                        if (dummy - 5)
                        {
                                if (line_chaos)
-                                       fire_beam(caster_ptr, Chaos_type, dummy, 150);
+                                       fire_beam(caster_ptr, chaos_type, dummy, 150);
                                else
-                                       fire_ball(caster_ptr, Chaos_type, dummy, 150, 2);
+                                       fire_ball(caster_ptr, chaos_type, dummy, 150, 2);
                        }
                }
+
+               return;
        }
-       else if (one_in_(3))
+
+       if (one_in_(3))
        {
-               fire_ball(caster_ptr, Chaos_type, 0, 500, 8);
+               fire_ball(caster_ptr, chaos_type, 0, 500, 8);
+               return;
        }
+
+       if (!get_aim_dir(caster_ptr, &dir)) return;
+       if (line_chaos)
+               fire_beam(caster_ptr, chaos_type, dir, 250);
        else
-       {
-               if (!get_aim_dir(&dir)) return;
-               if (line_chaos)
-                       fire_beam(caster_ptr, Chaos_type, dir, 250);
-               else
-                       fire_ball(caster_ptr, Chaos_type, dir, 250, 3 + (plev / 35));
-       }
+               fire_ball(caster_ptr, chaos_type, dir, 250, 3 + (caster_ptr->lev / 35));
 }
 
+
 /*!
  * @brief TY_CURSE処理発動 / Activate the evil Topi Ylinen curse
+ * @param target_ptr プレーヤーへの参照ポインタ
  * @param stop_ty 再帰処理停止フラグ
  * @param count 発動回数
  * @return 作用が実際にあった場合TRUEを返す
@@ -2547,11 +2409,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;
+       floor_type *floor_ptr = target_ptr->current_floor_ptr;
+       while (is_first_curse || (one_in_(3) && !stop_ty))
        {
+               is_first_curse = FALSE;
                switch (randint1(34))
                {
                case 28: case 29:
@@ -2561,6 +2424,7 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                                earthquake(target_ptr, target_ptr->y, target_ptr->x, 5 + randint0(10), 0);
                                if (!one_in_(6)) break;
                        }
+                       /* Fall through */
                case 30: case 31:
                        if (!(*count))
                        {
@@ -2570,14 +2434,16 @@ bool activate_ty_curse(player_type *target_ptr, bool stop_ty, int *count)
                                take_hit(target_ptr, DAMAGE_NOESCAPE, dam, _("純粋な魔力の解放", "released pure mana"), -1);
                                if (!one_in_(6)) break;
                        }
+                       /* Fall through */
                case 32: case 33:
                        if (!(*count))
                        {
                                msg_print(_("周囲の空間が歪んだ!", "Space warps about you!"));
                                teleport_player(target_ptr, damroll(10, 10), TELEPORT_PASSIVE);
-                               if (randint0(13)) (*count) += activate_hi_summon(target_ptr->y, target_ptr->x, FALSE);
+                               if (randint0(13)) (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                                if (!one_in_(6)) break;
                        }
+                       /* Fall through */
                case 34:
                        msg_print(_("エネルギーのうねりを感じた!", "You feel a surge of energy!"));
                        wall_breaker(target_ptr);
@@ -2586,26 +2452,32 @@ 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;
+                       /* Fall through */
                case 1: case 2: case 3: case 16: case 17:
-                       aggravate_monsters(0);
+                       aggravate_monsters(target_ptr, 0);
                        if (!one_in_(6)) break;
+                       /* Fall through */
                case 4: case 5: case 6:
-                       (*count) += activate_hi_summon(target_ptr->y, target_ptr->x, FALSE);
+                       (*count) += activate_hi_summon(target_ptr, target_ptr->y, target_ptr->x, FALSE);
                        if (!one_in_(6)) break;
+                       /* Fall through */
                case 7: case 8: case 9: case 18:
-                       (*count) += summon_specific(0, target_ptr->y, target_ptr->x, target_ptr->current_floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+                       (*count) += summon_specific(target_ptr, 0, target_ptr->y, target_ptr->x, floor_ptr->dun_level, 0, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                        if (!one_in_(6)) break;
+                       /* Fall through */
                case 10: case 11: case 12:
                        msg_print(_("経験値が体から吸い取られた気がする!", "You feel your experience draining away..."));
                        lose_exp(target_ptr, target_ptr->exp / 16);
                        if (!one_in_(6)) break;
+                       /* Fall through */
                case 13: case 14: case 15: case 19: case 20:
-                       if (stop_ty || (target_ptr->free_act && (randint1(125) < target_ptr->skill_sav)) || (target_ptr->pclass == CLASS_BERSERKER))
-                       {
-                               /* Do nothing */ ;
-                       }
-                       else
+               {
+                       bool is_statue = stop_ty;
+                       is_statue |= target_ptr->free_act && (randint1(125) < target_ptr->skill_sav);
+                       is_statue |= target_ptr->pclass == CLASS_BERSERKER;
+                       if (!is_statue)
                        {
                                msg_print(_("彫像になった気分だ!", "You feel like a statue!"));
                                if (target_ptr->free_act)
@@ -2614,58 +2486,59 @@ 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;
+               }
+                       /* Fall through */
                case 21: case 22: case 23:
                        (void)do_dec_stat(target_ptr, randint0(6));
                        if (!one_in_(6)) break;
+                       /* Fall through */
                case 24:
                        msg_print(_("ほえ?私は誰?ここで何してる?", "Huh? Who am I? What am I doing here?"));
                        lose_all_info(target_ptr);
                        if (!one_in_(6)) break;
+                       /* Fall through */
                case 25:
-                       /*
-                        * Only summon Cyberdemons deep in the dungeon.
-                        */
-                       if ((target_ptr->current_floor_ptr->dun_level > 65) && !stop_ty)
+                       if ((floor_ptr->dun_level > 65) && !stop_ty)
                        {
-                               (*count) += summon_cyber(-1, target_ptr->y, target_ptr->x);
+                               (*count) += summon_cyber(target_ptr, -1, target_ptr->y, target_ptr->x);
                                stop_ty = TRUE;
                                break;
                        }
+
                        if (!one_in_(6)) break;
+                       /* Fall through */
                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;
 }
 
+
 /*!
+ * todo 引数にPOSITION x/yは必要か? 要調査
  * @brief HI_SUMMON(上級召喚)処理発動
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param y 召喚位置Y座標
  * @param x 召喚位置X座標
  * @param can_pet プレイヤーのペットとなる可能性があるならばTRUEにする
  * @return 作用が実際にあった場合TRUEを返す
  */
-int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
+int activate_hi_summon(player_type *caster_ptr, POSITION y, POSITION x, bool can_pet)
 {
-       int i;
-       int count = 0;
-       DEPTH summon_lev;
        BIT_FLAGS mode = PM_ALLOW_GROUP;
        bool pet = FALSE;
-
        if (can_pet)
        {
                if (one_in_(4))
@@ -2681,79 +2554,80 @@ int activate_hi_summon(POSITION y, POSITION x, bool can_pet)
 
        if (!pet) mode |= PM_NO_PET;
 
-       summon_lev = (pet ? p_ptr->lev * 2 / 3 + randint1(p_ptr->lev / 2) : p_ptr->current_floor_ptr->dun_level);
-
-       for (i = 0; i < (randint1(7) + (p_ptr->current_floor_ptr->dun_level / 40)); i++)
+       DEPTH dungeon_level = caster_ptr->current_floor_ptr->dun_level;
+       DEPTH summon_lev = (pet ? caster_ptr->lev * 2 / 3 + randint1(caster_ptr->lev / 2) : dungeon_level);
+       int count = 0;
+       for (int i = 0; i < (randint1(7) + (dungeon_level / 40)); i++)
        {
-               switch (randint1(25) + (p_ptr->current_floor_ptr->dun_level / 20))
+               switch (randint1(25) + (dungeon_level / 20))
                {
-                       case 1: case 2:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
-                               break;
-                       case 3: case 4:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
-                               break;
-                       case 5: case 6:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
-                               break;
-                       case 7: case 8:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
-                               break;
-                       case 9: case 10:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
-                               break;
-                       case 11: case 12:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
-                               break;
-                       case 13: case 14:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
-                               break;
-                       case 15: case 16:
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
-                               break;
-                       case 17:
-                               if (can_pet) break;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
-                               break;
-                       case 18: case 19:
-                               if (can_pet) break;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
-                               break;
-                       case 20: case 21:
-                               if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
-                               break;
-                       case 22: case 23:
-                               if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
-                               break;
-                       case 24:
-                               count += summon_specific((pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
-                               break;
-                       default:
-                               if (!can_pet) mode |= PM_ALLOW_UNIQUE;
-                               count += summon_specific((pet ? -1 : 0), y, x,pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
+               case 1: case 2:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANT, mode);
+                       break;
+               case 3: case 4:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_SPIDER, mode);
+                       break;
+               case 5: case 6:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HOUND, mode);
+                       break;
+               case 7: case 8:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HYDRA, mode);
+                       break;
+               case 9: case 10:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_ANGEL, mode);
+                       break;
+               case 11: case 12:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNDEAD, mode);
+                       break;
+               case 13: case 14:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DRAGON, mode);
+                       break;
+               case 15: case 16:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_DEMON, mode);
+                       break;
+               case 17:
+                       if (can_pet) break;
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_AMBERITES, (mode | PM_ALLOW_UNIQUE));
+                       break;
+               case 18: case 19:
+                       if (can_pet) break;
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_UNIQUE, (mode | PM_ALLOW_UNIQUE));
+                       break;
+               case 20: case 21:
+                       if (!can_pet) mode |= PM_ALLOW_UNIQUE;
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_UNDEAD, mode);
+                       break;
+               case 22: case 23:
+                       if (!can_pet) mode |= PM_ALLOW_UNIQUE;
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, summon_lev, SUMMON_HI_DRAGON, mode);
+                       break;
+               case 24:
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, 100, SUMMON_CYBER, mode);
+                       break;
+               default:
+                       if (!can_pet) mode |= PM_ALLOW_UNIQUE;
+                       count += summon_specific(caster_ptr, (pet ? -1 : 0), y, x, pet ? summon_lev : (((summon_lev * 3) / 2) + 5), 0, mode);
                }
        }
 
        return count;
 }
 
+
 /*!
  * @brief 周辺破壊効果(プレイヤー中心)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
 void wall_breaker(player_type *caster_ptr)
 {
-       int i;
        POSITION y = 0, x = 0;
        int attempts = 1000;
-
        if (randint1(80 + caster_ptr->lev) < 70)
        {
                while (attempts--)
                {
-                       scatter(&y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
+                       scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 4, 0);
 
                        if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
 
@@ -2761,191 +2635,210 @@ void wall_breaker(player_type *caster_ptr)
                }
 
                project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
-                                 (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
+                       (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
+               return;
        }
-       else if (randint1(100) > 30)
+
+       if (randint1(100) > 30)
        {
                earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 1, 0);
+               return;
        }
-       else
-       {
-               int num = damroll(5, 3);
 
-               for (i = 0; i < num; i++)
+       int num = damroll(5, 3);
+       for (int i = 0; i < num; i++)
+       {
+               while (TRUE)
                {
-                       while (1)
-                       {
-                               scatter(&y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
-
-                               if (!player_bold(caster_ptr, y, x)) break;
-                       }
+                       scatter(caster_ptr, &y, &x, caster_ptr->y, caster_ptr->x, 10, 0);
 
-                       project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
-                                         (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
+                       if (!player_bold(caster_ptr, y, x)) break;
                }
+
+               project(caster_ptr, 0, 0, y, x, 20 + randint1(30), GF_KILL_WALL,
+                       (PROJECT_BEAM | PROJECT_THRU | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL), -1);
        }
 }
 
 
 /*!
  * @brief パニック・モンスター効果(プレイヤー視界範囲内) / Confuse monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool confuse_monsters(HIT_POINT dam)
+bool confuse_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_OLD_CONF, dam));
+       return (project_all_los(caster_ptr, GF_OLD_CONF, dam));
 }
 
 
 /*!
  * @brief チャーム・モンスター効果(プレイヤー視界範囲内) / Charm monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool charm_monsters(HIT_POINT dam)
+bool charm_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_CHARM, dam));
+       return (project_all_los(caster_ptr, GF_CHARM, dam));
 }
 
 
 /*!
  * @brief 動物魅了効果(プレイヤー視界範囲内) / Charm Animals
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool charm_animals(HIT_POINT dam)
+bool charm_animals(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_CONTROL_ANIMAL, dam));
+       return (project_all_los(caster_ptr, GF_CONTROL_ANIMAL, dam));
 }
 
 
 /*!
  * @brief モンスター朦朧効果(プレイヤー視界範囲内) / Stun monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool stun_monsters(HIT_POINT dam)
+bool stun_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_STUN, dam));
+       return (project_all_los(caster_ptr, GF_STUN, dam));
 }
 
 
 /*!
  * @brief モンスター停止効果(プレイヤー視界範囲内) / Stasis monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool stasis_monsters(HIT_POINT dam)
+bool stasis_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_STASIS, dam));
+       return (project_all_los(caster_ptr, GF_STASIS, dam));
 }
 
 
 /*!
  * @brief モンスター精神攻撃効果(プレイヤー視界範囲内) / Mindblast monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool mindblast_monsters(HIT_POINT dam)
+bool mindblast_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_PSI, dam));
+       return (project_all_los(caster_ptr, GF_PSI, dam));
 }
 
 
 /*!
  * @brief モンスター追放効果(プレイヤー視界範囲内) / Banish all monsters
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dist 効力(距離)
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool banish_monsters(int dist)
+bool banish_monsters(player_type *caster_ptr, int dist)
 {
-       return (project_all_los(p_ptr, GF_AWAY_ALL, dist));
+       return (project_all_los(caster_ptr, GF_AWAY_ALL, dist));
 }
 
 
 /*!
  * @brief 邪悪退散効果(プレイヤー視界範囲内) / Turn evil
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool turn_evil(HIT_POINT dam)
+bool turn_evil(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_TURN_EVIL, dam));
+       return (project_all_los(caster_ptr, GF_TURN_EVIL, dam));
 }
 
 
 /*!
  * @brief 全モンスター退散効果(プレイヤー視界範囲内) / Turn everyone
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dam 効力
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool turn_monsters(HIT_POINT dam)
+bool turn_monsters(player_type *caster_ptr, HIT_POINT dam)
 {
-       return (project_all_los(p_ptr, GF_TURN_ALL, dam));
+       return (project_all_los(caster_ptr, GF_TURN_ALL, dam));
 }
 
 
 /*!
  * @brief 死の光線(プレイヤー視界範囲内) / Death-ray all monsters (note: OBSCENELY powerful)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool deathray_monsters(void)
+bool deathray_monsters(player_type *caster_ptr)
 {
-       return (project_all_los(p_ptr, GF_DEATH_RAY, p_ptr->lev * 200));
+       return (project_all_los(caster_ptr, GF_DEATH_RAY, caster_ptr->lev * 200));
 }
 
+
 /*!
  * @brief チャーム・モンスター(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool charm_monster(DIRECTION dir, PLAYER_LEVEL plev)
+bool charm_monster(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_CHARM, dir, plev, flg));
+       return (project_hook(caster_ptr, GF_CHARM, dir, plev, flg));
 }
 
+
 /*!
  * @brief アンデッド支配(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool control_one_undead(DIRECTION dir, PLAYER_LEVEL plev)
+bool control_one_undead(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
+       return (project_hook(caster_ptr, GF_CONTROL_UNDEAD, dir, plev, flg));
 }
 
+
 /*!
  * @brief 悪魔支配(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool control_one_demon(DIRECTION dir, PLAYER_LEVEL plev)
+bool control_one_demon(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_CONTROL_DEMON, dir, plev, flg));
+       return (project_hook(caster_ptr, GF_CONTROL_DEMON, dir, plev, flg));
 }
 
+
 /*!
  * @brief 動物支配(1体)
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 方向(5ならばグローバル変数 target_col/target_row の座標を目標にする)
  * @param plev パワー
  * @return 作用が実際にあった場合TRUEを返す
  */
-bool charm_animal(DIRECTION dir, PLAYER_LEVEL plev)
+bool charm_animal(player_type *caster_ptr, DIRECTION dir, PLAYER_LEVEL plev)
 {
        BIT_FLAGS flg = PROJECT_STOP | PROJECT_KILL;
-       return (project_hook(p_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
+       return (project_hook(caster_ptr, GF_CONTROL_ANIMAL, dir, plev, flg));
 }
 
 
 /*!
  * @brief 変わり身処理
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param success 判定成功上の処理ならばTRUE
  * @return 作用が実際にあった場合TRUEを返す
  */
@@ -2953,7 +2846,6 @@ bool kawarimi(player_type *caster_ptr, bool success)
 {
        object_type forge;
        object_type *q_ptr = &forge;
-       POSITION y, x;
 
        if (caster_ptr->is_dead) return FALSE;
        if (caster_ptr->confused || caster_ptr->blind || caster_ptr->paralyzed || caster_ptr->image) return FALSE;
@@ -2967,88 +2859,76 @@ bool kawarimi(player_type *caster_ptr, bool success)
                return FALSE;
        }
 
-       y = caster_ptr->y;
-       x = caster_ptr->x;
+       POSITION y = caster_ptr->y;
+       POSITION x = caster_ptr->x;
 
-       teleport_player(caster_ptr, 10 + randint1(90), 0L);
+       teleport_player(caster_ptr, 10 + randint1(90), TELEPORT_SPONTANEOUS);
        object_wipe(q_ptr);
        object_prep(q_ptr, lookup_kind(TV_STATUE, SV_WOODEN_STATUE));
 
        q_ptr->pval = MON_NINJA;
-       (void)drop_near(q_ptr, -1, y, x);
+       (void)drop_near(caster_ptr, q_ptr, -1, y, x);
 
        if (success) msg_print(_("攻撃を受ける前に素早く身をひるがえした。", "You have turned around just before the attack hit you."));
        else msg_print(_("失敗!攻撃を受けてしまった。", "Failed! You are hit by the attack."));
 
        caster_ptr->special_defense &= ~(NINJA_KAWARIMI);
        caster_ptr->redraw |= (PR_STATUS);
-
-       /* Teleported */
        return TRUE;
 }
 
 
 /*!
  * @brief 入身処理 / "Rush Attack" routine for Samurai or Ninja
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param mdeath 目標モンスターが死亡したかを返す
  * @return 作用が実際にあった場合TRUEを返す /  Return value is for checking "done"
  */
 bool rush_attack(player_type *attacker_ptr, bool *mdeath)
 {
-       DIRECTION dir;
-       int tx, ty;
-       int tm_idx = 0;
-       u16b path_g[32];
-       int path_n, i;
-       bool tmp_mdeath = FALSE;
-       bool moved = FALSE;
-
        if (mdeath) *mdeath = FALSE;
 
        project_length = 5;
-       if (!get_aim_dir(&dir)) return FALSE;
+       DIRECTION dir;
+       if (!get_aim_dir(attacker_ptr, &dir)) return FALSE;
 
-       /* Use the given direction */
-       tx = attacker_ptr->x + project_length * ddx[dir];
-       ty = attacker_ptr->y + project_length * ddy[dir];
+       int tx = attacker_ptr->x + project_length * ddx[dir];
+       int ty = attacker_ptr->y + project_length * ddy[dir];
 
-       /* Hack -- Use an actual "target" */
-       if ((dir == 5) && target_okay())
+       if ((dir == 5) && target_okay(attacker_ptr))
        {
                tx = target_col;
                ty = target_row;
        }
 
-       if (in_bounds(attacker_ptr->current_floor_ptr, ty, tx)) tm_idx = attacker_ptr->current_floor_ptr->grid_array[ty][tx].m_idx;
+       int tm_idx = 0;
+       floor_type *floor_ptr = attacker_ptr->current_floor_ptr;
+       if (in_bounds(floor_ptr, ty, tx)) tm_idx = floor_ptr->grid_array[ty][tx].m_idx;
 
-       path_n = project_path(attacker_ptr->current_floor_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
+       u16b path_g[32];
+       int path_n = project_path(attacker_ptr, path_g, project_length, attacker_ptr->y, attacker_ptr->x, ty, tx, PROJECT_STOP | PROJECT_KILL);
        project_length = 0;
-
-       /* No need to move */
        if (!path_n) return TRUE;
 
-       /* Use ty and tx as to-move point */
        ty = attacker_ptr->y;
        tx = attacker_ptr->x;
-
-       /* Project along the path */
-       for (i = 0; i < path_n; i++)
+       bool tmp_mdeath = FALSE;
+       bool moved = FALSE;
+       for (int i = 0; i < path_n; i++)
        {
                monster_type *m_ptr;
 
                int ny = GRID_Y(path_g[i]);
                int nx = GRID_X(path_g[i]);
 
-               if (cave_empty_bold(attacker_ptr->current_floor_ptr, ny, nx) && player_can_enter(attacker_ptr, attacker_ptr->current_floor_ptr->grid_array[ny][nx].feat, 0))
+               if (is_cave_empty_bold(attacker_ptr, ny, nx) && player_can_enter(attacker_ptr, floor_ptr->grid_array[ny][nx].feat, 0))
                {
                        ty = ny;
                        tx = nx;
-
-                       /* Go to next grid */
                        continue;
                }
 
-               if (!attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
+               if (!floor_ptr->grid_array[ny][nx].m_idx)
                {
                        if (tm_idx)
                        {
@@ -3059,18 +2939,14 @@ bool rush_attack(player_type *attacker_ptr, bool *mdeath)
                                msg_print(_("ここには入身では入れない。", "You can't move to that place."));
                        }
 
-                       /* Exit loop */
                        break;
                }
 
-               /* Move player before updating the monster */
                if (!player_bold(attacker_ptr, ty, tx)) teleport_player_to(attacker_ptr, ty, tx, TELEPORT_NONMAGICAL);
-               update_monster(attacker_ptr, attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx, TRUE);
+               update_monster(attacker_ptr, floor_ptr->grid_array[ny][nx].m_idx, TRUE);
 
-               /* Found a monster */
-               m_ptr = &attacker_ptr->current_floor_ptr->m_list[attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx];
-
-               if (tm_idx != attacker_ptr->current_floor_ptr->grid_array[ny][nx].m_idx)
+               m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[ny][nx].m_idx];
+               if (tm_idx != floor_ptr->grid_array[ny][nx].m_idx)
                {
 #ifdef JP
                        msg_format("%s%sが立ちふさがっている!", tm_idx ? "別の" : "", m_ptr->ml ? "モンスター" : "何か");
@@ -3080,11 +2956,8 @@ bool rush_attack(player_type *attacker_ptr, bool *mdeath)
                }
                else if (!player_bold(attacker_ptr, ty, tx))
                {
-                       /* Hold the monster name */
                        GAME_TEXT m_name[MAX_NLEN];
-
-                       /* Get the monster name (BEFORE polymorphing) */
-                       monster_desc(m_name, m_ptr, 0);
+                       monster_desc(attacker_ptr, m_name, m_ptr, 0);
                        msg_format(_("素早く%sの懐に入り込んだ!", "You quickly jump in and attack %s!"), m_name);
                }
 
@@ -3104,37 +2977,38 @@ bool rush_attack(player_type *attacker_ptr, bool *mdeath)
 
 /*!
  * @brief 全鏡の消去 / Remove all mirrors in this floor
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param explode 爆発処理を伴うならばTRUE
  * @return なし
  */
 void remove_all_mirrors(player_type *caster_ptr, bool explode)
 {
-       POSITION x, y;
-
-       for (x = 0; x < caster_ptr->current_floor_ptr->width; x++)
+       for (POSITION x = 0; x < caster_ptr->current_floor_ptr->width; x++)
        {
-               for (y = 0; y < caster_ptr->current_floor_ptr->height; y++)
+               for (POSITION y = 0; y < caster_ptr->current_floor_ptr->height; y++)
                {
-                       if (is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
-                       {
-                               remove_mirror(caster_ptr, y, x);
-                               if (explode)
-                                       project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
-                                               (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
-                       }
+                       if (!is_mirror_grid(&caster_ptr->current_floor_ptr->grid_array[y][x]))
+                               continue;
+
+                       remove_mirror(caster_ptr, y, x);
+                       if (!explode) continue;
+
+                       project(caster_ptr, 0, 2, y, x, caster_ptr->lev / 2 + 5, GF_SHARDS,
+                               (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
                }
        }
 }
 
+
 /*!
  * @brief 『一つの指輪』の効果処理 /
  * Hack -- activate the ring of power
+ * @param caster_ptr プレーヤーへの参照ポインタ
  * @param dir 発動の方向ID
  * @return なし
  */
 void ring_of_power(player_type *caster_ptr, DIRECTION dir)
 {
-       /* Pick a random effect */
        switch (randint1(10))
        {
        case 1:
@@ -3162,7 +3036,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,19 +3059,20 @@ void ring_of_power(player_type *caster_ptr, DIRECTION dir)
        }
 }
 
+
 /*!
 * @brief 運命の輪、並びにカオス的な効果の発動
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param spell ランダムな効果を選択するための基準ID
 * @return なし
 */
 void wild_magic(player_type *caster_ptr, int spell)
 {
-       int counter = 0;
        int type = SUMMON_MOLD + randint0(6);
-
        if (type < SUMMON_MOLD) type = SUMMON_MOLD;
        else if (type > SUMMON_MIMIC) type = SUMMON_MIMIC;
 
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
        switch (randint1(spell) + randint1(8) + 1)
        {
        case 1:
@@ -3217,20 +3092,21 @@ 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();
+               destroy_doors_touch(caster_ptr);
                break;
        case 16: case 17:
                wall_breaker(caster_ptr);
+               break;
        case 18:
-               sleep_monsters_touch();
+               sleep_monsters_touch(caster_ptr);
                break;
        case 19:
        case 20:
@@ -3243,7 +3119,7 @@ void wild_magic(player_type *caster_ptr, int spell)
        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);
@@ -3263,21 +3139,22 @@ void wild_magic(player_type *caster_ptr, int spell)
                fire_ball(caster_ptr, GF_CHAOS, 0, spell + 5, 1 + (spell / 10));
                break;
        case 33:
-               wall_stone();
+               wall_stone(caster_ptr);
                break;
        case 34:
        case 35:
-               while (counter++ < 8)
+               for (int counter = 0; counter < 8; counter++)
                {
-                       (void)summon_specific(0, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
+                       (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3) / 2, type, (PM_ALLOW_GROUP | PM_NO_PET));
                }
+
                break;
        case 36:
        case 37:
-               activate_hi_summon(caster_ptr->y, caster_ptr->x, FALSE);
+               activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
                break;
        case 38:
-               (void)summon_cyber(-1, caster_ptr->y, caster_ptr->x);
+               (void)summon_cyber(caster_ptr, -1, caster_ptr->y, caster_ptr->x);
                break;
        default:
        {
@@ -3286,23 +3163,21 @@ 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 なし
 */
 void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 {
-       int i;
        int b = 10 + randint1(10);
-
-       for (i = 0; i < b; i++)
+       for (int i = 0; i < b; i++)
        {
                POSITION y = 0, x = 0;
                int count;
@@ -3313,19 +3188,16 @@ void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 
                        x = caster_ptr->x - 8 + randint0(17);
                        y = caster_ptr->y - 8 + randint0(17);
-
                        dx = (caster_ptr->x > x) ? (caster_ptr->x - x) : (x - caster_ptr->x);
                        dy = (caster_ptr->y > y) ? (caster_ptr->y - y) : (y - caster_ptr->y);
-
-                       /* Approximate distance */
                        d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
 
                        if (d >= 9) continue;
 
-                       if (!in_bounds(caster_ptr->current_floor_ptr, y, x) || !projectable(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, y, x)
-                               || !cave_have_flag_bold(caster_ptr->current_floor_ptr, y, x, FF_PROJECT)) continue;
+                       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
+                       if (!in_bounds(floor_ptr, y, x) || !projectable(caster_ptr, caster_ptr->y, caster_ptr->x, y, x)
+                               || !cave_have_flag_bold(floor_ptr, y, x, FF_PROJECT)) continue;
 
-                       /* Valid position */
                        break;
                }
 
@@ -3338,60 +3210,47 @@ void cast_meteor(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 
 /*!
 * @brief 破邪魔法「神の怒り」の処理としてターゲットを指定した後分解のボールを最大20回発生させる。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dam ダメージ
 * @param rad 効力の半径
 * @return ターゲットを指定し、実行したならばTRUEを返す。
 */
 bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
 {
-       POSITION x, y, tx, ty;
-       POSITION nx, ny;
        DIRECTION dir;
-       int i;
-       int b = 10 + randint1(10);
-
-       if (!get_aim_dir(&dir)) return FALSE;
+       if (!get_aim_dir(caster_ptr, &dir)) return FALSE;
 
-       /* Use the given direction */
-       tx = caster_ptr->x + 99 * ddx[dir];
-       ty = caster_ptr->y + 99 * ddy[dir];
-
-       /* Hack -- Use an actual "target" */
-       if ((dir == 5) && target_okay())
+       POSITION tx = caster_ptr->x + 99 * ddx[dir];
+       POSITION ty = caster_ptr->y + 99 * ddy[dir];
+       if ((dir == 5) && target_okay(caster_ptr))
        {
                tx = target_col;
                ty = target_row;
        }
 
-       x = caster_ptr->x;
-       y = caster_ptr->y;
-
-       while (1)
+       POSITION x = caster_ptr->x;
+       POSITION y = caster_ptr->y;
+       POSITION nx, ny;
+       while (TRUE)
        {
-               /* Hack -- Stop at the target */
                if ((y == ty) && (x == tx)) break;
 
                ny = y;
                nx = x;
                mmove2(&ny, &nx, caster_ptr->y, caster_ptr->x, ty, tx);
-
-               /* Stop at maximum range */
                if (MAX_RANGE <= distance(caster_ptr->y, caster_ptr->x, ny, nx)) break;
-
-               /* Stopped by walls/doors */
                if (!cave_have_flag_bold(caster_ptr->current_floor_ptr, ny, nx, FF_PROJECT)) break;
-
-               /* Stopped by monsters */
                if ((dir != 5) && caster_ptr->current_floor_ptr->grid_array[ny][nx].m_idx != 0) break;
 
-               /* Save the new location */
                x = nx;
                y = ny;
        }
+
        tx = x;
        ty = y;
 
-       for (i = 0; i < b; i++)
+       int b = 10 + randint1(10);
+       for (int i = 0; i < b; i++)
        {
                int count = 20, d = 0;
 
@@ -3405,15 +3264,12 @@ bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
                        dx = (tx > x) ? (tx - x) : (x - tx);
                        dy = (ty > y) ? (ty - y) : (y - ty);
 
-                       /* Approximate distance */
                        d = (dy > dx) ? (dy + (dx >> 1)) : (dx + (dy >> 1));
-                       /* Within the radius */
                        if (d < 5) break;
                }
 
                if (count < 0) continue;
 
-               /* 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(caster_ptr->current_floor_ptr, ty, tx, y, x))
@@ -3425,8 +3281,10 @@ bool cast_wrath_of_the_god(player_type *caster_ptr, HIT_POINT dam, POSITION rad)
        return TRUE;
 }
 
+
 /*!
 * @brief 「ワンダー」のランダムな効果を決定して処理する。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dir 方向ID
 * @return なし
 * @details
@@ -3441,7 +3299,6 @@ void cast_wonder(player_type *caster_ptr, DIRECTION dir)
        PLAYER_LEVEL plev = caster_ptr->lev;
        int die = randint1(100) + plev / 5;
        int vir = virtue_number(caster_ptr, V_CHANCE);
-
        if (vir)
        {
                if (caster_ptr->virtues[vir - 1] > 0)
@@ -3455,66 +3312,162 @@ void cast_wonder(player_type *caster_ptr, DIRECTION dir)
        }
 
        if (die < 26)
+       {
                chg_virtue(caster_ptr, V_CHANCE, 1);
+       }
 
        if (die > 100)
        {
                msg_print(_("あなたは力がみなぎるのを感じた!", "You feel a surge of power!"));
        }
 
-       if (die < 8) clone_monster(dir);
-       else if (die < 14) speed_monster(dir, plev);
-       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,
+       if (die < 8)
+       {
+               clone_monster(caster_ptr, dir);
+               return;
+       }
+
+       if (die < 14)
+       {
+               speed_monster(caster_ptr, dir, plev);
+               return;
+       }
+
+       if (die < 26)
+       {
+               heal_monster(caster_ptr, dir, damroll(4, 6));
+               return;
+       }
+
+       if (die < 31)
+       {
+               poly_monster(caster_ptr, dir, plev);
+               return;
+       }
+
+       if (die < 36)
+       {
+               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 < 56)
-               fire_bolt_or_beam(beam_chance(caster_ptr) - 10, GF_ELEC, dir,
+               return;
+       }
+
+       if (die < 41)
+       {
+               confuse_monster(caster_ptr, dir, plev);
+               return;
+       }
+
+       if (die < 46)
+       {
+               fire_ball(caster_ptr, GF_POIS, dir, 20 + (plev / 2), 3);
+               return;
+       }
+
+       if (die < 51)
+       {
+               (void)lite_line(caster_ptr, dir, damroll(6, 8));
+               return;
+       }
+
+       if (die < 56)
+       {
+               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,
+               return;
+       }
+
+       if (die < 61)
+       {
+               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,
+               return;
+       }
+
+       if (die < 66)
+       {
+               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,
+               return;
+       }
+
+       if (die < 71)
+       {
+               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 < 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 < 104)
+               return;
+       }
+
+       if (die < 76)
+       {
+               hypodynamic_bolt(caster_ptr, dir, 75);
+               return;
+       }
+
+       if (die < 81)
+       {
+               fire_ball(caster_ptr, GF_ELEC, dir, 30 + plev / 2, 2);
+               return;
+       }
+
+       if (die < 86)
+       {
+               fire_ball(caster_ptr, GF_ACID, dir, 40 + plev, 2);
+               return;
+       }
+
+       if (die < 91)
+       {
+               fire_ball(caster_ptr, GF_ICE, dir, 70 + plev, 3);
+               return;
+       }
+
+       if (die < 96)
+       {
+               fire_ball(caster_ptr, GF_FIRE, dir, 80 + plev, 3);
+               return;
+       }
+
+       if (die < 101)
+       {
+               hypodynamic_bolt(caster_ptr, dir, 100 + plev);
+               return;
+       }
+
+       if (die < 104)
        {
                earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 12, 0);
+               return;
        }
-       else if (die < 106)
+
+       if (die < 106)
        {
-               (void)destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
+               (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
+               return;
        }
-       else if (die < 108)
+
+       if (die < 108)
        {
                symbol_genocide(caster_ptr, plev + 50, TRUE);
+               return;
        }
-       else if (die < 110) dispel_monsters(120);
-       else /* RARE */
+
+       if (die < 110)
        {
-               dispel_monsters(150);
-               slow_monsters(plev);
-               sleep_monsters(plev);
-               hp_player(caster_ptr, 300);
+               dispel_monsters(caster_ptr, 120);
+               return;
        }
+
+       dispel_monsters(caster_ptr, 150);
+       slow_monsters(caster_ptr, plev);
+       sleep_monsters(caster_ptr, plev);
+       hp_player(caster_ptr, 300);
 }
 
 
 /*!
 * @brief 「悪霊召喚」のランダムな効果を決定して処理する。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @param dir 方向ID
 * @return なし
 */
@@ -3524,7 +3477,7 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        int die = randint1(100) + plev / 5;
        int vir = virtue_number(caster_ptr, V_CHANCE);
 
-       if (vir)
+       if (vir != 0)
        {
                if (caster_ptr->virtues[vir - 1] > 0)
                {
@@ -3550,7 +3503,7 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
                msg_print(_("なんてこった!あなたの周りの地面から朽ちた人影が立ち上がってきた!",
                        "Oh no! Mouldering forms rise from the earth around you!"));
 
-               (void)summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+               (void)summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
                chg_virtue(caster_ptr, V_UNLIFE, 1);
        }
        else if (die < 14)
@@ -3568,16 +3521,16 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
        else if (die < 31)
        {
-               poly_monster(dir, plev);
+               poly_monster(caster_ptr, 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);
+               confuse_monster(caster_ptr, dir, plev);
        }
        else if (die < 46)
        {
@@ -3585,31 +3538,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 +3582,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)
        {
@@ -3637,21 +3590,21 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
        else if (die < 106)
        {
-               (void)destroy_area(caster_ptr->current_floor_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
+               (void)destroy_area(caster_ptr, caster_ptr->y, caster_ptr->x, 13 + randint0(5), FALSE);
        }
        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);
        }
 
@@ -3662,8 +3615,10 @@ void cast_invoke_spirits(player_type *caster_ptr, DIRECTION dir)
        }
 }
 
+
 /*!
 * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
+* @param caster_ptr プレーヤーへの参照ポインタ
 * @return なし
 */
 void cast_shuffle(player_type *caster_ptr)
@@ -3674,7 +3629,6 @@ void cast_shuffle(player_type *caster_ptr)
        int vir = virtue_number(caster_ptr, V_CHANCE);
        int i;
 
-       /* Card sharks and high mages get a level bonus */
        if ((caster_ptr->pclass == CLASS_ROGUE) ||
                (caster_ptr->pclass == CLASS_HIGH_MAGE) ||
                (caster_ptr->pclass == CLASS_SORCERER))
@@ -3682,7 +3636,6 @@ void cast_shuffle(player_type *caster_ptr)
        else
                die = randint1(120);
 
-
        if (vir)
        {
                if (caster_ptr->virtues[vir - 1] > 0)
@@ -3698,178 +3651,216 @@ void cast_shuffle(player_type *caster_ptr)
        msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
 
        if (die < 30)
+       {
                chg_virtue(caster_ptr, V_CHANCE, 1);
+       }
 
+       floor_type *floor_ptr = caster_ptr->current_floor_ptr;
        if (die < 7)
        {
                msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
 
                for (i = 0; i < randint1(3); i++)
-                       activate_hi_summon(caster_ptr->y, caster_ptr->x, FALSE);
+               {
+                       activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
+               }
+
+               return;
        }
-       else if (die < 14)
+
+       if (die < 14)
        {
                msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
-               summon_specific(0, caster_ptr->y, caster_ptr->x, caster_ptr->current_floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+               summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
+               return;
        }
-       else if (die < 18)
+
+       if (die < 18)
        {
                int count = 0;
                msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
                activate_ty_curse(caster_ptr, FALSE, &count);
+               return;
        }
-       else if (die < 22)
+
+       if (die < 22)
        {
                msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
-               aggravate_monsters(0);
+               aggravate_monsters(caster_ptr, 0);
+               return;
        }
-       else if (die < 26)
+
+       if (die < 26)
        {
                msg_print(_("《愚者》だ。", "It's the Fool."));
                do_dec_stat(caster_ptr, A_INT);
                do_dec_stat(caster_ptr, A_WIS);
+               return;
        }
-       else if (die < 30)
+
+       if (die < 30)
        {
                msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
-               trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
+               trump_summoning(caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
+               return;
        }
-       else if (die < 33)
+
+       if (die < 33)
        {
                msg_print(_("《月》だ。", "It's the Moon."));
-               unlite_area(10, 3);
+               unlite_area(caster_ptr, 10, 3);
+               return;
        }
-       else if (die < 38)
+
+       if (die < 38)
        {
                msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
                wild_magic(caster_ptr, randint0(32));
+               return;
        }
-       else if (die < 40)
+
+       if (die < 40)
        {
                msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
                teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
+               return;
        }
-       else if (die < 42)
+
+       if (die < 42)
        {
                msg_print(_("《正義》だ。", "It's Justice."));
                set_blessed(caster_ptr, caster_ptr->lev, FALSE);
+               return;
        }
-       else if (die < 47)
+
+       if (die < 47)
        {
                msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
                teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
+               return;
        }
-       else if (die < 52)
+
+       if (die < 52)
        {
                msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
                teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
+               return;
        }
-       else if (die < 60)
+
+       if (die < 60)
        {
                msg_print(_("《塔》だ。", "It's the Tower."));
                wall_breaker(caster_ptr);
+               return;
        }
-       else if (die < 72)
+
+       if (die < 72)
        {
                msg_print(_("《節制》だ。", "It's Temperance."));
-               sleep_monsters_touch();
+               sleep_monsters_touch(caster_ptr);
+               return;
        }
-       else if (die < 80)
+
+       if (die < 80)
        {
                msg_print(_("《塔》だ。", "It's the Tower."));
-
                earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
+               return;
        }
-       else if (die < 82)
+
+       if (die < 82)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
+               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
+               return;
        }
-       else if (die < 84)
+
+       if (die < 84)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
+               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
+               return;
        }
-       else if (die < 86)
+
+       if (die < 86)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
+               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
+               return;
        }
-       else if (die < 88)
+
+       if (die < 88)
        {
                msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
-               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (caster_ptr->current_floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
+               trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
+               return;
        }
-       else if (die < 96)
+
+       if (die < 96)
        {
                msg_print(_("《恋人》だ。", "It's the Lovers."));
 
-               if (get_aim_dir(&dir))
-                       charm_monster(dir, MIN(caster_ptr->lev, 20));
+               if (get_aim_dir(caster_ptr, &dir))
+               {
+                       charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
+               }
+
+               return;
        }
-       else if (die < 101)
+
+       if (die < 101)
        {
                msg_print(_("《隠者》だ。", "It's the Hermit."));
-               wall_stone();
+               wall_stone(caster_ptr);
+               return;
        }
-       else if (die < 111)
+
+       if (die < 111)
        {
                msg_print(_("《審判》だ。", "It's the Judgement."));
                roll_hitdice(caster_ptr, 0L);
                lose_all_mutations(caster_ptr);
+               return;
        }
-       else if (die < 120)
+
+       if (die < 120)
        {
                msg_print(_("《太陽》だ。", "It's the Sun."));
                chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
                chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
                wiz_lite(caster_ptr, FALSE);
+               return;
        }
-       else
+
+       msg_print(_("《世界》だ。", "It's the World."));
+       if (caster_ptr->exp >= PY_MAX_EXP)
        {
-               msg_print(_("《世界》だ。", "It's the World."));
-               if (caster_ptr->exp < PY_MAX_EXP)
-               {
-                       s32b ee = (caster_ptr->exp / 25) + 1;
-                       if (ee > 5000) ee = 5000;
-                       msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
-                       gain_exp(caster_ptr, ee);
-               }
+               return;
        }
-}
 
-/*!
- * @brief 口を使う継続的な処理を中断する
- * @return なし
- */
-void stop_mouth(player_type *caster_ptr)
-{
-       if (music_singing_any(caster_ptr)) stop_singing(caster_ptr);
-       if (hex_spelling_any(caster_ptr)) stop_hex_spell_all(caster_ptr);
+       s32b ee = (caster_ptr->exp / 25) + 1;
+       if (ee > 5000) ee = 5000;
+       msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
+       gain_exp(caster_ptr, ee);
 }
 
 
 bool_hack vampirism(player_type *caster_ptr)
 {
-       DIRECTION dir;
-       POSITION x, y;
-       int dummy;
-       grid_type *g_ptr;
-
        if (d_info[caster_ptr->dungeon_idx].flags1 & DF1_NO_MELEE)
        {
-               msg_print(_("なぜか攻撃することができない。", "Something prevent you from attacking."));
+               msg_print(_("なぜか攻撃することができない。", "Something prevents you from attacking."));
                return FALSE;
        }
 
-       /* Only works on adjacent monsters */
+       DIRECTION dir;
        if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
-       y = caster_ptr->y + ddy[dir];
-       x = caster_ptr->x + ddx[dir];
-       g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
 
+       POSITION y = caster_ptr->y + ddy[dir];
+       POSITION x = caster_ptr->x + ddx[dir];
+       grid_type *g_ptr;
+       g_ptr = &caster_ptr->current_floor_ptr->grid_array[y][x];
        stop_mouth(caster_ptr);
-
        if (!(g_ptr->m_idx))
        {
                msg_print(_("何もない場所に噛みついた!", "You bite into thin air!"));
@@ -3878,57 +3869,59 @@ bool_hack vampirism(player_type *caster_ptr)
 
        msg_print(_("あなたはニヤリとして牙をむいた...", "You grin and bare your fangs..."));
 
-       dummy = caster_ptr->lev * 2;
-
-       if (hypodynamic_bolt(dir, dummy))
+       int dummy = caster_ptr->lev * 2;
+       if (!hypodynamic_bolt(caster_ptr, dir, dummy))
        {
-               if (caster_ptr->food < PY_FOOD_FULL)
-                       /* No heal if we are "full" */
-                       (void)hp_player(caster_ptr, dummy);
-               else
-                       msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
-
-               /* Gain nutritional sustenance: 150/hp drained */
-               /* A Food ration gives 5000 food points (by contrast) */
-               /* Don't ever get more than "Full" this way */
-               /* But if we ARE Gorged,  it won't cure us */
-               dummy = caster_ptr->food + MIN(5000, 100 * dummy);
-               if (caster_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
-                       (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
+               msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
+               return TRUE;
        }
+
+       if (caster_ptr->food < PY_FOOD_FULL)
+               (void)hp_player(caster_ptr, dummy);
        else
-               msg_print(_("げぇ!ひどい味だ。", "Yechh. That tastes foul."));
+               msg_print(_("あなたは空腹ではありません。", "You were not hungry."));
+
+       /* Gain nutritional sustenance: 150/hp drained */
+       /* A Food ration gives 5000 food points (by contrast) */
+       /* Don't ever get more than "Full" this way */
+       /* But if we ARE Gorged,  it won't cure us */
+       dummy = caster_ptr->food + MIN(5000, 100 * dummy);
+       if (caster_ptr->food < PY_FOOD_MAX)   /* Not gorged already */
+               (void)set_food(caster_ptr, dummy >= PY_FOOD_MAX ? PY_FOOD_MAX - 1 : dummy);
        return TRUE;
 }
 
-bool panic_hit(void)
+
+/*!
+* ヒット&アウェイのレイシャルパワー/突然変異
+* @param caster_ptr プレーヤーへの参照ポインタ
+* @return コマンドの入力先にモンスターがいたらTRUE
+*/
+bool hit_and_away(player_type *caster_ptr)
 {
        DIRECTION dir;
-       POSITION x, y;
-
-       if (!get_direction(p_ptr, &dir, FALSE, FALSE)) return FALSE;
-       y = p_ptr->y + ddy[dir];
-       x = p_ptr->x + ddx[dir];
-       if (p_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+       if (!get_direction(caster_ptr, &dir, FALSE, FALSE)) return FALSE;
+       POSITION y = caster_ptr->y + ddy[dir];
+       POSITION x = caster_ptr->x + ddx[dir];
+       if (caster_ptr->current_floor_ptr->grid_array[y][x].m_idx)
        {
-               py_attack(p_ptr, y, x, 0);
-               if (randint0(p_ptr->skill_dis) < 7)
+               py_attack(caster_ptr, y, x, 0);
+               if (randint0(caster_ptr->skill_dis) < 7)
                        msg_print(_("うまく逃げられなかった。", "You failed to run away."));
                else
-                       teleport_player(p_ptr, 30, 0L);
+                       teleport_player(caster_ptr, 30, TELEPORT_SPONTANEOUS);
                return TRUE;
        }
-       else
-       {
-               msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
-               msg_print(NULL);
-               return FALSE;
-       }
 
+       msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
+       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,
@@ -3941,33 +3934,23 @@ bool panic_hit(void)
 */
 bool psychometry(player_type *caster_ptr)
 {
-       OBJECT_IDX      item;
+       concptr q = _("どのアイテムを調べますか?", "Meditate on which item? ");
+       concptr s = _("調べるアイテムがありません。", "You have nothing appropriate.");
        object_type *o_ptr;
-       GAME_TEXT o_name[MAX_NLEN];
-       byte            feel;
-       concptr            q, s;
-       bool okay = FALSE;
-
-       q = _("どのアイテムを調べますか?", "Meditate on which item? ");
-       s = _("調べるアイテムがありません。", "You have nothing appropriate.");
-
+       OBJECT_IDX item;
        o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0);
-       if (!o_ptr) return (FALSE);
+       if (!o_ptr) return FALSE;
 
-       /* It is fully known, no information needed */
        if (object_is_known(o_ptr))
        {
                msg_print(_("何も新しいことは判らなかった。", "You cannot find out anything more about that."));
                return TRUE;
        }
 
-       /* Check for a feeling */
-       feel = value_check_aux1(o_ptr);
-
-       /* Get an object description */
-       object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
+       byte feel = value_check_aux1(o_ptr);
+       GAME_TEXT o_name[MAX_NLEN];
+       object_desc(caster_ptr, o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
-       /* Skip non-feelings */
        if (!feel)
        {
                msg_format(_("%sからは特に変わった事は感じとれなかった。", "You do not perceive anything unusual about the %s."), o_name);
@@ -3981,7 +3964,6 @@ bool psychometry(player_type *caster_ptr)
                o_name, ((o_ptr->number == 1) ? "is" : "are"), game_inscriptions[feel]);
 #endif
 
-
        o_ptr->ident |= (IDENT_SENSE);
        o_ptr->feeling = feel;
        o_ptr->marked |= OM_TOUCHED;
@@ -3989,7 +3971,7 @@ bool psychometry(player_type *caster_ptr)
        caster_ptr->update |= (PU_COMBINE | PU_REORDER);
        caster_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER);
 
-       /* Valid "tval" codes */
+       bool okay = FALSE;
        switch (o_ptr->tval)
        {
        case TV_SHOT:
@@ -4018,21 +4000,17 @@ bool psychometry(player_type *caster_ptr)
                break;
        }
 
-       /* Auto-inscription/destroy */
-       autopick_alter_item(item, (bool)(okay && destroy_feeling));
-
-       /* Something happened */
-       return (TRUE);
+       autopick_alter_item(caster_ptr, item, (bool)(okay && destroy_feeling));
+       return TRUE;
 }
 
 
 bool draconian_breath(player_type *creature_ptr)
 {
-       DIRECTION dir;
        int Type = (one_in_(3) ? GF_COLD : GF_FIRE);
        concptr Type_desc = ((Type == GF_COLD) ? _("冷気", "cold") : _("炎", "fire"));
-
-       if (!get_aim_dir(&dir)) return FALSE;
+       DIRECTION dir;
+       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
 
        if (randint1(100) < creature_ptr->lev)
        {
@@ -4055,6 +4033,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_SHARDS;
                                Type_desc = _("破片", "shards");
                        }
+
                        break;
                case CLASS_MAGE:
                case CLASS_WARRIOR_MAGE:
@@ -4074,6 +4053,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 +4066,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_CHAOS;
                                Type_desc = _("カオス", "chaos");
                        }
+
                        break;
                case CLASS_MONK:
                case CLASS_SAMURAI:
@@ -4100,6 +4081,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_SOUND;
                                Type_desc = _("轟音", "sound");
                        }
+
                        break;
                case CLASS_MINDCRAFTER:
                        if (!one_in_(3))
@@ -4112,6 +4094,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_PSI;
                                Type_desc = _("精神エネルギー", "mental energy");
                        }
+
                        break;
                case CLASS_PRIEST:
                case CLASS_PALADIN:
@@ -4125,6 +4108,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 +4122,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_POIS;
                                Type_desc = _("毒", "poison");
                        }
+
                        break;
                case CLASS_BARD:
                        if (!one_in_(3))
@@ -4150,6 +4135,7 @@ bool draconian_breath(player_type *creature_ptr)
                                Type = GF_CONFUSION;
                                Type_desc = _("混乱", "confusion");
                        }
+
                        break;
                }
        }
@@ -4161,39 +4147,47 @@ bool draconian_breath(player_type *creature_ptr)
        return TRUE;
 }
 
+
 bool android_inside_weapon(player_type *creature_ptr)
 {
        DIRECTION dir;
-       if (!get_aim_dir(&dir)) return FALSE;
+       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
+
        if (creature_ptr->lev < 10)
        {
                msg_print(_("レイガンを発射した。", "You fire your ray gun."));
                fire_bolt(creature_ptr, GF_MISSILE, dir, (creature_ptr->lev + 1) / 2);
+               return TRUE;
        }
-       else if (creature_ptr->lev < 25)
+
+       if (creature_ptr->lev < 25)
        {
                msg_print(_("ブラスターを発射した。", "You fire your blaster."));
                fire_bolt(creature_ptr, GF_MISSILE, dir, creature_ptr->lev);
+               return TRUE;
        }
-       else if (creature_ptr->lev < 35)
+
+       if (creature_ptr->lev < 35)
        {
                msg_print(_("バズーカを発射した。", "You fire your bazooka."));
                fire_ball(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2, 2);
+               return TRUE;
        }
-       else if (creature_ptr->lev < 45)
+
+       if (creature_ptr->lev < 45)
        {
                msg_print(_("ビームキャノンを発射した。", "You fire a beam cannon."));
                fire_beam(creature_ptr, GF_MISSILE, dir, creature_ptr->lev * 2);
+               return TRUE;
        }
-       else
-       {
-               msg_print(_("ロケットを発射した。", "You fire a rocket."));
-               fire_rocket(creature_ptr, GF_ROCKET, dir, creature_ptr->lev * 5, 2);
-       }
+
+       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)
+
+bool create_ration(player_type *creature_ptr)
 {
        object_type *q_ptr;
        object_type forge;
@@ -4203,151 +4197,168 @@ bool create_ration(player_type *crature_ptr)
        object_prep(q_ptr, lookup_kind(TV_FOOD, SV_FOOD_RATION));
 
        /* Drop the object from heaven */
-       (void)drop_near(q_ptr, -1, crature_ptr->y, crature_ptr->x);
+       (void)drop_near(creature_ptr, q_ptr, -1, creature_ptr->y, creature_ptr->x);
        msg_print(_("食事を料理して作った。", "You cook some food."));
        return TRUE;
 }
 
+
 void hayagake(player_type *creature_ptr)
 {
        if (creature_ptr->action == ACTION_HAYAGAKE)
        {
                set_action(creature_ptr, ACTION_NONE);
+               creature_ptr->energy_use = 0;
+               return;
+       }
+
+       grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
+       feature_type *f_ptr = &f_info[g_ptr->feat];
+
+       if (!have_flag(f_ptr->flags, FF_PROJECT) ||
+               (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
+       {
+               msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
        }
        else
        {
-               grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x];
-               feature_type *f_ptr = &f_info[g_ptr->feat];
-
-               if (!have_flag(f_ptr->flags, FF_PROJECT) ||
-                       (!creature_ptr->levitation && have_flag(f_ptr->flags, FF_DEEP)))
-               {
-                       msg_print(_("ここでは素早く動けない。", "You cannot run in here."));
-               }
-               else
-               {
-                       set_action(creature_ptr, ACTION_HAYAGAKE);
-               }
+               set_action(creature_ptr, ACTION_HAYAGAKE);
        }
+
        creature_ptr->energy_use = 0;
 }
 
+
 bool double_attack(player_type *creature_ptr)
 {
        DIRECTION dir;
-       POSITION x, y;
-
-       if (!get_rep_dir(&dir, FALSE)) return FALSE;
-       y = creature_ptr->y + ddy[dir];
-       x = creature_ptr->x + ddx[dir];
-       if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
+       if (!get_rep_dir(creature_ptr, &dir, FALSE)) return FALSE;
+       POSITION y = creature_ptr->y + ddy[dir];
+       POSITION x = creature_ptr->x + ddx[dir];
+       if (!creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
        {
-               if (one_in_(3))
-                       msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
-                               "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
-               else if(one_in_(2))
-                       msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
-                               "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
-               else
-                       msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
-                               "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
-
-               py_attack(creature_ptr, y, x, 0);
-               if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
-               {
-                       handle_stuff();
-                       py_attack(creature_ptr, y, x, 0);
-               }
-               creature_ptr->energy_need += ENERGY_NEED();
+               msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
+               msg_print(NULL);
+               return TRUE;
        }
+
+       if (one_in_(3))
+               msg_print(_("あーたたたたたたたたたたたたたたたたたたたたたた!!!",
+                       "Ahhhtatatatatatatatatatatatatatataatatatatattaaaaa!!!!"));
+       else if (one_in_(2))
+               msg_print(_("無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄無駄!!!",
+                       "Mudamudamudamudamudamudamudamudamudamudamudamudamuda!!!!"));
        else
+               msg_print(_("オラオラオラオラオラオラオラオラオラオラオラオラ!!!",
+                       "Oraoraoraoraoraoraoraoraoraoraoraoraoraoraoraoraora!!!!"));
+
+       py_attack(creature_ptr, y, x, 0);
+       if (creature_ptr->current_floor_ptr->grid_array[y][x].m_idx)
        {
-               msg_print(_("その方向にはモンスターはいません。", "You don't see any monster in this direction"));
-               msg_print(NULL);
+               handle_stuff(creature_ptr);
+               py_attack(creature_ptr, y, x, 0);
        }
+
+       creature_ptr->energy_need += ENERGY_NEED();
        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;
-       if (gain_sp)
+       int gain_sp = take_hit(creature_ptr, DAMAGE_USELIFE, creature_ptr->lev, _("HPからMPへの無謀な変換", "thoughtless conversion from HP to SP"), -1) / 5;
+       if (!gain_sp)
        {
-               creature_ptr->csp += gain_sp;
-               if (creature_ptr->csp > creature_ptr->msp)
-               {
-                       creature_ptr->csp = creature_ptr->msp;
-                       creature_ptr->csp_frac = 0;
-               }
+               msg_print(_("変換に失敗した。", "You failed to convert."));
+               creature_ptr->redraw |= (PR_HP | PR_MANA);
+               return TRUE;
        }
-       else
+
+       creature_ptr->csp += gain_sp;
+       if (creature_ptr->csp > creature_ptr->msp)
        {
-               msg_print(_("変換に失敗した。", "You failed to convert."));
+               creature_ptr->csp = creature_ptr->msp;
+               creature_ptr->csp_frac = 0;
        }
+
        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)
        {
                creature_ptr->csp -= creature_ptr->lev / 5;
-               hp_player(p_ptr, creature_ptr->lev);
+               hp_player(creature_ptr, creature_ptr->lev);
        }
        else
        {
                msg_print(_("変換に失敗した。", "You failed to convert."));
        }
+
        creature_ptr->redraw |= (PR_HP | PR_MANA);
        return TRUE;
 }
 
+
 bool demonic_breath(player_type *creature_ptr)
 {
        DIRECTION dir;
        int type = (one_in_(2) ? GF_NETHER : GF_FIRE);
-       if (!get_aim_dir(&dir)) return FALSE;
+       if (!get_aim_dir(creature_ptr, &dir)) return FALSE;
        stop_mouth(creature_ptr);
        msg_format(_("あなたは%sのブレスを吐いた。", "You breathe %s."), ((type == GF_NETHER) ? _("地獄", "nether") : _("火炎", "fire")));
        fire_breath(creature_ptr, type, dir, creature_ptr->lev * 3, (creature_ptr->lev / 15) + 1);
        return TRUE;
 }
 
+
+/*!
+ * 静水
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return ペットを操っている場合を除きTRUE
+*/
 bool mirror_concentration(player_type *creature_ptr)
 {
        if (total_friends)
        {
-               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
                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."));
 
-               creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
-               if (creature_ptr->csp >= creature_ptr->msp)
-               {
-                       creature_ptr->csp = creature_ptr->msp;
-                       creature_ptr->csp_frac = 0;
-               }
-               creature_ptr->redraw |= (PR_MANA);
+       if (!is_mirror_grid(&creature_ptr->current_floor_ptr->grid_array[creature_ptr->y][creature_ptr->x]))
+       {
+               msg_print(_("鏡の上でないと集中できない!", "There's no mirror here!"));
+               return TRUE;
        }
-       else
+
+       msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
+
+       creature_ptr->csp += (5 + creature_ptr->lev * creature_ptr->lev / 100);
+       if (creature_ptr->csp >= creature_ptr->msp)
        {
-               msg_print(_("鏡の上でないと集中できない!", "Here are not any mirrors!"));
+               creature_ptr->csp = creature_ptr->msp;
+               creature_ptr->csp_frac = 0;
        }
+
+       creature_ptr->redraw |= PR_MANA;
        return TRUE;
 }
 
+
+/*!
+ * 剣の舞い
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return 常にTRUE
+*/
 bool sword_dancing(player_type *creature_ptr)
 {
        DIRECTION dir;
        POSITION y = 0, x = 0;
-       int i;
        grid_type *g_ptr;
-
-       for (i = 0; i < 6; i++)
+       for (int i = 0; i < 6; i++)
        {
                dir = randint0(8);
                y = creature_ptr->y + ddy_ddd[dir];
@@ -4362,20 +4373,33 @@ bool sword_dancing(player_type *creature_ptr)
                        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);
-       stun_monsters(creature_ptr->lev * 4);
-       confuse_monsters(creature_ptr->lev * 4);
-       turn_monsters(creature_ptr->lev * 4);
-       stasis_monsters(creature_ptr->lev * 4);
+       slow_monsters(creature_ptr, creature_ptr->lev);
+       stun_monsters(creature_ptr, creature_ptr->lev * 4);
+       confuse_monsters(creature_ptr, creature_ptr->lev * 4);
+       turn_monsters(creature_ptr, creature_ptr->lev * 4);
+       stasis_monsters(creature_ptr, creature_ptr->lev * 4);
        return TRUE;
 }
 
+
+/*!
+ * 荒馬慣らし
+ * @param creature_ptr プレーヤーへの参照ポインタ
+ * @return 結果はどうあれ騎乗したらTRUE
+*/
 bool rodeo(player_type *creature_ptr)
 {
        GAME_TEXT m_name[MAX_NLEN];
@@ -4388,11 +4412,12 @@ 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];
+       m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->riding];
        r_ptr = &r_info[m_ptr->r_idx];
-       monster_desc(m_name, m_ptr, 0);
+       monster_desc(creature_ptr, m_name, m_ptr, 0);
        msg_format(_("%sに乗った。", "You ride on %s."), m_name);
 
        if (is_pet(m_ptr)) return TRUE;
@@ -4407,25 +4432,29 @@ bool rodeo(player_type *creature_ptr)
                && (rlev < creature_ptr->lev * 3 / 2 + randint0(creature_ptr->lev / 5)))
        {
                msg_format(_("%sを手なずけた。", "You tame %s."), m_name);
-               set_pet(m_ptr);
+               set_pet(creature_ptr, m_ptr);
        }
        else
        {
-               msg_format(_("%sに振り落とされた!", "You have thrown off by %s."), m_name);
-               rakuba(p_ptr, 1, TRUE);
+               msg_format(_("%sに振り落とされた!", "You have been thrown off by %s."), m_name);
+               rakuba(creature_ptr, 1, TRUE);
+
                /* 落馬処理に失敗してもとにかく乗馬解除 */
                creature_ptr->riding = 0;
        }
+
        return TRUE;
 }
 
+
 bool clear_mind(player_type *creature_ptr)
 {
        if (total_friends)
        {
-               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
                return FALSE;
        }
+
        msg_print(_("少し頭がハッキリした。", "You feel your head clear a little."));
 
        creature_ptr->csp += (3 + creature_ptr->lev / 20);
@@ -4434,24 +4463,28 @@ 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);
 
        if (total_friends)
        {
-               msg_print(_("今はペットを操ることに集中していないと。", "You need concentration on the pets now."));
+               msg_print(_("今はペットを操ることに集中していないと。", "Your pets demand all of your attention."));
                return FALSE;
        }
+
        if (creature_ptr->special_defense & KATA_MASK)
        {
-               msg_print(_("今は構えに集中している。", "You need concentration on your form."));
+               msg_print(_("今は構えに集中している。", "You're already concentrating on your stance."));
                return FALSE;
        }
+
        msg_print(_("精神を集中して気合いを溜めた。", "You concentrate to charge your power."));
 
        creature_ptr->csp += creature_ptr->msp / 2;
@@ -4460,6 +4493,7 @@ bool concentration(player_type *creature_ptr)
                creature_ptr->csp = max_csp;
                creature_ptr->csp_frac = 0;
        }
-       creature_ptr->redraw |= (PR_MANA);
+
+       creature_ptr->redraw |= PR_MANA;
        return TRUE;
 }