diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-04 13:08:55 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:46 +0100 |
| commit | 54695e630229222fe785074fc37f1ac4d35164b6 (patch) | |
| tree | cc6f0962897e77ac99a582b28169f1abfa4ae06d | |
| parent | 4f353285ea156bfd6332499a16ece8b16139e87c (diff) | |
| download | muhqs-game-54695e630229222fe785074fc37f1ac4d35164b6.tar.gz muhqs-game-54695e630229222fe785074fc37f1ac4d35164b6.zip | |
move unit upkeep code to Unit onUpkeep hook
| -rw-r--r-- | go/game/player.go | 3 | ||||
| -rw-r--r-- | go/game/unit.go | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/go/game/player.go b/go/game/player.go index 0221eb34..b1cb6916 100644 --- a/go/game/player.go +++ b/go/game/player.go @@ -68,8 +68,7 @@ func (p *Player) Upkeep() { // TODO: let players decide if they want to pay the upkeep p.Resource -= unit.Upkeep - - unit.resetBaseActions() + unit.onUpkeep() } } diff --git a/go/game/unit.go b/go/game/unit.go index c24e3901..fba85f30 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -120,6 +120,10 @@ func (u *Unit) resetBaseActions() { u.AvailAttackActions = DEFAULT_AVAIL_ATTACK_ACTIONS + u.additionalAttackActions } +func (u *Unit) onUpkeep() { + u.resetBaseActions() +} + func (u *Unit) move(s *State, tile *Tile) { u.tile.Permanent = nil tile.Permanent = u |
