-
Notifications
You must be signed in to change notification settings - Fork 0
/
vektorace.action.php
163 lines (143 loc) · 4.97 KB
/
vektorace.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
<?php
/*
*------
* BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
* Vektorace implementation : © <Pietro Luigi Porcedda> <pietro.l.porcedda@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.
* -----
*/
class action_vektorace 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 = "vektorace_vektorace";
self::trace( "Complete reinitialization of board game" );
}
}
// debugging func
/* public function loadBugSQL() {
self::setAjaxMode();
$reportId = (int) self::getArg('report_id', AT_int, true);
$this->game->loadBugSQL($reportId);
self::ajaxResponse();
} */
// debug
/* public function testCollision() {
self::setAjaxMode();
$x = self::getArg( "x", AT_int, true );
$y = self::getArg( "y", AT_int, true );
$this->game->testCollision( $x, $y );
self::ajaxResponse();
} */
// ALL ACTION HANDLERS BELOW
public function assignInitialOrder() {
self::setAjaxMode();
$order = self::getArg( "order", AT_numberlist, true );
$this->game->assignInitialOrder(explode(',',$order));
self::ajaxResponse();
}
public function placeFirstCar() {
self::setAjaxMode();
$x = self::getArg( "x", AT_int, true );
$y = self::getArg( "y", AT_int, true );
$this->game->placeFirstCar( $x, $y );
self::ajaxResponse();
}
public function placeCarFS() {
self::setAjaxMode();
$ref = self::getArg( "ref", AT_alphanum, true);
$pos = self::getArg( "pos", AT_int, true);
$this->game->placeCarFS($ref, $pos);
self::ajaxResponse();
}
public function chooseTokensAmount() {
self::setAjaxMode();
$tire = self::getArg( "tire", AT_int, true );
$nitro = self::getArg( "nitro", AT_int, true );
$pitStop = self::getArg( "pitStop", AT_bool, false, false);
$this->game->chooseTokensAmount( $tire, $nitro, $pitStop);
self::ajaxResponse();
}
public function chooseStartingGear() {
self::setAjaxMode();
$gearN = self::getArg( "gearN", AT_int, true );
$this->game->chooseStartingGear($gearN);
self::ajaxResponse();
}
public function declareGear() {
self::setAjaxMode();
$gearN = self::getArg( "gearN", AT_int, true );
$this->game->declareGear($gearN);
self::ajaxResponse();
}
public function placeGearVector() {
self::setAjaxMode();
$pos = self::getArg( "pos", AT_alphanum_dash, true);
$this->game->placeGearVector($pos);
self::ajaxResponse();
}
public function brakeCar() {
self::setAjaxMode();
$this->game->brakeCar();
self::ajaxResponse();
}
public function giveWay() {
self::setAjaxMode();
$this->game->giveWay();
self::ajaxResponse();
}
public function concede() {
self::setAjaxMode();
$this->game->concede();
self::ajaxResponse();
}
public function rotateAfterBrake() {
self::setAjaxMode();
$dir = self::getArg( "dir", AT_int, true);
$this->game->rotateAfterBrake($dir);
self::ajaxResponse();
}
public function useBoost() {
self::setAjaxMode();
$use = self::getArg( "use", AT_bool, true);
$this->game->useBoost($use);
self::ajaxResponse();
}
public function placeBoostVector() {
self::setAjaxMode();
$n = self::getArg( "n", AT_int, false );
$this->game->placeBoostVector($n);
self::ajaxResponse();
}
public function placeCar() {
self::setAjaxMode();
$pos = self::getArg( "pos", AT_alphanum_dash, true);
$dir = self::getArg( "dir", AT_alphanum_dash, true);
$this->game->placeCar($pos, $dir);
self::ajaxResponse();
}
public function engageManeuver() {
self::setAjaxMode();
$action = self::getArg( "maneuver", AT_alphanum_dash, true);
$enemy = self::getArg( "enemy", AT_int, true);
$posIndex = self::getArg( "posIndex", AT_int, false, 0);
$this->game->engageManeuver($enemy, $action, $posIndex);
self::ajaxResponse();
}
public function skipAttack() {
self::setAjaxMode();
$this->game->skipAttack();
self::ajaxResponse();
}
public function boxBox() {
self::setAjaxMode();
$skip = self::getArg( "skip", AT_bool, false, false);
$this->game->boxBox($skip);
self::ajaxResponse();
}
}