made items affect stats

This commit is contained in:
2025-12-01 10:59:00 -05:00
parent d6dff2a539
commit 77cb83cfd5
2 changed files with 54 additions and 10 deletions

24
types.h
View File

@@ -57,23 +57,37 @@ enum ItemType {
template <>
struct std::formatter<ItemType> : std::formatter<string_view> {
bool title_case = false;
constexpr auto parse(std::format_parse_context& ctx) {
auto it = ctx.begin();
if (it == ctx.end()) return it;
if (*it == 't') {
title_case = true;
++it;
}
return it;
}
auto format(const ItemType& item_type, std::format_context& ctx) const {
std::string_view item_type_str;
switch (item_type) {
case TEARS_UP:
item_type_str = "TEARS_UP";
item_type_str = title_case ? "Tears Up" : "TEARS_UP";
break;
case TEARS_DOWN:
item_type_str = "TEARS_DOWN";
item_type_str = title_case ? "Tears Down" : "TEARS_DOWN";
break;
case RANGE_UP:
item_type_str = "RANGE_UP";
item_type_str = title_case ? "Range Up" : "RANGE_UP";
break;
case RANGE_DOWN:
item_type_str = "RANGE_DOWN";
item_type_str = title_case ? "Range Down" : "RANGE_DOWN";
break;
case ITEM_TYPE_COUNT:
item_type_str = "ITEM_TYPE_COUNT";
item_type_str = title_case ? "Item Type Count" : "ITEM_TYPE_COUNT";
break;
}
return std::formatter<string_view>::format(item_type_str, ctx);;