OSDN Git Service

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