add_cheat_remove_flags_others(target_ptr, msr_ptr);
}
-/*!
- * @brief モンスターの魔法一覧から戦術的に適さない魔法を除外する /
- * Remove the "bad" spells from a spell list
- * @param m_idx モンスターの構造体参照ポインタ
- * @param f4p モンスター魔法のフラグリスト1
- * @param f5p モンスター魔法のフラグリスト2
- * @param f6p モンスター魔法のフラグリスト3
- * @return なし
- */
-void remove_bad_spells(MONSTER_IDX m_idx, player_type *target_ptr, u32b *f4p, u32b *f5p, u32b *f6p)
+static void check_acid_resistance(msr_type *msr_ptr)
{
- msr_type tmp_msr;
- msr_type *msr_ptr = initialize_msr_type(target_ptr, &tmp_msr, m_idx, *f4p, *f5p, *f6p);
- if (msr_ptr->r_ptr->flags2 & RF2_STUPID)
- return;
-
- if (!smart_cheat && !smart_learn)
- return;
-
- monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
- if (smart_learn) {
- if (m_ptr->smart && (randint0(100) < 1))
- m_ptr->smart &= SM_FRIENDLY | SM_PET | SM_CLONED;
-
- msr_ptr->smart = m_ptr->smart;
- }
-
- add_cheat_remove_flags(target_ptr, msr_ptr);
- if (!msr_ptr->smart)
- return;
-
if (msr_ptr->smart & SM_IMM_ACID) {
msr_ptr->f4 &= ~(RF4_BR_ACID);
msr_ptr->f5 &= ~(RF5_BA_ACID);
msr_ptr->f5 &= ~(RF5_BO_ACID);
- } else if ((msr_ptr->smart & SM_OPP_ACID) && (msr_ptr->smart & SM_RES_ACID)) {
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_ACID) && (msr_ptr->smart & SM_RES_ACID)) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f4 &= ~(RF4_BR_ACID);
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f5 &= ~(RF5_BO_ACID);
- } else if ((msr_ptr->smart & SM_OPP_ACID) || (msr_ptr->smart & SM_RES_ACID)) {
+
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_ACID) || (msr_ptr->smart & SM_RES_ACID)) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f4 &= ~(RF4_BR_ACID);
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f5 &= ~(RF5_BO_ACID);
}
+}
+static void check_elec_resistance(msr_type *msr_ptr)
+{
if (msr_ptr->smart & SM_IMM_ELEC) {
msr_ptr->f4 &= ~(RF4_BR_ELEC);
msr_ptr->f5 &= ~(RF5_BA_ELEC);
msr_ptr->f5 &= ~(RF5_BO_ELEC);
- } else if ((msr_ptr->smart & SM_OPP_ELEC) && (msr_ptr->smart & SM_RES_ELEC)) {
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_ELEC) && (msr_ptr->smart & SM_RES_ELEC)) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f4 &= ~(RF4_BR_ELEC);
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f5 &= ~(RF5_BO_ELEC);
- } else if ((msr_ptr->smart & SM_OPP_ELEC) || (msr_ptr->smart & SM_RES_ELEC)) {
+
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_ELEC) || (msr_ptr->smart & SM_RES_ELEC)) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f4 &= ~(RF4_BR_ELEC);
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f5 &= ~(RF5_BO_ELEC);
}
+}
+static void check_fire_resistance(msr_type *msr_ptr)
+{
if (msr_ptr->smart & (SM_IMM_FIRE)) {
msr_ptr->f4 &= ~(RF4_BR_FIRE);
msr_ptr->f5 &= ~(RF5_BA_FIRE);
msr_ptr->f5 &= ~(RF5_BO_FIRE);
- } else if ((msr_ptr->smart & SM_OPP_FIRE) && (msr_ptr->smart & SM_RES_FIRE)) {
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_FIRE) && (msr_ptr->smart & SM_RES_FIRE)) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f4 &= ~(RF4_BR_FIRE);
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f5 &= ~(RF5_BO_FIRE);
- } else if ((msr_ptr->smart & SM_OPP_FIRE) || (msr_ptr->smart & SM_RES_FIRE)) {
+
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_FIRE) || (msr_ptr->smart & SM_RES_FIRE)) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f4 &= ~(RF4_BR_FIRE);
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f5 &= ~(RF5_BO_FIRE);
}
+}
+static void check_cold_resistance(msr_type *msr_ptr)
+{
if (msr_ptr->smart & (SM_IMM_COLD)) {
msr_ptr->f4 &= ~(RF4_BR_COLD);
msr_ptr->f5 &= ~(RF5_BA_COLD);
msr_ptr->f5 &= ~(RF5_BO_COLD);
msr_ptr->f5 &= ~(RF5_BO_ICEE);
- } else if ((msr_ptr->smart & SM_OPP_COLD) && (msr_ptr->smart & SM_RES_COLD)) {
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_COLD) && (msr_ptr->smart & SM_RES_COLD)) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f4 &= ~(RF4_BR_COLD);
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f5 &= ~(RF5_BO_ICEE);
- } else if ((msr_ptr->smart & SM_OPP_COLD) || (msr_ptr->smart & SM_RES_COLD)) {
+
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_COLD) || (msr_ptr->smart & SM_RES_COLD)) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f4 &= ~(RF4_BR_COLD);
if (int_outof(msr_ptr->r_ptr, 20))
msr_ptr->f5 &= ~(RF5_BO_ICEE);
}
+}
+static void check_pois_resistance(msr_type *msr_ptr)
+{
if ((msr_ptr->smart & SM_OPP_POIS) && (msr_ptr->smart & SM_RES_POIS)) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->f4 &= ~(RF4_BR_POIS);
if (int_outof(msr_ptr->r_ptr, 60))
msr_ptr->f4 &= ~(RF4_BR_NUKE);
- } else if ((msr_ptr->smart & SM_OPP_POIS) || (msr_ptr->smart & SM_RES_POIS)) {
+
+ return;
+ }
+
+ if ((msr_ptr->smart & SM_OPP_POIS) || (msr_ptr->smart & SM_RES_POIS)) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f4 &= ~(RF4_BR_POIS);
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->f5 &= ~(RF5_BA_POIS);
}
+}
+
+/*!
+ * @brief モンスターの魔法一覧から戦術的に適さない魔法を除外する /
+ * Remove the "bad" spells from a spell list
+ * @param m_idx モンスターの構造体参照ポインタ
+ * @param f4p モンスター魔法のフラグリスト1
+ * @param f5p モンスター魔法のフラグリスト2
+ * @param f6p モンスター魔法のフラグリスト3
+ * @return なし
+ */
+void remove_bad_spells(MONSTER_IDX m_idx, player_type *target_ptr, u32b *f4p, u32b *f5p, u32b *f6p)
+{
+ msr_type tmp_msr;
+ msr_type *msr_ptr = initialize_msr_type(target_ptr, &tmp_msr, m_idx, *f4p, *f5p, *f6p);
+ if (msr_ptr->r_ptr->flags2 & RF2_STUPID)
+ return;
+
+ if (!smart_cheat && !smart_learn)
+ return;
+
+ monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
+ if (smart_learn) {
+ if (m_ptr->smart && (randint0(100) < 1))
+ m_ptr->smart &= SM_FRIENDLY | SM_PET | SM_CLONED;
+
+ msr_ptr->smart = m_ptr->smart;
+ }
+
+ add_cheat_remove_flags(target_ptr, msr_ptr);
+ if (!msr_ptr->smart)
+ return;
+ check_acid_resistance(msr_ptr);
+ check_elec_resistance(msr_ptr);
+ check_fire_resistance(msr_ptr);
+ check_cold_resistance(msr_ptr);
+ check_pois_resistance(msr_ptr);
if (msr_ptr->smart & SM_RES_NETH) {
if (is_specific_player_race(target_ptr, RACE_SPECTRE)) {
msr_ptr->f4 &= ~(RF4_BR_NETH);