Compare commits
12 Commits
0a39cc76d6
...
main
Author | SHA1 | Date | |
---|---|---|---|
18b221d972 | |||
e45c5b3711 | |||
f53beb4b17 | |||
c30254a36d | |||
350fd0f777
|
|||
816b5e8e7a
|
|||
e61d7571f0 | |||
6d6d0f5c8b | |||
3ca17d8881 | |||
976610b1bb | |||
a4692712cc | |||
2ca8f3ed13 |
9
go.mod
9
go.mod
@ -2,6 +2,11 @@ module git.chromaticdragon.app/kistaro/KoboldSim
|
|||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require git.chromaticdragon.app/kistaro/CardSimEngine v0.3.0
|
require git.chromaticdragon.app/kistaro/CardSimEngine v0.5.0
|
||||||
|
|
||||||
require golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
|
require (
|
||||||
|
github.com/kr/pretty v0.3.1 // indirect
|
||||||
|
github.com/kr/text v0.2.0 // indirect
|
||||||
|
github.com/rogpeppe/go-internal v1.9.0 // indirect
|
||||||
|
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
|
||||||
|
)
|
||||||
|
12
go.sum
12
go.sum
@ -1,4 +1,12 @@
|
|||||||
git.chromaticdragon.app/kistaro/CardSimEngine v0.3.0 h1:PYpW6+XTod3oJHf7JyfCpHMCdGILrvyqSJPH/71FMRQ=
|
git.chromaticdragon.app/kistaro/CardSimEngine v0.5.0 h1:o4ncTVfDgax3w2tVhkap4/ZrZDe13YnNNJ0pe7zaqjM=
|
||||||
git.chromaticdragon.app/kistaro/CardSimEngine v0.3.0/go.mod h1:FYuoJHaK7lDI8Fwf4lZY2Y+8P9zavT4oLvSFUG6drw4=
|
git.chromaticdragon.app/kistaro/CardSimEngine v0.5.0/go.mod h1:FYuoJHaK7lDI8Fwf4lZY2Y+8P9zavT4oLvSFUG6drw4=
|
||||||
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
|
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
|
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||||
|
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||||
|
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
|
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
|
||||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -10,76 +10,233 @@ import (
|
|||||||
type KoboldMine struct {
|
type KoboldMine struct {
|
||||||
BasePopulation float64 `cardsim:"stathidden"`
|
BasePopulation float64 `cardsim:"stathidden"`
|
||||||
|
|
||||||
MiningIncome float64 `cardsim:"stat" cardsim_name:"Mining Productivity"`
|
MiningIncome float64 `cardsim:"stathidden" cardsim_name:"Mining Productivity"`
|
||||||
ScavengingIncome float64 `cardsim:"stat" cardsim_name:"Scavenging Productivity"`
|
ScavengingIncome float64 `cardsim:"stathidden" cardsim_name:"Scavenging Productivity"`
|
||||||
AlchemyIncome float64 `cardsim:"stat" cardsim_name:"Alchemy Productivity"`
|
AlchemyIncome float64 `cardsim:"stathidden" cardsim_name:"Alchemy Productivity"`
|
||||||
HospitalityIncome float64 `cardsim:"stat" cardsim_name:"Hospitality Productivity"`
|
HospitalityIncome float64 `cardsim:"stathidden" cardsim_name:"Hospitality Productivity"`
|
||||||
AgricultureIncome float64 `cardsim:"stat" cardsim_name:"Agriculture Productivity"`
|
AgricultureIncome float64 `cardsim:"stathidden" cardsim_name:"Agriculture Productivity"`
|
||||||
ManufacturingIncome float64 `cardsim:"stat" cardsim_name:"Manufacturing Productivity"`
|
ManufacturingIncome float64 `cardsim:"stathidden" cardsim_name:"Manufacturing Productivity"`
|
||||||
PlanarIncome float64 `cardsim:"stat" cardsim_name:"Planar Productivity"`
|
PlanarIncome float64 `cardsim:"stathidden" cardsim_name:"Planar Productivity"`
|
||||||
PublishingIncome float64 `cardsim:"stat" cardsim_name:"Publishing Productivity"`
|
PublishingIncome float64 `cardsim:"stathidden" cardsim_name:"Publishing Productivity"`
|
||||||
ForestryIncome float64 `cardsim:"stat" cardsim_name:"Forestry Productivity"`
|
ForestryIncome float64 `cardsim:"stathidden" cardsim_name:"Forestry Productivity"`
|
||||||
FinanceIncome float64 `cardsim:"stat" cardsim_name:"Finance Productivity"`
|
FinanceIncome float64 `cardsim:"stathidden" cardsim_name:"Finance Productivity"`
|
||||||
GadgetryIncome float64 `cardsim:"stat" cardsim_name:"Gadgetry Productivity"`
|
GadgetryIncome float64 `cardsim:"stathidden" cardsim_name:"Gadgetry Productivity"`
|
||||||
FishingIncome float64 `cardsim:"stat" cardsim_name:"Fishing Productivity"`
|
FishingIncome float64 `cardsim:"stathidden" cardsim_name:"Fishing Productivity"`
|
||||||
ConstructionIncome float64 `cardsim:"stat" cardsim_name:"Construction Productivity"`
|
ConstructionIncome float64 `cardsim:"stathidden" cardsim_name:"Construction Productivity"`
|
||||||
|
|
||||||
PropagandaExpense float64 `cardsim:"stat" cardsim_name:"Propaganda Investment"`
|
PropagandaExpense float64 `cardsim:"stathidden" cardsim_name:"Propaganda Investment"`
|
||||||
BureaucracyExpense float64 `cardsim:"stat" cardsim_name:"Bureaucracy Investment"`
|
BureaucracyExpense float64 `cardsim:"stathidden" cardsim_name:"Bureaucracy Investment"`
|
||||||
WarExpense float64 `cardsim:"stat" cardsim_name:"War Investment"`
|
WarExpense float64 `cardsim:"stathidden" cardsim_name:"War Investment"`
|
||||||
QoLExpense float64 `cardsim:"stat" cardsim_name:"QoL Investment"`
|
QoLExpense float64 `cardsim:"stathidden" cardsim_name:"QoL Investment"`
|
||||||
LogisticsExpense float64 `cardsim:"stat" cardsim_name:"Logistics Investment"`
|
LogisticsExpense float64 `cardsim:"stathidden" cardsim_name:"Logistics Investment"`
|
||||||
DragonSubsExpense float64 `cardsim:"stat" cardsim_name:"Dragon Subsidies Investment"`
|
DragonSubsExpense float64 `cardsim:"stathidden" cardsim_name:"Dragon Subsidies Investment"`
|
||||||
ResearchSubsExpense float64 `cardsim:"stat" cardsim_name:"Research Subsidies Investment"`
|
ResearchSubsExpense float64 `cardsim:"stathidden" cardsim_name:"Research Subsidies Investment"`
|
||||||
EducationExpense float64 `cardsim:"stat" cardsim_name:"Education Investment"`
|
EducationExpense float64 `cardsim:"stathidden" cardsim_name:"Education Investment"`
|
||||||
HealthcareExpense float64 `cardsim:"stat" cardsim_name:"Healthcare Investment"`
|
HealthcareExpense float64 `cardsim:"stathidden" cardsim_name:"Healthcare Investment"`
|
||||||
ForeignRelExpense float64 `cardsim:"stat" cardsim_name:"Foreign Relations Investment"`
|
ForeignRelExpense float64 `cardsim:"stathidden" cardsim_name:"Foreign Relations Investment"`
|
||||||
PoliceExpense float64 `cardsim:"stat" cardsim_name:"Law Enforcement Investment"`
|
PoliceExpense float64 `cardsim:"stathidden" cardsim_name:"Law Enforcement Investment"`
|
||||||
EconPlanExpense float64 `cardsim:"stat" cardsim_name:"Economic Planning Investment"`
|
EconPlanExpense float64 `cardsim:"stathidden" cardsim_name:"Economic Planning Investment"`
|
||||||
ParksExpense float64 `cardsim:"stat" cardsim_name:"Parks and Aesthetics Investment"`
|
ParksExpense float64 `cardsim:"stathidden" cardsim_name:"Parks and Aesthetics Investment"`
|
||||||
FaithExpense float64 `cardsim:"stat" cardsim_name:"Faith Investment"`
|
FaithExpense float64 `cardsim:"stathidden" cardsim_name:"Faith Investment"`
|
||||||
|
|
||||||
FoodSupply float64 `cardsim:"stathidden"`
|
FoodSupply float64 `cardsim:"stathidden"`
|
||||||
|
ObesogenicFood float64 `cardsim:"stathidden"`
|
||||||
ForeignRelations float64 `cardsim:"stathidden"`
|
ForeignRelations float64 `cardsim:"stathidden"`
|
||||||
HiddenRelPenalty float64 `cardsim:"stathidden"`
|
HiddenRelPenalty float64 `cardsim:"stathidden"` // Lower is better.
|
||||||
Secrecy float64 `cardsim:"stathidden"`
|
Secrecy float64 `cardsim:"stathidden"`
|
||||||
|
PointOfDimReturns float64 `cardsim:"stathidden"`
|
||||||
|
Rebellion float64 `cardsim:"stathidden"`
|
||||||
|
Madness float64 `cardsim:"stathidden"`
|
||||||
|
Cruelty float64 `cardsim:"stat"`
|
||||||
|
Greed float64 `cardsim:"stat"`
|
||||||
|
Gullibility float64 `cardsim:"stathidden"`
|
||||||
|
Authoritarianism float64 `cardsim:"stat"`
|
||||||
|
|
||||||
// AnotherExpense float64 `cardsim:"hiddenround5"`
|
// AnotherExpense float64 `cardsim:"hiddenround5"`
|
||||||
// A different way of adding stats that is slightly more empowering.
|
// A different way of adding stats that is slightly more empowering.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) ProductivityFunc(s *float64) func() float64 {
|
func (k *KoboldMine) ProductivityFunc(s float64) func() float64 {
|
||||||
return func() float64 {
|
return func() float64 {
|
||||||
return *s * float64(k.BasePopulation)
|
return math.Max(s*float64(k.Kobolds()), 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) ProductivityTotal() float64 {
|
||||||
|
total := math.Max(k.MiningIncome, 0.01)
|
||||||
|
total += math.Max(k.ScavengingIncome, 0)
|
||||||
|
total += math.Max(k.AlchemyIncome, 0)
|
||||||
|
total += math.Max(k.HospitalityIncome, 0)
|
||||||
|
total += math.Max(k.AgricultureIncome, 0)
|
||||||
|
total += math.Max(k.ManufacturingIncome, 0)
|
||||||
|
total += math.Max(k.PlanarIncome, 0)
|
||||||
|
total += math.Max(k.PublishingIncome, 0)
|
||||||
|
total += math.Max(k.FinanceIncome, 0)
|
||||||
|
total += math.Max(k.GadgetryIncome, 0)
|
||||||
|
total += math.Max(k.FishingIncome, 0)
|
||||||
|
total += math.Max(k.ConstructionIncome, 0.02)
|
||||||
|
total += math.Max(k.PropagandaExpense, 0)
|
||||||
|
total += math.Max(k.BureaucracyExpense, 0)
|
||||||
|
total += math.Max(k.WarExpense, 0)
|
||||||
|
total += math.Max(k.QoLExpense, 0)
|
||||||
|
total += math.Max(k.LogisticsExpense, 0)
|
||||||
|
total += math.Max(k.DragonSubsExpense, 0)
|
||||||
|
total += math.Max(k.ResearchSubsExpense, 0)
|
||||||
|
total += math.Max(k.EducationExpense, 0)
|
||||||
|
total += math.Max(k.HealthcareExpense, 0)
|
||||||
|
total += math.Max(k.ForeignRelExpense, 0)
|
||||||
|
total += math.Max(k.PoliceExpense, 0)
|
||||||
|
total += math.Max(k.EconPlanExpense, 0)
|
||||||
|
total += math.Max(k.ParksExpense, 0)
|
||||||
|
total += math.Max(k.FaithExpense, 0)
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) ProductivityMultiplier() float64 {
|
||||||
|
return math.Pow(0.95, math.Max(0, k.ProductivityTotal()-k.PointOfDimReturns))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueMiningIncome() float64 {
|
||||||
|
return math.Max(k.MiningIncome*k.ProductivityMultiplier(), 0.01)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueScavengingIncome() float64 {
|
||||||
|
return math.Max(k.ScavengingIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueAlchemyIncome() float64 {
|
||||||
|
return math.Max(k.AlchemyIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueHospitalityIncome() float64 {
|
||||||
|
return math.Max(k.HospitalityIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueAgricultureIncome() float64 {
|
||||||
|
return math.Max(k.AgricultureIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueManufacturingIncome() float64 {
|
||||||
|
return math.Max(k.ManufacturingIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TruePlanarIncome() float64 {
|
||||||
|
return math.Max(k.PlanarIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TruePublishingIncome() float64 {
|
||||||
|
return math.Max(k.PublishingIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueForestryIncome() float64 {
|
||||||
|
return math.Max(k.ForestryIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueFinanceIncome() float64 {
|
||||||
|
return math.Max(k.FinanceIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueGadgetryIncome() float64 {
|
||||||
|
return math.Max(k.GadgetryIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueFishingIncome() float64 {
|
||||||
|
return math.Max(k.FishingIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueConstructionIncome() float64 {
|
||||||
|
return math.Max(k.ConstructionIncome*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TruePropagandaExpense() float64 {
|
||||||
|
return math.Max(k.PropagandaExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueBureaucracyExpense() float64 {
|
||||||
|
return math.Max(k.BureaucracyExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueWarExpense() float64 {
|
||||||
|
return math.Max(k.WarExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueQoLExpense() float64 {
|
||||||
|
return math.Max(k.QoLExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueLogisticsExpense() float64 {
|
||||||
|
return math.Max(k.LogisticsExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueDragonSubsExpense() float64 {
|
||||||
|
return math.Max(k.DragonSubsExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueResearchSubsExpense() float64 {
|
||||||
|
return math.Max(k.ResearchSubsExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueEducationExpense() float64 {
|
||||||
|
return math.Max(k.EducationExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueHealthcareExpense() float64 {
|
||||||
|
return math.Max(k.HealthcareExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueForeignRelExpense() float64 {
|
||||||
|
return math.Max(k.ForeignRelExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TruePoliceExpense() float64 {
|
||||||
|
return math.Max(k.PoliceExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueEconPlanExpense() float64 {
|
||||||
|
return math.Max(k.EconPlanExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueParksExpense() float64 {
|
||||||
|
return math.Max(k.ParksExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) TrueFaithExpense() float64 {
|
||||||
|
return math.Max(k.FaithExpense*k.ProductivityMultiplier(), 0)
|
||||||
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) TotalSectorIncome() float64 {
|
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)
|
return float64(k.Kobolds()) * (math.Max(k.TrueMiningIncome(), 0.01) + math.Max(k.TrueScavengingIncome(), 0) + math.Max(k.TrueAlchemyIncome(), 0) + math.Max(k.TrueHospitalityIncome(), 0) + math.Max(k.TrueAgricultureIncome(), 0) + math.Max(k.TrueManufacturingIncome(), 0) + math.Max(k.TruePlanarIncome(), 0) + math.Max(k.TruePublishingIncome(), 0) + math.Max(k.TrueFinanceIncome(), 0) + math.Max(k.TrueGadgetryIncome(), 0) + math.Max(k.TrueFishingIncome(), 0) + math.Max(k.TrueConstructionIncome(), 0.02))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) TotalGovExpense() float64 {
|
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)
|
return float64(k.Kobolds()) * (math.Max(k.TruePropagandaExpense(), 0) + math.Max(k.TrueBureaucracyExpense(), 0) + math.Max(k.TrueWarExpense(), 0) + math.Max(k.TrueQoLExpense(), 0) + math.Max(k.TrueLogisticsExpense(), 0) + math.Max(k.TrueDragonSubsExpense(), 0) + math.Max(k.TrueResearchSubsExpense(), 0) + math.Max(k.TrueEducationExpense(), 0) + math.Max(k.TrueHealthcareExpense(), 0) + math.Max(k.TrueForeignRelExpense(), 0) + math.Max(k.TruePoliceExpense(), 0) + math.Max(k.TrueEconPlanExpense(), 0) + math.Max(k.TrueParksExpense(), 0) + math.Max(k.TrueFaithExpense(), 0))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) Taxation() float64 {
|
func (k *KoboldMine) Taxation() float64 {
|
||||||
return (k.TotalGovExpense() / (k.TotalSectorIncome() + k.TotalGovExpense())) * 100
|
return (k.TotalGovExpense() / (k.TotalSectorIncome() + k.TotalGovExpense())) * 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Idea for the tax rate. I could have a tracked "tax evasion" stat that drives up taxation (people who actually pay have to pay more) as well as a tracked "public pay ratio" stat that drives up taxation if the public sector is paid more than the private sector and vice versa if the public sector is paid less. Both stats should be exposed to the player.
|
||||||
|
// Idea for tax evasion. The corruption stat should increase tax evasion, while the squalor stat should reduce it. The link with corruption should be obvious, but for squalor: when the economy improves, more people have resources with which to attempt to protect their income.
|
||||||
|
|
||||||
func (k *KoboldMine) StatTaxRate() float64 {
|
func (k *KoboldMine) StatTaxRate() float64 {
|
||||||
return k.Taxation()
|
return k.Taxation()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) Kobolds() int64 {
|
func (k *KoboldMine) Kobolds() int64 {
|
||||||
return int64(k.BasePopulation * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)) * (1 + k.TrueForeignRelations()))
|
return int64((k.BasePopulation + (k.HealthcareExpense * 1000)) * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)) * (1 + k.TrueForeignRelations()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) DisplayedFoodSupply() float64 {
|
func (k *KoboldMine) DisplayedFoodSupply() float64 {
|
||||||
return (k.FoodSupply - 1) * 100
|
return (k.FoodSupply - 1) * 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) StatObesogenicity() float64 {
|
||||||
|
return (k.ObesogenicFood - 1) * 100
|
||||||
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) StatObesity() float64 {
|
func (k *KoboldMine) StatObesity() float64 {
|
||||||
return 100 / (2.3 + math.Exp(-0.04*(k.DisplayedFoodSupply()-37)))
|
return (100 / (2.3 + math.Exp(-0.04*(k.DisplayedFoodSupply()-37)))) + 100/(2.3+math.Exp(-0.04*(k.StatObesogenicity()-37)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) TrueForeignRelations() float64 {
|
func (k *KoboldMine) TrueForeignRelations() float64 {
|
||||||
@ -94,116 +251,160 @@ func (k *KoboldMine) DisplayedSecrecy() float64 {
|
|||||||
return k.Secrecy * 100
|
return k.Secrecy * 100
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) SqualorReduction() float64 {
|
||||||
|
total := math.Max(k.MiningIncome, 0.01)
|
||||||
|
total -= math.Max(k.ScavengingIncome, 0)
|
||||||
|
total += math.Max(k.AlchemyIncome, 0)
|
||||||
|
total += math.Max(k.HospitalityIncome, 0) * 2
|
||||||
|
total += math.Max(k.ManufacturingIncome, 0)
|
||||||
|
total += math.Max(k.PlanarIncome, 0)
|
||||||
|
total += math.Max(k.PublishingIncome, 0) * 2
|
||||||
|
total += math.Max(k.FinanceIncome, 0) * 3
|
||||||
|
total += math.Max(k.GadgetryIncome, 0) * 2
|
||||||
|
total += math.Max(k.ConstructionIncome, 0.02) * 2
|
||||||
|
total += math.Max(k.PropagandaExpense, 0)
|
||||||
|
total += math.Max(k.BureaucracyExpense, 0) * 2
|
||||||
|
total += math.Max(k.QoLExpense, 0) * 20
|
||||||
|
total += math.Max(k.LogisticsExpense, 0)
|
||||||
|
total += math.Max(k.ResearchSubsExpense, 0) * 2
|
||||||
|
total += math.Max(k.EducationExpense, 0) * 4
|
||||||
|
total += math.Max(k.HealthcareExpense, 0) * 6
|
||||||
|
total += math.Max(k.ForeignRelExpense, 0)
|
||||||
|
total += math.Max(k.PoliceExpense, 0)
|
||||||
|
total += math.Max(k.EconPlanExpense, 0)
|
||||||
|
total += math.Max(k.ParksExpense, 0) * 3
|
||||||
|
total += math.Max(k.FaithExpense, 0) * 10
|
||||||
|
return total
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) StatSqualor() float64 {
|
||||||
|
return 100 * math.Pow(1.204, 1.2-(2*k.SqualorReduction()))
|
||||||
|
}
|
||||||
|
|
||||||
|
// So I want squalor to be a value between 100 and 0 that reduces readily at the start and then becomes increasingly difficult to further reduce. This initial squalor stat starts at about 80%, but may not change rapidly enough. Note that the 1.2-(2* sequence is meant to balance it at 80% starting point. If I change the velocity on the 2* side, I have to change the 1.2 offset as well. I really hope this math works, because I don't quite understand it.
|
||||||
|
|
||||||
|
func (k *KoboldMine) StatChaos() float64 {
|
||||||
|
return Mean(k.Rebellion, k.Madness, k.Cruelty)
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the "crimes of chaos" stat for my crime calculations. It will also be displayed to the player as just Chaos. The player can see Cruelty, but not Madness or Rebellion. I'm concerned some players may think, "Oh, chaos is a good thing, I want more of that as long as it's not cruel!" In that case, they'll have mad, rebellious colonies that commit crimes against those perceived to be cruel...
|
||||||
|
|
||||||
|
func (k *KoboldMine) StatCorruption() float64 {
|
||||||
|
return Mean(k.Greed, k.Gullibility, k.Authoritarianism)
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the "crimes of cunning" stat for my crime calculations. It will also be displayed to the player as just Corruption. The player can also see Greed and Authoritarianism, so they should have a good idea what goes into Corruption, but they'll have to infer the importance of Gullibility.
|
||||||
|
|
||||||
func (k *KoboldMine) Stats() []cardsim.Stat {
|
func (k *KoboldMine) Stats() []cardsim.Stat {
|
||||||
stats := cardsim.ExtractStats(k)
|
stats := cardsim.ExtractStats(k)
|
||||||
funcs := []cardsim.Stat{
|
funcs := []cardsim.Stat{
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Mining Income",
|
"Mining Income",
|
||||||
k.ProductivityFunc(&k.MiningIncome),
|
k.ProductivityFunc(k.TrueMiningIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Scavenging Income",
|
"Scavenging Income",
|
||||||
k.ProductivityFunc(&k.ScavengingIncome),
|
k.ProductivityFunc(k.TrueScavengingIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Alchemy Income",
|
"Alchemy Income",
|
||||||
k.ProductivityFunc(&k.AlchemyIncome),
|
k.ProductivityFunc(k.TrueAlchemyIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Hospitality Income",
|
"Hospitality Income",
|
||||||
k.ProductivityFunc(&k.HospitalityIncome),
|
k.ProductivityFunc(k.TrueHospitalityIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Agriculture Income",
|
"Agriculture Income",
|
||||||
k.ProductivityFunc(&k.AgricultureIncome),
|
k.ProductivityFunc(k.TrueAgricultureIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Manufacturing Income",
|
"Manufacturing Income",
|
||||||
k.ProductivityFunc(&k.ManufacturingIncome),
|
k.ProductivityFunc(k.TrueManufacturingIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Planar Harvesting Income",
|
"Planar Harvesting Income",
|
||||||
k.ProductivityFunc(&k.PlanarIncome),
|
k.ProductivityFunc(k.TruePlanarIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Book Publishing Income",
|
"Book Publishing Income",
|
||||||
k.ProductivityFunc(&k.PublishingIncome),
|
k.ProductivityFunc(k.TruePublishingIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Forestry Income",
|
"Forestry Income",
|
||||||
k.ProductivityFunc(&k.ForestryIncome),
|
k.ProductivityFunc(k.TrueForestryIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Finance Income",
|
"Finance Income",
|
||||||
k.ProductivityFunc(&k.FinanceIncome),
|
k.ProductivityFunc(k.TrueFinanceIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Gadgetry Income",
|
"Gadgetry Income",
|
||||||
k.ProductivityFunc(&k.GadgetryIncome),
|
k.ProductivityFunc(k.TrueGadgetryIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Fishing Income",
|
"Fishing Income",
|
||||||
k.ProductivityFunc(&k.FishingIncome),
|
k.ProductivityFunc(k.TrueFishingIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Construction Income",
|
"Construction Income",
|
||||||
k.ProductivityFunc(&k.ConstructionIncome),
|
k.ProductivityFunc(k.TrueConstructionIncome()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Propaganda Expense",
|
"Propaganda Expense",
|
||||||
k.ProductivityFunc(&k.PropagandaExpense),
|
k.ProductivityFunc(k.TruePropagandaExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Bureaucracy Expense",
|
"Bureaucracy Expense",
|
||||||
k.ProductivityFunc(&k.BureaucracyExpense),
|
k.ProductivityFunc(k.TrueBureaucracyExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"War Expense",
|
"War Expense",
|
||||||
k.ProductivityFunc(&k.WarExpense),
|
k.ProductivityFunc(k.TrueWarExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"QoL Expense",
|
"QoL Expense",
|
||||||
k.ProductivityFunc(&k.QoLExpense),
|
k.ProductivityFunc(k.TrueQoLExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Logistics Expense",
|
"Logistics Expense",
|
||||||
k.ProductivityFunc(&k.LogisticsExpense),
|
k.ProductivityFunc(k.TrueLogisticsExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Dragon Subsidies",
|
"Dragon Subsidies",
|
||||||
k.ProductivityFunc(&k.DragonSubsExpense),
|
k.ProductivityFunc(k.TrueDragonSubsExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Research Subsidies",
|
"Research Subsidies",
|
||||||
k.ProductivityFunc(&k.ResearchSubsExpense),
|
k.ProductivityFunc(k.TrueResearchSubsExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Education Expense",
|
"Education Expense",
|
||||||
k.ProductivityFunc(&k.EducationExpense),
|
k.ProductivityFunc(k.TrueEducationExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Healthcare Expense",
|
"Healthcare Expense",
|
||||||
k.ProductivityFunc(&k.HealthcareExpense),
|
k.ProductivityFunc(k.TrueHealthcareExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Foreign Relations Expense",
|
"Foreign Relations Expense",
|
||||||
k.ProductivityFunc(&k.ForeignRelExpense),
|
k.ProductivityFunc(k.TrueForeignRelExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Law Enforcement Expense",
|
"Law Enforcement Expense",
|
||||||
k.ProductivityFunc(&k.PoliceExpense),
|
k.ProductivityFunc(k.TruePoliceExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Economic Planning Expense",
|
"Economic Planning Expense",
|
||||||
k.ProductivityFunc(&k.EconPlanExpense),
|
k.ProductivityFunc(k.TrueEconPlanExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Parks and Aesthetics Expense",
|
"Parks and Aesthetics Expense",
|
||||||
k.ProductivityFunc(&k.ParksExpense),
|
k.ProductivityFunc(k.TrueParksExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Faith Expense",
|
"Faith Expense",
|
||||||
k.ProductivityFunc(&k.FaithExpense),
|
k.ProductivityFunc(k.TrueFaithExpense()),
|
||||||
),
|
),
|
||||||
cardsim.StatFunc(
|
cardsim.StatFunc(
|
||||||
"Total Sector Income",
|
"Total Sector Income",
|
||||||
@ -229,6 +430,14 @@ func (k *KoboldMine) Stats() []cardsim.Stat {
|
|||||||
"Kobolds",
|
"Kobolds",
|
||||||
k.Kobolds,
|
k.Kobolds,
|
||||||
),
|
),
|
||||||
|
cardsim.InvisibleStatFunc(
|
||||||
|
"Squalor Reduction",
|
||||||
|
k.SqualorReduction,
|
||||||
|
),
|
||||||
|
cardsim.StatFunc(
|
||||||
|
"Squalor",
|
||||||
|
k.StatSqualor,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
stats = append(stats, funcs...)
|
stats = append(stats, funcs...)
|
||||||
// cardsim.SortStats(stats)
|
// cardsim.SortStats(stats)
|
||||||
@ -237,7 +446,7 @@ func (k *KoboldMine) Stats() []cardsim.Stat {
|
|||||||
|
|
||||||
func NewKoboldMine() *KoboldMine {
|
func NewKoboldMine() *KoboldMine {
|
||||||
return &KoboldMine{
|
return &KoboldMine{
|
||||||
BasePopulation: 1030,
|
BasePopulation: 1025,
|
||||||
MiningIncome: 0.15,
|
MiningIncome: 0.15,
|
||||||
ScavengingIncome: 0.1,
|
ScavengingIncome: 0.1,
|
||||||
AlchemyIncome: 0.01,
|
AlchemyIncome: 0.01,
|
||||||
@ -268,6 +477,15 @@ func NewKoboldMine() *KoboldMine {
|
|||||||
FoodSupply: 0.20,
|
FoodSupply: 0.20,
|
||||||
ForeignRelations: -0.40,
|
ForeignRelations: -0.40,
|
||||||
HiddenRelPenalty: -0.01,
|
HiddenRelPenalty: -0.01,
|
||||||
|
Rebellion: 0.10,
|
||||||
|
Madness: 0.25,
|
||||||
|
Cruelty: 0.45,
|
||||||
|
Greed: 0.35,
|
||||||
|
Gullibility: 0.10,
|
||||||
|
Authoritarianism: 0.70,
|
||||||
Secrecy: .95,
|
Secrecy: .95,
|
||||||
|
PointOfDimReturns: 1.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note that the mine initializes with 1.02 points of overall productivity.
|
||||||
|
22
koboldsim/util.go
Normal file
22
koboldsim/util.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package koboldsim
|
||||||
|
|
||||||
|
import "math"
|
||||||
|
|
||||||
|
// Generic helper functions not directly attached to Card Sim Engine mechanics.
|
||||||
|
|
||||||
|
// Mean calculates the mathematical mean of its arguments (the sum, divided
|
||||||
|
// by the number of elements). If it is called with no arguments, it returns
|
||||||
|
// NaN ("not a number"). If there are contradictory infinities among the
|
||||||
|
// arguments, it also returns NaN. Overflowing or underflowing can create an
|
||||||
|
// infinity.
|
||||||
|
func Mean(vals ...float64) float64 {
|
||||||
|
if len(vals) == 0 {
|
||||||
|
return math.NaN()
|
||||||
|
}
|
||||||
|
|
||||||
|
total := 0.0
|
||||||
|
for _, x := range vals {
|
||||||
|
total += x
|
||||||
|
}
|
||||||
|
return total / float64(len(vals))
|
||||||
|
}
|
Reference in New Issue
Block a user