OSDN Git Service

#37580 sanity_blast()の仕様変更。魔法防御が高いほど致命的な変異を受けやすい問題を直した。 / Change process of sanity_bl...
[hengband/hengband.git] / src / spells1.c
index af9e23b..92dbfcc 100644 (file)
@@ -129,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);
@@ -208,7 +208,7 @@ static byte spell_color(int type)
  * If the distance is not "one", we (may) return "*".
  * </pre>
  */
-u16b bolt_pict(int y, int x, int ny, int nx, int typ)
+u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, int typ)
 {
        int base;
 
@@ -298,7 +298,7 @@ u16b bolt_pict(int y, int x, int ny, int nx, int typ)
  * 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)
+sint project_path(u16b *gp, POSITION range, POSITION y1, POSITION x1, POSITION y2, POSITION x2, BIT_FLAGS flg)
 {
        int y, x;
 
@@ -596,11 +596,11 @@ 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; /*!< 処理中のモンスターX座標 */
-static int project_m_y; /*!< 処理中のモンスターY座標 */
+static POSITION project_m_x; /*!< 処理中のモンスターX座標 */
+static POSITION project_m_y; /*!< 処理中のモンスターY座標 */
 /* Mega-Hack -- monsters target */
-static s16b monster_target_x; /*!< モンスターの攻撃目標X座標 */
-static s16b monster_target_y; /*!< モンスターの攻撃目標Y座標 */
+static POSITION monster_target_x; /*!< モンスターの攻撃目標X座標 */
+static POSITION monster_target_y; /*!< モンスターの攻撃目標Y座標 */
 
 
 /*!
@@ -628,7 +628,7 @@ static s16b monster_target_y; /*!< モンスターの攻撃目標Y座標 */
  * 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)
+static bool project_f(int who, int r, int y, int x, HIT_POINT dam, int typ)
 {
        cave_type       *c_ptr = &cave[y][x];
        feature_type    *f_ptr = &f_info[c_ptr->feat];
@@ -1198,20 +1198,20 @@ static bool project_f(int who, int r, int y, int x, int dam, int typ)
  * 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)
