diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-09-03 15:00:05 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-09-03 15:00:05 +0200 |
| commit | b0d2ca8ccb8b42d8da23ae014d154dfde9f1cf08 (patch) | |
| tree | 09c936d9deddc903e2555f93441fa804d92817dd /go/game | |
| parent | d292115061b793c8fe959a3eecb0fd3c226f70f9 (diff) | |
| download | muhqs-game-b0d2ca8ccb8b42d8da23ae014d154dfde9f1cf08.tar.gz muhqs-game-b0d2ca8ccb8b42d8da23ae014d154dfde9f1cf08.zip | |
special case the formatting of free and full actions in choice
Diffstat (limited to 'go/game')
| -rw-r--r-- | go/game/action.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/go/game/action.go b/go/game/action.go index 91ea223c..f371aae6 100644 --- a/go/game/action.go +++ b/go/game/action.go @@ -623,7 +623,7 @@ func (a *ArtifactMoveAction) String() string { type FullAction struct { ActionBase - desc string + Desc string tag string } @@ -634,7 +634,7 @@ func newFullAction(u *Unit, proto ActionFuncPrototype, desc string) *FullAction Card: u.Card(), }, - desc: desc, + Desc: desc, } a.resolveFunc = func(s *LocalState) { @@ -649,7 +649,7 @@ func newFullAction(u *Unit, proto ActionFuncPrototype, desc string) *FullAction func (a *FullAction) String() string { u := a.source.(*Unit) if a.targets == nil || a.targets.RequireSelection() { - return fmt.Sprintf("↻ %s", a.desc) + return fmt.Sprintf("↻ %s", a.Desc) } return fmt.Sprintf("%v↻@%v", u, a.targets) @@ -657,7 +657,7 @@ func (a *FullAction) String() string { type FreeAction struct { ActionBase - desc string + Desc string } // newControllerCostFunc returns a new cost function checking the controller's resource and decreasing it accordingly. @@ -695,18 +695,19 @@ func NewFreeAction(p Permanent, resolveProto ActionFuncPrototype, costFunc Actio func (a *FreeAction) Speed() ActionSpeed { return fast } func (a *FreeAction) String() (s string) { + // Format the source switch src := a.source.(type) { case *Card: - s += fmt.Sprintf("%v: %s ", a.Controller(), src.Name) + s += fmt.Sprintf("%v: %s", a.Controller(), src.Name) default: s += fmt.Sprintf("%s", src) } - s += " free_action" + // Format the description and potential targets if a.targets == nil || a.targets.RequireSelection() { - s += fmt.Sprintf(" %s", a.desc) + s += fmt.Sprintf(" %s", a.Desc) } else { - s += fmt.Sprintf("@%v", a.targets) + s += fmt.Sprintf(" %s@%v", a.Desc, a.targets) } return |
