aboutsummaryrefslogtreecommitdiff
path: root/internal/object/item.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-09 05:59:20 -0400
committerhistoria <[not public]>2026-06-09 05:59:20 -0400
commit9eb5ab1818b6b19501fd7209db1987c9e06cc919 (patch)
tree76e046b0bf611dfe939a8c8f6507467de2e9e20f /internal/object/item.go
downloadthehouseoficarus-9eb5ab1818b6b19501fd7209db1987c9e06cc919.tar.gz
first commit
Diffstat (limited to 'internal/object/item.go')
-rw-r--r--internal/object/item.go62
1 files changed, 62 insertions, 0 deletions
diff --git a/internal/object/item.go b/internal/object/item.go
new file mode 100644
index 0000000..67a2998
--- /dev/null
+++ b/internal/object/item.go
@@ -0,0 +1,62 @@
+package object
+
+import "strings"
+
+type EquipSlot string
+
+const (
+ SlotHead EquipSlot = "head"
+ SlotNeck EquipSlot = "neck"
+ SlotTorso EquipSlot = "torso"
+ SlotLegs EquipSlot = "legs"
+ SlotHands EquipSlot = "hands"
+ SlotFeet EquipSlot = "feet"
+ SlotBack EquipSlot = "back"
+ SlotAmmo EquipSlot = "ammo"
+ SlotMainHand EquipSlot = "main_hand"
+ SlotOffHand EquipSlot = "off_hand"
+ SlotRing EquipSlot = "ring"
+)
+
+type WeaponType string
+
+const (
+ WeaponMelee WeaponType = "melee"
+ WeaponRanged WeaponType = "ranged"
+ WeaponTechnology WeaponType = "technology"
+)
+
+type ItemDef struct {
+ ID string `yaml:"id"`
+ Name string `yaml:"name"`
+ Aliases []string `yaml:"aliases"`
+ Description string `yaml:"description"`
+ Value int `yaml:"value"` // credits
+ Stackable bool `yaml:"stackable"`
+ EquipSlot EquipSlot `yaml:"equip_slot"`
+ WeaponType WeaponType `yaml:"weapon_type"`
+ Stats ItemStats `yaml:"stats"`
+ Speed int `yaml:"speed"` // ticks between attacks
+ Toolbelt bool `yaml:"toolbelt"` // can go on toolbelt
+}
+
+type ItemStats struct {
+ AttackBonus int `yaml:"attack_bonus"`
+ StrengthBonus int `yaml:"strength_bonus"`
+ DefenseBonus int `yaml:"defense_bonus"`
+ ScienceBonus int `yaml:"science_bonus"`
+ TechnologyBonus int `yaml:"technology_bonus"`
+}
+
+func (d *ItemDef) MatchesName(input string) bool {
+ lower := strings.ToLower(input)
+ if strings.ToLower(d.Name) == lower {
+ return true
+ }
+ for _, a := range d.Aliases {
+ if strings.ToLower(a) == lower {
+ return true
+ }
+ }
+ return false
+}