OSDN Git Service

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