-#include "mspell/improper-mspell-remover.h"
+#include "mspell/improper-mspell-remover.h"
#include "game-option/birth-options.h"
#include "monster-race/monster-race.h"
-#include "monster-race/race-flags2.h"
#include "monster/smart-learn-types.h"
#include "mspell/element-resistance-checker.h"
#include "mspell/high-resistance-checker.h"
#include "mspell/smart-mspell-util.h"
#include "system/floor-type-definition.h"
-#include "system/monster-type-definition.h"
+#include "system/monster-entity.h"
+#include "system/monster-race-info.h"
+#include "system/player-type-definition.h"
-static void add_cheat_remove_flags(player_type *target_ptr, msr_type *msr_ptr)
+static void add_cheat_remove_flags(PlayerType *player_ptr, msr_type *msr_ptr)
{
- if (!smart_cheat)
+ if (!smart_cheat) {
return;
+ }
- add_cheat_remove_flags_element(target_ptr, msr_ptr);
- add_cheat_remove_flags_others(target_ptr, msr_ptr);
+ add_cheat_remove_flags_element(player_ptr, msr_ptr);
+ add_cheat_remove_flags_others(player_ptr, msr_ptr);
}
/*!
* @param f4p モンスター魔法のフラグリスト1
* @param f5p モンスター魔法のフラグリスト2
* @param f6p モンスター魔法のフラグリスト3
- * @return なし
*/
-void remove_bad_spells(MONSTER_IDX m_idx, player_type *target_ptr, EnumClassFlagGroup<RF_ABILITY> &ability_flags)
+void remove_bad_spells(MONSTER_IDX m_idx, PlayerType *player_ptr, EnumClassFlagGroup<MonsterAbilityType> &ability_flags)
{
- msr_type tmp_msr;
- msr_type *msr_ptr = initialize_msr_type(target_ptr, &tmp_msr, m_idx, ability_flags);
- if (msr_ptr->r_ptr->flags2 & RF2_STUPID)
+ msr_type tmp_msr(player_ptr, m_idx, ability_flags);
+ auto *msr_ptr = &tmp_msr;
+ if (msr_ptr->r_ptr->behavior_flags.has(MonsterBehaviorType::STUPID)) {
return;
+ }
- if (!smart_cheat && !smart_learn)
+ if (!smart_cheat && !smart_learn) {
return;
+ }
- monster_type *m_ptr = &target_ptr->current_floor_ptr->m_list[m_idx];
+ auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
if (smart_learn) {
/* 時々学習情報を忘れる */
- if (randint0(100) < 1)
+ if (randint0(100) < 1) {
m_ptr->smart.clear();
+ }
- msr_ptr->smart = m_ptr->smart;
+ msr_ptr->smart_flags = m_ptr->smart;
}
- add_cheat_remove_flags(target_ptr, msr_ptr);
- if (msr_ptr->smart.none())
+ add_cheat_remove_flags(player_ptr, msr_ptr);
+ if (msr_ptr->smart_flags.none()) {
return;
+ }
check_element_resistance(msr_ptr);
- check_high_resistances(target_ptr, msr_ptr);
+ check_high_resistances(player_ptr, msr_ptr);
ability_flags = msr_ptr->ability_flags;
}