diff options
Diffstat (limited to 'go')
| -rw-r--r-- | go/game/tile.go | 20 | ||||
| -rw-r--r-- | go/game/unit.go | 5 |
2 files changed, 16 insertions, 9 deletions
diff --git a/go/game/tile.go b/go/game/tile.go index 47f9a5d6..89d3ec3f 100644 --- a/go/game/tile.go +++ b/go/game/tile.go @@ -137,16 +137,20 @@ func (t *Tile) IsFree() bool { return t.Permanent == nil } +func (t *Tile) IsSuitableForCard(card *Card) bool { + if t.Water && !card.hasPlacementConstrain("swimming") { + return false + } + if !t.Water && card.hasPlacementConstrain("swimming") { + return false + } + + return true +} + func (t *Tile) IsAvailableForCard(card *Card) bool { if t.IsFree() { - if t.Water && !card.hasPlacementConstrain("swimming") { - return false - } - if !t.Water && card.hasPlacementConstrain("swimming") { - return false - } - - return true + return t.IsSuitableForCard(card) } x, err := t.Permanent.Card().getXEffect("crew") diff --git a/go/game/unit.go b/go/game/unit.go index c875fa50..9f823a0d 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -172,7 +172,10 @@ func (u *Unit) AvailSlowActions() (actions []Action) { } for _, t := range TilesInRange(m, u, 1) { - if t.Permanent != nil && t.Permanent.Card().Type.IsArtifact() { + // Only generate a ArtifactSwitchAction if the tiles are current + // tiles are suitable for both permanents + if t.Permanent != nil && t.Permanent.Card().Type.IsArtifact() && + t.IsSuitableForCard(u.Card()) && u.Tile().IsSuitableForCard(t.Permanent.Card()) { actions = append(actions, newArtifactSwitchAction(u, t.Permanent)) } } |
