-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstates.inc.php
361 lines (330 loc) · 12.6 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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php
// vim: tw=120:
/**
*------
* BGA framework: © Gregory Isabelli <[email protected]> & Emmanuel Colin <[email protected]>
* SolarStorm implementation : © Christophe Badoit <[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.
* -----
*/
if (!defined('ST_PLAYER_TURN')) {
define('ST_PLAYER_START_OF_TURN', 2);
define('ST_PLAYER_TURN', 3);
define('ST_PLAYER_MOVE', 4);
define('ST_PLAYER_SCAVENGE', 5);
define('ST_PLAYER_SCAVENGE_PICK_CARDS', 6);
define('ST_PLAYER_SHARE', 7);
define('ST_PLAYER_REPAIR', 8);
define('ST_PLAYER_DIVERT', 9);
define('ST_PLAYER_ROOM_CREW_QUARTER', 10);
define('ST_PLAYER_ROOM_CARGO_HOLD', 11);
define('ST_PLAYER_ROOM_MESS_HALL', 12);
define('ST_PLAYER_ROOM_ENGINE_ROOM', 13);
define('ST_PLAYER_ROOM_REPAIR_CENTRE', 14);
define('ST_PLAYER_ROOM_ARMOURY', 15);
define('ST_PLAYER_ROOM_BRIDGE', 16);
define('ST_PLAYER_ACTION_CANCEL', 19);
define('ST_PLAYER_ACTION_DONE', 20);
define('ST_PLAYER_PICK_RESOURCES_CARDS', 21);
define('ST_PLAYER_ASK_ACTION_TOKENS_PLAY', 22);
define('ST_PLAYER_END_TURN', 40);
define('ST_PLAYER_DISCARD_RESOURCES', 41);
define('ST_PLAYER_NEXT_PLAYER', 43);
define('ST_PLAYER_RESTART_TURN', 44);
define('ST_END_OF_GAME', 99);
}
$machinestates = [
// The initial state. Please do not modify.
1 => [
'name' => 'gameSetup',
'description' => '',
'type' => 'manager',
'action' => 'stGameSetup',
'transitions' => ['' => 2],
],
ST_PLAYER_START_OF_TURN => [
'name' => 'playerStartOfTurn',
'type' => 'game',
'action' => 'stStartOfTurn',
'transitions' => [
'transPlayerTurn' => ST_PLAYER_TURN,
],
],
ST_PLAYER_TURN => [
'name' => 'playerTurn',
'description' => clienttranslate('${actplayer} must choose an action'),
'descriptionmyturn' => clienttranslate('${you} must choose an action'),
'type' => 'activeplayer',
'args' => 'argPlayerTurn',
'possibleactions' => ['choose', 'useToken', 'restartTurn'],
'transitions' => [
'transPlayerMove' => ST_PLAYER_MOVE,
'transPlayerScavenge' => ST_PLAYER_SCAVENGE,
'transPlayerShare' => ST_PLAYER_SHARE,
'transPlayerRepair' => ST_PLAYER_REPAIR,
'transPlayerDivert' => ST_PLAYER_DIVERT,
'transPlayerRoomCrewQuarter' => ST_PLAYER_ROOM_CREW_QUARTER,
'transPlayerRoomCargoHold' => ST_PLAYER_ROOM_CARGO_HOLD,
'transPlayerRoomMessHall' => ST_PLAYER_ROOM_MESS_HALL,
'transPlayerRoomEngineRoom' => ST_PLAYER_ROOM_ENGINE_ROOM,
'transPlayerRoomRepairCentre' => ST_PLAYER_ROOM_REPAIR_CENTRE,
'transPlayerRoomArmoury' => ST_PLAYER_ROOM_ARMOURY,
'transPlayerRoomBridge' => ST_PLAYER_ROOM_BRIDGE,
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transEndOfGame' => ST_END_OF_GAME,
'transPlayerRestartTurn' => ST_PLAYER_RESTART_TURN,
],
],
ST_PLAYER_MOVE => [
'name' => 'playerMove',
'description' => clienttranslate('${actplayer} must choose a destination'),
'descriptionmyturn' => clienttranslate('${you} must choose a destination'),
'type' => 'activeplayer',
'args' => 'argPlayerMove',
'possibleactions' => ['move', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_SCAVENGE => [
'name' => 'playerScavenge',
'description' => clienttranslate('Scavenge: ${actplayer} must roll the dice'),
'descriptionmyturn' => clienttranslate('Scavenge: ${you} must roll the dice'),
'type' => 'activeplayer',
'possibleactions' => ['rollDice', 'cancel'],
'transitions' => [
'transActionScavengePickCards' => ST_PLAYER_SCAVENGE_PICK_CARDS,
'transActionScavengePickNothing' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_SCAVENGE_PICK_CARDS => [
'name' => 'playerScavengePickCards',
'description' => clienttranslate('Scavenge: ${actplayer} must pick resources cards'),
'descriptionmyturn' => clienttranslate('Scavenge: ${you} must pick resources cards'),
'type' => 'activeplayer',
'args' => 'argPlayerScavengePickCards',
'possibleactions' => ['pickResource'],
'transitions' => [
'transActionScavengePickCards' => ST_PLAYER_SCAVENGE_PICK_CARDS,
'transActionScavengeEnd' => ST_PLAYER_ACTION_DONE,
'transEndOfGame' => ST_END_OF_GAME,
],
],
ST_PLAYER_SHARE => [
'name' => 'playerShare',
'description' => clienttranslate('${actplayer} must share a resource'),
'descriptionmyturn' => clienttranslate('${you} must share a resource'),
'type' => 'activeplayer',
'action' => 'stActionShare',
'possibleactions' => ['pickResourceFromAnotherPlayer', 'giveResourceToAnotherPlayer', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_REPAIR => [
'name' => 'playerRepair',
'description' => clienttranslate('Repair: ${actplayer} must select a resource'),
'descriptionmyturn' => clienttranslate('Repair: ${you} must select a resource'),
'type' => 'activeplayer',
'args' => 'argPlayerRepair',
'possibleactions' => ['selectResourceForRepair', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_DIVERT => [
'name' => 'playerDivert',
'description' => clienttranslate('Divert power: ${actplayer} must select resources'),
'descriptionmyturn' => clienttranslate('Divert power: ${you} must select resources'),
'type' => 'activeplayer',
'possibleactions' => ['selectResourcesForDivert', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_ROOM_CREW_QUARTER => [
'name' => 'playerRoomCrewQuarter',
'description' => clienttranslate('Crew Quarters: ${actplayer} must select a meeple to move'),
'descriptionmyturn' => clienttranslate('Crew Quarters: ${you} must select a meeple to move'),
'type' => 'activeplayer',
'possibleactions' => ['moveMeepleToRoom', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_ROOM_CARGO_HOLD => [
'name' => 'playerRoomCargoHold',
'description' => clienttranslate('Cargo Hold: ${actplayer} must reorder the next resource cards'),
'descriptionmyturn' => clienttranslate('Cargo Hold: ${you} must reorder the next resource cards'),
'type' => 'activeplayer',
'action' => 'stPlayerRoomCargoHold',
'args' => 'argPlayerRoomCargoHold',
'possibleactions' => ['putBackResourceCardsInDeck'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
],
],
ST_PLAYER_ROOM_MESS_HALL => [
'name' => 'playerRoomMessHall',
'description' => clienttranslate('Mess Hall: ${actplayer} must take, give or swap a card with another player'),
'descriptionmyturn' => clienttranslate('Mess Hall: ${you} must take, give or swap a card with another player'),
'type' => 'activeplayer',
'possibleactions' => [
'pickResourceFromAnotherPlayer',
'giveResourceToAnotherPlayer',
'swapResourceWithAnotherPlayer',
'cancel',
],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_ROOM_ENGINE_ROOM => [
'name' => 'playerRoomEngineRoom',
'description' => clienttranslate('Engine room: ${actplayer} must swap a resource card from the discard pile'),
'descriptionmyturn' => clienttranslate('Engine room: ${you} must swap a resource card from the discard pile'),
'type' => 'activeplayer',
'args' => 'argPlayerRoomEngineRoom',
'possibleactions' => ['swapResourceFromDiscard', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_ROOM_REPAIR_CENTRE => [
'name' => 'playerRoomRepairCentre',
'description' => clienttranslate('Repair centre: ${actplayer} must repair any room'),
'descriptionmyturn' => clienttranslate('Repair centre: ${you} must select a room to repair'),
'type' => 'activeplayer',
'possibleactions' => ['selectResourceForRepair', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
],
],
ST_PLAYER_ROOM_ARMOURY => [
'name' => 'playerRoomArmoury',
'description' => clienttranslate('Armoury: ${actplayer} must place protection tokens'),
'descriptionmyturn' => clienttranslate('Armoury: ${you} must place protection tokens'),
'type' => 'activeplayer',
'args' => 'argPlayerRoomArmoury',
'possibleactions' => ['putProtectionTokens', 'cancel'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transActionCancel' => ST_PLAYER_ACTION_CANCEL,
'transPlayerRoomArmoury' => ST_PLAYER_ROOM_ARMOURY,
],
],
ST_PLAYER_ROOM_BRIDGE => [
'name' => 'playerRoomBridge',
'description' => clienttranslate('Bridge: ${actplayer} must reorder the next damage cards'),
'descriptionmyturn' => clienttranslate('Bridge: ${you} must reorder the next damage cards'),
'type' => 'activeplayer',
'action' => 'stPlayerRoomBridge',
'args' => 'argPlayerRoomBridge',
'possibleactions' => ['putBackDamageCardsInDeck'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
],
],
ST_PLAYER_ACTION_CANCEL => [
'name' => 'actionCancel',
'type' => 'game',
'action' => 'stActionCancel',
'transitions' => [
'transPlayerTurn' => ST_PLAYER_TURN,
],
],
ST_PLAYER_ACTION_DONE => [
'name' => 'actionDone',
'type' => 'game',
'action' => 'stActionDone',
'transitions' => [
'transPlayerTurn' => ST_PLAYER_TURN,
'transPlayerAskActionTokensPlay' => ST_PLAYER_ASK_ACTION_TOKENS_PLAY,
'transPlayerPickResourcesCards' => ST_PLAYER_PICK_RESOURCES_CARDS,
],
],
ST_PLAYER_PICK_RESOURCES_CARDS => [
'name' => 'pickResources',
'description' => clienttranslate('End of turn: ${actplayer} must pick resources cards'),
'descriptionmyturn' => clienttranslate('End of turn: ${you} must pick resources cards'),
'type' => 'activeplayer',
'args' => 'argPlayerPickResourcesCards',
'possibleactions' => ['pickResource', 'restartTurn'],
'transitions' => [
'transPlayerEndTurn' => ST_PLAYER_END_TURN,
'transPlayerPickResourcesCards' => ST_PLAYER_PICK_RESOURCES_CARDS,
'transEndOfGame' => ST_END_OF_GAME,
'transPlayerRestartTurn' => ST_PLAYER_RESTART_TURN,
],
],
ST_PLAYER_ASK_ACTION_TOKENS_PLAY => [
'name' => 'playerAskActionTokensPlay',
'description' => clienttranslate('End of turn: ${actplayer} can use their action tokens'),
'descriptionmyturn' => clienttranslate('End of turn: ${you} can use you action tokens'),
'type' => 'activeplayer',
'possibleactions' => ['useToken', 'dontUseToken', 'restartTurn'],
'transitions' => [
'transActionDone' => ST_PLAYER_ACTION_DONE,
'transPlayerRestartTurn' => ST_PLAYER_RESTART_TURN,
],
],
ST_PLAYER_END_TURN => [
'name' => 'endTurn',
'type' => 'game',
'action' => 'stEndTurn',
'updateGameProgression' => true,
'transitions' => [
'transPlayerDiscardResources' => ST_PLAYER_DISCARD_RESOURCES,
'transPlayerNextPlayer' => ST_PLAYER_NEXT_PLAYER,
'transEndOfGame' => ST_END_OF_GAME,
],
],
ST_PLAYER_DISCARD_RESOURCES => [
'name' => 'playerDiscardResources',
'description' => clienttranslate('End of turn: ${actplayer} must discard resources cards (max 6)'),
'descriptionmyturn' => clienttranslate('End of turn: ${you} must discard resources cards (max 6)'),
'type' => 'activeplayer',
'args' => 'argPlayerDiscardResources',
'possibleactions' => ['discardResources', 'restartTurn'],
'transitions' => [
'transPlayerNextPlayer' => ST_PLAYER_NEXT_PLAYER,
'transPlayerRestartTurn' => ST_PLAYER_RESTART_TURN,
],
],
ST_PLAYER_NEXT_PLAYER => [
'name' => 'playerNextPlayer',
'type' => 'game',
'action' => 'stNextPlayer',
'transitions' => [
'transPlayerStartOfTurn' => ST_PLAYER_START_OF_TURN
],
],
ST_PLAYER_RESTART_TURN => [
'name' => 'playerRestartTurn',
'type' => 'game',
'action' => 'stPlayerRestartTurn',
'transitions' => [
'transPlayerStartOfTurn' => ST_PLAYER_START_OF_TURN
],
],
// Final state.
// Please do not modify (and do not overload action/args methods).
99 => [
'name' => 'gameEnd',
'description' => clienttranslate('End of game'),
'type' => 'manager',
'action' => 'stGameEnd',
'args' => 'argGameEnd',
],
];