aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go/client/game.go4
-rw-r--r--go/game/artifact.go4
-rw-r--r--go/game/permanent.go4
-rw-r--r--go/game/unit.go22
4 files changed, 26 insertions, 8 deletions
diff --git a/go/client/game.go b/go/client/game.go
index b70c2b8f..abd68378 100644
--- a/go/client/game.go
+++ b/go/client/game.go
@@ -263,7 +263,7 @@ func (g *Game) addPermActionChoice(perm game.Permanent, x, y int) {
perms := []game.Permanent{perm}
for _, p := range perm.Pile() {
- if len(p.AvailActions()) > 0 {
+ if len(p.CurrentlyAvailActions()) > 0 {
perms = append(perms, p)
}
}
@@ -284,7 +284,7 @@ func (g *Game) addPermActionChoice(perm game.Permanent, x, y int) {
}
func (g *Game) addActionChoice(perm game.Permanent, x, y int) {
- actions := perm.AvailActions()
+ actions := perm.CurrentlyAvailActions()
if len(actions) > 0 {
g.selectedObject = perm
onClick := func(c *ui.Choice, x, y int) {
diff --git a/go/game/artifact.go b/go/game/artifact.go
index 2cc0e1d7..cbe01dc2 100644
--- a/go/game/artifact.go
+++ b/go/game/artifact.go
@@ -44,7 +44,3 @@ func (a *Artifact) IsDestroyed() bool {
func (a *Artifact) Attackable() bool {
return a.Solid > 0
}
-
-func (a *Artifact) AvailActions() []Action {
- return []Action{}
-}
diff --git a/go/game/permanent.go b/go/game/permanent.go
index 91aff890..db2dcaff 100644
--- a/go/game/permanent.go
+++ b/go/game/permanent.go
@@ -29,6 +29,7 @@ type Permanent interface {
AddDamage(damage int)
IsDestroyed() bool
Attackable() bool
+ CurrentlyAvailActions() []Action
AvailActions() []Action
IsAvailableTile(*Tile) bool
@@ -145,6 +146,9 @@ func (p *PermanentBase) adjustMarks(mark PermanentMark, amount int) {
}
}
+func (p *PermanentBase) CurrentlyAvailActions() []Action { return nil }
+func (p *PermanentBase) AvailActions() []Action { return nil }
+
func (p *PermanentBase) IsAvailableTile(tile *Tile) bool {
return tile.IsAvailableForCard(p.card)
}
diff --git a/go/game/unit.go b/go/game/unit.go
index 4851a037..51383b77 100644
--- a/go/game/unit.go
+++ b/go/game/unit.go
@@ -184,7 +184,7 @@ func (u *Unit) HasFullAction() bool {
func (u *Unit) FullAction() {
}
-func (u *Unit) AvailActions() (actions []Action) {
+func (u *Unit) AvailSlowActions() (actions []Action) {
if u.AvailMoveActions > 0 && u.Movement != INVALID_MOVEMENT() {
actions = append(actions, NewMoveAction(u))
}
@@ -202,11 +202,29 @@ func (u *Unit) AvailActions() (actions []Action) {
}
}
+ return actions
+}
+
+func (u *Unit) AvailFreeActions() (actions []Action) {
for _, p := range u.FreeActions {
actions = append(actions, p)
}
+ return
+}
+
+func (u *Unit) CurrentlyAvailActions() (actions []Action) {
+ s := u.Controller().gameState
+ if s.ActivePlayer == u.Controller() && s.ActivePhase == Phases.ActionPhase {
+ actions = append(actions, u.AvailSlowActions()...)
+ }
+ actions = append(actions, u.AvailFreeActions()...)
+ return
+}
- return actions
+func (u *Unit) AvailActions() (actions []Action) {
+ actions = append(actions, u.AvailSlowActions()...)
+ actions = append(actions, u.AvailFreeActions()...)
+ return
}
func (u *Unit) onPile(containing Permanent) {