OSDN Git Service

[Refactor] #37353 ソースファイル改名。
[hengband/hengband.git] / src / mspells1.c
index 2874322..4db609b 100644 (file)
@@ -67,7 +67,7 @@ static bool int_outof(monster_race *r_ptr, int prob)
  * @param f6p モンスター魔法のフラグリスト3
  * @return なし
  */
-static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
+static void remove_bad_spells(MONSTER_IDX m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
 {
        monster_type *m_ptr = &m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -332,7 +332,6 @@ static void remove_bad_spells(int m_idx, u32b *f4p, u32b *f5p, u32b *f6p)
                if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_PLAS);
                if (int_outof(r_ptr, 150)) f5 &= ~(RF5_BO_ICEE);
                if (int_outof(r_ptr, 150)) f5 &= ~(RF5_MISSILE);
-               if (int_outof(r_ptr, 150)) f4 &= ~(RF4_SHOOT);
        }
 
        if (smart & (SM_IMM_FREE))
@@ -510,9 +509,9 @@ bool clean_shot(int y1, int x1, int y2, int x2, bool is_friend)
  * @param target_type モンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER
  * @return なし
  */
-void bolt(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int target_type)
+void bolt(MONSTER_IDX m_idx, int y, int x, int typ, int dam_hp, int monspell, int target_type)
   {
-    int flg;
+    BIT_FLAGS flg = 0;
     bool learnable = spell_learnable(m_idx);
 
     switch (target_type)
@@ -541,9 +540,9 @@ void bolt(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int target
  * @param target_type モンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER
  * @return なし
  */
-void beam(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int target_type)
+void beam(MONSTER_IDX m_idx, int y, int x, int typ, int dam_hp, int monspell, int target_type)
 {
-    int flg;
+    BIT_FLAGS flg = 0;
     bool learnable = spell_learnable(m_idx);
 
     switch (target_type)
@@ -575,12 +574,12 @@ void beam(int m_idx, int y, int x, int typ, int dam_hp, int monspell, int target
  * @param target_type モンスターからモンスターへ撃つならMONSTER_TO_MONSTER、モンスターからプレイヤーならMONSTER_TO_PLAYER
  * @return なし
  */
-void breath(int y, int x, int m_idx, int typ, int dam_hp, int rad, bool breath, int monspell, int target_type)
+void breath(int y, int x, MONSTER_IDX m_idx, int typ, int dam_hp, int rad, bool breath, int monspell, int target_type)
 {
     monster_type *m_ptr = &m_list[m_idx];
     monster_race *r_ptr = &r_info[m_ptr->r_idx];
     bool learnable = spell_learnable(m_idx);
-       int flg;
+       BIT_FLAGS flg = 0x00;
 
     switch (target_type)
     {
@@ -675,12 +674,12 @@ void curse_equipment(int chance, int heavy_chance)
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
 
        /* Extra, biased saving throw for blessed items */
-       if (have_flag(oflgs, TR_BLESSED) && (randint1(888) > chance))
+       if (have_flag(oflgs, TR_BLESSED))
        {
 #ifdef JP
-msg_format("%sは呪いを跳ね返した!", o_name,
+               msg_format("祝福された%sは呪いを跳ね返した!", o_name,
 #else
-               msg_format("Your %s resist%s cursing!", o_name,
+               msg_format("Your blessed %s resist%s cursing!", o_name,
 #endif
 
                        ((o_ptr->number > 1) ? "" : "s"));
@@ -960,7 +959,7 @@ static bool spell_dispel(byte spell)
  * @param m_idx モンスターの構造体配列ID
  * @return 魔力消去をかけるべきならTRUEを返す。
  */
-bool dispel_check(int m_idx)
+bool dispel_check(MONSTER_IDX m_idx)
 {
        monster_type *m_ptr = &m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -1077,7 +1076,7 @@ bool dispel_check(int m_idx)
  *\n
  * This function may well be an efficiency bottleneck.\n
  */
-static int choose_attack_spell(int m_idx, byte spells[], byte num)
+static int choose_attack_spell(MONSTER_IDX m_idx, byte spells[], byte num)
 {
        monster_type *m_ptr = &m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -1210,7 +1209,7 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
        }
 
        /* Player is close and we have attack spells, blink away */
-       if ((distance(py, px, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->flags6 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster)
+       if ((distance(p_ptr->y, p_ptr->x, m_ptr->fy, m_ptr->fx) < 4) && (attack_num || (r_ptr->a_ability_flags2 & RF6_TRAPS)) && (randint0(100) < 75) && !world_monster)
        {
                /* Choose tactical spell */
                if (tactic_num) return (tactic[randint0(tactic_num)]);
@@ -1306,7 +1305,7 @@ static int choose_attack_spell(int m_idx, byte spells[], byte num)
  * @param spell 判定対象のID
  * @return 非魔術的な特殊技能ならばTRUEを返す。
  */
-bool spell_is_inate(u16b spell)
+bool spell_is_inate(SPELL_IDX spell)
 {
        if (spell < 32 * 4) /* Set RF4 */
        {
@@ -1335,8 +1334,8 @@ bool spell_is_inate(u16b spell)
  * @param path_check 射線を判定するための関数ポインタ
  * @return 有効な座標があった場合TRUEを返す
  */
-static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp,
-       int f_flag, bool (*path_check)(int, int, int, int))
+static bool adjacent_grid_check(monster_type *m_ptr, POSITION *yp, POSITION *xp,
+       int f_flag, bool (*path_check)(POSITION, POSITION, POSITION, POSITION))
 {
        int i;
        int tonari;
@@ -1349,9 +1348,9 @@ static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp,
                                             {-1,  0,  1, -1,  1, -1,  0,  1},
                                             { 1,  0, -1,  1, -1,  1,  0, -1}};
 
-       if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0;
-       else if (m_ptr->fy < py) tonari = 1;
-       else if (m_ptr->fx < px) tonari = 2;
+       if (m_ptr->fy < p_ptr->y && m_ptr->fx < p_ptr->x) tonari = 0;
+       else if (m_ptr->fy < p_ptr->y) tonari = 1;
+       else if (m_ptr->fx < p_ptr->x) tonari = 2;
        else tonari = 3;
 
        for (i = 0; i < 8; i++)
@@ -1440,11 +1439,14 @@ static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp,
  * Note the special "MFLAG_NICE" flag, which prevents a monster from using\n
  * any spell attacks until the player has had a single chance to move.\n
  */
-bool make_attack_spell(int m_idx)
+bool make_attack_spell(MONSTER_IDX m_idx)
 {
-       int             k, thrown_spell = 0, rlev, failrate;
+       int k;
+       SPELL_IDX thrown_spell = 0;
+       DEPTH rlev;
+       PERCENTAGE failrate;
        byte            spell[96], num = 0;
-       u32b            f4, f5, f6;
+       BIT_FLAGS f4, f5, f6;
        monster_type    *m_ptr = &m_list[m_idx];
        monster_race    *r_ptr = &r_info[m_ptr->r_idx];
        char            m_name[80];
@@ -1454,18 +1456,14 @@ bool make_attack_spell(int m_idx)
        bool            no_inate = FALSE;
        bool            do_spell = DO_SPELL_NONE;
        int             dam = 0;
-       int rad = 0; //For elemental spells
 
        /* Target location */
-       int x = px;
-       int y = py;
+       POSITION x = p_ptr->x;
+       POSITION y = p_ptr->y;
 
        /* Target location for lite breath */
-       int x_br_lite = 0;
-       int y_br_lite = 0;
-
-       /* Summon count */
-       int count = 0;
+       POSITION x_br_lite = 0;
+       POSITION y_br_lite = 0;
 
        /* Extract the "see-able-ness" */
     bool seen = (!p_ptr->blind && m_ptr->ml);
@@ -1501,8 +1499,8 @@ bool make_attack_spell(int m_idx)
 
        /* 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;
 
        /*** require projectable player ***/
 
@@ -1690,7 +1688,7 @@ bool make_attack_spell(int m_idx)
                if (((f4 & RF4_BOLT_MASK) ||
                     (f5 & RF5_BOLT_MASK) ||
                     (f6 & RF6_BOLT_MASK)) &&
-                   !clean_shot(m_ptr->fy, m_ptr->fx, py, px, FALSE))
+                   !clean_shot(m_ptr->fy, m_ptr->fx, p_ptr->y, p_ptr->x, FALSE))
                {
                        /* Remove spells that will only hurt friends */
                        f4 &= ~(RF4_BOLT_MASK);