diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-03-26 18:59:22 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:56 +0100 |
| commit | d46eb8bca2c26121d71f9122bd9930104734519d (patch) | |
| tree | 9d533f3dc5589deadef5fe8f7aecac72d00c0a3c /go/game/unit.go | |
| parent | f5e740230cc2ac034b98496f1c0715b3ed6cef27 (diff) | |
| download | muhqs-game-d46eb8bca2c26121d71f9122bd9930104734519d.tar.gz muhqs-game-d46eb8bca2c26121d71f9122bd9930104734519d.zip | |
implment upkeep costs using ResourceCosts
Diffstat (limited to 'go/game/unit.go')
| -rw-r--r-- | go/game/unit.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/go/game/unit.go b/go/game/unit.go index f1e38078..c875fa50 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -10,7 +10,7 @@ type Unit struct { Health int Movement Movement Attack Attack - upkeep int + upkeep *ResourceCosts FullActions []*FullAction FreeActions []*FreeAction // Effects []Effects @@ -29,9 +29,9 @@ func NewUnit(card *Card, tile *Tile, owner *Player) *Unit { movement = parseMovement(movementDesc) } - upkeep, ok := card.Values["upkeep"].(int) - if !ok { - upkeep = 0 + upkeep := card.PlayCosts + if upkeep == nil { + upkeep = &ResourceCosts{fixed: 0} } var attack Attack @@ -66,7 +66,7 @@ func NewUnitFromPath(cardPath string, tile *Tile, owner *Player) *Unit { } func (u *Unit) UpkeepCost() int { - return u.upkeep + return u.upkeep.Costs(u.controller.gameState) } func (u *Unit) resetBaseActions() { |
