aboutsummaryrefslogtreecommitdiff
path: root/go/game/action.go
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2025-09-03 12:37:52 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2025-09-03 12:39:42 +0200
commit67faa0f3bf6fb047d19372c9b671a45887b99f6e (patch)
tree359daa9bf5f3ccd04678598b6fa17e60d5fcc768 /go/game/action.go
parent1f6b30ebec826fe886829c2618ed0b109009e3b8 (diff)
downloadmuhqs-game-67faa0f3bf6fb047d19372c9b671a45887b99f6e.tar.gz
muhqs-game-67faa0f3bf6fb047d19372c9b671a45887b99f6e.zip
implement the patrician
Diffstat (limited to 'go/game/action.go')
-rw-r--r--go/game/action.go12
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 {