OSDN Git Service

(2.2.0.11) バージョンコマンド(V)の表示修正 / Change 'V' command's message.
[hengband/hengband.git] / src / spells1.c
index 1756839..8ee066a 100644 (file)
@@ -1,29 +1,34 @@
-/* File: spells1.c */
-
-/*
+/*!
+ * @file spells1.c
+ * @brief 魔法による遠隔処理の実装 / Spell projection
+ * @date 2014/07/10
+ * @author
+ * <pre>
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke
- *
  * This software may be copied and distributed for educational, research,
  * and not for profit purposes provided that this copyright and statement
  * are included in all such copies.  Other copyrights may also apply.
+ * </pre>
  */
 
-/* Purpose: Spell projection */
-
 #include "angband.h"
 
 /* ToDo: Make this global */
-/* 1/x chance of reducing stats (for elemental attacks) */
-#define HURT_CHANCE 16
+#define HURT_CHANCE 16 /*!< 属性攻撃を受けた際に能力値低下を起こす確率(1/X) / 1/x chance of reducing stats (for elemental attacks) */
 
+static int rakubadam_m; /*!< 振り落とされた際のダメージ量 */
+static int rakubadam_p; /*!< 落馬した際のダメージ量 */
 
-static int rakubadam_m;
-static int rakubadam_p;
+int project_length = 0; /*!< 投射の射程距離 */
 
-int project_length = 0;
 
-/*
+/*!
+ * @brief 配置した鏡リストの次を取得する /
  * Get another mirror. for SEEKER 
+ * @param next_y 次の鏡のy座標を返す参照ポインタ
+ * @param next_x 次の鏡のx座標を返す参照ポインタ
+ * @param cury 現在の鏡のy座標
+ * @param curx 現在の鏡のx座標
  */
 static void next_mirror( int* next_y , int* next_x , int cury, int curx)
 {
@@ -55,8 +60,11 @@ static void next_mirror( int* next_y , int* next_x , int cury, int curx)
        return;
 }
                
-/*
+/*!
+ * @brief 万色表現用にランダムな色を選択する関数 /
  * Get a legal "multi-hued" color for drawing "spells"
+ * @param max 色IDの最大値
+ * @return 選択した色ID
  */
 static byte mh_attr(int max)
 {
@@ -83,8 +91,11 @@ static byte mh_attr(int max)
 }
 
 
-/*
+/*!
+ * @brief 魔法属性に応じたエフェクトの色を返す /
  * Return a color to use for the bolt/ball spells
+ * @param type 魔法属性
+ * @return 対応する色ID
  */
 static byte spell_color(int type)
 {
@@ -118,7 +129,7 @@ static byte spell_color(int type)
                        case GF_SOUND:          return (0x09);
                        case GF_SHARDS:         return (0x08);
                        case GF_FORCE:          return (0x09);
-                       case GF_INERTIA:        return (0x09);
+                       case GF_INERTIAL:        return (0x09);
                        case GF_GRAVITY:        return (0x09);
                        case GF_TIME:           return (0x09);
                        case GF_LITE_WEAK:      return (0x06);
@@ -182,12 +193,20 @@ static byte spell_color(int type)
 }
 
 
-/*
+/*!
+ * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
  * Find the attr/char pair to use for a spell effect
- *
+ * @param y 始点Y座標
+ * @param x 始点X座標
+ * @param ny 終点Y座標
+ * @param nx 終点X座標
+ * @param typ 魔法の効果属性
+ * @return 方向キャラID
+ * @details
+ * <pre>
  * It is moving (or has moved) from (x,y) to (nx,ny).
- *
  * If the distance is not "one", we (may) return "*".
+ * </pre>
  */
 u16b bolt_pict(int y, int x, int ny, int nx, int typ)
 {
@@ -228,9 +247,19 @@ u16b bolt_pict(int y, int x, int ny, int nx, int typ)
 }
 
 
