#include "monster-race/monster-kind-mask.h"
#include "monster-race/monster-race.h"
#include "monster-race/race-brightness-mask.h"
-#include "monster-race/race-flags1.h"
-#include "monster-race/race-flags2.h"
-#include "monster-race/race-flags3.h"
-#include "monster-race/race-flags7.h"
#include "monster-race/race-indice-types.h"
+#include "monster-race/race-misc-flags.h"
#include "monster/monster-flag-types.h"
#include "monster/monster-info.h"
#include "monster/monster-list.h"
{
const auto &monrace = monraces_info[r_idx];
bool unselectable = monrace.kind_flags.has(MonsterKindType::UNIQUE);
- unselectable |= any_bits(monrace.flags2, RF2_MULTIPLY);
+ unselectable |= monrace.misc_flags.has(MonsterMiscType::MULTIPLY);
unselectable |= monrace.behavior_flags.has(MonsterBehaviorType::FRIENDLY);
unselectable |= monrace.feature_flags.has(MonsterFeatureType::AQUATIC);
- unselectable |= any_bits(monrace.flags7, RF7_CHAMELEON);
+ unselectable |= monrace.misc_flags.has(MonsterMiscType::CHAMELEON);
unselectable |= monrace.is_explodable();
if (unselectable) {
return false;
return MonsterRaceId::ALIEN_JURAL;
}
- if (none_bits(monraces_info[r_idx].flags7, RF7_TANUKI)) {
+ if (monraces_info[r_idx].misc_flags.has_not(MonsterMiscType::TANUKI)) {
return r_idx;
}
* @param r_idx 生成モンスター種族
* @return ユニークの生成が不可能な条件ならFALSE、それ以外はTRUE
*/
-static bool check_unique_placeable(PlayerType *player_ptr, MonsterRaceId r_idx, BIT_FLAGS mode)
+static bool check_unique_placeable(const FloorType &floor, MonsterRaceId r_idx, BIT_FLAGS mode)
{
- if (AngbandSystem::get_instance().is_watching()) {
+ if (AngbandSystem::get_instance().is_phase_out()) {
return true;
}
}
auto *r_ptr = &monraces_info[r_idx];
- if ((r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || r_ptr->population_flags.has(MonsterPopulationType::NAZGUL)) && (r_ptr->cur_num >= r_ptr->max_num)) {
+ auto is_unique = r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || r_ptr->population_flags.has(MonsterPopulationType::NAZGUL);
+ is_unique &= r_ptr->cur_num >= r_ptr->max_num;
+ if (is_unique) {
return false;
}
- if (any_bits(r_ptr->flags7, RF7_UNIQUE2) && (r_ptr->cur_num >= 1)) {
+ if (r_ptr->population_flags.has(MonsterPopulationType::ONLY_ONE) && (r_ptr->cur_num >= 1)) {
return false;
}
return false;
}
- if (any_bits(r_ptr->flags1, RF1_FORCE_DEPTH) && (player_ptr->current_floor_ptr->dun_level < r_ptr->level) && (!ironman_nightmare || any_bits(r_ptr->flags1, RF1_QUESTOR))) {
- return false;
- }
-
- return true;
+ const auto is_deep = r_ptr->misc_flags.has(MonsterMiscType::FORCE_DEPTH) && (floor.dun_level < r_ptr->level);
+ const auto is_questor = !ironman_nightmare || r_ptr->misc_flags.has(MonsterMiscType::QUESTOR);
+ return !is_deep || !is_questor;
}
/*!
int number_mon = 0;
for (int i2 = 0; i2 < floor.width; ++i2) {
for (int j2 = 0; j2 < floor.height; j2++) {
- auto quest_monster = (floor.grid_array[j2][i2].m_idx > 0);
+ auto quest_monster = floor.grid_array[j2][i2].has_monster();
quest_monster &= (floor.m_list[floor.grid_array[j2][i2].m_idx].r_idx == q_ptr->r_idx);
if (quest_monster) {
number_mon++;
/*!
* @brief モンスターを一体生成する / Attempt to place a monster of the given race at the given location.
* @param player_ptr プレイヤーへの参照ポインタ
- * @param who 召喚を行ったモンスターID
+ * @param src_idx 召喚を行ったモンスターID
* @param y 生成位置y座標
* @param x 生成位置x座標
* @param r_idx 生成モンスター種族
* @param mode 生成オプション
* @return 成功したらtrue
*/
-bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX who, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
+bool place_monster_one(PlayerType *player_ptr, MONSTER_IDX src_idx, POSITION y, POSITION x, MonsterRaceId r_idx, BIT_FLAGS mode)
{
auto &floor = *player_ptr->current_floor_ptr;
auto *g_ptr = &floor.grid_array[y][x];
return false;
}
- if (!check_unique_placeable(player_ptr, r_idx, mode) || !check_quest_placeable(floor, r_idx) || !check_procection_rune(player_ptr, r_idx, y, x)) {
+ if (!check_unique_placeable(floor, r_idx, mode) || !check_quest_placeable(floor, r_idx) || !check_procection_rune(player_ptr, r_idx, y, x)) {
return false;
}
g_ptr->m_idx = m_pop(&floor);
hack_m_idx_ii = g_ptr->m_idx;
- if (!g_ptr->m_idx) {
+ if (!g_ptr->has_monster()) {
return false;
}
m_ptr->mflag.clear();
m_ptr->mflag2.clear();
- if (any_bits(mode, PM_MULTIPLY) && (who > 0) && !floor.m_list[who].is_original_ap()) {
- m_ptr->ap_r_idx = floor.m_list[who].ap_r_idx;
- if (floor.m_list[who].mflag2.has(MonsterConstantFlagType::KAGE)) {
+ if (any_bits(mode, PM_MULTIPLY) && is_monster(src_idx) && !floor.m_list[src_idx].is_original_ap()) {
+ m_ptr->ap_r_idx = floor.m_list[src_idx].ap_r_idx;
+ if (floor.m_list[src_idx].mflag2.has(MonsterConstantFlagType::KAGE)) {
m_ptr->mflag2.set(MonsterConstantFlagType::KAGE);
}
}
- if ((who > 0) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
- m_ptr->sub_align = floor.m_list[who].sub_align;
+ if (is_monster(src_idx) && r_ptr->kind_flags.has_none_of(alignment_mask)) {
+ m_ptr->sub_align = floor.m_list[src_idx].sub_align;
} else {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
if (r_ptr->kind_flags.has(MonsterKindType::EVIL)) {
m_ptr->nickname.clear();
m_ptr->exp = 0;
- if (who > 0 && floor.m_list[who].is_pet()) {
+ if (is_monster(src_idx) && floor.m_list[src_idx].is_pet()) {
set_bits(mode, PM_FORCE_PET);
- m_ptr->parent_m_idx = who;
+ m_ptr->parent_m_idx = src_idx;
} else {
m_ptr->parent_m_idx = 0;
}
- if (any_bits(r_ptr->flags7, RF7_CHAMELEON)) {
+ if (r_ptr->misc_flags.has(MonsterMiscType::CHAMELEON)) {
choose_new_monster(player_ptr, g_ptr->m_idx, true, MonsterRace::empty_id());
r_ptr = &m_ptr->get_monrace();
m_ptr->mflag2.set(MonsterConstantFlagType::CHAMELEON);
- if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (who <= 0)) {
+ if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (!is_monster(src_idx))) {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
}
} else if (any_bits(mode, PM_KAGE) && none_bits(mode, PM_FORCE_PET)) {
m_ptr->ml = false;
if (any_bits(mode, PM_FORCE_PET)) {
set_pet(player_ptr, m_ptr);
- } else if (((who == 0) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, who) || any_bits(mode, PM_FORCE_FRIENDLY)) {
+ } else if ((is_player(src_idx) && r_ptr->behavior_flags.has(MonsterBehaviorType::FRIENDLY)) || is_friendly_idx(player_ptr, src_idx) || any_bits(mode, PM_FORCE_FRIENDLY)) {
if (!monster_has_hostile_align(player_ptr, nullptr, 0, -1, r_ptr) && !player_ptr->current_floor_ptr->inside_arena) {
set_friendly(m_ptr);
}
(void)set_monster_csleep(player_ptr, g_ptr->m_idx, (val * 2) + randint1(val * 10));
}
- if (any_bits(r_ptr->flags1, RF1_FORCE_MAXHP)) {
+ if (r_ptr->misc_flags.has(MonsterMiscType::FORCE_MAXHP)) {
m_ptr->max_maxhp = maxroll(r_ptr->hdice, r_ptr->hside);
} else {
m_ptr->max_maxhp = damroll(r_ptr->hdice, r_ptr->hside);
m_ptr->get_real_monrace().floor_id = player_ptr->floor_id;
}
- if (any_bits(r_ptr->flags2, RF2_MULTIPLY)) {
+ if (r_ptr->misc_flags.has(MonsterMiscType::MULTIPLY)) {
floor.num_repro++;
}