89 lines
1.7 KiB
GDScript
89 lines
1.7 KiB
GDScript
class_name Item
|
|
|
|
enum Type {
|
|
# Items
|
|
POTION = 1,
|
|
|
|
# Ingredients
|
|
ONION = 2,
|
|
SWEET_POTATO = 3,
|
|
|
|
# Recipe outputs
|
|
ASH_BAKED_SWEET_POTATO = 4,
|
|
};
|
|
|
|
enum Category {
|
|
MEDICINE,
|
|
KEY_ITEM,
|
|
INGREDIENT,
|
|
FOOD
|
|
};
|
|
|
|
static func isStackable(itemType:Type) -> bool:
|
|
match itemType:
|
|
|
|
_:
|
|
return true
|
|
|
|
static func getItemName(itemType:Type, count:int = 1) -> String:
|
|
match itemType:
|
|
Type.POTION:
|
|
if count != 1:
|
|
return "Potions"
|
|
return "Potion"
|
|
|
|
Type.ONION:
|
|
if count != 1:
|
|
return "Onions"
|
|
return "Onion"
|
|
|
|
Type.SWEET_POTATO:
|
|
if count != 1:
|
|
return "Sweet Potatoes"
|
|
return "Sweet Potato"
|
|
|
|
Type.ASH_BAKED_SWEET_POTATO:
|
|
if count != 1:
|
|
return "Ash-Baked Sweet Potatoes"
|
|
return "Ash-Baked Sweet Potato"
|
|
|
|
_:
|
|
assert(false, "Invalid item type")
|
|
return ""
|
|
|
|
static func getItemDescription(itemType:Type) -> String:
|
|
match itemType:
|
|
Type.POTION:
|
|
return "A potent healing drink, infused with magical properties. Restores health and stamina."
|
|
|
|
Type.ONION:
|
|
return "A common vegetable, known for its strong flavor and aroma. Can be used in cooking."
|
|
|
|
Type.SWEET_POTATO:
|
|
return "A nutritious root vegetable, sweet and starchy. Can be used in cooking."
|
|
|
|
Type.ASH_BAKED_SWEET_POTATO:
|
|
return "Tender, warm, and sweet meal, made by baking a sweet potato in campfire embers. Comforting, simple, and gently filling."
|
|
|
|
_:
|
|
assert(false, "Invalid item type")
|
|
return ""
|
|
|
|
static func getItemCategory(itemType:Type) -> Category:
|
|
match itemType:
|
|
Type.POTION:
|
|
return Category.MEDICINE
|
|
|
|
Type.ONION:
|
|
return Category.INGREDIENT
|
|
|
|
Type.SWEET_POTATO:
|
|
return Category.INGREDIENT
|
|
|
|
Type.ASH_BAKED_SWEET_POTATO:
|
|
return Category.FOOD
|
|
|
|
_:
|
|
assert(false, "Invalid item type")
|
|
return Category.KEY_ITEM
|