#define TV_EQUIP_BEGIN ItemKindType::SHOT
#define TV_EQUIP_END ItemKindType::CARD
-#define TV_WEAPON_BEGIN ItemKindType::BOW
-#define TV_WEAPON_END ItemKindType::SWORD
constexpr auto TV_WEARABLE_RANGE = EnumRange(ItemKindType::BOW, ItemKindType::CARD);
constexpr auto TV_WEAPON_RANGE = EnumRange(ItemKindType::BOW, ItemKindType::SWORD);
}
}
+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()) {
bool is_protector() const;
bool can_be_aura_protector() const;
bool is_wearable() const;
+ bool is_weapon() const;
private:
ItemKindType type_value;
*/
bool ItemEntity::is_weapon() const
{
- return (TV_WEAPON_BEGIN <= this->tval) && (this->tval <= TV_WEAPON_END);
+ return BaseitemKey(this->tval).is_weapon();
}
/*!