xonecas.ioDon't click! Sean Caetano Martin Sign in
tiny-adventure / internal / model / unit.go 29 lines858 bytes Raw
1package model
2
3type Unit struct {
4	ID        string    `json:"id"`
5	Name      string    `json:"name"`
6	Class     string    `json:"class"`
7	Race      string    `json:"race"`
8	Faction   string    `json:"faction,omitempty"`
9	Level     int       `json:"level"`
10	XP        int       `json:"xp"`
11	Stats     Stats     `json:"stats"`
12	Abilities []Ability `json:"abilities"`
13	Gear      Gear      `json:"gear,omitempty"`
14	Traits    []string  `json:"traits,omitempty"`
15	Weak      []string  `json:"weak,omitempty"`
16	Resist    []string  `json:"resist,omitempty"`
17}
18
19func (u Unit) Fallen() bool { return u.Stats.HP <= 0 }
20
21type Party struct {
22	Units     []Unit `json:"units"`
23	Inventory []Item `json:"inventory"`
24	Keys      []Item `json:"keys"`
25	X         int    `json:"x"`
26	Y         int    `json:"y"`
27	Gold      int    `json:"gold"`
28	Potions   int    `json:"potions"`
29}