diff options
| -rw-r--r-- | go/game/player.go | 4 | ||||
| -rw-r--r-- | go/game/unit.go | 22 |
2 files changed, 19 insertions, 7 deletions
diff --git a/go/game/player.go b/go/game/player.go index 0eb474e9..0221eb34 100644 --- a/go/game/player.go +++ b/go/game/player.go @@ -69,9 +69,7 @@ func (p *Player) Upkeep() { // TODO: let players decide if they want to pay the upkeep p.Resource -= unit.Upkeep - // TODO: better refresh unit actions - unit.AvailAttackActions = 1 - unit.AvailMoveActions = 1 + unit.resetBaseActions() } } diff --git a/go/game/unit.go b/go/game/unit.go index 2bc90992..116de413 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -51,6 +51,11 @@ var UnitMarks = struct { Faith: faith, } +const ( + DEFAULT_AVAIL_MOVE_ACTIONS = 1 + DEFAULT_AVAIL_ATTACK_ACTIONS = 1 +) + type Unit struct { PermanentBase Health int @@ -61,8 +66,10 @@ type Unit struct { FreeActions []*FreeAction States map[UnitMark]int // Effects []Effects - AvailMoveActions int - AvailAttackActions int + AvailMoveActions int + additionalMoveActions int + AvailAttackActions int + additionalAttackActions int } func NewUnit(card *Card, tile *Tile, owner *Player) *Unit { @@ -94,10 +101,12 @@ func NewUnit(card *Card, tile *Tile, owner *Player) *Unit { Attack: attack, Upkeep: upkeep, States: make(map[UnitMark]int), - AvailMoveActions: 1, - AvailAttackActions: 1, + AvailMoveActions: DEFAULT_AVAIL_MOVE_ACTIONS, + AvailAttackActions: DEFAULT_AVAIL_ATTACK_ACTIONS, } + // TODO: parse effect for additional actions + u.FullActions = card.Impl.fullActions(u) u.FreeActions = card.Impl.freeActions(u) @@ -109,6 +118,11 @@ func NewUnitFromPath(cardPath string, tile *Tile, owner *Player) *Unit { return NewUnit(NewCard(cardPath), tile, owner) } +func (u *Unit) resetBaseActions() { + u.AvailMoveActions = DEFAULT_AVAIL_MOVE_ACTIONS + u.additionalMoveActions + u.AvailAttackActions = DEFAULT_AVAIL_ATTACK_ACTIONS + u.additionalAttackActions +} + func (u *Unit) move(s *State, tile *Tile) { u.tile.Permanent = nil tile.Permanent = u |
