#include "system/baseitem-info.h"
#include "object/tval-types.h"
#include "sv-definition/sv-bow-types.h"
+#include "sv-definition/sv-food-types.h"
BaseitemKey::BaseitemKey(const ItemKindType type_value, const std::optional<int> &subtype_value)
: type_value(type_value)
}
}
+/*
+ * @brief 未鑑定名を持つか否かの判定
+ * @details FOODはキノコが該当する
+ */
+bool BaseitemKey::has_unidentified_name() const
+{
+ switch (this->type_value) {
+ case ItemKindType::AMULET:
+ case ItemKindType::RING:
+ case ItemKindType::STAFF:
+ case ItemKindType::WAND:
+ case ItemKindType::ROD:
+ case ItemKindType::SCROLL:
+ case ItemKindType::POTION:
+ return true;
+ case ItemKindType::FOOD:
+ return this->is_mushrooms();
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::can_recharge() const
+{
+ switch (this->type_value) {
+ case ItemKindType::STAFF:
+ case ItemKindType::WAND:
+ case ItemKindType::ROD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::is_wand_rod() const
+{
+ switch (this->type_value) {
+ case ItemKindType::WAND:
+ case ItemKindType::ROD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::is_wand_staff() const
+{
+ switch (this->type_value) {
+ case ItemKindType::WAND:
+ case ItemKindType::STAFF:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::is_protector() const
+{
+ switch (this->type_value) {
+ case ItemKindType::BOOTS:
+ case ItemKindType::GLOVES:
+ case ItemKindType::HELM:
+ case ItemKindType::CROWN:
+ case ItemKindType::SHIELD:
+ case ItemKindType::CLOAK:
+ case ItemKindType::SOFT_ARMOR:
+ case ItemKindType::HARD_ARMOR:
+ case ItemKindType::DRAG_ARMOR:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::can_be_aura_protector() const
+{
+ switch (this->type_value) {
+ case ItemKindType::CLOAK:
+ case ItemKindType::SOFT_ARMOR:
+ case ItemKindType::HARD_ARMOR:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::is_wearable() const
+{
+ switch (this->type_value) {
+ case ItemKindType::BOW:
+ case ItemKindType::DIGGING:
+ case ItemKindType::HAFTED:
+ case ItemKindType::POLEARM:
+ case ItemKindType::SWORD:
+ case ItemKindType::BOOTS:
+ case ItemKindType::GLOVES:
+ case ItemKindType::HELM:
+ case ItemKindType::CROWN:
+ case ItemKindType::SHIELD:
+ case ItemKindType::CLOAK:
+ case ItemKindType::SOFT_ARMOR:
+ case ItemKindType::HARD_ARMOR:
+ case ItemKindType::DRAG_ARMOR:
+ case ItemKindType::LITE:
+ case ItemKindType::AMULET:
+ case ItemKindType::RING:
+ case ItemKindType::CARD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::is_weapon() const
+{
+ switch (this->type_value) {
+ case ItemKindType::BOW:
+ case ItemKindType::DIGGING:
+ case ItemKindType::HAFTED:
+ case ItemKindType::POLEARM:
+ case ItemKindType::SWORD:
+ return true;
+ default:
+ return false;
+ }
+}
+
+bool BaseitemKey::is_mushrooms() const
+{
+ if (!this->subtype_value.has_value()) {
+ return false;
+ }
+
+ switch (this->subtype_value.value()) {
+ case SV_FOOD_POISON:
+ case SV_FOOD_BLINDNESS:
+ case SV_FOOD_PARANOIA:
+ case SV_FOOD_CONFUSION:
+ case SV_FOOD_HALLUCINATION:
+ case SV_FOOD_PARALYSIS:
+ case SV_FOOD_WEAKNESS:
+ case SV_FOOD_SICKNESS:
+ case SV_FOOD_STUPIDITY:
+ case SV_FOOD_NAIVETY:
+ case SV_FOOD_UNHEALTH:
+ case SV_FOOD_DISEASE:
+ case SV_FOOD_CURE_POISON:
+ case SV_FOOD_CURE_BLINDNESS:
+ case SV_FOOD_CURE_PARANOIA:
+ case SV_FOOD_CURE_CONFUSION:
+ case SV_FOOD_CURE_SERIOUS:
+ case SV_FOOD_RESTORE_STR:
+ case SV_FOOD_RESTORE_CON:
+ case SV_FOOD_RESTORING:
+ return true;
+ default:
+ return false;
+ }
+}
+
BaseitemInfo::BaseitemInfo()
: bi_key(ItemKindType::NONE)
{