-/*
+/*!
+ * @brief 始点から終点への経路を返す /
  * Determine the path taken by a projection.
- *
+ * @param gp 経路座標リストを返す参照ポインタ
+ * @param range 距離
+ * @param y1 始点Y座標
+ * @param x1 始点X座標
+ * @param y2 終点Y座標
+ * @param x2 終点X座標
+ * @param flg フラグID
+ * @return リストの長さ
+ * @details
+ * <pre>
  * The projection will always start from the grid (y1,x1), and will travel
  * towards the grid (y2,x2), touching one grid per unit of distance along
  * the major axis, and stopping when it enters the destination grid or a
@@ -267,6 +296,7 @@ u16b bolt_pict(int y, int x, int ny, int nx, int typ)
  *
  * This algorithm is similar to, but slightly different from, the one used
  * by "update_view_los()", and very different from the one used by "los()".
+ * </pre>
  */
 sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
 {
@@ -565,17 +595,25 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg)
 /*
  * Mega-Hack -- track "affected" monsters (see "project()" comments)
  */
-static int project_m_n;
-static int project_m_x;
-static int project_m_y;
+static int project_m_n; /*!< 魔法効果範囲内にいるモンスターの数 */
+static int project_m_x; /*!< 処理中のモンスターX座標 */
+static int project_m_y; /*!< 処理中のモンスターY座標 */
 /* Mega-Hack -- monsters target */
-static s16b monster_target_x;
-static s16b monster_target_y;
-
-
-/*
- * We are called from "project()" to "damage" terrain features
- *
+static s16b monster_target_x; /*!< モンスターの攻撃目標X座標 */
+static s16b monster_target_y; /*!< モンスターの攻撃目標Y座標 */
+
+
+/*!
+ * @brief 汎用的なビーム/ボルト/ボール系による地形効果処理 / We are called from "project()" to "damage" terrain features
+ * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
+ * @param y 目標Y座標 / Target y location (or location to travel "towards")
+ * @param x 目標X座標 / Target x location (or location to travel "towards")
+ * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
+ * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
+ * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
+ * @details
+ * <pre>
  * We are called both for "beam" effects and "ball" effects.
  *
  * The "r" parameter is the "distance from ground zero".
@@ -588,6 +626,7 @@ static s16b monster_target_y;
  * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
  *
  * XXX XXX XXX Perhaps we should affect doors?
+ * </pre>
  */
 static bool project_f(int who, int r, int y, int x, int dam, int typ)
 {
@@ -1132,7 +1171,17 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ)
 
 
 
-/*
+/*!
+ * @brief 汎用的なビーム/ボルト/ボール系によるアイテムオブジェクトへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
+ * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
+ * @param y 目標Y座標 / Target y location (or location to travel "towards")
+ * @param x 目標X座標 / Target x location (or location to travel "towards")
+ * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
+ * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
+ * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
+ * @details
+ * <pre>
  * We are called from "project()" to "damage" objects
  *
  * We are called both for "beam" effects and "ball" effects.
@@ -1147,6 +1196,7 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ)
  * XXX XXX XXX We also "see" grids which are "memorized", probably a hack
  *
  * We return "TRUE" if the effect of the projection is "obvious".
+ * </pre>
  */
 static bool project_o(int who, int r, int y, int x, int dam, int typ)
 {
@@ -1467,11 +1517,19 @@ static bool project_o(int who, int r, int y, int x, int dam, int typ)
 }
 
 
