aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/economy/heads.go
diff options
context:
space:
mode:
Diffstat (limited to 'economy/heads.go')
-rw-r--r--economy/heads.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/economy/heads.go b/economy/heads.go
new file mode 100644
index 0000000..15c9456
--- /dev/null
+++ b/economy/heads.go
@@ -0,0 +1,37 @@
+package economy
+
+import (
+ "maps"
+)
+
+type Location uint
+type CostFunc func(cr float32, mutiplier float32, modifier float32) Money
+
+const (
+ Field Location = iota
+ Display
+ Storage
+)
+
+type Head struct {
+ Location Location
+ Conditions struct {
+ Multipliers map[string]float32
+ Modifiers map[string]float32
+ }
+ CR float32
+}
+
+func (h Head) Value(cost CostFunc) Money {
+ var multiplier float32 = 1
+ for val := range maps.Values(h.Conditions.Multipliers) {
+ multiplier *= val
+ }
+
+ var modifier float32 = 0
+ for val := range maps.Values(h.Conditions.Modifiers) {
+ modifier += val
+ }
+
+ return cost(h.CR, multiplier, modifier)
+}