-
Notifications
You must be signed in to change notification settings - Fork 0
/
states.inc.php
300 lines (266 loc) · 10.5 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
<?php
/**
*------
* BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
* Perikles implementation : © <David Edelstein> <david.edelstein@gmail.com>
*
* 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
*
* Perikles game states description
*
*/
if (!defined('SETUP')) { // ensure this block is only invoked once, since it is included multiple times
// state constants
define("SETUP", 1);
// Influence phase
define("INITIAL_INFLUENCE", 2);
define("CHOOSE_INITIAL_INFLUENCE", 3);
define("TAKE_INFLUENCE", 4);
define("PLACE_INFLUENCE", 5);
define("CHOOSE_PLACE_INFLUENCE", 6);
define("ASSIGN_CANDIDATE", 7);
define("ASSASSINATE", 8);
define("NEXT_PLAYER", 9);
// Election phase
define("PROPOSE_CANDIDATE", 10);
define("ELECTIONS", 11);
// Commit forces phase
define("ASSIGN_LEADERS", 20);
define("SPARTAN_CHOICE", 21);
define("DEAD_POOL", 22);
define("BRING_OUT_YOUR_DEAD", 23);
define("COMMIT_FORCES", 24);
define("NEXT_COMMIT", 25);
// Battle phase
define("NEXT_BATTLE_TILE", 30);
define("RESOLVE_TILE", 31);
define("NEXT_COMBAT", 32);
define("ROLL_BATTLE", 33);
define("TAKE_LOSS", 34);
define("END_TURN", 35);
// SPECIAL TILES
define("SPECIAL_TILE", 40);
define("SPECIAL_BATTLE_TILE", 41);
// Endgame
define("SCORING", 90);
define("ENDGAME", 99);
}
$machinestates = array(
// The initial state. Please do not modify.
SETUP => array(
"name" => "gameSetup",
"description" => "",
"type" => "manager",
"action" => "stGameSetup",
"transitions" => array( "" => CHOOSE_INITIAL_INFLUENCE )
),
INITIAL_INFLUENCE => array(
"name" => "initialInfluence",
"description" => "",
"type" => "game",
"action" => "stInitialInfluence",
"transitions" => array( "nextPlayer" => CHOOSE_INITIAL_INFLUENCE, "startGame" => TAKE_INFLUENCE )
),
CHOOSE_INITIAL_INFLUENCE => array(
"name" => "chooseInitialInfluence",
"description" => clienttranslate('${actplayer} must choose a city to add ${count} starting Influence cube'),
"descriptionmyturn" => clienttranslate('You must choose a city to add ${count} starting Influence cube'),
"args" => "argsInitial",
"type" => "activeplayer",
"possibleactions" => array( "placeAnyCube" ),
"transitions" => array( "nextPlayerInitial" => INITIAL_INFLUENCE )
),
TAKE_INFLUENCE => array(
"name" => "takeInfluence",
"description" => clienttranslate('${actplayer} must take an Influence tile'),
"descriptionmyturn" => clienttranslate('You must take an Influence tile'),
"type" => "activeplayer",
"args" => "argsSpecial",
"updateGameProgression" => true,
"possibleactions" => array("takeInfluence", "useSpecial"),
"transitions" => array( "placeCube" => PLACE_INFLUENCE, "choosePlaceCube" => CHOOSE_PLACE_INFLUENCE, "continueTurn" => TAKE_INFLUENCE)
),
PLACE_INFLUENCE => array(
"name" => "placeInfluence",
"description" => "",
"type" => "game",
"action" => "stPlaceInfluence",
"transitions" => array( "useSpecial" => SPECIAL_TILE, "assassinate" => ASSASSINATE, "candidate" => PROPOSE_CANDIDATE, "nextPlayer" => NEXT_PLAYER )
),
CHOOSE_PLACE_INFLUENCE => array(
"name" => "choosePlaceInfluence",
"description" => clienttranslate('${actplayer} must choose a city to add an Influence cube'),
"descriptionmyturn" => clienttranslate('You must choose a city to add an Influence cube'),
"type" => "activeplayer",
"possibleactions" => array( "placeAnyCube" ),
"transitions" => array( "nextPlayer" => NEXT_PLAYER, "useSpecial" => SPECIAL_TILE )
),
PROPOSE_CANDIDATE => array(
"name" => "proposeCandidates",
"description" => clienttranslate('${actplayer} must propose a candidate'),
"descriptionmyturn" => clienttranslate('You must propose a candidate'),
"type" => "activeplayer",
"possibleactions" => array( "proposeCandidate" ),
"transitions" => array( "nextPlayer" => NEXT_PLAYER, "useSpecial" => SPECIAL_TILE )
),
ASSASSINATE => array(
"name" => "assassinate",
"description" => clienttranslate('${actplayer} must remove 1 Influence cube'),
"descriptionmyturn" => clienttranslate('You must remove 1 Influence cube'),
"type" => "activeplayer",
"possibleactions" => array( "chooseRemoveCube" ),
"transitions" => array( "nextPlayer" => NEXT_PLAYER, "useSpecial" => SPECIAL_TILE )
),
/**
* This is the optional check to use Special after regular phase.
*/
SPECIAL_TILE => array(
"name" => "specialTile",
"description" => clienttranslate('Special Tile phase'),
"descriptionmyturn" => clienttranslate('You may use your Special Tile'),
"args" => "argsSpecial",
"type" => "activeplayer",
"possibleactions" => array("useSpecial"),
"transitions" => array( "nextPlayer" => NEXT_PLAYER, "nextCommit" => NEXT_COMMIT, "continueCommit" => COMMIT_FORCES )
),
/**
* For battle Special Tiles.
*/
SPECIAL_BATTLE_TILE => array(
"name" => "specialBattleTile",
"description" => clienttranslate('Special Tile phase'),
"descriptionmyturn" => clienttranslate('You may use your Special Tile at ${battle_location}'),
"args" => "argsSpecialBattle",
"type" => "multipleactiveplayer",
"possibleactions" => array( "useSpecialBattle" ),
"transitions" => array( "battle" => ROLL_BATTLE )
),
ELECTIONS => array(
"name" => "election",
"description" => "",
"type" => "game",
"action" => "stElections",
"transitions" => array( "" => SPARTAN_CHOICE )
),
SPARTAN_CHOICE => array(
"name" => "spartanChoice",
"description" => clienttranslate('Spartan Leader ${actplayer} must choose the first player to commit forces'),
"descriptionmyturn" => clienttranslate('You must choose the first player to commit forces'),
"type" => "activeplayer",
"possibleactions" => array( "chooseNextPlayer" ),
"transitions" => array( "" => DEAD_POOL)
),
DEAD_POOL => array(
"name" => "deadPool",
"description" => "",
"type" => "game",
"action" => "stDeadPool",
"transitions" => array( "nextPlayer" => DEAD_POOL, "takeDead" => BRING_OUT_YOUR_DEAD, "startCommit" => NEXT_COMMIT)
),
BRING_OUT_YOUR_DEAD => array(
"name" => "takeDead",
"description" => clienttranslate('${actplayer} must choose unit(s) from the dead pool'),
"descriptionmyturn" => clienttranslate('You must choose unit(s) from the dead pool'),
"type" => "activeplayer",
"args" => "argsDeadPool",
"possibleactions" => array( "chooseDeadUnits" ),
"transitions" => array( "nextPlayer" => DEAD_POOL, "nextPick" => BRING_OUT_YOUR_DEAD )
),
NEXT_COMMIT => array(
"name" => "nextPlayerCommit",
"description" => "",
"type" => "game",
"args" => "argsWarPhase",
"action" => "stNextCommit",
"transitions" => array( "commit" => COMMIT_FORCES, "nextPlayer" => NEXT_COMMIT, "resolve" => NEXT_BATTLE_TILE )
),
COMMIT_FORCES => array(
"name" => "commitForces",
"description" => clienttranslate('${actplayer} must commit forces'),
"descriptionmyturn" => clienttranslate('You must commit forces'),
"args" => "argsSpecial",
"type" => "activeplayer",
"possibleactions" => array( "assignUnits", "useSpecial" ),
"transitions" => array( "nextPlayer" => NEXT_COMMIT, "useSpecial" => SPECIAL_TILE, "continueCommit" => COMMIT_FORCES)
),
// rotate to the next location tile
NEXT_BATTLE_TILE => array(
"name" => "nextTile",
"description" => "",
"type" => "game",
"action" => "stNextLocationTile",
"transitions" => array( "resolve" => RESOLVE_TILE, "nextBattle" => NEXT_BATTLE_TILE, "endTurn" => END_TURN )
),
/**
* Manage combat(s) for one tile.
*/
RESOLVE_TILE => array(
"name" => "resolveTile",
"description" => "",
"type" => "game",
"updateGameProgression" => true,
"action" => "stResolveTile",
"transitions" => array( "nextCombat" => NEXT_COMBAT, "endBattle" => NEXT_BATTLE_TILE )
),
// handle one battle (may be 1-2 per tile)
NEXT_COMBAT => array(
"name" => "battle",
"description" => "",
"type" => "game",
"action" => "stCombat",
"transitions" => array( "nextBattle" => NEXT_BATTLE_TILE, "continueBattle" => RESOLVE_TILE, "combat" => ROLL_BATTLE, "useSpecial" => SPECIAL_BATTLE_TILE )
),
// all player actions completed, roll a SINGLE combat until it's over
ROLL_BATTLE => array(
"name" => "rollcombat",
"description" => "",
"type" => "game",
"action" => "stRollCombat",
"transitions" => array( "takeLoss" => TAKE_LOSS, "endBattle" => RESOLVE_TILE )
),
// losers must lose one counter
TAKE_LOSS => array(
"name" => "takeLoss",
"description" => clienttranslate('${actplayer} must lose one counter'),
"descriptionmyturn" => clienttranslate('You must lose one counter'),
"args" => "argsLoss",
"type" => "activeplayer",
"possibleactions" => array( "chooseLoss" ),
"transitions" => array( "" => RESOLVE_TILE )
),
END_TURN => array(
"name" => "endTurn",
"description" => "",
"type" => "game",
"updateGameProgression" => true,
"action" => "stEndTurn",
"transitions" => array( "nextTurn" => TAKE_INFLUENCE, "endGame" => SCORING )
),
NEXT_PLAYER => array(
"name" => "nextPlayer",
"description" => "",
"type" => "game",
"action" => "stNextPlayer",
"transitions" => array( "takeInfluence" => TAKE_INFLUENCE, "proposeCandidate" => PROPOSE_CANDIDATE, "elections" => ELECTIONS, "nextPlayer" => NEXT_PLAYER, "nextCommit" => NEXT_COMMIT)
),
SCORING => array(
"name" => "finalScoring",
"description" => "",
"type" => "game",
"action" => "stScoring",
"transitions" => array( "" => ENDGAME )
),
// Final state.
// Please do not modify (and do not overload action/args methods).
ENDGAME => array(
"name" => "gameEnd",
"description" => clienttranslate("End of game"),
"type" => "manager",
"action" => "stGameEnd",
"args" => "argGameEnd"
)
);