aboutsummaryrefslogtreecommitdiff
path: root/go/game/action.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-04-03 16:47:42 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-01-27 16:43:53 +0100
commit011b95e8db31f1306eafb575ed12bed4e2fc1ca3 (patch)
tree44b007c1324e99e26014bab45faefa755c6ab38d /go/game/action.go
parent4d33d8b637211aaa3e0adfda68e363e64f90623f (diff)
downloadmuhqs-game-011b95e8db31f1306eafb575ed12bed4e2fc1ca3.tar.gz
muhqs-game-011b95e8db31f1306eafb575ed12bed4e2fc1ca3.zip
implement equipment with next unit play option
Also make more state methods private.
Diffstat (limited to 'go/game/action.go')
-rw-r--r--go/game/action.go15
1 files changed, 13 insertions, 2 deletions
diff --git a/go/game/action.go b/go/game/action.go
index 271f5f51..fbabb06b 100644
--- a/go/game/action.go
+++ b/go/game/action.go
@@ -127,7 +127,10 @@ type PlayAction struct {
ActionBase
}
-var permanentPlayActionTarget = TargetDesc{"available spawn tile", "1"}
+var (
+ permanentPlayActionTarget = TargetDesc{"available spawn tile", "1"}
+ equipmentPlayActionTarget = TargetDesc{"available spawn tile", "?"}
+)
func NewPlayAction(p *Player, c *Card, args ...interface{}) *PlayAction {
a := &PlayAction{ActionBase{
@@ -155,7 +158,11 @@ func NewPlayAction(p *Player, c *Card, args ...interface{}) *PlayAction {
s := p.gameState
if c.IsPermanent() {
- a.targets = newTargets(newTarget(s, permanentPlayActionTarget, a))
+ if c.Type == CardTypes.Equipment {
+ a.targets = newTargets(newTarget(s, equipmentPlayActionTarget, a))
+ } else {
+ a.targets = newTargets(newTarget(s, permanentPlayActionTarget, a))
+ }
} else if targetDesc := c.Impl.playTargets(); targetDesc != INVALID_TARGET_DESC {
a.targets = newTargets(newTarget(s, targetDesc, a))
} else {
@@ -175,6 +182,10 @@ func (a *PlayAction) String() string {
return fmt.Sprintf(" %s play %s", p.Name, a.Card.Name)
}
+ if a.Card.Type == CardTypes.Equipment && len(a.Target().sel) == 0 {
+ return fmt.Sprintf("%s play %s@next unit", p.Name, a.Card.Name)
+ }
+
return fmt.Sprintf("%s play %s@%v", p.Name, a.Card.Name, a.targets)
}