-
Notifications
You must be signed in to change notification settings - Fork 2
/
states.inc.php
322 lines (289 loc) · 12.9 KB
/
states.inc.php
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<?php
/**
*------
* BGA framework: © Gregory Isabelli <[email protected]> & Emmanuel Colin <[email protected]>
* Innovation implementation : © Jean Portemer <[email protected]>
*
* This code has been produced on the BGA studio platform for use on http://boardgamearena.com.
* See http://en.boardgamearena.com/#!doc/Studio for more information.
* -----
*
* states.inc.php
*
* Innovation game states description
*
*/
/*
Game state machine is a tool used to facilitate game developpement by doing common stuff that can be set up
in a very easy way from this configuration file.
Please check the BGA Studio presentation about game state to understand this, and associated documentation.
Summary:
States types:
_ activeplayer: in this type of state, we expect some action from the active player.
_ multipleactiveplayer: in this type of state, we expect some action from multiple players (the active players)
_ game: this is an intermediary state where we don't expect any actions from players. Your game logic must decide what is the next game state.
_ manager: special type for initial and final state
Arguments of game states:
_ name: the name of the GameState, in order you can recognize it on your own code.
_ description: the description of the current game state is always displayed in the action status bar on
the top of the game. Most of the time this is useless for game state with "game" type.
_ descriptionmyturn: the description of the current game state when it's your turn.
_ type: defines the type of game states (activeplayer / multipleactiveplayer / game / manager)
_ action: name of the method to call when this game state become the current game state. Usually, the
action method is prefixed by "st" (ex: "stMyGameStateName").
_ possibleactions: array that specify possible player actions on this step. It allows you to use "checkAction"
method on both client side (Javacript: this.checkAction) and server side (PHP: self::checkAction).
_ transitions: the transitions are the possible paths to go from a game state to another. You must name
transitions in order to use transition names in "nextState" PHP method, and use IDs to
specify the next game state for each transition.
_ args: name of the method to call to retrieve arguments for this gamestate. Arguments are sent to the
client side to be used on "onEnteringState" or to set arguments in the gamestate description.
_ updateGameProgression: when specified, the game progression is updated (=> call to your getGameProgression
method).
*/
// !! It is not a good idea to modify this file when a game is running !!
// Game State Diagram: https://docs.google.com/drawings/d/1oKv79jHr1t2C8VjWJCkfSAN8FoGzT8rkM9hVooFV4S0
$machinestates = array(
// The initial state. Please do not modify.
1 => array(
"name" => "gameSetup",
"description" => clienttranslate('Game setup'),
"type" => "manager",
"action" => "stGameSetup",
"transitions" => array("" => 2)
),
// Note: ID=2 => your first state
2 => array(
"name" => "turn0",
"description" => clienttranslate('Some players still have to choose a card to meld'),
"descriptionmyturn" => clienttranslate('${You} must choose a card to meld'),
"type" => "multipleactiveplayer",
"action" => "stTurn0",
"args" => "argTurn0",
"possibleactions" => array("initialMeld", "updateInitialMeld"),
"transitions" => array("" => 3)
),
3 => array(
"name" => "whoBegins",
"description" => clienttranslate('Each player meld his card...'),
"type" => "game",
"action" => "stWhoBegins",
"updateGameProgression" => true,
"transitions" => array("" => 4)
),
4 => array(
"name" => "playerTurn",
"description" => clienttranslate('${actplayer} must take ${qualified_action}'),
"descriptionmyturn" => clienttranslate('${You} must take ${qualified_action}:'),
"type" => "activeplayer",
"possibleactions" => array("draw", "meld", "dogma", "endorse", "achieve"),
"args" => "argPlayerTurn",
"transitions" => array(
"interPlayerTurn" => 5,
"dogmaEffect" => 6,
"preSelectionMove" => 12, // The search icons on Cities cards can trigger this transition
// TODO(LATER): Remove this transition since it now comes from the new digArtifact state.
"relicPlayerTurn" => 16,
"digArtifact" => 17,
"justBeforeGameEnd" => 98,
),
),
5 => array(
"name" => "interPlayerTurn",
"description" => clienttranslate('Finalising the player action...'),
"type" => "game",
"action" => "stInterPlayerTurn",
"updateGameProgression" => true,
"transitions" => array(
"playerTurn" => 4,
"artifactPlayerTurn" => 15,
"justBeforeGameEnd" => 98
)
),
6 => array(
"name" => "dogmaEffect",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect}...'),
"type" => "game",
"action" => "stDogmaEffect",
"args" => "argDogmaEffect",
"transitions" => array("playerInvolvedTurn" => 8, "interDogmaEffect" => 7)
),
7 => array(
"name" => "interDogmaEffect",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect}...'),
"type" => "game",
"action" => "stInterDogmaEffect",
"args" => "argInterDogmaEffect",
"updateGameProgression" => true,
"transitions" => array(
"interPlayerTurn" => 5,
"dogmaEffect" => 6,
"playerInvolvedTurn" => 8, // Used by mechanism which executes nested effects
"justBeforeGameEnd" => 98)
),
8 => array(
"name" => "playerInvolvedTurn",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect} on ${player}...'),
"type" => "game",
"action" => "stPlayerInvolvedTurn",
"args" => "argPlayerInvolvedTurn",
"transitions" => array(
"interPlayerInvolvedTurn" => 9,
"interactionStep" => 10,
"justBeforeGameEnd" => 98
)
),
9 => array(
"name" => "interPlayerInvolvedTurn",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect} on ${player}...'),
"type" => "game",
"action" => "stInterPlayerInvolvedTurn",
"args" => "argInterPlayerInvolvedTurn",
"updateGameProgression" => true,
"transitions" => array(
"dogmaEffect" => 6,
"interDogmaEffect" => 7,
"playerInvolvedTurn" => 8,
"justBeforeGameEnd" => 98,
)
),
10 => array(
"name" => "interactionStep",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect} on ${player}...'),
"type" => "game",
"action" => "stInteractionStep",
"args" => "argInteractionStep",
"transitions" => array("preSelectionMove" => 12, "interPlayerInvolvedTurn" => 9, "interactionStep" => 10, "justBeforeGameEnd" => 98)
),
11 => array(
"name" => "interInteractionStep",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect} on ${player}...'),
"type" => "game",
"action" => "stInterInteractionStep",
"args" => "argInterInteractionStep",
"updateGameProgression" => true,
"transitions" => array(
"interPlayerInvolvedTurn" => 9,
"interactionStep" => 10,
"digArtifact" => 17, // The search icons on Cities cards can trigger this transition
"justBeforeGameEnd" => 98,
),
),
12 => array(
"name" => "preSelectionMove",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect} on ${player}...'),
"type" => "game",
"action" => "stPreSelectionMove",
"args" => "argPreSelectionMove",
"transitions" => array(
"interInteractionStep" => 11,
"selectionMove" => 13,
"interSelectionMove" => 14, // Automatic card selection when there's only one selectable card
)
),
13 => array(
"name" => "selectionMove",
"description" => clienttranslate('${card_name}: ${message_for_others}'), // The content is generated in argSelectionMove
"descriptionmyturn" => clienttranslate('${card_name}: ${message_for_player}') . ' ', // The content is generated in argSelectionMove
"type" => "activeplayer",
"possibleactions" => array("choose"),
"args" => "argSelectionMove",
"transitions" => array("interSelectionMove" => 14, "interInteractionStep" => 11 /* for zombie only*/, "justBeforeGameEnd" => 98)
),
14 => array(
"name" => "interSelectionMove",
"description" => clienttranslate('Resolving the ${card_name} ${qualified_effect} on ${player}...'),
"type" => "game",
"action" => "stInterSelectionMove",
"args" => "argInterSelectionMove",
"updateGameProgression" => true,
"transitions" => array(
"preSelectionMove" => 12,
"interInteractionStep" => 11,
"justBeforeGameEnd" => 98
)
),
15 => array(
"name" => "artifactPlayerTurn",
"description" => clienttranslate('${actplayer} must choose what to do with his Artifact on display'),
"descriptionmyturn" => clienttranslate('${You} must choose what to do with your Artifact on display:'),
"args" => "argPlayerArtifactTurn",
"type" => "activeplayer",
"possibleactions" => array("dogmaArtifactOnDisplay", "returnArtifactOnDisplay", "passArtifactOnDisplay"),
"transitions" => array("playerTurn" => 4, "dogmaEffect" => 6, "justBeforeGameEnd" => 98)
),
16 => array(
"name" => "relicPlayerTurn",
"description" => clienttranslate('${actplayer} must choose whether to seize ${relic_name}'),
"descriptionmyturn" => clienttranslate('${You} must choose whether to seize ${relic_name}:'),
"args" => "argRelicPlayerTurn",
"type" => "activeplayer",
"possibleactions" => array("seizeRelicToAchievements", "seizeRelicToHand", "passSeizeRelic"),
"transitions" => array("promoteCard" => 18, "justBeforeGameEnd" => 98)
),
17 => array(
"name" => "digArtifact",
"description" => clienttranslate('Finalising the player action...'),
"type" => "game",
"action" => "stDigArtifact",
"transitions" => array(
"relicPlayerTurn" => 16,
"promoteCard" => 18,
"justBeforeGameEnd" => 98,
),
),
18 => array(
"name" => "promoteCard",
"description" => clienttranslate('Finalising the player action...'),
"type" => "game",
"action" => "stPromoteCard",
"transitions" => array(
"interPlayerTurn" => 5,
"promoteCardPlayerTurn" => 19,
"justBeforeGameEnd" => 98,
),
),
19 => array(
"name" => "promoteCardPlayerTurn",
"description" => clienttranslate('${actplayer} may choose a card to promote from his forecast'),
"descriptionmyturn" => clienttranslate('${You} may choose a card to promote from your forecast'),
"args" => "argPromoteCardPlayerTurn",
"type" => "activeplayer",
"possibleactions" => ["passPromoteCard", "promoteCard", "promoteCardBack"],
"transitions" => [
"interPlayerTurn" => 5,
"promoteDogmaPlayerTurn" => 20,
"justBeforeGameEnd" => 98,
],
),
20 => array(
"name" => "dogmaPromotedPlayerTurn",
"description" => clienttranslate('${actplayer} may choose to dogma the promoted card'),
"descriptionmyturn" => clienttranslate('${You} may choose to dogma the promoted card'),
"args" => "argDogmaPromotedCardPlayerTurn",
"type" => "activeplayer",
"possibleactions" => ["passDogmaPromotedCard", "dogmaPromotedCard"],
"transitions" => [
"interPlayerTurn" => 5,
"dogmaEffect" => 6,
"justBeforeGameEnd" => 98,
],
),
98 => array(
"name" => "justBeforeGameEnd",
"description" => clienttranslate('Finishing the game...'),
"type" => "game",
"action" => "stJustBeforeGameEnd",
"updateGameProgression" => true,
"transitions" => array("" => 99)
),
// Final state.
// Please do not modify.
99 => array(
"name" => "gameEnd",
"description" => clienttranslate('End of game'),
"type" => "manager",
"action" => "stGameEnd",
"args" => "argGameEnd"
)
);