Compare commits

..

2 Commits

Author SHA1 Message Date
f3fd0c582f Expansion of Issue #4
Parks spending will have more features later.
2023-04-05 12:30:00 -07:00
de98cf8fb3 Obesity Stat Implementation
First sigmoid function!
2023-04-05 12:29:23 -07:00
2 changed files with 47 additions and 3 deletions

View File

@ -382,13 +382,51 @@ var cards = []Card{
}, },
CanDo: YesWeCan, CanDo: YesWeCan,
}, },
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your Minister of Finance is scandalized. "A free service? And such an expensive one to construct? No, no, no. The baths must pull their weight in the budget if they're ot be made at all. We must set an entry fee."`),
EnactedDesc: cardsim.MsgStr("[current policy] Elite bathhouses serve paying customers in your largest sites."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.ConstructionIncome += 0.01
p.Stats.HospitalityIncome += 0.01
p.Stats.ParksExpense += 0.02
return cardsim.MsgStr("A dirty body is the mark of the lower classes."), nil
},
Undo: func(p *Player) error {
p.Stats.ConstructionIncome -= 0.01
p.Stats.HospitalityIncome -= 0.01
p.Stats.ParksExpense -= 0.02
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your head diplomat chimes in with, "If you want to make the service self-sustaining, build a bath in a shallow cave and invite the surfacers in for a fee. Of course, we'll be giving up some of our secrecy, but it'll bring in foreign exchange to power our industries."`),
EnactedDesc: cardsim.MsgStr("[current policy] Conservative kobolds are scandalized: not only has the nation bathhouses, it has near-surface bathhouses for surfacers to visit."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.ConstructionIncome += 0.02
p.Stats.HospitalityIncome += 0.03
p.Stats.ManufacturingIncome += 0.01
p.Stats.ParksExpense += 0.03
p.Stats.FoodSupply += 0.01
return cardsim.MsgStr("Surfacers stink less in the nation's vicinity."), nil
}, // Reminder: When a Secrecy stat is implemented charge this option a secrecy penalty.
Undo: func(p *Player) error {
p.Stats.ConstructionIncome -= 0.02
p.Stats.HospitalityIncome -= 0.03
p.Stats.ManufacturingIncome -= 0.01
p.Stats.ParksExpense -= 0.03
p.Stats.FoodSupply -= 0.01
return nil
},
CanDo: YesWeCan,
},
&VerbosePolicy{ &VerbosePolicy{
Default: &BasicPolicy{ Default: &BasicPolicy{
UnenactedDesc: cardsim.MsgStr("When is the right time to embark on building public baths? You can hew close to skeptics instead."), UnenactedDesc: cardsim.MsgStr("Bathhouses are a big project that would displace other things in the city center. You could use the space for housing and services instead."),
EnactedDesc: cardsim.MsgStr("When is the right time to embark on building public baths? You can hew close to skeptics instead."), EnactedDesc: cardsim.MsgStr("When is the right time to embark on building public baths? You can hew close to skeptics instead."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.BasePopulation += 5 p.Stats.BasePopulation += 5
return cardsim.MsgStr("There are a few opponents of public baths to curry the support of."), nil return cardsim.MsgStr("Opponents of public bathing won a recent political contest."), nil
}, },
Undo: func(p *Player) error { Undo: func(p *Player) error {
p.Stats.BasePopulation -= 5 p.Stats.BasePopulation -= 5

View File

@ -1,6 +1,8 @@
package koboldsim package koboldsim
import ( import (
"math"
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim" "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
) )
@ -65,13 +67,17 @@ func (k *KoboldMine) StatTaxRate() float64 {
} }
func (k *KoboldMine) Kobolds() int64 { func (k *KoboldMine) Kobolds() int64 {
return int64(k.BasePopulation * k.FoodSupply) return int64(k.BasePopulation * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)))
} }
func (k *KoboldMine) DisplayedFoodSupply() float64 { func (k *KoboldMine) DisplayedFoodSupply() float64 {
return (k.FoodSupply - 1) * 100 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 { func (k *KoboldMine) Stats() []cardsim.Stat {
stats := cardsim.ExtractStats(k) stats := cardsim.ExtractStats(k)
funcs := []cardsim.Stat{ funcs := []cardsim.Stat{