diff --git a/koboldsim/cardtypes.go b/koboldsim/cardtypes.go index 5d4c3c3..e8485b9 100644 --- a/koboldsim/cardtypes.go +++ b/koboldsim/cardtypes.go @@ -398,6 +398,34 @@ func (f *FuncPolicy) Is(p Policy) bool { 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. func ShuffleIntoBottomHalf(c Card, p *Player, _ CardOption) error { p.Deck.InsertRandomBottom(0.5, c)