From 9e082b76ad5e0f90814bc88265149a6541b8fb45 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 24 Feb 2023 13:48:33 +0100 Subject: intermeditae commit * implement dopping piles * implement simple spell targeting * add some simple spells --- go/game/state.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'go/game/state.go') diff --git a/go/game/state.go b/go/game/state.go index 0ef8c4d4..82dccf15 100644 --- a/go/game/state.go +++ b/go/game/state.go @@ -264,7 +264,7 @@ func (s *State) pushAction(a Action) { s.Stack.push(a) } -func (s *State) DeclareAction(a Action) { +func (s *State) declareAction(a Action) { var err error err = a.CheckTargets(s) @@ -307,7 +307,7 @@ func (s *State) allPassing(skipFirst bool) bool { case *PassPriority: log.Printf("%s passed %d/%d\n", p.Name, i+1, nPlayers) default: - s.DeclareAction(a) + s.declareAction(a) return false } } @@ -382,13 +382,23 @@ func removePtr[P *Unit](collection []P, ptr P) []P { } func (s *State) destroyPermanent(p Permanent) { - leaveTile(p) + t := TileOrContainingPermTile(p) + + _leaveTile(p) s.removePermanent(p) switch p := p.(type) { case *Unit: s.Units = removePtr(s.Units, p) } + + if pile := p.Pile(); len(pile) > 0 { + dropAction := newPileDropAction(p, t, pile) + prompt(p.Controller().Ctrl, + newTargetSelectionPrompt(dropAction, fmt.Sprintf("Drop %v's pile", p))) + s.declareAction(dropAction) + } + p.Owner().DiscardPile.AddCard(p.Card()) } -- cgit v1.2.3