init: function(data) { GameObject.init.apply(this, arguments); /** * When the Piece has been captured (removed from the board) this is true. Otherwise false. * * @type {boolean} */ this._addProperty("captured", serializer.defaultBoolean(data.captured)); /** * The file (column) coordinate of the Piece represented as a letter [a-h], with 'a' starting at the left of the board. * * @type {string} */ this._addProperty("file", serializer.defaultString(data.file)); /** * If the Piece has moved from its starting position. * * @type {boolean} */ this._addProperty("hasMoved", serializer.defaultBoolean(data.hasMoved)); /** * The player that controls this chess Piece. * * @type {Player} */ this._addProperty("owner", serializer.defaultGameObject(data.owner)); /** * The rank (row) coordinate of the Piece represented as a number [1-8], with 1 starting at the bottom of the board. * * @type {number} */ this._addProperty("rank", serializer.defaultInteger(data.rank)); /** * The type of chess Piece this is, either: 'King', 'Queen', 'Knight', 'Rook', 'Bishop', or 'Pawn'. * * @type {string} */ this._addProperty("type", serializer.defaultString(data.type)); //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. // put any initialization logic here. the base variables should be set from 'data' above // NOTE: no players are connected (nor created) at this point. For that logic use 'begin()' //<<-- /Creer-Merge: init -->> },
init: function(data) { GameObject.init.apply(this, arguments); /** * All the checkers currently in the game owned by this player * * @type {list.<Checker>} */ this._addProperty("checkers", serializer.defaultArray(data.checkers)); /** * What type of client this is, e.g. 'Python', 'JavaScript', or some other language. For potential data mining purposes. * * @type {string} */ this._addProperty("clientType", serializer.defaultString(data.clientType)); /** * if the player lost the game or not * * @type {boolean} */ this._addProperty("lost", serializer.defaultBoolean(data.lost)); /** * The name of the player * * @type {string} */ this._addProperty("name", serializer.defaultString(data.name)); /** * this player's opponent in the game. * * @type {Player} */ this._addProperty("otherPlayer", serializer.defaultGameObject(data.otherPlayer)); /** * the reason why the player lost the game * * @type {string} */ this._addProperty("reasonLost", serializer.defaultString(data.reasonLost)); /** * the reason why the player won the game * * @type {string} */ this._addProperty("reasonWon", serializer.defaultString(data.reasonWon)); /** * The amount of time (in ns) remaining for this AI to send commands. * * @type {number} */ this._addProperty("timeRemaining", serializer.defaultNumber(data.timeRemaining)); /** * if the player won the game or not * * @type {boolean} */ this._addProperty("won", serializer.defaultBoolean(data.won)); /** * The direction your checkers must go along the y-axis until kinged * * @type {number} */ this._addProperty("yDirection", serializer.defaultInteger(data.yDirection)); //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. // put any initialization logic here. the base variables should be set from 'data' in Generated${obj_key}'s init function // NOTE: no players are connected at this point. //<<-- /Creer-Merge: init -->> },
init: function(data) { GameObject.init.apply(this, arguments); /** * How many bribes this player has remaining to use during their turn. Each action a Building does costs 1 bribe. Any unused bribes are lost at the end of the player's turn. * * @type {number} */ this._addProperty("bribesRemaining", serializer.defaultInteger(data.bribesRemaining)); /** * All the buildings owned by this player. * * @type {list.<Building>} */ this._addProperty("buildings", serializer.defaultArray(data.buildings)); /** * What type of client this is, e.g. 'Python', 'JavaScript', or some other language. For potential data mining purposes. * * @type {string} */ this._addProperty("clientType", serializer.defaultString(data.clientType)); /** * All the FireDepartments owned by this player. * * @type {list.<FireDepartment>} */ this._addProperty("fireDepartments", serializer.defaultArray(data.fireDepartments)); /** * The Warehouse that serves as this player's headquarters and has extra health. If this gets destroyed they lose. * * @type {Warehouse} */ this._addProperty("headquarters", serializer.defaultGameObject(data.headquarters)); /** * if the player lost the game or not * * @type {boolean} */ this._addProperty("lost", serializer.defaultBoolean(data.lost)); /** * The name of the player * * @type {string} */ this._addProperty("name", serializer.defaultString(data.name)); /** * this player's opponent in the game. * * @type {Player} */ this._addProperty("otherPlayer", serializer.defaultGameObject(data.otherPlayer)); /** * All the PoliceDepartments owned by this player. * * @type {list.<PoliceDepartment>} */ this._addProperty("policeDepartments", serializer.defaultArray(data.policeDepartments)); /** * the reason why the player lost the game * * @type {string} */ this._addProperty("reasonLost", serializer.defaultString(data.reasonLost)); /** * the reason why the player won the game * * @type {string} */ this._addProperty("reasonWon", serializer.defaultString(data.reasonWon)); /** * The amount of time (in ns) remaining for this AI to send commands. * * @type {number} */ this._addProperty("timeRemaining", serializer.defaultNumber(data.timeRemaining)); /** * All the warehouses owned by this player. Includes the Headquarters. * * @type {list.<Warehouse>} */ this._addProperty("warehouses", serializer.defaultArray(data.warehouses)); /** * All the WeatherStations owned by this player. * * @type {list.<WeatherStation>} */ this._addProperty("weatherStations", serializer.defaultArray(data.weatherStations)); /** * if the player won the game or not * * @type {boolean} */ this._addProperty("won", serializer.defaultBoolean(data.won)); //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. // put any initialization logic here. the base variables should be set from 'data' above // NOTE: no players are connected (nor created) at this point. For that logic use 'begin()' //<<-- /Creer-Merge: init -->> },
init: function(data) { GameObject.init.apply(this, arguments); /** * when true this building has already been bribed this turn and cannot be bribed again this turn. * * @type {boolean} */ this._addProperty("bribed", serializer.defaultBoolean(data.bribed)); /** * The Building directly to the east of this building, or null if not present. * * @type {Building} */ this._addProperty("buildingEast", serializer.defaultGameObject(data.buildingEast)); /** * The Building directly to the north of this building, or null if not present. * * @type {Building} */ this._addProperty("buildingNorth", serializer.defaultGameObject(data.buildingNorth)); /** * The Building directly to the south of this building, or null if not present. * * @type {Building} */ this._addProperty("buildingSouth", serializer.defaultGameObject(data.buildingSouth)); /** * The Building directly to the west of this building, or null if not present. * * @type {Building} */ this._addProperty("buildingWest", serializer.defaultGameObject(data.buildingWest)); /** * How much fire is currently burning the building, and thus how much damage it will take at the end of its owner's turn. 0 means no fire. * * @type {number} */ this._addProperty("fire", serializer.defaultInteger(data.fire)); /** * How much health this building currently has. When this reaches 0 the Building has been burned down * * @type {number} */ this._addProperty("health", serializer.defaultInteger(data.health)); /** * true if this is the Headquarters of the owning player, false otherwise. Burning this down wins the game for the other Player. * * @type {boolean} */ this._addProperty("isHeadquarters", serializer.defaultBoolean(data.isHeadquarters)); /** * The player that owns this building. If it burns down (health reaches 0) that player gets an additional bribe(s). * * @type {Player} */ this._addProperty("owner", serializer.defaultGameObject(data.owner)); /** * The location of the Building along the x-axis * * @type {number} */ this._addProperty("x", serializer.defaultInteger(data.x)); /** * The location of the Building along the y-axis * * @type {number} */ this._addProperty("y", serializer.defaultInteger(data.y)); //<<-- Creer-Merge: init -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. this.health = this.maxHealth; if(this.isHeadquarters) { this.makeHeadquarters(); } //<<-- /Creer-Merge: init -->> },