OSDN Git Service

[Refactor] #3756 ItemEntity::is() とBaseitemKey::is() を定義した
[hengbandforosx/hengbandosx.git] / src / system / baseitem-info.h
index 3907697..b736a56 100644 (file)
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
 
 #include "object-enchant/tr-flags.h"
 #include "object-enchant/trg-types.h"
 enum class ItemKindType : short;
 class BaseitemKey {
 public:
-    BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value = std::nullopt);
+    constexpr BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value = std::nullopt)
+        : type_value(type_value)
+        , subtype_value(subtype_value)
+    {
+    }
+
     bool operator==(const BaseitemKey &other) const;
     bool operator!=(const BaseitemKey &other) const
     {
@@ -37,6 +42,7 @@ public:
 
     ItemKindType tval() const;
     std::optional<int> sval() const;
+    bool is(ItemKindType tval) const;
 
     ItemKindType get_arrow_kind() const;
     bool is_spell_book() const;
@@ -65,6 +71,7 @@ public:
     bool is_junk() const;
     bool is_armour() const;
     bool is_cross_bow() const;
+    bool refuse_enchant_weapon() const;
 
 private:
     ItemKindType type_value;
@@ -115,6 +122,8 @@ public:
     bool easy_know{}; /*!< ベースアイテムが初期からベース名を判断可能かどうか / This object is always known (if aware) */
     RandomArtActType act_idx{}; /*!< 発動能力のID /  Activative ability index */
 
+    void decide_easy_know();
+
     /* @todo ここから下はk_info.txt に依存しないミュータブルなフィールド群なので、将来的に分離予定 */
 
     TERM_COLOR x_attr{}; /*!< 設定変更後のアイテムシンボルカラー /  Desired object attribute */
@@ -123,6 +132,8 @@ public:
     IDX flavor{}; /*!< 未鑑定名の何番目を当てるか(0は未鑑定名なし) / Special object flavor (or zero) */
     bool aware{}; /*!< ベースアイテムが鑑定済かどうか /  The player is "aware" of the item's effects */
     bool tried{}; /*!< ベースアイテムを未鑑定のまま試したことがあるか /  The player has "tried" one of the items */
+
+    void mark_as_tried();
 };
 
 extern std::vector<BaseitemInfo> baseitems_info;