-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathageofcomics.action.php
335 lines (241 loc) · 8.78 KB
/
ageofcomics.action.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
<?php
/**
*------
* BGA framework: © Gregory Isabelli <[email protected]> & Emmanuel Colin <[email protected]>
* AgeOfComics implementation : © Evan Pulgino <[email protected]>
*
* This code has been produced on the BGA studio platform for use on https://boardgamearena.com.
* See http://en.doc.boardgamearena.com/Studio for more information.
* -----
*
* ageofcomics.action.php
*
* AgeOfComics main action entry point
*
* In this file, you are describing all the methods that can be called from your
* user interface logic (javascript).
*
* If you define a method "myAction" here, then you can call it from your javascript code with:
* this.ajaxcall( "/ageofcomics/ageofcomics/myAction.html", ...)
*
* @link https://en.doc.boardgamearena.com/Players_actions:_yourgamename.action.php
*
* @EvanPulgino
*/
class action_ageofcomics extends APP_GameAction {
// Constructor: please do not modify
public function __default() {
if (self::isArg("notifwindow")) {
$this->view = "common_notifwindow";
$this->viewArgs["table"] = self::getArg("table", AT_posint, true);
} else {
$this->view = "ageofcomics_ageofcomics";
self::trace("Complete reinitialization of board game");
}
}
public function collectSalesOrder() {
self::setAjaxMode();
$salesOrderId = self::getArg("salesOrderId", AT_posint, true);
$playerIdToPay = self::getArg("playerIdToPay", AT_posint, true);
$this->game->states[PERFORM_SALES]->collectSalesOrder(
$salesOrderId,
$playerIdToPay
);
self::ajaxResponse();
}
public function confirmDiscard() {
self::setAjaxMode();
$cardsToDiscard = self::getArg("cardsToDiscard", AT_numberlist, true);
$this->game->states[CHECK_HAND_SIZE]->confirmDiscard(
explode(",", $cardsToDiscard)
);
self::ajaxResponse();
}
public function confirmGainIdeas() {
self::setAjaxMode();
$ideasFromBoard = self::getArg("ideasFromBoard", AT_numberlist, true);
$ideasFromSupply = self::getArg("ideasFromSupply", AT_numberlist, true);
$this->game->states[PERFORM_IDEAS]->confirmGainIdeas(
explode(",", $ideasFromBoard),
explode(",", $ideasFromSupply)
);
self::ajaxResponse();
}
public function confirmGainBonusIdeas() {
self::setAjaxMode();
$ideas = self::getArg("ideas", AT_numberlist, true);
$this->game->states[PERFORM_PRINT_BONUS]->confirmGainBonusIdeas(
explode(",", $ideas)
);
self::ajaxResponse();
}
public function developComic() {
self::setAjaxMode();
$comicId = self::getArg("comicId", AT_posint, true);
$topOfDeck = self::getArg("topOfDeck", AT_bool, true);
$this->game->states[PERFORM_DEVELOP]->developComic(
$comicId,
$topOfDeck
);
self::ajaxResponse();
}
public function developFromGenre() {
self::setAjaxMode();
$genre = self::getArg("genre", AT_alphanum, true);
$this->game->states[PERFORM_DEVELOP]->developFromGenre($genre);
self::ajaxResponse();
}
public function doubleTrain() {
self::setAjaxMode();
$playerId = self::getArg("playerId", AT_posint, true);
$comicId = self::getArg("comicId", AT_posint, true);
$artistId = self::getArg("artistId", AT_posint, true);
$writerId = self::getArg("writerId", AT_posint, true);
$this->game->states[INCREASE_CREATIVES]->doubleTrain(
$playerId,
$comicId,
$artistId,
$writerId
);
self::ajaxResponse();
}
public function endIncreaseCreatives() {
self::setAjaxMode();
$playerId = self::getArg("playerId", AT_posint, true);
$this->game->states[INCREASE_CREATIVES]->endIncreaseCreatives(
$playerId
);
self::ajaxResponse();
}
public function endSales() {
self::setAjaxMode();
$this->game->states[PERFORM_SALES]->endSales();
self::ajaxResponse();
}
public function flipSalesOrder() {
self::setAjaxMode();
$salesOrderId = self::getArg("salesOrderId", AT_posint, true);
$playerIdToPay = self::getArg("playerIdToPay", AT_posint, true);
$this->game->states[PERFORM_SALES]->flipSalesOrder(
$salesOrderId,
$playerIdToPay
);
self::ajaxResponse();
}
public function hireCreative() {
self::setAjaxMode();
$cardId = self::getArg("cardId", AT_posint, true);
$creativeType = self::getArg("creativeType", AT_alphanum, true);
$this->game->states[PERFORM_HIRE]->hireCreative($cardId, $creativeType);
self::ajaxResponse();
}
public function learn() {
self::setAjaxMode();
$playerId = self::getArg("playerId", AT_posint, true);
$comicId = self::getArg("comicId", AT_posint, true);
$cardId = self::getArg("cardId", AT_posint, true);
$this->game->states[INCREASE_CREATIVES]->learn(
$playerId,
$comicId,
$cardId
);
self::ajaxResponse();
}
public function moveSalesAgent() {
self::setAjaxMode();
$space = self::getArg("space", AT_posint, true);
$this->game->states[PERFORM_SALES]->moveSalesAgent($space);
self::ajaxResponse();
}
public function moveSalesAgentWithTicket() {
self::setAjaxMode();
$space = self::getArg("space", AT_posint, true);
$this->game->states[PERFORM_SALES]->moveSalesAgentWithTicket($space);
self::ajaxResponse();
}
public function placeUpgradeCube() {
self::setAjaxMode();
$actionKey = self::getArg("actionKey", AT_posint, true);
$cubeMoved = self::getArg("cubeMoved", AT_posint, true);
$this->game->states[PERFORM_PRINT_UPGRADE]->placeUpgradeCube(
$actionKey,
$cubeMoved
);
self::ajaxResponse();
}
public function printComic() {
self::setAjaxMode();
$comicId = self::getArg("comicId", AT_posint, true);
$artistId = self::getArg("artistId", AT_posint, true);
$writerId = self::getArg("writerId", AT_posint, true);
$this->game->states[PERFORM_PRINT]->printComic(
$comicId,
$artistId,
$writerId
);
self::ajaxResponse();
}
public function selectActionSpace() {
self::setAjaxMode();
$actionSpace = self::getArg("actionSpace", AT_posint, true);
$this->game->states[PLAYER_TURN]->selectActionSpace($actionSpace);
self::ajaxResponse();
}
public function selectComicForOrder() {
self::setAjaxMode();
$comicId = self::getArg("comicId", AT_posint, true);
$salesOrderId = self::getArg("salesOrderId", AT_posint, true);
$this->game->states[PERFORM_SALES_FULFILL_ORDER]->selectComicForOrder(
$comicId,
$salesOrderId
);
self::ajaxResponse();
}
public function selectStartItems() {
self::setAjaxMode();
$comicGenre = self::getArg("comic", AT_posint, true);
$ideaGenres = self::getArg("ideas", AT_numberlist, true);
$this->game->states[PLAYER_SETUP]->selectStartItems(
$comicGenre,
explode(",", $ideaGenres)
);
self::ajaxResponse();
}
public function selectUpgradeCube() {
self::setAjaxMode();
$cubeLocation = self::getArg("actionKey", AT_posint, true);
$this->game->states[PERFORM_PRINT_GET_UPGRADE_CUBE]->selectUpgradeCube(
$cubeLocation
);
self::ajaxResponse();
}
public function skipDoublePrint() {
self::setAjaxMode();
$this->game->states[PERFORM_PRINT]->skipDoublePrint();
self::ajaxResponse();
}
public function skipUpgrade() {
self::setAjaxMode();
$this->game->states[PERFORM_PRINT_GET_UPGRADE_CUBE]->skipUpgrade();
self::ajaxResponse();
}
public function takeRoyalties() {
self::setAjaxMode();
$amount = self::getArg("amount", AT_posint, true);
$space = self::getArg("space", AT_posint, true);
$this->game->takeRoyalties($amount, $space);
self::ajaxResponse();
}
public function train() {
self::setAjaxMode();
$playerId = self::getArg("playerId", AT_posint, true);
$comicId = self::getArg("comicId", AT_posint, true);
$cardId = self::getArg("cardId", AT_posint, true);
$this->game->states[INCREASE_CREATIVES]->train(
$playerId,
$comicId,
$cardId
);
self::ajaxResponse();
}
}