KoboldSim/koboldsim/cards.go
Rakeela d2f89f5bd4 Issue #2 Option Validity Check
I also fixed the write to-do and changed an improbable mention of Education into a more likely mention of Finance.
2023-04-03 21:20:14 -07:00

215 lines
11 KiB
Go

package koboldsim
import "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
var cards = []Card{
&SwitchingCard{
Name: cardsim.MsgStr("Warborn"),
Desc: cardsim.MsgStr(" A surge of anti-kobold sentiment has been reported by your spies on the surface and your military is concerned that anti-kobold vigilantes will attack the tunnels in the near-future. They want to build up now while doing so is safe."),
After: ShuffleIntoBottomHalf,
Policies: []Policy{
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your war chief paces irritably. "We have terrible threats facing us. It's imperative that we build up our numbers in both the military and the domestic sense. I want creches under military control and a good hunting crew to supply them with food."`),
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) {
p.Stats.Kobolds.Value += 100
p.Stats.SectorScavengingIncome.Value += 0.01
p.Stats.GovWarExpense.Value += 0.02
return cardsim.MsgStr("Kobolds are known to be born warriors."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 100
p.Stats.SectorScavengingIncome.Value -= 0.01
p.Stats.GovWarExpense.Value -= 0.02
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your head miner considers the matter worriedly. "Creches under military control? No. That would invite chaos. We need to dig deeper; we can have a peaceful, orderly society if we just get far enough away from surfacers."`),
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) {
p.Stats.Kobolds.Value += 40
p.Stats.SectorMiningIncome.Value += 0.02
p.Stats.GovBureaucracyExpense.Value += 0.01
return cardsim.MsgStr("Kobolds are known to be cowards hiding in the dark."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 40
p.Stats.SectorMiningIncome.Value -= 0.02
p.Stats.GovBureaucracyExpense.Value -= 0.01
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your nursery director is incensed. "Creches under military control? Never! Let young kobolds play! In fact, cut the military just for suggesting this. The threats facing us are completely overstated."`),
EnactedDesc: cardsim.MsgStr("[current policy] Military funding has been diverted into early childhood education."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value -= 40
p.Stats.SectorScavengingIncome.Value -= 0.01
p.Stats.GovWarExpense.Value -= 0.02
return cardsim.MsgStr("An undefended hunting outpost near the surface was recently wiped out by a raid."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value += 40
p.Stats.SectorScavengingIncome.Value += 0.01
p.Stats.GovWarExpense.Value += 0.02
return nil
},
CanDo: YesWeCan,
},
&VerbosePolicy{
Default: &BasicPolicy{
UnenactedDesc: cardsim.MsgStr("This isn't about a disaster and can probably be safely dismissed."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value += 20
return cardsim.MsgStr("Creche control doesn't shift that easily."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 20
return nil
},
CanDo: YesWeCan,
},
Variants: []Policy{
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Rejecting this issue will also reject the military's natalist stance."),
Do: OverrideMsg(cardsim.MsgStr("Militant natalism has been reduced by policy.")),
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`"Dig deeper" pressures in your nation may be excessive.`),
Do: OverrideMsg(cardsim.MsgStr("Some of the lower depths are being abandoned.")),
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Near-surface patrols may need to be increased."),
Do: OverrideMsg(cardsim.MsgStr("More and better-armed hunting outposts are being established.")),
},
&BasicPolicy{
EnactedDesc: cardsim.MsgStr("This isn't about a disaster and can probably continue to be safely dismissed."),
Do: OverrideMsg(cardsim.MsgStr("Creche control doesn't shift that easily.")),
},
},
},
}, // end of "Warborn" policies
}, // end of "Warborn" card
&SwitchingCard{
Name: cardsim.MsgStr("International Festival of Bureaucracy"),
Desc: cardsim.MsgStr(" Good times are upon us! A great festival has been declared between many kobold nations, celebrating the orderly nature of the kobold soul! That's right, it's the International Festival of Bureaucracy!"),
After: ShuffleIntoBottomHalf,
Policies: []Policy{
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your Minister of Administration is practically jumping for joy. "This is our opportunity to prove that we're a prosperous society and attract some fresh blood! We need to raise salaries in the bureaucracy, grant some time off to our bureaucrats to make sure they can attend, and try to hire talent away from other nations. We'll forge productive trade relations by this, you'll see!`),
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) {
p.Stats.Kobolds.Value += 80
p.Stats.SectorScavengingIncome.Value += 0.01
p.Stats.GovBureaucracyExpense.Value += 0.03
return cardsim.MsgStr("Bureaucrats are considered pillars of society."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 80
p.Stats.SectorScavengingIncome.Value -= 0.01
p.Stats.GovBureaucracyExpense.Value -= 0.03
return nil
},
CanDo: YesWeCan,
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your Minister of Finance pulls you aside. "This is a good opportunity to head-hunt. Bureaucrats from many nations will be attending. There's got to be some who'll work for less than the ones we've got. There are some terribly threatened or impoverished communities among kobolds.`),
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) {
p.Stats.Kobolds.Value += 20
p.Stats.GovBureaucracyExpense.Value -= 0.01
return cardsim.MsgStr("Immigrant bureaucrats complain about being under-appreciated."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 20
p.Stats.GovBureaucracyExpense.Value += 0.01
return nil
},
CanDo: func(p *Player) bool { return p.Stats.GovBureaucracyExpense.Value >= 0.02 },
// CanDo: func(p *Player) bool {
// if p.Stats.GovBureaucracyExpense.Value >= 0.02 {
// return true
// }
// return false
// },
// Original implementation preserved in the hopes that I'll learn this stuff. This is equivalent to the shorter code above. I'll probably remove this comment eventually. Sincerely, Rakeela.
},
&BasicPolicy{
UnenactedDesc: cardsim.MsgStr(`Your Minister of Finance greets you exuberantly. "We've trimmed the wages of the bureaucracy beautifully, but maybe we can scout some outright volunteers. Some nations are absolute disasters, after all.`),
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) {
p.Stats.Kobolds.Value += 10
p.Stats.GovBureaucracyExpense.Value -= 0.02
return cardsim.MsgStr("The local bureaucracy is staffed by volunteer labor."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value -= 10
p.Stats.GovBureaucracyExpense.Value += 0.02
return nil
},
CanDo: func(p *Player) bool { return p.Stats.GovBureaucracyExpense.Value < 0.02 },
},
&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."`),
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) {
p.Stats.Kobolds.Value -= 80
p.Stats.GovBureaucracyExpense.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
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value += 80
p.Stats.GovBureaucracyExpense.Value += 0.04
return nil
},
CanDo: YesWeCan,
},
&VerbosePolicy{
Default: &BasicPolicy{
UnenactedDesc: cardsim.MsgStr("Some kobolds will attend the festival on their own, and we may face desertions for our lack of interest."),
EnactedDesc: cardsim.MsgStr("Some kobolds will attend the festival on their own. No change is expected."),
Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value -= 20
return cardsim.MsgStr("A festival of bureaucracy lured away a few kobolds to other nations."), nil
},
Undo: func(p *Player) error {
p.Stats.Kobolds.Value += 20
return nil
},
CanDo: YesWeCan,
},
Variants: []Policy{
nil,
&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{
OptionTextFunc: func(p *Player) (cardsim.Message, error) {
if p.Stats.GovBureaucracyExpense.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."), nil
},
EnactFunc: func(p *Player) (cardsim.Message, error) {
if p.Stats.GovBureaucracyExpense.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 brought in immigrants wondering at the nation's lack thereof."), ErrKeepMessage
},
},
nil, // remember, if using a BasicPolicy, this uses EnactedDesc
},
},
},
},
} // end of card list
func initDeck(d *cardsim.Deck[*KoboldMine]) {
for _, c := range cards {
d.Insert(cardsim.BottomOfDeck, c)
}
d.Shuffle()
}