From 65aa5f53d54b4590b98a559fccfb1cc7c7644187 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 17 Feb 2023 00:29:26 +0100 Subject: 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 --- go/game/state.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'go/game/state.go') 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 { -- cgit v1.2.3