From 8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 4 Feb 2023 18:51:31 +0100 Subject: improve permanent pile support * Fix alot of bugs caused by permanents without tiles * Implement a permanent choice to select the permanents in a pile * Fix how pile hooks are called --- go/game/state.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'go/game/state.go') 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 -- cgit v1.2.3