ggejs
Version:
A powerful JavaScript library for interacting with the server of Goodgame Empire: Four Kingdoms
27 lines (24 loc) • 637 B
JavaScript
const Unit = require("../Unit");
const BasicMovement = require("./BasicMovement");
class SiegeMovement extends BasicMovement {
/**
* @param {Client} client
* @param {Object} data
*/
constructor(client, data) {
super(client, data);
/** @type {InventoryItem<Unit>[]} */
this.army = parse(client, data.A);
}
}
/**
* @param {Client} client
* @param {Array} data
* @returns {InventoryItem<Unit>[]}
*/
function parse(client, data) {
return data.map(d => {
return {item: new Unit(client, d[0]), count: d[1]}
})
}
module.exports = SiegeMovement;