diff options
Diffstat (limited to 'go/game/unit.go')
| -rw-r--r-- | go/game/unit.go | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/go/game/unit.go b/go/game/unit.go index 9f823a0d..b71596d4 100644 --- a/go/game/unit.go +++ b/go/game/unit.go @@ -170,35 +170,41 @@ func (u *Unit) AvailSlowActions() (actions []Action) { for _, p := range u.FullActions { actions = append(actions, p) } - - for _, t := range TilesInRange(m, u, 1) { - // 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)) - } - } } if u.AvailAttackActions > 0 || u.AvailMoveActions > 0 { - for _, tile := range TilesInRange(m, u, 1) { - if tile.Permanent == nil { + for _, t := range TilesInRange(m, u, 1) { + if t.Permanent == nil { continue } - if equipment, ok := tile.Permanent.(*Equipment); ok { + // Equipment Actions + if equipment, ok := t.Permanent.(*Equipment); ok { actions = append(actions, NewEquipAction(u, equipment)) } - for _, perm := range tile.Permanent.Pile() { + for _, perm := range t.Permanent.Pile() { if equipment, ok := perm.(*Equipment); ok { actions = append(actions, NewEquipAction(u, equipment)) } } - if tile.Permanent.Card().Type.IsArtifact() { - actions = append(actions, newArtifactMoveAction(u, tile.Permanent)) + // Artifact Actions + if t.Permanent.Card().Type.IsArtifact() { + // ArtifactMoveActions are FullActions + if u.AvailAttackActions > 0 && u.AvailMoveActions > 0 { + actions = append(actions, newArtifactMoveAction(u, t.Permanent)) + } + + // ArtifactSwitchActions replace the MoveAction + if u.AvailMoveActions > 0 { + // Only generate an ArtifactSwitchAction if the 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)) + } + } } } } |
