OSDN Git Service

[Refactor] #38997 magic_barrier() に player_type * 引数を追加. / Add player_type * argument...
authordeskull <deskull@users.sourceforge.jp>
Tue, 24 Dec 2019 08:39:14 +0000 (17:39 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Tue, 24 Dec 2019 08:39:14 +0000 (17:39 +0900)
src/mspells1.c
src/mspells2.c
src/realm-hex.c
src/realm-hex.h

index d736b40..ef6a391 100644 (file)
@@ -1721,7 +1721,7 @@ bool make_attack_spell(MONSTER_IDX m_idx, player_type *target_ptr)
        }
 
        /* Hex: Anti Magic Barrier */
-       if (!spell_is_inate(thrown_spell) && magic_barrier(m_idx))
+       if (!spell_is_inate(thrown_spell) && magic_barrier(p_ptr, m_idx))
        {
                msg_format(_("反魔法バリアが%^sの呪文をかき消した。", "Anti magic barrier cancels the spell which %^s casts."), m_name);
                return (TRUE);
index 4f1e3bc..3259cc0 100644 (file)
@@ -701,7 +701,7 @@ bool monst_spell_monst(MONSTER_IDX m_idx)
        }
 
        /* Hex: Anti Magic Barrier */
-       if (!spell_is_inate(thrown_spell) && magic_barrier(m_idx))
+       if (!spell_is_inate(thrown_spell) && magic_barrier(p_ptr, m_idx))
        {
                if (see_m) msg_format(_("反魔法バリアが%^sの呪文をかき消した。", 
                                            "Anti magic barrier cancels the spell which %^s casts."), m_name);
index f63041a..bc18f06 100644 (file)
@@ -306,13 +306,13 @@ bool teleport_barrier(MONSTER_IDX m_idx)
  * @param m_idx 判定の対象となるモンスターID
  * @return 反魔法の効果が適用されるならTRUEを返す
  */
-bool magic_barrier(MONSTER_IDX m_idx)
+bool magic_barrier(player_type *target_ptr, MONSTER_IDX m_idx)
 {
-       monster_type *m_ptr = &p_ptr->current_floor_ptr->m_list[m_idx];
+       monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
 
        if (!hex_spelling(HEX_ANTI_MAGIC)) return FALSE;
-       if ((p_ptr->lev * 3 / 2) < randint1(r_ptr->level)) return FALSE;
+       if ((target_ptr->lev * 3 / 2) < randint1(r_ptr->level)) return FALSE;
 
        return TRUE;
 }
index 0261182..ddf0d22 100644 (file)
@@ -56,7 +56,7 @@ extern bool hex_spell_fully(player_type *caster_ptr);
 extern void revenge_spell(player_type *caster_ptr);
 extern void revenge_store(HIT_POINT dam);
 extern bool teleport_barrier(MONSTER_IDX m_idx);
-extern bool magic_barrier(MONSTER_IDX m_idx);
+extern bool magic_barrier(player_type *target_ptr, MONSTER_IDX m_idx);
 extern bool multiply_barrier(MONSTER_IDX m_idx);
 extern concptr do_hex_spell(player_type *caster_ptr, SPELL_IDX spell, BIT_FLAGS mode);