m_ptr->mflag2[MonsterConstantFlagType::CLONED] = rd_bits_smart[22];
m_ptr->mflag2[MonsterConstantFlagType::PET] = rd_bits_smart[23];
m_ptr->mflag2[MonsterConstantFlagType::FRIENDLY] = rd_bits_smart[28];
- m_ptr->smart.reset(i2enum<SM>(22)).reset(i2enum<SM>(23)).reset(i2enum<SM>(28));
+ m_ptr->smart.reset(i2enum<MonsterSmartLearnType>(22)).reset(i2enum<MonsterSmartLearnType>(23)).reset(i2enum<MonsterSmartLearnType>(28));
if (h_older_than(0, 4, 5)) {
m_ptr->exp = 0;
this->m_ptr->mflag2[MonsterConstantFlagType::CLONED] = rd_bits[22];
this->m_ptr->mflag2[MonsterConstantFlagType::PET] = rd_bits[23];
this->m_ptr->mflag2[MonsterConstantFlagType::FRIENDLY] = rd_bits[28];
- this->m_ptr->smart.reset(i2enum<SM>(22)).reset(i2enum<SM>(23)).reset(i2enum<SM>(28));
+ this->m_ptr->smart.reset(i2enum<MonsterSmartLearnType>(22)).reset(i2enum<MonsterSmartLearnType>(23)).reset(i2enum<MonsterSmartLearnType>(28));
} else {
rd_FlagGroup(this->m_ptr->smart, rd_byte);
}
switch (what) {
case DRS_ACID:
if (has_resist_acid(player_ptr))
- m_ptr->smart.set(SM::RES_ACID);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_ACID);
if (is_oppose_acid(player_ptr))
- m_ptr->smart.set(SM::OPP_ACID);
+ m_ptr->smart.set(MonsterSmartLearnType::OPP_ACID);
if (has_immune_acid(player_ptr))
- m_ptr->smart.set(SM::IMM_ACID);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_ACID);
break;
case DRS_ELEC:
if (has_resist_elec(player_ptr))
- m_ptr->smart.set(SM::RES_ELEC);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_ELEC);
if (is_oppose_elec(player_ptr))
- m_ptr->smart.set(SM::OPP_ELEC);
+ m_ptr->smart.set(MonsterSmartLearnType::OPP_ELEC);
if (has_immune_elec(player_ptr))
- m_ptr->smart.set(SM::IMM_ELEC);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_ELEC);
break;
case DRS_FIRE:
if (has_resist_fire(player_ptr))
- m_ptr->smart.set(SM::RES_FIRE);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_FIRE);
if (is_oppose_fire(player_ptr))
- m_ptr->smart.set(SM::OPP_FIRE);
+ m_ptr->smart.set(MonsterSmartLearnType::OPP_FIRE);
if (has_immune_fire(player_ptr))
- m_ptr->smart.set(SM::IMM_FIRE);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_FIRE);
break;
case DRS_COLD:
if (has_resist_cold(player_ptr))
- m_ptr->smart.set(SM::RES_COLD);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_COLD);
if (is_oppose_cold(player_ptr))
- m_ptr->smart.set(SM::OPP_COLD);
+ m_ptr->smart.set(MonsterSmartLearnType::OPP_COLD);
if (has_immune_cold(player_ptr))
- m_ptr->smart.set(SM::IMM_COLD);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_COLD);
break;
case DRS_POIS:
if (has_resist_pois(player_ptr))
- m_ptr->smart.set(SM::RES_POIS);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_POIS);
if (is_oppose_pois(player_ptr))
- m_ptr->smart.set(SM::OPP_POIS);
+ m_ptr->smart.set(MonsterSmartLearnType::OPP_POIS);
break;
case DRS_NETH:
if (has_resist_neth(player_ptr))
- m_ptr->smart.set(SM::RES_NETH);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_NETH);
break;
case DRS_LITE:
if (has_resist_lite(player_ptr))
- m_ptr->smart.set(SM::RES_LITE);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_LITE);
break;
case DRS_DARK:
if (has_resist_dark(player_ptr))
- m_ptr->smart.set(SM::RES_DARK);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_DARK);
break;
case DRS_FEAR:
if (has_resist_fear(player_ptr))
- m_ptr->smart.set(SM::RES_FEAR);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_FEAR);
break;
case DRS_CONF:
if (has_resist_conf(player_ptr))
- m_ptr->smart.set(SM::RES_CONF);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_CONF);
break;
case DRS_CHAOS:
if (has_resist_chaos(player_ptr))
- m_ptr->smart.set(SM::RES_CHAOS);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_CHAOS);
break;
case DRS_DISEN:
if (has_resist_disen(player_ptr))
- m_ptr->smart.set(SM::RES_DISEN);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_DISEN);
break;
case DRS_BLIND:
if (has_resist_blind(player_ptr))
- m_ptr->smart.set(SM::RES_BLIND);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_BLIND);
break;
case DRS_NEXUS:
if (has_resist_nexus(player_ptr))
- m_ptr->smart.set(SM::RES_NEXUS);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_NEXUS);
break;
case DRS_SOUND:
if (has_resist_sound(player_ptr))
- m_ptr->smart.set(SM::RES_SOUND);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_SOUND);
break;
case DRS_SHARD:
if (has_resist_shard(player_ptr))
- m_ptr->smart.set(SM::RES_SHARD);
+ m_ptr->smart.set(MonsterSmartLearnType::RES_SHARD);
break;
case DRS_FREE:
if (player_ptr->free_act)
- m_ptr->smart.set(SM::IMM_FREE);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_FREE);
break;
case DRS_MANA:
if (!player_ptr->msp)
- m_ptr->smart.set(SM::IMM_MANA);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_MANA);
break;
case DRS_REFLECT:
if (has_reflect(player_ptr))
- m_ptr->smart.set(SM::IMM_REFLECT);
+ m_ptr->smart.set(MonsterSmartLearnType::IMM_REFLECT);
break;
default:
#pragma once
-enum class SM {
+enum class MonsterSmartLearnType {
RES_ACID = 0, /*!< モンスターの学習フラグ: プレイヤーに酸耐性あり */
RES_ELEC = 1, /*!< モンスターの学習フラグ: プレイヤーに電撃耐性あり */
RES_FIRE = 2, /*!< モンスターの学習フラグ: プレイヤーに火炎耐性あり */
void add_cheat_remove_flags_element(player_type *player_ptr, msr_type *msr_ptr)
{
if (has_resist_acid(player_ptr))
- msr_ptr->smart.set(SM::RES_ACID);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_ACID);
if (is_oppose_acid(player_ptr))
- msr_ptr->smart.set(SM::OPP_ACID);
+ msr_ptr->smart.set(MonsterSmartLearnType::OPP_ACID);
if (has_immune_acid(player_ptr))
- msr_ptr->smart.set(SM::IMM_ACID);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_ACID);
if (has_resist_elec(player_ptr))
- msr_ptr->smart.set(SM::RES_ELEC);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_ELEC);
if (is_oppose_elec(player_ptr))
- msr_ptr->smart.set(SM::OPP_ELEC);
+ msr_ptr->smart.set(MonsterSmartLearnType::OPP_ELEC);
if (has_immune_elec(player_ptr))
- msr_ptr->smart.set(SM::IMM_ELEC);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_ELEC);
if (has_resist_fire(player_ptr))
- msr_ptr->smart.set(SM::RES_FIRE);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_FIRE);
if (is_oppose_fire(player_ptr))
- msr_ptr->smart.set(SM::OPP_FIRE);
+ msr_ptr->smart.set(MonsterSmartLearnType::OPP_FIRE);
if (has_immune_fire(player_ptr))
- msr_ptr->smart.set(SM::IMM_FIRE);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_FIRE);
if (has_resist_cold(player_ptr))
- msr_ptr->smart.set(SM::RES_COLD);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_COLD);
if (is_oppose_cold(player_ptr))
- msr_ptr->smart.set(SM::OPP_COLD);
+ msr_ptr->smart.set(MonsterSmartLearnType::OPP_COLD);
if (has_immune_cold(player_ptr))
- msr_ptr->smart.set(SM::IMM_COLD);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_COLD);
if (has_resist_pois(player_ptr))
- msr_ptr->smart.set(SM::RES_POIS);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_POIS);
if (is_oppose_pois(player_ptr))
- msr_ptr->smart.set(SM::OPP_POIS);
+ msr_ptr->smart.set(MonsterSmartLearnType::OPP_POIS);
}
static void check_acid_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has(SM::IMM_ACID)) {
+ if (msr_ptr->smart.has(MonsterSmartLearnType::IMM_ACID)) {
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_ACID);
msr_ptr->ability_flags.reset(MonsterAbilityType::BA_ACID);
msr_ptr->ability_flags.reset(MonsterAbilityType::BO_ACID);
return;
}
- if (msr_ptr->smart.has_all_of({SM::OPP_ACID, SM::RES_ACID})) {
+ if (msr_ptr->smart.has_all_of({MonsterSmartLearnType::OPP_ACID, MonsterSmartLearnType::RES_ACID})) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_ACID);
return;
}
- if (msr_ptr->smart.has_any_of({SM::OPP_ACID, SM::RES_ACID})) {
+ if (msr_ptr->smart.has_any_of({MonsterSmartLearnType::OPP_ACID, MonsterSmartLearnType::RES_ACID})) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_ACID);
static void check_elec_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has(SM::IMM_ELEC)) {
+ if (msr_ptr->smart.has(MonsterSmartLearnType::IMM_ELEC)) {
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_ELEC);
msr_ptr->ability_flags.reset(MonsterAbilityType::BA_ELEC);
msr_ptr->ability_flags.reset(MonsterAbilityType::BO_ELEC);
return;
}
- if (msr_ptr->smart.has_all_of({SM::OPP_ELEC, SM::RES_ELEC})) {
+ if (msr_ptr->smart.has_all_of({MonsterSmartLearnType::OPP_ELEC, MonsterSmartLearnType::RES_ELEC})) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_ELEC);
return;
}
- if (msr_ptr->smart.has_any_of({SM::OPP_ELEC, SM::RES_ELEC})) {
+ if (msr_ptr->smart.has_any_of({MonsterSmartLearnType::OPP_ELEC, MonsterSmartLearnType::RES_ELEC})) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_ELEC);
static void check_fire_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has(SM::IMM_FIRE)) {
+ if (msr_ptr->smart.has(MonsterSmartLearnType::IMM_FIRE)) {
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_FIRE);
msr_ptr->ability_flags.reset(MonsterAbilityType::BA_FIRE);
msr_ptr->ability_flags.reset(MonsterAbilityType::BO_FIRE);
return;
}
- if (msr_ptr->smart.has_all_of({SM::OPP_FIRE, SM::RES_FIRE})) {
+ if (msr_ptr->smart.has_all_of({MonsterSmartLearnType::OPP_FIRE, MonsterSmartLearnType::RES_FIRE})) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_FIRE);
return;
}
- if (msr_ptr->smart.has_any_of({SM::OPP_FIRE, SM::RES_FIRE})) {
+ if (msr_ptr->smart.has_any_of({MonsterSmartLearnType::OPP_FIRE, MonsterSmartLearnType::RES_FIRE})) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_FIRE);
static void check_cold_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has(SM::IMM_COLD)) {
+ if (msr_ptr->smart.has(MonsterSmartLearnType::IMM_COLD)) {
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_COLD);
msr_ptr->ability_flags.reset(MonsterAbilityType::BA_COLD);
msr_ptr->ability_flags.reset(MonsterAbilityType::BO_COLD);
return;
}
- if (msr_ptr->smart.has_all_of({SM::OPP_COLD, SM::RES_COLD})) {
+ if (msr_ptr->smart.has_all_of({MonsterSmartLearnType::OPP_COLD, MonsterSmartLearnType::RES_COLD})) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_COLD);
return;
}
- if (msr_ptr->smart.has_any_of({SM::OPP_COLD, SM::RES_COLD})) {
+ if (msr_ptr->smart.has_any_of({MonsterSmartLearnType::OPP_COLD, MonsterSmartLearnType::RES_COLD})) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_COLD);
static void check_pois_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_all_of({SM::OPP_POIS, SM::RES_POIS})) {
+ if (msr_ptr->smart.has_all_of({MonsterSmartLearnType::OPP_POIS, MonsterSmartLearnType::RES_POIS})) {
if (int_outof(msr_ptr->r_ptr, 80))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_POIS);
return;
}
- if (msr_ptr->smart.has_any_of({SM::OPP_POIS, SM::RES_POIS})) {
+ if (msr_ptr->smart.has_any_of({MonsterSmartLearnType::OPP_POIS, MonsterSmartLearnType::RES_POIS})) {
if (int_outof(msr_ptr->r_ptr, 30))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_POIS);
void add_cheat_remove_flags_others(player_type *player_ptr, msr_type *msr_ptr)
{
if (has_resist_neth(player_ptr))
- msr_ptr->smart.set(SM::RES_NETH);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_NETH);
if (has_resist_lite(player_ptr))
- msr_ptr->smart.set(SM::RES_LITE);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_LITE);
if (has_resist_dark(player_ptr))
- msr_ptr->smart.set(SM::RES_DARK);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_DARK);
if (has_resist_fear(player_ptr))
- msr_ptr->smart.set(SM::RES_FEAR);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_FEAR);
if (has_resist_conf(player_ptr))
- msr_ptr->smart.set(SM::RES_CONF);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_CONF);
if (has_resist_chaos(player_ptr))
- msr_ptr->smart.set(SM::RES_CHAOS);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_CHAOS);
if (has_resist_disen(player_ptr))
- msr_ptr->smart.set(SM::RES_DISEN);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_DISEN);
if (has_resist_blind(player_ptr))
- msr_ptr->smart.set(SM::RES_BLIND);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_BLIND);
if (has_resist_nexus(player_ptr))
- msr_ptr->smart.set(SM::RES_NEXUS);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_NEXUS);
if (has_resist_sound(player_ptr))
- msr_ptr->smart.set(SM::RES_SOUND);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_SOUND);
if (has_resist_shard(player_ptr))
- msr_ptr->smart.set(SM::RES_SHARD);
+ msr_ptr->smart.set(MonsterSmartLearnType::RES_SHARD);
if (has_reflect(player_ptr))
- msr_ptr->smart.set(SM::IMM_REFLECT);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_REFLECT);
if (player_ptr->free_act)
- msr_ptr->smart.set(SM::IMM_FREE);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_FREE);
if (!player_ptr->msp)
- msr_ptr->smart.set(SM::IMM_MANA);
+ msr_ptr->smart.set(MonsterSmartLearnType::IMM_MANA);
}
static void check_nether_resistance(player_type *player_ptr, msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::RES_NETH))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::RES_NETH))
return;
if (PlayerRace(player_ptr).equals(PlayerRaceType::SPECTRE)) {
static void check_lite_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::RES_LITE))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::RES_LITE))
return;
if (int_outof(msr_ptr->r_ptr, 50))
static void check_dark_resistance(player_type *player_ptr, msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::RES_DARK))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::RES_DARK))
return;
if (PlayerRace(player_ptr).tr_flags().has(TR_IM_DARK)) {
static void check_conf_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::RES_CONF))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::RES_CONF))
return;
msr_ptr->ability_flags.reset(MonsterAbilityType::CONF);
static void check_chaos_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::RES_CHAOS))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::RES_CHAOS))
return;
if (int_outof(msr_ptr->r_ptr, 20))
static void check_nexus_resistance(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::RES_NEXUS))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::RES_NEXUS))
return;
if (int_outof(msr_ptr->r_ptr, 50))
static void check_reflection(msr_type *msr_ptr)
{
- if (msr_ptr->smart.has_not(SM::IMM_REFLECT))
+ if (msr_ptr->smart.has_not(MonsterSmartLearnType::IMM_REFLECT))
return;
if (int_outof(msr_ptr->r_ptr, 150))
check_nether_resistance(player_ptr, msr_ptr);
check_lite_resistance(msr_ptr);
check_dark_resistance(player_ptr, msr_ptr);
- if (msr_ptr->smart.has(SM::RES_FEAR))
+ if (msr_ptr->smart.has(MonsterSmartLearnType::RES_FEAR))
msr_ptr->ability_flags.reset(MonsterAbilityType::SCARE);
check_conf_resistance(msr_ptr);
check_chaos_resistance(msr_ptr);
- if (msr_ptr->smart.has(SM::RES_DISEN) && int_outof(msr_ptr->r_ptr, 40))
+ if (msr_ptr->smart.has(MonsterSmartLearnType::RES_DISEN) && int_outof(msr_ptr->r_ptr, 40))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_DISE);
- if (msr_ptr->smart.has(SM::RES_BLIND))
+ if (msr_ptr->smart.has(MonsterSmartLearnType::RES_BLIND))
msr_ptr->ability_flags.reset(MonsterAbilityType::BLIND);
check_nexus_resistance(msr_ptr);
- if (msr_ptr->smart.has(SM::RES_SOUND) && int_outof(msr_ptr->r_ptr, 50))
+ if (msr_ptr->smart.has(MonsterSmartLearnType::RES_SOUND) && int_outof(msr_ptr->r_ptr, 50))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_SOUN);
- if (msr_ptr->smart.has(SM::RES_SHARD) && int_outof(msr_ptr->r_ptr, 40))
+ if (msr_ptr->smart.has(MonsterSmartLearnType::RES_SHARD) && int_outof(msr_ptr->r_ptr, 40))
msr_ptr->ability_flags.reset(MonsterAbilityType::BR_SHAR);
check_reflection(msr_ptr);
- if (msr_ptr->smart.has(SM::IMM_FREE)) {
+ if (msr_ptr->smart.has(MonsterSmartLearnType::IMM_FREE)) {
msr_ptr->ability_flags.reset(MonsterAbilityType::HOLD);
msr_ptr->ability_flags.reset(MonsterAbilityType::SLOW);
}
- if (msr_ptr->smart.has(SM::IMM_MANA))
+ if (msr_ptr->smart.has(MonsterSmartLearnType::IMM_MANA))
msr_ptr->ability_flags.reset(MonsterAbilityType::DRAIN_MANA);
}
typedef struct msr_type {
monster_race *r_ptr;
EnumClassFlagGroup<MonsterAbilityType> ability_flags;
- EnumClassFlagGroup<SM> smart;
+ EnumClassFlagGroup<MonsterSmartLearnType> smart;
} msr_type;
struct player_type;
EXP exp{}; /*!< モンスターの現在所持経験値 */
/* TODO: クローン、ペット、有効化は意義が異なるので別変数に切り離すこと。save/loadのバージョン更新が面倒そうだけど */
- EnumClassFlagGroup<SM> smart{}; /*!< モンスターのプレイヤーに対する学習状態 / Field for "smart_learn" - Some bit-flags for the "smart" field */
+ EnumClassFlagGroup<MonsterSmartLearnType> smart{}; /*!< モンスターのプレイヤーに対する学習状態 / Field for "smart_learn" - Some bit-flags for the "smart" field */
MONSTER_IDX parent_m_idx{}; /*!< 召喚主のモンスターID */
} monster_type;