OSDN Git Service

[Refactor] #38997 spell_learnable() にfloor_type * 引数を追加 / Added floor_type * argument...
authorHourier <hourier@users.sourceforge.jp>
Sat, 11 Jan 2020 06:16:01 +0000 (15:16 +0900)
committerHourier <hourier@users.sourceforge.jp>
Sat, 11 Jan 2020 06:16:01 +0000 (15:16 +0900)
src/monster-spell.h
src/mspells1.c
src/mspells4.c

index 1eaee00..52d5347 100644 (file)
@@ -326,7 +326,7 @@ extern void learn_spell(player_type *learner_ptr, int monspell);
 extern void set_rf_masks(BIT_FLAGS *f4, BIT_FLAGS *f5, BIT_FLAGS *f6, BIT_FLAGS mode);
 
 /* mspells4.c */
-extern bool spell_learnable(MONSTER_IDX m_idx);
+extern bool spell_learnable(player_type *target_ptr, MONSTER_IDX m_idx);
 extern HIT_POINT monspell_to_player(int SPELL_NUM, player_type *target_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx);
 extern HIT_POINT monspell_to_monster(player_type *target_ptr, int SPELL_NUM, POSITION y, POSITION x, MONSTER_IDX m_idx, MONSTER_IDX t_idx);
 extern HIT_POINT monspell_damage(int SPELL_NUM, MONSTER_IDX m_idx, int TYPE);
index 5803912..de366e8 100644 (file)
@@ -531,7 +531,7 @@ void bolt(player_type *target_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, EF
 
        /* Target the player with a bolt attack */
        if (typ != GF_ARROW) flg |= PROJECT_REFLECTABLE;
-       bool learnable = spell_learnable(m_idx);
+       bool learnable = spell_learnable(target_ptr, m_idx);
        (void)project(target_ptr, m_idx, 0, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
 }
 
@@ -562,7 +562,7 @@ void beam(player_type *target_ptr, MONSTER_IDX m_idx, POSITION y, POSITION x, EF
     }
 
        /* Target the player with a bolt attack */
-       bool learnable = spell_learnable(m_idx);
+       bool learnable = spell_learnable(target_ptr, m_idx);
        (void)project(target_ptr, m_idx, 0, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
 }
 
@@ -621,7 +621,7 @@ void breath(player_type *target_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx,
        }
 
        /* Target the player with a ball attack */
-       bool learnable = spell_learnable(m_idx);
+       bool learnable = spell_learnable(target_ptr, m_idx);
        (void)project(target_ptr, m_idx, rad, y, x, dam_hp, typ, flg, (learnable ? monspell : -1));
 }
 
index 6f31130..fb3684b 100644 (file)
@@ -61,13 +61,13 @@ bool see_monster(floor_type *floor_ptr, MONSTER_IDX m_idx)
 * @param m_idx モンスターID
 * @return プレイヤーが青魔法で学習できるならTRUE、そうでなければFALSEを返す。
 */
-bool spell_learnable(MONSTER_IDX m_idx)
+bool spell_learnable(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];
        /* Extract the "see-able-ness" */
-       bool seen = (!p_ptr->blind && m_ptr->ml);
+       bool seen = (!target_ptr->blind && m_ptr->ml);
 
-       bool maneable = player_has_los_bold(p_ptr, m_ptr->fy, m_ptr->fx);
+       bool maneable = player_has_los_bold(target_ptr, m_ptr->fy, m_ptr->fx);
        return (seen && maneable && !current_world_ptr->timewalk_m_idx);
 }