OSDN Git Service

[Refactor] Rename ItemEntity::is_artifact()
[hengbandforosx/hengbandosx.git] / src / system / item-entity.h
1 #pragma once
2
3 /*
4  * @file item-entity.h
5  * @brief アイテム定義の構造体とエンティティ処理定義
6  * @author Hourier
7  * @date 2021/05/02
8  */
9
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"
18 #include <optional>
19
20 enum class FixedArtifactId : short;
21 enum class ItemKindType : short;
22 enum class SmithEffectType : int16_t;
23 enum class RandomArtActType : short;
24
25 class ItemEntity {
26 public:
27     ItemEntity();
28     short bi_id{}; /*!< ベースアイテムID (0は、不具合調査用の無効アイテム または 何も装備していない箇所のアイテム であることを示す) */
29     POSITION iy{}; /*!< Y-position on map, or zero */
30     POSITION ix{}; /*!< X-position on map, or zero */
31     IDX stack_idx{}; /*!< このアイテムを含むアイテムリスト内の位置(降順) */
32     BaseitemKey bi_key;
33     PARAMETER_VALUE pval{}; /*!< Item extra-parameter */
34     byte discount{}; /*!< ゲーム中の値引き率 (0~100) / Discount (if any) */
35     ITEM_NUMBER number{}; /*!< Number of items */
36     WEIGHT weight{}; /*!< Item weight */
37     FixedArtifactId fixed_artifact_idx; /*!< 固定アーティファクト番号 (固定アーティファクトでないなら0) */
38     EgoType ego_idx{}; /*!< エゴ番号 (エゴでないなら0) */
39
40     RandomArtActType activation_id{}; /*!< エゴ/アーティファクトの発動ID / Extra info activation index */
41     byte chest_level = 0; /*!< 箱の中身レベル */
42     uint8_t captured_monster_speed = 0; /*!< 捕らえたモンスターの速度 */
43     short captured_monster_current_hp = 0; /*!< 捕らえたモンスターの現HP */
44     short captured_monster_max_hp = 0; /*!< 捕らえたモンスターの最大HP */
45     short fuel = 0; /*!< 光源の残り寿命 / Remaining fuel */
46
47     byte smith_hit = 0; /*!< 鍛冶をした結果上昇した命中値 */
48     byte smith_damage = 0; /*!< 鍛冶をした結果上昇したダメージ */
49     std::optional<SmithEffectType> smith_effect; //!< 鍛冶で付与された効果
50     std::optional<RandomArtActType> smith_act_idx; //!< 鍛冶で付与された発動効果のID
51
52     HIT_PROB to_h{}; /*!< Plusses to hit */
53     int to_d{}; /*!< Plusses to damage */
54     ARMOUR_CLASS to_a{}; /*!< Plusses to AC */
55     ARMOUR_CLASS ac{}; /*!< Normal AC */
56
57     DICE_NUMBER dd{}; /*!< Damage dice/nums */
58     DICE_SID ds{}; /*!< Damage dice/sides */
59     TIME_EFFECT timeout{}; /*!< Timeout Counter */
60     byte ident{}; /*!< Special flags  */
61     EnumClassFlagGroup<OmType> marked{}; /*!< Object is marked */
62     std::optional<std::string> inscription{}; /*!< Inscription */
63     std::optional<std::string> randart_name{}; /*!< Artifact name (random artifacts) */
64     byte feeling{}; /*!< Game generated inscription number (eg, pseudo-id) */
65
66     TrFlags art_flags{}; /*!< Extra Flags for ego and artifacts */
67     EnumClassFlagGroup<CurseTraitType> curse_flags{}; /*!< Flags for curse */
68     MONSTER_IDX held_m_idx{}; /*!< アイテムを所持しているモンスターID (いないなら 0) / Monster holding us (if any) */
69     int artifact_bias{}; /*!< ランダムアーティファクト生成時のバイアスID */
70
71     void wipe();
72     void copy_from(const ItemEntity *j_ptr);
73     void prep(short new_bi_id);
74     bool is_weapon() const;
75     bool is_weapon_ammo() const;
76     bool is_weapon_armour_ammo() const;
77     bool is_melee_weapon() const;
78     bool is_melee_ammo() const;
79     bool is_wearable() const;
80     bool is_equipment() const;
81     bool is_orthodox_melee_weapons() const;
82     bool is_broken_weapon() const;
83     bool is_throwable() const;
84     bool is_wieldable_in_etheir_hand() const;
85     bool refuse_enchant_weapon() const;
86     bool allow_enchant_weapon() const;
87     bool allow_enchant_melee_weapon() const;
88     bool allow_two_hands_wielding() const;
89     bool is_ammo() const;
90     bool is_convertible() const;
91     bool is_lance() const;
92     bool is_protector() const;
93     bool can_be_aura_protector() const;
94     bool is_rare() const;
95     bool is_ego() const;
96     bool is_smith() const;
97     bool is_fixed_or_random_artifact() const;
98     bool is_fixed_artifact() const;
99     bool is_random_artifact() const;
100     bool is_nameless() const;
101     bool is_valid() const;
102     bool is_broken() const;
103     bool is_cursed() const;
104     bool is_held_by_monster() const;
105     bool is_known() const;
106     bool is_fully_known() const;
107     bool is_aware() const;
108     bool is_tried() const;
109     bool is_potion() const;
110     bool is_readable() const;
111     bool can_refill_lantern() const;
112     bool can_refill_torch() const;
113     bool can_recharge() const;
114     bool is_offerable() const;
115     bool is_activatable() const;
116     bool is_fuel() const;
117     bool is_spell_book() const;
118     bool is_glove_same_temper(const ItemEntity *j_ptr) const;
119     bool can_pile(const ItemEntity *j_ptr) const;
120     TERM_COLOR get_color() const;
121     char get_symbol() const;
122     int get_price() const;
123     bool is_specific_artifact(FixedArtifactId id) const;
124     bool has_unidentified_name() const;
125     ItemKindType get_arrow_kind() const;
126     bool is_wand_rod() const;
127     bool is_wand_staff() const;
128     short get_bow_energy() const;
129     int get_arrow_magnification() const;
130     bool is_aiming_rod() const;
131     bool is_lite_requiring_fuel() const;
132     bool is_junk() const;
133     bool is_armour() const;
134     bool is_cross_bow() const;
135     bool is_inscribed() const;
136
137 private:
138     int get_baseitem_price() const;
139     int calc_figurine_value() const;
140     int calc_capture_value() const;
141 };