-/*!
+/*!
* @brief モンスターをフロアに1体配置する処理
* @date 2020/06/13
* @author Hourier
#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"
#include "monster/monster-util.h"
#include "object/warning.h"
#include "player/player-status.h"
+#include "system/angband-system.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
#include "system/monster-race-info.h"
int attempts = 1000;
DEPTH min = std::min(floor_ptr->base_level - 5, 50);
while (--attempts) {
- auto ap_r_idx = get_mon_num(player_ptr, 0, floor_ptr->base_level + 10, 0);
+ auto ap_r_idx = get_mon_num(player_ptr, 0, floor_ptr->base_level + 10, PM_NONE);
if (monraces_info[ap_r_idx].level >= min) {
return ap_r_idx;
}
* @param r_idx 生成モンスター種族
* @return ユニークの生成が不可能な条件ならFALSE、それ以外はTRUE
*/
-static bool check_unique_placeable(PlayerType *player_ptr, MonsterRaceId r_idx)
+static bool check_unique_placeable(const FloorType &floor, MonsterRaceId r_idx, BIT_FLAGS mode)
{
- if (player_ptr->phase_out) {
+ 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)) {
- return false;
+ if (any_bits(mode, PM_CLONE)) {
+ return true;
}
- if (any_bits(r_ptr->flags7, RF7_UNIQUE2) && (r_ptr->cur_num >= 1)) {
+ auto *r_ptr = &monraces_info[r_idx];
+ 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 (r_idx == MonsterRaceId::BANORLUPART) {
- if (monraces_info[MonsterRaceId::BANOR].cur_num > 0) {
- return false;
- }
- if (monraces_info[MonsterRaceId::LUPART].cur_num > 0) {
- return false;
- }
+ if (r_ptr->population_flags.has(MonsterPopulationType::ONLY_ONE) && (r_ptr->cur_num >= 1)) {
+ 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))) {
+ if (!MonraceList::get_instance().is_selectable(r_idx)) {
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 || any_bits(r_ptr->flags1, RF1_QUESTOR);
+ return !is_deep || !is_questor;
}
/*!
*/
static bool check_quest_placeable(const FloorType &floor, MonsterRaceId r_idx)
{
- if (!inside_quest(quest_number(floor, floor.dun_level))) {
+ if (!inside_quest(floor.get_quest_id())) {
return true;
}
const auto &quest_list = QuestList::get_instance();
- QuestId number = quest_number(floor, floor.dun_level);
+ QuestId number = floor.get_quest_id();
const auto *q_ptr = &quest_list[number];
if ((q_ptr->type != QuestKindType::KILL_LEVEL) && (q_ptr->type != QuestKindType::RANDOM)) {
return true;
auto *r_ptr = &monraces_info[r_idx];
concptr name = r_ptr->name.data();
- if (player_ptr->wild_mode || !in_bounds(&floor, y, x) || !MonsterRace(r_idx).is_valid() || r_ptr->name.empty()) {
+ if (player_ptr->wild_mode || !in_bounds(&floor, y, x) || !MonsterRace(r_idx).is_valid()) {
return false;
}
return false;
}
- if (!check_unique_placeable(player_ptr, r_idx) || !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;
}
if (any_bits(r_ptr->flags7, RF7_CHAMELEON)) {
choose_new_monster(player_ptr, g_ptr->m_idx, true, MonsterRace::empty_id());
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
m_ptr->mflag2.set(MonsterConstantFlagType::CHAMELEON);
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (who <= 0)) {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
auto is_awake_lightning_monster = r_ptr->brightness_flags.has_any_of(self_ld_mask);
is_awake_lightning_monster |= r_ptr->brightness_flags.has_any_of(has_ld_mask) && !m_ptr->is_asleep();
if (is_awake_lightning_monster) {
- RedrawingFlagsUpdater::get_instance().set_flag(StatusRedrawingFlag::MONSTER_LITE);
+ RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
update_monster(player_ptr, g_ptr->m_idx, true);
- m_ptr->get_real_r_ref().cur_num++;
+ m_ptr->get_real_monrace().cur_num++;
/*
* Memorize location of the unique monster in saved floors.
* A unique monster move from old saved floor.
*/
if (w_ptr->character_dungeon && (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || r_ptr->population_flags.has(MonsterPopulationType::NAZGUL))) {
- m_ptr->get_real_r_ref().floor_id = player_ptr->floor_id;
+ m_ptr->get_real_monrace().floor_id = player_ptr->floor_id;
}
if (any_bits(r_ptr->flags2, RF2_MULTIPLY)) {