aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-02-08 13:59:57 +0100
committerFlorian Fischer <florian.fischer@muhq.space>2025-08-20 15:50:09 +0200
commit97d5079e68624f842938e4c87386752f1cfda649 (patch)
tree455cb30e00f46bcd687c095d4f3b7264e84d5a79 /go
parentb43dc7b501ea3e2cfc606c4c5b707143edb00cb3 (diff)
downloadmuhqs-game-97d5079e68624f842938e4c87386752f1cfda649.tar.gz
muhqs-game-97d5079e68624f842938e4c87386752f1cfda649.zip
remove card from hand when declaring a play action
Diffstat (limited to 'go')
-rw-r--r--go/game/action.go2
-rw-r--r--go/game/state.go3
2 files changed, 3 insertions, 2 deletions
diff --git a/go/game/action.go b/go/game/action.go
index a283bbfb..5002f58a 100644
--- a/go/game/action.go
+++ b/go/game/action.go
@@ -115,8 +115,6 @@ func NewPlayAction(p *Player, c *Card, args ...interface{}) *PlayAction {
a.targets = newTargets(s, []string{}, a)
}
- p.Hand.RemoveCard(c)
-
a.resolveFunc = func(s *State) {
s.resolvePlay(p, c, a.targets)
}
diff --git a/go/game/state.go b/go/game/state.go
index 7a54ddc0..98ac9c31 100644
--- a/go/game/state.go
+++ b/go/game/state.go
@@ -243,6 +243,9 @@ func (s *State) DeclareAction(a Action) {
}
if err == nil {
+ if pa, ok := a.(*PlayAction); ok {
+ pa.Source().(*Player).Hand.RemoveCard(pa.Card)
+ }
s.pushAction(a)
}