From 011b95e8db31f1306eafb575ed12bed4e2fc1ca3 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 3 Apr 2023 16:47:42 +0200 Subject: implement equipment with next unit play option Also make more state methods private. --- go/game/action.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'go/game/action.go') 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) } -- cgit v1.2.3