blob: 38749c7ee9d255f95f24df0e17381e2ebfb1b46e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
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()
}
|