Compare commits
10 Commits
refactor-p
...
f3fd0c582f
Author | SHA1 | Date | |
---|---|---|---|
f3fd0c582f | |||
de98cf8fb3 | |||
d66e17a279 | |||
caa5c2e60c | |||
159508b202 | |||
301d8ae161
|
|||
e0dad09045 | |||
ccd141ddc5 | |||
d2f89f5bd4 | |||
f7bed6c4b9
|
4
go.mod
4
go.mod
@ -2,4 +2,6 @@ module git.chromaticdragon.app/kistaro/KoboldSim
|
|||||||
|
|
||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require git.chromaticdragon.app/kistaro/CardSimEngine v0.1.3
|
require git.chromaticdragon.app/kistaro/CardSimEngine v0.3.0
|
||||||
|
|
||||||
|
require golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
|
||||||
|
8
go.sum
8
go.sum
@ -1,4 +1,4 @@
|
|||||||
git.chromaticdragon.app/kistaro/CardSimEngine v0.1.2 h1:+8KVFhSxXbQO7CPzmL89sJ+qjgU4J42Z5OinGuDMR0U=
|
git.chromaticdragon.app/kistaro/CardSimEngine v0.3.0 h1:PYpW6+XTod3oJHf7JyfCpHMCdGILrvyqSJPH/71FMRQ=
|
||||||
git.chromaticdragon.app/kistaro/CardSimEngine v0.1.2/go.mod h1:VFaOagdbtM6gH87ioHent8v76nDh9PddpymMqWdrLfI=
|
git.chromaticdragon.app/kistaro/CardSimEngine v0.3.0/go.mod h1:FYuoJHaK7lDI8Fwf4lZY2Y+8P9zavT4oLvSFUG6drw4=
|
||||||
git.chromaticdragon.app/kistaro/CardSimEngine v0.1.3 h1:rNaDDXnPVoMpavpx4vR9k30sl0nO0BnCe32nZbAF2IM=
|
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
|
||||||
git.chromaticdragon.app/kistaro/CardSimEngine v0.1.3/go.mod h1:VFaOagdbtM6gH87ioHent8v76nDh9PddpymMqWdrLfI=
|
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package koboldsim
|
package koboldsim
|
||||||
|
|
||||||
import "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
import (
|
||||||
|
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
||||||
|
)
|
||||||
|
|
||||||
var cards = []Card{
|
var cards = []Card{
|
||||||
&SwitchingCard{
|
&SwitchingCard{
|
||||||
@ -10,17 +12,19 @@ var cards = []Card{
|
|||||||
Policies: []Policy{
|
Policies: []Policy{
|
||||||
&BasicPolicy{
|
&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."`),
|
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."),
|
EnactedDesc: cardsim.MsgStr("[current policy] Your war chief is presently 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.BasePopulation += 100
|
||||||
p.Stats.SectorScavengingIncome.Value += 0.01
|
p.Stats.ScavengingIncome += 0.01
|
||||||
p.Stats.GovWarExpense.Value += 0.02
|
p.Stats.WarExpense += 0.02
|
||||||
|
p.Stats.FoodSupply += 0.01
|
||||||
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.BasePopulation -= 100
|
||||||
p.Stats.SectorScavengingIncome.Value -= 0.01
|
p.Stats.ScavengingIncome -= 0.01
|
||||||
p.Stats.GovWarExpense.Value -= 0.02
|
p.Stats.WarExpense -= 0.02
|
||||||
|
p.Stats.FoodSupply -= 0.01
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
@ -29,15 +33,17 @@ var cards = []Card{
|
|||||||
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."`),
|
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."),
|
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.BasePopulation += 40
|
||||||
p.Stats.SectorMiningIncome.Value += 0.02
|
p.Stats.MiningIncome += 0.02
|
||||||
p.Stats.GovBureaucracyExpense.Value += 0.01
|
p.Stats.BureaucracyExpense += 0.01
|
||||||
|
p.Stats.FoodSupply -= 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.BasePopulation -= 40
|
||||||
p.Stats.SectorMiningIncome.Value -= 0.02
|
p.Stats.MiningIncome -= 0.02
|
||||||
p.Stats.GovBureaucracyExpense.Value -= 0.01
|
p.Stats.BureaucracyExpense -= 0.01
|
||||||
|
p.Stats.FoodSupply += 0.01
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
@ -46,15 +52,19 @@ var cards = []Card{
|
|||||||
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."`),
|
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."),
|
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.BasePopulation -= 40
|
||||||
p.Stats.SectorScavengingIncome.Value -= 0.01
|
p.Stats.ScavengingIncome -= 0.01
|
||||||
p.Stats.GovWarExpense.Value -= 0.02
|
p.Stats.WarExpense -= 0.02
|
||||||
|
p.Stats.EducationExpense += 0.01
|
||||||
|
p.Stats.FoodSupply -= 0.01
|
||||||
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.BasePopulation += 40
|
||||||
p.Stats.SectorScavengingIncome.Value += 0.01
|
p.Stats.ScavengingIncome += 0.01
|
||||||
p.Stats.GovWarExpense.Value += 0.02
|
p.Stats.WarExpense += 0.02
|
||||||
|
p.Stats.EducationExpense -= 0.01
|
||||||
|
p.Stats.FoodSupply += 0.01
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
@ -63,11 +73,11 @@ var cards = []Card{
|
|||||||
Default: &BasicPolicy{
|
Default: &BasicPolicy{
|
||||||
UnenactedDesc: cardsim.MsgStr("This isn't about a disaster and can probably be safely dismissed."),
|
UnenactedDesc: cardsim.MsgStr("This isn't about a disaster and can probably be safely dismissed."),
|
||||||
Do: func(p *Player) (cardsim.Message, error) {
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
p.Stats.Kobolds.Value += 20
|
p.Stats.BasePopulation += 20
|
||||||
return cardsim.MsgStr("Creche control doesn't shift that easily."), nil
|
return cardsim.MsgStr("Creche control doesn't shift that easily."), nil
|
||||||
},
|
},
|
||||||
Undo: func(p *Player) error {
|
Undo: func(p *Player) error {
|
||||||
p.Stats.Kobolds.Value -= 20
|
p.Stats.BasePopulation -= 20
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
@ -102,62 +112,73 @@ var cards = []Card{
|
|||||||
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!`),
|
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."),
|
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.BasePopulation += 80
|
||||||
p.Stats.SectorScavengingIncome.Value += 0.01
|
p.Stats.ScavengingIncome += 0.01
|
||||||
p.Stats.GovBureaucracyExpense.Value += 0.03
|
p.Stats.BureaucracyExpense += 0.03
|
||||||
|
p.Stats.FoodSupply += 0.01
|
||||||
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.BasePopulation -= 80
|
||||||
p.Stats.SectorScavengingIncome.Value -= 0.01
|
p.Stats.ScavengingIncome -= 0.01
|
||||||
p.Stats.GovBureaucracyExpense.Value -= 0.03
|
p.Stats.BureaucracyExpense -= 0.03
|
||||||
|
p.Stats.FoodSupply -= 0.01
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
},
|
},
|
||||||
&BasicPolicy{
|
&BasicPolicy{
|
||||||
UnenactedDesc: cardsim.MsgStr(`Your Minister of Education 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.`),
|
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("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.BasePopulation += 20
|
||||||
p.Stats.GovBureaucracyExpense.Value -= 0.01
|
p.Stats.BureaucracyExpense -= 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.BasePopulation -= 20
|
||||||
p.Stats.GovBureaucracyExpense.Value += 0.01
|
p.Stats.BureaucracyExpense += 0.01
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: func(b *BasicPolicy, p *Player) bool {
|
||||||
// TODO(rakeela): This option should only be available if the fourth option isn't the status quo and bureaucratic expense is at least 0.02.
|
return p.Stats.BureaucracyExpense >= 0.02 && b.LastEnactedIdx != 3
|
||||||
|
},
|
||||||
|
// 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{
|
&BasicPolicy{
|
||||||
UnenactedDesc: cardsim.MsgStr(`Your Minister of Education 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.`),
|
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(`It's hard to find volunteer workers at the festival, but your nation is doing its best to equip the bureaucracy with exactly that.`),
|
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.BasePopulation += 10
|
||||||
p.Stats.GovBureaucracyExpense.Value -= 0.02
|
p.Stats.BureaucracyExpense -= 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.BasePopulation -= 10
|
||||||
p.Stats.GovBureaucracyExpense.Value += 0.02
|
p.Stats.BureaucracyExpense += 0.02
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: func(b *BasicPolicy, p *Player) bool {
|
||||||
// TODO(rakeela): This option should only be available if the fourth option isn't the status quo and bureaucratic expense is less than 0.02.
|
return p.Stats.BureaucracyExpense < 0.02 && b.LastEnactedIdx != 3
|
||||||
|
},
|
||||||
},
|
},
|
||||||
&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.BasePopulation -= 80
|
||||||
p.Stats.GovBureaucracyExpense.Value -= 0.04
|
p.Stats.BureaucracyExpense -= 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.BasePopulation += 80
|
||||||
p.Stats.GovBureaucracyExpense.Value += 0.04
|
p.Stats.BureaucracyExpense += 0.04
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
@ -167,28 +188,28 @@ var cards = []Card{
|
|||||||
UnenactedDesc: cardsim.MsgStr("Some kobolds will attend the festival on their own, and we may face desertions for our lack of interest."),
|
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."),
|
EnactedDesc: cardsim.MsgStr("Some kobolds will attend the festival on their own. No change is expected."),
|
||||||
Do: func(p *Player) (cardsim.Message, error) {
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
p.Stats.Kobolds.Value -= 20
|
p.Stats.BasePopulation -= 20
|
||||||
return cardsim.MsgStr("A festival of bureaucracy lured away a few kobolds to other nations."), nil
|
return cardsim.MsgStr("A festival of bureaucracy lured away a few kobolds to other nations."), nil
|
||||||
},
|
},
|
||||||
Undo: func(p *Player) error {
|
Undo: func(p *Player) error {
|
||||||
p.Stats.Kobolds.Value += 20
|
p.Stats.BasePopulation += 20
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
CanDo: YesWeCan,
|
CanDo: YesWeCan,
|
||||||
},
|
},
|
||||||
Variants: []Policy{
|
Variants: []Policy{
|
||||||
nil,
|
nil,
|
||||||
&DisabledPolicy{cardsim.MsgStr("TODO(rakeela): write")},
|
&DisabledPolicy{cardsim.MsgStr("Neglecting the event would be less popular and more inefficient than our current policy.")},
|
||||||
&DisabledPolicy{cardsim.MsgStr("TODO(rakeela): write")},
|
&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 >= -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 >= -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
|
||||||
@ -197,8 +218,225 @@ var cards = []Card{
|
|||||||
nil, // remember, if using a BasicPolicy, this uses EnactedDesc
|
nil, // remember, if using a BasicPolicy, this uses EnactedDesc
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
}, //End of "International Festival of Bureaucracy" policies
|
||||||
},
|
}, //End of "International Festival of Bureaucracy" card
|
||||||
|
&SwitchingCard{
|
||||||
|
Name: cardsim.MsgStr("Two Kobolds in a Trenchcoat"),
|
||||||
|
Desc: cardsim.MsgStr("An inevitable concern of kobold nations is the matter of trade. Trade with other kobolds is straightforward, but overland caravans are unsafe. Trade with surfacers is vital... but achieving it is difficult owing to anti-kobold sentiment."),
|
||||||
|
After: ShuffleIntoBottomHalf,
|
||||||
|
Policies: []Policy{
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr(`Speaking for the conservative opinion, one prospective merchant says, "We need illusions. Our priority needs to be trading to acquire or studying to create artifacts of disguising. The high start-up costs are balanced by free movement in a surface society that frequently detests us."`),
|
||||||
|
EnactedDesc: cardsim.MsgStr("[current policy] Your merchants rely on magical disguises to avoid being caught as kobolds while doing business on the surface."),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
p.Stats.ManufacturingIncome += 0.03
|
||||||
|
p.Stats.LogisticsExpense += 0.04
|
||||||
|
p.Stats.MiningIncome += 0.01
|
||||||
|
p.Stats.AlchemyIncome += 0.01
|
||||||
|
p.Stats.GadgetryIncome += 0.01
|
||||||
|
p.Stats.ScavengingIncome += 0.01
|
||||||
|
p.Stats.FoodSupply += 0.01
|
||||||
|
return cardsim.MsgStr("Nobody ever meets a kobold merchant."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
p.Stats.ManufacturingIncome -= 0.03
|
||||||
|
p.Stats.LogisticsExpense -= 0.04
|
||||||
|
p.Stats.MiningIncome -= 0.01
|
||||||
|
p.Stats.AlchemyIncome -= 0.01
|
||||||
|
p.Stats.GadgetryIncome -= 0.01
|
||||||
|
p.Stats.ScavengingIncome -= 0.01
|
||||||
|
p.Stats.FoodSupply -= 0.01
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
CanDo: YesWeCan,
|
||||||
|
},
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr(`Brave but potentially headstrong, another prospective merchant has attended the meeting with the following plea. "We must take head-on the risk of improving the status of kobolds! Only by bravely attending the surface markets can we hope to achieve a true and lasting peace!`),
|
||||||
|
EnactedDesc: cardsim.MsgStr(`[currentpolicy] Your merchants represent the nation's peaceful ideals by visiting the surface openly despite occasional casaulties.`),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
p.Stats.BasePopulation -= 15
|
||||||
|
p.Stats.ManufacturingIncome += 0.03
|
||||||
|
p.Stats.LogisticsExpense += 0.01
|
||||||
|
p.Stats.EconPlanExpense += 0.04
|
||||||
|
p.Stats.MiningIncome += 0.01
|
||||||
|
p.Stats.AlchemyIncome += 0.02
|
||||||
|
p.Stats.GadgetryIncome += 0.02
|
||||||
|
p.Stats.HospitalityIncome += 0.01
|
||||||
|
p.Stats.PublishingIncome += 0.01
|
||||||
|
p.Stats.ForeignRelExpense += 0.01
|
||||||
|
p.Stats.WarExpense -= 0.01
|
||||||
|
p.Stats.ScavengingIncome -= 0.01
|
||||||
|
return cardsim.MsgStr("The economic planning office formally plans for attrition among its merchants."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
p.Stats.BasePopulation += 15
|
||||||
|
p.Stats.ManufacturingIncome -= 0.03
|
||||||
|
p.Stats.LogisticsExpense -= 0.01
|
||||||
|
p.Stats.EconPlanExpense -= 0.04
|
||||||
|
p.Stats.MiningIncome -= 0.01
|
||||||
|
p.Stats.AlchemyIncome -= 0.02
|
||||||
|
p.Stats.GadgetryIncome -= 0.02
|
||||||
|
p.Stats.HospitalityIncome -= 0.01
|
||||||
|
p.Stats.PublishingIncome -= 0.01
|
||||||
|
p.Stats.ForeignRelExpense -= 0.01
|
||||||
|
p.Stats.WarExpense += 0.01
|
||||||
|
p.Stats.ScavengingIncome += 0.01
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
CanDo: YesWeCan,
|
||||||
|
},
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr(`A shady scavenger has offered to change careers and become a merchant. Their proposal is, "Surfacers aren't all monolithic. If we talk to the ones who are more greedy than prejudiced, we don't need magic or idealism. We can get in contact with lots of people who'll buy lots of things from us, even things that might not have a market if we worked with 'good' merchants."`),
|
||||||
|
EnactedDesc: cardsim.MsgStr("[current policy] Your merchants work with the underworld of the surface, forging connections with the people who are ironically less likely to murder them."),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
p.Stats.BasePopulation -= 5
|
||||||
|
p.Stats.LogisticsExpense += 0.01
|
||||||
|
p.Stats.ScavengingIncome += 0.03
|
||||||
|
p.Stats.AlchemyIncome += 0.02
|
||||||
|
p.Stats.GadgetryIncome += 0.03
|
||||||
|
p.Stats.MiningIncome -= 0.01
|
||||||
|
p.Stats.ManufacturingIncome -= 0.01
|
||||||
|
return cardsim.MsgStr("Kobold merchants are instantly suspected of black market connections."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
p.Stats.BasePopulation += 5
|
||||||
|
p.Stats.LogisticsExpense -= 0.01
|
||||||
|
p.Stats.ScavengingIncome -= 0.03
|
||||||
|
p.Stats.AlchemyIncome -= 0.02
|
||||||
|
p.Stats.GadgetryIncome -= 0.03
|
||||||
|
p.Stats.MiningIncome += 0.01
|
||||||
|
p.Stats.ManufacturingIncome += 0.01
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
CanDo: YesWeCan,
|
||||||
|
},
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr(`A mining forebold registered for the right to attend this meeting, and says, "Surfacers can't be trusted in business and we shouldn't be supporting them with trade. We need underground roads to ease trade with other kobold nations. It's a massive investment in smoothing current tunnels and digging new ones, but think of the reward: a world of underground civilizations supporting each other."`),
|
||||||
|
EnactedDesc: cardsim.MsgStr(`[currentpolicy] Your merchants have been directed to focus on trade with other kobolds, and your miners are perpetually tunnelling towards other kobold nations in pursuit of the dream of a world of underground roads.`),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
p.Stats.MiningIncome += 0.05
|
||||||
|
p.Stats.ConstructionIncome += 0.01
|
||||||
|
p.Stats.LogisticsExpense += 0.06
|
||||||
|
p.Stats.FoodSupply -= 0.01
|
||||||
|
return cardsim.MsgStr("The vast network of caverns under the surface of the world is not a natural phenomenon."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
p.Stats.MiningIncome -= 0.05
|
||||||
|
p.Stats.ConstructionIncome -= 0.01
|
||||||
|
p.Stats.LogisticsExpense -= 0.06
|
||||||
|
p.Stats.FoodSupply += 0.01
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
CanDo: YesWeCan,
|
||||||
|
},
|
||||||
|
&VerbosePolicy{
|
||||||
|
Default: &BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr("Refusing an opportunity to expand trade is merely an opportunity cost. It won't make conditions any better or worse."),
|
||||||
|
EnactedDesc: cardsim.MsgStr("Refusing an opportunity to expand trade is merely an opportunity cost. It won't make conditions any better or worse."),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
return cardsim.MsgStr("Kobold merchants are known for their talent at standing on each others' shoulders."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
CanDo: YesWeCan,
|
||||||
|
},
|
||||||
|
Variants: []Policy{
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr("Rejecting the illusion-based merchantry will cost us a great deal in trade and surface food, but we can certainly do it."),
|
||||||
|
},
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr("Rejecting our idealistic approach to surface trade will save a few lives directly, but consider how much we need the food we buy from the surfacers."),
|
||||||
|
},
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr("The surfacers' governments would certainly prefer us to abandon our underworld connections in their cities. Do we care about that? We'd be giving up some excellent profits."),
|
||||||
|
},
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr("Some of the miners would be heartbroken by abandoning the dream of underground roads, but the tax savings would be significant."),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, //End of "Two Kobolds in a Trenchcoat" policies
|
||||||
|
}, //End of "Two Kobolds in a Trenchcoat" card
|
||||||
|
&SwitchingCard{
|
||||||
|
Name: cardsim.MsgStr("A Recipe for Stewed Kobold"),
|
||||||
|
Desc: cardsim.MsgStr("Nobody would ever say a kobold smells bad, but the constant burrowing, manufacturing, and metallurgy that is common to kobold life is still a recipe for tense muscles and filthy scales. A slate of proposals have come through to address this issue."),
|
||||||
|
After: ShuffleIntoBottomHalf,
|
||||||
|
Policies: []Policy{
|
||||||
|
&BasicPolicy{
|
||||||
|
UnenactedDesc: cardsim.MsgStr(`A calm and cheerful scribe says, "We should have public baths! We have more problems with flooding than drought in the deep underground, so we've got plenty of water. We just need to channel it. We could create a hub of social life while improving the health of everybody!"`),
|
||||||
|
EnactedDesc: cardsim.MsgStr("[current policy] Public bathing is a staple social policy in the mines and warrens of your nation."),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
p.Stats.ConstructionIncome += 0.01
|
||||||
|
p.Stats.QoLExpense += 0.01
|
||||||
|
p.Stats.HealthcareExpense += 0.01
|
||||||
|
p.Stats.ParksExpense += 0.04
|
||||||
|
return cardsim.MsgStr("The company of others makes cold water tolerable."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
p.Stats.ConstructionIncome -= 0.01
|
||||||
|
p.Stats.QoLExpense -= 0.01
|
||||||
|
p.Stats.HealthcareExpense -= 0.01
|
||||||
|
p.Stats.ParksExpense -= 0.04
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
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{
|
||||||
|
Default: &BasicPolicy{
|
||||||
|
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."),
|
||||||
|
Do: func(p *Player) (cardsim.Message, error) {
|
||||||
|
p.Stats.BasePopulation += 5
|
||||||
|
return cardsim.MsgStr("Opponents of public bathing won a recent political contest."), nil
|
||||||
|
},
|
||||||
|
Undo: func(p *Player) error {
|
||||||
|
p.Stats.BasePopulation -= 5
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
CanDo: YesWeCan,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}, //End of "A Recipe for Stewed Kobold" policies
|
||||||
|
}, //End of "A Recipe for Stewed Kobold" card
|
||||||
} // end of card list
|
} // end of card list
|
||||||
|
|
||||||
func initDeck(d *cardsim.Deck[*KoboldMine]) {
|
func initDeck(d *cardsim.Deck[*KoboldMine]) {
|
||||||
|
@ -48,6 +48,11 @@ type SwitchingCard struct {
|
|||||||
After func(Card, *Player, CardOption) error
|
After func(Card, *Player, CardOption) error
|
||||||
Policies []Policy
|
Policies []Policy
|
||||||
lastPolicy Policy
|
lastPolicy Policy
|
||||||
|
|
||||||
|
// ShowUnavailable controls whether options for which Enabled() = false
|
||||||
|
// should be presented to the player at all. Indexes for "last enacted"
|
||||||
|
// still refer to the original list, not the shortened one.
|
||||||
|
ShowUnavailable bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title implements Card.
|
// Title implements Card.
|
||||||
@ -71,7 +76,7 @@ func (s *SwitchingCard) EventText(*Player) (cardsim.Message, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Options implements Card.
|
// Options implements Card.
|
||||||
func (s *SwitchingCard) Options(*Player) ([]CardOption, error) {
|
func (s *SwitchingCard) Options(player *Player) ([]CardOption, error) {
|
||||||
lastIdx := -1
|
lastIdx := -1
|
||||||
for i, p := range s.Policies {
|
for i, p := range s.Policies {
|
||||||
if p.Is(s.lastPolicy) {
|
if p.Is(s.lastPolicy) {
|
||||||
@ -79,10 +84,12 @@ func (s *SwitchingCard) Options(*Player) ([]CardOption, error) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret := make([]CardOption, len(s.Policies))
|
ret := make([]CardOption, 0, len(s.Policies))
|
||||||
for i, p := range s.Policies {
|
for _, p := range s.Policies {
|
||||||
p.LastEnacted(lastIdx, s.lastPolicy)
|
p.LastEnacted(lastIdx, s.lastPolicy)
|
||||||
ret[i] = p
|
if s.ShowUnavailable || p.Enabled(player) {
|
||||||
|
ret = append(ret, p)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret, nil
|
return ret, nil
|
||||||
}
|
}
|
||||||
@ -114,25 +121,29 @@ type BasicPolicy struct {
|
|||||||
NothingChanged cardsim.Message
|
NothingChanged cardsim.Message
|
||||||
Do func(*Player) (cardsim.Message, error)
|
Do func(*Player) (cardsim.Message, error)
|
||||||
Undo func(*Player) error
|
Undo func(*Player) error
|
||||||
CanDo func(*Player) bool
|
CanDo func(*BasicPolicy, *Player) bool
|
||||||
|
|
||||||
currentlyEnacted bool
|
CurrentlyEnacted bool
|
||||||
|
LastEnactedPolicy Policy
|
||||||
|
LastEnactedIdx int
|
||||||
}
|
}
|
||||||
|
|
||||||
// YesWeCan returns true. It's the default value for BasicPolicy.CanDo / BasicPolicy.CanUndo.
|
// YesWeCan returns true. It's the default value for BasicPolicy.CanDo / BasicPolicy.CanUndo.
|
||||||
func YesWeCan(*Player) bool {
|
func YesWeCan(*BasicPolicy, *Player) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// LastEnacted notifies b about the last-enacted policy in its group. It updates
|
// LastEnacted notifies b about the last-enacted policy in its group. It updates
|
||||||
// b.currentlyEnacted accordingly.
|
// b.currentlyEnacted accordingly.
|
||||||
func (b *BasicPolicy) LastEnacted(_ int, p Policy) {
|
func (b *BasicPolicy) LastEnacted(i int, p Policy) {
|
||||||
b.currentlyEnacted = b.Is(p)
|
b.LastEnactedPolicy = p
|
||||||
|
b.LastEnactedIdx = i
|
||||||
|
b.CurrentlyEnacted = b.Is(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OptionText implements CardOption.
|
// OptionText implements CardOption.
|
||||||
func (b *BasicPolicy) OptionText(*Player) (cardsim.Message, error) {
|
func (b *BasicPolicy) OptionText(*Player) (cardsim.Message, error) {
|
||||||
if b.currentlyEnacted {
|
if b.CurrentlyEnacted {
|
||||||
if b.EnactedDesc == nil {
|
if b.EnactedDesc == nil {
|
||||||
return nil, ErrUnimplemented
|
return nil, ErrUnimplemented
|
||||||
}
|
}
|
||||||
@ -149,22 +160,19 @@ func (b *BasicPolicy) Enact(p *Player) (cardsim.Message, error) {
|
|||||||
if b.Do == nil {
|
if b.Do == nil {
|
||||||
return nil, ErrUnimplemented
|
return nil, ErrUnimplemented
|
||||||
}
|
}
|
||||||
if b.currentlyEnacted {
|
if b.CurrentlyEnacted {
|
||||||
p.ActionsRemaining++
|
p.ActionsRemaining++
|
||||||
if b.NothingChanged == nil {
|
if b.NothingChanged == nil {
|
||||||
b.NothingChanged = cardsim.MsgStr("You continue your current approach.")
|
b.NothingChanged = cardsim.MsgStr("You continue your current approach.")
|
||||||
}
|
}
|
||||||
return b.NothingChanged, nil
|
return b.NothingChanged, nil
|
||||||
}
|
}
|
||||||
if b.Enabled(p) {
|
return b.Do(p)
|
||||||
return b.Do(p)
|
|
||||||
}
|
|
||||||
return nil, ErrOptionNotEnabled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unenact implements Policy.
|
// Unenact implements Policy.
|
||||||
func (b *BasicPolicy) Unenact(p *Player) error {
|
func (b *BasicPolicy) Unenact(p *Player) error {
|
||||||
if !b.currentlyEnacted {
|
if !b.CurrentlyEnacted {
|
||||||
return ErrPolicyNotEnacted
|
return ErrPolicyNotEnacted
|
||||||
}
|
}
|
||||||
if b.Undo == nil {
|
if b.Undo == nil {
|
||||||
@ -175,13 +183,13 @@ func (b *BasicPolicy) Unenact(p *Player) error {
|
|||||||
|
|
||||||
// Enabled implements CardOption.
|
// Enabled implements CardOption.
|
||||||
func (b *BasicPolicy) Enabled(p *Player) bool {
|
func (b *BasicPolicy) Enabled(p *Player) bool {
|
||||||
if b.currentlyEnacted {
|
if b.CurrentlyEnacted {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if b.CanDo == nil {
|
if b.CanDo == nil {
|
||||||
panic(ErrUnimplemented)
|
panic(ErrUnimplemented)
|
||||||
}
|
}
|
||||||
return b.CanDo(p)
|
return b.CanDo(b, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BasicPolicy) Is(p Policy) bool {
|
func (b *BasicPolicy) Is(p Policy) bool {
|
||||||
@ -195,22 +203,22 @@ func (b *BasicPolicy) Is(p Policy) bool {
|
|||||||
// policy. Which policy is used is determined by what the previous policy for
|
// policy. Which policy is used is determined by what the previous policy for
|
||||||
// the card was (as reported via a call to LastEnacted):
|
// the card was (as reported via a call to LastEnacted):
|
||||||
//
|
//
|
||||||
// * If no policy has yet been enacted, use FirstTime.
|
// - If no policy has yet been enacted, use FirstTime.
|
||||||
// * If a policy has been enacted, use the Policy at the slot in Variants
|
// - If a policy has been enacted, use the Policy at the slot in Variants
|
||||||
// that corresponds to the slot (on the Card) of the currently-enacted policy.
|
// that corresponds to the slot (on the Card) of the currently-enacted policy.
|
||||||
// * If the policy retrieved in this way returns ErrUnimplemented, throw away
|
// - If the policy retrieved in this way returns ErrUnimplemented, throw away
|
||||||
// its response and use Default instead. For Enabled, which does not have
|
// its response and use Default instead. For Enabled, which does not have
|
||||||
// an error component to its return value, look for ErrUnimplemented as the
|
// an error component to its return value, look for ErrUnimplemented as the
|
||||||
// argument to a Panic call, instead.
|
// argument to a Panic call, instead.
|
||||||
// * If the policy retrieved in this way returns ErrKeepMessage when Enact
|
// - If the policy retrieved in this way returns ErrKeepMessage when Enact
|
||||||
// is called, it calls Default for the side effects but ignores its message,
|
// is called, it calls Default for the side effects but ignores its message,
|
||||||
// retaining the message from the original call. This is to avoid having to
|
// retaining the message from the original call. This is to avoid having to
|
||||||
// repeat the same Enact function except with different text each time.
|
// repeat the same Enact function except with different text each time.
|
||||||
// OptionText does this too, even though OptionText doesn't have side effects,
|
// OptionText does this too, even though OptionText doesn't have side effects,
|
||||||
// so the same helper function can create a "constant message" callback
|
// so the same helper function can create a "constant message" callback
|
||||||
// that works the same for both fields so someone implementing a card won't
|
// that works the same for both fields so someone implementing a card won't
|
||||||
// accidentally fail to enact their policy's effects by using the wrong one
|
// accidentally fail to enact their policy's effects by using the wrong one
|
||||||
// in the wrong slot.
|
// in the wrong slot.
|
||||||
type VerbosePolicy struct {
|
type VerbosePolicy struct {
|
||||||
Default Policy
|
Default Policy
|
||||||
FirstTime Policy
|
FirstTime Policy
|
||||||
@ -257,7 +265,7 @@ func (v *VerbosePolicy) fillDefaults() {
|
|||||||
for len(v.Variants) <= v.lastIdx {
|
for len(v.Variants) <= v.lastIdx {
|
||||||
v.Variants = append(v.Variants, v.Default)
|
v.Variants = append(v.Variants, v.Default)
|
||||||
}
|
}
|
||||||
if v.lastIdx > 0 && v.Variants[v.lastIdx] == nil {
|
if v.lastIdx >= 0 && v.Variants[v.lastIdx] == nil {
|
||||||
v.Variants[v.lastIdx] = v.Default
|
v.Variants[v.lastIdx] = v.Default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package koboldsim
|
package koboldsim
|
||||||
|
|
||||||
import "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
||||||
|
)
|
||||||
|
|
||||||
func InitPlayer() *Player {
|
func InitPlayer() *Player {
|
||||||
p := cardsim.InitPlayer(NewKoboldMine())
|
p := cardsim.InitPlayer(NewKoboldMine())
|
||||||
@ -13,6 +17,16 @@ func InitPlayer() *Player {
|
|||||||
Name: cardsim.MsgStr("All Stats"),
|
Name: cardsim.MsgStr("All Stats"),
|
||||||
Intro: cardsim.MsgStr("All available statistics."),
|
Intro: cardsim.MsgStr("All available statistics."),
|
||||||
},
|
},
|
||||||
|
&cardsim.BasicStatsPanel[*KoboldMine]{
|
||||||
|
Name: cardsim.MsgStr("Per Capita Economic"),
|
||||||
|
Intro: cardsim.MsgStr("Yield and Investment per Capita"),
|
||||||
|
Filter: cardsim.All(
|
||||||
|
cardsim.VisibleOrDebug[*KoboldMine],
|
||||||
|
func(p *Player, s cardsim.Stat) bool {
|
||||||
|
return strings.Contains(s.StatName(), "Productivity") || strings.Contains(s.StatName(), "Investment")
|
||||||
|
},
|
||||||
|
),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
p.Prompt = &cardsim.BasicStatsPanel[*KoboldMine]{
|
p.Prompt = &cardsim.BasicStatsPanel[*KoboldMine]{
|
||||||
Name: cardsim.MsgStr("The Kobold Mine"),
|
Name: cardsim.MsgStr("The Kobold Mine"),
|
||||||
@ -21,6 +35,7 @@ func InitPlayer() *Player {
|
|||||||
"Kobolds",
|
"Kobolds",
|
||||||
"Total Sector Income",
|
"Total Sector Income",
|
||||||
"Total Government Expense",
|
"Total Government Expense",
|
||||||
|
"Tax Rate",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
p.State = cardsim.GameActive
|
p.State = cardsim.GameActive
|
||||||
|
@ -1,52 +1,189 @@
|
|||||||
package koboldsim
|
package koboldsim
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"math"
|
||||||
|
|
||||||
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
|
||||||
)
|
)
|
||||||
|
|
||||||
// KoboldMine is the state of a kobold mine.
|
// KoboldMine is the state of a kobold mine.
|
||||||
type KoboldMine struct {
|
type KoboldMine struct {
|
||||||
Kobolds cardsim.Stored[int64]
|
BasePopulation float64 `cardsim:"stathidden"`
|
||||||
|
|
||||||
SectorMiningIncome cardsim.Stored[float64]
|
MiningIncome float64 `cardsim:"stat" cardsim_name:"Mining Productivity"`
|
||||||
SectorScavengingIncome cardsim.Stored[float64]
|
ScavengingIncome float64 `cardsim:"stat" cardsim_name:"Scavenging Productivity"`
|
||||||
|
AlchemyIncome float64 `cardsim:"stat" cardsim_name:"Alchemy Productivity"`
|
||||||
|
HospitalityIncome float64 `cardsim:"stat" cardsim_name:"Hospitality Productivity"`
|
||||||
|
AgricultureIncome float64 `cardsim:"stat" cardsim_name:"Agriculture Productivity"`
|
||||||
|
ManufacturingIncome float64 `cardsim:"stat" cardsim_name:"Manufacturing Productivity"`
|
||||||
|
PlanarIncome float64 `cardsim:"stat" cardsim_name:"Planar Productivity"`
|
||||||
|
PublishingIncome float64 `cardsim:"stat" cardsim_name:"Publishing Productivity"`
|
||||||
|
FinanceIncome float64 `cardsim:"stat" cardsim_name:"Finance Productivity"`
|
||||||
|
GadgetryIncome float64 `cardsim:"stat" cardsim_name:"Gadgetry Productivity"`
|
||||||
|
FishingIncome float64 `cardsim:"stat" cardsim_name:"Fishing Productivity"`
|
||||||
|
ConstructionIncome float64 `cardsim:"stat" cardsim_name:"Construction Productivity"`
|
||||||
|
|
||||||
GovBureaucracyExpense cardsim.Stored[float64]
|
PropagandaExpense float64 `cardsim:"stat" cardsim_name:"Propaganda Investment"`
|
||||||
GovWarExpense cardsim.Stored[float64]
|
BureaucracyExpense float64 `cardsim:"stat" cardsim_name:"Bureaucracy Investment"`
|
||||||
|
WarExpense float64 `cardsim:"stat" cardsim_name:"War Investment"`
|
||||||
|
QoLExpense float64 `cardsim:"stat" cardsim_name:"QoL Investment"`
|
||||||
|
LogisticsExpense float64 `cardsim:"stat" cardsim_name:"Logistics Investment"`
|
||||||
|
DragonSubsExpense float64 `cardsim:"stat" cardsim_name:"Dragon Subsidies Investment"`
|
||||||
|
ResearchSubsExpense float64 `cardsim:"stat" cardsim_name:"Research Subsidies Investment"`
|
||||||
|
EducationExpense float64 `cardsim:"stat" cardsim_name:"Education Investment"`
|
||||||
|
HealthcareExpense float64 `cardsim:"stat" cardsim_name:"Healthcare Investment"`
|
||||||
|
ForeignRelExpense float64 `cardsim:"stat" cardsim_name:"Foreign Relations Investment"`
|
||||||
|
PoliceExpense float64 `cardsim:"stat" cardsim_name:"Law Enforcement Investment"`
|
||||||
|
EconPlanExpense float64 `cardsim:"stat" cardsim_name:"Economic Planning Investment"`
|
||||||
|
ParksExpense float64 `cardsim:"stat" cardsim_name:"Parks and Aesthetics Investment"`
|
||||||
|
FaithExpense float64 `cardsim:"stat" cardsim_name:"Faith Investment"`
|
||||||
|
|
||||||
|
FoodSupply float64 `cardsim:"stathidden"`
|
||||||
|
|
||||||
|
// AnotherExpense float64 `cardsim:"hiddenround5"`
|
||||||
|
// A different way of adding stats that is slightly more empowering.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (k *KoboldMine) ProductivityFunc(s *cardsim.Stored[float64]) func() float64 {
|
func (k *KoboldMine) ProductivityFunc(s *float64) func() float64 {
|
||||||
return func() float64 {
|
return func() float64 {
|
||||||
return s.Value * float64(k.Kobolds.Value)
|
return *s * float64(k.BasePopulation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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()) * (k.MiningIncome + k.ScavengingIncome + k.AlchemyIncome + k.HospitalityIncome + k.AgricultureIncome + k.ManufacturingIncome + k.PlanarIncome + k.PublishingIncome + k.FinanceIncome + k.GadgetryIncome + k.FishingIncome + k.ConstructionIncome)
|
||||||
}
|
}
|
||||||
|
|
||||||
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()) * (k.PropagandaExpense + k.BureaucracyExpense + k.WarExpense + k.QoLExpense + k.LogisticsExpense + k.DragonSubsExpense + k.ResearchSubsExpense + k.EducationExpense + k.HealthcareExpense + k.ForeignRelExpense + k.PoliceExpense + k.EconPlanExpense + k.ParksExpense + k.FaithExpense)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) Taxation() float64 {
|
||||||
|
return (k.TotalGovExpense() / (k.TotalSectorIncome() + k.TotalGovExpense())) * 100
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) StatTaxRate() float64 {
|
||||||
|
return k.Taxation()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) Kobolds() int64 {
|
||||||
|
return int64(k.BasePopulation * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KoboldMine) DisplayedFoodSupply() float64 {
|
||||||
|
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{
|
||||||
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(
|
||||||
|
"Propaganda Expense",
|
||||||
|
k.ProductivityFunc(&k.PropagandaExpense),
|
||||||
|
),
|
||||||
|
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",
|
||||||
@ -56,33 +193,49 @@ func (k *KoboldMine) Stats() []cardsim.Stat {
|
|||||||
"Total Government Expense",
|
"Total Government Expense",
|
||||||
k.TotalGovExpense,
|
k.TotalGovExpense,
|
||||||
),
|
),
|
||||||
|
cardsim.StatFunc(
|
||||||
|
"Food Supply",
|
||||||
|
k.DisplayedFoodSupply,
|
||||||
|
),
|
||||||
|
cardsim.StatFunc(
|
||||||
|
"Kobolds",
|
||||||
|
k.Kobolds,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
stats = append(stats, funcs...)
|
stats = append(stats, funcs...)
|
||||||
cardsim.SortStats(stats)
|
// cardsim.SortStats(stats)
|
||||||
return stats
|
return stats
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewKoboldMine() *KoboldMine {
|
func NewKoboldMine() *KoboldMine {
|
||||||
return &KoboldMine{
|
return &KoboldMine{
|
||||||
Kobolds: cardsim.Stored[int64]{
|
BasePopulation: 1000,
|
||||||
Name: "Kobolds",
|
MiningIncome: 0.15,
|
||||||
Value: 1000,
|
ScavengingIncome: 0.1,
|
||||||
},
|
AlchemyIncome: 0.01,
|
||||||
SectorMiningIncome: cardsim.Stored[float64]{
|
HospitalityIncome: 0.0,
|
||||||
Name: "Sector Mining Income",
|
AgricultureIncome: 0.0,
|
||||||
Value: 0.15,
|
ManufacturingIncome: 0.10,
|
||||||
},
|
PlanarIncome: 0.00,
|
||||||
SectorScavengingIncome: cardsim.Stored[float64]{
|
PublishingIncome: 0.02,
|
||||||
Name: "Sector Scavenging Income",
|
FinanceIncome: 0.02,
|
||||||
Value: 0.1,
|
GadgetryIncome: 0.03,
|
||||||
},
|
FishingIncome: 0.0,
|
||||||
GovBureaucracyExpense: cardsim.Stored[float64]{
|
ConstructionIncome: 0.05,
|
||||||
Name: "Government Bureaucracy Expense",
|
PropagandaExpense: 0.01,
|
||||||
Value: 0.05,
|
BureaucracyExpense: 0.05,
|
||||||
},
|
WarExpense: 0.1,
|
||||||
GovWarExpense: cardsim.Stored[float64]{
|
QoLExpense: 0.01,
|
||||||
Name: "Government War Expense",
|
LogisticsExpense: 0.02,
|
||||||
Value: 0.1,
|
DragonSubsExpense: 0.0,
|
||||||
},
|
ResearchSubsExpense: 0.0,
|
||||||
|
EducationExpense: 0.01,
|
||||||
|
HealthcareExpense: 0.01,
|
||||||
|
ForeignRelExpense: 0.0,
|
||||||
|
PoliceExpense: 0.03,
|
||||||
|
EconPlanExpense: 0.02,
|
||||||
|
ParksExpense: 0.0,
|
||||||
|
FaithExpense: 0.03,
|
||||||
|
FoodSupply: 0.20,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user