diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2024-03-26 18:59:22 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:10 +0200 |
| commit | 305897c542b034ab2b08f880436afb4e066c88de (patch) | |
| tree | 23a3986d99ed4f4d09a42c987513d4271a1f7684 /go/game/unit.go | |
| parent | 2ad43658e3fdd7bda4cf568f1c60281ec1534bda (diff) | |
| download | muhqs-game-305897c542b034ab2b08f880436afb4e066c88de.tar.gz muhqs-game-305897c542b034ab2b08f880436afb4e066c88de.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() { |
