aboutsummaryrefslogtreecommitdiff
path: root/go/game/unit.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-12-27 12:40:19 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:58 +0100
commit4e2ab55d345fd5e5c5d2d5bc56948611b15564d5 (patch)
treec6998ac54687c442ad0baa541edd0fbf917b1308 /go/game/unit.go
parent5aa8e7ddbc41aed55e7918e6afaec0b5c07fa510 (diff)
downloadmuhqs-game-4e2ab55d345fd5e5c5d2d5bc56948611b15564d5.tar.gz
muhqs-game-4e2ab55d345fd5e5c5d2d5bc56948611b15564d5.zip
introduce game.State interface abstraction
This allows to not use the internal game state directly from client code.
Diffstat (limited to 'go/game/unit.go')
-rw-r--r--go/game/unit.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/go/game/unit.go b/go/game/unit.go
index b71596d4..fd08b481 100644
--- a/go/game/unit.go
+++ b/go/game/unit.go
@@ -159,7 +159,7 @@ func (u *Unit) AvailSlowActions() (actions []Action) {
actions = append(actions, NewMoveAction(u))
}
- m := u.Controller().gameState.Map
+ m := u.Controller().gameState.Map()
if u.AvailAttackActions > 0 && !INVALID_ATTACK(u.Attack) &&
len(u.AttackableEnemyPermanents(m)) > 0 {
@@ -221,7 +221,7 @@ func (u *Unit) AvailFreeActions() (actions []Action) {
func (u *Unit) CurrentlyAvailActions() (actions []Action) {
s := u.Controller().gameState
- if s.ActivePlayer == u.Controller() && s.ActivePhase == Phases.ActionPhase {
+ if s.IsActivePlayer(u.Controller()) && s.ActivePhase() == Phases.ActionPhase {
actions = append(actions, u.AvailSlowActions()...)
}
actions = append(actions, u.AvailFreeActions()...)