-
Notifications
You must be signed in to change notification settings - Fork 0
/
battleforhill.action.php
56 lines (45 loc) · 1.35 KB
/
battleforhill.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
<?php
use Functional as F;
/**
* @property BattleForHill game
*/
class action_battleforhill extends APP_GameAction
{
public function __default()
{
if (self::isArg('notifwindow')) {
$this->view = "common_notifwindow";
$this->viewArgs['table'] = $this->getArg("table", AT_posint, true);
} else {
$this->view = "battleforhill_battleforhill";
self::trace("Complete reinitialization of board game");
}
}
public function returnToDeck()
{
$this->setAjaxMode();
$joinedIds = $this->getArg('ids', AT_numberlist, true);
$ids = F\map(explode(',', $joinedIds), function ($id) {
return intval($id);
});
$this->game->returnToDeck($ids);
$this->ajaxResponse();
}
public function playCard()
{
$this->setAjaxMode();
$cardId = $this->getArg('id', AT_int, true);
$x = (int) $this->getArg('x', AT_int, true);
$y = (int) $this->getArg('y', AT_int, true);
$this->game->playCard($cardId, $x, $y);
$this->ajaxResponse();
}
public function chooseAttack()
{
$this->setAjaxMode();
$x = (int) $this->getArg('x', AT_int, true);
$y = (int) $this->getArg('y', AT_int, true);
$this->game->chooseAttack($x, $y);
$this->ajaxResponse();
}
}