aboutsummaryrefslogtreecommitdiff
path: root/go/game/state.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-24 13:48:33 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:51 +0100
commit9e082b76ad5e0f90814bc88265149a6541b8fb45 (patch)
treed32aab723a05335dba53b68023f9b70e1148c1ba /go/game/state.go
parent7788121beb6b9dd8540d4345e8e841830ff2c490 (diff)
downloadmuhqs-game-9e082b76ad5e0f90814bc88265149a6541b8fb45.tar.gz
muhqs-game-9e082b76ad5e0f90814bc88265149a6541b8fb45.zip
intermeditae commit
* implement dopping piles * implement simple spell targeting * add some simple spells
Diffstat (limited to 'go/game/state.go')
-rw-r--r--go/game/state.go16
1 files changed, 13 insertions, 3 deletions
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())
}