diff options
Diffstat (limited to 'go/game/action.go')
| -rw-r--r-- | go/game/action.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/go/game/action.go b/go/game/action.go index 856ea6bc..91ea223c 100644 --- a/go/game/action.go +++ b/go/game/action.go @@ -660,6 +660,18 @@ type FreeAction struct { desc string } +// newControllerCostFunc returns a new cost function checking the controller's resource and decreasing it accordingly. +func newControllerResourceCostFunc(p Permanent, amount int) ActionCostFunc { + return func(s *LocalState) bool { + c := p.Controller() + if c.Resource < amount { + return false + } + c.Resource -= amount + return true + } +} + func NewFreeAction(p Permanent, resolveProto ActionFuncPrototype, costFunc ActionCostFunc, desc string, ) *FreeAction { |