-/*
- * Helper function for "project()" below.
- *
- * Handle a beam/bolt/ball causing damage to a monster.
- *
+/*!
+ * @brief 汎用的なビーム/ボルト/ボール系によるモンスターへの効果処理 / Handle a beam/bolt/ball causing damage to a monster.
+ * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
+ * @param y 目標Y座標 / Target y location (or location to travel "towards")
+ * @param x 目標X座標 / Target x location (or location to travel "towards")
+ * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
+ * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
+ * @param flg 効果フラグ
+ * @param see_s_msg TRUEならばメッセージを表示する
+ * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
+ * @details
+ * <pre>
  * This routine takes a "source monster" (by index) which is mostly used to
  * determine if the player is causing the damage, and a "radius" (see below),
  * which is used to decrease the power of explosions with distance, and a
@@ -1479,28 +1537,31 @@ static bool project_o(int who, int r, int y, int x, int dam, int typ)
  * (polymorph and teleport being the obvious ones), a default damage, which
  * is modified as needed based on various properties, and finally a "damage
  * type" (see below).
- *
+ * </pre>
+ * <pre>
  * Note that this routine can handle "no damage" attacks (like teleport) by
  * taking a "zero" damage, and can even take "parameters" to attacks (like
  * confuse) by accepting a "damage", using it to calculate the effect, and
  * then setting the damage to zero.  Note that the "damage" parameter is
  * divided by the radius, so monsters not at the "epicenter" will not take
  * as much damage (or whatever)...
- *
+ * </pre>
+ * <pre>
  * Note that "polymorph" is dangerous, since a failure in "place_monster()"'
  * may result in a dereference of an invalid pointer.  XXX XXX XXX
- *
+ * </pre>
+ * <pre>
  * Various messages are produced, and damage is applied.
- *
+ * </pre>
+ * <pre>
  * Just "casting" a substance (i.e. plasma) does not make you immune, you must
  * actually be "made" of that substance, or "breathe" big balls of it.
- *
  * We assume that "Plasma" monsters, and "Plasma" breathers, are immune
  * to plasma.
- *
  * We assume "Nether" is an evil, necromantic force, so it doesn't hurt undead,
  * and hurts evil less.  If can breath nether, then it resists it as well.
- *
+ * </pre>
+ * <pre>
  * Damage reductions use the following formulas:
  *   Note that "dam = dam * 6 / (randint1(6) + 6);"
  *     gives avg damage of .655, ranging from .858 to .500
@@ -1512,15 +1573,18 @@ static bool project_o(int who, int r, int y, int x, int dam, int typ)
  *     gives avg damage of .327, ranging from .427 to .250
  *   Note that "dam = dam * 2 / (randint1(6) + 6);"
  *     gives something simple.
- *
+ * </pre>
+ * <pre>
  * In this function, "result" messages are postponed until the end, where
  * the "note" string is appended to the monster name, if not NULL.  So,
  * to make a spell have "no effect" just set "note" to NULL.  You should
  * also set "notice" to FALSE, or the player will learn what the spell does.
- *
+ * </pre>
+ * <pre>
  * We attempt to return "TRUE" if the player saw anything "useful" happen.
+ * "flg" was added.
+ * </pre>
  */
-/* "flg" was added. */
 static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, bool see_s_msg)
 {
        int tmp;
@@ -2111,7 +2175,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                }
 
                /* Inertia -- breathers resist */
-               case GF_INERTIA:
+               case GF_INERTIAL:
                {
                        if (seen) obvious = TRUE;
 
@@ -2291,7 +2355,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                        if (seen) obvious = TRUE;
 
                        /* PSI only works if the monster can see you! -- RG */
-                       if (!(los(m_ptr->fy, m_ptr->fx, py, px)))
+                       if (!(los(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x)))
                        {
                                if (seen_msg) 
                     msg_format(_("%sはあなたが見えないので影響されない!", "%^s can't see you, and isn't affected!"), m_name);
@@ -4941,10 +5005,10 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                        case 3: case 4: case 5: case 6:
                                if (!count)
                                {
-                                       int dam = damroll(10, 10);
+                                       int extra_dam = damroll(10, 10);
                     msg_print(_("純粋な魔力の次元への扉が開いた!", "A portal opens to a plane of raw mana!"));
 
-                                       project(0, 8, ty,tx, dam, GF_MANA, curse_flg, -1);
+                                       project(0, 8, ty, tx, extra_dam, GF_MANA, curse_flg, -1);
                                        if (!one_in_(6)) break;
                                }
                        case 7: case 8:
@@ -4974,7 +5038,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                                if (pet) mode |= PM_FORCE_PET;
                                else mode |= (PM_NO_PET | PM_FORCE_FRIENDLY);
 
-                               count += summon_specific((pet ? -1 : 0), py, px, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
+                               count += summon_specific((pet ? -1 : 0), p_ptr->y, p_ptr->x, (pet ? p_ptr->lev*2/3+randint1(p_ptr->lev/2) : dun_level), 0, mode);
                                if (!one_in_(6)) break;
                        }
                        case 23: case 24: case 25:
@@ -5073,7 +5137,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                q_ptr->ident |= (IDENT_MENTAL);
 
                /* Drop it in the dungeon */
-               (void)drop_near(q_ptr, -1, py, px);
+               (void)drop_near(q_ptr, -1, p_ptr->y, p_ptr->x);
        }
 
        /* Track it */
@@ -5085,23 +5149,27 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
        return (obvious);
 }
 
