diff options
Diffstat (limited to 'go/game/state.go')
| -rw-r--r-- | go/game/state.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/go/game/state.go b/go/game/state.go index 45c8bba5..35aeb342 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -126,16 +126,16 @@ func (s *State) IsValidMove(a *MoveAction) error { } u := a.Source().(*Unit) - tile := a.Targets().sel[0].(*Tile) + tile := relaxedTileTarget(a, a.Targets().sel[0]) if !slices.Contains(u.MoveRangeTiles(s.Map), tile) { - return fmt.Errorf("Unit %s at %s can not move to %s", - u.card.Name, u.tile.Position.String(), tile.Position.String()) + return fmt.Errorf("Unit %s@%v can not move to %s", + u.card.Name, u.tile.Position, tile.Position.String()) } - if tile.Permanent != nil { - return fmt.Errorf("Unit %s at %s can not move to occupied %s", - u.card.Name, u.tile.Position.String(), tile.Position.String()) + if !u.IsAvailableTile(tile) { + return fmt.Errorf("Unit %s@%v can not move to not available tile %v", + u.card.Name, u.tile.Position, tile) } return nil |
