-/*!
+/*!
* @brief モンスター処理 / misc code for monsters
* @date 2014/07/08
* @author
#include "game-option/cheat-options.h"
#include "grid/grid.h"
#include "monster-floor/monster-summon.h"
+#include "monster-floor/place-monster-types.h"
#include "monster-race/monster-kind-mask.h"
#include "monster-race/monster-race.h"
#include "monster-race/race-brightness-mask.h"
#include "system/monster-race-info.h"
#include "system/player-type-definition.h"
#include "system/redrawing-flags-updater.h"
+#include "util/bit-flags-calculator.h"
#include "util/probability-table.h"
#include "view/display-messages.h"
#include "world/world.h"
* @return 選択されたモンスター生成種族
* @details nasty生成 (ゲーム内経過日数に応じて、現在フロアより深いフロアのモンスターを出現させる仕様)は
*/
-MonsterRaceId get_mon_num(PlayerType *player_ptr, DEPTH min_level, DEPTH max_level, BIT_FLAGS option)
+MonsterRaceId get_mon_num(PlayerType *player_ptr, DEPTH min_level, DEPTH max_level, BIT_FLAGS mode)
{
/* town max_level : same delay as 10F, no nasty mons till day18 */
auto delay = static_cast<int>(std::sqrt(max_level * 10000)) + (max_level * 5);
}
/* Boost the max_level */
- if ((option & GMN_ARENA) || dungeon.flags.has_not(DungeonFeatureType::BEGINNER)) {
+ if (any_bits(mode, PM_ARENA) || dungeon.flags.has_not(DungeonFeatureType::BEGINNER)) {
/* Nightmare mode allows more out-of depth monsters */
if (ironman_nightmare && !randint0(chance_nasty)) {
/* What a bizarre calculation */
ProbabilityTable<int> prob_table;
/* Process probabilities */
+ const auto &monraces = MonraceList::get_instance();
for (auto i = 0U; i < alloc_race_table.size(); i++) {
const auto &entry = alloc_race_table[i];
if (entry.level < min_level) {
} // sorted by depth array,
auto r_idx = i2enum<MonsterRaceId>(entry.index);
auto r_ptr = &monraces_info[r_idx];
- if (!(option & GMN_ARENA) && !chameleon_change_m_idx) {
- if ((r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || r_ptr->population_flags.has(MonsterPopulationType::NAZGUL)) && (r_ptr->cur_num >= r_ptr->max_num)) {
+ if (none_bits(mode, PM_ARENA) && !chameleon_change_m_idx) {
+ if ((r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || r_ptr->population_flags.has(MonsterPopulationType::NAZGUL)) && (r_ptr->cur_num >= r_ptr->max_num) && none_bits(mode, PM_CLONE)) {
continue;
}
- if ((r_ptr->flags7 & (RF7_UNIQUE2)) && (r_ptr->cur_num >= 1)) {
+ if (r_ptr->population_flags.has(MonsterPopulationType::ONLY_ONE) && (r_ptr->cur_num >= 1)) {
continue;
}
- if (r_idx == MonsterRaceId::BANORLUPART) {
- if (monraces_info[MonsterRaceId::BANOR].cur_num > 0) {
- continue;
- }
- if (monraces_info[MonsterRaceId::LUPART].cur_num > 0) {
- continue;
- }
+ if (!monraces.is_selectable(r_idx)) {
+ continue;
}
}
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *r_ptr = &monraces_info[r_idx];
auto *m_ptr = &floor_ptr->m_list[chameleon_change_m_idx];
- MonsterRaceInfo *old_r_ptr = &monraces_info[m_ptr->r_idx];
+ MonsterRaceInfo *old_r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has_not(MonsterKindType::UNIQUE)) {
return false;
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *r_ptr = &monraces_info[r_idx];
auto *m_ptr = &floor_ptr->m_list[chameleon_change_m_idx];
- MonsterRaceInfo *old_r_ptr = &monraces_info[m_ptr->r_idx];
+ MonsterRaceInfo *old_r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
return false;
MonsterRaceInfo *r_ptr;
bool old_unique = false;
- if (monraces_info[m_ptr->r_idx].kind_flags.has(MonsterKindType::UNIQUE)) {
+ if (m_ptr->get_monrace().kind_flags.has(MonsterKindType::UNIQUE)) {
old_unique = true;
}
if (old_unique && (r_idx == MonsterRaceId::CHAMELEON)) {
if (m_idx == player_ptr->riding) {
msg_format(_("突然%sが変身した。", "Suddenly, %s transforms!"), old_m_name.data());
- if (!(r_ptr->flags7 & RF7_RIDING)) {
+ if (r_ptr->misc_flags.has_not(MonsterMiscType::RIDING)) {
if (process_fall_off_horse(player_ptr, 0, true)) {
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
msg_print(_("地面に落とされた。", format("You have fallen from %s.", m_name.data())));
m_ptr->mspeed = get_mspeed(floor_ptr, r_ptr);
int oldmaxhp = m_ptr->max_maxhp;
- if (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);