-
-/*
- * Helper function for "project()" below.
- *
+/*!
+ * @brief 汎用的なビーム/ボルト/ボール系によるプレイヤーへの効果処理 / Helper function for "project()" below.
+ * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param who_name 効果を起こしたモンスターの名前
+ * @param r 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
+ * @param y 目標Y座標 / Target y location (or location to travel "towards")
+ * @param x 目標X座標 / Target x location (or location to travel "towards")
+ * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
+ * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
+ * @param flg 効果フラグ
+ * @param monspell 効果元のモンスター魔法ID
+ * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
+ * @details
  * Handle a beam/bolt/ball causing damage to the player.
- *
  * This routine takes a "source monster" (by index), a "distance", a default
  * "damage", and a "damage type".  See "project_m()" above.
- *
  * If "rad" is non-zero, then the blast was centered elsewhere, and the damage
  * is reduced (see "project_m()" above).  This can happen if a monster breathes
  * at the player and hits a wall instead.
- *
  * NOTE (Zangband): 'Bolt' attacks can be reflected back, so we need
  * to know if this is actually a ball or a bolt spell
- *
- *
  * We return "TRUE" if any "obvious" effects were observed.  XXX XXX Actually,
  * we just assume that the effects were obvious, for historical reasons.
  */
@@ -5168,7 +5236,7 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                                t_x = m_list[who].fx - 1 + randint1(3);
                                max_attempts--;
                        }
-                       while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(py, px, t_y, t_x));
+                       while (max_attempts && in_bounds2u(t_y, t_x) && !projectable(p_ptr->y, p_ptr->x, t_y, t_x));
 
                        if (max_attempts < 1)
                        {
@@ -5178,8 +5246,8 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                }
                else
                {
-                       t_y = py - 1 + randint1(3);
-                       t_x = px - 1 + randint1(3);
+                       t_y = p_ptr->y - 1 + randint1(3);
+                       t_x = p_ptr->x - 1 + randint1(3);
                }
 
                project(0, 0, t_y, t_x, dam, typ, (PROJECT_STOP|PROJECT_KILL|PROJECT_REFLECTABLE), monspell);
@@ -5355,13 +5423,13 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                /* Arrow -- XXX no dodging */
                case GF_ARROW:
                {
-            if (fuzzy)
-            {
-                msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
-            }
+                       if (fuzzy)
+                       {
+                               msg_print(_("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
+                       }
                        else if ((inventory[INVEN_RARM].name1 == ART_ZANTETSU) || (inventory[INVEN_LARM].name1 == ART_ZANTETSU))
                        {
-                msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
+                               msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
                                break;
                        }
                        get_damage = take_hit(DAMAGE_ATTACK, dam, killer, monspell);
@@ -5376,13 +5444,13 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
 
                        if (!p_ptr->resist_sound && !CHECK_MULTISHADOW())
                        {
-                               int k = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
-                               (void)set_stun(p_ptr->stun + k);
+                               int plus_stun = (randint1((dam > 40) ? 35 : (dam * 3 / 4 + 5)));
+                               (void)set_stun(p_ptr->stun + plus_stun);
                        }
 
                        if (!(p_ptr->resist_fire ||
-                             IS_OPPOSE_FIRE() ||
-                             p_ptr->immune_fire))
+                               IS_OPPOSE_FIRE() ||
+                               p_ptr->immune_fire))
                        {
                                inven_damage(set_acid_destroy, 3);
                        }
@@ -5512,8 +5580,8 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                        }
                        else if (!CHECK_MULTISHADOW())
                        {
-                               int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
-                               (void)set_stun(p_ptr->stun + k);
+                               int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
+                               (void)set_stun(p_ptr->stun + plus_stun);
                        }
 
                        if (!p_ptr->resist_sound || one_in_(13))
@@ -5614,7 +5682,7 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                }
 
                /* Inertia -- slowness */
