OSDN Git Service

#37353 HEX_REVENGE_TYPE, HEX_REVENGE_POWER, HEX_REVENGE_TURN を定義。 / Define HEX_REVENG...
[hengband/hengband.git] / src / mspells2.c
index 7e8129a..2913919 100644 (file)
@@ -1,6 +1,6 @@
-/*!
+/*!
  * @file mspells2.c
- * @brief ¥â¥ó¥¹¥¿¡¼ËâË¡¤Î¼ÂÁõ(ÂÐ¥â¥ó¥¹¥¿¡¼½èÍý) / Monster spells (attack monster)
+ * @brief モンスター魔法の実装(対モンスター処理) / Monster spells (attack monster)
  * @date 2014/01/17
  * @author
  * Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke\n
 #include "angband.h"
 
 /*!
- * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨ÂÐ¥â¥ó¥¹¥¿¡¼¤Ë¥Ó¡¼¥à¤òÅö¤Æ¤ë¤³¤È²Äǽ¤«¤òȽÄꤹ¤ë /
+ * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
  * Determine if a beam spell will hit the target.
- * @param y1 »ÏÅÀ¤ÎYºÂɸ
- * @param x1 »ÏÅÀ¤ÎXºÂɸ
- * @param y2 ÌÜɸ¤ÎYºÂɸ
- * @param x2 ÌÜɸ¤ÎXºÂɸ
- * @param m_ptr »ÈÍѤ¹¤ë¥â¥ó¥¹¥¿¡¼¤Î¹½Â¤Âλ²¾È¥Ý¥¤¥ó¥¿
- * @return ¥Ó¡¼¥à¤¬Åþã²Äǽ¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
+ * @param y1 始点のY座標
+ * @param x1 始点のX座標
+ * @param y2 目標のY座標
+ * @param x2 目標のX座標
+ * @param m_ptr ä½¿ç\94¨ã\81\99ã\82\8bã\83¢ã\83³ã\82¹ã\82¿ã\83¼ã\81®æ§\8bé\80 ä½\93å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @return ビームが到達可能ならばTRUEを返す
  */
 static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr)
 {
@@ -62,39 +62,39 @@ static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr)
 }
 
 /*!
- * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨ÂÐ¥â¥ó¥¹¥¿¡¼¤ËľÀܥ֥쥹¤òÅö¤Æ¤ë¤³¤È¤¬²Äǽ¤«¤òȽÄꤹ¤ë /
+ * @brief モンスターが敵対モンスターに直接ブレスを当てることが可能かを判定する /
  * Determine if a breath will hit the target.
- * @param y1 »ÏÅÀ¤ÎYºÂɸ
- * @param x1 »ÏÅÀ¤ÎXºÂɸ
- * @param y2 ÌÜɸ¤ÎYºÂɸ
- * @param x2 ÌÜɸ¤ÎXºÂɸ
- * @param rad È¾·Â
- * @param typ ¸ú²Ì°À­ID
- * @param is_friend TRUE¤Ê¤é¤Ð¡¢¥×¥ì¥¤¥ä¡¼¤ò´¬¤­¹þ¤à»þ¤Ë¥Ö¥ì¥¹¤ÎȽÄê¤òFALSE¤Ë¤¹¤ë¡£
- * @return ¥Ö¥ì¥¹¤òľÀÜÅö¤Æ¤é¤ì¤ë¤Ê¤é¤ÐTRUE¤òÊÖ¤¹
+ * @param y1 始点のY座標
+ * @param x1 始点のX座標
+ * @param y2 目標のY座標
+ * @param x2 目標のX座標
+ * @param rad 半径
+ * @param typ 効果属性ID
+ * @param is_friend TRUEならば、プレイヤーを巻き込む時にブレスの判定をFALSEにする。
+ * @return ブレスを直接当てられるならばTRUEを返す
  */
