aboutsummaryrefslogtreecommitdiff
path: root/go/game/unit.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2024-03-26 20:36:22 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:57:11 +0200
commitaef4d5ea938f55831e70e28ae2a19c1b23797d8a (patch)
treecfd941d4db8c28745b8525d7631f81e6555a75c2 /go/game/unit.go
parent5b935ead582537bd1a038a98dd4d252c481482d7 (diff)
downloadmuhqs-game-aef4d5ea938f55831e70e28ae2a19c1b23797d8a.tar.gz
muhqs-game-aef4d5ea938f55831e70e28ae2a19c1b23797d8a.zip
only generate ArtifactMoveActions if the switched positions are suitable
Diffstat (limited to 'go/game/unit.go')
-rw-r--r--go/game/unit.go5
1 files changed, 4 insertions, 1 deletions
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))
}
}