diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-01 20:07:15 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:46:38 +0200 |
| commit | 2e2ad2edb01191dd4844768df883e7ef8ceec846 (patch) | |
| tree | ac3f0b3384de04f46bfb4d79fe890562f1eb662a | |
| parent | c1672acea02450cd5ec3ca92c83f6e82d723b21f (diff) | |
| download | muhqs-game-2e2ad2edb01191dd4844768df883e7ef8ceec846.tar.gz muhqs-game-2e2ad2edb01191dd4844768df883e7ef8ceec846.zip | |
add support for additional base actions
| -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 |