-               case GF_INERTIA:
+               case GF_INERTIAL:
                {
                        if (fuzzy) msg_print(_("何か遅いもので攻撃された!", "You are hit by something slow!"));
                        if (!CHECK_MULTISHADOW()) (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
@@ -5753,7 +5821,7 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                case GF_GRAVITY:
                {
                        if (fuzzy) msg_print(_("何か重いもので攻撃された!", "You are hit by something heavy!"));
-            msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
+                               msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
 
                        if (!CHECK_MULTISHADOW())
                        {
@@ -5762,8 +5830,8 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                                        (void)set_slow(p_ptr->slow + randint0(4) + 4, FALSE);
                                if (!(p_ptr->resist_sound || p_ptr->levitation))
                                {
-                                       int k = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
-                                       (void)set_stun(p_ptr->stun + k);
+                                       int plus_stun = (randint1((dam > 90) ? 35 : (dam / 3 + 5)));
+                                       (void)set_stun(p_ptr->stun + plus_stun);
                                }
                        }
                        if (p_ptr->levitation)
@@ -5821,15 +5889,8 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                        if (ironman_nightmare)
                        {
                 msg_print(_("恐ろしい光景が頭に浮かんできた。", "A horrible vision enters your mind."));
-
-                               /* Pick a nightmare */
-                               get_mon_num_prep(get_nightmare, NULL);
-
                                /* Have some nightmares */
-                               have_nightmare(get_mon_num(MAX_DEPTH));
-
-                               /* Remove the monster restriction */
-                               get_mon_num_prep(NULL, NULL);
+                               sanity_blast(NULL, FALSE);
                        }
 
                        set_paralyzed(p_ptr->paralyzed + dam);
@@ -6568,20 +6629,19 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte
 }
 
 
-/*
- * Generic "beam"/"bolt"/"ball" projection routine.
- *
- * Input:
- *   who: Index of "source" monster (zero for "player")
- *   rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
- *   y,x: Target location (or location to travel "towards")
- *   dam: Base damage roll to apply to affected monsters (or player)
- *   typ: Type of damage to apply to monsters (and objects)
- *   flg: Extra bit flags (see PROJECT_xxxx in "defines.h")
- *
- * Return:
- *   TRUE if any "effects" of the projection were observed, else FALSE
- *
+/*!
+ * @brief 汎用的なビーム/ボルト/ボール系処理のルーチン Generic "beam"/"bolt"/"ball" projection routine.
+ * @param who 魔法を発動したモンスター(0ならばプレイヤー) / Index of "source" monster (zero for "player")
+ * @param rad 効果半径(ビーム/ボルト = 0 / ボール = 1以上) / Radius of explosion (0 = beam/bolt, 1 to 9 = ball)
+ * @param y 目標Y座標 / Target y location (or location to travel "towards")
+ * @param x 目標X座標 / Target x location (or location to travel "towards")
+ * @param dam 基本威力 / Base damage roll to apply to affected monsters (or player)
+ * @param typ 効果属性 / Type of damage to apply to monsters (and objects)
+ * @param flg 効果フラグ / Extra bit flags (see PROJECT_xxxx in "defines.h")
+ * @param monspell 効果元のモンスター魔法ID
+ * @return 何か一つでも効力があればTRUEを返す / TRUE if any "effects" of the projection were observed, else FALSE
+ * @details
+ * <pre>
  * Allows a monster (or player) to project a beam/bolt/ball of a given kind
  * towards a given location (optionally passing over the heads of interposing
  * monsters), and have it do a given amount of damage to the monsters (and
@@ -6709,6 +6769,7 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte
  * Note that we must call "handle_stuff()" after affecting terrain features
  * in the blast radius, in case the "illumination" of the grid was changed,
  * and "update_view()" and "update_monsters()" need to be called.
+ * </pre>
  */
 bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int monspell)
 {
@@ -6774,8 +6835,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
        rakubadam_m = 0;
 
        /* Default target of monsterspell is player */
-       monster_target_y=py;
-       monster_target_x=px;
+       monster_target_y=p_ptr->y;
+       monster_target_x=p_ptr->x;
 
        /* Hack -- Jump to target */
        if (flg & (PROJECT_JUMP))
@@ -6792,8 +6853,8 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
        /* Start at player */
        else if (who <= 0)
        {
-               x1 = px;
-               y1 = py;
+               x1 = p_ptr->x;
+               y1 = p_ptr->y;
        }
 
        /* Start at monster */
@@ -6961,11 +7022,11 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                monster_target_y=(s16b)y;
                                monster_target_x=(s16b)x;
 
-                               remove_mirror(y,x);
-                               next_mirror( &oy,&ox,y,x );
+                               remove_mirror(y, x);
+                               next_mirror(&oy, &ox, y, x);
 
                                path_n = i+project_path(&(path_g[i+1]), (project_length ? project_length : MAX_RANGE), y, x, oy, ox, flg);
-                               for( j = last_i; j <=i ; j++ )
+                               for(j = last_i; j <= i; j++)
                                {
                                        y = GRID_Y(path_g[j]);
                                        x = GRID_X(path_g[j]);
@@ -6989,28 +7050,29 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                last_i = i;
                        }
                }
-               for( i = last_i ; i < path_n ; i++ )
+               for(i = last_i ; i < path_n ; i++)
                {
-                       int x,y;
-                       y = GRID_Y(path_g[i]);
-                       x = GRID_X(path_g[i]);
-                       if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))
-                         notice=TRUE;
+                       int py, px;
+                       py = GRID_Y(path_g[i]);
+                       px = GRID_X(path_g[i]);
+                       if(project_m(0, 0, py, px, dam, GF_SEEKER, flg, TRUE))
+                               notice = TRUE;
                        if(!who && (project_m_n==1) && !jump ){
-                         if(cave[project_m_y][project_m_x].m_idx >0 ){
-                           monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
+                               if(cave[project_m_y][project_m_x].m_idx > 0)
+                               {
+                                       monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
 
-                           if (m_ptr->ml)
-                           {
-                             /* Hack -- auto-recall */
-                             if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
+                                       if (m_ptr->ml)
+                                       {
+                                               /* Hack -- auto-recall */
+                                               if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
 
-                             /* Hack - auto-track */
-                             health_track(cave[project_m_y][project_m_x].m_idx);
-                           }
-                         }
+                                               /* Hack - auto-track */
+                                               health_track(cave[project_m_y][project_m_x].m_idx);
+                                       }
+                               }
                        }
