diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-04 18:51:31 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:46:40 +0200 |
| commit | 8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d (patch) | |
| tree | 6e201152c264184bcd5aad784386654e921c8634 /go/game/state.go | |
| parent | 083ec284a9ef286729e544df9340a12760f03ab7 (diff) | |
| download | muhqs-game-8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d.tar.gz muhqs-game-8c3456f5a120a00f8a4e89065d7d50f2c1b4ad0d.zip | |
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
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 |
