242 lines
7.5 KiB
Go
242 lines
7.5 KiB
Go
package koboldsim
|
|
|
|
import (
|
|
"math"
|
|
|
|
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
|
)
|
|
|
|
// KoboldMine is the state of a kobold mine.
|
|
type KoboldMine struct {
|
|
BasePopulation float64 `cardsim:"stathidden"`
|
|
|
|
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"`
|
|
|
|
PropagandaExpense float64 `cardsim:"stat" cardsim_name:"Propaganda Investment"`
|
|
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"`
|
|
|
|
FoodSupply float64 `cardsim:"stathidden"`
|
|
|
|
// AnotherExpense float64 `cardsim:"hiddenround5"`
|
|
// A different way of adding stats that is slightly more empowering.
|
|
}
|
|
|
|
func (k *KoboldMine) ProductivityFunc(s *float64) func() float64 {
|
|
return func() float64 {
|
|
return *s * float64(k.BasePopulation)
|
|
}
|
|
}
|
|
|
|
func (k *KoboldMine) TotalSectorIncome() float64 {
|
|
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)
|
|
}
|
|
|
|
func (k *KoboldMine) TotalGovExpense() float64 {
|
|
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)
|
|
}
|
|
|
|
func (k *KoboldMine) Taxation() float64 {
|
|
return (k.TotalGovExpense() / (k.TotalSectorIncome() + k.TotalGovExpense())) * 100
|
|
}
|
|
|
|
func (k *KoboldMine) StatTaxRate() float64 {
|
|
return k.Taxation()
|
|
}
|
|
|
|
func (k *KoboldMine) Kobolds() int64 {
|
|
return int64(k.BasePopulation * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)))
|
|
}
|
|
|
|
func (k *KoboldMine) DisplayedFoodSupply() float64 {
|
|
return (k.FoodSupply - 1) * 100
|
|
}
|
|
|
|
func (k *KoboldMine) StatObesity() float64 {
|
|
return 100 / (1 + math.Exp(-0.05*(k.DisplayedFoodSupply()-37)))
|
|
}
|
|
|
|
func (k *KoboldMine) Stats() []cardsim.Stat {
|
|
stats := cardsim.ExtractStats(k)
|
|
funcs := []cardsim.Stat{
|
|
cardsim.StatFunc(
|
|
"Mining Income",
|
|
k.ProductivityFunc(&k.MiningIncome),
|
|
),
|
|
cardsim.StatFunc(
|
|
"Scavenging Income",
|
|
k.ProductivityFunc(&k.ScavengingIncome),
|
|
),
|
|
cardsim.StatFunc(
|
|
"Alchemy Income",
|
|
k.ProductivityFunc(&k.AlchemyIncome),
|
|
),
|
|
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(
|
|
"Propaganda Expense",
|
|
k.ProductivityFunc(&k.PropagandaExpense),
|
|
),
|
|
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),
|
|
),
|
|
cardsim.StatFunc(
|
|
"Total Sector Income",
|
|
k.TotalSectorIncome,
|
|
),
|
|
cardsim.StatFunc(
|
|
"Total Government Expense",
|
|
k.TotalGovExpense,
|
|
),
|
|
cardsim.StatFunc(
|
|
"Food Supply",
|
|
k.DisplayedFoodSupply,
|
|
),
|
|
cardsim.StatFunc(
|
|
"Kobolds",
|
|
k.Kobolds,
|
|
),
|
|
}
|
|
stats = append(stats, funcs...)
|
|
// cardsim.SortStats(stats)
|
|
return stats
|
|
}
|
|
|
|
func NewKoboldMine() *KoboldMine {
|
|
return &KoboldMine{
|
|
BasePopulation: 1000,
|
|
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,
|
|
PropagandaExpense: 0.01,
|
|
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,
|
|
FoodSupply: 0.20,
|
|
}
|
|
}
|