feat: some typedefs for the RP in the RPG

This commit is contained in:
Zhongheng Liu 2024-10-23 23:26:20 +03:00
commit 4ee1a32e4e
Signed by: steven
GPG key ID: DC8F48E7B4C40905
2 changed files with 61 additions and 0 deletions

3
data/objects.json Normal file
View file

@ -0,0 +1,3 @@
{
}

58
utils/types/objects.go Normal file
View file

@ -0,0 +1,58 @@
package types
func InitObjects() {
WEAPON_OLD_FAMILY_SWORD := Weapon{
name: "Mjorrsword",
atk: 10,
meta: WeaponMetadata{
info: "The Mjorrsword is an old sword, a legacy in your family. \nLast used in the Fjolrholmer Revolution, it is now yours to hold on to.",
}
}
}
type Inventory struct {
weapons []Weapon
foods []Food
potions []Potion
}
type Player struct {
name string
inventory Inventory
effects []Effect
wallet []Currency
}
type WeaponMetadata struct {
info string
}
type Weapon struct {
name string
atk int
meta WeaponMetadata
}
type Food struct {
name string
regen_health int
}
type Effect struct {
name string
effect func(p *Player)
}
type Potion struct {
name string
effect Effect
}
type Currency struct {
name string
prefix string
value int
amount int
}
type Consumable interface {
Food | Potion
}