package engine type BaseAction struct { User *Player BaseSource IsCard } func (b *BaseAction) Actor() *Player { return b.User } func (b *BaseAction) Source() IsCard { return b.BaseSource } func (b *BaseAction) Then(g *Game) { } type Action interface { Actor() *Player Source() IsCard Then(g *Game) } func Interactions(a ...Action) map[InteractionID]Action { m := make(map[InteractionID]Action, len(a)) for i, ac := range a { m[InteractionID(i)] = ac } return m } type DamageDecision bool var ( Aura DamageDecision = true Life DamageDecision = false ) type DesignateDamage struct { Attacker *Player Defender *Player SourceCard *Card } func (d *DesignateDamage) Then(g *Game) { } type PlayCard struct { *BaseAction } func (u *PlayCard) Then(g *Game) { g.Actions = Interactions(&PlayCard{}, &UseVigor{}) } type PlayAllOutCard struct { *BaseAction } func (p *PlayAllOutCard) Then(g *Game) { g.Actions = Interactions(&EndTurn{}) } type ShuffleDeck struct { *BaseAction } func (s *ShuffleDeck) Then(g *Game) { g.Actions = Interactions(&DrawCard{}) } type DrawCard struct { *BaseAction } func (d *DrawCard) Then(g *Game) { g.Actions = Interactions(&PlayCard{}, &PlayAllOutCard{}, &UseVigor{}) } type UseVigor struct { *BaseAction } func (u *UseVigor) Then(g *Game) { g.Actions = Interactions(&PlayCard{}, &UseVigor{}) } type EndTurn struct { *BaseAction } func (e *EndTurn) Then(g *Game) { g.NextTurn() }