Change "Productivity" to "Income" and "Expense

Also fixes a typo and an incorrectly assigned variable.
This commit is contained in:
Rakeela Windrider 2023-04-03 14:35:36 -07:00
parent 4e983bd0f0
commit 0e77206868
2 changed files with 36 additions and 36 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.SectorScavengingProductivity.Value += 0.01 p.Stats.SectorScavengingIncome.Value += 0.01
p.Stats.GovWarProductivity.Value += 0.02 p.Stats.GovWarExpense.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.SectorScavengingProductivity.Value -= 0.01 p.Stats.SectorScavengingIncome.Value -= 0.01
p.Stats.GovWarProductivity.Value -= 0.02 p.Stats.GovWarExpense.Value -= 0.02
return nil return nil
}, },
}, },
@ -29,14 +29,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.SectorMiningProductivity.Value += 0.02 p.Stats.SectorMiningIncome.Value += 0.02
p.Stats.GovBureaucracyProductivity.Value += 0.01 p.Stats.GovBureaucracyExpense.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.SectorMiningProductivity.Value -= 0.02 p.Stats.SectorMiningIncome.Value -= 0.02
p.Stats.GovBureaucracyProductivity.Value -= 0.01 p.Stats.GovBureaucracyExpense.Value -= 0.01
return nil return nil
}, },
}, },
@ -45,14 +45,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.SectorScavengingProductivity.Value -= 0.01 p.Stats.SectorScavengingIncome.Value -= 0.01
p.Stats.GovWarProductivity.Value -= 0.02 p.Stats.GovWarExpense.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.SectorScavengingProductivity.Value += 0.01 p.Stats.SectorScavengingIncome.Value += 0.01
p.Stats.GovWarProductivity.Value += 0.02 p.Stats.GovWarExpense.Value += 0.02
return nil return nil
}, },
}, },

View File

@ -8,11 +8,11 @@ import (
type KoboldMine struct { type KoboldMine struct {
Kobolds cardsim.Stored[int64] Kobolds cardsim.Stored[int64]
SectorMiningProductivity cardsim.Stored[float64] SectorMiningIncome cardsim.Stored[float64]
SectorScavengingProductivity cardsim.Stored[float64] SectorScavengingIncome cardsim.Stored[float64]
GovBureaucracyProductivity cardsim.Stored[float64] GovBureaucracyExpense cardsim.Stored[float64]
GovWarProductivity cardsim.Stored[float64] GovWarExpense cardsim.Stored[float64]
} }
func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 { func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 {
@ -22,38 +22,38 @@ func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64
} }
func (k *KoboldMine) TotalSectorProductivity() float64 { func (k *KoboldMine) TotalSectorProductivity() float64 {
return float64(k.Kobolds.Value) * (k.SectorMiningProductivity.Value + k.SectorScavengingProductivity.Value) return float64(k.Kobolds.Value) * (k.SectorMiningIncome.Value + k.SectorScavengingIncome.Value)
} }
func (k *KoboldMine) TotalGovProductivity() float64 { func (k *KoboldMine) TotalGovProductivity() float64 {
return float64(k.Kobolds.Value) * (k.GovBureaucracyProductivity.Value + k.GovWarProductivity.Value) return float64(k.Kobolds.Value) * (k.GovBureaucracyExpense.Value + k.GovWarExpense.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 Productivity", "Total Sector Mining Income",
k.ProductivityFunc(&k.SectorMiningProductivity), k.ProductivityFunc(&k.SectorMiningIncome),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Sector Scavenging Productivity", "Total Sector Scavenging Income",
k.ProductivityFunc(&k.SectorScavengingProductivity), k.ProductivityFunc(&k.SectorScavengingIncome),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Government Bureaucracy Productivity", "Total Government Bureaucracy Expense",
k.ProductivityFunc(&k.GovBureaucracyProductivity), k.ProductivityFunc(&k.GovBureaucracyExpense),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Government War Productivity", "Total Government War Expense",
k.ProductivityFunc(&k.GovBureaucracyProductivity), k.ProductivityFunc(&k.GovWarExpense),
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Sector Productivity", "Total Sector Income",
k.TotalSectorProductivity, k.TotalSectorProductivity,
), ),
cardsim.StatFunc( cardsim.StatFunc(
"Total Government Productivity", "Total Government Expense",
k.TotalGovProductivity, k.TotalGovProductivity,
), ),
} }
@ -68,20 +68,20 @@ func NewKoboldMine() *KoboldMine {
Name: "Kobolds", Name: "Kobolds",
Value: 1000, Value: 1000,
}, },
SectorMiningProductivity: cardsim.Stored[float64]{ SectorMiningIncome: cardsim.Stored[float64]{
Name: "Sector Mining Productivity", Name: "Sector Mining Income",
Value: 0.15, Value: 0.15,
}, },
SectorScavengingProductivity: cardsim.Stored[float64]{ SectorScavengingIncome: cardsim.Stored[float64]{
Name: "Sector Scavening Productivity", Name: "Sector Scavening Income",
Value: 0.1, Value: 0.1,
}, },
GovBureaucracyProductivity: cardsim.Stored[float64]{ GovBureaucracyExpense: cardsim.Stored[float64]{
Name: "Government Bureaucracy Productivity", Name: "Government Bureaucracy Expense",
Value: 0.05, Value: 0.05,
}, },
GovWarProductivity: cardsim.Stored[float64]{ GovWarExpense: cardsim.Stored[float64]{
Name: "Government War Productivity", Name: "Government War Expense",
Value: 0.1, Value: 0.1,
}, },
} }