-                       (void)project_f(0,0,y,x,dam,GF_SEEKER);
+                       (void)project_f(0, 0, py, px, dam, GF_SEEKER);
                }
                return notice;
        }
@@ -7124,25 +7186,25 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                }
                for( i = 0; i < path_n ; i++ )
                {
-                       int x,y;
-                       y = GRID_Y(path_g[i]);
-                       x = GRID_X(path_g[i]);
-                       (void)project_m(0,0,y,x,dam,GF_SUPER_RAY,flg,TRUE);
-                       if(!who && (project_m_n==1) && !jump ){
-                         if(cave[project_m_y][project_m_x].m_idx >0 ){
-                           monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
+                       int py, px;
+                       py = GRID_Y(path_g[i]);
+                       px = GRID_X(path_g[i]);
+                       (void)project_m(0, 0, py, px, dam, GF_SUPER_RAY, flg, TRUE);
+                       if(!who && (project_m_n == 1) && !jump){
+                               if(cave[project_m_y][project_m_x].m_idx >0 ){
+                                       monster_type *m_ptr = &m_list[cave[project_m_y][project_m_x].m_idx];
 
-                           if (m_ptr->ml)
-                           {
-                             /* Hack -- auto-recall */
-                             if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
+                                       if (m_ptr->ml)
+                                       {
+                                               /* Hack -- auto-recall */
+                                               if (!p_ptr->image) monster_race_track(m_ptr->ap_r_idx);
 
-                             /* Hack - auto-track */
-                             health_track(cave[project_m_y][project_m_x].m_idx);
-                           }
-                         }
+                                               /* Hack - auto-track */
+                                               health_track(cave[project_m_y][project_m_x].m_idx);
+                                       }
+                               }
                        }
-                       (void)project_f(0,0,y,x,dam,GF_SUPER_RAY);
+                       (void)project_f(0, 0, py, px, dam, GF_SUPER_RAY);
                }
                return notice;
        }
