<?xml version="1.0" encoding="utf-8"?>\r
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
- <Import Project="..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.props')" />\r
+ <Import Project="..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.props" Condition="Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.props')" />\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<ClCompile Include="..\..\src\mspell\summon-checker.cpp" />\r
<ClCompile Include="..\..\src\object-enchant\activation-info-table.cpp" />\r
<ClCompile Include="..\..\src\object-enchant\dragon-breaths-table.cpp" />\r
- <ClCompile Include="..\..\src\object\object-flags.cpp" />\r
<ClCompile Include="..\..\src\perception\identification.cpp" />\r
<ClCompile Include="..\..\src\player-attack\attack-chaos-effect.cpp" />\r
<ClCompile Include="..\..\src\combat\attack-criticality.cpp" />\r
<ClInclude Include="..\..\src\object-enchant\dragon-breaths-table.h" />\r
<ClInclude Include="..\..\src\artifact\random-art-bias-types.h" />\r
<ClInclude Include="..\..\src\object-enchant\trg-types.h" />\r
- <ClInclude Include="..\..\src\object\object-flags.h" />\r
<ClInclude Include="..\..\src\perception\identification.h" />\r
<ClInclude Include="..\..\src\player-attack\attack-chaos-effect.h" />\r
<ClInclude Include="..\..\src\combat\attack-criticality.h" />\r
</ItemGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
- <Import Project="..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.targets" Condition="Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.targets')" />\r
+ <Import Project="..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.targets" Condition="Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.targets')" />\r
</ImportGroup>\r
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">\r
<PropertyGroup>\r
<ErrorText>このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。</ErrorText>\r
</PropertyGroup>\r
- <Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.props'))" />\r
- <Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.3\build\Microsoft.CodeAnalysis.NetAnalyzers.targets'))" />\r
+ <Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.props'))" />\r
+ <Error Condition="!Exists('..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeAnalysis.NetAnalyzers.7.0.4\build\Microsoft.CodeAnalysis.NetAnalyzers.targets'))" />\r
</Target>\r
</Project>
\ No newline at end of file
<ClCompile Include="..\..\src\core\visuals-reseter.cpp">\r
<Filter>core</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\..\src\object\object-flags.cpp">\r
- <Filter>object</Filter>\r
- </ClCompile>\r
<ClCompile Include="..\..\src\object\object-info.cpp">\r
<Filter>object</Filter>\r
</ClCompile>\r
<ClInclude Include="..\..\src\object-enchant\trg-types.h">\r
<Filter>object-enchant</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\..\src\object\object-flags.h">\r
- <Filter>object</Filter>\r
- </ClInclude>\r
<ClInclude Include="..\..\src\object\object-info.h">\r
<Filter>object</Filter>\r
</ClInclude>\r
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.CodeAnalysis.NetAnalyzers" version="7.0.3" targetFramework="native" developmentDependency="true" />
+ <package id="Microsoft.CodeAnalysis.NetAnalyzers" version="7.0.4" targetFramework="native" developmentDependency="true" />
</packages>
\ No newline at end of file
\
object/item-tester-hooker.cpp object/item-tester-hooker.h \
object/object-broken.cpp object/object-broken.h \
- object/object-flags.cpp object/object-flags.h \
object/object-index-list.cpp object/object-index-list.h \
object/object-info.cpp object/object-info.h \
object/object-kind-hook.cpp object/object-kind-hook.h \
bool can_move = true;
bool do_past = false;
if (g_ptr->m_idx && (m_ptr->ml || p_can_enter || p_can_kill_walls)) {
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto effects = player_ptr->effects();
auto is_stunned = effects->stun()->is_stunned();
auto can_cast = !effects->confusion()->is_confused();
}
auto &monster = floor.m_list[grid.m_idx];
- const auto &monrace = monraces_info[monster.r_idx];
+ const auto &monrace = monster.get_monrace();
auto can_banish = monrace.kind_flags.has(MonsterKindType::EVIL);
can_banish &= none_bits(monrace.flags1, RF1_QUESTOR);
can_banish &= monrace.kind_flags.has_not(MonsterKindType::UNIQUE);
#include "io/files-util.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "system/item-entity.h"
#include "system/player-type-definition.h"
/*対邪平均ダメージの計算処理*/
static int calc_arm_avgdamage(PlayerType *player_ptr, ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
int base, forced, vorpal;
int s_evil = forced = vorpal = 0;
int dam = base = (o_ptr->dd * o_ptr->ds + o_ptr->dd) / 2;
bool has_extreme_damage_rate(PlayerType *player_ptr, ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has(TR_VAMPIRIC)) {
if (flags.has(TR_BLOWS) && (o_ptr->pval == 1) && (calc_arm_avgdamage(player_ptr, o_ptr) > 52)) {
return true;
#include "object-enchant/tr-types.h"
#include "object-hook/hook-armor.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "object/object-kind-hook.h"
#include "object/object-value-calc.h"
#include "object/tval-types.h"
static bool weakening_artifact(ItemEntity *o_ptr)
{
const auto &baseitem = o_ptr->get_baseitem();
- auto flags = object_flags(o_ptr);
-
- if (flags.has(TR_KILL_EVIL)) {
+ if (o_ptr->get_flags().has(TR_KILL_EVIL)) {
o_ptr->art_flags.reset(TR_KILL_EVIL);
o_ptr->art_flags.set(TR_SLAY_EVIL);
return true;
*/
void autopick_load_pref(PlayerType *player_ptr, bool disp_mes)
{
- GAME_TEXT buf[80];
init_autopick();
- angband_strcpy(buf, pickpref_filename(player_ptr, PT_WITH_PNAME), sizeof(buf));
- errr err = process_autopick_file(player_ptr, buf);
- if (err == 0 && disp_mes) {
- msg_format(_("%sを読み込みました。", "Loaded '%s'."), buf);
- }
- if (err < 0) {
- angband_strcpy(buf, pickpref_filename(player_ptr, PT_DEFAULT), sizeof(buf));
- err = process_autopick_file(player_ptr, buf);
- if (err == 0 && disp_mes) {
- msg_format(_("%sを読み込みました。", "Loaded '%s'."), buf);
+ const auto path = search_pickpref_path(player_ptr);
+ if (!path.empty()) {
+ const auto pickpref_filename = path.filename().string();
+ if (process_autopick_file(player_ptr, pickpref_filename) == 0) {
+ if (disp_mes) {
+ msg_format(_("%sを読み込みました。", "Loaded '%s'."), pickpref_filename.data());
+ }
+ return;
}
}
- if (err && disp_mes) {
+ if (disp_mes) {
msg_print(_("自動拾い設定ファイルの読み込みに失敗しました。", "Failed to reload autopick preference."));
}
}
/*!
+ * @brief 自動拾い設定ファイルのパスを返す
+ *
+ * ユーザディレクトリを "picktype-プレイヤー名.prf"、"picktype.prf" の順にファイルが存在するかどうかを確認し、
+ * 存在した場合はそのパスを返す。どちらも存在しない場合は空のパスを返す。
+ *
+ * @return 見つかった自動拾い設定ファイルのパス。見つからなかった場合は空のパス。
+ */
+std::filesystem::path search_pickpref_path(PlayerType *player_ptr)
+{
+ for (const auto filename_mode : { PT_WITH_PNAME, PT_DEFAULT }) {
+ const auto filename = pickpref_filename(player_ptr, filename_mode);
+ const auto path = path_build(ANGBAND_DIR_USER, filename);
+ if (std::filesystem::exists(path)) {
+ return path;
+ }
+ }
+
+ return {};
+}
+
+/*!
* @brief Get file name for autopick preference
*/
std::string pickpref_filename(PlayerType *player_ptr, int filename_mode)
#pragma once
#include "system/angband.h"
+#include <filesystem>
#include <string>
#include <string_view>
#include <vector>
class PlayerType;
void autopick_load_pref(PlayerType *player_ptr, bool disp_mes);
+std::filesystem::path search_pickpref_path(PlayerType *player_ptr);
std::vector<concptr> read_pickpref_text_lines(PlayerType *player_ptr, int *filename_mode_p);
bool write_text_lines(std::string_view filename, const std::vector<concptr> &lines);
std::string pickpref_filename(PlayerType *player_ptr, int filename_mode);
*/
static bool clear_auto_register(PlayerType *player_ptr)
{
- auto path_pref = path_build(ANGBAND_DIR_USER, pickpref_filename(player_ptr, PT_WITH_PNAME));
- auto *pref_fff = angband_fopen(path_pref, FileOpenMode::READ);
- if (!pref_fff) {
- path_pref = path_build(ANGBAND_DIR_USER, pickpref_filename(player_ptr, PT_DEFAULT));
- pref_fff = angband_fopen(path_pref, FileOpenMode::READ);
+ const auto path_pref = search_pickpref_path(player_ptr);
+ if (path_pref.empty()) {
+ return true;
}
-
+ auto *pref_fff = angband_fopen(path_pref, FileOpenMode::READ);
if (!pref_fff) {
return true;
}
}
}
- const auto path_pref = path_build(ANGBAND_DIR_USER, pickpref_filename(player_ptr, PT_WITH_PNAME));
- auto *pref_fff = angband_fopen(path_pref, FileOpenMode::READ);
- if (!pref_fff) {
- path_build(ANGBAND_DIR_USER, pickpref_filename(player_ptr, PT_DEFAULT));
- pref_fff = angband_fopen(path_pref, FileOpenMode::READ);
- }
+ const auto path_pref = search_pickpref_path(player_ptr);
+ auto *pref_fff = !path_pref.empty() ? angband_fopen(path_pref, FileOpenMode::READ) : nullptr;
if (pref_fff) {
while (true) {
{
this->change_virtue_non_beginner();
this->change_virtue_unique();
- const auto &r_ref = this->m_ptr->get_real_r_ref();
+ const auto &r_ref = this->m_ptr->get_real_monrace();
if (m_ptr->r_idx == MonsterRaceId::BEGGAR || m_ptr->r_idx == MonsterRaceId::LEPER) {
chg_virtue(this->player_ptr, Virtue::COMPASSION, -1);
}
void AvatarChanger::change_virtue_non_beginner()
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (floor_ptr->get_dungeon_definition().flags.has(DungeonFeatureType::BEGINNER)) {
return;
}
*/
void AvatarChanger::change_virtue_unique()
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has_not(MonsterKindType::UNIQUE)) {
return;
}
void AvatarChanger::change_virtue_good_evil()
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has(MonsterKindType::GOOD) && ((r_ptr->level) / 10 + (3 * floor_ptr->dun_level) >= randint1(100))) {
chg_virtue(this->player_ptr, Virtue::UNLIFE, 1);
}
void AvatarChanger::change_virtue_revenge()
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->r_deaths == 0) {
return;
}
void AvatarChanger::change_virtue_wild_thief()
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto innocent = true;
auto thief = false;
for (const auto &blow : r_ptr->blows) {
*/
void AvatarChanger::change_virtue_good_animal()
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto magic_ability_flags = r_ptr->ability_flags;
magic_ability_flags.reset(RF_ABILITY_NOMAGIC_MASK);
if (r_ptr->kind_flags.has_not(MonsterKindType::ANIMAL) || r_ptr->kind_flags.has(MonsterKindType::EVIL) || magic_ability_flags.any()) {
}
m_ptr = &floor_ptr->m_list[floor_ptr->grid_array[target_row][target_col].m_idx];
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
auto m_name = monster_desc(player_ptr, m_ptr, 0);
if (r_ptr->resistance_flags.has_not(MonsterResistanceType::RESIST_TELEPORT)) {
return m_name;
{
WEIGHT n_weight = 0;
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
int dice_num, dice_side;
concptr atk_desc;
auto &floor = *player_ptr->current_floor_ptr;
auto *g_ptr = &floor.grid_array[y][x];
auto *m_ptr = &floor.m_list[g_ptr->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
const auto mutation_attack_methods = {
PlayerMutationType::HORNS,
const auto &grid = floor_ptr->grid_array[target_row][target_col];
auto *m_ptr = &floor_ptr->m_list[grid.m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
if (r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_TELEPORT)) {
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE) || r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL)) {
msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
return false;
}
- if (!(monraces_info[m_ptr->r_idx].flags7 & RF7_RIDING)) {
+ if (!(m_ptr->get_monrace().flags7 & RF7_RIDING)) {
msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
return false;
}
return false;
}
- if (monraces_info[m_ptr->r_idx].level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
+ if (m_ptr->get_monrace().level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
msg_print(_("うまく乗れなかった。", "You failed to ride."));
PlayerEnergy(player_ptr).set_player_turn_energy(100);
return false;
return;
}
- if (monraces_info[m_ptr->r_idx].kind_flags.has(MonsterKindType::UNIQUE)) {
+ if (m_ptr->get_monrace().kind_flags.has(MonsterKindType::UNIQUE)) {
msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
return;
}
{ { _("南西", " southwest of"), _("南", " south of"), _("南東", " southeast of") } },
} };
POSITION y1, x1;
- const auto [wid, hgt] = get_screen_size();
+ const auto &[wid, hgt] = get_screen_size();
POSITION y2 = y1 = panel_row_min;
POSITION x2 = x1 = panel_col_min;
constexpr auto fmt = _("マップ位置 [%d(%02d),%d(%02d)] (プレイヤーの%s) 方向?", "Map sector [%d(%02d),%d(%02d)], which is%s your sector. Direction?");
#include "object-hook/hook-weapon.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "object/object-mark-types.h"
#include "perception/object-perception.h"
return;
}
- auto should_curse = object_flags(o_ptr).has(TR_PERSISTENT_CURSE) || o_ptr->curse_flags.has(CurseTraitType::PERSISTENT_CURSE);
+ auto should_curse = o_ptr->get_flags().has(TR_PERSISTENT_CURSE) || o_ptr->curse_flags.has(CurseTraitType::PERSISTENT_CURSE);
should_curse &= o_ptr->curse_flags.has_not(CurseTraitType::HEAVY_CURSE);
if (!should_curse) {
return;
#include "object-hook/hook-expendable.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-info/samurai-data-type.h"
#include "player-status/player-energy.h"
return;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
PlayerEnergy(player_ptr).set_player_turn_energy(50);
j_ptr = &player_ptr->inventory_list[INVEN_LITE];
- auto flags2 = object_flags(j_ptr);
+ const auto flags2 = j_ptr->get_flags();
j_ptr->fuel += o_ptr->fuel;
msg_print(_("ランプに油を注いだ。", "You fuel your lamp."));
if (flags.has(TR_DARK_SOURCE) && (j_ptr->fuel > 0)) {
return;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
PlayerEnergy(player_ptr).set_player_turn_energy(50);
j_ptr = &player_ptr->inventory_list[INVEN_LITE];
- auto flags2 = object_flags(j_ptr);
+ const auto flags2 = j_ptr->get_flags();
j_ptr->fuel += o_ptr->fuel + 5;
msg_print(_("松明を結合した。", "You combine the torches."));
if (flags.has(TR_DARK_SOURCE) && (j_ptr->fuel > 0)) {
{
bool success_hit = false;
auto *o_ptr = &player_ptr->inventory_list[enum2i(INVEN_MAIN_HAND) + pa_ptr->hand];
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((o_ptr->bi_key == BaseitemKey(ItemKindType::SWORD, SV_POISON_NEEDLE)) || (pa_ptr->mode == HISSATSU_KYUSHO)) {
int n = 1;
*/
static void ninja_critical(PlayerType *player_ptr, player_attack_type *pa_ptr)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
int maxhp = pa_ptr->m_ptr->maxhp;
if (one_in_(pa_ptr->backstab ? 13 : (pa_ptr->stab_fleeing || pa_ptr->surprise_attack) ? 15
: 27)) {
void critical_attack(PlayerType *player_ptr, player_attack_type *pa_ptr)
{
auto *o_ptr = &player_ptr->inventory_list[enum2i(INVEN_MAIN_HAND) + pa_ptr->hand];
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((o_ptr->bi_key == BaseitemKey(ItemKindType::SWORD, SV_POISON_NEEDLE)) || (pa_ptr->mode == HISSATSU_KYUSHO)) {
if ((randint1(randint1(r_ptr->level / 7) + 5) == 1) && r_ptr->kind_flags.has_not(MonsterKindType::UNIQUE) && !(r_ptr->flags7 & RF7_UNIQUE2)) {
pa_ptr->attack_damage = pa_ptr->m_ptr->hp + 1;
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (r_ptr->resistance_flags.has_any_of(RFR_EFF_IM_FIRE_MASK)) {
if (is_original_ap_and_seen(player_ptr, monap_ptr->m_ptr)) {
r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_IM_FIRE_MASK);
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (r_ptr->resistance_flags.has_any_of(RFR_EFF_IM_ELEC_MASK)) {
if (is_original_ap_and_seen(player_ptr, monap_ptr->m_ptr)) {
r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_IM_ELEC_MASK);
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (r_ptr->resistance_flags.has_any_of(RFR_EFF_IM_COLD_MASK)) {
if (is_original_ap_and_seen(player_ptr, monap_ptr->m_ptr)) {
r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_IM_COLD_MASK);
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (r_ptr->resistance_flags.has_any_of(RFR_EFF_RESIST_SHARDS_MASK)) {
if (is_original_ap_and_seen(player_ptr, monap_ptr->m_ptr)) {
r_ptr->r_resistance_flags.set(r_ptr->resistance_flags & RFR_EFF_RESIST_SHARDS_MASK);
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (r_ptr->kind_flags.has_not(MonsterKindType::EVIL)) {
return;
}
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL)) {
if (is_original_ap_and_seen(player_ptr, monap_ptr->m_ptr)) {
r_ptr->r_resistance_flags.set(MonsterResistanceType::RESIST_ALL);
int dam = 1;
ItemEntity *o_armed_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND];
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
const EnumClassFlagGroup<MonsterResistanceType> resist_flags = { MonsterResistanceType::RESIST_ALL, MonsterResistanceType::RESIST_DARK };
if (r_ptr->resistance_flags.has_any_of(resist_flags)) {
#include "monster/monster-status.h"
#include "monster/monster-update.h"
#include "object/object-broken.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "object/object-mark-types.h"
#include "player-base/player-class.h"
AttributeFlags attribute_flags{};
attribute_flags.set(AttributeType::PLAYER_SHOOT);
- TrFlags flags{};
- auto arrow_flags = object_flags(arrow_ptr);
- auto bow_flags = object_flags(bow_ptr);
-
- flags = bow_flags | arrow_flags;
+ const auto arrow_flags = arrow_ptr->get_flags();
+ const auto bow_flags = bow_ptr->get_flags();
+ const auto flags = bow_flags | arrow_flags;
static const struct snipe_convert_table_t {
SPELL_IDX snipe_type;
{
MULTIPLY mult = 10;
- MonsterRaceInfo *race_ptr = &monraces_info[monster_ptr->r_idx];
-
- TrFlags flags{};
- auto arrow_flags = object_flags(arrow_ptr);
- auto bow_flags = object_flags(bow_ptr);
+ auto &monrace = monster_ptr->get_monrace();
- flags = bow_flags | arrow_flags;
+ const auto arrow_flags = arrow_ptr->get_flags();
+ const auto bow_flags = bow_ptr->get_flags();
+ const auto flags = bow_flags | arrow_flags;
/* Some "weapons" and "ammo" do extra damage */
switch (arrow_ptr->bi_key.tval()) {
case ItemKindType::SHOT:
case ItemKindType::ARROW:
case ItemKindType::BOLT: {
- if ((flags.has(TR_SLAY_ANIMAL)) && race_ptr->kind_flags.has(MonsterKindType::ANIMAL)) {
+ if ((flags.has(TR_SLAY_ANIMAL)) && monrace.kind_flags.has(MonsterKindType::ANIMAL)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::ANIMAL);
+ monrace.r_kind_flags.set(MonsterKindType::ANIMAL);
}
if (mult < 17) {
mult = 17;
}
}
- if ((flags.has(TR_KILL_ANIMAL)) && race_ptr->kind_flags.has(MonsterKindType::ANIMAL)) {
+ if ((flags.has(TR_KILL_ANIMAL)) && monrace.kind_flags.has(MonsterKindType::ANIMAL)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::ANIMAL);
+ monrace.r_kind_flags.set(MonsterKindType::ANIMAL);
}
if (mult < 27) {
mult = 27;
}
}
- if ((flags.has(TR_SLAY_EVIL)) && race_ptr->kind_flags.has(MonsterKindType::EVIL)) {
+ if ((flags.has(TR_SLAY_EVIL)) && monrace.kind_flags.has(MonsterKindType::EVIL)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::EVIL);
+ monrace.r_kind_flags.set(MonsterKindType::EVIL);
}
if (mult < 15) {
mult = 15;
}
}
- if ((flags.has(TR_KILL_EVIL)) && race_ptr->kind_flags.has(MonsterKindType::EVIL)) {
+ if ((flags.has(TR_KILL_EVIL)) && monrace.kind_flags.has(MonsterKindType::EVIL)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::EVIL);
+ monrace.r_kind_flags.set(MonsterKindType::EVIL);
}
if (mult < 25) {
mult = 25;
}
}
- if ((flags.has(TR_SLAY_GOOD)) && race_ptr->kind_flags.has(MonsterKindType::GOOD)) {
+ if ((flags.has(TR_SLAY_GOOD)) && monrace.kind_flags.has(MonsterKindType::GOOD)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::GOOD);
+ monrace.r_kind_flags.set(MonsterKindType::GOOD);
}
if (mult < 15) {
mult = 15;
}
}
- if ((flags.has(TR_KILL_GOOD)) && race_ptr->kind_flags.has(MonsterKindType::GOOD)) {
+ if ((flags.has(TR_KILL_GOOD)) && monrace.kind_flags.has(MonsterKindType::GOOD)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::GOOD);
+ monrace.r_kind_flags.set(MonsterKindType::GOOD);
}
if (mult < 25) {
mult = 25;
}
}
- if ((flags.has(TR_SLAY_HUMAN)) && race_ptr->kind_flags.has(MonsterKindType::HUMAN)) {
+ if ((flags.has(TR_SLAY_HUMAN)) && monrace.kind_flags.has(MonsterKindType::HUMAN)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::HUMAN);
+ monrace.r_kind_flags.set(MonsterKindType::HUMAN);
}
if (mult < 17) {
mult = 17;
}
}
- if ((flags.has(TR_KILL_HUMAN)) && race_ptr->kind_flags.has(MonsterKindType::HUMAN)) {
+ if ((flags.has(TR_KILL_HUMAN)) && monrace.kind_flags.has(MonsterKindType::HUMAN)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::HUMAN);
+ monrace.r_kind_flags.set(MonsterKindType::HUMAN);
}
if (mult < 27) {
mult = 27;
}
}
- if ((flags.has(TR_SLAY_UNDEAD)) && race_ptr->kind_flags.has(MonsterKindType::UNDEAD)) {
+ if ((flags.has(TR_SLAY_UNDEAD)) && monrace.kind_flags.has(MonsterKindType::UNDEAD)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::UNDEAD);
+ monrace.r_kind_flags.set(MonsterKindType::UNDEAD);
}
if (mult < 20) {
mult = 20;
}
}
- if ((flags.has(TR_KILL_UNDEAD)) && race_ptr->kind_flags.has(MonsterKindType::UNDEAD)) {
+ if ((flags.has(TR_KILL_UNDEAD)) && monrace.kind_flags.has(MonsterKindType::UNDEAD)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::UNDEAD);
+ monrace.r_kind_flags.set(MonsterKindType::UNDEAD);
}
if (mult < 30) {
mult = 30;
}
}
- if ((flags.has(TR_SLAY_DEMON)) && race_ptr->kind_flags.has(MonsterKindType::DEMON)) {
+ if ((flags.has(TR_SLAY_DEMON)) && monrace.kind_flags.has(MonsterKindType::DEMON)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::DEMON);
+ monrace.r_kind_flags.set(MonsterKindType::DEMON);
}
if (mult < 20) {
mult = 20;
}
}
- if ((flags.has(TR_KILL_DEMON)) && race_ptr->kind_flags.has(MonsterKindType::DEMON)) {
+ if ((flags.has(TR_KILL_DEMON)) && monrace.kind_flags.has(MonsterKindType::DEMON)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::DEMON);
+ monrace.r_kind_flags.set(MonsterKindType::DEMON);
}
if (mult < 30) {
mult = 30;
}
}
- if ((flags.has(TR_SLAY_ORC)) && race_ptr->kind_flags.has(MonsterKindType::ORC)) {
+ if ((flags.has(TR_SLAY_ORC)) && monrace.kind_flags.has(MonsterKindType::ORC)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::ORC);
+ monrace.r_kind_flags.set(MonsterKindType::ORC);
}
if (mult < 20) {
mult = 20;
}
}
- if ((flags.has(TR_KILL_ORC)) && race_ptr->kind_flags.has(MonsterKindType::ORC)) {
+ if ((flags.has(TR_KILL_ORC)) && monrace.kind_flags.has(MonsterKindType::ORC)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::ORC);
+ monrace.r_kind_flags.set(MonsterKindType::ORC);
}
if (mult < 30) {
mult = 30;
}
}
- if ((flags.has(TR_SLAY_TROLL)) && race_ptr->kind_flags.has(MonsterKindType::TROLL)) {
+ if ((flags.has(TR_SLAY_TROLL)) && monrace.kind_flags.has(MonsterKindType::TROLL)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::TROLL);
+ monrace.r_kind_flags.set(MonsterKindType::TROLL);
}
if (mult < 20) {
}
}
- if ((flags.has(TR_KILL_TROLL)) && race_ptr->kind_flags.has(MonsterKindType::TROLL)) {
+ if ((flags.has(TR_KILL_TROLL)) && monrace.kind_flags.has(MonsterKindType::TROLL)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::TROLL);
+ monrace.r_kind_flags.set(MonsterKindType::TROLL);
}
if (mult < 30) {
mult = 30;
}
}
- if ((flags.has(TR_SLAY_GIANT)) && race_ptr->kind_flags.has(MonsterKindType::GIANT)) {
+ if ((flags.has(TR_SLAY_GIANT)) && monrace.kind_flags.has(MonsterKindType::GIANT)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::GIANT);
+ monrace.r_kind_flags.set(MonsterKindType::GIANT);
}
if (mult < 20) {
mult = 20;
}
}
- if ((flags.has(TR_KILL_GIANT)) && race_ptr->kind_flags.has(MonsterKindType::GIANT)) {
+ if ((flags.has(TR_KILL_GIANT)) && monrace.kind_flags.has(MonsterKindType::GIANT)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::GIANT);
+ monrace.r_kind_flags.set(MonsterKindType::GIANT);
}
if (mult < 30) {
mult = 30;
}
}
- if ((flags.has(TR_SLAY_DRAGON)) && race_ptr->kind_flags.has(MonsterKindType::DRAGON)) {
+ if ((flags.has(TR_SLAY_DRAGON)) && monrace.kind_flags.has(MonsterKindType::DRAGON)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::DRAGON);
+ monrace.r_kind_flags.set(MonsterKindType::DRAGON);
}
if (mult < 20) {
mult = 20;
}
}
- if ((flags.has(TR_KILL_DRAGON)) && race_ptr->kind_flags.has(MonsterKindType::DRAGON)) {
+ if ((flags.has(TR_KILL_DRAGON)) && monrace.kind_flags.has(MonsterKindType::DRAGON)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_kind_flags.set(MonsterKindType::DRAGON);
+ monrace.r_kind_flags.set(MonsterKindType::DRAGON);
}
if (mult < 30) {
mult = 30;
if (flags.has(TR_BRAND_ACID)) {
/* Notice immunity */
- if (race_ptr->resistance_flags.has_any_of(RFR_EFF_IM_ACID_MASK)) {
+ if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_ACID_MASK)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(race_ptr->resistance_flags & RFR_EFF_IM_ACID_MASK);
+ monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_ACID_MASK);
}
} else {
if (mult < 17) {
if (flags.has(TR_BRAND_ELEC)) {
/* Notice immunity */
- if (race_ptr->resistance_flags.has_any_of(RFR_EFF_IM_ELEC_MASK)) {
+ if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_ELEC_MASK)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(race_ptr->resistance_flags & RFR_EFF_IM_ELEC_MASK);
+ monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_ELEC_MASK);
}
} else {
if (mult < 17) {
if (flags.has(TR_BRAND_FIRE)) {
/* Notice immunity */
- if (race_ptr->resistance_flags.has_any_of(RFR_EFF_IM_FIRE_MASK)) {
+ if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_FIRE_MASK)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(race_ptr->resistance_flags & RFR_EFF_IM_FIRE_MASK);
+ monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_FIRE_MASK);
}
}
/* Otherwise, take the damage */
else {
- if (race_ptr->resistance_flags.has(MonsterResistanceType::HURT_FIRE)) {
+ if (monrace.resistance_flags.has(MonsterResistanceType::HURT_FIRE)) {
if (mult < 25) {
mult = 25;
}
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(MonsterResistanceType::HURT_FIRE);
+ monrace.r_resistance_flags.set(MonsterResistanceType::HURT_FIRE);
}
} else if (mult < 17) {
mult = 17;
if (flags.has(TR_BRAND_COLD)) {
/* Notice immunity */
- if (race_ptr->resistance_flags.has_any_of(RFR_EFF_IM_COLD_MASK)) {
+ if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_COLD_MASK)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(race_ptr->resistance_flags & RFR_EFF_IM_COLD_MASK);
+ monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_COLD_MASK);
}
}
/* Otherwise, take the damage */
else {
- if (race_ptr->resistance_flags.has(MonsterResistanceType::HURT_COLD)) {
+ if (monrace.resistance_flags.has(MonsterResistanceType::HURT_COLD)) {
if (mult < 25) {
mult = 25;
}
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(MonsterResistanceType::HURT_COLD);
+ monrace.r_resistance_flags.set(MonsterResistanceType::HURT_COLD);
}
} else if (mult < 17) {
mult = 17;
if (flags.has(TR_BRAND_POIS)) {
/* Notice immunity */
- if (race_ptr->resistance_flags.has_any_of(RFR_EFF_IM_POISON_MASK)) {
+ if (monrace.resistance_flags.has_any_of(RFR_EFF_IM_POISON_MASK)) {
if (is_original_ap_and_seen(player_ptr, monster_ptr)) {
- race_ptr->r_resistance_flags.set(race_ptr->resistance_flags & RFR_EFF_IM_POISON_MASK);
+ monrace.r_resistance_flags.set(monrace.resistance_flags & RFR_EFF_IM_POISON_MASK);
}
}
/* Otherwise, take the damage */
grid_type *c_mon_ptr = &floor_ptr->grid_array[y][x];
auto *m_ptr = &floor_ptr->m_list[c_mon_ptr->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
/* Check the visibility */
auto visible = m_ptr->ml;
{
int k;
ARMOUR_CLASS ac;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
/* Percentile dice */
k = randint1(100);
#include "monster-race/race-resistance-mask.h"
#include "monster/monster-info.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "player-base/player-class.h"
#include "player/attack-defense-types.h"
{ TR_KILL_DRAGON, MonsterKindType::DRAGON, 50 },
};
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
for (size_t i = 0; i < sizeof(slay_table) / sizeof(slay_table[0]); ++i) {
const struct slay_table_t *p = &slay_table[i];
{ TR_BRAND_POIS, RFR_EFF_IM_POISON_MASK, MonsterResistanceType::MAX },
};
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
for (size_t i = 0; i < sizeof(brand_table) / sizeof(brand_table[0]); ++i) {
const struct brand_table_t *p = &brand_table[i];
*/
int calc_attack_damage_with_slay(PlayerType *player_ptr, ItemEntity *o_ptr, int tdam, MonsterEntity *m_ptr, combat_options mode, bool thrown)
{
- auto flags = object_flags(o_ptr);
+ auto flags = o_ptr->get_flags();
torch_flags(o_ptr, flags); /* torches has secret flags */
if (!thrown) {
}
}
- auto flags = object_flags(o_ptr);
+ auto flags = o_ptr->get_flags();
if (player_ptr->special_attack & (ATTACK_ACID)) {
flags.set(TR_BRAND_ACID);
const auto effects = player_ptr->effects();
if (player_ptr->riding && !effects->confusion()->is_confused() && !effects->blindness()->is_blind()) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (m_ptr->is_asleep()) {
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
(void)set_monster_csleep(player_ptr, player_ptr->riding, 0);
continue;
}
- r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ r_ptr = &m_ptr->get_real_monrace();
// モンスターのシンボル/カラーの更新
if (m_ptr->ml && r_ptr->visual_flags.has_any_of({ MonsterVisualType::MULTI_COLOR, MonsterVisualType::SHAPECHANGER })) {
ItemEntity item;
while (true) {
item.wipe();
- auto &r_ref = monraces_info[this->m_ptr->r_idx];
- (void)make_object(this->player_ptr, &item, AM_GOOD | AM_GREAT, r_ref.level);
+ const auto &monrace = this->m_ptr->get_monrace();
+ (void)make_object(this->player_ptr, &item, AM_GOOD | AM_GREAT, monrace.level);
if (!this->check_quality(item)) {
continue;
}
#include "object-enchant/tr-types.h"
#include "object-hook/hook-expendable.h"
#include "object/object-broken.h"
-#include "object/object-flags.h"
#include "object/object-mark-types.h"
#include "perception/object-perception.h"
#include "spell-kind/spells-perception.h"
#else
bool plural = (o_ptr->number > 1);
#endif
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
bool is_fixed_or_random_artifact = o_ptr->is_fixed_or_random_artifact();
switch (typ) {
case AttributeType::ACID: {
this->g_ptr = &floor_ptr->grid_array[this->y][this->x];
this->m_ptr = &floor_ptr->m_list[this->g_ptr->m_idx];
this->m_caster_ptr = (this->who > 0) ? &floor_ptr->m_list[this->who] : nullptr;
- this->r_ptr = &monraces_info[this->m_ptr->r_idx];
+ this->r_ptr = &this->m_ptr->get_monrace();
this->seen = this->m_ptr->ml;
this->seen_msg = is_seen(player_ptr, this->m_ptr);
this->slept = this->m_ptr->is_asleep();
this->known = ((this->m_ptr->cdis <= MAX_PLAYER_SIGHT) || player_ptr->phase_out);
this->note_dies = this->m_ptr->get_died_message();
- this->caster_lev = (this->who > 0) ? monraces_info[this->m_caster_ptr->r_idx].level : (player_ptr->lev * 2);
+ this->caster_lev = (this->who > 0) ? this->m_caster_ptr->get_monrace().level : (player_ptr->lev * 2);
}
}
em_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[em_ptr->g_ptr->m_idx];
- em_ptr->r_ptr = &monraces_info[em_ptr->m_ptr->r_idx];
+ em_ptr->r_ptr = &em_ptr->m_ptr->get_monrace();
}
/*!
{
if (ep_ptr->who > 0) {
ep_ptr->m_ptr = &player_ptr->current_floor_ptr->m_list[ep_ptr->who];
- ep_ptr->rlev = (&monraces_info[ep_ptr->m_ptr->r_idx])->level >= 1 ? (&monraces_info[ep_ptr->m_ptr->r_idx])->level : 1;
+ ep_ptr->rlev = ep_ptr->m_ptr->get_monrace().level >= 1 ? ep_ptr->m_ptr->get_monrace().level : 1;
angband_strcpy(ep_ptr->m_name, monster_desc(player_ptr, ep_ptr->m_ptr, 0), sizeof(ep_ptr->m_name));
angband_strcpy(ep_ptr->killer, who_name, sizeof(ep_ptr->killer));
return;
auto x = gx[i];
if (grids <= 1) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[y][x].m_idx];
- MonsterRaceInfo *ref_ptr = &monraces_info[m_ptr->r_idx];
+ MonsterRaceInfo *ref_ptr = &m_ptr->get_monrace();
if ((flag & PROJECT_REFLECTABLE) && player_ptr->current_floor_ptr->grid_array[y][x].m_idx && (ref_ptr->flags2 & RF2_REFLECTING) && ((player_ptr->current_floor_ptr->grid_array[y][x].m_idx != player_ptr->riding) || !(flag & PROJECT_PLAYER)) && (!who || path_n > 1) && !one_in_(10)) {
POSITION t_y, t_x;
int max_attempts = 10;
#include "object-enchant/tr-types.h"
#include "object-enchant/trg-types.h"
#include "object-hook/hook-quest.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "perception/object-perception.h"
#include "player-base/player-class.h"
static bool should_show_slaying_bonus(const ItemEntity &item)
{
- if (object_flags(&item).has(TR_SHOW_MODS)) {
+ if (item.get_flags().has(TR_SHOW_MODS)) {
return true;
}
static std::string describe_bow_power(PlayerType *player_ptr, const ItemEntity &item, const describe_option_type &opt)
{
auto power = item.get_arrow_magnification();
- const auto tr_flags = object_flags(&item);
+ const auto tr_flags = item.get_flags();
if (tr_flags.has(TR_XTRA_MIGHT)) {
power++;
}
static std::string describe_pval_type(const ItemEntity &item)
{
- const auto tr_flags = object_flags(&item);
+ const auto tr_flags = item.get_flags();
if (tr_flags.has(TR_HIDE_TYPE)) {
return "";
}
static std::string describe_pval(const ItemEntity &item)
{
- const auto tr_flags = object_flags(&item);
+ const auto tr_flags = item.get_flags();
if (tr_flags.has_none_of(TR_PVAL_FLAG_MASK)) {
return "";
}
#include "flavor/flag-inscriptions-table.h"
#include "object-enchant/tr-flags.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "sv-definition/sv-food-types.h"
#include "system/artifact-type-definition.h"
*/
std::string get_ability_abbreviation(const ItemEntity &item, bool is_kanji, bool all)
{
- auto flags = object_flags(&item);
+ auto flags = item.get_flags();
if (!all) {
const auto &baseitem = item.get_baseitem();
flags.reset(baseitem.flags);
#include "object-enchant/object-ego.h"
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "perception/object-perception.h"
#include "system/artifact-type-definition.h"
#include "system/item-entity.h"
static std::string get_fullname_if_set(const ItemEntity &item, const describe_option_type &opt)
{
- if (!opt.aware || object_flags(&item).has_not(TR_FULL_NAME)) {
+ if (!opt.aware || item.get_flags().has_not(TR_FULL_NAME)) {
return "";
}
}
}
- if (item.is_fixed_artifact() && object_flags(&item).has_not(TR_FULL_NAME)) {
+ if (item.is_fixed_artifact() && item.get_flags().has_not(TR_FULL_NAME)) {
const auto &artifact = item.get_fixed_artifact();
/* '『' から始まらない伝説のアイテムの名前は最初に付加する */
if (artifact.name.find("『", 0, 2) != 0) {
static std::string describe_unique_name_after_body_en(const ItemEntity &item, const describe_option_type &opt)
{
- if (!opt.known || object_flags(&item).has(TR_FULL_NAME) || any_bits(opt.mode, OD_BASE_NAME)) {
+ if (!opt.known || item.get_flags().has(TR_FULL_NAME) || any_bits(opt.mode, OD_BASE_NAME)) {
return "";
}
#include "object-enchant/tr-types.h"
#include "object-enchant/trg-types.h"
#include "object-hook/hook-quest.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "perception/object-perception.h"
#include "player-info/class-info.h"
m_ptr->mtimed[MTIMED_CSLEEP] = 0;
m_ptr->hold_o_idx_list.clear();
m_ptr->target_y = 0;
- auto &r_ref = m_ptr->get_real_r_ref();
+ auto &r_ref = m_ptr->get_real_monrace();
if (r_ref.behavior_flags.has(MonsterBehaviorType::PREVENT_SUDDEN_MAGIC) && !ironman_nightmare) {
m_ptr->mflag.set(MonsterTemporaryFlagType::PREVENT_MAGIC);
}
}
} else {
auto *m_ptr = &party_mon[current_monster];
- auto &r_ref = m_ptr->get_real_r_ref();
+ auto &r_ref = m_ptr->get_real_monrace();
msg_format(_("%sとはぐれてしまった。", "You have lost sight of %s."), monster_desc(player_ptr, m_ptr, 0).data());
if (record_named_pet && m_ptr->is_named()) {
exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_LOST_SIGHT, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
continue;
}
- auto &r_ref = m_ref.get_real_r_ref();
+ auto &r_ref = m_ref.get_real_monrace();
if (r_ref.kind_flags.has(MonsterKindType::UNIQUE) || (r_ref.population_flags.has(MonsterPopulationType::NAZGUL))) {
r_ref.floor_id = cur_floor_id;
}
(void)set_monster_invulner(player_ptr, i, 0, false);
}
- const auto &r_ref = m_ptr->get_real_r_ref();
+ const auto &r_ref = m_ptr->get_real_monrace();
if (r_ref.kind_flags.has_not(MonsterKindType::UNIQUE) && r_ref.population_flags.has_not(MonsterPopulationType::NAZGUL)) {
continue;
}
continue;
}
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
if (r_ptr->level + 10 > floor_ptr->dun_level) {
delta += (r_ptr->level + 10 - floor_ptr->dun_level) * 2 * base;
continue;
}
- const auto &r_ref = m_ptr->get_real_r_ref();
+ const auto &r_ref = m_ptr->get_real_monrace();
if (r_ref.kind_flags.has(MonsterKindType::UNIQUE) || (r_ref.population_flags.has(MonsterPopulationType::NAZGUL))) {
continue;
}
continue;
}
- m_ptr->get_real_r_ref().cur_num++;
+ m_ptr->get_real_monrace().cur_num++;
}
}
void print_bolt_pict(PlayerType *player_ptr, POSITION y, POSITION x, POSITION ny, POSITION nx, AttributeType typ)
{
- const auto [a, c] = bolt_pict(y, x, ny, nx, typ);
+ const auto &[a, c] = bolt_pict(y, x, ny, nx, typ);
print_rel(player_ptr, c, a, ny, nx);
}
}
if (!(mode & TELEPORT_PASSIVE)) {
- if (!monster_can_cross_terrain(player_ptr, g_ptr->feat, &monraces_info[m_ptr->r_idx], 0)) {
+ if (!monster_can_cross_terrain(player_ptr, g_ptr->feat, &m_ptr->get_monrace(), 0)) {
return false;
}
}
#include "object-enchant/object-ego.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "pet/pet-util.h"
#include "player-base/player-class.h"
ItemEntity *o_ptr;
o_ptr = &player_ptr->inventory_list[INVEN_LITE];
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if ((player_ptr->inventory_list[INVEN_LITE].bi_key.tval() != ItemKindType::NONE) && flags.has_not(TR_DARK_SOURCE) && !has_resist_lite(player_ptr)) {
const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
{
for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
#include "perception/object-perception.h"
#include "player-base/player-race.h"
#include "player-info/race-types.h"
}
tr_type cf = TR_STR;
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
switch (flag) {
case CurseTraitType::ADD_L_CURSE:
cf = TR_ADD_L_CURSE;
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has_not(TR_TELEPORT)) {
continue;
* @param art_ptr 記述内容を収めた構造体参照ポインタ
* Fill in an object description structure for a given object
*/
-static void spoiler_print_randart(ItemEntity *o_ptr, obj_desc_list *art_ptr, std::ofstream &ofs)
+static void spoiler_print_randart(ItemEntity *o_ptr, const ArtifactsDumpInfo *art_ptr, std::ofstream &ofs)
{
const auto finalizer = util::make_finalizer([art_ptr, &ofs]() {
ofs << spoiler_indent << art_ptr->misc_desc << "\n\n";
*/
static void spoil_random_artifact_aux(PlayerType *player_ptr, ItemEntity *o_ptr, ItemKindType tval, std::ofstream &ofs)
{
- obj_desc_list artifact;
if (!o_ptr->is_known() || !o_ptr->is_random_artifact() || (o_ptr->bi_key.tval() != tval)) {
return;
}
- random_artifact_analyze(player_ptr, o_ptr, &artifact);
- spoiler_print_randart(o_ptr, &artifact, ofs);
+ const auto artifacts_list = random_artifact_analyze(player_ptr, o_ptr);
+ spoiler_print_randart(o_ptr, &artifacts_list, ofs);
}
/*!
*/
bool change_panel(PlayerType *player_ptr, POSITION dy, POSITION dx)
{
- const auto [wid, hgt] = get_screen_size();
+ const auto &[wid, hgt] = get_screen_size();
POSITION y = panel_row_min + dy * hgt / 2;
POSITION x = panel_col_min + dx * wid / 2;
*/
void panel_bounds_center(void)
{
- const auto [wid, hgt] = get_screen_size();
+ const auto &[wid, hgt] = get_screen_size();
panel_row_max = panel_row_min + hgt - 1;
panel_row_prt = panel_row_min - 1;
panel_col_max = panel_col_min + wid - 1;
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "perception/object-perception.h"
#include "store/store-util.h"
*/
static void display_identified_resistances_flag(ItemEntity *o_ptr, FILE *fff)
{
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
print_im_or_res_flag(TR_IM_ACID, TR_RES_ACID, flags, fff);
print_im_or_res_flag(TR_IM_ELEC, TR_RES_ELEC, flags, fff);
monster_loader->rd_monster(m_ptr);
auto *g_ptr = &floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
g_ptr->m_idx = m_idx;
- m_ptr->get_real_r_ref().cur_num++;
+ m_ptr->get_real_monrace().cur_num++;
}
return 0;
#include "load/savedata-old-flag-types.h"
#include "object-enchant/object-ego.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "sv-definition/sv-lite-types.h"
#include "system/angband.h"
}
if (h_older_than(1, 0, 14)) {
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
if (r_ptr->kind_flags.has(MonsterKindType::EVIL)) {
monster_loader->rd_monster(m_ptr);
auto *g_ptr = &floor_ptr->grid_array[m_ptr->fy][m_ptr->fx];
g_ptr->m_idx = m_idx;
- m_ptr->get_real_r_ref().cur_num++;
+ m_ptr->get_real_monrace().cur_num++;
}
if (h_older_than(0, 3, 13) && !floor_ptr->dun_level && !floor_ptr->inside_arena) {
strcpy(&(Name[NameLen - 1]), "ies");
} else if (suffix(Name, "ouse")) {
strcpy(&(Name[NameLen - 4]), "ice");
+ } else if (suffix(Name, "ous")) {
+ strcpy(&(Name[NameLen - 3]), "i");
} else if (suffix(Name, "us")) {
strcpy(&(Name[NameLen - 2]), "i");
} else if (suffix(Name, "kelman")) {
void lore_treasure(PlayerType *player_ptr, MONSTER_IDX m_idx, ITEM_NUMBER num_item, ITEM_NUMBER num_gold)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_original_ap()) {
return;
auto floor_ptr = player_ptr->current_floor_ptr;
auto m_ptr1 = &floor_ptr->m_list[m_idx1];
auto m_ptr2 = &floor_ptr->m_list[m_idx2];
- auto ap_r_ptr1 = &monraces_info[m_ptr1->ap_r_idx];
- auto ap_r_ptr2 = &monraces_info[m_ptr2->ap_r_idx];
+ auto ap_r_ptr1 = &m_ptr1->get_real_monrace();
+ auto ap_r_ptr2 = &m_ptr2->get_real_monrace();
/* Unique monsters first */
if (ap_r_ptr1->kind_flags.has(MonsterKindType::UNIQUE) != ap_r_ptr2->kind_flags.has(MonsterKindType::UNIQUE)) {
if (do_dwap) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- MonsterRaceInfo *ap_r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ auto *ap_r_ptr = &m_ptr->get_real_monrace();
scene_target_monster.m_idx = m_idx;
scene_target_monster.ap_r_ptr = ap_r_ptr;
scene_target_monster.last_seen = get_game_turn();
clear_scene_target_monster();
} else {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[scene_target_monster.m_idx];
- MonsterRaceInfo *ap_r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ auto *ap_r_ptr = &m_ptr->get_real_monrace();
if (ap_r_ptr != scene_target_monster.ap_r_ptr) {
// 死亡、チェンジモンスター、etc.
clear_scene_target_monster();
#include "object-hook/hook-weapon.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "object/object-kind-hook.h"
#include "object/object-value.h"
#include "racial/racial-android.h"
*/
static void give_one_ability_of_object(ItemEntity *to_ptr, ItemEntity *from_ptr)
{
- auto to_flags = object_flags(to_ptr);
- auto from_flags = object_flags(from_ptr);
+ const auto to_flags = to_ptr->get_flags();
+ const auto from_flags = from_ptr->get_flags();
std::vector<tr_type> candidates;
for (int i = 0; i < TR_FLAG_MAX; i++) {
#include "object-hook/hook-weapon.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "realm/realm-hex-numbers.h"
#include "spell-realm/spells-hex.h"
int vorpal_div = 1;
int dmg_bonus = o_ptr->to_d + player_ptr->to_d[0];
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (o_ptr->bi_key == BaseitemKey(ItemKindType::SWORD, SV_POISON_NEEDLE)) {
dokubari = true;
}
*/
static bool process_all_resistances(mam_pp_type *mam_pp_ptr)
{
- auto *r_ptr = &monraces_info[mam_pp_ptr->m_ptr->r_idx];
+ auto *r_ptr = &mam_pp_ptr->m_ptr->get_monrace();
if (r_ptr->resistance_flags.has_not(MonsterResistanceType::RESIST_ALL)) {
return false;
}
*/
static bool check_monster_hp(PlayerType *player_ptr, mam_pp_type *mam_pp_ptr)
{
- const auto &monrace = monraces_info[mam_pp_ptr->m_ptr->r_idx];
+ const auto &monrace = mam_pp_ptr->m_ptr->get_monrace();
if (mam_pp_ptr->m_ptr->hp < 0) {
return false;
}
*/
static void make_monster_fear(PlayerType *player_ptr, mam_pp_type *mam_pp_ptr)
{
- auto *r_ptr = &monraces_info[mam_pp_ptr->m_ptr->r_idx];
+ auto *r_ptr = &mam_pp_ptr->m_ptr->get_monrace();
if (mam_pp_ptr->m_ptr->is_fearful() || ((r_ptr->flags3 & RF3_NO_FEAR) == 0)) {
return;
}
MonsterAbilityType::BA_FIRE,
MonsterAbilityType::BA_COLD
};
- auto *r_ptr = &monraces_info[ms_ptr->m_ptr->r_idx];
+ auto *r_ptr = &ms_ptr->m_ptr->get_monrace();
if (any_bits(r_ptr->flags2, RF2_POWERFUL)) {
ms_ptr->ability_flags.reset(ball_when_powerful_rad4);
};
auto *floor_ptr = player_ptr->current_floor_ptr;
this->m_ptr = &floor_ptr->m_list[m_idx];
this->t_ptr = nullptr;
- this->r_ptr = &monraces_info[this->m_ptr->r_idx];
+ this->r_ptr = &this->m_ptr->get_monrace();
this->see_m = is_seen(player_ptr, this->m_ptr);
this->maneable = player_has_los_bold(player_ptr, this->m_ptr->fy, this->m_ptr->fx);
this->pet = this->m_ptr->is_pet();
mam_ptr->explode = false;
mam_ptr->touched = false;
- auto *r_ptr = &monraces_info[mam_ptr->m_ptr->r_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[mam_ptr->t_ptr->r_idx];
+ auto *r_ptr = &mam_ptr->m_ptr->get_monrace();
+ auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
mam_ptr->ac = tr_ptr->ac;
mam_ptr->rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
mam_ptr->blinked = false;
static void process_blow_effect(PlayerType *player_ptr, mam_type *mam_ptr)
{
- auto *r_ptr = &monraces_info[mam_ptr->m_ptr->r_idx];
+ auto *r_ptr = &mam_ptr->m_ptr->get_monrace();
switch (mam_ptr->attribute) {
case BlowEffectType::FEAR:
project(player_ptr, mam_ptr->m_idx, 0, mam_ptr->t_ptr->fy, mam_ptr->t_ptr->fx, mam_ptr->damage,
static void aura_fire_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
{
- auto *r_ptr = &monraces_info[mam_ptr->m_ptr->r_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[mam_ptr->t_ptr->r_idx];
+ auto *r_ptr = &mam_ptr->m_ptr->get_monrace();
+ auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
if (tr_ptr->aura_flags.has_not(MonsterAuraType::FIRE) || !MonsterRace(mam_ptr->m_ptr->r_idx).is_valid()) {
return;
}
static void aura_cold_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
{
const auto *m_ptr = mam_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[mam_ptr->t_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
+ auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
if (tr_ptr->aura_flags.has_not(MonsterAuraType::COLD) || !MonsterRace(m_ptr->r_idx).is_valid()) {
return;
}
static void aura_elec_by_melee(PlayerType *player_ptr, mam_type *mam_ptr)
{
const auto *m_ptr = mam_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[mam_ptr->t_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
+ auto *tr_ptr = &mam_ptr->t_ptr->get_monrace();
if (tr_ptr->aura_flags.has_not(MonsterAuraType::ELEC) || !MonsterRace(m_ptr->r_idx).is_valid()) {
return;
}
return false;
}
- auto *r_ptr = &monraces_info[mam_ptr->m_ptr->r_idx];
+ auto *r_ptr = &mam_ptr->m_ptr->get_monrace();
if (r_ptr->behavior_flags.has(MonsterBehaviorType::NEVER_BLOW)) {
return false;
}
void repeat_melee(PlayerType *player_ptr, mam_type *mam_ptr)
{
const auto *m_ptr = mam_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
for (int ap_cnt = 0; ap_cnt < MAX_NUM_BLOWS; ap_cnt++) {
mam_ptr->effect = r_ptr->blows[ap_cnt].effect;
mam_ptr->method = r_ptr->blows[ap_cnt].method;
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
msg_format(_("%sに乗った。", "You ride on %s."), m_name.data());
POSITION oy = y, ox = x;
MONSTER_IDX m_idx = player_ptr->current_floor_ptr->grid_array[y][x].m_idx;
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
if (randint1(r_ptr->level * 3 / 2) > randint0(dam / 2) + dam / 2) {
*/
void process_surprise_attack(PlayerType *player_ptr, player_attack_type *pa_ptr)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if (!has_melee_weapon(player_ptr, enum2i(INVEN_MAIN_HAND) + pa_ptr->hand) || player_ptr->is_icky_wield[pa_ptr->hand]) {
return;
}
#include "object-hook/hook-weapon.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "racial/racial-android.h"
#include "system/item-entity.h"
#include "system/player-type-definition.h"
}
const auto item_name = describe_flavor(player_ptr, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
- auto item_flags = object_flags(o_ptr);
+ const auto item_flags = o_ptr->get_flags();
auto &rfu = RedrawingFlagsUpdater::get_instance();
if (o_ptr->is_cursed()) {
auto can_disturb_blessing = o_ptr->curse_flags.has(CurseTraitType::HEAVY_CURSE) && (randint1(100) < 33);
*/
MULTIPLY mult_hissatsu(PlayerType *player_ptr, MULTIPLY mult, const TrFlags &flags, MonsterEntity *m_ptr, combat_options mode)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
samurai_slaying_type tmp_slaying(mult, flags, m_ptr, mode, r_ptr);
samurai_slaying_type *samurai_slaying_ptr = &tmp_slaying;
hissatsu_burning_strike(player_ptr, samurai_slaying_ptr);
pa_ptr->attack_damage = 0;
anger_monster(player_ptr, pa_ptr->m_ptr);
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((r_ptr->flags3 & (RF3_NO_STUN))) {
msg_format(_("%s には効果がなかった。", "%s is not effected."), pa_ptr->m_name);
return;
*/
MULTIPLY calc_snipe_damage_with_slay(PlayerType *player_ptr, MULTIPLY mult, MonsterEntity *m_ptr, SPELL_IDX snipe_type)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool seen = is_seen(player_ptr, m_ptr);
auto sniper_data = PlayerClass(player_ptr).get_specific_data<SniperData>();
*/
static int calc_stun_resistance(player_attack_type *pa_ptr)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
int resist_stun = 0;
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
resist_stun += 88;
static int process_monk_additional_effect(player_attack_type *pa_ptr, int *stun_effect)
{
int special_effect = 0;
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if (pa_ptr->ma_ptr->effect == MA_KNEE) {
if (r_ptr->flags1 & RF1_MALE) {
msg_format(_("%sに金的膝蹴りをくらわした!", "You hit %s in the groin with your knee!"), pa_ptr->m_name);
*/
static void process_attack_vital_spot(PlayerType *player_ptr, player_attack_type *pa_ptr, int *stun_effect, int *resist_stun, const int special_effect)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((special_effect == MA_KNEE) && ((pa_ptr->attack_damage + player_ptr->to_d[pa_ptr->hand]) < pa_ptr->m_ptr->hp)) {
msg_format(_("%s^は苦痛にうめいている!", "%s^ moans in agony!"), pa_ptr->m_name);
*stun_effect = 7 + randint1(13);
*/
static void print_stun_effect(PlayerType *player_ptr, player_attack_type *pa_ptr, const int stun_effect, const int resist_stun)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if (stun_effect && ((pa_ptr->attack_damage + player_ptr->to_d[pa_ptr->hand]) < pa_ptr->m_ptr->hp)) {
if (player_ptr->lev > randint1(r_ptr->level + resist_stun + 10)) {
if (set_monster_stunned(player_ptr, pa_ptr->g_ptr->m_idx, stun_effect + pa_ptr->m_ptr->get_remaining_stun())) {
return;
}
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
this->rlev = ((r_ptr->level >= 1) ? r_ptr->level : 1);
angband_strcpy(this->m_name, monster_desc(this->player_ptr, this->m_ptr, 0), sizeof(this->m_name));
angband_strcpy(this->ddesc, monster_desc(this->player_ptr, this->m_ptr, MD_WRONGDOER_NAME), sizeof(this->ddesc));
bool MonsterAttackPlayer::check_no_blow()
{
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
if (r_ptr->behavior_flags.has(MonsterBehaviorType::NEVER_BLOW)) {
return false;
}
*/
bool MonsterAttackPlayer::process_monster_blows()
{
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
for (auto ap_cnt = 0; ap_cnt < MAX_NUM_BLOWS; ap_cnt++) {
this->obvious = false;
this->damage = 0;
return false;
}
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
if (this->m_ptr->is_pet() && r_ptr->kind_flags.has(MonsterKindType::UNIQUE) && (this->method == RaceBlowMethodType::EXPLODE)) {
this->method = RaceBlowMethodType::HIT;
this->d_dice /= 10;
*/
bool MonsterAttackPlayer::effect_protecion_from_evil()
{
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
if ((this->player_ptr->protevil <= 0) || r_ptr->kind_flags.has_not(MonsterKindType::EVIL) || (this->player_ptr->lev < this->rlev) || ((randint0(100) + this->player_ptr->lev) <= 50)) {
return false;
}
return;
}
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
auto target_level = r_ptr->level;
short increment = 0;
if ((cur / 100) < target_level) {
return;
}
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
if (!this->obvious && (this->damage == 0) && (r_ptr->r_blows[ap_cnt] <= 10)) {
return;
}
spell_hex.eyes_on_eyes();
musou_counterattack(this->player_ptr, this);
spell_hex.thief_teleport();
- auto *r_ptr = &monraces_info[this->m_ptr->r_idx];
+ auto *r_ptr = &this->m_ptr->get_monrace();
if (this->player_ptr->is_dead && (r_ptr->r_deaths < MAX_SHORT) && !this->player_ptr->current_floor_ptr->inside_arena) {
r_ptr->r_deaths++;
}
{
auto &floor = *player_ptr->current_floor_ptr;
auto *m_ptr = &floor.m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!turn_flags_ptr->do_move || !player_bold(player_ptr, ny, nx)) {
return;
}
{
auto &floor = *player_ptr->current_floor_ptr;
auto *m_ptr = &floor.m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
MonsterEntity *y_ptr;
y_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
if (r_ptr->behavior_flags.has(MonsterBehaviorType::NEVER_BLOW)) {
*/
bool process_monster_attack_to_monster(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, grid_type *g_ptr, bool can_cross)
{
- auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
- MonsterEntity *y_ptr;
- y_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+ const auto &monster_from = player_ptr->current_floor_ptr->m_list[m_idx];
+ const auto &monrace_from = monster_from.get_monrace();
if (!turn_flags_ptr->do_move || (g_ptr->m_idx == 0)) {
return false;
}
- MonsterRaceInfo *z_ptr = &monraces_info[y_ptr->r_idx];
+ const auto &monster_to = player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
+ const auto &monrace_to = monster_to.get_monrace();
turn_flags_ptr->do_move = false;
- bool do_kill_body = r_ptr->behavior_flags.has(MonsterBehaviorType::KILL_BODY) && r_ptr->behavior_flags.has_not(MonsterBehaviorType::NEVER_BLOW);
- do_kill_body &= (r_ptr->mexp * r_ptr->level > z_ptr->mexp * z_ptr->level);
+ bool do_kill_body = monrace_from.behavior_flags.has(MonsterBehaviorType::KILL_BODY) && monrace_from.behavior_flags.has_not(MonsterBehaviorType::NEVER_BLOW);
+ do_kill_body &= (monrace_from.mexp * monrace_from.level > monrace_to.mexp * monrace_to.level);
do_kill_body &= (g_ptr->m_idx != player_ptr->riding);
- if (do_kill_body || are_enemies(player_ptr, *m_ptr, *y_ptr) || m_ptr->is_confused()) {
+ if (do_kill_body || are_enemies(player_ptr, monster_from, monster_to) || monster_from.is_confused()) {
return exe_monster_attack_to_monster(player_ptr, m_idx, g_ptr);
}
- bool do_move_body = r_ptr->behavior_flags.has(MonsterBehaviorType::MOVE_BODY) && r_ptr->behavior_flags.has_not(MonsterBehaviorType::NEVER_MOVE);
- do_move_body &= (r_ptr->mexp > z_ptr->mexp);
+ bool do_move_body = monrace_from.behavior_flags.has(MonsterBehaviorType::MOVE_BODY) && monrace_from.behavior_flags.has_not(MonsterBehaviorType::NEVER_MOVE);
+ do_move_body &= (monrace_from.mexp > monrace_to.mexp);
do_move_body &= can_cross;
do_move_body &= (g_ptr->m_idx != player_ptr->riding);
- do_move_body &= monster_can_cross_terrain(player_ptr, player_ptr->current_floor_ptr->grid_array[m_ptr->fy][m_ptr->fx].feat, z_ptr, 0);
+ do_move_body &= monster_can_cross_terrain(player_ptr, player_ptr->current_floor_ptr->grid_array[monster_from.fy][monster_from.fx].feat, &monrace_to, 0);
if (do_move_body) {
turn_flags_ptr->do_move = true;
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (has_resist_fear(player_ptr)) {
msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
monap_ptr->obvious = true;
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (player_ptr->free_act) {
msg_print(_("しかし効果がなかった!", "You are unaffected!"));
monap_ptr->obvious = true;
return;
}
- auto *r_ptr = &monraces_info[monap_ptr->m_ptr->r_idx];
+ auto *r_ptr = &monap_ptr->m_ptr->get_monrace();
if (BadStatusSetter(player_ptr).mod_stun(10 + randint1(r_ptr->level / 4))) {
monap_ptr->obvious = true;
}
auto *floor_ptr = player_ptr->current_floor_ptr;
md_ptr->m_idx = m_idx;
md_ptr->m_ptr = &floor_ptr->m_list[m_idx];
- md_ptr->r_ptr = &monraces_info[md_ptr->m_ptr->r_idx];
+ md_ptr->r_ptr = &md_ptr->m_ptr->get_monrace();
md_ptr->do_gold = (md_ptr->r_ptr->drop_flags.has_none_of({ MonsterDropType::ONLY_ITEM, MonsterDropType::DROP_GOOD, MonsterDropType::DROP_GREAT }));
md_ptr->do_item = (md_ptr->r_ptr->drop_flags.has_not(MonsterDropType::ONLY_GOLD) || md_ptr->r_ptr->drop_flags.has_any_of({ MonsterDropType::DROP_GOOD, MonsterDropType::DROP_GREAT }));
md_ptr->cloned = md_ptr->m_ptr->mflag2.has(MonsterConstantFlagType::CLONED);
on_dead_explosion(player_ptr, md_ptr);
if (md_ptr->m_ptr->mflag2.has(MonsterConstantFlagType::CHAMELEON)) {
choose_new_monster(player_ptr, m_idx, true, MonsterRaceId::CHAMELEON);
- md_ptr->r_ptr = &monraces_info[md_ptr->m_ptr->r_idx];
+ md_ptr->r_ptr = &md_ptr->m_ptr->get_monrace();
}
QuestCompletionChecker(player_ptr, md_ptr->m_ptr).complete();
*/
static bool decide_pet_approch_direction(PlayerType *player_ptr, MonsterEntity *m_ptr, MonsterEntity *t_ptr)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_pet()) {
return false;
}
{
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
for (int i = start; ((i < start + floor_ptr->m_max) && (i > start - floor_ptr->m_max)); i += plus) {
MONSTER_IDX dummy = (i % floor_ptr->m_max);
if (dummy == 0) {
*/
static bool random_walk(PlayerType *player_ptr, DIRECTION *mm, MonsterEntity *m_ptr)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->behavior_flags.has_all_of({ MonsterBehaviorType::RAND_MOVE_50, MonsterBehaviorType::RAND_MOVE_25 }) && (randint0(100) < 75)) {
if (is_original_ap_and_seen(player_ptr, m_ptr)) {
r_ptr->r_behavior_flags.set({ MonsterBehaviorType::RAND_MOVE_50, MonsterBehaviorType::RAND_MOVE_25 });
bool decide_monster_movement_direction(PlayerType *player_ptr, DIRECTION *mm, MONSTER_IDX m_idx, bool aware)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (m_ptr->is_confused() || !aware) {
mm[0] = mm[1] = mm[2] = mm[3] = 5;
MonsterRaceInfo *r_ptr;
for (int i = 1; i < floor_ptr->m_max; i++) {
m_ptr = &floor_ptr->m_list[i];
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid() || (m_ptr->cdis > dis_lim)) {
continue;
}
static bool check_hp_for_terrain_destruction(TerrainType *f_ptr, MonsterEntity *m_ptr)
{
auto can_destroy = f_ptr->flags.has_not(TerrainCharacteristics::GLASS);
- can_destroy |= monraces_info[m_ptr->r_idx].behavior_flags.has(MonsterBehaviorType::STUPID);
+ can_destroy |= m_ptr->get_monrace().behavior_flags.has(MonsterBehaviorType::STUPID);
can_destroy |= m_ptr->hp >= std::max(m_ptr->maxhp / 3, 200);
return can_destroy;
}
*/
static bool process_wall(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, POSITION ny, POSITION nx, bool can_cross)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
auto *f_ptr = &terrains_info[g_ptr->feat];
if (player_bold(player_ptr, ny, nx)) {
*/
static bool bash_normal_door(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, POSITION ny, POSITION nx)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
auto *f_ptr = &terrains_info[g_ptr->feat];
turn_flags_ptr->do_move = false;
*/
static void bash_glass_door(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, TerrainType *f_ptr, bool may_bash)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto can_bash = may_bash;
can_bash &= r_ptr->behavior_flags.has(MonsterBehaviorType::BASH_DOOR);
can_bash &= f_ptr->flags.has(TerrainCharacteristics::BASH);
*/
static bool process_door(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, POSITION ny, POSITION nx)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
const auto &g_ref = player_ptr->current_floor_ptr->grid_array[ny][nx];
if (!is_closed_door(player_ptr, g_ref.feat)) {
return true;
static bool process_protection_rune(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, POSITION ny, POSITION nx)
{
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto can_enter = turn_flags_ptr->do_move;
can_enter &= g_ptr->is_rune_protection();
can_enter &= (r_ptr->behavior_flags.has_not(MonsterBehaviorType::NEVER_BLOW)) || !player_bold(player_ptr, ny, nx);
static bool process_explosive_rune(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, POSITION ny, POSITION nx)
{
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto should_explode = turn_flags_ptr->do_move;
should_explode &= g_ptr->is_rune_explosion();
should_explode &= (r_ptr->behavior_flags.has_not(MonsterBehaviorType::NEVER_BLOW)) || !player_bold(player_ptr, ny, nx);
*/
static bool process_post_dig_wall(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr, POSITION ny, POSITION nx)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
grid_type *g_ptr;
g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
TerrainType *f_ptr;
grid_type *g_ptr;
g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_cross = monster_can_cross_terrain(player_ptr, g_ptr->feat, r_ptr, turn_flags_ptr->is_riding_mon ? CEM_RIDING : 0);
if (!process_wall(player_ptr, turn_flags_ptr, m_ptr, ny, nx, can_cross)) {
break;
}
- const auto &ap_r_ref = monraces_info[m_ptr->ap_r_idx];
+ const auto &ap_r_ref = m_ptr->get_real_monrace();
const auto is_projectable = projectable(player_ptr, player_ptr->y, player_ptr->x, m_ptr->fy, m_ptr->fx);
const auto can_see = disturb_near && m_ptr->mflag.has(MonsterTemporaryFlagType::VIEW) && is_projectable;
const auto is_high_level = disturb_high && (ap_r_ref.r_tkills > 0) && (ap_r_ref.level >= player_ptr->lev);
static std::string_view get_speak_filename(MonsterEntity *m_ptr)
{
- const auto &ap_r_ref = monraces_info[m_ptr->ap_r_idx];
+ const auto &ap_r_ref = m_ptr->get_real_monrace();
if (m_ptr->is_fearful() && can_speak(ap_r_ref, MonsterSpeakType::SPEAK_FEAR)) {
return _("monfear_j.txt", "monfear.txt");
}
msg_print(_("重厚な足音が聞こえた。", "You hear heavy steps."));
}
- auto can_speak = monraces_info[m_ptr->ap_r_idx].speak_flags.any();
+ auto can_speak = m_ptr->get_real_monrace().speak_flags.any();
constexpr auto chance_speak = 8;
if (!can_speak || !aware || !one_in_(chance_speak) || !player_has_los_bold(player_ptr, oy, ox) || !projectable(player_ptr, oy, ox, player_ptr->y, player_ptr->x)) {
return;
#include "monster/monster-processor-util.h"
#include "monster/smart-learn-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/object-mark-types.h"
#include "system/floor-type-definition.h"
#include "system/grid-type-definition.h"
const POSITION ny, const POSITION nx, std::string_view m_name, std::string_view o_name, const OBJECT_IDX this_o_idx)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (is_unpickable_object) {
if (turn_flags_ptr->do_take && r_ptr->behavior_flags.has(MonsterBehaviorType::STUPID)) {
turn_flags_ptr->did_take_item = true;
void update_object_by_monster_movement(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx, POSITION ny, POSITION nx)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[ny][nx];
turn_flags_ptr->do_take = r_ptr->behavior_flags.has(MonsterBehaviorType::TAKE_ITEM);
for (auto it = g_ptr->o_idx_list.begin(); it != g_ptr->o_idx_list.end();) {
}
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
const auto item_name = describe_flavor(player_ptr, o_ptr, 0);
const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_HIDDEN);
update_object_flags(flags, flg_monster_kind, flgr);
{
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
POSITION y = m_ptr->fy;
POSITION x = m_ptr->fx;
- m_ptr->get_real_r_ref().cur_num--;
+ m_ptr->get_real_monrace().cur_num--;
if (r_ptr->flags2 & (RF2_MULTIPLY)) {
floor_ptr->num_repro--;
}
MonsterSpeakType::SPEAK_FEAR,
};
- auto speak = monraces_info[m_ptr->r_idx].speak_flags.has_any_of(flags);
+ auto speak = m_ptr->get_monrace().speak_flags.has_any_of(flags);
speak &= !is_acting_monster(m_ptr->r_idx);
speak &= player_has_los_bold(player_ptr, m_ptr->fy, m_ptr->fx);
speak &= projectable(player_ptr, m_ptr->fy, m_ptr->fx, player_ptr->y, player_ptr->x);
bool runaway_monster(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_runaway = m_ptr->is_pet() || m_ptr->is_friendly();
can_runaway &= (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) || (r_ptr->population_flags.has(MonsterPopulationType::NAZGUL));
can_runaway &= !player_ptr->phase_out;
continue;
}
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
grid_type *g_ptr;
g_ptr = &floor_ptr->grid_array[y][x];
static void sweep_hiding_candidate(
PlayerType *player_ptr, MonsterEntity *m_ptr, const POSITION *y_offsets, const POSITION *x_offsets, coordinate_candidate *candidate)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
for (POSITION i = 0, dx = x_offsets[0], dy = y_offsets[0]; dx != 0 || dy != 0; i++, dx = x_offsets[i], dy = y_offsets[i]) {
POSITION y = m_ptr->fy + dy;
POSITION x = m_ptr->fx + dx;
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
POSITION y = 0;
POSITION x = 0;
auto y2 = this->player_ptr->y;
bool MonsterSweepGrid::mon_will_run()
{
auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (m_ptr->is_pet()) {
return (this->player_ptr->pet_follow_distance < 0) && (m_ptr->cdis <= (0 - this->player_ptr->pet_follow_distance));
}
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (this->done || this->will_run || !m_ptr->is_hostile() || none_bits(r_ptr->flags1, RF1_FRIENDS)) {
return;
}
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!this->check_movable_grid(yp, xp, no_flow)) {
return;
}
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto y1 = m_ptr->fy;
auto x1 = m_ptr->fx;
if (projectable(this->player_ptr, y1, x1, this->player_ptr->y, this->player_ptr->x)) {
auto gx = 0;
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto fy = m_ptr->fy;
auto fx = m_ptr->fx;
auto y1 = fy - *yp;
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;
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)) {
bool process_quantum_effect(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has_not(MonsterKindType::QUANTUM)) {
return false;
}
on_dead_dragon_centipede(player_ptr, md_ptr);
return;
case MonsterRaceId::CAIT_SITH:
+ if (player_ptr->current_floor_ptr->dun_level <= 0) {
+ return;
+ }
drop_specific_item_on_dead(player_ptr, md_ptr, kind_is_boots);
return;
case MonsterRaceId::YENDOR_WIZARD_1:
on_dead_random_artifact(player_ptr, md_ptr, kind_is_amulet);
return;
case MonsterRaceId::YENDOR_WIZARD_2:
+ if (player_ptr->current_floor_ptr->dun_level <= 0) {
+ return;
+ }
drop_specific_item_on_dead(player_ptr, md_ptr, kind_is_amulet);
return;
case MonsterRaceId::MANIMANI:
*/
bool vault_monster_okay(PlayerType *player_ptr, MonsterRaceId r_idx)
{
- return mon_hook_dungeon(player_ptr, r_idx) && monraces_info[r_idx].kind_flags.has_not(MonsterKindType::UNIQUE) && none_bits(monraces_info[r_idx].flags7, RF7_UNIQUE2) && monraces_info[r_idx].resistance_flags.has_not(MonsterResistanceType::RESIST_ALL) && monraces_info[r_idx].feature_flags.has_not(MonsterFeatureType::AQUATIC);
+ const auto &monrace = monraces_info[r_idx];
+ auto is_valid = mon_hook_dungeon(player_ptr, r_idx);
+ is_valid &= monrace.kind_flags.has_not(MonsterKindType::UNIQUE);
+ is_valid &= none_bits(monrace.flags7, RF7_UNIQUE2);
+ is_valid &= monrace.resistance_flags.has_not(MonsterResistanceType::RESIST_ALL);
+ is_valid &= monrace.feature_flags.has_not(MonsterFeatureType::AQUATIC);
+ return is_valid;
}
int cur_dis = 5 * (20 - cnt);
for (MONSTER_IDX i = 1; i < floor_ptr->m_max; i++) {
auto *m_ptr = &floor_ptr->m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
bool MonsterDamageProcessor::process_dead_exp_virtue(std::string_view note, MonsterEntity *exp_mon)
{
auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
- auto &r_ref = m_ptr->get_real_r_ref();
+ auto &r_ref = m_ptr->get_real_monrace();
if (m_ptr->hp >= 0) {
return false;
}
}
if (m_ptr->mflag2.has(MonsterConstantFlagType::CHAMELEON)) {
- auto &real_r_ref = m_ptr->get_real_r_ref();
- r_idx = m_ptr->get_real_r_idx();
+ auto &real_r_ref = m_ptr->get_real_monrace();
+ r_idx = m_ptr->get_real_monrace_id();
if (real_r_ref.r_sights < MAX_SHORT) {
real_r_ref.r_sights++;
}
void MonsterDamageProcessor::increase_kill_numbers()
{
auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
- auto &r_ref = m_ptr->get_real_r_ref();
+ auto &r_ref = m_ptr->get_real_monrace();
auto is_hallucinated = this->player_ptr->effects()->hallucination()->is_hallucinated();
if (((m_ptr->ml == 0) || is_hallucinated) && r_ref.kind_flags.has_not(MonsterKindType::UNIQUE)) {
return;
void MonsterDamageProcessor::death_amberites(std::string_view m_name)
{
auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
- const auto &r_ref = m_ptr->get_real_r_ref();
+ const auto &r_ref = m_ptr->get_real_monrace();
if (r_ref.kind_flags.has_not(MonsterKindType::AMBERITE) || one_in_(2)) {
return;
}
void MonsterDamageProcessor::dying_scream(std::string_view m_name)
{
auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[this->m_idx];
- const auto &r_ref = m_ptr->get_real_r_ref();
+ const auto &r_ref = m_ptr->get_real_monrace();
if (r_ref.speak_flags.has_none_of({ MonsterSpeakType::SPEAK_ALL, MonsterSpeakType::SPEAK_DEATH })) {
return;
}
{
auto *floor_ptr = this->player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[this->m_idx];
- const auto &r_ref = m_ptr->get_real_r_ref();
+ const auto &r_ref = m_ptr->get_real_monrace();
if (r_ref.kind_flags.has_not(MonsterKindType::UNIQUE) || m_ptr->mflag2.has(MonsterConstantFlagType::CLONED) || vanilla_town) {
return;
}
*/
void MonsterDamageProcessor::get_exp_from_mon(MonsterEntity *m_ptr, int exp_dam)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid() || m_ptr->is_pet() || this->player_ptr->phase_out) {
return;
}
}
}
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (m_ptr->is_fearful() || any_bits(r_ptr->flags3, RF3_NO_FEAR)) {
return;
}
return std::nullopt;
}
- const auto &monrace = monraces_info[monster.ap_r_idx];
+ const auto &monrace = monster.get_real_monrace();
const auto kind = get_monster_pronoun_kind(monrace, pron);
return get_monster_personal_pronoun(kind, mode);
}
static std::optional<std::string> get_monster_self_pronoun(const MonsterEntity &monster, const BIT_FLAGS mode)
{
- const auto &monrace = monraces_info[monster.ap_r_idx];
+ const auto &monrace = monster.get_real_monrace();
constexpr BIT_FLAGS self = MD_POSSESSIVE | MD_OBJECTIVE;
if (!match_bits(mode, self, self)) {
return std::nullopt;
static std::string get_describing_monster_name(const MonsterEntity &monster, const bool is_hallucinated, const BIT_FLAGS mode)
{
- const auto &monrace = monraces_info[monster.ap_r_idx];
+ const auto &monrace = monster.get_real_monrace();
if (!is_hallucinated || any_bits(mode, MD_IGNORE_HALLU)) {
- return any_bits(mode, MD_TRUE_NAME) ? monster.get_real_r_ref().name : monrace.name;
+ return any_bits(mode, MD_TRUE_NAME) ? monster.get_real_monrace().name : monrace.name;
}
if (one_in_(2)) {
static std::optional<std::string> get_fake_monster_name(const PlayerType &player, const MonsterEntity &monster, const std::string &name, const BIT_FLAGS mode)
{
- const auto &monrace = monraces_info[monster.ap_r_idx];
+ const auto &monrace = monster.get_real_monrace();
const auto is_hallucinated = player.effects()->hallucination()->is_hallucinated();
if (monrace.kind_flags.has_not(MonsterKindType::UNIQUE) || (is_hallucinated && none_bits(mode, MD_IGNORE_HALLU))) {
return std::nullopt;
return "";
}
- const auto &monrace = monraces_info[monster.ap_r_idx];
+ const auto &monrace = monster.get_real_monrace();
if (monrace.kind_flags.has(MonsterKindType::UNIQUE)) {
return _("(カメレオンの王)", "(Chameleon Lord)");
}
ss << add_cameleon_name(*m_ptr, mode);
if (any_bits(mode, MD_IGNORE_HALLU) && !m_ptr->is_original_ap()) {
- ss << "(" << monraces_info[m_ptr->r_idx].name << ")";
+ ss << "(" << m_ptr->get_monrace().name << ")";
}
if (any_bits(mode, MD_POSSESSIVE)) {
* @param mode オプション
* @return 踏破可能ならばTRUEを返す
*/
-bool monster_can_cross_terrain(PlayerType *player_ptr, FEAT_IDX feat, MonsterRaceInfo *r_ptr, BIT_FLAGS16 mode)
+bool monster_can_cross_terrain(PlayerType *player_ptr, FEAT_IDX feat, const MonsterRaceInfo *r_ptr, BIT_FLAGS16 mode)
{
auto *f_ptr = &terrains_info[feat];
/*!
* @brief モンスターの属性の基づいた敵対関係の有無を返す
* Check if two monsters are enemies
- * @param m_ptr モンスター1の構造体参照ポインタ
- * @param n_ptr モンスター2の構造体参照ポインタ
+ * @param monster1 モンスター1への参照
+ * @param monster2 モンスター2への参照
* @return 敵対関係にあるならばTRUEを返す
*/
-bool are_enemies(PlayerType *player_ptr, const MonsterEntity &m1_ref, const MonsterEntity &m2_ref)
+bool are_enemies(PlayerType *player_ptr, const MonsterEntity &monster1, const MonsterEntity &monster2)
{
if (player_ptr->phase_out) {
- if (m1_ref.is_pet() || m2_ref.is_pet()) {
+ if (monster1.is_pet() || monster2.is_pet()) {
return false;
}
return true;
}
- const auto &r1_ref = monraces_info[m1_ref.r_idx];
- const auto &r2_ref = monraces_info[m2_ref.r_idx];
- const auto is_m1_wild = r1_ref.wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL });
- const auto is_m2_wild = r2_ref.wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL });
+ const auto &monrace1 = monster1.get_monrace();
+ const auto &monrace2 = monster2.get_monrace();
+ const auto is_m1_wild = monrace1.wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL });
+ const auto is_m2_wild = monrace2.wilderness_flags.has_any_of({ MonsterWildernessType::WILD_TOWN, MonsterWildernessType::WILD_ALL });
if (is_m1_wild && is_m2_wild) {
- if (!m1_ref.is_pet() && !m2_ref.is_pet()) {
+ if (!monster1.is_pet() && !monster2.is_pet()) {
return false;
}
}
- if (check_hostile_align(m1_ref.sub_align, m2_ref.sub_align)) {
- if (m1_ref.mflag2.has_not(MonsterConstantFlagType::CHAMELEON) || m2_ref.mflag2.has_not(MonsterConstantFlagType::CHAMELEON)) {
+ if (check_hostile_align(monster1.sub_align, monster2.sub_align)) {
+ if (monster1.mflag2.has_not(MonsterConstantFlagType::CHAMELEON) || monster2.mflag2.has_not(MonsterConstantFlagType::CHAMELEON)) {
return true;
}
}
- if (m1_ref.is_hostile() != m2_ref.is_hostile()) {
+ if (monster1.is_hostile() != monster2.is_hostile()) {
return true;
}
class MonsterRaceInfo;
class MonsterEntity;
class PlayerType;
-bool monster_can_cross_terrain(PlayerType *player_ptr, FEAT_IDX feat, MonsterRaceInfo *r_ptr, BIT_FLAGS16 mode);
+bool monster_can_cross_terrain(PlayerType *player_ptr, FEAT_IDX feat, const MonsterRaceInfo *r_ptr, BIT_FLAGS16 mode);
bool monster_can_enter(PlayerType *player_ptr, POSITION y, POSITION x, MonsterRaceInfo *r_ptr, BIT_FLAGS16 mode);
bool are_enemies(PlayerType *player_ptr, const MonsterEntity &m1_ref, const MonsterEntity &m2_ref);
bool monster_has_hostile_align(PlayerType *player_ptr, MonsterEntity *m_ptr, int pa_good, int pa_evil, MonsterRaceInfo *r_ptr);
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)) {
static auto d_char_is_any_of(concptr symbols)
{
return [symbols](const MonsterEntity &monster) {
- const auto &m_info = monraces_info[monster.r_idx];
- return angband_strchr(symbols, m_info.d_char) != nullptr;
+ const auto &monrace = monster.get_monrace();
+ return angband_strchr(symbols, monrace.d_char) != nullptr;
};
}
{ 0, _("はくしゃくしゃになった。", " crumples.") },
} },
{ [](const MonsterEntity &monster) {
- const auto &m_info = monraces_info[monster.r_idx];
- return d_char_is_any_of("JMR")(monster) || !isalpha(m_info.d_char); },
+ const auto &monrace = monster.get_monrace();
+ return d_char_is_any_of("JMR")(monster) || !isalpha(monrace.d_char); },
{
{ 95, _("はほとんど気にとめていない。", " barely notices.") },
{ 75, _("はシーッと鳴いた。", " hisses.") },
void process_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
turn_flags tmp_flags;
turn_flags *turn_flags_ptr = init_turn_flags(player_ptr->riding, m_idx, &tmp_flags);
turn_flags_ptr->see_m = is_seen(player_ptr, m_ptr);
decide_drop_from_monster(player_ptr, m_idx, turn_flags_ptr->is_riding_mon);
if (m_ptr->mflag2.has(MonsterConstantFlagType::CHAMELEON) && one_in_(13) && !m_ptr->is_asleep()) {
choose_new_monster(player_ptr, m_idx, false, MonsterRace::empty_id());
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
}
turn_flags_ptr->aware = process_stealth(player_ptr, m_idx);
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
int tmp = player_ptr->lev * 6 + (player_ptr->skill_stl + 10) * 4;
if (player_ptr->monlite) {
tmp /= 3;
void decide_drop_from_monster(PlayerType *player_ptr, MONSTER_IDX m_idx, bool is_riding_mon)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!is_riding_mon || ((r_ptr->flags7 & RF7_RIDING) != 0)) {
return;
}
bool awake_monster(PlayerType *player_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_asleep()) {
return true;
}
void process_angar(PlayerType *player_ptr, MONSTER_IDX m_idx, bool see_m)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool gets_angry = false;
if (m_ptr->is_friendly() && has_aggravate(player_ptr)) {
gets_angry = true;
void process_special(PlayerType *player_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->ability_flags.has_not(MonsterAbilityType::SPECIAL) || (m_ptr->r_idx != MonsterRaceId::OHMU) || player_ptr->current_floor_ptr->inside_arena || player_ptr->phase_out || (r_ptr->freq_spell == 0) || (randint1(100) > r_ptr->freq_spell)) {
return;
}
bool decide_monster_multiplication(PlayerType *player_ptr, MONSTER_IDX m_idx, POSITION oy, POSITION ox)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (((r_ptr->flags2 & RF2_MULTIPLY) == 0) || (player_ptr->current_floor_ptr->num_repro >= MAX_REPRODUCTION)) {
return false;
}
bool cast_spell(PlayerType *player_ptr, MONSTER_IDX m_idx, bool aware)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if ((r_ptr->freq_spell == 0) || (randint1(100) > r_ptr->freq_spell)) {
return false;
}
bool decide_process_continue(PlayerType *player_ptr, MonsterEntity *m_ptr)
{
MonsterRaceInfo *r_ptr;
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
if (!player_ptr->no_flowed) {
m_ptr->mflag2.reset(MonsterConstantFlagType::NOFLOW);
}
{
QuestCompletionChecker(player_ptr, m_ptr).complete();
m_ptr->mflag2.set(MonsterConstantFlagType::PET);
- if (monraces_info[m_ptr->r_idx].kind_flags.has_none_of(alignment_mask)) {
+ if (m_ptr->get_monrace().kind_flags.has_none_of(alignment_mask)) {
m_ptr->sub_align = SUB_ALIGN_NEUTRAL;
}
}
}
}
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(has_ld_mask)) {
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(has_ld_mask)) {
rfu.set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
bool monster_is_powerful(FloorType *floor_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
return any_bits(r_ptr->flags2, RF2_POWERFUL);
}
DEPTH monster_level_idx(FloorType *floor_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
return (r_ptr->level >= 1) ? r_ptr->level : 1;
}
*/
int mon_damage_mod(PlayerType *player_ptr, MonsterEntity *m_ptr, int dam, bool is_psy_spear)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL) && dam > 0) {
dam /= 100;
if ((dam == 0) && one_in_(3)) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
switch (mtimed_idx) {
case MTIMED_CSLEEP: {
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto is_wakeup = false;
if (m_ptr->cdis < MAX_MONSTER_SENSING) {
/* Handle "sensing radius" */
break;
case MTIMED_STUNNED: {
- int rlev = monraces_info[m_ptr->r_idx].level;
+ int rlev = m_ptr->get_monrace().level;
/* Recover from stun */
if (set_monster_stunned(player_ptr, m_idx, (randint0(10000) <= rlev * rlev) ? 0 : (m_ptr->get_remaining_stun() - 1))) {
case MTIMED_CONFUSED: {
/* Reduce the confusion */
- if (!set_monster_confused(player_ptr, m_idx, m_ptr->get_remaining_confusion() - randint1(monraces_info[m_ptr->r_idx].level / 20 + 1))) {
+ if (!set_monster_confused(player_ptr, m_idx, m_ptr->get_remaining_confusion() - randint1(m_ptr->get_monrace().level / 20 + 1))) {
break;
}
case MTIMED_MONFEAR: {
/* Reduce the fear */
- if (!set_monster_monfear(player_ptr, m_idx, m_ptr->get_remaining_fear() - randint1(monraces_info[m_ptr->r_idx].level / 20 + 1))) {
+ if (!set_monster_monfear(player_ptr, m_idx, m_ptr->get_remaining_fear() - randint1(m_ptr->get_monrace().level / 20 + 1))) {
break;
}
return;
}
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto *s_ptr = &monraces_info[s_idx];
if (player_ptr->phase_out || (r_ptr->next_exp == 0)) {
auto old_sub_align = m_ptr->sub_align;
/* Hack -- Reduce the racial counter of previous monster */
- m_ptr->get_real_r_ref().cur_num--;
+ m_ptr->get_real_monrace().cur_num--;
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
m_ptr->r_idx = r_ptr->next_r_idx;
/* Count the monsters on the level */
- m_ptr->get_real_r_ref().cur_num++;
+ m_ptr->get_real_monrace().cur_num++;
m_ptr->ap_r_idx = m_ptr->r_idx;
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
m_ptr->max_maxhp = any_bits(r_ptr->flags1, RF1_FORCE_MAXHP) ? maxroll(r_ptr->hdice, r_ptr->hside) : damroll(r_ptr->hdice, r_ptr->hside);
if (ironman_nightmare) {
*/
void update_monster_race_flags(PlayerType *player_ptr, turn_flags *turn_flags_ptr, MonsterEntity *m_ptr)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!is_original_ap_and_seen(player_ptr, m_ptr)) {
return;
}
static bool update_weird_telepathy(PlayerType *player_ptr, um_type *um_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = um_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if ((r_ptr->flags2 & RF2_WEIRD_MIND) == 0) {
return false;
}
static void update_telepathy_sight(PlayerType *player_ptr, um_type *um_ptr, MONSTER_IDX m_idx)
{
auto *m_ptr = um_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (PlayerClass(player_ptr).samurai_stance_is(SamuraiStanceType::MUSOU)) {
um_ptr->flag = true;
um_ptr->m_ptr->mflag.set(MonsterTemporaryFlagType::ESP);
static void update_specific_race_telepathy(PlayerType *player_ptr, um_type *um_ptr)
{
auto *m_ptr = um_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
if ((player_ptr->esp_animal) && r_ptr->kind_flags.has(MonsterKindType::ANIMAL)) {
um_ptr->flag = true;
return false;
}
- auto *r_ptr = &monraces_info[um_ptr->m_ptr->r_idx];
+ auto *r_ptr = &um_ptr->m_ptr->get_monrace();
if (any_bits(r_ptr->flags2, RF2_COLD_BLOOD) && r_ptr->aura_flags.has_not(MonsterAuraType::FIRE)) {
return false;
}
return false;
}
- auto *r_ptr = &monraces_info[um_ptr->m_ptr->r_idx];
+ auto *r_ptr = &um_ptr->m_ptr->get_monrace();
if (r_ptr->flags2 & RF2_INVISIBLE) {
if (player_ptr->see_inv) {
um_ptr->easy = true;
{
POSITION distance = decide_updated_distance(player_ptr, um_ptr);
auto *m_ptr = um_ptr->m_ptr;
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
m_ptr->mflag.reset(MonsterTemporaryFlagType::ESP);
}
if (!player_ptr->effects()->hallucination()->is_hallucinated()) {
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if ((m_ptr->ap_r_idx == MonsterRaceId::KAGE) && (monraces_info[MonsterRaceId::KAGE].r_sights < MAX_SHORT)) {
monraces_info[MonsterRaceId::KAGE].r_sights++;
} else if (m_ptr->is_original_ap() && (r_ptr->r_sights < MAX_SHORT)) {
}
}
- if (w_ptr->is_loading_now && w_ptr->character_dungeon && !player_ptr->phase_out && monraces_info[m_ptr->ap_r_idx].flags2 & RF2_ELDRITCH_HORROR) {
+ if (w_ptr->is_loading_now && w_ptr->character_dungeon && !player_ptr->phase_out && m_ptr->get_real_monrace().flags2 & RF2_ELDRITCH_HORROR) {
m_ptr->mflag.set(MonsterTemporaryFlagType::SANITY_BLAST);
}
um_type tmp_um;
um_type *um_ptr = initialize_um_type(player_ptr, &tmp_um, m_idx, full);
if (disturb_high) {
- MonsterRaceInfo *ap_r_ptr = &monraces_info[um_ptr->m_ptr->ap_r_idx];
+ auto *ap_r_ptr = &um_ptr->m_ptr->get_real_monrace();
if (ap_r_ptr->r_tkills && ap_r_ptr->level >= player_ptr->lev) {
um_ptr->do_disturb = true;
}
void update_smart_learn(PlayerType *player_ptr, MONSTER_IDX m_idx, int what)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!smart_learn || (r_ptr->behavior_flags.has(MonsterBehaviorType::STUPID)) || ((r_ptr->behavior_flags.has_not(MonsterBehaviorType::SMART)) && (randint0(100) < 50))) {
return;
}
, do_spell(DO_SPELL_NONE)
, thrown_spell(MonsterAbilityType::MAX)
{
- this->r_ptr = &monraces_info[this->m_ptr->r_idx];
+ this->r_ptr = &this->m_ptr->get_monrace();
this->no_inate = randint0(100) >= (this->r_ptr->freq_spell * 2);
this->ability_flags = this->r_ptr->ability_flags;
}
return false;
}
- const auto [last_y, last_x] = grid_g.back();
+ const auto &[last_y, last_x] = grid_g.back();
if ((last_y != y2) || (last_x != x2)) {
return false;
}
ProjectResult breath(PlayerType *player_ptr, POSITION y, POSITION x, MONSTER_IDX m_idx, AttributeType typ, int dam_hp, POSITION rad, int target_type)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
BIT_FLAGS flg = PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_BREATH;
if (target_type == MONSTER_TO_PLAYER) {
flg |= PROJECT_PLAYER;
{
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
int hp = (TYPE == DAM_ROLL) ? m_ptr->hp : m_ptr->max_maxhp;
int shoot_dd, shoot_ds;
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ auto *t_ptr = &floor_ptr->m_list[t_idx];
+ auto *tr_ptr = &t_ptr->get_monrace();
mspell_cast_msg_simple msg(_("%s^があなたを引き戻した。", "%s^ commands you to return."),
_("%s^が%sを引き戻した。", "%s^ commands %s to return."));
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
mspell_cast_msg_simple msg(_("%s^にテレポートさせられた。", "%s^ teleports you away."),
_("%s^は%sをテレポートさせた。", "%s^ teleports %s away."));
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
bool resist, saving_throw;
concptr msg_done;
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_use_lite_area = false;
bool monster_to_monster = target_type == MONSTER_TO_MONSTER;
bool monster_to_player = target_type == MONSTER_TO_PLAYER;
const auto &floor_ref = *player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ref.m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->ability_flags.has(MonsterAbilityType::BR_ACID)) {
if (!has_immune_acid(player_ptr) && (player_ptr->oppose_acid || music_singing(player_ptr, MUSIC_RESIST))) {
return true;
std::vector<MonsterAbilityType> dispel;
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[msa_ptr->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->flags2 & RF2_STUPID) {
return rand_choice(msa_ptr->mspells);
}
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
bool monster_to_player = (target_type == MONSTER_TO_PLAYER);
bool monster_to_monster = (target_type == MONSTER_TO_MONSTER);
bool direct = player_bold(player_ptr, y, x);
{
auto *floor_ptr = player_ptr->current_floor_ptr;
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
switch (m_ptr->r_idx) {
case MonsterRaceId::OHMU:
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
bool resist, saving_throw;
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
bool resist, saving_throw;
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
bool resist, saving_throw;
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
bool resist, saving_throw;
auto *floor_ptr = player_ptr->current_floor_ptr;
MonsterEntity *t_ptr = &floor_ptr->m_list[t_idx];
- MonsterRaceInfo *tr_ptr = &monraces_info[t_ptr->r_idx];
+ MonsterRaceInfo *tr_ptr = &t_ptr->get_monrace();
DEPTH rlev = monster_level_idx(floor_ptr, m_idx);
bool resist, saving_throw;
msg_format(_("%s^が何かをつぶやいた。", "%s^ mumbles."), m_name);
}
} else if (mon_to_player || (mon_to_mon && known && see_either)) {
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
#ifdef JP
(void)m_poss;
#endif
summon_disturb(player_ptr, target_type, known, see_either);
auto *m_ptr = &floor_ptr->m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
int num = 1;
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
num += r_ptr->level / 40;
: ability_flags(ability_flags)
{
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
- this->r_ptr = &monraces_info[m_ptr->r_idx];
+ this->r_ptr = &m_ptr->get_monrace();
}
/*!
int danger_amount = 0;
for (MONSTER_IDX monster = 0; monster < player_ptr->current_floor_ptr->m_max; monster++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[monster];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
#include "object-activation/activation-breath.h"
#include "effect/attribute-types.h"
#include "object-enchant/dragon-breaths-table.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "player/player-status.h"
#include "spell-kind/spells-launcher.h"
return false;
}
- auto resistance_flags = object_flags(o_ptr);
+ const auto resistance_flags = o_ptr->get_flags();
AttributeType type[20];
int n = 0;
continue;
}
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
msg_format(_("%s. ", "%s. "), r_ptr->name.data());
}
#include "object-enchant/trc-types.h"
#include "object-hook/hook-armor.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "system/item-entity.h"
#include "system/player-type-definition.h"
#include "system/redrawing-flags-updater.h"
return;
}
- auto oflags = object_flags(o_ptr);
+ const auto oflags = o_ptr->get_flags();
const auto item_name = describe_flavor(player_ptr, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
/* Extra, biased saving throw for blessed items */
}
pa_ptr->attack_damage *= (int)vorpal_magnification;
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((r_ptr->resistance_flags.has(MonsterResistanceType::RESIST_ALL) ? pa_ptr->attack_damage / 100 : pa_ptr->attack_damage) > pa_ptr->m_ptr->hp) {
msg_format(_("%sを真っ二つにした!", "You cut %s in half!"), pa_ptr->m_name);
} else {
#include "object-hook/hook-magic.h"
#include "inventory/inventory-slot-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "perception/object-perception.h"
#include "player-base/player-class.h"
#include "player-info/class-info.h"
}
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
- if (&player_ptr->inventory_list[i] == o_ptr) {
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_ACTIVATE)) {
- return true;
- }
+ if ((&player_ptr->inventory_list[i] == o_ptr) && o_ptr->get_flags().has(TR_ACTIVATE)) {
+ return true;
}
}
#include "object-hook/hook-weapon.h"
#include "object-enchant/tr-types.h"
#include "object-hook/hook-armor.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "player/player-skill.h"
#include "sv-definition/sv-weapon-types.h"
const auto sval = o_ptr->bi_key.sval().value();
switch (player_ptr->pclass) {
case PlayerClassType::PRIEST: {
- const auto flags = object_flags_known(o_ptr);
+ const auto flags = o_ptr->get_flags_known();
return flags.has(TR_BLESSED) || (tval == ItemKindType::HAFTED);
}
case PlayerClassType::MONK:
case PlayerClassType::BEASTMASTER:
case PlayerClassType::CAVALRY: {
/* Is it known to be suitable to using while riding? */
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
return flags.has(TR_RIDING);
}
case PlayerClassType::SORCERER:
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
#include "object/object-broken.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "object/object-stack.h"
#include "player-base/player-class.h"
void ObjectThrowEntity::calc_throw_range()
{
this->q_ptr->copy_from(this->o_ptr);
- this->obj_flags = object_flags(this->q_ptr);
+ this->obj_flags = this->q_ptr->get_flags();
torch_flags(this->q_ptr, this->obj_flags);
distribute_charges(this->o_ptr, this->q_ptr, 1);
this->q_ptr->number = 1;
#include "effect/effect-processor.h"
#include "mind/snipe-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "sv-definition/sv-potion-types.h"
#include "system/baseitem-info.h"
return false;
}
- auto flags = object_flags(o_ptr);
- return flags.has_not(this->ignore_flg);
+ return o_ptr->get_flags().has_not(this->ignore_flg);
}
/*!
+++ /dev/null
-#include "object/object-flags.h"
-#include "mind/mind-weaponsmith.h"
-#include "object-enchant/object-ego.h"
-#include "object-enchant/tr-types.h"
-#include "object/tval-types.h"
-#include "perception/object-perception.h"
-#include "smith/object-smith.h"
-#include "system/artifact-type-definition.h"
-#include "system/baseitem-info.h"
-#include "system/item-entity.h"
-#include "system/player-type-definition.h"
-#include "util/bit-flags-calculator.h"
-
-/*!
- * @brief エゴ光源のフラグを修正する
- *
- * 寿命のある光源で寿命が0ターンの時、光源エゴアイテムに起因するフラグは
- * 灼熱エゴの火炎耐性を除き付与されないようにする。
- *
- * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
- * @param flags フラグ情報を受け取る配列
- */
-static void modify_ego_lite_flags(const ItemEntity *o_ptr, TrFlags &flags)
-{
- if (o_ptr->bi_key.tval() != ItemKindType::LITE) {
- return;
- }
-
- if (!o_ptr->is_lite_requiring_fuel() || o_ptr->fuel != 0) {
- return;
- }
-
- switch (o_ptr->ego_idx) {
- case EgoType::LITE_AURA_FIRE:
- flags.reset(TR_SH_FIRE);
- return;
- case EgoType::LITE_INFRA:
- flags.reset(TR_INFRA);
- return;
- case EgoType::LITE_EYE:
- flags.reset({ TR_RES_BLIND, TR_SEE_INVIS });
- return;
- default:
- return;
- }
-}
-
-/*!
- * @brief オブジェクトのフラグ類を配列に与える
- * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
- * @param flags フラグ情報を受け取る配列
- */
-TrFlags object_flags(const ItemEntity *o_ptr)
-{
- const auto &baseitem = o_ptr->get_baseitem();
- auto flags = baseitem.flags;
-
- if (o_ptr->is_fixed_artifact()) {
- flags = o_ptr->get_fixed_artifact().flags;
- }
-
- if (o_ptr->is_ego()) {
- const auto &ego = o_ptr->get_ego();
- flags.set(ego.flags);
- modify_ego_lite_flags(o_ptr, flags);
- }
-
- flags.set(o_ptr->art_flags);
- if (auto effect = Smith::object_effect(o_ptr); effect.has_value()) {
- auto tr_flags = Smith::get_effect_tr_flags(effect.value());
- flags.set(tr_flags);
- }
-
- if (Smith::object_activation(o_ptr).has_value()) {
- flags.set(TR_ACTIVATE);
- }
-
- return flags;
-}
-
-/*!
- * @brief オブジェクトの明示されているフラグ類を取得する
- * Obtain the "flags" for an item which are known to the player
- * @param o_ptr フラグ取得元のオブジェクト構造体ポインタ
- * @param flags フラグ情報を受け取る配列
- */
-TrFlags object_flags_known(const ItemEntity *o_ptr)
-{
- TrFlags flags{};
- if (!o_ptr->is_aware()) {
- return flags;
- }
-
- const auto &baseitem = o_ptr->get_baseitem();
- flags = baseitem.flags;
- if (!o_ptr->is_known()) {
- return flags;
- }
-
- if (o_ptr->is_ego()) {
- const auto &ego = o_ptr->get_ego();
- flags.set(ego.flags);
- modify_ego_lite_flags(o_ptr, flags);
- }
-
- if (o_ptr->is_fully_known()) {
- if (o_ptr->is_fixed_artifact()) {
- flags = o_ptr->get_fixed_artifact().flags;
- }
-
- flags.set(o_ptr->art_flags);
- }
-
- if (auto effect = Smith::object_effect(o_ptr); effect.has_value()) {
- auto tr_flags = Smith::get_effect_tr_flags(effect.value());
- flags.set(tr_flags);
- }
-
- if (Smith::object_activation(o_ptr).has_value()) {
- flags.set(TR_ACTIVATE);
- }
-
- return flags;
-}
+++ /dev/null
-#pragma once
-
-#include "system/angband.h"
-#include "system/system-variables.h"
-
-#include "object-enchant/tr-flags.h"
-
-class ItemEntity;
-TrFlags object_flags(const ItemEntity *o_ptr);
-TrFlags object_flags_known(const ItemEntity *o_ptr);
#include "object-enchant/activation-info-table.h"
#include "object-enchant/dragon-breaths-table.h"
#include "object-enchant/object-ego.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player/player-realm.h"
#include "realm/realm-names-table.h"
std::string desc = _("", "breathe ");
int n = 0;
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
for (int i = 0; dragonbreath_info[i].flag != 0; i++) {
if (flags.has(dragonbreath_info[i].flag)) {
*/
std::string activation_explanation(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has_not(TR_ACTIVATE)) {
return _("なし", "nothing");
}
#include "object-enchant/object-ego.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
#include "system/artifact-type-definition.h"
#include "system/baseitem-info.h"
#include "system/item-entity.h"
PRICE flag_cost(const ItemEntity *o_ptr, int plusses)
{
PRICE total = 0;
- auto flags = object_flags(o_ptr);
+ auto flags = o_ptr->get_flags();
const auto &baseitem = o_ptr->get_baseitem();
flags.reset(baseitem.flags);
#include "object/object-value.h"
#include "monster-race/monster-race.h"
-#include "object/object-flags.h"
#include "object/object-value-calc.h"
#include "object/tval-types.h"
#include "system/artifact-type-definition.h"
}
PRICE value = baseitem.cost;
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (o_ptr->is_fixed_artifact()) {
const auto &artifact = o_ptr->get_fixed_artifact();
if (!artifact.cost) {
#include "mspell/mspell-damage-calculator.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-base/player-race.h"
#include "player/player-status-flags.h"
#include "player/player-status-resist.h"
/* Search Inventory */
std::vector<int> candidates;
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
- auto *o_ptr = &player_ptr->inventory_list[i];
-
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_WARNING)) {
+ const auto *o_ptr = &player_ptr->inventory_list[i];
+ if (o_ptr->get_flags().has(TR_WARNING)) {
candidates.push_back(i);
}
}
*/
static void spell_damcalc(PlayerType *player_ptr, MonsterEntity *m_ptr, AttributeType typ, int dam, int *max)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
int rlev = r_ptr->level;
bool ignore_wraith_form = false;
continue;
}
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
/* Monster spells (only powerful ones)*/
if (projectable(player_ptr, my, mx, yy, xx)) {
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "sv-definition/sv-amulet-types.h"
#include "sv-definition/sv-other-types.h"
{
std::array<std::string, 128> info{};
int trivial_info = 0;
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
const auto item_text = o_ptr->is_fixed_artifact() ? o_ptr->get_fixed_artifact().text.data() : o_ptr->get_baseitem().text.data();
const auto item_text_lines = shape_buffer(item_text, 77 - 15);
POSITION sx = 0;
int sn = 0;
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!player_ptr->riding || player_ptr->wild_mode) {
return false;
if (!m_ptr->is_valid()) {
continue;
}
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_pet()) {
continue;
if (player_ptr->riding == m_idx) {
total_friend_levels += (r_ptr->level + 5) * 2;
- } else if (!has_a_unique && any_bits(monraces_info[m_ptr->r_idx].flags7, RF7_RIDING)) {
+ } else if (!has_a_unique && any_bits(m_ptr->get_monrace().flags7, RF7_RIDING)) {
total_friend_levels += (r_ptr->level + 5) * 7 / 2;
} else {
total_friend_levels += (r_ptr->level + 5) * 10;
#include "player-ability/player-charisma.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-info/class-info.h"
#include "player-info/mimic-info-table.h"
#include "player-ability/player-constitution.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/class-info.h"
#include "player-ability/player-dexterity.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/class-info.h"
#include "player-ability/player-intelligence.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-info/class-info.h"
#include "player-info/mimic-info-table.h"
#include "player-ability/player-strength.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/monk-data-type.h"
#include "player-ability/player-wisdom.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-info/class-info.h"
#include "player-info/mimic-info-table.h"
attack_teleport_away(player_ptr, pa_ptr, num);
}
- if (pa_ptr->chaos_effect == CE_POLYMORPH && (randint1(90) > monraces_info[pa_ptr->m_ptr->r_idx].level)) {
+ if (pa_ptr->chaos_effect == CE_POLYMORPH && (randint1(90) > pa_ptr->m_ptr->get_monrace().level)) {
attack_polymorph(player_ptr, pa_ptr, y, x);
}
#include "object-enchant/tr-types.h"
#include "object-enchant/vorpal-weapon.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "player-attack/attack-chaos-effect.h"
#include "player-attack/blood-sucking-processor.h"
this->m_idx = this->g_ptr->m_idx;
this->m_ptr = &floor.m_list[this->g_ptr->m_idx];
this->r_idx = this->m_ptr->r_idx;
- this->r_ptr = &monraces_info[this->m_ptr->r_idx];
+ this->r_ptr = &this->m_ptr->get_monrace();
this->ma_ptr = &ma_blows[0];
}
*/
static void get_bare_knuckle_exp(PlayerType *player_ptr, player_attack_type *pa_ptr)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((r_ptr->level + 10) <= player_ptr->lev) {
return;
}
*/
static void get_attack_exp(PlayerType *player_ptr, player_attack_type *pa_ptr)
{
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
auto *o_ptr = &player_ptr->inventory_list[enum2i(INVEN_MAIN_HAND) + pa_ptr->hand];
if (!o_ptr->is_valid()) {
get_bare_knuckle_exp(player_ptr, pa_ptr);
pa_ptr->attack_damage = 0;
}
- auto *r_ptr = &monraces_info[pa_ptr->m_ptr->r_idx];
+ auto *r_ptr = &pa_ptr->m_ptr->get_monrace();
if ((pa_ptr->mode == HISSATSU_ZANMA) && !(!pa_ptr->m_ptr->has_living_flag() && r_ptr->kind_flags.has(MonsterKindType::EVIL))) {
pa_ptr->attack_damage = 0;
}
sound(SOUND_HIT);
print_surprise_attack(pa_ptr);
- pa_ptr->flags = object_flags(o_ptr);
+ pa_ptr->flags = o_ptr->get_flags();
pa_ptr->chaos_effect = select_chaotic_effect(player_ptr, pa_ptr);
pa_ptr->magical_effect = select_magical_brand_effect(player_ptr, pa_ptr);
decide_blood_sucking(player_ptr, pa_ptr);
if (!m_ptr->is_valid()) {
continue;
}
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_pet()) {
continue;
#include "player-info/base-status-info.h"
#include "inventory/inventory-slot-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-info/self-info-util.h"
#include "player/player-status-flags.h"
#include "system/player-type-definition.h"
continue;
}
- auto tflags = object_flags(o_ptr);
+ const auto tflags = o_ptr->get_flags();
self_ptr->flags.set(tflags);
}
#include "player-status/player-basic-statistics.h"
#include "core/window-redrawer.h"
#include "mutation/mutation-flag-types.h"
-#include "object/object-flags.h"
#include "player-base/player-race.h"
#include "player-info/class-info.h"
#include "player-info/mimic-info-table.h"
#include "monster/monster-status.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/equipment-info.h"
int16_t bonus = 0;
auto weight = calc_inventory_weight(this->player_ptr);
if (this->player_ptr->riding) {
- auto *riding_m_ptr = &(this->player_ptr)->current_floor_ptr->m_list[this->player_ptr->riding];
- auto *riding_r_ptr = &monraces_info[riding_m_ptr->r_idx];
- auto count = 1500 + riding_r_ptr->level * 25;
+ const auto &monster = this->player_ptr->current_floor_ptr->m_list[this->player_ptr->riding];
+ const auto &monrace = monster.get_monrace();
+ auto count = 1500 + monrace.level * 25;
if (weight > count) {
bonus -= ((weight - count) / (count / 5));
}
#include "player-status/player-status-base.h"
#include "inventory/inventory-slot-types.h"
-#include "object/object-flags.h"
#include "player/player-status.h"
#include "system/item-entity.h"
#include "system/player-type-definition.h"
continue;
}
- auto o_flags = object_flags(o_ptr);
+ const auto o_flags = o_ptr->get_flags();
if (o_flags.has(check_flag)) {
set_bits(flags, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
}
continue;
}
- auto o_flags = object_flags(o_ptr);
+ const auto o_flags = o_ptr->get_flags();
if (o_flags.has(check_flag)) {
if (o_ptr->pval < 0) {
set_bits(flags, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
this->set_locals(); /* 計算前に値のセット。派生クラスの値がセットされる。*/
int16_t bonus = 0;
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
- auto *o_ptr = &player_ptr->inventory_list[i];
- auto o_flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[i];
+ const auto o_flags = o_ptr->get_flags();
if (!o_ptr->is_valid()) {
continue;
}
int power = 100;
if (!necro && m_ptr) {
- auto *r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ auto *r_ptr = &m_ptr->get_real_monrace();
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
power = r_ptr->level / 2;
if (r_ptr->kind_flags.has_not(MonsterKindType::UNIQUE)) {
#include "object-hook/hook-armor.h"
#include "object/item-tester-hooker.h"
#include "object/object-broken.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/class-info.h"
}
const auto item_name = describe_flavor(player_ptr, o_ptr, OD_OMIT_PREFIX | OD_NAME_ONLY);
- auto item_flags = object_flags(o_ptr);
+ const auto item_flags = o_ptr->get_flags();
if (o_ptr->ac + o_ptr->to_a <= 0) {
msg_format(_("%sは既にボロボロだ!", "Your %s is already fully corroded!"), item_name.data());
return false;
*/
static void process_aura_damage(MonsterEntity *m_ptr, PlayerType *player_ptr, bool immune, MonsterAuraType aura_flag, dam_func dam_func, concptr message)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->aura_flags.has_not(aura_flag) || immune) {
return;
}
const auto *floor_ptr = this->player_ptr->current_floor_ptr;
const auto &monster = floor_ptr->m_list[this->player_ptr->riding];
- const auto &monrace = monraces_info[monster.r_idx];
+ const auto &monrace = monster.get_monrace();
if (((this->player_ptr->skill_exp[PlayerSkillKindType::RIDING] - (RIDING_EXP_BEGINNER * 2)) / 200 < monrace.level) && one_in_(2)) {
this->player_ptr->skill_exp[PlayerSkillKindType::RIDING] += 1;
RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "player-ability/player-charisma.h"
#include "player-ability/player-constitution.h"
#include "player-ability/player-dexterity.h"
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has(tr_flag)) {
set_bits(result, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
return true;
}
- if (player_ptr->riding) {
- MonsterEntity *riding_m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- MonsterRaceInfo *riding_r_ptr = &monraces_info[riding_m_ptr->r_idx];
- if (riding_r_ptr->feature_flags.has(MonsterFeatureType::KILL_WALL)) {
- return true;
- }
+ if (player_ptr->riding == 0) {
+ return false;
}
- return false;
+ const auto &riding_monster = player_ptr->current_floor_ptr->m_list[player_ptr->riding];
+ const auto &riding_monrace = riding_monster.get_monrace();
+ return riding_monrace.feature_flags.has(MonsterFeatureType::KILL_WALL);
}
/*!
*/
bool has_pass_wall(PlayerType *player_ptr)
{
- bool pow = false;
-
if (player_ptr->wraith_form || player_ptr->tim_pass_wall || PlayerRace(player_ptr).equals(PlayerRaceType::SPECTRE)) {
- pow = true;
+ return true;
}
- if (player_ptr->riding) {
- MonsterEntity *riding_m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- MonsterRaceInfo *riding_r_ptr = &monraces_info[riding_m_ptr->r_idx];
- if (riding_r_ptr->feature_flags.has_not(MonsterFeatureType::PASS_WALL)) {
- pow = false;
- }
+ if (player_ptr->riding == 0) {
+ return false;
}
- return pow;
+ const auto &monster = player_ptr->current_floor_ptr->m_list[player_ptr->riding];
+ const auto &monrace = monraces_info[monster.r_idx];
+ return monrace.feature_flags.has(MonsterFeatureType::PASS_WALL);
}
/*!
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has(TR_WARNING)) {
if (!o_ptr->is_inscribed() || !angband_strchr(o_ptr->inscription->data(), '$')) {
}
// 乗馬中は実際に浮遊するかどうかは乗馬中のモンスターに依存する
- if (player_ptr->riding) {
- MonsterEntity *riding_m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- MonsterRaceInfo *riding_r_ptr = &monraces_info[riding_m_ptr->r_idx];
- result = riding_r_ptr->feature_flags.has(MonsterFeatureType::CAN_FLY) ? FLAG_CAUSE_RIDING : FLAG_CAUSE_NONE;
+ if (player_ptr->riding == 0) {
+ return result;
}
- return result;
+ const auto &monster = player_ptr->current_floor_ptr->m_list[player_ptr->riding];
+ const auto &monrace = monraces_info[monster.r_idx];
+ return monrace.feature_flags.has(MonsterFeatureType::CAN_FLY) ? FLAG_CAUSE_RIDING : FLAG_CAUSE_NONE;
}
bool has_can_swim(PlayerType *player_ptr)
{
- bool can_swim = false;
- if (player_ptr->riding) {
- MonsterEntity *riding_m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- MonsterRaceInfo *riding_r_ptr = &monraces_info[riding_m_ptr->r_idx];
- if (riding_r_ptr->feature_flags.has_any_of({ MonsterFeatureType::CAN_SWIM, MonsterFeatureType::AQUATIC })) {
- can_swim = true;
- }
+ if (player_ptr->riding == 0) {
+ return false;
}
- return can_swim;
+ const auto &monster = player_ptr->current_floor_ptr->m_list[player_ptr->riding];
+ const auto &monrace = monraces_info[monster.r_idx];
+ return monrace.feature_flags.has_any_of({ MonsterFeatureType::CAN_SWIM, MonsterFeatureType::AQUATIC });
}
BIT_FLAGS has_slow_digest(PlayerType *player_ptr)
if (!o_ptr->is_valid()) {
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has(TR_AGGRAVATE)) {
player_ptr->cursed.set(CurseTraitType::AGGRAVATE);
}
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has(TR_BLOWS)) {
if ((i == INVEN_MAIN_HAND || i == INVEN_MAIN_RING) && !two_handed) {
player_ptr->extra_blows[0] += o_ptr->pval;
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has(TR_VUL_CURSE) || o_ptr->curse_flags.has(CurseTraitType::VUL_CURSE)) {
set_bits(result, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
continue;
}
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if ((flags.has(TR_VUL_CURSE) || o_ptr->curse_flags.has(CurseTraitType::VUL_CURSE)) && o_ptr->curse_flags.has(CurseTraitType::HEAVY_CURSE)) {
set_bits(result, convert_inventory_slot_type_to_flag_cause(i2enum<inventory_slot_type>(i)));
*/
bool is_wielding_icky_weapon(PlayerType *player_ptr, int i)
{
- auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
- auto flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
+ const auto flags = o_ptr->get_flags();
const auto tval = o_ptr->bi_key.tval();
const auto has_no_weapon = (tval == ItemKindType::NONE) || (tval == ItemKindType::SHIELD);
*/
bool is_wielding_icky_riding_weapon(PlayerType *player_ptr, int i)
{
- auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
- auto flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
+ const auto flags = o_ptr->get_flags();
const auto tval = o_ptr->bi_key.tval();
const auto has_no_weapon = (tval == ItemKindType::NONE) || (tval == ItemKindType::SHIELD);
const auto is_suitable = o_ptr->is_lance() || flags.has(TR_RIDING);
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
#include "object-hook/hook-weapon.h"
-#include "object/object-flags.h"
#include "player-base/player-race.h"
#include "player-info/class-info.h"
#include "player-info/race-info.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
#include "object-hook/hook-armor.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "object/object-mark-types.h"
#include "perception/object-perception.h"
if (any_bits(mp_ptr->spell_xtra, extra_magic_glove_reduce_mana)) {
player_ptr->cumber_glove = false;
- auto *o_ptr = &player_ptr->inventory_list[INVEN_ARMS];
- auto flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[INVEN_ARMS];
+ const auto flags = o_ptr->get_flags();
auto should_mp_decrease = o_ptr->is_valid();
should_mp_decrease &= flags.has_not(TR_FREE_ACT);
should_mp_decrease &= flags.has_not(TR_DEC_MANA);
continue;
}
- auto flags = object_flags(q_ptr);
- if (flags.has(TR_XTRA_SHOTS)) {
+ if (q_ptr->get_flags().has(TR_XTRA_SHOTS)) {
extra_shots++;
}
}
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_XTRA_SHOTS)) {
+ if (o_ptr->get_flags().has(TR_XTRA_SHOTS)) {
extra_shots++;
}
if (!o_ptr->is_valid()) {
continue;
}
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_MAGIC_MASTERY)) {
+
+ if (o_ptr->get_flags().has(TR_MAGIC_MASTERY)) {
pow += 8 * o_ptr->pval;
}
}
if (!o_ptr->is_valid()) {
continue;
}
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_SEARCH)) {
+
+ if (o_ptr->get_flags().has(TR_SEARCH)) {
pow += (o_ptr->pval * 5);
}
}
if (!o_ptr->is_valid()) {
continue;
}
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_SEARCH)) {
+
+ if (o_ptr->get_flags().has(TR_SEARCH)) {
pow += (o_ptr->pval * 5);
}
}
if (!o_ptr->is_valid()) {
continue;
}
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_TUNNEL)) {
+
+ if (o_ptr->get_flags().has(TR_TUNNEL)) {
pow += (o_ptr->pval * 20);
}
}
static int16_t calc_num_blow(PlayerType *player_ptr, int i)
{
- ItemEntity *o_ptr;
int16_t num_blow = 1;
- o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
- auto flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
PlayerClass pc(player_ptr);
if (has_melee_weapon(player_ptr, INVEN_MAIN_HAND + i)) {
if (o_ptr->is_valid() && !player_ptr->heavy_wield[i]) {
wgt = info.wgt;
mul = info.mul;
- if (pc.equals(PlayerClassType::CAVALRY) && player_ptr->riding && flags.has(TR_RIDING)) {
+ if (pc.equals(PlayerClassType::CAVALRY) && player_ptr->riding && o_ptr->get_flags().has(TR_RIDING)) {
num = 5;
wgt = 70;
mul = 4;
}
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
- ItemEntity *o_ptr;
- o_ptr = &player_ptr->inventory_list[i];
- auto flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[i];
+ const auto flags = o_ptr->get_flags();
if (!o_ptr->is_valid()) {
continue;
}
ac += o_ptr->to_a;
}
- if (o_ptr->curse_flags.has(CurseTraitType::LOW_AC) || object_flags(o_ptr).has(TR_LOW_AC)) {
+ if (o_ptr->curse_flags.has(CurseTraitType::LOW_AC) || flags.has(TR_LOW_AC)) {
if (o_ptr->curse_flags.has(CurseTraitType::HEAVY_CURSE)) {
if (is_real_value || o_ptr->is_fully_known()) {
ac -= 30;
int penalty = 0;
if (has_melee_weapon(player_ptr, INVEN_MAIN_HAND) && has_melee_weapon(player_ptr, INVEN_SUB_HAND)) {
- auto flags = object_flags(&player_ptr->inventory_list[INVEN_SUB_HAND]);
+ const auto flags = player_ptr->inventory_list[INVEN_SUB_HAND].get_flags();
penalty = ((100 - player_ptr->skill_exp[PlayerSkillKindType::TWO_WEAPON] / 160) - (130 - player_ptr->inventory_list[slot].weight) / 8);
if (set_quick_and_tiny(player_ptr) || set_icing_and_twinkle(player_ptr) || set_anubis_and_chariot(player_ptr)) {
static short calc_to_damage(PlayerType *player_ptr, INVENTORY_IDX slot, bool is_real_value)
{
- auto *o_ptr = &player_ptr->inventory_list[slot];
- auto flags = object_flags(o_ptr);
-
+ const auto *o_ptr = &player_ptr->inventory_list[slot];
player_hand calc_hand = PLAYER_HAND_OTHER;
if (slot == INVEN_MAIN_HAND) {
calc_hand = PLAYER_HAND_MAIN;
damage -= player_stun->get_damage_penalty();
PlayerClass pc(player_ptr);
const auto tval = o_ptr->bi_key.tval();
- if (pc.equals(PlayerClassType::PRIEST) && (flags.has_not(TR_BLESSED)) && ((tval == ItemKindType::SWORD) || (tval == ItemKindType::POLEARM))) {
+ if (pc.equals(PlayerClassType::PRIEST) && (o_ptr->get_flags().has_not(TR_BLESSED)) && ((tval == ItemKindType::SWORD) || (tval == ItemKindType::POLEARM))) {
damage -= 2;
} else if (pc.equals(PlayerClassType::BERSERKER)) {
damage += player_ptr->lev / 6;
/* Bonuses and penalties by weapon */
PlayerClass pc(player_ptr);
if (has_melee_weapon(player_ptr, slot)) {
- auto *o_ptr = &player_ptr->inventory_list[slot];
- auto flags = object_flags(o_ptr);
+ const auto *o_ptr = &player_ptr->inventory_list[slot];
/* Traind bonuses */
const auto tval = o_ptr->bi_key.tval();
}
/* Riding bonus and penalty */
+ const auto flags = o_ptr->get_flags();
if (player_ptr->riding > 0) {
if (o_ptr->is_lance()) {
hit += 15;
#include "mind/mind-elementalist.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player-base/player-race.h"
#include "player-info/race-info.h"
continue;
}
- auto o_flags = object_flags_known(o_ptr);
+ auto o_flags = o_ptr->get_flags_known();
if (o_flags.has(TR_IM_ACID)) {
flags.set(TR_RES_ACID);
}
#include "object-hook/hook-armor.h"
#include "object/item-tester-hooker.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "player/attack-defense-types.h"
#include "player/player-skill.h"
#include "player/player-status.h"
}
const auto item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
- auto f = object_flags(o_ptr);
-
if (!input_check(format(_("本当に %s を呪いますか?", "Do you curse %s, really?"), item_name.data()))) {
return "";
}
- if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || f.has(TR_BLESSED))) {
+ if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || o_ptr->get_flags().has(TR_BLESSED))) {
msg_format(_("%s は呪いを跳ね返した。", "%s resists the effect."), item_name.data());
if (one_in_(3)) {
if (o_ptr->to_d > 0) {
o_ptr = &player_ptr->inventory_list[item];
const auto item_name = describe_flavor(player_ptr, o_ptr, OD_NAME_ONLY);
- auto f = object_flags(o_ptr);
-
if (!input_check(format(_("本当に %s を呪いますか?", "Do you curse %s, really?"), item_name.data()))) {
return "";
}
- if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || f.has(TR_BLESSED))) {
+ if (!one_in_(3) && (o_ptr->is_fixed_or_random_artifact() || o_ptr->get_flags().has(TR_BLESSED))) {
msg_format(_("%s は呪いを跳ね返した。", "%s resists the effect."), item_name.data());
if (one_in_(3)) {
if (o_ptr->to_d > 0) {
return "";
}
- auto f = object_flags(o_ptr);
-
player_ptr->csp += (player_ptr->lev / 5) + randint1(player_ptr->lev / 5);
- if (f.has(TR_TY_CURSE) || o_ptr->curse_flags.has(CurseTraitType::TY_CURSE)) {
+ if (o_ptr->get_flags().has(TR_TY_CURSE) || o_ptr->curse_flags.has(CurseTraitType::TY_CURSE)) {
player_ptr->csp += randint1(5);
}
if (player_ptr->csp > player_ptr->msp) {
#include "monster/monster-info.h"
#include "monster/monster-update.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-info/equipment-info.h"
#include "player/player-damage.h"
#include "player/player-move.h"
lite_spot(player_ptr, oy, ox);
lite_spot(player_ptr, ty, tx);
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(ld_mask)) {
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(ld_mask)) {
RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
}
o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
damage = o_ptr->to_d * 100;
- auto flags = object_flags(o_ptr);
// @todo ヴォーパルの多重定義.
if (o_ptr->is_specific_artifact(FixedArtifactId::VORPAL_BLADE) || o_ptr->is_specific_artifact(FixedArtifactId::CHAINSWORD)) {
/* vorpal blade */
basedam *= 5;
basedam /= 3;
- } else if (flags.has(TR_VORPAL)) {
+ } else if (o_ptr->get_flags().has(TR_VORPAL)) {
/* vorpal flag only */
basedam *= 11;
basedam /= 9;
m_ptr = &player_ptr->current_floor_ptr->m_list[m_idx];
/* Monster cannot move back? */
- if (!monster_can_enter(player_ptr, ny, nx, &monraces_info[m_ptr->r_idx], 0)) {
+ if (!monster_can_enter(player_ptr, ny, nx, &m_ptr->get_monrace(), 0)) {
/* -more- */
if (i < 2) {
msg_print(nullptr);
o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + i];
basedam = (o_ptr->dd * (o_ptr->ds + 1)) * 50;
damage = o_ptr->to_d * 100;
- auto flags = object_flags(o_ptr);
// @todo ヴォーパルの多重定義.
if (o_ptr->is_specific_artifact(FixedArtifactId::VORPAL_BLADE) || o_ptr->is_specific_artifact(FixedArtifactId::CHAINSWORD)) {
/* vorpal blade */
basedam *= 5;
basedam /= 3;
- } else if (flags.has(TR_VORPAL)) {
+ } else if (o_ptr->get_flags().has(TR_VORPAL)) {
/* vorpal flag only */
basedam *= 11;
basedam /= 9;
que.emplace(y, x);
while (!que.empty()) {
+ // 参照で受けるとダングリング状態になるのでコピーする.
const auto [y_cur, x_cur] = que.front();
que.pop();
#include "object-enchant/tr-flags.h"
#include "object-enchant/tr-types.h"
#include "object/item-tester-hooker.h"
-#include "object/object-flags.h"
#include "perception/object-perception.h"
#include "player-base/player-class.h"
#include "player-info/smith-data-type.h"
Smith::DrainEssenceResult Smith::drain_essence(ItemEntity *o_ptr)
{
// 抽出量を揃えるためKILLフラグのみ付いている場合はSLAYフラグも付ける
- auto old_flags = object_flags(o_ptr);
+ auto old_flags = o_ptr->get_flags();
if (old_flags.has(TR_KILL_DRAGON)) {
old_flags.set(TR_SLAY_DRAGON);
}
object_aware(player_ptr, o_ptr);
object_known(o_ptr);
- auto new_flags = object_flags(o_ptr);
+ const auto new_flags = o_ptr->get_flags();
std::unordered_map<SmithEssenceType, int> drain_values;
#include "smith/smith-info.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "smith/smith-types.h"
#include "sv-definition/sv-weapon-types.h"
void BasicSmithInfo::erase_essence(ItemEntity *o_ptr) const
{
o_ptr->smith_effect = std::nullopt;
- auto flags = object_flags(o_ptr);
- if (flags.has_none_of(TR_PVAL_FLAG_MASK)) {
+ if (o_ptr->get_flags().has_none_of(TR_PVAL_FLAG_MASK)) {
o_ptr->pval = 0;
}
}
#include "main/sound-definitions-table.h"
#include "main/sound-of-music.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-attack/player-attack.h"
#include "player-base/player-class.h"
#include "player-info/race-info.h"
msg_print(_("振り回した大鎌が自分自身に返ってきた!", "Your scythe returns to you!"));
auto *o_ptr = &player_ptr->inventory_list[INVEN_MAIN_HAND + pa_ptr->hand];
- auto death_scythe_flags = object_flags(o_ptr);
+ const auto death_scythe_flags = o_ptr->get_flags();
pa_ptr->attack_damage = damroll(o_ptr->dd + player_ptr->to_dd[pa_ptr->hand], o_ptr->ds + player_ptr->to_ds[pa_ptr->hand]);
int magnification = calc_death_scythe_reflection_magnification(player_ptr);
compensate_death_scythe_reflection_magnification(player_ptr, &magnification, death_scythe_flags);
#include "mind/mind-ninja.h"
#include "object-enchant/object-ego.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "player/special-defense-types.h"
#include "sv-definition/sv-lite-types.h"
{
player_ptr->cur_lite = 0;
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
- ItemEntity *o_ptr;
- o_ptr = &player_ptr->inventory_list[i];
- auto flags = object_flags(o_ptr);
-
+ const auto *o_ptr = &player_ptr->inventory_list[i];
if (!o_ptr->is_valid()) {
continue;
}
player_ptr->cur_lite++;
}
+ const auto flags = o_ptr->get_flags();
if (flags.has_not(TR_DARK_SOURCE)) {
if (o_ptr->bi_key.tval() == ItemKindType::LITE) {
const auto sval = o_ptr->bi_key.sval();
}
for (auto path_g_ite = path_g.begin(); path_g_ite != path_g.end(); path_g_ite++) {
- const auto [oy, ox] = *(path_g_ite == path_g.begin() ? path_g.begin() : path_g_ite - 1);
- const auto [ny, nx] = *path_g_ite;
+ const auto &[oy, ox] = *(path_g_ite == path_g.begin() ? path_g.begin() : path_g_ite - 1);
+ const auto &[ny, nx] = *path_g_ite;
if (delay_factor > 0 && !this->player_ptr->effects()->blindness()->is_blind()) {
if (panel_contains(ny, nx) && player_has_los_bold(this->player_ptr, ny, nx)) {
(void)affect_feature(this->player_ptr, 0, 0, py, px, dam, typ);
}
- const auto [y, x] = path_g.back();
+ const auto &[y, x] = path_g.back();
if (!floor_ptr->grid_array[y][x].is_mirror()) {
break;
std::vector<std::pair<int, int>> drawn_last_pos_list;
for (const auto &it : pos_list) {
- const auto [y, x] = (n == 1) ? center : *std::next(it, -1);
- const auto [ny, nx] = *it;
+ const auto &[y, x] = (n == 1) ? center : *std::next(it, -1);
+ const auto &[ny, nx] = *it;
if (panel_contains(y, x) && player_has_los_bold(player_ptr, y, x)) {
print_bolt_pict(player_ptr, y, x, y, x, typ);
}
{
- const auto [y, x] = path_g.back();
+ const auto &[y, x] = path_g.back();
if (floor_ptr->grid_array[y][x].is_mirror()) {
this->remove_mirror(y, x);
auto project_flag = flag;
std::map<int, std::vector<projection_path::const_iterator>> pos_list_map;
for (const auto &second_path_g : second_path_g_list) {
for (auto it = second_path_g.begin(); it != second_path_g.end(); ++it) {
- const auto [o_y, o_x] = path_g.back();
- const auto [y, x] = *it;
+ const auto &[o_y, o_x] = path_g.back();
+ const auto &[y, x] = *it;
auto d = distance(o_y, o_x, y, x);
pos_list_map[d].push_back(it);
}
rand_shuffle(pos_list.begin(), pos_list.end());
for (const auto &it : pos_list) {
- const auto [y, x] = *it;
+ const auto &[y, x] = *it;
res.notice |= activate_super_ray_effect(player_ptr, y, x, dam, flag);
}
}
}
auto *m_ptr = &floor_ptr->m_list[gg_ptr->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (r_ptr->flags1 & RF1_QUESTOR) {
map[16 + yy - cy][16 + xx - cx] = false;
continue;
bool flag = false;
for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
auto flag = false;
for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
auto flag = false;
for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
auto flag = false;
for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
auto flag = false;
for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
update_monster(player_ptr, m_idx, true);
lite_spot(player_ptr, target_row, target_col);
lite_spot(player_ptr, ty, tx);
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(ld_mask)) {
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(ld_mask)) {
RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
if (g_ptr->m_idx) {
auto *m_ptr = &floor_ptr->m_list[g_ptr->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (in_generate) /* In generation */
{
{
auto &floor = *player_ptr->current_floor_ptr;
auto *m_ptr = &floor.m_list[m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (m_ptr->is_pet() && !player_cast) {
return false;
}
auto result = false;
for (short i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid() || (r_ptr->d_char != symbol)) {
continue;
}
bool result = false;
for (MONSTER_IDX i = 1; i < floor.m_max; i++) {
auto *m_ptr = &floor.m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
if (g_ptr->m_idx) {
PERCENTAGE chance = 25;
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
update_monster(player_ptr, g_ptr->m_idx, false);
if (r_ptr->behavior_flags.has(MonsterBehaviorType::STUPID)) {
chance = 10;
}
MonsterRaceInfo *r_ptr;
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
if (r_ptr->kind_flags.has(MonsterKindType::UNIQUE)) {
const auto m_name = monster_desc(player_ptr, m_ptr, 0x00);
msg_format(_("%sは爆破されるのを嫌がり、勝手に自分の世界へと帰った。", "%s^ resists being blasted and runs away."), m_name.data());
auto probe = false;
for (int i = 1; i < player_ptr->current_floor_ptr->m_max; i++) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[i];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (!m_ptr->is_valid()) {
continue;
}
#include "monster/monster-update.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-base/player-class.h"
#include "player/player-move.h"
#include "player/player-status.h"
MonsterEntity *m_ptr;
MonsterRaceInfo *r_ptr;
m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
(void)set_monster_csleep(player_ptr, g_ptr->m_idx, 0);
lite_spot(player_ptr, oy, ox);
lite_spot(player_ptr, ny, nx);
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(ld_mask)) {
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(ld_mask)) {
RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
lite_spot(player_ptr, oy, ox);
lite_spot(player_ptr, ny, nx);
- if (monraces_info[m_ptr->r_idx].brightness_flags.has_any_of(ld_mask)) {
+ if (m_ptr->get_monrace().brightness_flags.has_any_of(ld_mask)) {
RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::MONSTER_LITE);
}
}
MONSTER_IDX tmp_m_idx = player_ptr->current_floor_ptr->grid_array[oy + yy][ox + xx].m_idx;
if (tmp_m_idx && (player_ptr->riding != tmp_m_idx)) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[tmp_m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_follow = r_ptr->ability_flags.has(MonsterAbilityType::TPORT);
can_follow &= r_ptr->resistance_flags.has_not(MonsterResistanceType::RESIST_TELEPORT);
}
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[tmp_m_idx];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
bool can_follow = r_ptr->ability_flags.has(MonsterAbilityType::TPORT);
can_follow &= r_ptr->resistance_flags.has_not(MonsterResistanceType::RESIST_TELEPORT);
for (i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
o_ptr = &player_ptr->inventory_list[i];
- if (o_ptr->is_valid() && !o_ptr->is_cursed()) {
- auto flags = object_flags(o_ptr);
- if (flags.has(TR_TELEPORT)) {
- follow = true;
- break;
- }
+ if (o_ptr->is_valid() && !o_ptr->is_cursed() && o_ptr->get_flags().has(TR_TELEPORT)) {
+ follow = true;
+ break;
}
}
}
MonsterEntity *m_ptr;
MonsterRaceInfo *r_ptr;
m_ptr = &player_ptr->current_floor_ptr->m_list[target_m_idx];
- r_ptr = &monraces_info[m_ptr->r_idx];
+ r_ptr = &m_ptr->get_monrace();
const auto m_name = monster_desc(player_ptr, m_ptr, 0);
msg_format(_("%s^の足を指さした。", "You gesture at %s^'s feet."), m_name.data());
#include "io/input-key-acceptor.h"
#include "object-enchant/object-ego.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "player-info/equipment-info.h"
#include "player/attack-defense-types.h"
#include "player/special-defense-types.h"
constexpr auto fmt = _("どの呪文の詠唱を中断しますか?(呪文 %c-%c, 'l'全て, ESC)", "Which spell do you stop casting? (Spell %c-%c, 'l' to all, ESC)");
const auto prompt = format(fmt, I2A(0), I2A(casting_num - 1));
screen_save();
- const auto [is_all, choice] = select_spell_stopping(prompt);
+ const auto &[is_all, choice] = select_spell_stopping(prompt);
if (is_all) {
return true;
}
bool SpellHex::check_hex_barrier(MONSTER_IDX m_idx, spell_hex_type type) const
{
const auto *m_ptr = &this->player_ptr->current_floor_ptr->m_list[m_idx];
- const auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ const auto *r_ptr = &m_ptr->get_monrace();
return this->is_spelling_specific(type) && ((this->player_ptr->lev * 3 / 2) >= randint1(r_ptr->level));
}
auto *floor_ptr = player_ptr->current_floor_ptr;
while (bdis <= mdis) {
if ((0 < dist) && (path_n < dist)) {
- const auto [ny, nx] = path[path_n];
+ const auto &[ny, nx] = path[path_n];
POSITION nd = distance(ny, nx, y1, x1);
if (bdis >= nd) {
*/
bool common_saving_throw_charm(PlayerType *player_ptr, int pow, MonsterEntity *m_ptr)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (player_ptr->current_floor_ptr->inside_arena) {
return true;
*/
bool common_saving_throw_control(PlayerType *player_ptr, int pow, MonsterEntity *m_ptr)
{
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (player_ptr->current_floor_ptr->inside_arena) {
return true;
#include "monster-race/monster-race.h"
#include "monster-race/race-flags3.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/object-value.h"
#include "object/tval-types.h"
#include "store/store-util.h"
*/
static bool is_blessed_item(const ItemEntity *item_ptr)
{
- auto flags = object_flags(item_ptr);
- return flags.has(TR_BLESSED);
+ return item_ptr->get_flags().has(TR_BLESSED);
}
static bool check_store_general(const ItemEntity &item)
#include "monster-race/monster-race.h"
#include "object-enchant/object-curse.h"
#include "object-enchant/special-object-flags.h"
-#include "object/object-flags.h"
#include "object/object-value.h"
#include "object/tval-types.h"
#include "smith/object-smith.h"
return false;
}
- auto flags = object_flags(this);
+ const auto flags = this->get_flags();
return flags.has(TR_ACTIVATE);
}
{
return ArtifactsInfo::get_instance().get_artifact(this->fixed_artifact_idx);
}
+
+TrFlags ItemEntity::get_flags() const
+{
+ const auto &baseitem = this->get_baseitem();
+ auto flags = baseitem.flags;
+
+ if (this->is_fixed_artifact()) {
+ flags = this->get_fixed_artifact().flags;
+ }
+
+ if (this->is_ego()) {
+ const auto &ego = this->get_ego();
+ flags.set(ego.flags);
+ this->modify_ego_lite_flags(flags);
+ }
+
+ flags.set(this->art_flags);
+ if (auto effect = Smith::object_effect(this); effect.has_value()) {
+ auto tr_flags = Smith::get_effect_tr_flags(effect.value());
+ flags.set(tr_flags);
+ }
+
+ if (Smith::object_activation(this).has_value()) {
+ flags.set(TR_ACTIVATE);
+ }
+
+ return flags;
+}
+
+TrFlags ItemEntity::get_flags_known() const
+{
+ TrFlags flags{};
+ if (!this->is_aware()) {
+ return flags;
+ }
+
+ const auto &baseitem = this->get_baseitem();
+ flags = baseitem.flags;
+ if (!this->is_known()) {
+ return flags;
+ }
+
+ if (this->is_ego()) {
+ const auto &ego = this->get_ego();
+ flags.set(ego.flags);
+ this->modify_ego_lite_flags(flags);
+ }
+
+ if (this->is_fully_known()) {
+ if (this->is_fixed_artifact()) {
+ flags = this->get_fixed_artifact().flags;
+ }
+
+ flags.set(this->art_flags);
+ }
+
+ if (auto effect = Smith::object_effect(this); effect.has_value()) {
+ auto tr_flags = Smith::get_effect_tr_flags(effect.value());
+ flags.set(tr_flags);
+ }
+
+ if (Smith::object_activation(this).has_value()) {
+ flags.set(TR_ACTIVATE);
+ }
+
+ return flags;
+}
+
+/*!
+ * @brief エゴ光源のフラグを修正する
+ *
+ * 寿命のある光源で寿命が0ターンの時、光源エゴアイテムに起因するフラグは
+ * 灼熱エゴの火炎耐性を除き付与されないようにする。
+ *
+ * @param flags フラグ情報を受け取る配列
+ */
+void ItemEntity::modify_ego_lite_flags(TrFlags &flags) const
+{
+ if (this->bi_key.tval() != ItemKindType::LITE) {
+ return;
+ }
+
+ if (!this->is_lite_requiring_fuel() || this->fuel != 0) {
+ return;
+ }
+
+ switch (this->ego_idx) {
+ case EgoType::LITE_AURA_FIRE:
+ flags.reset(TR_SH_FIRE);
+ return;
+ case EgoType::LITE_INFRA:
+ flags.reset(TR_INFRA);
+ return;
+ case EgoType::LITE_EYE:
+ flags.reset({ TR_RES_BLIND, TR_SEE_INVIS });
+ return;
+ default:
+ return;
+ }
+}
BaseitemInfo &get_baseitem() const;
EgoItemDefinition &get_ego() const;
ArtifactType &get_fixed_artifact() const;
+ TrFlags get_flags() const;
+ TrFlags get_flags_known() const;
private:
int get_baseitem_price() const;
int calc_figurine_value() const;
int calc_capture_value() const;
+ void modify_ego_lite_flags(TrFlags &flags) const;
};
return true;
}
- const auto &r_ref = monraces_info[this->ap_r_idx];
+ const auto &r_ref = this->get_real_monrace();
const auto mimic_symbols = "/|\\()[]=$,.!?&`#%<>+~";
if (angband_strchr(mimic_symbols, r_ref.d_char) == nullptr) {
return false;
return MonsterRace(this->r_idx).is_valid();
}
-MonsterRaceId MonsterEntity::get_real_r_idx() const
+MonsterRaceId MonsterEntity::get_real_monrace_id() const
{
- const auto &r_ref = monraces_info[this->r_idx];
+ const auto &monrace = this->get_monrace();
if (this->mflag2.has_not(MonsterConstantFlagType::CHAMELEON)) {
return this->r_idx;
}
- return r_ref.kind_flags.has(MonsterKindType::UNIQUE) ? MonsterRaceId::CHAMELEON_K : MonsterRaceId::CHAMELEON;
+ return monrace.kind_flags.has(MonsterKindType::UNIQUE) ? MonsterRaceId::CHAMELEON_K : MonsterRaceId::CHAMELEON;
}
/*!
- * @brief モンスターの真の種族を返す / Extract monster race pointer of a monster's true form
- * @return 本当のモンスター種族参照ポインタ
+ * @brief モンスターの真の種族定義を返す (CHAMAELEONフラグ専用)
+ * @return 真のモンスター種族参照
*/
-MonsterRaceInfo &MonsterEntity::get_real_r_ref() const
+MonsterRaceInfo &MonsterEntity::get_real_monrace() const
{
- return monraces_info[this->get_real_r_idx()];
+ return monraces_info[this->get_real_monrace_id()];
+}
+
+MonsterRaceInfo &MonsterEntity::get_monrace() const
+{
+ return monraces_info[this->r_idx];
}
short MonsterEntity::get_remaining_sleep() const
*/
bool MonsterEntity::has_living_flag(bool is_apperance) const
{
- const auto &monrace = monraces_info[is_apperance ? this->ap_r_idx : this->r_idx];
+ const auto &monrace = is_apperance ? this->get_real_monrace() : this->get_monrace();
return monrace.has_living_flag();
}
bool MonsterEntity::is_explodable() const
{
- const auto &monrace = monraces_info[this->r_idx];
+ const auto &monrace = this->get_monrace();
return monrace.is_explodable();
}
std::string MonsterEntity::get_died_message() const
{
- const auto &monrace = monraces_info[this->r_idx];
+ const auto &monrace = this->get_monrace();
return monrace.get_died_message();
}
bool is_original_ap() const;
bool is_mimicry() const;
bool is_valid() const;
- MonsterRaceId get_real_r_idx() const;
- MonsterRaceInfo &get_real_r_ref() const;
+ MonsterRaceId get_real_monrace_id() const;
+ MonsterRaceInfo &get_real_monrace() const;
+ MonsterRaceInfo &get_monrace() const;
short get_remaining_sleep() const;
short get_remaining_acceleration() const;
short get_remaining_deceleration() const;
return true;
}
- const auto [y, x] = grid_g.back();
+ const auto &[y, x] = grid_g.back();
if ((y != y2) || (x != x2)) {
return false;
}
{
POSITION y = player_ptr->y;
POSITION x = player_ptr->x;
- const auto [wid, hgt] = get_screen_size();
+ const auto &[wid, hgt] = get_screen_size();
int max_prow_min = player_ptr->current_floor_ptr->height - hgt;
int max_pcol_min = player_ptr->current_floor_ptr->width - wid;
if (max_prow_min < 0) {
*/
static std::string evaluate_monster_exp(PlayerType *player_ptr, MonsterEntity *m_ptr)
{
- MonsterRaceInfo *ap_r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ MonsterRaceInfo *ap_r_ptr = &m_ptr->get_real_monrace();
if ((player_ptr->lev >= PY_MAX_LEVEL) || PlayerRace(player_ptr).equals(PlayerRaceType::ANDROID)) {
return "**";
}
static void describe_monster_person(GridExamination *ge_ptr)
{
- MonsterRaceInfo *ap_r_ptr = &monraces_info[ge_ptr->m_ptr->ap_r_idx];
+ const auto &monrace = ge_ptr->m_ptr->get_real_monrace();
ge_ptr->s1 = _("それは", "It is ");
- if (ap_r_ptr->flags1 & RF1_FEMALE) {
+ if (monrace.flags1 & RF1_FEMALE) {
ge_ptr->s1 = _("彼女は", "She is ");
- } else if (ap_r_ptr->flags1 & RF1_MALE) {
+ } else if (monrace.flags1 & RF1_MALE) {
ge_ptr->s1 = _("彼は", "He is ");
}
}
} else if (player_ptr->riding) {
auto *m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->riding];
- auto *r_ptr = &monraces_info[m_ptr->r_idx];
+ auto *r_ptr = &m_ptr->get_monrace();
if (m_ptr->is_confused()) {
if (randint0(100) < 75) {
dir = ddd[randint0(8)];
}
auto comp_importance = [floor_ptr = player_ptr->current_floor_ptr](MONSTER_IDX idx1, MONSTER_IDX idx2) {
- auto m_ptr1 = &floor_ptr->m_list[idx1];
- auto m_ptr2 = &floor_ptr->m_list[idx2];
- auto ap_r_ptr1 = &monraces_info[m_ptr1->ap_r_idx];
- auto ap_r_ptr2 = &monraces_info[m_ptr2->ap_r_idx];
+ const auto &monster1 = floor_ptr->m_list[idx1];
+ const auto &monster2 = floor_ptr->m_list[idx2];
+ const auto &monrace1 = monraces_info[monster1.ap_r_idx];
+ const auto &monrace2 = monraces_info[monster2.ap_r_idx];
/* Unique monsters first */
- if (ap_r_ptr1->kind_flags.has(MonsterKindType::UNIQUE) != ap_r_ptr2->kind_flags.has(MonsterKindType::UNIQUE)) {
- return ap_r_ptr1->kind_flags.has(MonsterKindType::UNIQUE);
+ if (monrace1.kind_flags.has(MonsterKindType::UNIQUE) != monrace2.kind_flags.has(MonsterKindType::UNIQUE)) {
+ return monrace1.kind_flags.has(MonsterKindType::UNIQUE);
}
/* Shadowers first (あやしい影) */
- if (m_ptr1->mflag2.has(MonsterConstantFlagType::KAGE) != m_ptr2->mflag2.has(MonsterConstantFlagType::KAGE)) {
- return m_ptr1->mflag2.has(MonsterConstantFlagType::KAGE);
+ if (monster1.mflag2.has(MonsterConstantFlagType::KAGE) != monster2.mflag2.has(MonsterConstantFlagType::KAGE)) {
+ return monster1.mflag2.has(MonsterConstantFlagType::KAGE);
}
/* Unknown monsters first */
- if ((ap_r_ptr1->r_tkills == 0) != (ap_r_ptr2->r_tkills == 0)) {
- return ap_r_ptr1->r_tkills == 0;
+ if ((monrace1.r_tkills == 0) != (monrace2.r_tkills == 0)) {
+ return monrace1.r_tkills == 0;
}
/* Higher level monsters first (if known) */
- if (ap_r_ptr1->r_tkills && ap_r_ptr2->r_tkills && ap_r_ptr1->level != ap_r_ptr2->level) {
- return ap_r_ptr1->level > ap_r_ptr2->level;
+ if (monrace1.r_tkills && monrace2.r_tkills && monrace1.level != monrace2.level) {
+ return monrace1.level > monrace2.level;
}
/* Sort by index if all conditions are same */
- return m_ptr1->ap_r_idx > m_ptr2->ap_r_idx;
+ return monster1.ap_r_idx > monster2.ap_r_idx;
};
std::sort(monster_list.begin(), monster_list.end(), comp_importance);
{
auto dy = 0;
auto dx = 0;
- [[maybe_unused]] const auto [wid, hgt] = get_screen_size();
+ [[maybe_unused]] const auto &[wid, hgt] = get_screen_size();
if (y < panel_row_min) {
dy = -1;
}
int w1 = who[a];
int w2 = who[b];
- MonsterEntity *m_ptr1 = &player_ptr->current_floor_ptr->m_list[w1];
- MonsterEntity *m_ptr2 = &player_ptr->current_floor_ptr->m_list[w2];
- MonsterRaceInfo *r_ptr1 = &monraces_info[m_ptr1->r_idx];
- MonsterRaceInfo *r_ptr2 = &monraces_info[m_ptr2->r_idx];
+ const auto &monster1 = player_ptr->current_floor_ptr->m_list[w1];
+ const auto &monster2 = player_ptr->current_floor_ptr->m_list[w2];
+ const auto &monrace1 = monraces_info[monster1.r_idx];
+ const auto &monrace2 = monraces_info[monster2.r_idx];
- if (m_ptr1->is_named() && !m_ptr2->is_named()) {
+ if (monster1.is_named() && !monster2.is_named()) {
return true;
}
- if (m_ptr2->is_named() && !m_ptr1->is_named()) {
+ if (monster2.is_named() && !monster1.is_named()) {
return false;
}
- if (r_ptr1->kind_flags.has(MonsterKindType::UNIQUE) && r_ptr2->kind_flags.has_not(MonsterKindType::UNIQUE)) {
+ if (monrace1.kind_flags.has(MonsterKindType::UNIQUE) && monrace2.kind_flags.has_not(MonsterKindType::UNIQUE)) {
return true;
}
- if (r_ptr2->kind_flags.has(MonsterKindType::UNIQUE) && r_ptr1->kind_flags.has_not(MonsterKindType::UNIQUE)) {
+ if (monrace2.kind_flags.has(MonsterKindType::UNIQUE) && monrace1.kind_flags.has_not(MonsterKindType::UNIQUE)) {
return false;
}
- if (r_ptr1->level > r_ptr2->level) {
+ if (monrace1.level > monrace2.level) {
return true;
}
- if (r_ptr2->level > r_ptr1->level) {
+ if (monrace2.level > monrace1.level) {
return false;
}
- if (m_ptr1->hp > m_ptr2->hp) {
+ if (monster1.hp > monster2.hp) {
return true;
}
- if (m_ptr2->hp > m_ptr1->hp) {
+ if (monster2.hp > monster1.hp) {
return false;
}
int w1 = who[a];
int w2 = who[b];
- MonsterEntity *m_ptr1 = &player_ptr->current_floor_ptr->m_list[w1];
- MonsterEntity *m_ptr2 = &player_ptr->current_floor_ptr->m_list[w2];
- MonsterRaceInfo *r_ptr1 = &monraces_info[m_ptr1->r_idx];
- MonsterRaceInfo *r_ptr2 = &monraces_info[m_ptr2->r_idx];
+ const auto &monster1 = player_ptr->current_floor_ptr->m_list[w1];
+ const auto &monster2 = player_ptr->current_floor_ptr->m_list[w2];
+ const auto &monrace1 = monraces_info[monster1.r_idx];
+ const auto &monrace2 = monraces_info[monster2.r_idx];
if (w1 == player_ptr->riding) {
return true;
return false;
}
- if (m_ptr1->is_named() && !m_ptr2->is_named()) {
+ if (monster1.is_named() && !monster2.is_named()) {
return true;
}
- if (m_ptr2->is_named() && !m_ptr1->is_named()) {
+ if (monster2.is_named() && !monster1.is_named()) {
return false;
}
- if (!m_ptr1->parent_m_idx && m_ptr2->parent_m_idx) {
+ if (!monster1.parent_m_idx && monster2.parent_m_idx) {
return true;
}
- if (!m_ptr2->parent_m_idx && m_ptr1->parent_m_idx) {
+ if (!monster2.parent_m_idx && monster1.parent_m_idx) {
return false;
}
- if (r_ptr1->kind_flags.has(MonsterKindType::UNIQUE) && r_ptr2->kind_flags.has_not(MonsterKindType::UNIQUE)) {
+ if (monrace1.kind_flags.has(MonsterKindType::UNIQUE) && monrace2.kind_flags.has_not(MonsterKindType::UNIQUE)) {
return true;
}
- if (r_ptr2->kind_flags.has(MonsterKindType::UNIQUE) && r_ptr1->kind_flags.has_not(MonsterKindType::UNIQUE)) {
+ if (monrace2.kind_flags.has(MonsterKindType::UNIQUE) && monrace1.kind_flags.has_not(MonsterKindType::UNIQUE)) {
return false;
}
- if (r_ptr1->level > r_ptr2->level) {
+ if (monrace1.level > monrace2.level) {
return true;
}
- if (r_ptr2->level > r_ptr1->level) {
+ if (monrace2.level > monrace1.level) {
return false;
}
- if (m_ptr1->hp > m_ptr2->hp) {
+ if (monster1.hp > monster2.hp) {
return true;
}
- if (m_ptr2->hp > m_ptr1->hp) {
+ if (monster2.hp > monster1.hp) {
return false;
}
*/
std::string str_substr(std::string_view sv, size_t pos, size_t n)
{
- const auto [mb_pos, mb_n] = adjust_substr_pos(sv, pos, n);
+ const auto &[mb_pos, mb_n] = adjust_substr_pos(sv, pos, n);
return std::string(sv.substr(mb_pos, mb_n));
}
*/
std::string str_substr(std::string &&str, size_t pos, size_t n)
{
- const auto [mb_pos, mb_n] = adjust_substr_pos(str, pos, n);
+ const auto &[mb_pos, mb_n] = adjust_substr_pos(str, pos, n);
str.erase(mb_pos + mb_n);
str.erase(0, mb_pos);
return std::move(str);
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
#include "object-enchant/trc-types.h"
-#include "object/object-flags.h"
#include "perception/object-perception.h"
#include "player/permanent-resistances.h"
#include "player/race-resistances.h"
auto *o_ptr = &player_ptr->inventory_list[i];
auto is_known = o_ptr->is_known();
auto is_sensed = is_known || o_ptr->ident & IDENT_SENSE;
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
if (flags.has(TR_ADD_L_CURSE) || flags.has(TR_ADD_H_CURSE)) {
if (is_known) {
int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL;
for (int i = INVEN_MAIN_HAND; i < max_i; i++) {
auto *o_ptr = &player_ptr->inventory_list[i];
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
auto b = false;
for (auto flg : lite_flags) {
int max_i = (mode & DP_WP) ? INVEN_BOW + 1 : INVEN_TOTAL;
for (int i = INVEN_MAIN_HAND; i < max_i; i++) {
auto *o_ptr = &player_ptr->inventory_list[i];
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
auto f_imm = flag_to_greater_flag.find(flag);
if (f_imm != flag_to_greater_flag.end()) {
return;
}
- auto *r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ auto *r_ptr = &m_ptr->get_real_monrace();
feat_priority = 30;
if (is_hallucinated) {
if (r_ptr->visual_flags.has_all_of({ MonsterVisualType::CLEAR, MonsterVisualType::CLEAR_COLOR })) {
}
concptr clone = m_ptr->mflag2.has(MonsterConstantFlagType::CLONED) ? ", clone" : "";
- MonsterRaceInfo *ap_r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ MonsterRaceInfo *ap_r_ptr = &m_ptr->get_real_monrace();
if (ap_r_ptr->r_tkills && m_ptr->mflag2.has_not(MonsterConstantFlagType::KAGE)) {
return format(_("レベル%d, %s%s%s", "Level %d, %s%s%s"), ap_r_ptr->level, desc, attitude, clone);
}
#include "inventory/inventory-slot-types.h"
#include "mutation/mutation-flag-types.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "player-base/player-race.h"
#include "player-info/class-info.h"
#include "player-info/mimic-info-table.h"
for (int i = INVEN_MAIN_HAND; i < INVEN_TOTAL; i++) {
ItemEntity *o_ptr;
o_ptr = &player_ptr->inventory_list[i];
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
for (int stat = 0; stat < A_MAX; stat++) {
TERM_COLOR a = TERM_SLATE;
char c = '.';
#include "mutation/mutation-flag-types.h"
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
-#include "object/object-flags.h"
#include "object/tval-types.h"
#include "perception/object-perception.h"
#include "player-base/player-class.h"
}
basedam = ((o_ptr->dd + player_ptr->to_dd[i]) * (o_ptr->ds + player_ptr->to_ds[i] + 1)) * 50;
- auto flags = object_flags_known(o_ptr);
+ auto flags = o_ptr->get_flags_known();
bool impact = player_ptr->impact != 0;
basedam = calc_expect_crit(player_ptr, o_ptr->weight, to_h[i], basedam, player_ptr->dis_to_h[i], poison_needle, impact);
static void print_pet_list_oneline(PlayerType *player_ptr, const MonsterEntity &monster, TERM_LEN x, TERM_LEN y, TERM_LEN width)
{
- const auto &monrace = monraces_info[monster.ap_r_idx];
+ const auto &monrace = monster.get_real_monrace();
const auto name = monster_desc(player_ptr, &monster, MD_ASSUME_VISIBLE | MD_INDEF_VISIBLE | MD_NO_OWNER);
- const auto [bar_color, bar_len] = monster.get_hp_bar_data();
+ const auto &[bar_color, bar_len] = monster.get_hp_bar_data();
const auto is_visible = monster.ml && !player_ptr->effects()->hallucination()->is_hallucinated();
term_erase(0, y);
if (is_hallucinated) {
line = format(_("(X:%03d Y:%03d) 何か奇妙な物の足元の発見済みアイテム一覧", "Found items at (%03d,%03d) under something strange"), x, y);
} else {
- const MonsterRaceInfo *const r_ptr = &monraces_info[m_ptr->ap_r_idx];
+ const MonsterRaceInfo *const r_ptr = &m_ptr->get_real_monrace();
line = format(_("(X:%03d Y:%03d) %sの足元の発見済みアイテム一覧", "Found items at (%03d,%03d) under %s"), x, y, r_ptr->name.data());
}
} else {
auto &monster = player_ptr->current_floor_ptr->m_list[monster_list_index];
if (MonsterRace(monster.r_idx).is_valid()) {
- term_putstr(col - 2, row + row_offset, 2, monraces_info[monster.r_idx].x_attr,
- format("%c", monraces_info[monster.r_idx].x_char));
+ const auto &monrace = monster.get_monrace();
+ term_putstr(col - 2, row + row_offset, 2, monrace.x_attr,
+ format("%c", monrace.x_char));
term_putstr(col - 1, row + row_offset, 5, TERM_WHITE, format("%5d", monster.hp));
term_putstr(col + 5, row + row_offset, 6, TERM_WHITE, format("%5d", monster.max_maxhp));
}
#include "object-enchant/object-ego.h"
#include "object-enchant/trc-types.h"
#include "object-enchant/trg-types.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "system/artifact-type-definition.h"
#include "system/item-entity.h"
*/
static std::vector<std::string> analyze_slay(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
return extract_spoiler_flags(flags, slay_flags_desc);
}
*/
static std::vector<std::string> analyze_brand(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
return extract_spoiler_flags(flags, brand_flags_desc);
}
*/
static std::vector<std::string> analyze_resist(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
return extract_spoiler_flags(flags, resist_flags_desc);
}
*/
static std::vector<std::string> analyze_immune(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
return extract_spoiler_flags(flags, immune_flags_desc);
}
*/
static std::vector<std::string> analyze_vulnerable(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
return extract_spoiler_flags(flags, vulnerable_flags_desc);
}
*/
static std::vector<std::string> analyze_sustains(const ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
if (flags.has_all_of(EnumRange(TR_SUST_STR, TR_SUST_CHR))) {
return { _("全能力", "All stats") };
}
static std::vector<std::string> analyze_misc_magic(const ItemEntity *o_ptr)
{
std::vector<std::string> descriptions{};
- auto flags = object_flags(o_ptr);
+ const auto flags = o_ptr->get_flags();
const auto &flags2_descriptions = extract_spoiler_flags(flags, misc_flags2_desc);
descriptions.insert(descriptions.end(), flags2_descriptions.begin(), flags2_descriptions.end());
const auto &flags3_descriptions = extract_spoiler_flags(flags, misc_flags3_desc);
* @brief アーティファクトの情報全体を構造体に収める
* @param player_ptr プレイヤーへの参照ポインタ
* @param o_ptr オブジェクト構造体の参照ポインタ
- * @param desc_ptr 全アーティファクト情報を収める文字列参照ポインタ
*/
-void object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr)
+ArtifactsDumpInfo object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr)
{
- desc_ptr->description = analyze_general(player_ptr, o_ptr);
- desc_ptr->pval_info.analyze(*o_ptr);
- desc_ptr->brands = analyze_brand(o_ptr);
- desc_ptr->slays = analyze_slay(o_ptr);
- desc_ptr->immunities = analyze_immune(o_ptr);
- desc_ptr->resistances = analyze_resist(o_ptr);
- desc_ptr->vulnerabilities = analyze_vulnerable(o_ptr);
- desc_ptr->sustenances = analyze_sustains(o_ptr);
- desc_ptr->misc_magic = analyze_misc_magic(o_ptr);
- desc_ptr->addition = analyze_addition(o_ptr);
- desc_ptr->misc_desc = analyze_misc(o_ptr);
- desc_ptr->activation = activation_explanation(o_ptr);
+ ArtifactsDumpInfo info{};
+ info.description = analyze_general(player_ptr, o_ptr);
+ info.pval_info.analyze(*o_ptr);
+ info.brands = analyze_brand(o_ptr);
+ info.slays = analyze_slay(o_ptr);
+ info.immunities = analyze_immune(o_ptr);
+ info.resistances = analyze_resist(o_ptr);
+ info.vulnerabilities = analyze_vulnerable(o_ptr);
+ info.sustenances = analyze_sustains(o_ptr);
+ info.misc_magic = analyze_misc_magic(o_ptr);
+ info.addition = analyze_addition(o_ptr);
+ info.misc_desc = analyze_misc(o_ptr);
+ info.activation = activation_explanation(o_ptr);
+ return info;
}
/*!
* @param o_ptr ランダムアーティファクトのオブジェクト構造体参照ポインタ
* @param desc_ptr 記述内容を収める構造体参照ポインタ
*/
-void random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr)
+ArtifactsDumpInfo random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr)
{
- desc_ptr->description = analyze_general(player_ptr, o_ptr);
- desc_ptr->pval_info.analyze(*o_ptr);
- desc_ptr->brands = analyze_brand(o_ptr);
- desc_ptr->slays = analyze_slay(o_ptr);
- desc_ptr->immunities = analyze_immune(o_ptr);
- desc_ptr->resistances = analyze_resist(o_ptr);
- desc_ptr->vulnerabilities = analyze_vulnerable(o_ptr);
- desc_ptr->sustenances = analyze_sustains(o_ptr);
- desc_ptr->misc_magic = analyze_misc_magic(o_ptr);
- desc_ptr->activation = activation_explanation(o_ptr);
+ ArtifactsDumpInfo info{};
+ info.description = analyze_general(player_ptr, o_ptr);
+ info.pval_info.analyze(*o_ptr);
+ info.brands = analyze_brand(o_ptr);
+ info.slays = analyze_slay(o_ptr);
+ info.immunities = analyze_immune(o_ptr);
+ info.resistances = analyze_resist(o_ptr);
+ info.vulnerabilities = analyze_vulnerable(o_ptr);
+ info.sustenances = analyze_sustains(o_ptr);
+ info.misc_magic = analyze_misc_magic(o_ptr);
+ info.activation = activation_explanation(o_ptr);
constexpr auto weight_mes = _("重さ %d.%d kg", "Weight %d.%d lbs");
const auto weight_integer = _(lb_to_kg_integer(o_ptr->weight), o_ptr->weight / 10);
const auto weight_fraction = _(lb_to_kg_fraction(o_ptr->weight), o_ptr->weight % 10);
- desc_ptr->misc_desc = format(weight_mes, weight_integer, weight_fraction);
+ info.misc_desc = format(weight_mes, weight_integer, weight_fraction);
+ return info;
}
#pragma once
class ItemEntity;
-struct obj_desc_list;
+class ArtifactsDumpInfo;
class PlayerType;
-void object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr);
-void random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr, obj_desc_list *desc_ptr);
+ArtifactsDumpInfo object_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr);
+ArtifactsDumpInfo random_artifact_analyze(PlayerType *player_ptr, const ItemEntity *o_ptr);
return;
}
- std::string line = spoiler_indent;
+ std::stringstream line;
+ line << spoiler_indent;
if (!header.empty()) {
- line.append(header).append(" ");
+ line << header << " ";
}
std::stringstream ss;
ss << list_separator << ' ';
const auto last_separator = ss.str();
for (size_t i = 0; i < descriptions.size(); i++) {
- auto elem = descriptions[i];
+ std::stringstream element;
+ element << descriptions[i];
if (i < descriptions.size() - 1) {
- elem.push_back(separator);
- elem.push_back(' ');
+ element << separator << ' ';
}
- if (line.length() + elem.length() <= MAX_LINE_LEN) {
- line.append(elem);
+ const auto element_str = element.str();
+ const int line_length = line.tellp();
+ constexpr auto max_line_length = 75;
+ if (line_length + element_str.length() <= max_line_length) {
+ line << element_str;
continue;
}
- if (line.length() > 1 && line.ends_with(last_separator)) {
- ofs << std::string_view(line).substr(0, line.length() - 2) << '\n';
- line = spoiler_indent;
- line.append(elem);
+ const auto line_str = line.str();
+ if (line_str.ends_with(last_separator)) {
+ ofs << std::string_view(line_str).substr(0, line_str.length() - 2) << '\n';
+ line.str("");
+ line.clear(std::stringstream::goodbit);
+ line << spoiler_indent << element_str;
} else {
- ofs << line << '\n';
- line = " ";
- line.append(elem);
+ ofs << line_str << '\n';
+ line.str("");
+ line.clear(std::stringstream::goodbit);
+ line << " " << element_str;
}
}
- ofs << line << '\n';
+ ofs << line.str() << '\n';
}
/*!
* Create a spoiler file entry for an artifact
* @param art_ptr アーティファクト情報をまとめた構造体の参照ポインタ
*/
-static void spoiler_print_art(obj_desc_list *art_ptr, std::ofstream &ofs)
+static void spoiler_print_art(const ArtifactsDumpInfo *art_ptr, std::ofstream &ofs)
{
const auto *pval_ptr = &art_ptr->pval_info;
ofs << art_ptr->description << '\n';
const auto item = make_fake_artifact(a_idx);
PlayerType dummy;
- obj_desc_list artifact_descriptions;
- object_analyze(&dummy, &item, &artifact_descriptions);
- spoiler_print_art(&artifact_descriptions, ofs);
+ const auto artifacts_list = object_analyze(&dummy, &item);
+ spoiler_print_art(&artifacts_list, ofs);
}
}
}
PlayerType dummy;
const auto item = prepare_item_for_obj_desc(bi_id);
const auto item_name = describe_flavor(&dummy, &item, OD_NAME_ONLY | OD_STORE);
- const auto [depth, price] = get_info(item);
+ const auto &[depth, price] = get_info(item);
const auto dam_or_ac = describe_dam_or_ac(item);
const auto weight = describe_weight(item);
const auto chance = describe_chance(item);
#include "wizard/spoiler-util.h"
-#include "object/object-flags.h"
#include "system/item-entity.h"
#include <fstream>
return;
}
- auto flags = object_flags(&item);
+ const auto flags = item.get_flags();
this->pval_desc = format("%+d", item.pval);
if (flags.has_all_of(EnumRange(TR_STR, TR_CHR))) {
this->pval_affects.push_back(_("全能力", "All stats"));
#include <string_view>
#include <vector>
-/* MAX_LINE_LEN specifies when a line should wrap. */
-#define MAX_LINE_LEN 75
-
enum class SpoilerOutputResultType {
CANCELED,
SUCCESSFUL,
void analyze(const ItemEntity &item);
};
-struct obj_desc_list {
+class ArtifactsDumpInfo {
+public:
+ ArtifactsDumpInfo() = default;
std::string description = ""; /* "The Longsword Dragonsmiter (6d4) (+20, +25)" */
ParameterValueInfo pval_info{}; /* Description of what is affected by an object's pval */
std::vector<std::string> slays{}; /* A list of an object's slaying preferences */
#include "object-enchant/special-object-flags.h"
#include "object-enchant/tr-types.h"
#include "object/item-use-flags.h"
-#include "object/object-flags.h"
#include "object/object-info.h"
#include "object/object-kind-hook.h"
#include "object/object-mark-types.h"
*/
static void wiz_display_item(PlayerType *player_ptr, ItemEntity *o_ptr)
{
- auto flags = object_flags(o_ptr);
auto get_seq_32bits = [](const TrFlags &flags, uint start) {
BIT_FLAGS result = 0U;
for (auto i = 0U; i < 32 && start + i < flags.size(); i++) {
prt(format("cursed = %-4lX captured_monster_speed = %-4d", o_ptr->curse_flags.to_ulong(), o_ptr->captured_monster_speed), ++line, j);
prt(format("captured_monster_max_hp = %-4d captured_monster_max_hp = %-4d", o_ptr->captured_monster_current_hp, o_ptr->captured_monster_max_hp), ++line, j);
+ const auto flags = o_ptr->get_flags();
prt("+------------FLAGS1------------+", ++line, j);
prt("AFFECT........SLAY........BRAND.", ++line, j);
prt(" mf cvae xsqpaefc", ++line, j);