OSDN Git Service

[Refactor] #38844 pet_t_m_idx, riding_t_m_idx を player_type 構造体に移動.
[hengband/hengband.git] / src / mspells2.c
index 0d4fe37..e71647b 100644 (file)
  */
 
 #include "angband.h"
+#include "util.h"
+
+#include "cmd-pet.h"
+#include "floor.h"
+#include "grid.h"
 #include "quest.h"
 #include "realm-hex.h"
 #include "player-move.h"
+#include "player-class.h"
 #include "monster.h"
 #include "monster-status.h"
 #include "monster-spell.h"
+#include "spells.h"
+#include "dungeon.h"
+#include "world.h"
+#include "view-mainwindow.h"
 
 /*!
  * @brief モンスターが敵対モンスターにビームを当てること可能かを判定する /
@@ -303,9 +313,9 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
        f6 = r_ptr->a_ability_flags2;
 
        /* Target is given for pet? */
-       if (pet_t_m_idx && pet)
+       if (p_ptr->pet_t_m_idx && pet)
        {
-               target_idx = pet_t_m_idx;
+               target_idx = p_ptr->pet_t_m_idx;
                t_ptr = &current_floor_ptr->m_list[target_idx];
 
                /* Cancel if not projectable (for now) */
@@ -326,7 +336,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
 
                        /* Cancel if neither enemy nor a given target */
                        if ((m_idx == target_idx) ||
-                           ((target_idx != pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
+                           ((target_idx != p_ptr->pet_t_m_idx) && !are_enemies(m_ptr, t_ptr)))
                        {
                                target_idx = 0;
                        }
@@ -348,15 +358,15 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
 
                if (p_ptr->inside_battle)
                {
-                       start = randint1(m_max-1) + m_max;
+                       start = randint1(current_floor_ptr->m_max-1) + current_floor_ptr->m_max;
                        if (randint0(2)) plus = -1;
                }
-               else start = m_max + 1;
+               else start = current_floor_ptr->m_max + 1;
 
                /* Scan thru all monsters */
-               for (i = start; ((i < start + m_max) && (i > start - m_max)); i += plus)
+               for (i = start; ((i < start + current_floor_ptr->m_max) && (i > start - current_floor_ptr->m_max)); i += plus)
                {
-                       MONSTER_IDX dummy = (i % m_max);
+                       MONSTER_IDX dummy = (i % current_floor_ptr->m_max);
                        if (!dummy) continue;
 
                        target_idx = dummy;
@@ -721,7 +731,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
                        p_ptr->mane_spell[p_ptr->mane_num] = thrown_spell - RF4_SPELL_START;
                        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);
                }