Card 10, first PIP implementation

This commit is contained in:
Rakeela 2024-09-29 09:29:50 -07:00
parent 16f452b08f
commit e018bd0ad6
3 changed files with 153 additions and 15 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1173,6 +1173,150 @@ var cards = []Card{
}, },
}, },
}, // end of "Strategic Sweets" card }, // end of "Strategic Sweets" card
&SwitchingCard{ // Card 10
Name: cardsim.MsgStr("The Foremost Deity"),
Desc: cardsim.MsgStr("Which of the kobold deities should be regarded as the patron of your tribe?"),
After: ShuffleIntoBottomHalf,
Policies: []Policy{
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`"Kobolds were meant to serve dragons!" insists one of your more sycophantic kobolds. "Instead of having a patron deity, we should find a dragon who we can swear undying loyalty to, assuring them that there are no higher deities in our lives than they. This is one of the most cost-effective ways to get a dragon, and the total loyalty of a kobold tribe often appeals to very powerful dragons who stand to gain a lot of prominence among dragons from being deified.`),
EnactedDesc: cardsim.MsgStr("[current policy] The tribe is venerating a powerful dragon as the tribe's patron deity."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.DragonCount += 1
p.Stats.Finance += 2
p.Stats.Hospitality += 1
p.Stats.Militarism += 1
p.Stats.Authoritarianism += 1
p.Stats.Rebellion -= 2
return cardsim.MsgStr("The tribe's new dragon tyrant is settling in nicely."), nil
},
Undo: func(p *Player) error {
p.Stats.DragonCount -= 1
p.Stats.Finance -= 2
p.Stats.Hospitality -= 1
p.Stats.Militarism -= 1
p.Stats.Authoritarianism -= 1
p.Stats.Rebellion += 2
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`A paragon of your tribe raises their hands and says, "The only patron deity for any lawful tribe is Izkren. The honored Queen of the Gods, Izkren stands for the striving towards paradise in life and after it. To exalt another god over her is to stand in rebellion against the proper way of things and invite in chaos."`),
EnactedDesc: cardsim.MsgStr("[current policy] Izkren, Queen of the Gods, has been installed as the foremost deity of the tribe."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Faith += 3
p.Stats.Publishing += 1
p.Stats.Hospitality += 1
p.Stats.Construction += 1
p.Stats.Authoritarianism += 2
p.Stats.Rebellion -= 4
p.Stats.Madness -= 1
p.Stats.Greed -= 1
return cardsim.MsgStr("Izkren is silent, but surely her approval can only bring your tribe to glory."), nil
},
Undo: func(p *Player) error {
p.Stats.Faith -= 3
p.Stats.Publishing -= 1
p.Stats.Hospitality -= 1
p.Stats.Construction -= 1
p.Stats.Authoritarianism -= 2
p.Stats.Rebellion += 4
p.Stats.Madness += 1
p.Stats.Greed += 1
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`A wise old kobold bows and avows, "Although it is a heterodox perspective, there are tribes that exalt the tinkering sage Sobol over all other gods. This practice puts wisdom and technical skill into an exalted position, bringing philosophers and engineers alike into the faith. Sobol's worship is sometimes derided as crypto-atheistic, but I assure you there are sincere advocates as well."`),
EnactedDesc: cardsim.MsgStr("[current policy] Sobol, the Wise Tinkerer, is considered the highest deity among the tribe."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.BasePopulation += 50
p.Stats.Faith += 1
p.Stats.Education += 2
p.Stats.ResearchSubs += 1
p.Stats.Manufacturing += 1
p.Stats.Construction += 1
p.Stats.Publishing += 2
p.Stats.Gadgetry += 2
p.Stats.Alchemy += 1
p.Stats.Madness -= 1
return cardsim.MsgStr("The number of kobolds the tribe can support increases with its technical sophistication."), nil
},
Undo: func(p *Player) error {
p.Stats.BasePopulation -= 50
p.Stats.Faith -= 1
p.Stats.Education -= 2
p.Stats.ResearchSubs -= 1
p.Stats.Manufacturing -= 1
p.Stats.Construction -= 1
p.Stats.Publishing -= 2
p.Stats.Gadgetry -= 2
p.Stats.Alchemy -= 1
p.Stats.Madness += 1
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`"Ektani!" cries a youthful kobold in a white robe. "The goddess of life! Some of her great saints are immortal! If you install Ektani as our highest god, we'll gain healing magics immediately. People will survive sickness and injury. They'll flock to us from plague-stricken tribes. And our healthcare professionals will be greatly exalted!"`),
EnactedDesc: cardsim.MsgStr("[current policy] Ektani, the exalted healer, is considered to be the tribe's rightful patron."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.BasePopulation += 1
p.Stats.Faith += 3
p.Stats.Healthcare += 2
p.Stats.Education += 1
p.Stats.Secrecy -= 1
p.Stats.Cruelty -= 1
p.Stats.Madness -= 1
p.Stats.FoodSupply -= 10
return cardsim.MsgStr("Ektani's support plunges death rates and childhood mortality while causing immigration to surge. Can you feed everyone?"), nil
},
Undo: func(p *Player) error {
p.Stats.BasePopulation -= 1
p.Stats.Faith -= 3
p.Stats.Healthcare -= 2
p.Stats.Education -= 1
p.Stats.Secrecy += 1
p.Stats.Cruelty += 1
p.Stats.Madness += 1
p.Stats.FoodSupply += 10
return nil
},
CanDo: YesWeCan,
},
&VerbosePolicy{
Default: &BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Rejecting all thought of worship will drive away a few kobolds."),
EnactedDesc: cardsim.MsgStr("Persisting in your rejection of worship will change nothing."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.BasePopulation -= 30
return cardsim.MsgStr("A few kobolds have left decrying your faithless tribe."), nil
},
Undo: func(p *Player) error {
p.Stats.BasePopulation += 30
return nil
},
CanDo: YesWeCan,
},
Variants: []Policy{
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Driving away a dragon tyrant is an undertaking, and a few kobolds will be lost in the process."),
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Rejecting Izkren will demoralize some of your tribe. There will be some emigrants."),
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Rejecting Sobol's primacy will damage your tribe's economy. There will be an outflow of economic migrants."),
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Cutting off Ektani's magic will drive kobolds away in horror, and spike death rates among those who remain."),
},
},
},
},
}, //end of "The Foremost Deity" card
} // end of card list } // end of card list
func initDeck(d *cardsim.Deck[*KoboldMine]) { func initDeck(d *cardsim.Deck[*KoboldMine]) {

View File

@ -7,6 +7,7 @@ import (
// KoboldMine is the state of a kobold mine. // KoboldMine is the state of a kobold mine.
type KoboldMine struct { type KoboldMine struct {
BasePopulation float64 `cardsim:"stathidden"` BasePopulation float64 `cardsim:"stathidden"`
DragonCount float64 `cardsim:"stat" cardsim_name:"Dragon Population"`
Mining float64 `cardsim:"stathidden" cardsim_name:"Mining"` Mining float64 `cardsim:"stathidden" cardsim_name:"Mining"`
Scavenging float64 `cardsim:"stathidden" cardsim_name:"Scavenging"` Scavenging float64 `cardsim:"stathidden" cardsim_name:"Scavenging"`
@ -32,7 +33,6 @@ type KoboldMine struct {
Education float64 `cardsim:"stathidden" cardsim_name:"Education"` Education float64 `cardsim:"stathidden" cardsim_name:"Education"`
Healthcare float64 `cardsim:"stathidden" cardsim_name:"Healthcare"` Healthcare float64 `cardsim:"stathidden" cardsim_name:"Healthcare"`
ForeignRelExpense float64 `cardsim:"stathidden" cardsim_name:"Diplomatic Investment"` ForeignRelExpense float64 `cardsim:"stathidden" cardsim_name:"Diplomatic Investment"`
Police float64 `cardsim:"stathidden" cardsim_name:"Law Enforcement"`
ParksExpense float64 `cardsim:"stathidden" cardsim_name:"City Beautification"` ParksExpense float64 `cardsim:"stathidden" cardsim_name:"City Beautification"`
Faith float64 `cardsim:"stathidden" cardsim_name:"Faith"` Faith float64 `cardsim:"stathidden" cardsim_name:"Faith"`
@ -43,7 +43,7 @@ type KoboldMine struct {
Rebellion float64 `cardsim:"stathidden"` Rebellion float64 `cardsim:"stathidden"`
Madness float64 `cardsim:"stathidden"` Madness float64 `cardsim:"stathidden"`
Cruelty float64 `cardsim:"stat"` Cruelty float64 `cardsim:"stat"`
Greed float64 `cardsim:"stat"` Greed float64 `cardsim:"stathidden"`
Gullibility float64 `cardsim:"stathidden"` Gullibility float64 `cardsim:"stathidden"`
Authoritarianism float64 `cardsim:"stat"` Authoritarianism float64 `cardsim:"stat"`
@ -55,12 +55,14 @@ type KoboldMine struct {
} }
func (k *KoboldMine) Kobolds() int64 { func (k *KoboldMine) Kobolds() int64 {
return int64((k.BasePopulation * (k.Healthcare + 1)) * (k.FoodSupply) * (100 + k.TrueForeignRelations()/100)) return int64((k.BasePopulation * (k.Healthcare + 1)) * (k.FoodSupply / 10) * (1 + k.TrueForeignRelations()/100))
} }
const ( const (
MinFoodSupply = 18 MinFoodSupply = 18
MaxFoodSupply = 37 MaxFoodSupply = 37
MinForeignRelations = -11
MaxForeignRelations = 9
) )
func (k *KoboldMine) DisplayedFoodSupply() float64 { func (k *KoboldMine) DisplayedFoodSupply() float64 {
@ -77,21 +79,14 @@ func (k *KoboldMine) TrueForeignRelations() float64 {
return openness / 100 * effectiveRel return openness / 100 * effectiveRel
} }
const (
MinForeignRelations = -11
MaxForeignRelations = 9
)
func (k *KoboldMine) DisplayedForeignRelations() float64 { func (k *KoboldMine) DisplayedForeignRelations() float64 {
return 100 * (k.ForeignRelations - MinForeignRelations) / (MaxForeignRelations - MinForeignRelations) return 100 * (k.ForeignRelations - MinForeignRelations) / (MaxForeignRelations - MinForeignRelations)
} }
func (k *KoboldMine) DisplayedSecrecy() float64 { func (k *KoboldMine) DisplayedSecrecy() float64 {
return k.Secrecy * 100 return k.Secrecy
} }
// 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 { func (k *KoboldMine) StatChaos() float64 {
return Mean(k.Rebellion, k.Madness, k.Cruelty) return Mean(k.Rebellion, k.Madness, k.Cruelty)
} }
@ -102,7 +97,7 @@ func (k *KoboldMine) StatCorruption() float64 {
return Mean(k.Greed, k.Gullibility, k.Authoritarianism) 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. // 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 see Authoritarianism, but they'll have to infer the importance of Greed and Gullibility.
func (k *KoboldMine) Stats() []cardsim.Stat { func (k *KoboldMine) Stats() []cardsim.Stat {
stats := cardsim.ExtractStats(k) stats := cardsim.ExtractStats(k)
@ -155,7 +150,6 @@ func NewKoboldMine() *KoboldMine {
Education: 0, Education: 0,
Healthcare: 0, Healthcare: 0,
ForeignRelExpense: 0, ForeignRelExpense: 0,
Police: 0,
ParksExpense: 0, ParksExpense: 0,
Faith: 0, Faith: 0,
FoodSupply: 20, FoodSupply: 20,