-
Notifications
You must be signed in to change notification settings - Fork 1
/
terraformingmars.game.php
116 lines (108 loc) · 3.89 KB
/
terraformingmars.game.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
<?php
/**
*------
* BGA framework: © Gregory Isabelli <gisabelli@boardgamearena.com> & Emmanuel Colin <ecolin@boardgamearena.com>
* game implementation : © Alena Laskavaia <laskava@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.
* -----
*
* .game.php
*
* This is the main file for your game logic.
*]
* In this PHP file, you are going to defines the rules of the game.
*
*/
require_once "modules/PGameXBody.php";
class terraformingmars extends PGameXBody {
function __construct() {
parent::__construct();
}
protected function getGameName() {
// Used for translations and stuff. Please do not modify.
return "terraformingmars";
}
/*
* setupNewGame:
*
* This method is called only once, when a new game is launched.
* In this method, you must setup the game according to the game rules, so that
* the game is ready to be played.
*/
protected function setupNewGame($players, $options = []) {
parent::setupNewGame($players, $options);
}
/*
* getAllDatas:
*
* Gather all informations about current game situation (visible by the current player).
*
* The method is called each time the game interface is displayed to a player, ie:
* _ when the game starts
* _ when a player refreshes the game page (F5)
*/
protected function getAllDatas() {
$result = parent::getAllDatas();
return $result;
}
/*
* getGameProgression:
*
* Compute and return the current game progression.
* The number returned must be an integer beween 0 (=the game just started) and
* 100 (= the game is finished or almost finished).
*
* This method is called each time we are in a game state with the "updateGameProgression" property set to true
* (see states.inc.php)
*/
function getGameProgression() {
return parent::getGameProgression();
}
//////////////////////////////////////////////////////////////////////////////
//////////// Zombie
////////////
/*
* zombieTurn:
*
* This method is called each time it is the turn of a player who has quit the game (= "zombie" player).
* You can do whatever you want in order to make sure the turn of this player ends appropriately
* (ex: pass).
*/
function zombieTurn($state, $active_player) {
parent::zombieTurn($state, $active_player);
}
///////////////////////////////////////////////////////////////////////////////////:
////////// DB upgrade
//////////
/*
* upgradeTableDb:
*
* You don't have to care about this until your game has been published on BGA.
* Once your game is on BGA, this method is called everytime the system detects a game running with your old
* Database scheme.
* In this case, if you change your Database scheme, you just have to apply the needed changes in order to
* update the game database and allow the game to continue to run with your new version.
*
*/
function upgradeTableDb($from_version) {
// $from_version is the current version of this game database, in numerical form.
// For example, if the game was running with a release of your game named "140430-1345",
// $from_version is equal to 1404301345
// Example:
// if( $from_version <= 1404301345 )
// {
// $sql = "ALTER TABLE xxxxxxx ....";
// self::DbQuery( $sql );
// }
// if( $from_version <= 1405061421 )
// {
// $sql = "CREATE TABLE xxxxxxx ....";
// self::DbQuery( $sql );
// }
// // Please add your future database scheme changes here
//
//
}
}