Files
DungeonsOfKharadum/src/scripts/item_database.gd
Elrinth 3a7fb29d58 Added rpg system for combat
added lots of loot to find
added level up system
2026-01-11 23:12:09 +01:00

1362 lines
40 KiB
GDScript

class_name ItemDatabase
extends RefCounted
# Item Database - Contains all item definitions and generation functions
# Coordinates are (x, y) where x is column, y is row in items_n_shit.png (20x14 grid)
# Frame calculation: frame = y * 20 + x
# Item rarity tiers for random generation
enum ItemRarity {
COMMON, # Basic items (food, low-tier equipment)
UNCOMMON, # Mid-tier equipment
RARE, # High-tier equipment
EPIC, # Legendary equipment
CONSUMABLE # Potions and consumables
}
# Dictionary to store all item definitions by ID
# Format: { "item_id": { item_data } }
static var item_definitions: Dictionary = {}
# Initialize item database
static func _initialize():
if item_definitions.is_empty():
_load_all_items()
# Load all item definitions
static func _load_all_items():
# ARMOUR items (row 0)
_register_item("silk_robe", {
"item_name": "Silk Robe",
"description": "A luxurious silk robe",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 10, # 10,0
"modifiers": {"def": 1, "end": 1},
"buy_cost": 50,
"sell_worth": 15,
"rarity": ItemRarity.COMMON
})
_register_item("padded_robe", {
"item_name": "Padded Robe",
"description": "A padded robe for protection",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 11, # 11,0
"modifiers": {"def": 2},
"buy_cost": 60,
"sell_worth": 18,
"rarity": ItemRarity.COMMON
})
_register_item("rags", {
"item_name": "Rags",
"description": "Tattered rags",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 12, # 12,0
"modifiers": {"def": 0},
"buy_cost": 10,
"sell_worth": 3,
"rarity": ItemRarity.COMMON
})
_register_item("leather_armour", {
"item_name": "Leather Armour",
"description": "A nice leather armour",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 13, # 13,0
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Tunic Body/LeatherTunic.png",
"modifiers": {"def": 3},
"buy_cost": 80,
"sell_worth": 24,
"rarity": ItemRarity.COMMON
})
_register_item("plate", {
"item_name": "Plate",
"description": "Heavy plate armour",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 14, # 14,0
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Armour Body/SteelArmour.png",
"modifiers": {"def": 5, "end": 1},
"buy_cost": 150,
"sell_worth": 45,
"rarity": ItemRarity.UNCOMMON
})
_register_item("full_mail", {
"item_name": "Full Mail",
"description": "Complete chainmail armour",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 15, # 15,0
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Armour Body/IronArmour.png",
"modifiers": {"def": 4},
"buy_cost": 120,
"sell_worth": 36,
"rarity": ItemRarity.UNCOMMON
})
_register_item("golden_mail", {
"item_name": "Golden Mail",
"description": "Exquisite golden chainmail",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ARMOUR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 16, # 16,0
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 2 - Clothes/Armour Body/GoldArmour.png",
"modifiers": {"def": 6, "end": 2},
"buy_cost": 300,
"sell_worth": 90,
"rarity": ItemRarity.RARE
})
# OFFHAND items (shields, row 0)
_register_item("wooden_shield", {
"item_name": "Wooden Shield",
"description": "A basic wooden shield",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.OFFHAND,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 17, # 17,0
"modifiers": {"def": 2},
"buy_cost": 40,
"sell_worth": 12,
"rarity": ItemRarity.COMMON
})
_register_item("sturdy_shield", {
"item_name": "Sturdy Shield",
"description": "A reinforced shield",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.OFFHAND,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 18, # 18,0
"modifiers": {"def": 3},
"buy_cost": 70,
"sell_worth": 21,
"rarity": ItemRarity.COMMON
})
_register_item("metal_shield", {
"item_name": "Metal Shield",
"description": "A strong metal shield",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.OFFHAND,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 0 * 20 + 19, # 19,0
"modifiers": {"def": 4},
"buy_cost": 100,
"sell_worth": 30,
"rarity": ItemRarity.UNCOMMON
})
# HEADGEAR items (row 1)
_register_item("beanie", {
"item_name": "Beanie",
"description": "A warm beanie",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 10, # 10,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Headband.png",
"modifiers": {"def": 1},
"buy_cost": 20,
"sell_worth": 6,
"rarity": ItemRarity.COMMON
})
_register_item("leather_helm", {
"item_name": "Leather Helm",
"description": "A nice leather helm",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 11, # 11,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/NoviceHelm.png",
"modifiers": {"def": 2},
"buy_cost": 50,
"sell_worth": 15,
"rarity": ItemRarity.COMMON
})
_register_item("nomads_helm", {
"item_name": "Nomad's Helm",
"description": "A helm for travelers",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 12, # 12,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Range/RangerHatGreen.png",
"modifiers": {"def": 2, "dex": 1},
"buy_cost": 60,
"sell_worth": 18,
"rarity": ItemRarity.COMMON
})
_register_item("strong_helm", {
"item_name": "Strong Helm",
"description": "A reinforced helm",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 13, # 13,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/KnightHelm.png",
"modifiers": {"def": 3},
"buy_cost": 80,
"sell_worth": 24,
"rarity": ItemRarity.UNCOMMON
})
_register_item("plate_helm", {
"item_name": "Plate Helm",
"description": "Heavy plate helm",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 14, # 14,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/SoldierSteelHelmBlue.png",
"modifiers": {"def": 4},
"buy_cost": 120,
"sell_worth": 36,
"rarity": ItemRarity.UNCOMMON
})
_register_item("warriors_helm", {
"item_name": "Warrior's Helm",
"description": "A helm for true warriors",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 15, # 15,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/DragonKnightHelm.png",
"modifiers": {"def": 5, "str": 1},
"buy_cost": 180,
"sell_worth": 54,
"rarity": ItemRarity.RARE
})
_register_item("paladins_helm", {
"item_name": "Paladin's Helm",
"description": "A blessed paladin helm",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.HEADGEAR,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 16, # 16,1
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 6 - Headgears/Basic Melee/PaladinHelmCyan.png",
"modifiers": {"def": 5, "wis": 1},
"buy_cost": 200,
"sell_worth": 60,
"rarity": ItemRarity.RARE
})
# ACCESSORY items (row 1)
_register_item("amulet_of_strength", {
"item_name": "Amulet of Strength",
"description": "Grants +3 STR",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ACCESSORY,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 17, # 17,1
"modifiers": {"str": 3},
"buy_cost": 250,
"sell_worth": 75,
"rarity": ItemRarity.RARE
})
_register_item("elven_shield", {
"item_name": "Elven Shield",
"description": "An elegant elven shield",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.OFFHAND,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 18, # 18,1
"modifiers": {"def": 5, "dex": 1},
"buy_cost": 180,
"sell_worth": 54,
"rarity": ItemRarity.RARE
})
_register_item("tower_shield", {
"item_name": "Tower Shield",
"description": "A massive tower shield",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.OFFHAND,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 1 * 20 + 19, # 19,1
"modifiers": {"def": 6, "end": 1},
"buy_cost": 220,
"sell_worth": 66,
"rarity": ItemRarity.RARE
})
# BOOTS items (row 2)
_register_item("sandals", {
"item_name": "Sandals",
"description": "A pair of shitty sandals",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 10, # 10,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesBrown.png",
"modifiers": {"def": 1},
"buy_cost": 15,
"sell_worth": 4,
"rarity": ItemRarity.COMMON
})
_register_item("leather_boots", {
"item_name": "Leather Boots",
"description": "Comfortable leather boots",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 11, # 11,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesBrown.png",
"modifiers": {"def": 2},
"buy_cost": 40,
"sell_worth": 12,
"rarity": ItemRarity.COMMON
})
_register_item("sturdy_boots", {
"item_name": "Sturdy Boots",
"description": "Reinforced boots",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 12, # 12,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesMaple.png",
"modifiers": {"def": 3},
"buy_cost": 60,
"sell_worth": 18,
"rarity": ItemRarity.COMMON
})
_register_item("smiths_boots", {
"item_name": "Smith's Boots",
"description": "Heavy boots for smiths",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 13, # 13,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/ShoesMaple.png",
"modifiers": {"def": 3, "end": 1},
"buy_cost": 80,
"sell_worth": 24,
"rarity": ItemRarity.UNCOMMON
})
_register_item("chain_boots", {
"item_name": "Chain Boots",
"description": "Chainmail boots",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 14, # 14,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/IronBoots.png",
"modifiers": {"def": 4},
"buy_cost": 100,
"sell_worth": 30,
"rarity": ItemRarity.UNCOMMON
})
_register_item("plate_boots", {
"item_name": "Plate Boots",
"description": "Heavy plate boots",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 15, # 15,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/IronBoots.png",
"modifiers": {"def": 5},
"buy_cost": 140,
"sell_worth": 42,
"rarity": ItemRarity.UNCOMMON
})
_register_item("gold_boots", {
"item_name": "Gold Boots",
"description": "Exquisite golden boots",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.BOOTS,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 16, # 16,2
"equipmentPath": "res://assets/gfx/Puny-Characters/Layer 1 - Shoes/IronBoots.png",
"modifiers": {"def": 6, "lck": 1},
"buy_cost": 250,
"sell_worth": 75,
"rarity": ItemRarity.RARE
})
# ACCESSORY items (row 2)
_register_item("ring_of_healing", {
"item_name": "Ring of Healing",
"description": "Regenerates health over time",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ACCESSORY,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 17, # 17,2
"modifiers": {"end": 2, "hp": 20},
"buy_cost": 200,
"sell_worth": 60,
"rarity": ItemRarity.RARE
})
_register_item("ring_of_magic", {
"item_name": "Ring of Magic",
"description": "Increases mana and spell power",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ACCESSORY,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 18, # 18,2
"modifiers": {"int": 2, "mp": 30},
"buy_cost": 200,
"sell_worth": 60,
"rarity": ItemRarity.RARE
})
_register_item("ring_of_light", {
"item_name": "Ring of Light",
"description": "Increases light radius",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.ACCESSORY,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 2 * 20 + 19, # 19,2
"modifiers": {"light_radius": 2},
"buy_cost": 150,
"sell_worth": 45,
"rarity": ItemRarity.UNCOMMON
})
# WEAPONS - SWORDS (row 3)
_register_item("long_sword", {
"item_name": "Long Sword",
"description": "A standard longsword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 10, # 10,3
"modifiers": {"dmg": 5},
"buy_cost": 100,
"sell_worth": 30,
"rarity": ItemRarity.COMMON
})
_register_item("sword_of_blaze", {
"item_name": "Sword of Blaze",
"description": "A fiery sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 11, # 11,3
"modifiers": {"dmg": 8, "int": 2},
"buy_cost": 250,
"sell_worth": 75,
"rarity": ItemRarity.RARE
})
_register_item("excalibur", {
"item_name": "Excalibur",
"description": "The legendary sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 12, # 12,3
"modifiers": {"dmg": 15, "str": 3, "wis": 2},
"buy_cost": 1000,
"sell_worth": 300,
"rarity": ItemRarity.EPIC
})
_register_item("sword_of_the_wind", {
"item_name": "Sword of the Wind",
"description": "A swift sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 13, # 13,3
"modifiers": {"dmg": 7, "dex": 3},
"buy_cost": 300,
"sell_worth": 90,
"rarity": ItemRarity.RARE
})
_register_item("halbrand", {
"item_name": "Halbrand",
"description": "A powerful sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 14, # 14,3
"modifiers": {"dmg": 12, "str": 2},
"buy_cost": 400,
"sell_worth": 120,
"rarity": ItemRarity.RARE
})
_register_item("thunders_wrath", {
"item_name": "Thunder's Wrath",
"description": "A sword crackling with lightning",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 15, # 15,3
"modifiers": {"dmg": 10, "int": 3},
"buy_cost": 350,
"sell_worth": 105,
"rarity": ItemRarity.RARE
})
_register_item("bastard_sword", {
"item_name": "Bastard Sword",
"description": "A versatile sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 16, # 16,3
"modifiers": {"dmg": 6},
"buy_cost": 120,
"sell_worth": 36,
"rarity": ItemRarity.COMMON
})
_register_item("blade_of_darkness", {
"item_name": "Blade of Darkness",
"description": "A dark and deadly blade",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 17, # 17,3
"modifiers": {"dmg": 11, "lck": 2},
"buy_cost": 380,
"sell_worth": 114,
"rarity": ItemRarity.RARE
})
_register_item("golden_blade", {
"item_name": "Golden Blade",
"description": "An ornate golden sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 18, # 18,3
"modifiers": {"dmg": 9, "lck": 3},
"buy_cost": 320,
"sell_worth": 96,
"rarity": ItemRarity.RARE
})
_register_item("reapers_edge", {
"item_name": "Reaper's Edge",
"description": "A blade of death",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 3 * 20 + 19, # 19,3
"modifiers": {"dmg": 13, "lck": 2, "str": 1},
"buy_cost": 450,
"sell_worth": 135,
"rarity": ItemRarity.EPIC
})
# More SWORDS (row 4)
_register_item("singers_edge", {
"item_name": "Singer's Edge",
"description": "An elegant rapier",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 4 * 20 + 10, # 10,4
"modifiers": {"dmg": 6, "dex": 2},
"buy_cost": 150,
"sell_worth": 45,
"rarity": ItemRarity.UNCOMMON
})
_register_item("rapier", {
"item_name": "Rapier",
"description": "A precise rapier",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 4 * 20 + 11, # 11,4
"modifiers": {"dmg": 5, "dex": 3},
"buy_cost": 130,
"sell_worth": 39,
"rarity": ItemRarity.UNCOMMON
})
_register_item("buster_sword", {
"item_name": "Buster Sword",
"description": "A massive sword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"two_handed": true,
"spriteFrame": 4 * 20 + 12, # 12,4
"modifiers": {"dmg": 14, "str": 2},
"buy_cost": 500,
"sell_worth": 150,
"rarity": ItemRarity.EPIC
})
_register_item("doom_guard", {
"item_name": "Doom Guard",
"description": "A sword of doom",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 4 * 20 + 13, # 13,4
"modifiers": {"dmg": 12, "str": 3},
"buy_cost": 420,
"sell_worth": 126,
"rarity": ItemRarity.EPIC
})
_register_item("ice_age", {
"item_name": "Ice Age",
"description": "A frozen blade",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 4 * 20 + 14, # 14,4
"modifiers": {"dmg": 10, "int": 2, "wis": 1},
"buy_cost": 350,
"sell_worth": 105,
"rarity": ItemRarity.RARE
})
_register_item("god_blade", {
"item_name": "God Blade",
"description": "A divine blade",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 4 * 20 + 15, # 15,4
"modifiers": {"dmg": 16, "str": 2, "wis": 3},
"buy_cost": 800,
"sell_worth": 240,
"rarity": ItemRarity.EPIC
})
# DAGGERS (row 4)
_register_item("knife", {
"item_name": "Knife",
"description": "A sharp dagger",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.DAGGER,
"spriteFrame": 4 * 20 + 16, # 16,4
"modifiers": {"dmg": 3, "dex": 1},
"buy_cost": 40,
"sell_worth": 12,
"rarity": ItemRarity.COMMON
})
_register_item("black_shiv", {
"item_name": "Black Shiv",
"description": "A dark dagger",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.DAGGER,
"spriteFrame": 4 * 20 + 17, # 17,4
"modifiers": {"dmg": 4, "dex": 2, "lck": 1},
"buy_cost": 80,
"sell_worth": 24,
"rarity": ItemRarity.UNCOMMON
})
_register_item("golden_knife", {
"item_name": "Golden Knife",
"description": "An ornate dagger",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.DAGGER,
"spriteFrame": 4 * 20 + 18, # 18,4
"modifiers": {"dmg": 5, "lck": 2},
"buy_cost": 120,
"sell_worth": 36,
"rarity": ItemRarity.UNCOMMON
})
_register_item("bloodletter", {
"item_name": "Bloodletter",
"description": "A deadly dagger",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.DAGGER,
"spriteFrame": 4 * 20 + 19, # 19,4
"modifiers": {"dmg": 6, "dex": 3, "lck": 1},
"buy_cost": 180,
"sell_worth": 54,
"rarity": ItemRarity.RARE
})
# SWORDS and AXES (row 5)
_register_item("short_sword", {
"item_name": "Short Sword",
"description": "A basic shortsword",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SWORD,
"spriteFrame": 5 * 20 + 10, # 10,5
"modifiers": {"dmg": 4},
"buy_cost": 60,
"sell_worth": 18,
"rarity": ItemRarity.COMMON
})
_register_item("hatchet", {
"item_name": "Hatchet",
"description": "A small axe",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.AXE,
"spriteFrame": 5 * 20 + 11, # 11,5
"modifiers": {"dmg": 5, "str": 1},
"buy_cost": 70,
"sell_worth": 21,
"rarity": ItemRarity.COMMON
})
_register_item("axe", {
"item_name": "Axe",
"description": "A standard axe",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.AXE,
"spriteFrame": 5 * 20 + 12, # 12,5
"modifiers": {"dmg": 7, "str": 1},
"buy_cost": 100,
"sell_worth": 30,
"rarity": ItemRarity.COMMON
})
_register_item("golden_axe", {
"item_name": "Golden Axe",
"description": "An ornate golden axe",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.AXE,
"spriteFrame": 5 * 20 + 13, # 13,5
"modifiers": {"dmg": 9, "str": 2, "lck": 1},
"buy_cost": 250,
"sell_worth": 75,
"rarity": ItemRarity.RARE
})
_register_item("blood_axe", {
"item_name": "Blood Axe",
"description": "A savage axe",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.AXE,
"spriteFrame": 5 * 20 + 14, # 14,5
"modifiers": {"dmg": 10, "str": 3},
"buy_cost": 300,
"sell_worth": 90,
"rarity": ItemRarity.RARE
})
_register_item("battle_axe", {
"item_name": "Battle Axe",
"description": "A massive two-handed axe",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.AXE,
"two_handed": true,
"spriteFrame": 5 * 20 + 15, # 15,5
"modifiers": {"dmg": 13, "str": 3},
"buy_cost": 450,
"sell_worth": 135,
"rarity": ItemRarity.RARE
})
# STAVES (row 5)
_register_item("staff", {
"item_name": "Staff",
"description": "A basic staff",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.STAFF,
"two_handed": true,
"spriteFrame": 5 * 20 + 16, # 16,5
"modifiers": {"dmg": 3, "int": 2, "mp": 20},
"buy_cost": 80,
"sell_worth": 24,
"rarity": ItemRarity.COMMON
})
_register_item("staff_of_darkness", {
"item_name": "Staff of Darkness",
"description": "A dark staff",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.STAFF,
"two_handed": true,
"spriteFrame": 5 * 20 + 17, # 17,5
"modifiers": {"dmg": 6, "int": 4, "mp": 40},
"buy_cost": 350,
"sell_worth": 105,
"rarity": ItemRarity.RARE
})
_register_item("staff_of_light", {
"item_name": "Staff of Light",
"description": "A blessed staff",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.STAFF,
"two_handed": true,
"spriteFrame": 5 * 20 + 18, # 18,5
"modifiers": {"dmg": 6, "wis": 4, "mp": 40},
"buy_cost": 350,
"sell_worth": 105,
"rarity": ItemRarity.RARE
})
_register_item("staff_of_fire", {
"item_name": "Staff of Fire",
"description": "A fiery staff",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.STAFF,
"two_handed": true,
"spriteFrame": 5 * 20 + 19, # 19,5
"modifiers": {"dmg": 7, "int": 3, "mp": 35},
"buy_cost": 380,
"sell_worth": 114,
"rarity": ItemRarity.RARE
})
# More STAVES and SPEARS (row 6)
_register_item("staff_of_galactic_magic", {
"item_name": "Staff of Galactic Magic",
"description": "A legendary staff",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.STAFF,
"two_handed": true,
"spriteFrame": 6 * 20 + 10, # 10,6
"modifiers": {"dmg": 10, "int": 5, "wis": 3, "mp": 60},
"buy_cost": 700,
"sell_worth": 210,
"rarity": ItemRarity.EPIC
})
_register_item("spear", {
"item_name": "Spear",
"description": "A standard spear",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SPEAR,
"two_handed": true,
"spriteFrame": 6 * 20 + 11, # 11,6
"modifiers": {"dmg": 6, "dex": 1},
"buy_cost": 90,
"sell_worth": 27,
"rarity": ItemRarity.COMMON
})
_register_item("dark_spear", {
"item_name": "Dark Spear",
"description": "A dark spear",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SPEAR,
"two_handed": true,
"spriteFrame": 6 * 20 + 12, # 12,6
"modifiers": {"dmg": 8, "dex": 2, "lck": 1},
"buy_cost": 200,
"sell_worth": 60,
"rarity": ItemRarity.UNCOMMON
})
_register_item("golden_spear", {
"item_name": "Golden Spear",
"description": "An ornate spear",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SPEAR,
"two_handed": true,
"spriteFrame": 6 * 20 + 13, # 13,6
"modifiers": {"dmg": 9, "dex": 2, "lck": 2},
"buy_cost": 280,
"sell_worth": 84,
"rarity": ItemRarity.RARE
})
_register_item("blood_spear", {
"item_name": "Blood Spear",
"description": "A deadly spear",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.SPEAR,
"two_handed": true,
"spriteFrame": 6 * 20 + 14, # 14,6
"modifiers": {"dmg": 10, "dex": 3},
"buy_cost": 320,
"sell_worth": 96,
"rarity": ItemRarity.RARE
})
# MACE and BOWS (row 6)
_register_item("mace", {
"item_name": "Mace",
"description": "A heavy mace",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.MACE,
"spriteFrame": 6 * 20 + 15, # 15,6
"modifiers": {"dmg": 8, "str": 2},
"buy_cost": 120,
"sell_worth": 36,
"rarity": ItemRarity.COMMON
})
_register_item("short_bow", {
"item_name": "Short Bow",
"description": "A wooden bow made of elfish lembas bread",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.BOW,
"spriteFrame": 6 * 20 + 16, # 16,6
"modifiers": {"dmg": 4, "dex": 2},
"buy_cost": 100,
"sell_worth": 30,
"rarity": ItemRarity.COMMON
})
_register_item("dark_bow", {
"item_name": "Dark Bow",
"description": "A dark bow",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.BOW,
"spriteFrame": 6 * 20 + 17, # 17,6
"modifiers": {"dmg": 6, "dex": 3, "lck": 1},
"buy_cost": 220,
"sell_worth": 66,
"rarity": ItemRarity.UNCOMMON
})
_register_item("long_bow", {
"item_name": "Long Bow",
"description": "A powerful longbow",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.BOW,
"spriteFrame": 6 * 20 + 18, # 18,6
"modifiers": {"dmg": 7, "dex": 2},
"buy_cost": 180,
"sell_worth": 54,
"rarity": ItemRarity.UNCOMMON
})
_register_item("blood_bow", {
"item_name": "Blood Bow",
"description": "A deadly bow",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.BOW,
"spriteFrame": 6 * 20 + 19, # 19,6
"modifiers": {"dmg": 8, "dex": 3},
"buy_cost": 280,
"sell_worth": 84,
"rarity": ItemRarity.RARE
})
# More BOWS and AMMUNITION (row 7)
_register_item("strike_force", {
"item_name": "Strike Force",
"description": "A legendary bow",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.MAINHAND,
"weapon_type": Item.WeaponType.BOW,
"spriteFrame": 7 * 20 + 10, # 10,7
"modifiers": {"dmg": 10, "dex": 4, "lck": 2},
"buy_cost": 500,
"sell_worth": 150,
"rarity": ItemRarity.EPIC
})
_register_item("arrow", {
"item_name": "Arrow",
"description": "A sharp arrow made of iron and feathers from pelican birds",
"item_type": Item.ItemType.Equippable,
"equipment_type": Item.EquipmentType.OFFHAND,
"weapon_type": Item.WeaponType.AMMUNITION,
"spriteFrame": 7 * 20 + 11, # 11,7
"quantity": 13,
"can_have_multiple_of": true,
"modifiers": {"dmg": 2},
"buy_cost": 20,
"sell_worth": 6,
"rarity": ItemRarity.COMMON
})
# CONSUMABLE FOOD ITEMS (row 7)
_register_item("cheese", {
"item_name": "Cheese",
"description": "Restores 10 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 12, # 12,7
"modifiers": {"hp": 10},
"buy_cost": 15,
"sell_worth": 4,
"rarity": ItemRarity.COMMON
})
_register_item("meat", {
"item_name": "Meat",
"description": "Restores 20 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 13, # 13,7
"modifiers": {"hp": 20},
"buy_cost": 25,
"sell_worth": 7,
"rarity": ItemRarity.COMMON
})
_register_item("egg", {
"item_name": "Egg",
"description": "Restores 3 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 14, # 14,7
"modifiers": {"hp": 3},
"buy_cost": 5,
"sell_worth": 1,
"rarity": ItemRarity.COMMON
})
_register_item("fish", {
"item_name": "Fish",
"description": "Restores 5 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 15, # 15,7
"modifiers": {"hp": 5},
"buy_cost": 8,
"sell_worth": 2,
"rarity": ItemRarity.COMMON
})
_register_item("chicken_leg", {
"item_name": "Chicken Leg",
"description": "Restores 8 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 16, # 16,7
"modifiers": {"hp": 8},
"buy_cost": 12,
"sell_worth": 3,
"rarity": ItemRarity.COMMON
})
_register_item("sandwich", {
"item_name": "Sandwich",
"description": "Restores 10 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 17, # 17,7
"modifiers": {"hp": 10},
"buy_cost": 15,
"sell_worth": 4,
"rarity": ItemRarity.COMMON
})
_register_item("potato", {
"item_name": "Potato",
"description": "Restores 2 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 18, # 18,7
"modifiers": {"hp": 2},
"buy_cost": 3,
"sell_worth": 1,
"rarity": ItemRarity.COMMON
})
_register_item("steak", {
"item_name": "Steak",
"description": "Restores 14 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 7 * 20 + 19, # 19,7
"modifiers": {"hp": 14},
"buy_cost": 20,
"sell_worth": 6,
"rarity": ItemRarity.COMMON
})
# More CONSUMABLE ITEMS (row 8)
_register_item("cookie", {
"item_name": "Cookie",
"description": "Restores 4 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 13, # 13,8
"modifiers": {"hp": 4},
"buy_cost": 6,
"sell_worth": 2,
"rarity": ItemRarity.COMMON
})
_register_item("candy", {
"item_name": "Candy",
"description": "Restores 7 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 14, # 14,8
"modifiers": {"hp": 7},
"buy_cost": 10,
"sell_worth": 3,
"rarity": ItemRarity.COMMON
})
_register_item("healing_potion", {
"item_name": "Healing Potion",
"description": "Restores 50 HP",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 15, # 15,8
"modifiers": {"hp": 50},
"buy_cost": 50,
"sell_worth": 15,
"rarity": ItemRarity.CONSUMABLE
})
_register_item("rejuvenation_potion", {
"item_name": "Rejuvenation Potion",
"description": "Restores 75 HP and 75 MANA",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 16, # 16,8
"modifiers": {"hp": 75, "mp": 75},
"buy_cost": 100,
"sell_worth": 30,
"rarity": ItemRarity.CONSUMABLE
})
_register_item("dodge_potion", {
"item_name": "Dodge Potion",
"description": "Grants higher dodge chance",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 17, # 17,8
"modifiers": {"dodge_chance": 0.15}, # +15% dodge chance (temporary)
"duration": 60.0, # 60 seconds
"buy_cost": 80,
"sell_worth": 24,
"rarity": ItemRarity.CONSUMABLE
})
_register_item("mana_potion", {
"item_name": "Mana Potion",
"description": "Restores 50 MANA",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 18, # 18,8
"modifiers": {"mp": 50},
"buy_cost": 40,
"sell_worth": 12,
"rarity": ItemRarity.CONSUMABLE
})
_register_item("resistance_potion", {
"item_name": "Resistance Potion",
"description": "+25% all resistances",
"item_type": Item.ItemType.Restoration,
"equipment_type": Item.EquipmentType.NONE,
"weapon_type": Item.WeaponType.NONE,
"spriteFrame": 8 * 20 + 19, # 19,8
"modifiers": {"res_all": 25}, # +25% to all resistances
"duration": 120.0, # 120 seconds
"buy_cost": 120,
"sell_worth": 36,
"rarity": ItemRarity.CONSUMABLE
})
# Register an item in the database
static func _register_item(item_id: String, item_data: Dictionary):
item_data["item_id"] = item_id
item_definitions[item_id] = item_data
# Create an Item instance from an item ID
static func create_item(item_id: String) -> Item:
_initialize()
if not item_definitions.has(item_id):
push_error("ItemDatabase: Item ID '%s' not found!" % item_id)
return null
var item_data = item_definitions[item_id].duplicate(true)
var item = Item.new()
# Set all properties from item_data
item.item_name = item_data.get("item_name", "Unknown Item")
item.description = item_data.get("description", "")
item.item_type = item_data.get("item_type", Item.ItemType.Restoration)
item.equipment_type = item_data.get("equipment_type", Item.EquipmentType.NONE)
item.weapon_type = item_data.get("weapon_type", Item.WeaponType.NONE)
item.spriteFrame = item_data.get("spriteFrame", 0)
item.modifiers = item_data.get("modifiers", {}).duplicate(true)
item.buy_cost = item_data.get("buy_cost", 10)
item.sell_worth = item_data.get("sell_worth", 3)
item.two_handed = item_data.get("two_handed", false)
item.quantity = item_data.get("quantity", 1)
item.can_have_multiple_of = item_data.get("can_have_multiple_of", false)
item.duration = item_data.get("duration", 0.0)
# spritePath defaults to items_n_shit.png in Item class, which is correct
# spriteFrames defaults to Vector2i(20,14) in Item class, which is correct
if item_data.has("equipmentPath"):
item.equipmentPath = item_data["equipmentPath"]
if item_data.has("colorReplacements"):
item.colorReplacements = item_data["colorReplacements"].duplicate(true)
# Remove item_id from data (internal use only)
item_data.erase("item_id")
item_data.erase("rarity") # Remove rarity (internal use only)
return item
# Get a random item by rarity
static func get_random_item_by_rarity(rarity: ItemRarity) -> Item:
_initialize()
var candidates = []
for item_id in item_definitions.keys():
var item_data = item_definitions[item_id]
if item_data.has("rarity") and item_data["rarity"] == rarity:
candidates.append(item_id)
if candidates.is_empty():
# Fallback to common items
return get_random_item_by_rarity(ItemRarity.COMMON)
var random_item_id = candidates[randi() % candidates.size()]
return create_item(random_item_id)
# Get a random item (weighted by rarity)
static func get_random_item() -> Item:
_initialize()
# Weighted random: 50% common, 25% uncommon, 15% rare, 5% epic, 5% consumable
var roll = randf()
var rarity: ItemRarity
if roll < 0.5:
rarity = ItemRarity.COMMON
elif roll < 0.75:
rarity = ItemRarity.UNCOMMON
elif roll < 0.90:
rarity = ItemRarity.RARE
elif roll < 0.95:
rarity = ItemRarity.EPIC
else:
rarity = ItemRarity.CONSUMABLE
return get_random_item_by_rarity(rarity)
# Get random items for enemies (weighted towards common/uncommon)
static func get_random_enemy_drop() -> Item:
_initialize()
# Enemies: 60% common, 30% uncommon, 8% rare, 2% epic/consumable
var roll = randf()
var rarity: ItemRarity
if roll < 0.6:
rarity = ItemRarity.COMMON
elif roll < 0.9:
rarity = ItemRarity.UNCOMMON
elif roll < 0.98:
rarity = ItemRarity.RARE
else:
# 50/50 between epic and consumable
rarity = ItemRarity.EPIC if randf() < 0.5 else ItemRarity.CONSUMABLE
return get_random_item_by_rarity(rarity)
# Get random items for chests (better loot)
static func get_random_chest_item() -> Item:
_initialize()
# Chests: 40% common, 35% uncommon, 20% rare, 5% epic/consumable
var roll = randf()
var rarity: ItemRarity
if roll < 0.4:
rarity = ItemRarity.COMMON
elif roll < 0.75:
rarity = ItemRarity.UNCOMMON
elif roll < 0.95:
rarity = ItemRarity.RARE
else:
rarity = ItemRarity.EPIC if randf() < 0.5 else ItemRarity.CONSUMABLE
return get_random_item_by_rarity(rarity)
# Get random items for destroyed containers (mostly consumables, some equipment)
static func get_random_container_item() -> Item:
_initialize()
# Containers: 50% food (common restoration), 30% common equipment, 15% uncommon, 5% rare
var roll = randf()
if roll < 0.5:
# Food items (restoration items with rarity COMMON)
var food_items = []
for item_id in item_definitions.keys():
var item_data = item_definitions[item_id]
if item_data.has("rarity") and item_data["rarity"] == ItemRarity.COMMON:
if item_data.has("item_type") and item_data["item_type"] == Item.ItemType.Restoration:
food_items.append(item_id)
if not food_items.is_empty():
var random_food_id = food_items[randi() % food_items.size()]
return create_item(random_food_id)
# Fall back to normal random item with adjusted weights
roll = randf()
var rarity: ItemRarity
if roll < 0.6:
rarity = ItemRarity.COMMON
elif roll < 0.85:
rarity = ItemRarity.UNCOMMON
else:
rarity = ItemRarity.RARE
return get_random_item_by_rarity(rarity)