diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-02-17 00:29:26 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:50 +0100 |
| commit | 65aa5f53d54b4590b98a559fccfb1cc7c7644187 (patch) | |
| tree | 8b258625df3211a93efba1db889bd371e2f1d0ae /go/game/state.go | |
| parent | 1c4651a7bba1e2b23a182152dc96902e9fb6868a (diff) | |
| download | muhqs-game-65aa5f53d54b4590b98a559fccfb1cc7c7644187.tar.gz muhqs-game-65aa5f53d54b4590b98a559fccfb1cc7c7644187.zip | |
implement unit and artifact switch action
Simplify the Choice Widget and make it a TextBox variant.
Drive-by fixes:
* ui.Collection: prioritize newer widgets during active widget selection
* game.FullAction: fix incorrect cost function.
Full actions cost all available actions. Also
fix the cost check
Diffstat (limited to 'go/game/state.go')
| -rw-r--r-- | go/game/state.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/go/game/state.go b/go/game/state.go index 7fa6e1bf..4af56b10 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -362,6 +362,17 @@ func (s *State) MoveUnit(u *Unit, t *Tile) { u.move(s, t) } +func (s *State) switchPermanents(p1 Permanent, p2 Permanent) { + t1 := TileOrContainingPermTile(p1) + t2 := TileOrContainingPermTile(p2) + + leaveTile(p1) + leaveTile(p2) + + enterTileOrPile(p1, t2) + enterTileOrPile(p2, t1) +} + func (s *State) FilterUnits(filter func(*Unit) bool) []*Unit { units := []*Unit{} for _, u := range s.Units { |
