aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go/game/costs.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/go/game/costs.go b/go/game/costs.go
index 6bdb98f2..06e394ab 100644
--- a/go/game/costs.go
+++ b/go/game/costs.go
@@ -1,6 +1,7 @@
package game
import (
+ "log"
"strconv"
"strings"
)
@@ -27,7 +28,7 @@ func ParseResourceCosts(costsStr string) *ResourceCosts {
return &costs
}
-func (c *ResourceCosts) Costs(s *State) int {
+func (c *ResourceCosts) Costs(s *State, choosenVariadicCosts ...int) int {
if !c.IsVariadic() {
return c.fixed
}
@@ -36,8 +37,18 @@ func (c *ResourceCosts) Costs(s *State) int {
return c.fixed + c.variadicConstraintFunc(s)
}
- // TODO: implement variadic costs
- return 0
+ costs := c.fixed
+ if len(choosenVariadicCosts) == 1 {
+ vc := choosenVariadicCosts[0]
+ if vc >= 0 {
+ costs = costs + c.variadicComponents*vc
+ } else {
+ log.Println("Invalid variadic costs choosen")
+ }
+ } else {
+ log.Println("Unambigous variadic costs choosen")
+ }
+ return costs
}
func ParseCardResourceCosts(_costs interface{}, effects []string) *ResourceCosts {