feat: some typedefs for the RP in the RPG
This commit is contained in:
parent
dc16793ad7
commit
4ee1a32e4e
2 changed files with 61 additions and 0 deletions
3
data/objects.json
Normal file
3
data/objects.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
|
||||
}
|
58
utils/types/objects.go
Normal file
58
utils/types/objects.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue