<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
<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
\
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 \
#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;
#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)) {
#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;
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);
-
- 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()) {
#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"
*/
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);
#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: {
#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"
#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));
#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);
}
/*!
#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);
#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"
#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;
}
#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);
#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"
}
}
- 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);
#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;
#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 */
#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);
}
}
#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);
#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"
#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"
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);
#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"
#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;
}
#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;
#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)));
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 (!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"
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;
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;
#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();
#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"
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;
}
}
}
#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"
#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;
};
#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()) {
#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);
#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);
}
}
}
#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);