+static bool project_o(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ)
 {
        cave_type *c_ptr = &cave[y][x];
 
-       s16b this_o_idx, next_o_idx = 0;
+       OBJECT_IDX this_o_idx, next_o_idx = 0;
 
        bool obvious = FALSE;
        bool known = player_has_los_bold(y, x);
 
-       u32b flgs[TR_FLAG_SIZE];
+       BIT_FLAGS flgs[TR_FLAG_SIZE];
 
        char o_name[MAX_NLEN];
 
-       int k_idx = 0;
+       KIND_OBJECT_IDX k_idx = 0;
        bool is_potion = FALSE;
 
 
@@ -1430,7 +1430,7 @@ static bool project_o(int who, int r, int y, int x, int dam, int typ)
                                if (o_ptr->tval == TV_CORPSE)
                                {
                                        int i;
-                                       u32b mode = 0L;
+                                       BIT_FLAGS mode = 0L;
 
                                        if (!who || is_pet(&m_list[who]))
                                                mode |= PM_FORCE_PET;
@@ -1545,13 +1545,12 @@ static bool project_o(int who, int r, int y, int x, int dam, int typ)
  * 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>
- * </pre>
- * <pre>
  * Various messages are produced, and damage is applied.
  * </pre>
  * <pre>
@@ -1586,7 +1585,7 @@ static bool project_o(int who, int r, int y, int x, int dam, int typ)
  * "flg" was added.
  * </pre>
  */
-static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, bool see_s_msg)
+static bool project_m(MONSTER_IDX who, POSITION r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, bool see_s_msg)
 {
        int tmp;
 
@@ -1644,7 +1643,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
        char m_name[80];
        char m_poss[10];
 
-       int photo = 0;
+       PARAMETER_VALUE photo = 0;
 
        /* Assume no note */
        cptr note = NULL;
@@ -2176,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;
 
@@ -2356,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);
@@ -3054,7 +3053,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
 
                        if (r_ptr->flagsr & RFR_RES_ALL)
                        {
-                note = _("には効果がなかった!", " is immune.");
+                               note = _("には効果がなかった!", " is immune.");
                                dam = 0;
                                if (is_original_ap_and_seen(m_ptr)) r_ptr->r_flagsr |= (RFR_RES_ALL);
                                break;
@@ -4074,7 +4073,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                                break;
                        }
 
-                       if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->flags5 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->flags6 & ~(RF6_NOMAGIC_MASK)))
+                       if ((r_ptr->flags4 & ~(RF4_NOMAGIC_MASK)) || (r_ptr->a_ability_flags1 & ~(RF5_NOMAGIC_MASK)) || (r_ptr->a_ability_flags2 & ~(RF6_NOMAGIC_MASK)))
                        {
                                if (who > 0)
                                {
@@ -5006,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:
@@ -5034,12 +5033,12 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
                        case 19: case 20: case 21: case 22:
                        {
                                bool pet = !one_in_(3);
-                               u32b mode = PM_ALLOW_GROUP;
+                               BIT_FLAGS mode = PM_ALLOW_GROUP;
 
                                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:
@@ -5138,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 */
@@ -5174,7 +5173,7 @@ static bool project_m(int who, int r, int y, int x, int dam, int typ, int flg, b
  * We return "TRUE" if any "obvious" effects were observed.  XXX XXX Actually,
  * we just assume that the effects were obvious, for historical reasons.
  */
-static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int typ, int flg, int monspell)
+static bool project_p(int who, cptr who_name, int r, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
 {
        int k = 0;
        int rlev = 0;
@@ -5217,15 +5216,15 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
 
        if ((p_ptr->reflect || ((p_ptr->special_defense & KATA_FUUJIN) && !p_ptr->blind)) && (flg & PROJECT_REFLECTABLE) && !one_in_(10))
        {
-               byte t_y, t_x;
+               POSITION t_y, t_x;
                int max_attempts = 10;
 
-        if (blind) 
-            msg_print(_("何かが跳ね返った!", "Something bounces!"));
+               if (blind) 
+                       msg_print(_("何かが跳ね返った!", "Something bounces!"));
                else if (p_ptr->special_defense & KATA_FUUJIN) 
-            msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
+                       msg_print(_("風の如く武器を振るって弾き返した!", "The attack bounces!"));
                else 
-            msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
+                       msg_print(_("攻撃が跳ね返った!", "The attack bounces!"));
 
 
                /* Choose 'new' target */
@@ -5237,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)
                        {
@@ -5247,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);
@@ -5424,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);
@@ -5445,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);
                        }
@@ -5466,7 +5465,9 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
                        if (p_ptr->resist_neth)
                        {
                                if (!prace_is_(RACE_SPECTRE))
+                               {
                                        dam *= 6; dam /= (randint1(4) + 7);
+                               }
                        }
                        else if (!CHECK_MULTISHADOW()) drain_exp(200 + (p_ptr->exp / 100), 200 + (p_ptr->exp / 1000), 75);
 
@@ -5581,8 +5582,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))
@@ -5683,7 +5684,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);
@@ -5822,7 +5823,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())
                        {
@@ -5831,8 +5832,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)
@@ -5890,15 +5891,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);
@@ -6294,27 +6288,27 @@ static bool project_p(int who, cptr who_name, int r, int y, int x, int dam, int
 /*
  * Find the distance from (x, y) to a line.
  */
-int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
+POSITION dist_to_line(POSITION y, POSITION x, POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
        /* Vector from (x, y) to (x1, y1) */
-       int py = y1 - y;
-       int px = x1 - x;
+       POSITION py = y1 - y;
+       POSITION px = x1 - x;
 
        /* Normal vector */
-       int ny = x2 - x1;
-       int nx = y1 - y2;
+       POSITION ny = x2 - x1;
+       POSITION nx = y1 - y2;
 
-   /* Length of N */
-       int pd = distance(y1, x1, y, x);
-       int nd = distance(y1, x1, y2, x2);
+       /* Length of N */
+       POSITION pd = distance(y1, x1, y, x);
+       POSITION nd = distance(y1, x1, y2, x2);
 
        if (pd > nd) return distance(y, x, y2, x2);
 
        /* Component of P on N */
        nd = ((nd) ? ((py * ny + px * nx) / nd) : 0);
 
-   /* Absolute value */
-   return((nd >= 0) ? nd : 0 - nd);
+       /* Absolute value */
+       return((nd >= 0) ? nd : 0 - nd);
 }
 
 
@@ -6324,28 +6318,28 @@ int dist_to_line(int y, int x, int y1, int x1, int y2, int x2)
  * Modified version of los() for calculation of disintegration balls.
  * Disintegration effects are stopped by permanent walls.
  */
-bool in_disintegration_range(int y1, int x1, int y2, int x2)
+bool in_disintegration_range(POSITION y1, POSITION x1, POSITION y2, POSITION x2)
 {
        /* Delta */
-       int dx, dy;
+       POSITION dx, dy;
 
        /* Absolute */
-       int ax, ay;
+       POSITION ax, ay;
 
        /* Signs */
-       int sx, sy;
+       POSITION sx, sy;
 
        /* Fractions */
-       int qx, qy;
+       POSITION qx, qy;
 
        /* Scanners */
-       int tx, ty;
+       POSITION tx, ty;
 
        /* Scale factors */
-       int f1, f2;
+       POSITION f1, f2;
 
        /* Slope, or 1/Slope, of LOS */
-       int m;
+       POSITION m;
 
 
        /* Extract the offset */
@@ -6550,10 +6544,10 @@ bool in_disintegration_range(int y1, int x1, int y2, int x2)
 /*
  * breath shape
  */
-void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, int typ)
+void breath_shape(u16b *path_g, int dist, int *pgrids, POSITION *gx, POSITION *gy, POSITION *gm, POSITION *pgm_rad, POSITION rad, POSITION y1, POSITION x1, POSITION y2, POSITION x2, int typ)
 {
-       int by = y1;
-       int bx = x1;
+       POSITION by = y1;
+       POSITION bx = x1;
        int brad = 0;
        int brev = rad * rad / dist;
        int bdis = 0;
@@ -6779,17 +6773,17 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte
  * 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)
+bool project(MONSTER_IDX who, POSITION rad, POSITION y, POSITION x, HIT_POINT dam, int typ, BIT_FLAGS flg, int monspell)
 {
        int i, t, dist;
 
-       int y1, x1;
-       int y2, x2;
-       int by, bx;
+       POSITION y1, x1;
+       POSITION y2, x2;
+       POSITION by, bx;
 
        int dist_hack = 0;
 
-       int y_saver, x_saver; /* For reflecting monsters */
+       POSITION y_saver, x_saver; /* For reflecting monsters */
 
        int msec = delay_factor * delay_factor * delay_factor;
 
@@ -6820,13 +6814,13 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
        int grids = 0;
 
        /* Coordinates of the affected grids */
-       byte gx[1024], gy[1024];
+       POSITION gx[1024], gy[1024];
 
        /* Encoded "radius" info (see above) */
-       byte gm[32];
+       POSITION gm[32];
 
        /* Actual radius encoded in gm[] */
-       int gm_rad = rad;
+       POSITION gm_rad = rad;
 
        bool jump = FALSE;
 
@@ -6843,8 +6837,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))
@@ -6861,8 +6855,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 */
@@ -7030,15 +7024,15 @@ 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]);
-                                       if(project_m(0,0,y,x,dam,GF_SEEKER,flg,TRUE))notice=TRUE;
+                                       if(project_m(0, 0, y, x, 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];
@@ -7058,28 +7052,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;
        }
