OSDN Git Service

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