2023-04-03 06:24:47 +00:00
|
|
|
package koboldsim
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
|
|
|
)
|
|
|
|
|
|
|
|
// KoboldMine is the state of a kobold mine.
|
|
|
|
type KoboldMine struct {
|
|
|
|
Kobolds cardsim.Stored[int64]
|
|
|
|
|
2023-04-03 21:35:36 +00:00
|
|
|
SectorMiningIncome cardsim.Stored[float64]
|
|
|
|
SectorScavengingIncome cardsim.Stored[float64]
|
2023-04-03 06:24:47 +00:00
|
|
|
|
2023-04-03 21:35:36 +00:00
|
|
|
GovBureaucracyExpense cardsim.Stored[float64]
|
|
|
|
GovWarExpense cardsim.Stored[float64]
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 {
|
|
|
|
return func() float64 {
|
|
|
|
return s.Value * float64(k.Kobolds.Value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) TotalSectorProductivity() float64 {
|
2023-04-03 21:35:36 +00:00
|
|
|
return float64(k.Kobolds.Value) * (k.SectorMiningIncome.Value + k.SectorScavengingIncome.Value)
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) TotalGovProductivity() float64 {
|
2023-04-03 21:35:36 +00:00
|
|
|
return float64(k.Kobolds.Value) * (k.GovBureaucracyExpense.Value + k.GovWarExpense.Value)
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) Stats() []cardsim.Stat {
|
|
|
|
stats := cardsim.ExtractStats(k)
|
|
|
|
funcs := []cardsim.Stat{
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Sector Mining Income",
|
|
|
|
k.ProductivityFunc(&k.SectorMiningIncome),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Sector Scavenging Income",
|
|
|
|
k.ProductivityFunc(&k.SectorScavengingIncome),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Government Bureaucracy Expense",
|
|
|
|
k.ProductivityFunc(&k.GovBureaucracyExpense),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Government War Expense",
|
|
|
|
k.ProductivityFunc(&k.GovWarExpense),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Sector Income",
|
2023-04-03 06:24:47 +00:00
|
|
|
k.TotalSectorProductivity,
|
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Government Expense",
|
2023-04-03 06:24:47 +00:00
|
|
|
k.TotalGovProductivity,
|
|
|
|
),
|
|
|
|
}
|
|
|
|
stats = append(stats, funcs...)
|
|
|
|
cardsim.SortStats(stats)
|
|
|
|
return stats
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewKoboldMine() *KoboldMine {
|
|
|
|
return &KoboldMine{
|
|
|
|
Kobolds: cardsim.Stored[int64]{
|
|
|
|
Name: "Kobolds",
|
|
|
|
Value: 1000,
|
|
|
|
},
|
2023-04-03 21:35:36 +00:00
|
|
|
SectorMiningIncome: cardsim.Stored[float64]{
|
|
|
|
Name: "Sector Mining Income",
|
2023-04-03 06:24:47 +00:00
|
|
|
Value: 0.15,
|
|
|
|
},
|
2023-04-03 21:35:36 +00:00
|
|
|
SectorScavengingIncome: cardsim.Stored[float64]{
|
|
|
|
Name: "Sector Scavening Income",
|
2023-04-03 06:24:47 +00:00
|
|
|
Value: 0.1,
|
|
|
|
},
|
2023-04-03 21:35:36 +00:00
|
|
|
GovBureaucracyExpense: cardsim.Stored[float64]{
|
|
|
|
Name: "Government Bureaucracy Expense",
|
2023-04-03 06:24:47 +00:00
|
|
|
Value: 0.05,
|
|
|
|
},
|
2023-04-03 21:35:36 +00:00
|
|
|
GovWarExpense: cardsim.Stored[float64]{
|
|
|
|
Name: "Government War Expense",
|
2023-04-03 06:24:47 +00:00
|
|
|
Value: 0.1,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|