Economic Stats Expansion

I also got rid of the "Sector" and "Gov" parts of the tokens, they were just pointless elongation.
This commit is contained in:
Rakeela Windrider 2023-04-04 10:33:14 -07:00
parent d2f89f5bd4
commit ccd141ddc5
2 changed files with 238 additions and 49 deletions

View File

@ -13,14 +13,14 @@ var cards = []Card{
EnactedDesc: cardsim.MsgStr("[current policy] Your war chief is presntly monitoring the situation, building up your military, and securing your creches."), EnactedDesc: cardsim.MsgStr("[current policy] Your war chief is presntly monitoring the situation, building up your military, and securing your creches."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value += 100 p.Stats.Kobolds.Value += 100
p.Stats.SectorScavengingIncome.Value += 0.01 p.Stats.ScavengingIncome.Value += 0.01
p.Stats.GovWarExpense.Value += 0.02 p.Stats.WarExpense.Value += 0.02
return cardsim.MsgStr("Kobolds are known to be born warriors."), nil return cardsim.MsgStr("Kobolds are known to be born warriors."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 100 p.Stats.Kobolds.Value -= 100
p.Stats.SectorScavengingIncome.Value -= 0.01 p.Stats.ScavengingIncome.Value -= 0.01
p.Stats.GovWarExpense.Value -= 0.02 p.Stats.WarExpense.Value -= 0.02
return nil return nil
}, },
CanDo: YesWeCan, CanDo: YesWeCan,
@ -30,14 +30,14 @@ var cards = []Card{
EnactedDesc: cardsim.MsgStr("[current policy] Your head miner is presently leading a project to dig as far away from the surface as possible."), EnactedDesc: cardsim.MsgStr("[current policy] Your head miner is presently leading a project to dig as far away from the surface as possible."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value += 40 p.Stats.Kobolds.Value += 40
p.Stats.SectorMiningIncome.Value += 0.02 p.Stats.MiningIncome.Value += 0.02
p.Stats.GovBureaucracyExpense.Value += 0.01 p.Stats.BureaucracyExpense.Value += 0.01
return cardsim.MsgStr("Kobolds are known to be cowards hiding in the dark."), nil return cardsim.MsgStr("Kobolds are known to be cowards hiding in the dark."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 40 p.Stats.Kobolds.Value -= 40
p.Stats.SectorMiningIncome.Value -= 0.02 p.Stats.MiningIncome.Value -= 0.02
p.Stats.GovBureaucracyExpense.Value -= 0.01 p.Stats.BureaucracyExpense.Value -= 0.01
return nil return nil
}, },
CanDo: YesWeCan, CanDo: YesWeCan,
@ -47,14 +47,14 @@ var cards = []Card{
EnactedDesc: cardsim.MsgStr("[current policy] Military funding has been diverted into early childhood education."), EnactedDesc: cardsim.MsgStr("[current policy] Military funding has been diverted into early childhood education."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value -= 40 p.Stats.Kobolds.Value -= 40
p.Stats.SectorScavengingIncome.Value -= 0.01 p.Stats.ScavengingIncome.Value -= 0.01
p.Stats.GovWarExpense.Value -= 0.02 p.Stats.WarExpense.Value -= 0.02
return cardsim.MsgStr("An undefended hunting outpost near the surface was recently wiped out by a raid."), nil return cardsim.MsgStr("An undefended hunting outpost near the surface was recently wiped out by a raid."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value += 40 p.Stats.Kobolds.Value += 40
p.Stats.SectorScavengingIncome.Value += 0.01 p.Stats.ScavengingIncome.Value += 0.01
p.Stats.GovWarExpense.Value += 0.02 p.Stats.WarExpense.Value += 0.02
return nil return nil
}, },
CanDo: YesWeCan, CanDo: YesWeCan,
@ -103,14 +103,14 @@ var cards = []Card{
EnactedDesc: cardsim.MsgStr("[current policy] Your bureaucrats are really looking forward to attending, where they can boast about how the festival boosted their salaries."), EnactedDesc: cardsim.MsgStr("[current policy] Your bureaucrats are really looking forward to attending, where they can boast about how the festival boosted their salaries."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value += 80 p.Stats.Kobolds.Value += 80
p.Stats.SectorScavengingIncome.Value += 0.01 p.Stats.ScavengingIncome.Value += 0.01
p.Stats.GovBureaucracyExpense.Value += 0.03 p.Stats.BureaucracyExpense.Value += 0.03
return cardsim.MsgStr("Bureaucrats are considered pillars of society."), nil return cardsim.MsgStr("Bureaucrats are considered pillars of society."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 80 p.Stats.Kobolds.Value -= 80
p.Stats.SectorScavengingIncome.Value -= 0.01 p.Stats.ScavengingIncome.Value -= 0.01
p.Stats.GovBureaucracyExpense.Value -= 0.03 p.Stats.BureaucracyExpense.Value -= 0.03
return nil return nil
}, },
CanDo: YesWeCan, CanDo: YesWeCan,
@ -120,15 +120,15 @@ var cards = []Card{
EnactedDesc: cardsim.MsgStr("[current policy] Your nation's policy is clear: the festival of bureaucracy is a chance to trade workers with other kobold nations in your attempts to build a more efficient government."), EnactedDesc: cardsim.MsgStr("[current policy] Your nation's policy is clear: the festival of bureaucracy is a chance to trade workers with other kobold nations in your attempts to build a more efficient government."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value += 20 p.Stats.Kobolds.Value += 20
p.Stats.GovBureaucracyExpense.Value -= 0.01 p.Stats.BureaucracyExpense.Value -= 0.01
return cardsim.MsgStr("Immigrant bureaucrats complain about being under-appreciated."), nil return cardsim.MsgStr("Immigrant bureaucrats complain about being under-appreciated."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 20 p.Stats.Kobolds.Value -= 20
p.Stats.GovBureaucracyExpense.Value += 0.01 p.Stats.BureaucracyExpense.Value += 0.01
return nil return nil
}, },
CanDo: func(p *Player) bool { return p.Stats.GovBureaucracyExpense.Value >= 0.02 }, CanDo: func(p *Player) bool { return p.Stats.BureaucracyExpense.Value >= 0.02 },
// CanDo: func(p *Player) bool { // CanDo: func(p *Player) bool {
// if p.Stats.GovBureaucracyExpense.Value >= 0.02 { // if p.Stats.GovBureaucracyExpense.Value >= 0.02 {
// return true // return true
@ -142,27 +142,27 @@ var cards = []Card{
EnactedDesc: cardsim.MsgStr(`[current policy] It's hard to find volunteer workers at the festival, but your nation is doing its best.`), EnactedDesc: cardsim.MsgStr(`[current policy] It's hard to find volunteer workers at the festival, but your nation is doing its best.`),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value += 10 p.Stats.Kobolds.Value += 10
p.Stats.GovBureaucracyExpense.Value -= 0.02 p.Stats.BureaucracyExpense.Value -= 0.02
return cardsim.MsgStr("The local bureaucracy is staffed by volunteer labor."), nil return cardsim.MsgStr("The local bureaucracy is staffed by volunteer labor."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 10 p.Stats.Kobolds.Value -= 10
p.Stats.GovBureaucracyExpense.Value += 0.02 p.Stats.BureaucracyExpense.Value += 0.02
return nil return nil
}, },
CanDo: func(p *Player) bool { return p.Stats.GovBureaucracyExpense.Value < 0.02 }, CanDo: func(p *Player) bool { return p.Stats.BureaucracyExpense.Value < 0.02 },
}, },
&BasicPolicy{ &BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`One of your non-bureaucrat friends has been in a foul temper. "This festival is everything that's wrong with our society. Life isn't about filling out forms. We ought to snub this festival and outright fire some bureaucrats."`), UnenactedDesc: cardsim.MsgStr(`One of your non-bureaucrat friends has been in a foul temper. "This festival is everything that's wrong with our society. Life isn't about filling out forms. We ought to snub this festival and outright fire some bureaucrats."`),
EnactedDesc: cardsim.MsgStr("Your nation currently bans the International Festival of Bureaucracy. There will be no local celebration without a policy change."), EnactedDesc: cardsim.MsgStr("Your nation currently bans the International Festival of Bureaucracy. There will be no local celebration without a policy change."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value -= 80 p.Stats.Kobolds.Value -= 80
p.Stats.GovBureaucracyExpense.Value -= 0.04 p.Stats.BureaucracyExpense.Value -= 0.04
return cardsim.MsgStr("A wave of bureaucrats just emigrated along with kobolds incensed by the nation's lack of respect for administration."), nil return cardsim.MsgStr("A wave of bureaucrats just emigrated along with kobolds incensed by the nation's lack of respect for administration."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.Kobolds.Value += 80 p.Stats.Kobolds.Value += 80
p.Stats.GovBureaucracyExpense.Value += 0.04 p.Stats.BureaucracyExpense.Value += 0.04
return nil return nil
}, },
CanDo: YesWeCan, CanDo: YesWeCan,
@ -187,13 +187,13 @@ var cards = []Card{
&DisabledPolicy{cardsim.MsgStr("Neglecting the event would be less popular and more inefficient than our current policy.")}, &DisabledPolicy{cardsim.MsgStr("Neglecting the event would be less popular and more inefficient than our current policy.")},
&FuncPolicy{ &FuncPolicy{
OptionTextFunc: func(p *Player) (cardsim.Message, error) { OptionTextFunc: func(p *Player) (cardsim.Message, error) {
if p.Stats.GovBureaucracyExpense.Value >= -0.03 { if p.Stats.BureaucracyExpense.Value >= -0.03 {
return cardsim.MsgStr("Permitting the festival will yield some immigration, but we'll be expected to rebuild our bureaucracy."), nil return cardsim.MsgStr("Permitting the festival will yield some immigration, but we'll be expected to rebuild our bureaucracy."), nil
} }
return cardsim.MsgStr("Permitting the festival will yield some immigration."), nil return cardsim.MsgStr("Permitting the festival will yield some immigration."), nil
}, },
EnactFunc: func(p *Player) (cardsim.Message, error) { EnactFunc: func(p *Player) (cardsim.Message, error) {
if p.Stats.GovBureaucracyExpense.Value >= -0.03 { if p.Stats.BureaucracyExpense.Value >= -0.03 {
return cardsim.MsgStr("A festival of bureaucracy just saw the nation's bureaucracy rebuilt."), ErrKeepMessage return cardsim.MsgStr("A festival of bureaucracy just saw the nation's bureaucracy rebuilt."), ErrKeepMessage
} }
return cardsim.MsgStr("A festival of bureaucracy brought in immigrants wondering at the nation's lack thereof."), ErrKeepMessage return cardsim.MsgStr("A festival of bureaucracy brought in immigrants wondering at the nation's lack thereof."), ErrKeepMessage

View File

@ -8,11 +8,32 @@ import (
type KoboldMine struct { type KoboldMine struct {
Kobolds cardsim.Stored[int64] Kobolds cardsim.Stored[int64]
SectorMiningIncome cardsim.Stored[float64] MiningIncome cardsim.Stored[float64]
SectorScavengingIncome 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]
GovBureaucracyExpense cardsim.Stored[float64] BureaucracyExpense cardsim.Stored[float64]
GovWarExpense 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]
} }
func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 { func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 {
@ -22,31 +43,115 @@ func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64
} }
func (k *KoboldMine) TotalSectorIncome() float64 { func (k *KoboldMine) TotalSectorIncome() float64 {
return float64(k.Kobolds.Value) * (k.SectorMiningIncome.Value + k.SectorScavengingIncome.Value) 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)
} }
func (k *KoboldMine) TotalGovExpense() float64 { func (k *KoboldMine) TotalGovExpense() float64 {
return float64(k.Kobolds.Value) * (k.GovBureaucracyExpense.Value + k.GovWarExpense.Value) 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)
} }
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(
"Total Sector Mining Income", "Mining Income",
k.ProductivityFunc(&k.SectorMiningIncome), k.ProductivityFunc(&k.MiningIncome),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Sector Scavenging Income", "Scavenging Income",
k.ProductivityFunc(&k.SectorScavengingIncome), k.ProductivityFunc(&k.ScavengingIncome),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Government Bureaucracy Expense", "Alchemy Income",
k.ProductivityFunc(&k.GovBureaucracyExpense), k.ProductivityFunc(&k.AlchemyIncome),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Government War Expense", "Hospitality Income",
k.ProductivityFunc(&k.GovWarExpense), 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),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Sector Income", "Total Sector Income",
@ -58,7 +163,7 @@ func (k *KoboldMine) Stats() []cardsim.Stat {
), ),
} }
stats = append(stats, funcs...) stats = append(stats, funcs...)
cardsim.SortStats(stats) // cardsim.SortStats(stats)
return stats return stats
} }
@ -68,21 +173,105 @@ func NewKoboldMine() *KoboldMine {
Name: "Kobolds", Name: "Kobolds",
Value: 1000, Value: 1000,
}, },
SectorMiningIncome: cardsim.Stored[float64]{ MiningIncome: cardsim.Stored[float64]{
Name: "Sector Mining Income", Name: "Mining Productivity",
Value: 0.15, Value: 0.15,
}, },
SectorScavengingIncome: cardsim.Stored[float64]{ ScavengingIncome: cardsim.Stored[float64]{
Name: "Sector Scavenging Income", Name: "Scavenging Productivity",
Value: 0.1, Value: 0.1,
}, },
GovBureaucracyExpense: cardsim.Stored[float64]{ AlchemyIncome: cardsim.Stored[float64]{
Name: "Government Bureaucracy Expense", 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, Value: 0.05,
}, },
GovWarExpense: cardsim.Stored[float64]{ BureaucracyExpense: cardsim.Stored[float64]{
Name: "Government War Expense", Name: "Bureaucracy Investment",
Value: 0.05,
},
WarExpense: cardsim.Stored[float64]{
Name: "War Investment",
Value: 0.1, 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,
},
} }
} }