OSDN Git Service

[Refactor] #38997 in_bound() に floor_type * 引数を追加. / Add floor_type * argument to...
[hengbandforosx/hengbandosx.git] / src / mspells1.c
index 3dc4222..7eb3a89 100644 (file)
  */
 
 #include "angband.h"
+#include "util.h"
+
+#include "floor.h"
+#include "dungeon.h"
+#include "grid.h"
 #include "object-curse.h"
-#include "projection.h"
 #include "quest.h"
 #include "realm-hex.h"
 #include "player-move.h"
+#include "player-status.h"
+#include "monster.h"
+#include "monster-spell.h"
+#include "spells.h"
+#include "world.h"
+#include "realm-song.h"
+#include "view-mainwindow.h"
+#include "player-race.h"
+#include "player-class.h"
 
 
 /*!
@@ -248,7 +261,7 @@ static void remove_bad_spells(MONSTER_IDX m_idx, u32b *f4p, u32b *f5p, u32b *f6p
 
        if (smart & (SM_RES_NETH))
        {
-               if (prace_is_(RACE_SPECTRE))
+               if (PRACE_IS_(p_ptr, RACE_SPECTRE))
                {
                        f4 &= ~(RF4_BR_NETH);
                        f5 &= ~(RF5_BA_NETH);
@@ -270,7 +283,7 @@ static void remove_bad_spells(MONSTER_IDX m_idx, u32b *f4p, u32b *f5p, u32b *f6p
 
        if (smart & (SM_RES_DARK))
        {
-               if (prace_is_(RACE_VAMPIRE))
+               if (PRACE_IS_(p_ptr, RACE_VAMPIRE))
                {
                        f4 &= ~(RF4_BR_DARK);
                        f5 &= ~(RF5_BA_DARK);
@@ -376,7 +389,7 @@ bool summon_possible(POSITION y1, POSITION x1)
                for (x = x1 - 2; x <= x1 + 2; x++)
                {
                        /* Ignore illegal locations */
-                       if (!in_bounds(y, x)) continue;
+                       if (!in_bounds(current_floor_ptr, y, x)) continue;
 
                        /* Only check a circular area */
                        if (distance(y1, x1, y, x)>2) continue;
@@ -798,7 +811,7 @@ static bool spell_world(byte spell)
  */
 static bool spell_special(byte spell)
 {
-       if (p_ptr->inside_battle) return FALSE;
+       if (p_ptr->phase_out) return FALSE;
        if (spell == 160 + 7) return (TRUE);
        return (FALSE);
 }
@@ -890,7 +903,7 @@ bool dispel_check(MONSTER_IDX m_idx)
        /* Elemental resistances */
        if (r_ptr->flags4 & RF4_BR_ACID)
        {
-               if (!p_ptr->immune_acid && (p_ptr->oppose_acid || music_singing(MUSIC_RESIST))) return (TRUE);
+               if (!p_ptr->immune_acid && (p_ptr->oppose_acid || music_singing(p_ptr, MUSIC_RESIST))) return (TRUE);
                if (p_ptr->special_defense & DEFENSE_ACID) return (TRUE);
        }
 
@@ -898,20 +911,20 @@ bool dispel_check(MONSTER_IDX m_idx)
        {
                if (!((p_ptr->prace == RACE_DEMON) && p_ptr->lev > 44))
                {
-                       if (!p_ptr->immune_fire && (p_ptr->oppose_fire || music_singing(MUSIC_RESIST))) return (TRUE);
+                       if (!p_ptr->immune_fire && (p_ptr->oppose_fire || music_singing(p_ptr, MUSIC_RESIST))) return (TRUE);
                        if (p_ptr->special_defense & DEFENSE_FIRE) return (TRUE);
                }
        }
 
        if (r_ptr->flags4 & RF4_BR_ELEC)
        {
-               if (!p_ptr->immune_elec && (p_ptr->oppose_elec || music_singing(MUSIC_RESIST))) return (TRUE);
+               if (!p_ptr->immune_elec && (p_ptr->oppose_elec || music_singing(p_ptr, MUSIC_RESIST))) return (TRUE);
                if (p_ptr->special_defense & DEFENSE_ELEC) return (TRUE);
        }
 
        if (r_ptr->flags4 & RF4_BR_COLD)
        {
-               if (!p_ptr->immune_cold && (p_ptr->oppose_cold || music_singing(MUSIC_RESIST))) return (TRUE);
+               if (!p_ptr->immune_cold && (p_ptr->oppose_cold || music_singing(p_ptr, MUSIC_RESIST))) return (TRUE);
                if (p_ptr->special_defense & DEFENSE_COLD) return (TRUE);
        }
 
@@ -919,7 +932,7 @@ bool dispel_check(MONSTER_IDX m_idx)
        {
                if (!((p_ptr->pclass == CLASS_NINJA) && p_ptr->lev > 44))
                {
-                       if (p_ptr->oppose_pois || music_singing(MUSIC_RESIST)) return (TRUE);
+                       if (p_ptr->oppose_pois || music_singing(p_ptr, MUSIC_RESIST)) return (TRUE);
                        if (p_ptr->special_defense & DEFENSE_POIS) return (TRUE);
                }
        }
@@ -937,7 +950,6 @@ bool dispel_check(MONSTER_IDX m_idx)
        if ((p_ptr->special_attack & ATTACK_COLD) && !(r_ptr->flagsr & RFR_EFF_IM_COLD_MASK)) return (TRUE);
        if ((p_ptr->special_attack & ATTACK_POIS) && !(r_ptr->flagsr & RFR_EFF_IM_POIS_MASK)) return (TRUE);
 
-       /* Speed */
        if (p_ptr->pspeed < 145)
        {
                if (IS_FAST()) return (TRUE);
@@ -1565,7 +1577,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
        /* Remove the "ineffective" spells */
        remove_bad_spells(m_idx, &f4, &f5, &f6);
 
-       if (p_ptr->inside_arena || p_ptr->inside_battle)
+       if (p_ptr->inside_arena || p_ptr->phase_out)
        {
                f4 &= ~(RF4_SUMMON_MASK);
                f5 &= ~(RF5_SUMMON_MASK);
@@ -1686,7 +1698,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
                break;
 
        default:
-               return FALSE; /* Paranoia */
+               return FALSE;
        }
 
        /* Abort if no spell was chosen */
@@ -1702,7 +1714,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
        if (!spell_is_inate(thrown_spell)
            && (in_no_magic_dungeon || (MON_STUNNED(m_ptr) && one_in_(2)) || (randint0(100) < failrate)))
        {
-               disturb(TRUE, TRUE);
+               disturb(p_ptr, TRUE, TRUE);
                msg_format(_("%^sは呪文を唱えようとしたが失敗した。", "%^s tries to cast a spell, but fails."), m_name);
 
                return (TRUE);
@@ -1785,7 +1797,7 @@ bool make_attack_spell(MONSTER_IDX m_idx)
                        p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - 96;
                        p_ptr->mane_dam[p_ptr->mane_num] = dam;
                        p_ptr->mane_num++;
-                       new_mane = TRUE;
+                       p_ptr->new_mane = TRUE;
 
                        p_ptr->redraw |= (PR_IMITATION);
                }