@@ -7417,7 +7479,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
        if (flg & PROJECT_KILL)
        {
                see_s_msg = (who > 0) ? is_seen(&m_list[who]) :
-                       (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(py, px, y1, x1)));
+                       (!who ? TRUE : (player_can_see_bold(y1, x1) && projectable(p_ptr->y, p_ptr->x, y1, x1)));
        }
 
 
@@ -7777,6 +7839,11 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
        return (notice);
 }
 
+/*!
+ * @brief 鏡魔法「封魔結界」の効果処理
+ * @param dam ダメージ量
+ * @return 効果があったらTRUEを返す
+ */
 bool binding_field( int dam )
 {
        int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
@@ -7792,18 +7859,18 @@ bool binding_field( int dam )
        int point_y[3];
 
        /* Default target of monsterspell is player */
-       monster_target_y=py;
-       monster_target_x=px;
+       monster_target_y=p_ptr->y;
+       monster_target_x=p_ptr->x;
 
        for( x=0 ; x < cur_wid ; x++ )
        {
                for( y=0 ; y < cur_hgt ; y++ )
                {
                        if( is_mirror_grid(&cave[y][x]) &&
-                           distance(py,px,y,x) <= MAX_RANGE &&
-                           distance(py,px,y,x) != 0 &&
+                           distance(p_ptr->y,p_ptr->x,y,x) <= MAX_RANGE &&
+                           distance(p_ptr->y,p_ptr->x,y,x) != 0 &&
                            player_has_los_bold(y,x) &&
-                           projectable(py, px, y, x)
+                           projectable(p_ptr->y, p_ptr->x, y, x)
                            ){
                                mirror_y[mirror_num]=y;
                                mirror_x[mirror_num]=x;
@@ -7824,8 +7891,8 @@ bool binding_field( int dam )
        point_x[0]=mirror_x[point_x[0]];
        point_y[1]=mirror_y[point_x[1]];
        point_x[1]=mirror_x[point_x[1]];
-       point_y[2]=py;
-       point_x[2]=px;
+       point_y[2]=p_ptr->y;
+       point_x[2]=p_ptr->x;
 
        x=point_x[0]+point_x[1]+point_x[2];
        y=point_y[0]+point_y[1]+point_y[2];
@@ -7853,7 +7920,7 @@ bool binding_field( int dam )
                            centersign*( (point_x[2]-x)*(point_y[0]-y)
                                         -(point_y[2]-y)*(point_x[0]-x)) >=0 )
                        {
-                               if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
+                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        /* Visual effects */
                                        if(!(p_ptr->blind)
                                           && panel_contains(y,x)){
@@ -7876,7 +7943,7 @@ bool binding_field( int dam )
                            centersign*( (point_x[2]-x)*(point_y[0]-y)
                                         -(point_y[2]-y)*(point_x[0]-x)) >=0 )
                        {
-                               if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
+                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        (void)project_f(0,0,y,x,dam,GF_MANA); 
                                }
                        }
@@ -7891,7 +7958,7 @@ bool binding_field( int dam )
                            centersign*( (point_x[2]-x)*(point_y[0]-y)
                                         -(point_y[2]-y)*(point_x[0]-x)) >=0 )
                        {
-                               if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
+                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        (void)project_o(0,0,y,x,dam,GF_MANA); 
                                }
                        }
@@ -7906,7 +7973,7 @@ bool binding_field( int dam )
                            centersign*( (point_x[2]-x)*(point_y[0]-y)
                                         -(point_y[2]-y)*(point_x[0]-x)) >=0 )
                        {
-                               if (player_has_los_bold(y, x) && projectable(py, px, y, x)) {
+                               if (player_has_los_bold(y, x) && projectable(p_ptr->y, p_ptr->x, y, x)) {
                                        (void)project_m(0,0,y,x,dam,GF_MANA,
                                          (PROJECT_GRID|PROJECT_ITEM|PROJECT_KILL|PROJECT_JUMP),TRUE);
                                }
@@ -7921,6 +7988,11 @@ bool binding_field( int dam )
        return TRUE;
 }
 
+/*!
+ * @brief 鏡魔法「鏡の封印」の効果処理
+ * @param dam ダメージ量
+ * @return 効果があったらTRUEを返す
+ */
 void seal_of_mirror( int dam )
 {
        int x,y;