@@ -7193,25 +7188,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;
        }
@@ -7486,7 +7481,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)));
        }
 
 
@@ -7591,7 +7586,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
                                    ((cave[y][x].m_idx != p_ptr->riding) || !(flg & PROJECT_PLAYER)) &&
                                    (!who || dist_hack > 1) && !one_in_(10))
                                {
-                                       byte t_y, t_x;
+                                       POSITION t_y, t_x;
                                        int max_attempts = 10;
 
                                        /* Choose 'new' target */
@@ -7851,7 +7846,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons
  * @param dam ダメージ量
  * @return 効果があったらTRUEを返す
  */
-bool binding_field( int dam )
+bool binding_field( HIT_POINT dam )
 {
        int mirror_x[10],mirror_y[10]; /* 鏡はもっと少ない */
        int mirror_num=0;              /* 鏡の数 */
@@ -7866,18 +7861,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;
@@ -7898,8 +7893,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];
@@ -7927,7 +7922,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)){
@@ -7950,7 +7945,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); 
                                }
                        }
@@ -7965,7 +7960,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); 
                                }
                        }
@@ -7980,7 +7975,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);
                                }
@@ -8000,7 +7995,7 @@ bool binding_field( int dam )
  * @param dam ダメージ量
  * @return 効果があったらTRUEを返す
  */
-void seal_of_mirror( int dam )
+void seal_of_mirror( HIT_POINT dam )
 {
        int x,y;