2023-04-03 06:24:47 +00:00
|
|
|
package koboldsim
|
|
|
|
|
|
|
|
import (
|
2023-04-05 19:29:23 +00:00
|
|
|
"math"
|
|
|
|
|
2023-04-03 06:24:47 +00:00
|
|
|
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
|
|
|
)
|
|
|
|
|
|
|
|
// KoboldMine is the state of a kobold mine.
|
|
|
|
type KoboldMine struct {
|
2023-04-05 03:23:32 +00:00
|
|
|
BasePopulation float64 `cardsim:"stathidden"`
|
2023-04-03 06:24:47 +00:00
|
|
|
|
2023-04-04 20:22:43 +00:00
|
|
|
MiningIncome float64 `cardsim:"stat" cardsim_name:"Mining Productivity"`
|
|
|
|
ScavengingIncome float64 `cardsim:"stat" cardsim_name:"Scavenging Productivity"`
|
|
|
|
AlchemyIncome float64 `cardsim:"stat" cardsim_name:"Alchemy Productivity"`
|
|
|
|
HospitalityIncome float64 `cardsim:"stat" cardsim_name:"Hospitality Productivity"`
|
|
|
|
AgricultureIncome float64 `cardsim:"stat" cardsim_name:"Agriculture Productivity"`
|
|
|
|
ManufacturingIncome float64 `cardsim:"stat" cardsim_name:"Manufacturing Productivity"`
|
|
|
|
PlanarIncome float64 `cardsim:"stat" cardsim_name:"Planar Productivity"`
|
|
|
|
PublishingIncome float64 `cardsim:"stat" cardsim_name:"Publishing Productivity"`
|
|
|
|
FinanceIncome float64 `cardsim:"stat" cardsim_name:"Finance Productivity"`
|
|
|
|
GadgetryIncome float64 `cardsim:"stat" cardsim_name:"Gadgetry Productivity"`
|
|
|
|
FishingIncome float64 `cardsim:"stat" cardsim_name:"Fishing Productivity"`
|
|
|
|
ConstructionIncome float64 `cardsim:"stat" cardsim_name:"Construction Productivity"`
|
2023-04-03 06:24:47 +00:00
|
|
|
|
2023-04-05 03:23:32 +00:00
|
|
|
PropagandaExpense float64 `cardsim:"stat" cardsim_name:"Propaganda Investment"`
|
2023-04-04 20:22:43 +00:00
|
|
|
BureaucracyExpense float64 `cardsim:"stat" cardsim_name:"Bureaucracy Investment"`
|
|
|
|
WarExpense float64 `cardsim:"stat" cardsim_name:"War Investment"`
|
|
|
|
QoLExpense float64 `cardsim:"stat" cardsim_name:"QoL Investment"`
|
|
|
|
LogisticsExpense float64 `cardsim:"stat" cardsim_name:"Logistics Investment"`
|
|
|
|
DragonSubsExpense float64 `cardsim:"stat" cardsim_name:"Dragon Subsidies Investment"`
|
|
|
|
ResearchSubsExpense float64 `cardsim:"stat" cardsim_name:"Research Subsidies Investment"`
|
|
|
|
EducationExpense float64 `cardsim:"stat" cardsim_name:"Education Investment"`
|
|
|
|
HealthcareExpense float64 `cardsim:"stat" cardsim_name:"Healthcare Investment"`
|
|
|
|
ForeignRelExpense float64 `cardsim:"stat" cardsim_name:"Foreign Relations Investment"`
|
|
|
|
PoliceExpense float64 `cardsim:"stat" cardsim_name:"Law Enforcement Investment"`
|
|
|
|
EconPlanExpense float64 `cardsim:"stat" cardsim_name:"Economic Planning Investment"`
|
|
|
|
ParksExpense float64 `cardsim:"stat" cardsim_name:"Parks and Aesthetics Investment"`
|
|
|
|
FaithExpense float64 `cardsim:"stat" cardsim_name:"Faith Investment"`
|
|
|
|
|
2023-04-05 03:23:32 +00:00
|
|
|
FoodSupply float64 `cardsim:"stathidden"`
|
|
|
|
|
2023-04-04 20:22:43 +00:00
|
|
|
// AnotherExpense float64 `cardsim:"hiddenround5"`
|
|
|
|
// A different way of adding stats that is slightly more empowering.
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
|
2023-04-04 20:22:43 +00:00
|
|
|
func (k *KoboldMine) ProductivityFunc(s *float64) func() float64 {
|
2023-04-03 06:24:47 +00:00
|
|
|
return func() float64 {
|
2023-04-05 03:23:32 +00:00
|
|
|
return *s * float64(k.BasePopulation)
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-03 23:18:26 +00:00
|
|
|
func (k *KoboldMine) TotalSectorIncome() float64 {
|
2023-04-05 03:23:32 +00:00
|
|
|
return float64(k.Kobolds()) * (k.MiningIncome + k.ScavengingIncome + k.AlchemyIncome + k.HospitalityIncome + k.AgricultureIncome + k.ManufacturingIncome + k.PlanarIncome + k.PublishingIncome + k.FinanceIncome + k.GadgetryIncome + k.FishingIncome + k.ConstructionIncome)
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
|
2023-04-03 23:18:26 +00:00
|
|
|
func (k *KoboldMine) TotalGovExpense() float64 {
|
2023-04-05 07:09:12 +00:00
|
|
|
return float64(k.Kobolds()) * (k.PropagandaExpense + k.BureaucracyExpense + k.WarExpense + k.QoLExpense + k.LogisticsExpense + k.DragonSubsExpense + k.ResearchSubsExpense + k.EducationExpense + k.HealthcareExpense + k.ForeignRelExpense + k.PoliceExpense + k.EconPlanExpense + k.ParksExpense + k.FaithExpense)
|
2023-04-04 20:22:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) Taxation() float64 {
|
|
|
|
return (k.TotalGovExpense() / (k.TotalSectorIncome() + k.TotalGovExpense())) * 100
|
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) StatTaxRate() float64 {
|
|
|
|
return k.Taxation()
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
|
2023-04-05 03:23:32 +00:00
|
|
|
func (k *KoboldMine) Kobolds() int64 {
|
2023-04-05 19:29:23 +00:00
|
|
|
return int64(k.BasePopulation * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)))
|
2023-04-05 03:23:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (k *KoboldMine) DisplayedFoodSupply() float64 {
|
|
|
|
return (k.FoodSupply - 1) * 100
|
|
|
|
}
|
|
|
|
|
2023-04-05 19:29:23 +00:00
|
|
|
func (k *KoboldMine) StatObesity() float64 {
|
|
|
|
return 100 / (1 + math.Exp(-0.05*(k.DisplayedFoodSupply()-37)))
|
|
|
|
}
|
|
|
|
|
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-04 17:33:14 +00:00
|
|
|
"Mining Income",
|
|
|
|
k.ProductivityFunc(&k.MiningIncome),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-04 17:33:14 +00:00
|
|
|
"Scavenging Income",
|
|
|
|
k.ProductivityFunc(&k.ScavengingIncome),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-04 17:33:14 +00:00
|
|
|
"Alchemy Income",
|
|
|
|
k.ProductivityFunc(&k.AlchemyIncome),
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-04 17:33:14 +00:00
|
|
|
"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),
|
|
|
|
),
|
2023-04-05 07:09:12 +00:00
|
|
|
cardsim.StatFunc(
|
|
|
|
"Propaganda Expense",
|
|
|
|
k.ProductivityFunc(&k.PropagandaExpense),
|
|
|
|
),
|
2023-04-04 17:33:14 +00:00
|
|
|
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(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Sector Income",
|
2023-04-03 23:18:26 +00:00
|
|
|
k.TotalSectorIncome,
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
2023-04-03 21:35:36 +00:00
|
|
|
"Total Government Expense",
|
2023-04-03 23:18:26 +00:00
|
|
|
k.TotalGovExpense,
|
2023-04-03 06:24:47 +00:00
|
|
|
),
|
2023-04-05 03:23:32 +00:00
|
|
|
cardsim.StatFunc(
|
|
|
|
"Food Supply",
|
|
|
|
k.DisplayedFoodSupply,
|
|
|
|
),
|
|
|
|
cardsim.StatFunc(
|
|
|
|
"Kobolds",
|
|
|
|
k.Kobolds,
|
|
|
|
),
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
stats = append(stats, funcs...)
|
2023-04-04 17:33:14 +00:00
|
|
|
// cardsim.SortStats(stats)
|
2023-04-03 06:24:47 +00:00
|
|
|
return stats
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewKoboldMine() *KoboldMine {
|
|
|
|
return &KoboldMine{
|
2023-04-05 03:23:32 +00:00
|
|
|
BasePopulation: 1000,
|
2023-04-04 20:22:43 +00:00
|
|
|
MiningIncome: 0.15,
|
|
|
|
ScavengingIncome: 0.1,
|
|
|
|
AlchemyIncome: 0.01,
|
|
|
|
HospitalityIncome: 0.0,
|
|
|
|
AgricultureIncome: 0.0,
|
|
|
|
ManufacturingIncome: 0.10,
|
|
|
|
PlanarIncome: 0.00,
|
|
|
|
PublishingIncome: 0.02,
|
|
|
|
FinanceIncome: 0.02,
|
|
|
|
GadgetryIncome: 0.03,
|
|
|
|
FishingIncome: 0.0,
|
|
|
|
ConstructionIncome: 0.05,
|
2023-04-05 07:09:12 +00:00
|
|
|
PropagandaExpense: 0.01,
|
2023-04-04 20:22:43 +00:00
|
|
|
BureaucracyExpense: 0.05,
|
|
|
|
WarExpense: 0.1,
|
|
|
|
QoLExpense: 0.01,
|
|
|
|
LogisticsExpense: 0.02,
|
|
|
|
DragonSubsExpense: 0.0,
|
|
|
|
ResearchSubsExpense: 0.0,
|
|
|
|
EducationExpense: 0.01,
|
|
|
|
HealthcareExpense: 0.01,
|
|
|
|
ForeignRelExpense: 0.0,
|
|
|
|
PoliceExpense: 0.03,
|
|
|
|
EconPlanExpense: 0.02,
|
|
|
|
ParksExpense: 0.0,
|
|
|
|
FaithExpense: 0.03,
|
2023-04-05 03:23:32 +00:00
|
|
|
FoodSupply: 0.20,
|
2023-04-03 06:24:47 +00:00
|
|
|
}
|
|
|
|
}
|