KoboldSim/koboldsim/stats.go

278 lines
7.5 KiB
Go
Raw Normal View History

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]
MiningIncome cardsim.Stored[float64]
ScavengingIncome cardsim.Stored[float64]
AlchemyIncome cardsim.Stored[float64]
HospitalityIncome cardsim.Stored[float64]
AgricultureIncome cardsim.Stored[float64]
ManufacturingIncome cardsim.Stored[float64]
PlanarIncome cardsim.Stored[float64]
PublishingIncome cardsim.Stored[float64]
FinanceIncome cardsim.Stored[float64]
GadgetryIncome cardsim.Stored[float64]
FishingIncome cardsim.Stored[float64]
ConstructionIncome cardsim.Stored[float64]
2023-04-03 06:24:47 +00:00
BureaucracyExpense cardsim.Stored[float64]
WarExpense cardsim.Stored[float64]
QoLExpense cardsim.Stored[float64]
LogisticsExpense cardsim.Stored[float64]
DragonSubsExpense cardsim.Stored[float64]
ResearchSubsExpense cardsim.Stored[float64]
EducationExpense cardsim.Stored[float64]
HealthcareExpense cardsim.Stored[float64]
ForeignRelExpense cardsim.Stored[float64]
PoliceExpense cardsim.Stored[float64]
EconPlanExpense cardsim.Stored[float64]
ParksExpense cardsim.Stored[float64]
FaithExpense 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)
}
}
2023-04-03 23:18:26 +00:00
func (k *KoboldMine) TotalSectorIncome() float64 {
return float64(k.Kobolds.Value) * (k.MiningIncome.Value + k.ScavengingIncome.Value + k.AlchemyIncome.Value + k.HospitalityIncome.Value + k.AgricultureIncome.Value + k.ManufacturingIncome.Value + k.PlanarIncome.Value + k.PublishingIncome.Value + k.FinanceIncome.Value + k.GadgetryIncome.Value + k.FishingIncome.Value + k.ConstructionIncome.Value)
2023-04-03 06:24:47 +00:00
}
2023-04-03 23:18:26 +00:00
func (k *KoboldMine) TotalGovExpense() float64 {
return float64(k.Kobolds.Value) * (k.BureaucracyExpense.Value + k.WarExpense.Value + k.QoLExpense.Value + k.LogisticsExpense.Value + k.DragonSubsExpense.Value + k.ResearchSubsExpense.Value + k.EducationExpense.Value + k.HealthcareExpense.Value + k.ForeignRelExpense.Value + k.PoliceExpense.Value + k.EconPlanExpense.Value + k.ParksExpense.Value + k.FaithExpense.Value)
2023-04-03 06:24:47 +00:00
}
func (k *KoboldMine) Stats() []cardsim.Stat {
stats := cardsim.ExtractStats(k)
funcs := []cardsim.Stat{
cardsim.StatFunc(
"Mining Income",
k.ProductivityFunc(&k.MiningIncome),
2023-04-03 06:24:47 +00:00
),
cardsim.StatFunc(
"Scavenging Income",
k.ProductivityFunc(&k.ScavengingIncome),
2023-04-03 06:24:47 +00:00
),
cardsim.StatFunc(
"Alchemy Income",
k.ProductivityFunc(&k.AlchemyIncome),
2023-04-03 06:24:47 +00:00
),
cardsim.StatFunc(
"Hospitality Income",
k.ProductivityFunc(&k.HospitalityIncome),
),
cardsim.StatFunc(
"Agriculture Income",
k.ProductivityFunc(&k.AgricultureIncome),
),
cardsim.StatFunc(
"Manufacturing Income",
k.ProductivityFunc(&k.ManufacturingIncome),
),
cardsim.StatFunc(
"Planar Harvesting Income",
k.ProductivityFunc(&k.PlanarIncome),
),
cardsim.StatFunc(
"Book Publishing Income",
k.ProductivityFunc(&k.PublishingIncome),
),
cardsim.StatFunc(
"Finance Income",
k.ProductivityFunc(&k.FinanceIncome),
),
cardsim.StatFunc(
"Gadgetry Income",
k.ProductivityFunc(&k.GadgetryIncome),
),
cardsim.StatFunc(
"Fishing Income",
k.ProductivityFunc(&k.FishingIncome),
),
cardsim.StatFunc(
"Construction Income",
k.ProductivityFunc(&k.ConstructionIncome),
),
cardsim.StatFunc(
"Bureaucracy Expense",
k.ProductivityFunc(&k.BureaucracyExpense),
),
cardsim.StatFunc(
"War Expense",
k.ProductivityFunc(&k.WarExpense),
),
cardsim.StatFunc(
"QoL Expense",
k.ProductivityFunc(&k.QoLExpense),
),
cardsim.StatFunc(
"Logistics Expense",
k.ProductivityFunc(&k.LogisticsExpense),
),
cardsim.StatFunc(
"Dragon Subsidies",
k.ProductivityFunc(&k.DragonSubsExpense),
),
cardsim.StatFunc(
"Research Subsidies",
k.ProductivityFunc(&k.ResearchSubsExpense),
),
cardsim.StatFunc(
"Education Expense",
k.ProductivityFunc(&k.EducationExpense),
),
cardsim.StatFunc(
"Healthcare Expense",
k.ProductivityFunc(&k.HealthcareExpense),
),
cardsim.StatFunc(
"Foreign Relations Expense",
k.ProductivityFunc(&k.ForeignRelExpense),
),
cardsim.StatFunc(
"Law Enforcement Expense",
k.ProductivityFunc(&k.PoliceExpense),
),
cardsim.StatFunc(
"Economic Planning Expense",
k.ProductivityFunc(&k.EconPlanExpense),
),
cardsim.StatFunc(
"Parks and Aesthetics Expense",
k.ProductivityFunc(&k.ParksExpense),
),
cardsim.StatFunc(
"Faith Expense",
k.ProductivityFunc(&k.FaithExpense),
2023-04-03 06:24:47 +00:00
),
cardsim.StatFunc(
"Total Sector Income",
2023-04-03 23:18:26 +00:00
k.TotalSectorIncome,
2023-04-03 06:24:47 +00:00
),
cardsim.StatFunc(
"Total Government Expense",
2023-04-03 23:18:26 +00:00
k.TotalGovExpense,
2023-04-03 06:24:47 +00:00
),
}
stats = append(stats, funcs...)
// cardsim.SortStats(stats)
2023-04-03 06:24:47 +00:00
return stats
}
func NewKoboldMine() *KoboldMine {
return &KoboldMine{
Kobolds: cardsim.Stored[int64]{
Name: "Kobolds",
Value: 1000,
},
MiningIncome: cardsim.Stored[float64]{
Name: "Mining Productivity",
2023-04-03 06:24:47 +00:00
Value: 0.15,
},
ScavengingIncome: cardsim.Stored[float64]{
Name: "Scavenging Productivity",
2023-04-03 06:24:47 +00:00
Value: 0.1,
},
AlchemyIncome: cardsim.Stored[float64]{
Name: "Alchemy Productivity",
Value: 0.01,
},
HospitalityIncome: cardsim.Stored[float64]{
Name: "Hospitality Productivity",
Value: 0.0,
},
AgricultureIncome: cardsim.Stored[float64]{
Name: "Agricultural Productivity",
Value: 0.0,
},
ManufacturingIncome: cardsim.Stored[float64]{
Name: "Manufacturing Productivity",
Value: 0.10,
},
PlanarIncome: cardsim.Stored[float64]{
Name: "Planar Harvesting Productivity",
Value: 0.00,
},
PublishingIncome: cardsim.Stored[float64]{
Name: "Book Publishing Productivity",
Value: 0.02,
},
FinanceIncome: cardsim.Stored[float64]{
Name: "Finance Productivity",
Value: 0.02,
},
GadgetryIncome: cardsim.Stored[float64]{
Name: "Gadgetry Productivity",
Value: 0.03,
},
FishingIncome: cardsim.Stored[float64]{
Name: "Fishing Productivity",
Value: 0.0,
},
ConstructionIncome: cardsim.Stored[float64]{
Name: "Construction Productivity",
Value: 0.05,
},
BureaucracyExpense: cardsim.Stored[float64]{
Name: "Bureaucracy Investment",
2023-04-03 06:24:47 +00:00
Value: 0.05,
},
WarExpense: cardsim.Stored[float64]{
Name: "War Investment",
2023-04-03 06:24:47 +00:00
Value: 0.1,
},
QoLExpense: cardsim.Stored[float64]{
Name: "QoL Investment",
Value: 0.01,
},
LogisticsExpense: cardsim.Stored[float64]{
Name: "Logistics Investment",
Value: 0.02,
},
DragonSubsExpense: cardsim.Stored[float64]{
Name: "Dragon Subsidies Investment",
Value: 0.0,
},
ResearchSubsExpense: cardsim.Stored[float64]{
Name: "Research Subsidies Investment",
Value: 0.0,
},
EducationExpense: cardsim.Stored[float64]{
Name: "Education Investment",
Value: 0.01,
},
HealthcareExpense: cardsim.Stored[float64]{
Name: "Healthcare Investment",
Value: 0.01,
},
ForeignRelExpense: cardsim.Stored[float64]{
Name: "Foreign Relations Investment",
Value: 0.0,
},
PoliceExpense: cardsim.Stored[float64]{
Name: "Law Enforcement Investment",
Value: 0.03,
},
EconPlanExpense: cardsim.Stored[float64]{
Name: "Economic Planning Investment",
Value: 0.02,
},
ParksExpense: cardsim.Stored[float64]{
Name: "Parks and Aesthetics Investment",
Value: 0.0,
},
FaithExpense: cardsim.Stored[float64]{
Name: "Faith Investment",
Value: 0.03,
},
2023-04-03 06:24:47 +00:00
}
}