-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathevents_game.go
81 lines (70 loc) · 2.94 KB
/
events_game.go
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
package main
// GamePlayersEvent contains list of players which were connected to a game.
type GamePlayersEvent struct {
YourPlayerIndex int `json:"yourPlayerIndex"`
Players []*Player `json:"players"`
}
// GameStateInfo contains info about card for each player, cards in deck, card on battleground.
type GameStateInfo struct {
YourHand []*Card `json:"yourHand"`
CanYouPickUp bool `json:"canYouPickUp"`
CanYouAttack bool `json:"canYouAttack"`
CanYouComplete bool `json:"canYouComplete"`
HandsSizes []int `json:"handsSizes"`
DeckSize int `json:"deckSize"`
DiscardPileSize int `json:"discardPileSize"`
TrumpCard *Card `json:"trumpCard"`
Battleground []*Card `json:"battleground"`
DefendingCards map[int]*Card `json:"defendingCards"`
CompletedPlayers map[int]bool `json:"completedPlayers"`
DefenderPickUp bool `json:"defenderPickUp"`
AttackerIndex int `json:"attackerIndex"`
DefenderIndex int `json:"defenderIndex"`
}
// GameDealEvent contains info about game after the deal. It includes list of cards for each player.
type GameDealEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
TrumpCardIsOwnedByPlayerIndex int `json:"trumpCardIsOwnedByPlayerIndex"`
}
// GameFirstAttackerEvent contains info who is the first attacker and why.
type GameFirstAttackerEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
ReasonCard *Card `json:"reasonCard"`
}
// GameStartedEvent contains state when game was started
type GameStartedEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
}
// GamePlayerLeftEvent contains index of player who left the game
type GamePlayerLeftEvent struct {
PlayerIndex int `json:"playerIndex"`
IsAfk bool `json:"isAfk"`
}
// GameAttackEvent contains info about attack with card
type GameAttackEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
AttackerIndex int `json:"attackerIndex"`
DefenderIndex int `json:"defenderIndex"`
Card *Card `json:"card"`
}
// GameDefendEvent contains info about defending card with other card
type GameDefendEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
DefenderIndex int `json:"defenderIndex"`
AttackingCard *Card `json:"attackingCard"`
DefendingCard *Card `json:"defendingCard"`
}
// GameStateEvent contains info about state only
type GameStateEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
}
// NewRoundEvent contains info new round
type NewRoundEvent struct {
GameStateInfo *GameStateInfo `json:"gameStateInfo"`
WasAttackSuccessful bool `json:"was_attack_successful"`
}
// GameEndEvent contains info about winner
type GameEndEvent struct {
HasLoser bool `json:"hasLoser"`
LoserIndex int `json:"loserIndex"`
}