-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy paththecrew.action.php
248 lines (207 loc) · 5.79 KB
/
thecrew.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
<?php
/**
*------
* BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
* The Crew implementation : © Nicolas Gocel <nicolas.gocel@gmail.com> & Timothée Pecatte <tim.pecatte@gmail.com>
*
* 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.
* -----
*
* thecrew.action.php
*
* thecrew main action entry point
*
*/
class action_thecrew 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 = "thecrew_thecrew";
self::trace( "Complete reinitialization of board game" );
}
}
public function setAutopick()
{
self::setAjaxMode();
$mode = self::getArg("autopick", AT_posint, true);
$this->game->actSetAutopick($mode);
self::ajaxResponse();
}
public function setAutocontinue()
{
self::setAjaxMode();
$mode = self::getArg("autocontinue", AT_posint, true);
$this->game->actSetAutocontinue($mode);
self::ajaxResponse();
}
public function setConfirmPreSelect()
{
self::setAjaxMode();
$mode = self::getArg("confirmpreselect", AT_posint, true);
$this->game->actSetConfirmPreSelect($mode);
self::ajaxResponse();
}
public function actMoveTile()
{
self::setAjaxMode();
$id1 = self::getArg("taskId1", AT_posint, true);
$id2 = self::getArg("taskId2", AT_posint, true);
$this->game->actMoveTile($id1 ,$id2);
self::ajaxResponse();
}
public function actPassMoveTile()
{
self::setAjaxMode();
$this->game->actPassMoveTile();
self::ajaxResponse();
}
public function actChooseTask()
{
self::setAjaxMode();
$taskId = self::getArg("taskId", AT_posint, true);
$this->game->actChooseTask($taskId);
self::ajaxResponse();
}
public function actPlayCard()
{
self::setAjaxMode();
$cardId = self::getArg("cardId", AT_posint, true);
$this->game->actPlayCard( $cardId);
self::ajaxResponse( );
}
public function actPreselectCard()
{
self::setAjaxMode();
$cardId = self::getArg("cardId", AT_posint, true);
$this->game->actPreselectCard($cardId);
self::ajaxResponse( );
}
/***********************
******* RESTART MISSION *******
***********************/
public function actAnswerRestartMission()
{
self::setAjaxMode();
$answer = self::getArg("answer", AT_posint, true);
$this->game->actAnswerRestartMission($answer);
self::ajaxResponse();
}
public function setRestartMission()
{
self::setAjaxMode();
$this->game->actRestartMission();
self::ajaxResponse( );
}
public function actContinueMissions()
{
self::setAjaxMode();
$this->game->actContinueMissions();
self::ajaxResponse( );
}
public function actStopMissions()
{
self::setAjaxMode();
$this->game->actStopMissions();
self::ajaxResponse( );
}
/***********************
******* QUESTION *******
***********************/
public function actReply()
{
self::setAjaxMode();
$reply = self::getArg("reply", AT_posint, true );
$this->game->actReply($reply);
self::ajaxResponse();
}
/***********************
******* DISTRESS *******
***********************/
public function actChooseDirection()
{
self::setAjaxMode();
$dir = self::getArg("dir", AT_posint, true);
$this->game->actChooseDirection($dir);
self::ajaxResponse();
}
public function actChooseCardDistress()
{
self::setAjaxMode();
$cardId = self::getArg("cardId", AT_posint, true);
$this->game->actChooseCardDistress($cardId);
self::ajaxResponse( );
}
public function actChooseCardDistressJarvis()
{
self::setAjaxMode();
$cardId = self::getArg('cardId', AT_posint, true);
$jarvisCardId = self::getArg('jarvisCardId', AT_posint, true);
$this->game->actChooseCardDistressJarvis($cardId, $jarvisCardId);
self::ajaxResponse();
}
/***********************
***** COMMUNICATION ****
***********************/
public function actToggleComm()
{
self::setAjaxMode();
$this->game->actToggleComm();
self::ajaxResponse( );
}
public function actCancelComm()
{
self::setAjaxMode();
$this->game->actCancelComm();
self::ajaxResponse( );
}
public function actConfirmComm()
{
self::setAjaxMode();
$cardId = self::getArg("cardId", AT_posint, true );
$status = self::getArg("status", AT_alphanum, true );
$this->game->actConfirmComm($cardId, $status);
self::ajaxResponse();
}
public function actPickCrew()
{
self::setAjaxMode();
$crewId = self::getArg("pId", AT_posint, true );
$this->game->actPickCrew( $crewId);
self::ajaxResponse();
}
/************************
**** 5 players rule *****
************************/
public function actGiveTask()
{
self::setAjaxMode();
$taskId = self::getArg("taskId", AT_posint, true);
$pId = self::getArg("pId", AT_posint, true);
$this->game->actGiveTask($taskId, $pId);
self::ajaxResponse();
}
public function actPassGiveTask()
{
self::setAjaxMode();
$this->game->actPassGiveTask();
self::ajaxResponse( );
}
public function actConfirmGiveTask()
{
self::setAjaxMode();
$this->game->actConfirmGiveTask();
self::ajaxResponse( );
}
public function actRejectGiveTask()
{
self::setAjaxMode();
$this->game->actRejectGiveTask();
self::ajaxResponse( );
}
}