-static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool is_friend)
+static bool breath_direct(POSITION y1, POSITION x1, POSITION y2, POSITION x2, POSITION rad, int typ, bool is_friend)
 {
        /* Must be the same as projectable() */
 
        int i;
 
        /* Initial grid */
-       int y = y1;
-       int x = x1;
+       POSITION y = y1;
+       POSITION x = x1;
 
        int grid_n = 0;
        u16b grid_g[512];
 
        int grids = 0;
-       byte gx[1024], gy[1024];
-       byte gm[32];
-       int gm_rad = rad;
+       POSITION gx[1024], gy[1024];
+       POSITION gm[32];
+       POSITION gm_rad = rad;
 
        bool hit2 = FALSE;
        bool hityou = FALSE;
 
-       int flg;
+       BIT_FLAGS flg;
 
        switch (typ)
        {
@@ -147,17 +147,17 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool
                if (flg & PROJECT_DISI)
                {
                        if (in_disintegration_range(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
-                       if (in_disintegration_range(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
+                       if (in_disintegration_range(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
                }
                else if (flg & PROJECT_LOS)
                {
                        if (los(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
-                       if (los(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
+                       if (los(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
                }
                else
                {
                        if (projectable(y1, x1, y2, x2) && (distance(y1, x1, y2, x2) <= rad)) hit2 = TRUE;
-                       if (projectable(y1, x1, py, px) && (distance(y1, x1, py, px) <= rad)) hityou = TRUE;
+                       if (projectable(y1, x1, p_ptr->y, p_ptr->x) && (distance(y1, x1, p_ptr->y, p_ptr->x) <= rad)) hityou = TRUE;
                }
        }
        else
@@ -182,16 +182,16 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool
 }
 
 /*!
- * @brief ¥â¥ó¥¹¥¿¡¼¤¬ÆüìǽÎϤÎÌÜɸÃÏÅÀ¤ò·è¤á¤ë½èÍý /
+ * @brief モンスターが特殊能力の目標地点を決める処理 /
  * Get the actual center point of ball spells (rad > 1) (originally from TOband)
- * @param sy »ÏÅÀ¤ÎYºÂɸ
- * @param sx »ÏÅÀ¤ÎXºÂɸ
- * @param ty ÌÜɸYºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
- * @param tx ÌÜɸXºÂɸ¤òÊÖ¤¹»²¾È¥Ý¥¤¥ó¥¿
- * @param flg È½Äê¤Î¥Õ¥é¥°ÇÛÎó
- * @return ¤Ê¤·
+ * @param sy 始点のY座標
+ * @param sx 始点のX座標
+ * @param ty ç\9b®æ¨\99Y座æ¨\99ã\82\92è¿\94ã\81\99å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @param tx ç\9b®æ¨\99X座æ¨\99ã\82\92è¿\94ã\81\99å\8f\82ç\85§ã\83\9dã\82¤ã\83³ã\82¿
+ * @param flg 判定のフラグ配列
+ * @return なし
  */
-void get_project_point(int sy, int sx, int *ty, int *tx, int flg)
+void get_project_point(int sy, int sx, int *ty, int *tx, BIT_FLAGS flg)
 {
        u16b path_g[128];
        int  path_n, i;
@@ -216,13 +216,13 @@ void get_project_point(int sy, int sx, int *ty, int *tx, int flg)
 }
 
 /*!
- * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨¥â¥ó¥¹¥¿¡¼¤ËËâÎϾõî¤ò»È¤¦¤«¤É¤¦¤«¤òÊÖ¤¹ /
+ * @brief モンスターが敵モンスターに魔力消去を使うかどうかを返す /
  * Check should monster cast dispel spell at other monster.
- * @param m_idx ½Ñ¼Ô¤Î¥â¥ó¥¹¥¿¡¼ID
- * @param t_idx ÌÜɸ¤Î¥â¥ó¥¹¥¿¡¼ID
- * @return ËâÎϾõî¤ò»È¤¦¤Ù¤­¤Ê¤é¤ÐTRUE¤òÊѤ¨¤¹¡£
+ * @param m_idx è¡\93è\80\85ã\81®ã\83¢ã\83³ã\82¹ã\82¿ã\83¼ID
+ * @param t_idx ç\9b®æ¨\99ã\81®ã\83¢ã\83³ã\82¹ã\82¿ã\83¼ID
+ * @return 魔力消去を使うべきならばTRUEを変えす。
  */
-static bool dispel_check_monster(int m_idx, int t_idx)
+static bool dispel_check_monster(MONSTER_IDX m_idx, IDX t_idx)
 {
        monster_type *t_ptr = &m_list[t_idx];
 
@@ -246,22 +246,22 @@ static bool dispel_check_monster(int m_idx, int t_idx)
 }
 
 /*!
- * @brief ¥â¥ó¥¹¥¿¡¼¤¬Å¨¥â¥ó¥¹¥¿¡¼¤ËÆüìǽÎϤò»È¤¦½èÍý¤Î¥á¥¤¥ó¥ë¡¼¥Á¥ó /
+ * @brief モンスターが敵モンスターに特殊能力を使う処理のメインルーチン /
  * Monster tries to 'cast a spell' (or breath, etc) at another monster.
- * @param m_idx ½Ñ¼Ô¤Î¥â¥ó¥¹¥¿¡¼ID
- * @return ¼ÂºÝ¤ËÆüìǽÎϤò»È¤Ã¤¿¾ì¹çTRUE¤òÊÖ¤¹
+ * @param m_idx è¡\93è\80\85ã\81®ã\83¢ã\83³ã\82¹ã\82¿ã\83¼ID
+ * @return 実際に特殊能力を使った場合TRUEを返す
  * @details
  * The player is only disturbed if able to be affected by the spell.
  */
-bool monst_spell_monst(int m_idx)
+bool monst_spell_monst(MONSTER_IDX m_idx)
 {
-       int y = 0, x = 0;
-       int i, k, t_idx = 0;
-       int thrown_spell, count = 0;
-       int dam = 0;
+       POSITION y = 0, x = 0;
+       int i, k;
+       MONSTER_IDX t_idx = 0;
+       int thrown_spell;
+       HIT_POINT dam = 0;
        int start;
        int plus = 1;
-       int rad = 0; //For elemental balls
 
        byte spell[96], num = 0;
 
@@ -290,18 +290,15 @@ bool monst_spell_monst(int m_idx)
                && (!p_ptr->inside_quest || is_fixed_quest_idx(p_ptr->inside_quest));
 
        bool can_use_lite_area = FALSE;
-
        bool can_remember;
 
-       bool resists_tele = FALSE;
-
        /* Cannot cast spells when confused */
        if (MON_CONFUSED(m_ptr)) return (FALSE);
 
        /* Extract the racial spell flags */
        f4 = r_ptr->flags4;
-       f5 = r_ptr->flags5;
-       f6 = r_ptr->flags6;
+       f5 = r_ptr->a_ability_flags1;
+       f6 = r_ptr->a_ability_flags2;
 
        /* Target is given for pet? */
        if (pet_t_m_idx && pet)
@@ -357,7 +354,7 @@ bool monst_spell_monst(int m_idx)
                /* Scan thru all monsters */
                for (i = start; ((i < start + m_max) && (i > start - m_max)); i += plus)
                {
-                       int dummy = (i % m_max);
+                       MONSTER_IDX dummy = (i % m_max);
                        if (!dummy) continue;
 
                        t_idx = dummy;
@@ -486,9 +483,9 @@ bool monst_spell_monst(int m_idx)
 
                                get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, 0L);
 
-                               if (projectable(real_y, real_x, py, px))
+                               if (projectable(real_y, real_x, p_ptr->y, p_ptr->x))
                                {
-                                       int dist = distance(real_y, real_x, py, px);
+                                       int dist = distance(real_y, real_x, p_ptr->y, p_ptr->x);
 
                                        if (dist <= 2)
                                        {
@@ -505,7 +502,7 @@ bool monst_spell_monst(int m_idx)
                                }
                                else if (f5 & RF5_BA_LITE)
                                {
-                                       if ((distance(real_y, real_x, py, px) <= 4) && los(real_y, real_x, py, px))
+                                       if ((distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 4) && los(real_y, real_x, p_ptr->y, p_ptr->x))
                                                f5 &= ~(RF5_BA_LITE);
                                }
                        }
@@ -516,7 +513,7 @@ bool monst_spell_monst(int m_idx)
                                int real_x = x;
 
                                get_project_point(m_ptr->fy, m_ptr->fx, &real_y, &real_x, PROJECT_STOP);
-                               if (projectable(real_y, real_x, py, px) && (distance(real_y, real_x, py, px) <= 2))
+                               if (projectable(real_y, real_x, p_ptr->y, p_ptr->x) && (distance(real_y, real_x, p_ptr->y, p_ptr->x) <= 2))
                                        f4 &= ~(RF4_ROCKET);
                        }
 
@@ -697,7 +694,7 @@ bool monst_spell_monst(int m_idx)
        {
                disturb(1, 1);
                /* Message */
-               if (see_m) msg_format(_("%^s¤Ï¼öʸ¤ò¾§¤¨¤è¤¦¤È¤·¤¿¤¬¼ºÇÔ¤·¤¿¡£", 
+               if (see_m) msg_format(_("%^sは呪文を唱えようとしたが失敗した。", 
                                            "%^s tries to cast a spell, but fails."), m_name);
 
                return (TRUE);
@@ -706,7 +703,7 @@ bool monst_spell_monst(int m_idx)
        /* Hex: Anti Magic Barrier */
        if (!spell_is_inate(thrown_spell) && magic_barrier(m_idx))
        {
-               if (see_m) msg_format(_("È¿ËâË¡¥Ð¥ê¥¢¤¬%^s¤Î¼öʸ¤ò¤«¤­¾Ã¤·¤¿¡£", 
+               if (see_m) msg_format(_("反魔法バリアが%^sの呪文をかき消した。", 
                                            "Anti magic barrier cancels the spell which %^s casts."), m_name);
                return (TRUE);
        }