2 * @brief ベースアイテム情報の構造体 / Information about object "kinds", including player knowledge.
6 * ゲーム進行用のセーブファイル上では aware と tried のみ保存対象とすること。と英文ではあるが実際はもっとある様子である。 /
7 * Only "aware" and "tried" are saved in the savefile
10 #include "system/baseitem-info.h"
11 #include "object/tval-types.h"
12 #include "sv-definition/sv-bow-types.h"
14 BaseitemKey::BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value)
15 : type_value(type_value)
16 , subtype_value(subtype_value)
20 bool BaseitemKey::operator==(const BaseitemKey &other) const
22 return (this->type_value == other.type_value) && (this->subtype_value == other.subtype_value);
25 // @details type_valueに大小があればそれを判定し、同一ならばsubtype_valueの大小を判定する.
26 bool BaseitemKey::operator<(const BaseitemKey &other) const
28 if (this->type_value < other.type_value) {
32 if (this->type_value > other.type_value) {
36 return this->subtype_value < other.subtype_value;
39 ItemKindType BaseitemKey::tval() const
41 return this->type_value;
44 std::optional<int> BaseitemKey::sval() const
46 return this->subtype_value;
50 * @brief 射撃武器に対応する矢/弾薬のベースアイテムIDを返す
51 * @return 対応する矢/弾薬のベースアイテムID
53 ItemKindType BaseitemKey::get_arrow_kind() const
55 if (this->type_value != ItemKindType::BOW) {
56 return ItemKindType::NONE;
59 if (!this->subtype_value.has_value()) {
60 return ItemKindType::NONE;
63 switch (this->subtype_value.value()) {
65 return ItemKindType::SHOT;
69 return ItemKindType::ARROW;
72 return ItemKindType::BOLT;
75 return ItemKindType::NO_AMMO;
77 return ItemKindType::NONE;
81 BaseitemInfo::BaseitemInfo()
82 : bi_key(ItemKindType::NONE)
86 std::vector<BaseitemInfo> baseitems_info;