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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
// @flow
export type ApiError = {
message: string,
details: ApiErrorDetail[]
};
export type ApiErrorDetail = {
message: string
};
export type ApiGameState = "LOBBY" | "PLAYING";
export type ApiLobby = {
id: number,
name: string,
owner: ApiPlayer,
players: ApiPlayer[],
settings: ApiSettings,
state: ApiGameState
};
export type ApiWonderSidePickMethod = "EACH_RANDOM" | "ALL_A" | "ALL_B" | "SAME_RANDOM_FOR_ALL";
export type ApiSettings = {
randomSeedForTests: number,
timeLimitInSeconds: number,
wonderSidePickMethod: ApiWonderSidePickMethod,
initialGold: number,
discardedCardGold: number,
defaultTradingCost: number,
pointsPer3Gold: number,
lostPointsPerDefeat: number,
wonPointsPerVictoryPerAge: Map<number, number>
};
export type ApiPlayer = {
username: string,
displayName: string,
index: number,
gameOwner: Boolean,
user: Boolean,
};
export type ApiTable = {
boards: ApiBoard[],
currentAge: number,
handRotationDirection: HandRotationDirection,
lastPlayedMoves: ApiPlayedMove[],
nbPlayers: number,
};
export type ApiBoard = {
playerIndex: number,
wonder: ApiWonder,
production: ApiProduction,
publicProduction: ApiProduction,
science: ApiScience,
military: ApiMilitary,
playedCards: ApiTableCard[],
gold: number,
};
export type ApiWonder = {
name: string,
initialResource: ApiResourceType,
stages: ApiWonderStage[],
image: string,
nbBuiltStages: Int,
buildability: ApiWonderBuildability,
}
export type ApiWonderStage = {
cardBack: ApiCardBack | null,
isBuilt: boolean,
requirements: ApiRequirements,
builtDuringLastMove: boolean,
}
export type HandRotationDirection = 'LEFT' | 'RIGHT';
export type ApiAction = 'PLAY' | 'PLAY_2' | 'PLAY_LAST' | 'PICK_NEIGHBOR_GUILD' | 'WAIT';
export type ApiCard = {
name: string,
color: Color,
requirements: ApiRequirements,
chainParent: String | null,
chainChildren: String[],
image: string,
back: ApiCardBack
};
export type ApiHandCard = ApiCard & {
playability: ApiPlayability,
};
export type ApiPlayability = {
playable: boolean,
chainable: boolean,
minPrice: number,
};
export type ApiTableCard = ApiCard & {
playedDuringLastMove: boolean,
};
export type ApiCardBack = {
image: string,
};
export type ApiPreparedCard = {
player: ApiPlayer,
cardBack: ApiCardBack,
};
export type ApiPlayerTurnInfo = {
playerIndex: number,
table: ApiTable,
currentAge: number,
action: ApiAction,
hand: ApiHandCard[],
neighbourGuildCards: ApiTableCard[],
message: string,
wonderBuildability: ApiWonderBuildability,
};
export type ApiWonderBuildability = {
buildable: boolean
}
export type ApiMoveType = "PLAY" | "PLAY_FREE" | "UPGRADE_WONDER" | "DISCARD" | "COPY_GUILD";
export type ApiProvider = "LEFT_NEIGHBOUR" | "RIGHT_NEIGHBOUR";
export type ApiResourceType = "WOOD" | "STONE" | "ORE" | "CLAY" | "GLASS" | "PAPYRUS" | "LOOM";
export type ApiProduction = {
fixedResources: ApiCountedResource[],
alternativeResources: ApiResourceType[][],
}
export type ApiCountedResource = {
type: ApiResourceType,
count: number,
}
export type ApiResources = {
quantities: Map<ApiResourceType, number>,
};
export type ApiBoughtResources = {
provider: ApiProvider,
resources: ApiResources,
};
export type ApiPlayerMove = {
type: ApiMoveType,
cardName: string,
boughtResources: ApiBoughtResources[],
};
export type ApiPlayedMove = {
playerIndex: number,
type: ApiMoveType,
card: ApiTableCard,
boughtResources: ApiBoughtResources[],
};
|