From fb755f3d325720b1e42df5bea049781b538afa5c Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 3 Sep 2025 12:36:30 +0200 Subject: fix String method of free action using nil targets --- go/game/action.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'go') diff --git a/go/game/action.go b/go/game/action.go index 5bb8bd67..856ea6bc 100644 --- a/go/game/action.go +++ b/go/game/action.go @@ -682,13 +682,22 @@ func NewFreeAction(p Permanent, resolveProto ActionFuncPrototype, costFunc Actio func (a *FreeAction) Speed() ActionSpeed { return fast } -func (a *FreeAction) String() string { - p := a.source.(Permanent) - if a.targets.RequireSelection() { - return fmt.Sprintf("free_action %s", a.desc) +func (a *FreeAction) String() (s string) { + switch src := a.source.(type) { + case *Card: + s += fmt.Sprintf("%v: %s ", a.Controller(), src.Name) + default: + s += fmt.Sprintf("%s", src) } - return fmt.Sprintf("%v: %s free_action@%v", p.Controller(), p.Card().Name, a.targets) + s += " free_action" + if a.targets == nil || a.targets.RequireSelection() { + s += fmt.Sprintf(" %s", a.desc) + } else { + s += fmt.Sprintf("@%v", a.targets) + } + + return } var buyActionTargetDesc = TargetDesc{"store card", "?"} -- cgit v1.2.3