5 * @brief アイテム定義の構造体とエンティティ処理定義
10 #include "object-enchant/object-ego.h"
11 #include "object-enchant/tr-flags.h"
12 #include "object-enchant/trc-types.h"
13 #include "object/object-mark-types.h"
14 #include "system/angband.h"
15 #include "system/baseitem-info.h"
16 #include "system/system-variables.h"
17 #include "util/flag-group.h"
22 enum class FixedArtifactId : short;
23 enum class ItemKindType : short;
24 enum class SmithEffectType : int16_t;
25 enum class RandomArtActType : short;
28 class EgoItemDefinition;
30 struct activation_type;
34 short bi_id{}; /*!< ベースアイテムID (0は、不具合調査用の無効アイテム または 何も装備していない箇所のアイテム であることを示す) */
35 POSITION iy{}; /*!< Y-position on map, or zero */
36 POSITION ix{}; /*!< X-position on map, or zero */
37 IDX stack_idx{}; /*!< このアイテムを含むアイテムリスト内の位置(降順) */
39 PARAMETER_VALUE pval{}; /*!< Item extra-parameter */
40 byte discount{}; /*!< ゲーム中の値引き率 (0~100) / Discount (if any) */
41 ITEM_NUMBER number{}; /*!< Number of items */
42 WEIGHT weight{}; /*!< Item weight */
43 FixedArtifactId fixed_artifact_idx; /*!< 固定アーティファクト番号 (固定アーティファクトでないなら0) */
44 EgoType ego_idx{}; /*!< エゴ番号 (エゴでないなら0) */
46 RandomArtActType activation_id{}; /*!< エゴ/アーティファクトの発動ID / Extra info activation index */
47 byte chest_level = 0; /*!< 箱の中身レベル */
48 uint8_t captured_monster_speed = 0; /*!< 捕らえたモンスターの速度 */
49 short captured_monster_current_hp = 0; /*!< 捕らえたモンスターの現HP */
50 short captured_monster_max_hp = 0; /*!< 捕らえたモンスターの最大HP */
51 short fuel = 0; /*!< 光源の残り寿命 / Remaining fuel */
53 byte smith_hit = 0; /*!< 鍛冶をした結果上昇した命中値 */
54 byte smith_damage = 0; /*!< 鍛冶をした結果上昇したダメージ */
55 std::optional<SmithEffectType> smith_effect; //!< 鍛冶で付与された効果
56 std::optional<RandomArtActType> smith_act_idx; //!< 鍛冶で付与された発動効果のID
58 HIT_PROB to_h{}; /*!< Plusses to hit */
59 int to_d{}; /*!< Plusses to damage */
60 ARMOUR_CLASS to_a{}; /*!< Plusses to AC */
61 ARMOUR_CLASS ac{}; /*!< Normal AC */
63 DICE_NUMBER dd{}; /*!< Damage dice/nums */
64 DICE_SID ds{}; /*!< Damage dice/sides */
65 TIME_EFFECT timeout{}; /*!< Timeout Counter */
66 byte ident{}; /*!< Special flags */
67 EnumClassFlagGroup<OmType> marked{}; /*!< Object is marked */
68 std::optional<std::string> inscription{}; /*!< Inscription */
69 std::optional<std::string> randart_name{}; /*!< Artifact name (random artifacts) */
70 byte feeling{}; /*!< Game generated inscription number (eg, pseudo-id) */
72 TrFlags art_flags{}; /*!< Extra Flags for ego and artifacts */
73 EnumClassFlagGroup<CurseTraitType> curse_flags{}; /*!< Flags for curse */
74 MONSTER_IDX held_m_idx{}; /*!< アイテムを所持しているモンスターID (いないなら 0) / Monster holding us (if any) */
75 int artifact_bias{}; /*!< ランダムアーティファクト生成時のバイアスID */
78 void copy_from(const ItemEntity *j_ptr);
79 void prep(short new_bi_id);
80 bool is_weapon() const;
81 bool is_weapon_ammo() const;
82 bool is_weapon_armour_ammo() const;
83 bool is_melee_weapon() const;
84 bool is_melee_ammo() const;
85 bool is_wearable() const;
86 bool is_equipment() const;
87 bool is_orthodox_melee_weapons() const;
88 bool is_broken_weapon() const;
89 bool is_throwable() const;
90 bool is_wieldable_in_etheir_hand() const;
91 bool refuse_enchant_weapon() const;
92 bool allow_enchant_weapon() const;
93 bool allow_enchant_melee_weapon() const;
94 bool allow_two_hands_wielding() const;
96 bool is_convertible() const;
97 bool is_lance() const;
98 bool is_protector() const;
99 bool can_be_aura_protector() const;
100 bool is_rare() const;
102 bool is_smith() const;
103 bool is_fixed_or_random_artifact() const;
104 bool is_fixed_artifact() const;
105 bool is_random_artifact() const;
106 bool is_nameless() const;
107 bool is_valid() const;
108 bool is_broken() const;
109 bool is_cursed() const;
110 bool is_held_by_monster() const;
111 bool is_known() const;
112 bool is_fully_known() const;
113 bool is_aware() const;
114 bool is_tried() const;
115 bool is_potion() const;
116 bool is_readable() const;
117 bool can_refill_lantern() const;
118 bool can_refill_torch() const;
119 bool can_recharge() const;
120 bool is_offerable() const;
121 bool is_activatable() const;
122 bool is_fuel() const;
123 bool is_spell_book() const;
124 bool is_glove_same_temper(const ItemEntity *j_ptr) const;
125 bool can_pile(const ItemEntity *j_ptr) const;
126 TERM_COLOR get_color() const;
127 char get_symbol() const;
128 int get_price() const;
129 bool is_specific_artifact(FixedArtifactId id) const;
130 bool has_unidentified_name() const;
131 ItemKindType get_arrow_kind() const;
132 bool is_wand_rod() const;
133 bool is_wand_staff() const;
134 short get_bow_energy() const;
135 int get_arrow_magnification() const;
136 bool is_aiming_rod() const;
137 bool is_lite_requiring_fuel() const;
138 bool is_junk() const;
139 bool is_armour() const;
140 bool is_cross_bow() const;
141 bool is_inscribed() const;
142 std::vector<activation_type>::const_iterator find_activation_info() const;
143 bool has_activation() const;
145 BaseitemInfo &get_baseitem() const;
146 EgoItemDefinition &get_ego() const;
147 ArtifactType &get_fixed_artifact() const;
148 TrFlags get_flags() const;
149 TrFlags get_flags_known() const;
150 std::string build_activation_description(const activation_type &act) const;
152 void mark_as_known();
153 void mark_as_tried();
156 int get_baseitem_price() const;
157 int calc_figurine_value() const;
158 int calc_capture_value() const;
159 void modify_ego_lite_flags(TrFlags &flags) const;
160 RandomArtActType get_activation_index() const;
161 std::string build_activation_description_dragon_breath() const;