OSDN Git Service

[Refactor] #3772 死体判定処理をBaseitemKey::is_corpse() に実装した
[hengbandforosx/hengbandosx.git] / src / system / baseitem-info.h
1 #pragma once
2
3 #include "object-enchant/tr-flags.h"
4 #include "object-enchant/trg-types.h"
5 #include "system/angband.h"
6 #include "util/flag-group.h"
7 #include <array>
8 #include <optional>
9 #include <string>
10 #include <vector>
11
12 enum class ItemKindType : short;
13 class BaseitemKey {
14 public:
15     constexpr BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value = std::nullopt)
16         : type_value(type_value)
17         , subtype_value(subtype_value)
18     {
19     }
20
21     bool operator==(const BaseitemKey &other) const;
22     bool operator!=(const BaseitemKey &other) const
23     {
24         return !(*this == other);
25     }
26
27     bool operator<(const BaseitemKey &other) const;
28     bool operator>(const BaseitemKey &other) const
29     {
30         return other < *this;
31     }
32
33     bool operator<=(const BaseitemKey &other) const
34     {
35         return !(*this > other);
36     }
37
38     bool operator>=(const BaseitemKey &other) const
39     {
40         return !(*this < other);
41     }
42
43     ItemKindType tval() const;
44     std::optional<int> sval() const;
45     bool is(ItemKindType tval) const;
46
47     ItemKindType get_arrow_kind() const;
48     bool is_spell_book() const;
49     bool is_high_level_book() const;
50     bool is_melee_weapon() const;
51     bool is_ammo() const;
52     bool has_unidentified_name() const;
53     bool can_recharge() const;
54     bool is_wand_rod() const;
55     bool is_wand_staff() const;
56     bool is_protector() const;
57     bool can_be_aura_protector() const;
58     bool is_wearable() const;
59     bool is_weapon() const;
60     bool is_equipement() const;
61     bool is_melee_ammo() const;
62     bool is_orthodox_melee_weapon() const;
63     bool is_broken_weapon() const;
64     bool is_throwable() const;
65     bool is_wieldable_in_etheir_hand() const;
66     bool is_rare() const;
67     short get_bow_energy() const;
68     int get_arrow_magnification() const;
69     bool is_aiming_rod() const;
70     bool is_lite_requiring_fuel() const;
71     bool is_junk() const;
72     bool is_armour() const;
73     bool is_cross_bow() const;
74     bool refuse_enchant_weapon() const;
75     std::string explain_activation() const;
76     bool is_convertible() const;
77     bool is_fuel() const;
78     bool is_lance() const;
79     bool is_readable() const;
80     bool is_corpse() const;
81
82 private:
83     ItemKindType type_value;
84     std::optional<int> subtype_value;
85
86     bool is_mushrooms() const;
87 };
88
89 enum class ItemKindType : short;
90 enum class RandomArtActType : short;
91 class BaseitemInfo {
92 public:
93     BaseitemInfo();
94     short idx{};
95
96     std::string name; /*!< ベースアイテム名 */
97     std::string text; /*!< 解説テキスト */
98     std::string flavor_name; /*!< 未確定名 */
99
100     BaseitemKey bi_key;
101
102     PARAMETER_VALUE pval{}; /*!< ベースアイテムのpval(能力修正共通値) Object extra info */
103
104     HIT_PROB to_h{}; /*!< ベースアイテムの命中修正値 / Bonus to hit */
105     int to_d{}; /*!< ベースアイテムのダメージ修正値 / Bonus to damage */
106     ARMOUR_CLASS to_a{}; /*!< ベースアイテムのAC修正値 / Bonus to armor */
107     ARMOUR_CLASS ac{}; /*!< ベースアイテムのAC基本値 /  Base armor */
108
109     DICE_NUMBER dd{}; /*!< ダメージダイスの数 / Damage dice */
110     DICE_SID ds{}; /*!< ダメージダイスの大きさ / Damage sides */
111
112     WEIGHT weight{}; /*!< ベースアイテムの重量 / Weight */
113     PRICE cost{}; /*!< ベースアイテムの基本価値 / Object "base cost" */
114     TrFlags flags{}; /*!< ベースアイテムの基本特性ビット配列 / Flags */
115     EnumClassFlagGroup<ItemGenerationTraitType> gen_flags; /*!< ベースアイテムの生成特性ビット配列 / flags for generate */
116
117     DEPTH level{}; /*!< ベースアイテムの基本生成階 / Level */
118
119     struct alloc_table {
120         int level; /*!< ベースアイテムの生成階 */
121         short chance; /*!< ベースアイテムの生成確率 */
122     };
123
124     std::array<alloc_table, 4> alloc_tables{}; /*!< ベースアイテムの生成テーブル */
125
126     TERM_COLOR d_attr{}; /*!< デフォルトのアイテムシンボルカラー / Default object attribute */
127     char d_char{}; /*!< デフォルトのアイテムシンボルアルファベット / Default object character */
128     bool easy_know{}; /*!< ベースアイテムが初期からベース名を判断可能かどうか / This object is always known (if aware) */
129     RandomArtActType act_idx{}; /*!< 発動能力のID /  Activative ability index */
130
131     void decide_easy_know();
132
133     /* @todo ここから下はk_info.txt に依存しないミュータブルなフィールド群なので、将来的に分離予定 */
134
135     TERM_COLOR x_attr{}; /*!< 設定変更後のアイテムシンボルカラー /  Desired object attribute */
136     char x_char{}; /*!< 設定変更後のアイテムシンボルアルファベット /  Desired object character */
137
138     IDX flavor{}; /*!< 未鑑定名の何番目を当てるか(0は未鑑定名なし) / Special object flavor (or zero) */
139     bool aware{}; /*!< ベースアイテムが鑑定済かどうか /  The player is "aware" of the item's effects */
140     bool tried{}; /*!< ベースアイテムを未鑑定のまま試したことがあるか /  The player has "tried" one of the items */
141
142     void mark_as_tried();
143 };
144
145 extern std::vector<BaseitemInfo> baseitems_info;