Compare commits

..

2 Commits

2 changed files with 66 additions and 15 deletions

View File

@ -57,7 +57,7 @@ var cards = []Card{
}, },
}, },
&VerbosePolicy{ &VerbosePolicy{
BasicPolicy: &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.Kobolds.Value += 20
@ -67,23 +67,24 @@ var cards = []Card{
p.Stats.Kobolds.Value -= 20 p.Stats.Kobolds.Value -= 20
return nil return nil
}, },
CanDo: YesWeCan,
}, },
Content: []DescResult{ Variants: []Policy{
{ &BasicPolicy{
Desc: cardsim.MsgStr("Rejecting this issue will also reject the military's natalist stance."), UnenactedDesc: cardsim.MsgStr("Rejecting this issue will also reject the military's natalist stance."),
Result: cardsim.MsgStr("Militant natalism has been reduced by policy."), Do: OverrideMsg(cardsim.MsgStr("Militant natalism has been reduced by policy.")),
}, },
{ &BasicPolicy{
Desc: cardsim.MsgStr(`"Dig deeper" pressures in your nation may be excessive.`), UnenactedDesc: cardsim.MsgStr(`"Dig deeper" pressures in your nation may be excessive.`),
Result: cardsim.MsgStr("Some of the lower depths are being abandoned."), Do: OverrideMsg(cardsim.MsgStr("Some of the lower depths are being abandoned.")),
}, },
{ &BasicPolicy{
Desc: cardsim.MsgStr("Near-surface patrols may need to be increased."), UnenactedDesc: cardsim.MsgStr("Near-surface patrols may need to be increased."),
Result: cardsim.MsgStr("More and better-armed hunting outposts are being established."), Do: OverrideMsg(cardsim.MsgStr("More and better-armed hunting outposts are being established.")),
}, },
{ &BasicPolicy{
Desc: cardsim.MsgStr("This isn't about a disaster and can probably continue to be safely dismissed."), EnactedDesc: cardsim.MsgStr("This isn't about a disaster and can probably continue to be safely dismissed."),
Result: cardsim.MsgStr("Creche control doesn't shift that easily."), Do: OverrideMsg(cardsim.MsgStr("Creche control doesn't shift that easily.")),
}, },
}, },
}, },
@ -155,8 +156,9 @@ var cards = []Card{
}, },
}, },
&VerbosePolicy{ &VerbosePolicy{
BasicPolicy: &BasicPolicy{ Default: &BasicPolicy{
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."),
Do: func(p *Player) (cardsim.Message, error) { Do: func(p *Player) (cardsim.Message, error) {
p.Stats.Kobolds.Value -= 20 p.Stats.Kobolds.Value -= 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
@ -165,6 +167,27 @@ var cards = []Card{
p.Stats.Kobolds.Value += 20 p.Stats.Kobolds.Value += 20
return nil return nil
}, },
CanDo: YesWeCan,
},
Variants: []Policy{
nil,
&DisabledPolicy{cardsim.MsgStr("TODO(rakeela): write")},
&DisabledPolicy{cardsim.MsgStr("TODO(rakeela): write")},
&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
}, },
}, },
}, },

View File

@ -398,6 +398,34 @@ func (f *FuncPolicy) Is(p Policy) bool {
return ok && (f == fp) return ok && (f == fp)
} }
// A DisabledPolicy is never enabled.
type DisabledPolicy struct {
Msg cardsim.Message
}
func (d *DisabledPolicy) OptionText(p *Player) (cardsim.Message, error) {
return d.Msg, nil
}
func (d *DisabledPolicy) Enact(*Player) (cardsim.Message, error) {
return nil, ErrOptionNotEnabled
}
func (d *DisabledPolicy) Enabled(*Player) bool {
return false
}
func (d *DisabledPolicy) Unenact(*Player) error {
return ErrPolicyNotEnacted
}
func (d *DisabledPolicy) LastEnacted(int, Policy) {}
func (d *DisabledPolicy) Is(p Policy) bool {
dp, ok := p.(*DisabledPolicy)
return ok && (dp == d)
}
// ShuffleIntoBottomHalf is a common "what to do with the card after?" behavior. // ShuffleIntoBottomHalf is a common "what to do with the card after?" behavior.
func ShuffleIntoBottomHalf(c Card, p *Player, _ CardOption) error { func ShuffleIntoBottomHalf(c Card, p *Player, _ CardOption) error {
p.Deck.InsertRandomBottom(0.5, c) p.Deck.InsertRandomBottom(0.5, c)