OSDN Git Service

[Refactor] #2204 HIT_POINTエイリアスをintに揃えた
[hengbandforosx/hengbandosx.git] / src / system / object-type-definition.h
1 #pragma once
2
3 /*
4  * @file object-type-definition.h
5  * @brief アイテム定義の構造体とエンティティ処理定義
6  * @author Hourier
7  * @date 2021/05/02
8  */
9
10 #include "object-enchant/tr-flags.h"
11 #include "object-enchant/trc-types.h"
12 #include "system/angband.h"
13 #include "system/system-variables.h"
14 #include "util/flag-group.h"
15 #include <optional>
16
17 enum class ItemKindType : short;
18 enum class SmithEffectType : int16_t;
19 enum class RandomArtActType : short;
20
21 class ObjectType {
22 public:
23     ObjectType() = default;
24     KIND_OBJECT_IDX k_idx{}; /*!< Kind index (zero if "dead") */
25     POSITION iy{}; /*!< Y-position on map, or zero */
26     POSITION ix{}; /*!< X-position on map, or zero */
27     IDX stack_idx{}; /*!< このアイテムを含むアイテムリスト内の位置(降順) */
28     ItemKindType tval{}; /*!< Item type (from kind) */
29
30     OBJECT_SUBTYPE_VALUE sval{}; /*!< Item sub-type (from kind) */
31     PARAMETER_VALUE pval{}; /*!< Item extra-parameter */
32     byte discount{}; /*!< ゲーム中の値引き率 (0~100) / Discount (if any) */
33     ITEM_NUMBER number{}; /*!< Number of items */
34     WEIGHT weight{}; /*!< Item weight */
35     ARTIFACT_IDX name1{}; /*!< Artifact type, if any */
36     EGO_IDX name2{}; /*!< Ego-Item type, if any */
37
38     RandomArtActType activation_id{}; /*!< エゴ/アーティファクトの発動ID / Extra info activation index */
39     byte chest_level = 0; /*!< 箱の中身レベル */
40     uint8_t captured_monster_speed = 0; /*!< 捕らえたモンスターの速度 */
41     short captured_monster_current_hp = 0; /*!< 捕らえたモンスターの現HP */
42     short captured_monster_max_hp = 0; /*!< 捕らえたモンスターの最大HP */
43     ushort fuel = 0; /*!< 光源の残り寿命 / Extra info fuel or captured monster's current HP */
44
45     byte smith_hit = 0; /*!< 鍛冶をした結果上昇した命中値 */
46     byte smith_damage = 0; /*!< 鍛冶をした結果上昇したダメージ */
47     std::optional<SmithEffectType> smith_effect; //!< 鍛冶で付与された効果
48     std::optional<RandomArtActType> smith_act_idx; //!< 鍛冶で付与された発動効果のID
49
50     HIT_PROB to_h{}; /*!< Plusses to hit */
51     int to_d{}; /*!< Plusses to damage */
52     ARMOUR_CLASS to_a{}; /*!< Plusses to AC */
53     ARMOUR_CLASS ac{}; /*!< Normal AC */
54
55     DICE_NUMBER dd{}; /*!< Damage dice/nums */
56     DICE_SID ds{}; /*!< Damage dice/sides */
57     TIME_EFFECT timeout{}; /*!< Timeout Counter */
58     byte ident{}; /*!< Special flags  */
59     byte marked{}; /*!< Object is marked */
60     uint16_t inscription{}; /*!< Inscription index */
61     uint16_t art_name{}; /*!< Artifact name (random artifacts) */
62     byte feeling{}; /*!< Game generated inscription number (eg, pseudo-id) */
63
64     TrFlags art_flags{}; /*!< Extra Flags for ego and artifacts */
65     EnumClassFlagGroup<CurseTraitType> curse_flags{}; /*!< Flags for curse */
66     MONSTER_IDX held_m_idx{}; /*!< アイテムを所持しているモンスターID (いないなら 0) / Monster holding us (if any) */
67     int artifact_bias{}; /*!< ランダムアーティファクト生成時のバイアスID */
68
69     void wipe();
70     void copy_from(ObjectType *j_ptr);
71     void prep(KIND_OBJECT_IDX ko_idx);
72     bool is_weapon() const;
73     bool is_weapon_ammo() const;
74     bool is_weapon_armour_ammo() const;
75     bool is_melee_weapon() const;
76     bool is_melee_ammo() const;
77     bool is_wearable() const;
78     bool is_equipment() const;
79     bool is_orthodox_melee_weapons() const;
80     bool is_broken_weapon() const;
81     bool is_throwable() const;
82     bool is_wieldable_in_etheir_hand() const;
83     bool refuse_enchant_weapon() const;
84     bool allow_enchant_weapon() const;
85     bool allow_enchant_melee_weapon() const;
86     bool allow_two_hands_wielding() const;
87     bool is_ammo() const;
88     bool is_convertible() const;
89     bool is_lance() const;
90     bool is_armour() const;
91     bool is_rare() const;
92     bool is_ego() const;
93     bool is_smith() const;
94     bool is_artifact() const;
95     bool is_fixed_artifact() const;
96     bool is_random_artifact() const;
97     bool is_nameless() const;
98     bool is_valid() const;
99     bool is_broken() const;
100     bool is_cursed() const;
101     bool is_held_by_monster() const;
102     bool is_known() const;
103     bool is_fully_known() const;
104     bool is_aware() const;
105     bool is_tried() const;
106     bool is_potion() const;
107     bool is_readable() const;
108     bool can_refill_lantern() const;
109     bool can_refill_torch() const;
110     bool is_rechargeable() const;
111     bool is_offerable() const;
112     bool is_activatable() const;
113     bool is_fuel() const;
114     bool is_glove_same_temper(const ObjectType *j_ptr) const;
115     bool can_pile(const ObjectType *j_ptr) const;
116 };