diff --git a/.gitignore b/.gitignore index 817268f..57d4713 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ .idea/ -atlassian-ide-plugin.xml -.git/ \ No newline at end of file +atlassian-ide-plugin.xml \ No newline at end of file diff --git a/Config/SublimeCodeIntel.json b/Config/SublimeCodeIntel.json deleted file mode 100644 index 5cf6c62..0000000 --- a/Config/SublimeCodeIntel.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - /* - Defines a configuration for each language. - */ - "codeintel_language_settings": { - "JavaScript": { - "codeintel_scan_extra_dir": [], - "codeintel_scan_exclude_dir":["/build/", "/min/"], - "codeintel_scan_files_in_project": true, - "codeintel_max_recursive_dir_depth": 2, - "codeintel_selected_catalogs": ["jQuery"] - } - } -} diff --git a/Global/Constants.js b/Global/Constants.js deleted file mode 100644 index bfcfcc3..0000000 --- a/Global/Constants.js +++ /dev/null @@ -1,2430 +0,0 @@ - -/** CREEP BODY PARTS **/ - -/** - * @constant - * @type {string} - */ -const MOVE = "move"; - -/** - * @constant - * @type {string} - */ -const WORK = "work"; - -/** - * @constant - * @type {string} - */ -const CARRY = "carry"; - -/** - * @constant - * @type {string} - */ -const ATTACK = "attack"; - -/** - * @constant - * @type {string} - */ -const RANGED_ATTACK = "ranged_attack"; - -/** - * @constant - * @type {string} - */ -const TOUGH = "tough"; - -/** - * @constant - * @type {string} - */ -const HEAL = "heal"; - -/** - * @constant - * @type {string} - */ -const CLAIM = "claim"; - -/** DIRECTION CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const TOP = 1; - -/** - * @constant - * @type {number} - */ -const TOP_RIGHT = 2; - -/** - * @constant - * @type {number} - */ -const RIGHT = 3; - -/** - * @constant - * @type {number} - */ -const BOTTOM_RIGHT = 4; - -/** - * @constant - * @type {number} - */ -const BOTTOM = 5; - -/** - * @constant - * @type {number} - */ -const BOTTOM_LEFT = 6; - -/** - * @constant - * @type {number} - */ -const LEFT = 7; - -/** - * @constant - * @type {number} - */ -const TOP_LEFT = 8; - -/** ERROR CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const OK = 0; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_OWNER = -1; - -/** - * @constant - * @type {number} - */ -const ERR_NO_PATH = -2; - -/** - * @constant - * @type {number} - */ -const ERR_NAME_EXISTS = -3; - -/** - * @constant - * @type {number} - */ -const ERR_BUSY = -4; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_FOUND = -5; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_ENOUGH_ENERGY = -6; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_ENOUGH_RESOURCES = -6; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_ENOUGH_EXTENSIONS = -6; - -/** - * @constant - * @type {number} - */ -const ERR_INVALID_TARGET = -7; - -/** - * @constant - * @type {number} - */ -const ERR_FULL = -8; - -/** - * @constant - * @type {number} - */ -const ERR_NOT_IN_RANGE = -9; - -/** - * @constant - * @type {number} - */ -const ERR_INVALID_ARGS = -10; - -/** - * @constant - * @type {number} - */ -const ERR_TIRED = -11; - -/** - * @constant - * @type {number} - */ -const ERR_NO_BODYPART = -12; - -/** - * @constant - * @type {number} - */ -const ERR_RCL_NOT_ENOUGH = -14; - -/** - * @constant - * @type {number} - */ -const ERR_GCL_NOT_ENOUGH = -15; - -/** COLOR CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const COLOR_RED = 1; - -/** - * @constant - * @type {number} - */ -const COLOR_PURPLE = 2; - -/** - * @constant - * @type {number} - */ -const COLOR_BLUE = 3; - -/** - * @constant - * @type {number} - */ -const COLOR_CYAN = 4; - -/** - * @constant - * @type {number} - */ -const COLOR_GREEN = 5; - -/** - * @constant - * @type {number} - */ -const COLOR_YELLOW = 6; - -/** - * @constant - * @type {number} - */ -const COLOR_ORANGE = 7; - -/** - * @constant - * @type {number} - */ -const COLOR_BROWN = 8; - -/** - * @constant - * @type {number} - */ -const COLOR_GREY = 9; - -/** - * @constant - * @type {number} - */ -const COLOR_WHITE = 10; - -/** FIND CONSTANTS **/ - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_TOP = 1; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_RIGHT = 3; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_BOTTOM = 5; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT_LEFT = 7; - -/** - * @constant - * @type {number} - */ -const FIND_EXIT = 10; - -/** - * @constant - * @type {number} - */ -const FIND_CREEPS = 101; - -/** - * @constant - * @type {number} - */ -const FIND_MY_CREEPS = 102; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_CREEPS = 103; - -/** - * @constant - * @type {number} - */ -const FIND_SOURCES_ACTIVE = 104; - -/** - * @constant - * @type {number} - */ -const FIND_SOURCES = 105; - -/** - * @constant - * @type {number} - */ -const FIND_DROPPED_RESOURCES = 106; - -/** - * @constant - * @type {number} - */ -const FIND_STRUCTURES = 107; - -/** - * @constant - * @type {number} - */ -const FIND_MY_STRUCTURES = 108; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_STRUCTURES = 109; - -/** - * @constant - * @type {number} - */ -const FIND_FLAGS = 110; - -/** - * @constant - * @type {number} - */ -const FIND_CONSTRUCTION_SITES = 111; - -/** - * @constant - * @type {number} - */ -const FIND_MY_SPAWNS = 112; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_SPAWNS = 113; - -/** - * @constant - * @type {number} - */ -const FIND_MY_CONSTRUCTION_SITES = 114; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_CONSTRUCTION_SITES = 115; - -/** - * @constant - * @type {number} - */ -const FIND_MINERALS = 116; - -/** - * @constant - * @type {number} - */ -const FIND_NUKES = 117; - -/** - * @constant - * @type {number} - */ -const FIND_TOMBSTONES = 118; - -/** - * @constant - * @type {number} - */ -const FIND_POWER_CREEPS = 119; - -/** - * @constant - * @type {number} - */ -const FIND_MY_POWER_CREEPS = 120; - -/** - * @constant - * @type {number} - */ -const FIND_HOSTILE_POWER_CREEPS = 121; - -/** - * @constant - * @type {string} - */ -const MODE_SIMULATION = "simulation"; - -/** - * @constant - * @type {string} - */ -const MODE_SURVIVAL = "survival"; - -/** - * @constant - * @type {string} - */ -const MODE_WORLD = "world"; - -/** - * @constant - * @type {string} - */ -const MODE_ARENA = "arena"; - -/** STRUCTURE CONSTANTS **/ - -/** - * @constant - * @type {string} - */ -const STRUCTURE_EXTENSION = "extension"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_RAMPART = "rampart"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_ROAD = "road"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_SPAWN = "spawn"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_WALL = "constructedWall"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_LINK = "link"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_KEEPER_LAIR = "keeperLair"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_CONTROLLER = "controller"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_STORAGE = "storage"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_TOWER = "tower"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_OBSERVER = "observer"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_POWER_BANK = "powerBank"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_POWER_SPAWN = "powerSpawn"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_PORTAL = "portal"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_EXTRACTOR = "extractor"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_LAB = "lab"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_TERMINAL = "terminal"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_CONTAINER = "container"; - -/** - * @constant - * @type {string} - */ -const STRUCTURE_NUKER = "nuker"; - -/** RESOURCE CONSTANTS **/ - -/** - * @constant - * @type {string} - */ -const SUBSCRIPTION_TOKEN = 'token'; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ENERGY = "energy"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_POWER = "power"; -/** - * @constant - * @type {string} - */ -const RESOURCE_HYDROGEN = "H"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_OXYGEN = "O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM = "U"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM = "K"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM = "L"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM = "Z"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYST = "X"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_OPS = "ops"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_HYDROXIDE = "OH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_KEANITE = "ZK"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_LEMERGITE = "UL"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM = "G"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_HYDRIDE = "UH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_OXIDE = "UO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_HYDRIDE = "KH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_OXIDE = "KO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_HYDRIDE = "LH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_OXIDE = "LO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_HYDRIDE = "ZH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_OXIDE = "ZO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_HYDRIDE = "GH"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_OXIDE = "GO"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_ACID = "UH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_UTRIUM_ALKALIDE = "UHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_ACID = "KH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_KEANIUM_ALKALIDE = "KHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_ACID = "LH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_LEMERGIUM_ALKALIDE = "LHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_ACID = "ZH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_ACID = "GH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_GHODIUM_ALKALIDE = "GHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O"; - -/** - * @constant - * @type {string} - */ -const RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2"; - -/** - * @constant - * @type {object} - */ -const REACTIONS = { - H: { - O: "OH", - L: "LH", - K: "KH", - U: "UH", - Z: "ZH", - G: "GH" - }, - O: { - H: "OH", - L: "LO", - K: "KO", - U: "UO", - Z: "ZO", - G: "GO" - }, - Z: { - K: "ZK", - H: "ZH", - O: "ZO" - }, - L: { - U: "UL", - H: "LH", - O: "LO" - }, - K: { - Z: "ZK", - H: "KH", - O: "KO" - }, - G: { - H: "GH", - O: "GO" - }, - U: { - L: "UL", - H: "UH", - O: "UO" - }, - OH: { - UH: "UH2O", - UO: "UHO2", - ZH: "ZH2O", - ZO: "ZHO2", - KH: "KH2O", - KO: "KHO2", - LH: "LH2O", - LO: "LHO2", - GH: "GH2O", - GO: "GHO2" - }, - X: { - UH2O: "XUH2O", - UHO2: "XUHO2", - LH2O: "XLH2O", - LHO2: "XLHO2", - KH2O: "XKH2O", - KHO2: "XKHO2", - ZH2O: "XZH2O", - ZHO2: "XZHO2", - GH2O: "XGH2O", - GHO2: "XGHO2" - }, - ZK: { - UL: "G" - }, - UL: { - ZK: "G" - }, - LH: { - OH: "LH2O" - }, - ZH: { - OH: "ZH2O" - }, - GH: { - OH: "GH2O" - }, - KH: { - OH: "KH2O" - }, - UH: { - OH: "UH2O" - }, - LO: { - OH: "LHO2" - }, - ZO: { - OH: "ZHO2" - }, - KO: { - OH: "KHO2" - }, - UO: { - OH: "UHO2" - }, - GO: { - OH: "GHO2" - }, - LH2O: { - X: "XLH2O" - }, - KH2O: { - X: "XKH2O" - }, - ZH2O: { - X: "XZH2O" - }, - UH2O: { - X: "XUH2O" - }, - GH2O: { - X: "XGH2O" - }, - LHO2: { - X: "XLHO2" - }, - UHO2: { - X: "XUHO2" - }, - KHO2: { - X: "XKHO2" - }, - ZHO2: { - X: "XZHO2" - }, - GHO2: { - X: "XGHO2" - } -}; - -/** - * @constant - * @type {object} - */ -const BOOSTS = { - work: { - UO: { - harvest: 2 - }, - UHO2: { - harvest: 3 - }, - XUHO2: { - harvest: 4 - }, - LH: { - build: 1.3, - repair: 1.3 - }, - LH2O: { - build: 1.65, - repair: 1.65 - }, - XLH2O: { - build: 2, - repair: 2 - }, - ZH: { - dismantle: 2 - }, - ZH2O: { - dismantle: 3 - }, - XZH2O: { - dismantle: 4 - }, - GH: { - upgradeController: 1.3 - }, - GH2O: { - upgradeController: 1.65 - }, - XGH2O: { - upgradeController: 2 - } - }, - attack: { - UH: { - attack: 2 - }, - UH2O: { - attack: 3 - }, - XUH2O: { - attack: 4 - } - }, - ranged_attack: { - KO: { - rangedAttack: 2, - rangedMassAttack: 2 - }, - KHO2: { - rangedAttack: 3, - rangedMassAttack: 3 - }, - XKHO2: { - rangedAttack: 4, - rangedMassAttack: 4 - } - }, - heal: { - LO: { - heal: 2, - rangedHeal: 2 - }, - LHO2: { - heal: 3, - rangedHeal: 3 - }, - XLHO2: { - heal: 4, - rangedHeal: 4 - } - }, - carry: { - KH: { - capacity: 2 - }, - KH2O: { - capacity: 3 - }, - XKH2O: { - capacity: 4 - } - }, - move: { - ZO: { - fatigue: 2 - }, - ZHO2: { - fatigue: 3 - }, - XZHO2: { - fatigue: 4 - } - }, - tough: { - GO: { - damage: .7 - }, - GHO2: { - damage: .5 - }, - XGHO2: { - damage: .3 - } - } -}; - -/** - * @constant - * @type {string[]} - */ -const RESOURCES_ALL = [ - RESOURCE_ENERGY, - RESOURCE_POWER, - RESOURCE_HYDROGEN, - RESOURCE_OXYGEN, - RESOURCE_UTRIUM, - RESOURCE_KEANIUM, - RESOURCE_LEMERGIUM, - RESOURCE_ZYNTHIUM, - RESOURCE_CATALYST, - RESOURCE_GHODIUM, - RESOURCE_HYDROXIDE, - RESOURCE_ZYNTHIUM_KEANITE, - RESOURCE_UTRIUM_LEMERGITE, - RESOURCE_UTRIUM_HYDRIDE, - RESOURCE_UTRIUM_OXIDE, - RESOURCE_KEANIUM_HYDRIDE, - RESOURCE_KEANIUM_OXIDE, - RESOURCE_LEMERGIUM_HYDRIDE, - RESOURCE_LEMERGIUM_OXIDE, - RESOURCE_ZYNTHIUM_HYDRIDE, - RESOURCE_ZYNTHIUM_OXIDE, - RESOURCE_GHODIUM_HYDRIDE, - RESOURCE_GHODIUM_OXIDE, - RESOURCE_UTRIUM_ACID, - RESOURCE_UTRIUM_ALKALIDE, - RESOURCE_KEANIUM_ACID, - RESOURCE_KEANIUM_ALKALIDE, - RESOURCE_LEMERGIUM_ACID, - RESOURCE_LEMERGIUM_ALKALIDE, - RESOURCE_ZYNTHIUM_ACID, - RESOURCE_ZYNTHIUM_ALKALIDE, - RESOURCE_GHODIUM_ACID, - RESOURCE_GHODIUM_ALKALIDE, - RESOURCE_CATALYZED_UTRIUM_ACID, - RESOURCE_CATALYZED_UTRIUM_ALKALIDE, - RESOURCE_CATALYZED_KEANIUM_ACID, - RESOURCE_CATALYZED_KEANIUM_ALKALIDE, - RESOURCE_CATALYZED_LEMERGIUM_ACID, - RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE, - RESOURCE_CATALYZED_ZYNTHIUM_ACID, - RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE, - RESOURCE_CATALYZED_GHODIUM_ACID, - RESOURCE_CATALYZED_GHODIUM_ALKALIDE, - RESOURCE_OPS -]; - -/** - * @constant - * @type {string[]} - */ -const BODYPARTS_ALL = [ - MOVE, - WORK, - CARRY, - ATTACK, - RANGED_ATTACK, - TOUGH, - HEAL, - CLAIM -]; - -/** - * @constant - * @type {string[]} - */ -const COLORS_ALL = [ - COLOR_RED, - COLOR_PURPLE, - COLOR_BLUE, - COLOR_CYAN, - COLOR_GREEN, - COLOR_YELLOW, - COLOR_ORANGE, - COLOR_BROWN, - COLOR_GREY, - COLOR_WHITE -]; - -const REACTION_TIME = { - OH: 20, - ZK: 5, - UL: 5, - G: 5, - UH: 10, - UH2O: 5, - XUH2O: 60, - UO: 10, - UHO2: 5, - XUHO2: 60, - KH: 10, - KH2O: 5, - XKH2O: 60, - KO: 10, - KHO2: 5, - XKHO2: 60, - LH: 15, - LH2O: 10, - XLH2O: 65, - LO: 10, - LHO2: 5, - XLHO2: 60, - ZH: 20, - ZH2O: 40, - XZH2O: 160, - ZO: 10, - ZHO2: 5, - XZHO2: 60, - GH: 10, - GH2O: 15, - XGH2O: 80, - GO: 10, - GHO2: 30, - XGHO2: 150, -}; - -/** - * @constant - * @type {object} - */ -const BODYPART_COST = { - move: 50, - work: 100, - attack: 80, - carry: 50, - heal: 250, - ranged_attack: 150, - tough: 10, - claim: 600 -}; - -/** - * Spawn time per body part in ticks - * @constant - * @type {number} - */ -const CREEP_SPAWN_TIME = 3; - -/** - * @constant - * @type {number} - */ -const CREEP_RENEW_RATIO = 1.2; - -/** - * Lifetime of a creep - * @constant - * @type {number} - */ -const CREEP_LIFE_TIME = 1500; - -/** - * Lifetime of a creep with CLAIM body parts - * @constant - * @type {number} - */ -const CREEP_CLAIM_LIFE_TIME = 500; - -/** - * use unknown - * @constant - * @type {number} - */ -const CREEP_CORPSE_RATE = 0.2; - -/** - * @constant - * @type {string[]} - */ -const OBSTACLE_OBJECT_TYPES = ["spawn", "creep", "powerCreep", "source", "mineral", "controller", "constructedWall", "extension", "link", "storage", "tower", "observer", "powerSpawn", "powerBank", "lab", "terminal","nuker"]; - -/** - * @constant - * @type {number} - */ -const ENERGY_REGEN_TIME = 300; - -/** - * @constant - * @type {number} - */ -const ENERGY_DECAY = 1000; - -/** - * @constant - * @type {number} - */ -const MINERAL_REGEN_TIME = 50000; - -/** - * @constant - * @type {object} - */ -const MINERAL_MIN_AMOUNT = { - H: 140000, - O: 140000, - L: 70000, - K: 70000, - Z: 70000, - U: 70000, - X: 70000 -}; - -/** - * @constant - * @type {number} - */ -const MINERAL_RANDOM_FACTOR = 2; - -/** - * @constant - * @type {number} - */ -const REPAIR_COST = 0.01; - -/** - * @constant - * @type {number} - */ -const DISMANTLE_COST = 0.005; - -/** - * @constant - * @type {number} - */ -const RAMPART_DECAY_AMOUNT = 300; - -/** - * @constant - * @type {number} - */ -const RAMPART_DECAY_TIME = 100; - -/** - * @constant - * @type {number} - */ -const RAMPART_HITS = 1; - -/** - * @constant - * @type {object} - */ -const RAMPART_HITS_MAX = { - 2: 300000, - 3: 1000000, - 4: 3000000, - 5: 10000000, - 6: 30000000, - 7: 100000000, - 8: 300000000 -}; - -/** - * @constant - * @type {number} - */ -const SPAWN_HITS = 5000; - -/** - * @constant - * @type {number} - */ -const SPAWN_ENERGY_START = 300; - -/** - * @constant - * @type {number} - */ -const SPAWN_ENERGY_CAPACITY = 300; - -/** - * @constant - * @type {number} - */ -const SOURCE_ENERGY_CAPACITY = 3000; - -/** - * @constant - * @type {number} - */ -const SOURCE_ENERGY_NEUTRAL_CAPACITY = 1500; - -/** - * @constant - * @type {number} - */ -const SOURCE_ENERGY_KEEPER_CAPACITY = 4500; - -/** - * @constant - * @type {number} - */ -const ROAD_HITS = 5000; - -/** - * @constant - * @type {number} - */ -const WALL_HITS = 1; - -/** - * @constant - * @type {number} - */ -const WALL_HITS_MAX = 300000000; - -/** - * @constant - * @type {number} - */ -const EXTENSION_HITS = 1000; - -/** - * @constant - * @type {object} - */ -const EXTENSION_ENERGY_CAPACITY = { - 0: 50, - 1: 50, - 2: 50, - 3: 50, - 4: 50, - 5: 50, - 6: 50, - 7: 100, - 8: 200 -}; - -/** - * @constant - * @type {number} - */ -const ROAD_WEAROUT = 1; - -/** - * @constant - * @type {number} - */ -const ROAD_DECAY_AMOUNT = 100; - -/** - * @constant - * @type {number} - */ -const ROAD_DECAY_TIME = 1000; - -/** - * @constant - * @type {number} - */ -const LINK_HITS = 1000; - -/** - * @constant - * @type {number} - */ -const LINK_HITS_MAX = 1000; - -/** - * @constant - * @type {number} - */ -const LINK_CAPACITY = 800; - -/** - * @constant - * @type {number} - */ -const LINK_COOLDOWN = 1; - -/** - * @constant - * @type {number} - */ -const LINK_LOSS_RATIO = 0.03; - -/** - * @constant - * @type {number} - */ -const CONTAINER_HITS = 250000; - -/** - * @constant - * @type {number} - */ -const CONTAINER_CAPACITY = 2000; - -/** - * @constant - * @type {number} - */ -const CONTAINER_DECAY = 5000; - -/** - * @constant - * @type {number} - */ -const CONTAINER_DECAY_TIME = 100; - -/** - * @constant - * @type {number} - */ -const CONTAINER_DECAY_TIME_OWNED = 500; - -/** - * @constant - * @type {number} - */ -const NUKER_HITS = 1000; - -/** - * @constant - * @type {number} - */ -const NUKER_COOLDOWN = 100000; - -/** - * @constant - * @type {number} - */ -const NUKER_ENERGY_CAPACITY = 300000; - -/** - * @constant - * @type {number} - */ -const NUKER_GHODIUM_CAPACITY = 5000; - -/** - * @constant - * @type {number} - */ -const NUKE_LAND_TIME = 50000; - -/** - * @constant - * @type {number} - */ -const NUKE_RANGE = 10; - -/** - * @constant - * @type {object} - */ -const NUKE_DAMAGE = { - 0: 10000000, - 2: 5000000 -}; - -/** - * @constant - * @type {number} - */ -const PORTAL_DECAY = 30000; - -/** - * @constant - * @type {number} - */ -const TOMBSTONE_DECAY_PER_PART = 5; - -/** - * @constant - * @type {string} - */ -const ORDER_SELL = 'sell'; - -/** - * @constant - * @type {string} - */ -const ORDER_BUY = 'buy'; - -/** - * @constant - * @type {number} - */ -const STORAGE_CAPACITY = 1000000; - -/** - * @constant - * @type {number} - */ -const STORAGE_HITS = 10000; - -/** - * @constant - * @type {number} - */ -const CARRY_CAPACITY = 50; - -/** - * @constant - * @type {number} - */ -const HARVEST_POWER = 2; - -/** - * @constant - * @type {number} - */ -const HARVEST_MINERAL_POWER = 1; - -/** - * @constant - * @type {number} - */ -const REPAIR_POWER = 100; - -/** - * @constant - * @type {number} - */ -const DISMANTLE_POWER = 100; - -/** - * @constant - * @type {number} - */ -const BUILD_POWER = 5; - -/** - * @constant - * @type {number} - */ -const ATTACK_POWER = 30; - -/** - * @constant - * @type {number} - */ -const UPGRADE_CONTROLLER_POWER = 1; - -/** - * @constant - * @type {number} - */ -const RANGED_ATTACK_POWER = 10; - -/** - * @constant - * @type {number} - */ -const HEAL_POWER = 12; - -/** - * @constant - * @type {number} - */ -const RANGED_HEAL_POWER = 4; - -/** - * @constant - * @type {object} - */ -const CONSTRUCTION_COST = { - spawn: 15000, - extension: 3000, - road: 300, - constructedWall: 1, - rampart: 1, - link: 5000, - storage: 30000, - tower: 5000, - observer: 8000, - powerSpawn: 100000, - extractor: 5000, - lab: 50000, - terminal: 100000, - container: 5000, - nuker: 100000 -}; - -/** - * @constant - * @type {number} - */ -const CONSTRUCTION_COST_ROAD_SWAMP_RATIO = 5; - -/** - * @constant - * @type {object} - */ -const CONTROLLER_LEVELS = { - 1: 200, - 2: 45000, - 3: 135000, - 4: 405000, - 5: 1215000, - 6: 3645000, - 7: 10935000 -}; - -/** - * @constant - * @type {object} - */ -const CONTROLLER_STRUCTURES = { - spawn: { 0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 1, 6: 1, 7: 2, 8: 3 }, - extension: { 0: 0, 1: 0, 2: 5, 3: 10, 4: 20, 5: 30, 6: 40, 7: 50, 8: 60 }, - link: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 2, 6: 3, 7: 4, 8: 6 }, - road: { 0: 2500, 1: 2500, 2: 2500, 3: 2500, 4: 2500, 5: 2500, 6: 2500, 7: 2500, 8: 2500 }, - constructedWall: { 1: 0, 2: 2500, 3: 2500, 4: 2500, 5: 2500, 6: 2500, 7: 2500, 8: 2500 }, - rampart: { 1: 0, 2: 2500, 3: 2500, 4: 2500, 5: 2500, 6: 2500, 7: 2500, 8: 2500 }, - storage: { 1: 0, 2: 0, 3: 0, 4: 1, 5: 1, 6: 1, 7: 1, 8: 1 }, - tower: { 1: 0, 2: 0, 3: 1, 4: 1, 5: 1, 6: 2, 7: 2, 8: 4 }, - observer: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 1 }, - powerSpawn: { 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 0, 7: 0, 8: 1 } -}; - -/** - * @constant - * @type {object} - */ -const CONTROLLER_DOWNGRADE = { - 1: 20000, - 2: 5000, - 3: 10000, - 4: 20000, - 5: 40000, - 6: 60000, - 7: 100000, - 8: 150000 -}; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_DOWNGRADE_RESTORE = 100; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD = 5000; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_CLAIM_DOWNGRADE = 0.2; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_RESERVE = 1; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_RESERVE_MAX = 5000; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_MAX_UPGRADE_PER_TICK = 15; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_ATTACK_BLOCKED_UPGRADE = 1000; - -/** - * @constant - * @type {number} - */ -const CONTROLLER_NUKE_BLOCKED_UPGRADE = 200; - -/** - * @constant - * @type {number} - */ -const TERMINAL_CAPACITY = 300000; - -/** - * @constant - * @type {number} - */ -const TERMINAL_HITS = 3000; - -/** - * @constant - * @type {number} - */ -const TERMINAL_SEND_COST = 0.1; - -/** - * @constant - * @type {number} - */ -const TERMINAL_MIN_SEND = 100; - -/** - * @constant - * @type {number} - */ -const TOWER_HITS = 3000; - -/** - * @constant - * @type {number} - */ -const TOWER_CAPACITY = 1000; - -/** - * @constant - * @type {number} - */ -const TOWER_ENERGY_COST = 10; - -/** - * @constant - * @type {number} - */ -const TOWER_POWER_ATTACK = 600; - -/** - * @constant - * @type {number} - */ -const TOWER_POWER_HEAL = 400; - -/** - * @constant - * @type {number} - */ -const TOWER_POWER_REPAIR = 800; - -/** - * @constant - * @type {number} - */ -const TOWER_OPTIMAL_RANGE = 5; - -/** - * @constant - * @type {number} - */ -const TOWER_FALLOFF_RANGE = 20; - -/** - * @constant - * @type {number} - */ -const TOWER_FALLOFF = 0.75; - -/** - * @constant - * @type {number} - */ -const OBSERVER_HITS = 500; - -/** - * @constant - * @type {number} - */ -const OBSERVER_RANGE = 10; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_HITS = 2000000; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_CAPACITY_MAX = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_CAPACITY_MIN = 500; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_CAPACITY_CRIT = 0.3; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_DECAY = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_BANK_HIT_BACK = 0.5; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_HITS = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_ENERGY_CAPACITY = 5000; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_POWER_CAPACITY = 100; - -/** - * @constant - * @type {number} - */ -const POWER_SPAWN_ENERGY_RATIO = 50; - -/** - * @constant - * @type {number} - */ -const LAB_HITS = 500; - -/** - * @constant - * @type {number} - */ -const LAB_MINERAL_CAPACITY = 3000; - -/** - * @constant - * @type {number} - */ -const LAB_ENERGY_CAPACITY = 2000; - -/** - * @constant - * @type {number} - */ -const LAB_BOOST_ENERGY = 20; - -/** - * @constant - * @type {number} - */ -const LAB_BOOST_MINERAL = 30; - -/** - * @constant - * @type {number} - */ -const LAB_COOLDOWN = 10; - -/** - * @constant - * @type {number} - */ -const GCL_POW = 2.4; - -/** - * @constant - * @type {number} - */ -const GCL_MULTIPLY = 1000000; - -/** - * @constant - * @type {number} - */ -const GCL_NOVICE = 3; - -/** - * @constant - * @type {number} - */ -const TERRAIN_MASK_WALL = 1; - -/** - * @constant - * @type {number} - */ -const TERRAIN_MASK_SWAMP = 2; - -/** - * @constant - * @type {number} - */ -const TERRAIN_MASK_LAVA = 4; - -/** - * @constant - * @type {number} - */ -const MAX_CONSTRUCTION_SITES = 100; - -/** - * @constant - * @type {number} - */ -const MAX_CREEP_SIZE = 50; - -/** LOOK CONSTANTS **/ - -/** - * @constant - * @type {string} - */ -const LOOK_CREEPS = "creep"; - -/** - * @constant - * @type {string} - */ -const LOOK_ENERGY = "energy"; - -/** - * @constant - * @type {string} - */ -const LOOK_RESOURCES = "resource"; - -/** - * @constant - * @type {string} - */ -const LOOK_SOURCES = "source"; - -/** - * @constant - * @type {string} - */ -const LOOK_MINERALS = "mineral"; - -/** - * @constant - * @type {string} - */ -const LOOK_STRUCTURES = "structure"; - -/** - * @constant - * @type {string} - */ -const LOOK_FLAGS = "flag"; - -/** - * @constant - * @type {string} - */ -const LOOK_CONSTRUCTION_SITES = "constructionSite"; - -/** - * @constant - * @type {string} - */ -const LOOK_NUKES = "nuke"; - -/** - * @constant - * @type {string} - */ -const LOOK_TERRAIN = "terrain"; - -/** - * @constant - * @type {string} - */ -const LOOK_TOMBSTONES = "tombstone"; - -/** - * @constant - * @type {string} - */ -const SYSTEM_USERNAME = 'Screeps'; - -/** - * @constant - * @deprecated use SIGN_PLANNED_AREA instead. - * @type {string} - */ -const SIGN_NOVICE_AREA = 'A new Novice Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; - -/** - * @constant - * @deprecated use SIGN_PLANNED_AREA instead. - * @type {string} - */ -const SIGN_RESPAWN_AREA = 'A new Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; - -/** - * @constant - * @type {string} - */ -const SIGN_PLANNED_AREA = 'A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved.'; - -/** - * @constant - * @type {number} - */ -const TERMINAL_COOLDOWN = 10; - -/** - * @constant - * @type {number} - */ -const POWER_LEVEL_MULTIPLY = 1000; - -/** - * @constant - * @type {number} - */ -const POWER_LEVEL_POW = 2; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_SPAWN_COOLDOWN = 8*3600*1000; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_DELETE_COOLDOWN = 24*3600*1000; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_MAX_LEVEL = 25; - -/** - * @constant - * @type {number} - */ -const POWER_CREEP_LIFE_TIME = 5000; - -/** - * @constant - * @type {object} - */ -const POWER_CLASS = { OPERATOR: 'operator' }; - -/** - * @constant - * @type {number} - */ -const PWR_GENERATE_OPS = 1; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_SPAWN = 2; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_TOWER = 3; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_STORAGE = 4; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_LAB = 5; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_EXTENSION = 6; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_OBSERVER = 7; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_TERMINAL = 8; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_SPAWN = 9; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_TOWER = 10; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_SOURCE = 11; - -/** - * @constant - * @type {number} - */ -const PWR_SHIELD = 12; - -/** - * @constant - * @type {number} - */ -const PWR_REGEN_SOURCE = 13; - -/** - * @constant - * @type {number} - */ -const PWR_REGEN_MINERAL = 14; - -/** - * @constant - * @type {number} - */ -const PWR_DISRUPT_TERMINAL = 15; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_POWER = 16; - -/** - * @constant - * @type {number} - */ -const PWR_FORTIFY = 17; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_CONTROLLER = 18; - -/** - * @constant - * @type {number} - */ -const PWR_OPERATE_FACTORY = 19; - -/** - * @constant - * @type {object} - */ -const POWER_INFO = { - [exports.PWR_GENERATE_OPS]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 50, - effect: [1, 2, 4, 6, 8] - }, - [exports.PWR_OPERATE_SPAWN]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 300, - duration: 1000, - range: 3, - ops: 100, - effect: [0.9, 0.7, 0.5, 0.35, 0.2] - }, - [exports.PWR_OPERATE_TOWER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 10, - duration: 100, - range: 3, - ops: 10, - effect: [1.1, 1.2, 1.3, 1.4, 1.5] - }, - [exports.PWR_OPERATE_STORAGE]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 800, - duration: 1000, - range: 3, - ops: 100, - effect: [500000,1000000,2000000,4000000,7000000] - }, - [exports.PWR_OPERATE_LAB]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 50, - duration: 1000, - range: 3, - ops: 10, - effect: [2,4,6,8,10] - }, - [exports.PWR_OPERATE_EXTENSION]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 50, - range: 3, - ops: 2, - effect: [0.2, 0.4, 0.6, 0.8, 1.0] - }, - [exports.PWR_OPERATE_OBSERVER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 400, - duration: [200,400,600,800,1000], - range: 3, - ops: 10, - }, - [exports.PWR_OPERATE_TERMINAL]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 500, - duration: 1000, - range: 3, - ops: 100, - effect: [0.9, 0.8, 0.7, 0.6, 0.5] - }, - [exports.PWR_DISRUPT_SPAWN]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 5, - range: 20, - ops: 10, - duration: [1,2,3,4,5] - }, - [exports.PWR_DISRUPT_TOWER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 0, - duration: 5, - range: 3, - ops: 10, - effect: [0.9, 0.8, 0.7, 0.6, 0.5], - }, - [exports.PWR_DISRUPT_SOURCE]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 100, - range: 3, - ops: 100, - duration: [100, 200, 300, 400, 500] - }, - [exports.PWR_SHIELD]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - effect: [5000, 10000, 15000, 20000, 25000], - duration: 50, - cooldown: 20, - energy: 100, - }, - [exports.PWR_REGEN_SOURCE]: { - className: exports.POWER_CLASS.OPERATOR, - level: [10, 11, 12, 14, 22], - cooldown: 100, - duration: 300, - range: 3, - effect: [50,100,150,200,250], - period: 15 - }, - [exports.PWR_REGEN_MINERAL]: { - className: exports.POWER_CLASS.OPERATOR, - level: [10, 11, 12, 14, 22], - cooldown: 100, - duration: 100, - range: 3, - effect: [2,4,6,8,10], - period: 10 - }, - [exports.PWR_DISRUPT_TERMINAL]: { - className: exports.POWER_CLASS.OPERATOR, - level: [20, 21, 22, 23, 24], - cooldown: 8, - duration: 10, - range: 50, - ops: [50,40,30,20,10] - - }, - [exports.PWR_FORTIFY]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 5, - range: 3, - ops: 5, - duration: [1, 2, 3, 4, 5] - }, - [exports.PWR_OPERATE_POWER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [10, 11, 12, 14, 22], - cooldown: 1000, - range: 3, - duration: 800, - ops: 200, - effect: [1, 2, 3, 4, 5] - }, - [exports.PWR_OPERATE_CONTROLLER]: { - className: exports.POWER_CLASS.OPERATOR, - level: [20, 21, 22, 23, 24], - cooldown: 1000, - range: 3, - duration: 800, - ops: 200, - effect: [10, 20, 30, 40, 50] - }, - [exports.PWR_OPERATE_FACTORY]: { - className: exports.POWER_CLASS.OPERATOR, - level: [0, 2, 7, 14, 22], - cooldown: 1000, - range: 3, - duration: 800, - ops: 100 - }, - }; diff --git a/generateConstants.js b/generateConstants.js new file mode 100644 index 0000000..053d610 --- /dev/null +++ b/generateConstants.js @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +const https = require("https"); +const url = "https://raw.githubusercontent.com/screeps/common/master/lib/constants.js"; + +/** + * Fetches the constants library file from the master branch of the Screeps git repository, parses it, then generates + * and prints to stdout a file suitable for use as an autocomplete definition. + * + * USAGE: + * To dump the file contents to stdout: + * node generateConstantsFile.js + * + * @author jd0yle , + * @author CrystallDEV + */ +https.get(url, function (res) { + let body = ""; + + res.setEncoding("utf8"); + + res.on("data", data => { + body += data; + }); + + res.on("end", function () { + let fs = require("fs"); + let tmpFileName = "constants.tmp.js"; + + fs.writeFile(tmpFileName, body, function (err) { + let constants, autocompleteContent = ""; + + if (err) { + throw(err); + } + + constants = require(`./${tmpFileName}`); + + Object.keys(constants).forEach(function (key) { + autocompleteContent = `${autocompleteContent}\n\n/**\n * @constant\n * @type {${typeof constants[key]}}\n */`; + autocompleteContent = `${autocompleteContent}\nconst ${key} = ${JSON.stringify(constants[key], null, 4)};`; + }); + + console.log(autocompleteContent); + + fs.unlink(`./${tmpFileName}`, function (err) { + if (err) { + throw(err); + } + }); + }); + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index 7d7b525..f3180fc 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ }, "devDependencies": {}, "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "generateConstants": "node ./generateConstants.js> ./src/Global/Constants.js" }, "repository": { "type": "git", diff --git a/ConstructionSite.js b/src/ConstructionSite.js similarity index 100% rename from ConstructionSite.js rename to src/ConstructionSite.js diff --git a/Creep.js b/src/Creep.js similarity index 100% rename from Creep.js rename to src/Creep.js diff --git a/src/Deposit.js b/src/Deposit.js new file mode 100644 index 0000000..9df59a7 --- /dev/null +++ b/src/Deposit.js @@ -0,0 +1,51 @@ +/** + * A rare resource deposit needed for producing commodities. Can be harvested by creeps with a WORK body part. Each + * harvest operation triggers a cooldown period, which becomes longer and longer over time. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Deposit} + */ +Deposit = function () { +}; + +Deposit.prototype = { + + /** + * The amount of game ticks until the next harvest action is possible. + * + * @see {@link https://docs.screeps.com/api/#Deposit.cooldown} + * + * @return {number} + */ + cooldown: 0, + + /** + * The deposit type + * @see {@link https://docs.screeps.com/api/#Deposit.depositType} + * + * @return {string|RESOURCE_MIST|RESOURCE_BIOMASS|RESOURCE_METAL|RESOURCE_SILICON} + */ + depositType: "", + + /** + * The cooldown of the last harvest operation on this deposit. + * + * @see {@link https://docs.screeps.com/api/#Deposit.lastCooldown} + * + * @return {number} + */ + lastCooldown: 0, + + /** + * The amount of game ticks when this deposit will disappear. + * + * @see {@link https://docs.screeps.com/api/#Deposit.ticksToDecay} + * + * @return {number} + */ + ticksToDecay: 0, + + +}; diff --git a/Flag.js b/src/Flag.js similarity index 100% rename from Flag.js rename to src/Flag.js diff --git a/Game.js b/src/Game.js similarity index 82% rename from Game.js rename to src/Game.js index d2c56fa..fa91e5e 100644 --- a/Game.js +++ b/src/Game.js @@ -69,20 +69,23 @@ Game = { "externally_allocated_size": 38430000 } */ - getHeapStatistics: function() {}, + getHeapStatistics: function () { + }, /** * Get amount of CPU time used from the beginning of the current game tick. Always returns 0 in the Simulation mode. * * @return {number} Returns the currently used CPU time as a float number */ - getUsed: function () {}, + getUsed: function () { + }, /** * This method is only available when Virtual machine is set to Isolated in your account runtime settings. * Reset your runtime environment and wipe all data in heap memory. */ - halt: function() {}, + halt: function () { + }, /** * Allocate CPU limits to different shards. Total amount of CPU should remain equal to Game.cpu.shardLimits. This method can be used only once per 12 hours. @@ -90,7 +93,8 @@ Game = { * * @return {OK|ERR_BUSY|ERR_INVALID_ARGS} */ - setShardLimits: function(limits) {}, + setShardLimits: function (limits) { + }, }, @@ -200,7 +204,7 @@ Game = { * @param {string} roomName The room name. * * @return {null|object} The exits information in the following format, or null if the room not found. - { + { "1": "W8N4", // TOP "3": "W7N3", // RIGHT "5": "W8N2", // BOTTOM @@ -212,7 +216,8 @@ Game = { * @example * var exits = Game.map.describeExits('W8N3'); */ - describeExits: function (roomName) {}, + describeExits: function (roomName) { + }, /** * Find the exit direction from the given room en route to another room. @@ -226,7 +231,8 @@ Game = { * * @see {@link http://support.screeps.com/hc/en-us/articles/203079191-Map#findExit} */ - findExit: function (fromRoom, toRoom, opts) {}, + findExit: function (fromRoom, toRoom, opts) { + }, /** * Find route from the given room to another room. @@ -241,12 +247,13 @@ Game = { * @param {function} [opts.routeCallback] This callback accepts two arguments: function(roomName, fromRoomName). It can be used to calculate the cost of entering that room. You can use this to do things like prioritize your own rooms, or avoid some rooms. You can return a floating point cost or Infinity to block the room. * * @return {Array|number|ERR_NO_PATH} The route array in the following format: - [ - { exit: FIND_EXIT_RIGHT, room: 'arena21' }, - { exit: FIND_EXIT_BOTTOM, room: 'arena22' } - ] + [ + { exit: FIND_EXIT_RIGHT, room: 'arena21' }, + { exit: FIND_EXIT_BOTTOM, room: 'arena22' } + ] */ - findRoute: function (fromRoom, toRoom, opts) {}, + findRoute: function (fromRoom, toRoom, opts) { + }, /** * Get the linear distance (in rooms) between two rooms. @@ -262,7 +269,8 @@ Game = { * * @return {number} A number of rooms between the given two rooms. */ - getRoomLinearDistance: function (roomName1, roomName2, continuous) {}, + getRoomLinearDistance: function (roomName1, roomName2, continuous) { + }, /** * Get a Room.Terrain object which provides fast access to static terrain data. This method works for any room in the world even if you have no access to it. @@ -275,7 +283,8 @@ Game = { * * @return {Room.Terrain} Returns new Room.Terrain object. */ - getRoomTerrain: function(roomName) {}, + getRoomTerrain: function (roomName) { + }, /** * Get terrain type at the specified room position. @@ -296,7 +305,8 @@ Game = { * * @return {"plain"|"swamp"|"wall"} */ - getTerrainAt: function (x, y, roomName) {}, + getTerrainAt: function (x, y, roomName) { + }, /** * Check if the room with the given name is available to move into @@ -309,20 +319,21 @@ Game = { * * @return {boolean} */ - isRoomAvailable: function (roomName) {} + isRoomAvailable: function (roomName) { + } }, /** * A global object representing the in-game market. * - * @see {@link http://support.screeps.com/hc/en-us/articles/203016382-Game#market} - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market} - * @see {@link http://docs.screeps.com/market.html} + * @see {@link https://docs.screeps.com/api/#Game.market} */ market: { /** * Your current credits balance. * + * @see {@link https://docs.screeps.com/api/#Game.market.credits} + * * @type {number} */ credits: 0, @@ -345,7 +356,7 @@ Game = { price : 2.95 } }] - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#incomingTransactions} + * @see {@link https://docs.screeps.com/api/#Game.market.incomingTransactions} * * @type {Array} */ @@ -369,7 +380,7 @@ Game = { price : 2.95 } }] - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#outgoingTransactions} + * @see {@link https://docs.screeps.com/api/#Game.market.outgoingTransactions} * * @type {Array} */ @@ -414,7 +425,7 @@ Game = { price : 50000 } } - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#orders} + * @see {@link https://docs.screeps.com/api/#Game.market.orders} * * @type {Array} */ @@ -424,7 +435,7 @@ Game = { * Estimate the energy transaction cost of StructureTerminal.send and Market.deal methods. * The formula: Math.ceil( amount * ( Math.log( 0.1 * linearDistanceBetweenRooms + 0.9) + 0.1) ) * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#calcTransactionCost} + * @see {@link https://docs.screeps.com/api/#Game.market.calcTransactionCost} * * @type {function} * @@ -438,12 +449,9 @@ Game = { }, /** - * This method is still under development. - * Cancel a previously created order. - * If a buy order provided, then the reserved credits amount will be refunded in full. - * The 5% fee is not returned. + * Cancel a previously created order. The 5% fee is not returned * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#cancelOrder} + * @see {@link https://docs.screeps.com/api/#Game.market.cancelOrder} * * @type {function} * @@ -469,37 +477,41 @@ Game = { * Create a market order in your terminal. * You will be charged price * amount * 0.05 credits when the order is placed. * The maximum orders count is 50 per player. - * You can create an order at any time with any amount, it will be automatically activated and deactivated depending on the resource/credits availability. + * You can create an order at any time with any amount, it will be automatically activated and deactivated + * depending on the resource/credits availability. * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#createBuyOrder} + * @see {@link https://docs.screeps.com/api/#Game.market.createOrder} * * @type {function} - * - * @param {string|ORDER_SELL|ORDER_BUY} type The order type, either ORDER_SELL or ORDER_BUY. - * @param {string} resourceType Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. - * @param {number} price The price for one resource unit in credits. Can be a decimal number. - * @param {number} totalAmount The amount of resources to be traded in total. - * @param {string} [roomName] The room where your order will be created. You must have your own Terminal structure in this room, otherwise the created order will be temporary inactive. This argument is not used when resourceType equals to GAMETIME_TOKEN. - * - * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} - */ - createOrder: function (type, resourceType, price, totalAmount, roomName) { + *@param {Object} params An Object with the following parameters: + * {string|ORDER_SELL|ORDER_BUY} type The order type, either ORDER_SELL or ORDER_BUY. + * {string} resourceType Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN. + * {number} price The price for one resource unit in credits. Can be a decimal number. + * {number} totalAmount The amount of resources to be traded in total. + * (optional){string} [roomName] The room where your order will be created. You must have your own + * Terminal structure in this room, otherwise the created order will be temporary inactive. + * This argument is not used when resourceType equals to GAMETIME_TOKEN. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} + */ + createOrder: function (params) { }, /** - * Execute a trade deal from your Terminal in yourRoomName to another player's Terminal using the specified buy/sell order. - * Your Terminal will be charged energy units of transfer cost regardless of the order resource type. - * You can use Game.market.calcTransactionCost method to estimate it. - * When multiple players try to execute the same deal, the one with the shortest distance takes precedence. - * You cannot execute more than 10 deals during one tick. + * Execute a trade deal from your Terminal in yourRoomName to another player's Terminal using the specified + * buy/sell order. Your Terminal will be charged energy units of transfer cost regardless of the order resource + * type. You can use Game.market.calcTransactionCost method to estimate it. When multiple players try to execute + * the same deal, the one with the shortest distance takes precedence.You cannot execute more than 10 deals + * during one tick. * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#deal} + * @see {@link https://docs.screeps.com/api/#Game.market.deal} * * @type {function} * * @param {string} orderId The order ID as provided in Game.market.getAllOrders * @param {number} amount The amount of resources to transfer. - * @param {string} [yourRoomName] The name of your room which has to contain an active Terminal with enough amount of energy. This argument is not used when the order resource type equals to SUBSCRIPTION_TOKEN. + * @param {string} [yourRoomName] The name of your room which has to contain an active Terminal with enough + * amount of energy. This argument is not used when the order resource type equals to SUBSCRIPTION_TOKEN. * * @return {number|OK|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} */ @@ -507,11 +519,10 @@ Game = { }, /** - * This method is still under development. - * Add more capacity to an existing order. It will affect remainingAmount and totalAmount properties. You will - * be charged price*addAmount*0.05 credits. + * Add more capacity to an existing order. It will affect remainingAmount and totalAmount properties. + * You will be charged price*addAmount*0.05 credits. * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#extendOrder} + * @see {@link https://docs.screeps.com/api/#Game.market.extendOrder} * * @type {function} * @@ -524,14 +535,13 @@ Game = { }, /** - * This method is still under development. * Get other players' orders currently active on the market. * * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#getAllOrders} * * @type {function} * - * @param {object|function} [filter] An object or function that will filter the resulting list using the lodash.filter method. + * @param {object|function} [filter] (optional) An object or function that will filter the resulting list using the lodash.filter method. * * @return {Array} An array of Orders */ @@ -539,10 +549,31 @@ Game = { }, /** - * This method is still under development. + * Get daily price history of the specified resource on the market for the last 14 days. + * + * @see {@link https://docs.screeps.com/api/#Game.market.getHistory} + * + * @type {function} + * + * @param {string} resourceType - One of the RESOURCE_* constants. If undefined, returns history data for all resources. + * + * @return {Array} with the following format: + * [{ + * "resourceType": "L", + * "date": "2019-06-24", + * "transactions": 4, + * "volume": 400, + * "avgPrice": 3.63, + * "stddevPrice": 0.27 + * }] + */ + getHistory: function (resourceType) { + }, + + /** * Retrieve info for specific market order. * - * @see {@link http://support.screeps.com/hc/en-us/articles/207928635-Market#getOrderById} + * @see {@link https://docs.screeps.com/api/#Game.market.getOrderById} * * @type {function} * diff --git a/src/Global/Constants.js b/src/Global/Constants.js new file mode 100644 index 0000000..7ba51e5 --- /dev/null +++ b/src/Global/Constants.js @@ -0,0 +1,4013 @@ + + +/** + * @constant + * @type {number} + */ +const OK = 0; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_OWNER = -1; + +/** + * @constant + * @type {number} + */ +const ERR_NO_PATH = -2; + +/** + * @constant + * @type {number} + */ +const ERR_NAME_EXISTS = -3; + +/** + * @constant + * @type {number} + */ +const ERR_BUSY = -4; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_FOUND = -5; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_ENOUGH_ENERGY = -6; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_ENOUGH_RESOURCES = -6; + +/** + * @constant + * @type {number} + */ +const ERR_INVALID_TARGET = -7; + +/** + * @constant + * @type {number} + */ +const ERR_FULL = -8; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_IN_RANGE = -9; + +/** + * @constant + * @type {number} + */ +const ERR_INVALID_ARGS = -10; + +/** + * @constant + * @type {number} + */ +const ERR_TIRED = -11; + +/** + * @constant + * @type {number} + */ +const ERR_NO_BODYPART = -12; + +/** + * @constant + * @type {number} + */ +const ERR_NOT_ENOUGH_EXTENSIONS = -6; + +/** + * @constant + * @type {number} + */ +const ERR_RCL_NOT_ENOUGH = -14; + +/** + * @constant + * @type {number} + */ +const ERR_GCL_NOT_ENOUGH = -15; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_TOP = 1; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_RIGHT = 3; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_BOTTOM = 5; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT_LEFT = 7; + +/** + * @constant + * @type {number} + */ +const FIND_EXIT = 10; + +/** + * @constant + * @type {number} + */ +const FIND_CREEPS = 101; + +/** + * @constant + * @type {number} + */ +const FIND_MY_CREEPS = 102; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_CREEPS = 103; + +/** + * @constant + * @type {number} + */ +const FIND_SOURCES_ACTIVE = 104; + +/** + * @constant + * @type {number} + */ +const FIND_SOURCES = 105; + +/** + * @constant + * @type {number} + */ +const FIND_DROPPED_RESOURCES = 106; + +/** + * @constant + * @type {number} + */ +const FIND_STRUCTURES = 107; + +/** + * @constant + * @type {number} + */ +const FIND_MY_STRUCTURES = 108; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_STRUCTURES = 109; + +/** + * @constant + * @type {number} + */ +const FIND_FLAGS = 110; + +/** + * @constant + * @type {number} + */ +const FIND_CONSTRUCTION_SITES = 111; + +/** + * @constant + * @type {number} + */ +const FIND_MY_SPAWNS = 112; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_SPAWNS = 113; + +/** + * @constant + * @type {number} + */ +const FIND_MY_CONSTRUCTION_SITES = 114; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_CONSTRUCTION_SITES = 115; + +/** + * @constant + * @type {number} + */ +const FIND_MINERALS = 116; + +/** + * @constant + * @type {number} + */ +const FIND_NUKES = 117; + +/** + * @constant + * @type {number} + */ +const FIND_TOMBSTONES = 118; + +/** + * @constant + * @type {number} + */ +const FIND_POWER_CREEPS = 119; + +/** + * @constant + * @type {number} + */ +const FIND_MY_POWER_CREEPS = 120; + +/** + * @constant + * @type {number} + */ +const FIND_HOSTILE_POWER_CREEPS = 121; + +/** + * @constant + * @type {number} + */ +const FIND_DEPOSITS = 122; + +/** + * @constant + * @type {number} + */ +const FIND_RUINS = 123; + +/** + * @constant + * @type {number} + */ +const TOP = 1; + +/** + * @constant + * @type {number} + */ +const TOP_RIGHT = 2; + +/** + * @constant + * @type {number} + */ +const RIGHT = 3; + +/** + * @constant + * @type {number} + */ +const BOTTOM_RIGHT = 4; + +/** + * @constant + * @type {number} + */ +const BOTTOM = 5; + +/** + * @constant + * @type {number} + */ +const BOTTOM_LEFT = 6; + +/** + * @constant + * @type {number} + */ +const LEFT = 7; + +/** + * @constant + * @type {number} + */ +const TOP_LEFT = 8; + +/** + * @constant + * @type {number} + */ +const COLOR_RED = 1; + +/** + * @constant + * @type {number} + */ +const COLOR_PURPLE = 2; + +/** + * @constant + * @type {number} + */ +const COLOR_BLUE = 3; + +/** + * @constant + * @type {number} + */ +const COLOR_CYAN = 4; + +/** + * @constant + * @type {number} + */ +const COLOR_GREEN = 5; + +/** + * @constant + * @type {number} + */ +const COLOR_YELLOW = 6; + +/** + * @constant + * @type {number} + */ +const COLOR_ORANGE = 7; + +/** + * @constant + * @type {number} + */ +const COLOR_BROWN = 8; + +/** + * @constant + * @type {number} + */ +const COLOR_GREY = 9; + +/** + * @constant + * @type {number} + */ +const COLOR_WHITE = 10; + +/** + * @constant + * @type {string} + */ +const LOOK_CREEPS = "creep"; + +/** + * @constant + * @type {string} + */ +const LOOK_ENERGY = "energy"; + +/** + * @constant + * @type {string} + */ +const LOOK_RESOURCES = "resource"; + +/** + * @constant + * @type {string} + */ +const LOOK_SOURCES = "source"; + +/** + * @constant + * @type {string} + */ +const LOOK_MINERALS = "mineral"; + +/** + * @constant + * @type {string} + */ +const LOOK_DEPOSITS = "deposit"; + +/** + * @constant + * @type {string} + */ +const LOOK_STRUCTURES = "structure"; + +/** + * @constant + * @type {string} + */ +const LOOK_FLAGS = "flag"; + +/** + * @constant + * @type {string} + */ +const LOOK_CONSTRUCTION_SITES = "constructionSite"; + +/** + * @constant + * @type {string} + */ +const LOOK_NUKES = "nuke"; + +/** + * @constant + * @type {string} + */ +const LOOK_TERRAIN = "terrain"; + +/** + * @constant + * @type {string} + */ +const LOOK_TOMBSTONES = "tombstone"; + +/** + * @constant + * @type {string} + */ +const LOOK_POWER_CREEPS = "powerCreep"; + +/** + * @constant + * @type {string} + */ +const LOOK_RUINS = "ruin"; + +/** + * @constant + * @type {object} + */ +const OBSTACLE_OBJECT_TYPES = [ + "spawn", + "creep", + "powerCreep", + "source", + "mineral", + "deposit", + "controller", + "constructedWall", + "extension", + "link", + "storage", + "tower", + "observer", + "powerSpawn", + "powerBank", + "lab", + "terminal", + "nuker", + "factory", + "invaderCore" +]; + +/** + * @constant + * @type {string} + */ +const MOVE = "move"; + +/** + * @constant + * @type {string} + */ +const WORK = "work"; + +/** + * @constant + * @type {string} + */ +const CARRY = "carry"; + +/** + * @constant + * @type {string} + */ +const ATTACK = "attack"; + +/** + * @constant + * @type {string} + */ +const RANGED_ATTACK = "ranged_attack"; + +/** + * @constant + * @type {string} + */ +const TOUGH = "tough"; + +/** + * @constant + * @type {string} + */ +const HEAL = "heal"; + +/** + * @constant + * @type {string} + */ +const CLAIM = "claim"; + +/** + * @constant + * @type {object} + */ +const BODYPART_COST = { + "move": 50, + "work": 100, + "attack": 80, + "carry": 50, + "heal": 250, + "ranged_attack": 150, + "tough": 10, + "claim": 600 +}; + +/** + * @constant + * @type {number} + */ +const WORLD_WIDTH = 202; + +/** + * @constant + * @type {number} + */ +const WORLD_HEIGHT = 202; + +/** + * @constant + * @type {number} + */ +const CREEP_LIFE_TIME = 1500; + +/** + * @constant + * @type {number} + */ +const CREEP_CLAIM_LIFE_TIME = 600; + +/** + * @constant + * @type {number} + */ +const CREEP_CORPSE_RATE = 0.2; + +/** + * @constant + * @type {number} + */ +const CREEP_PART_MAX_ENERGY = 125; + +/** + * @constant + * @type {number} + */ +const CARRY_CAPACITY = 50; + +/** + * @constant + * @type {number} + */ +const HARVEST_POWER = 2; + +/** + * @constant + * @type {number} + */ +const HARVEST_MINERAL_POWER = 1; + +/** + * @constant + * @type {number} + */ +const HARVEST_DEPOSIT_POWER = 1; + +/** + * @constant + * @type {number} + */ +const REPAIR_POWER = 100; + +/** + * @constant + * @type {number} + */ +const DISMANTLE_POWER = 50; + +/** + * @constant + * @type {number} + */ +const BUILD_POWER = 5; + +/** + * @constant + * @type {number} + */ +const ATTACK_POWER = 30; + +/** + * @constant + * @type {number} + */ +const UPGRADE_CONTROLLER_POWER = 1; + +/** + * @constant + * @type {number} + */ +const RANGED_ATTACK_POWER = 10; + +/** + * @constant + * @type {number} + */ +const HEAL_POWER = 12; + +/** + * @constant + * @type {number} + */ +const RANGED_HEAL_POWER = 4; + +/** + * @constant + * @type {number} + */ +const REPAIR_COST = 0.01; + +/** + * @constant + * @type {number} + */ +const DISMANTLE_COST = 0.005; + +/** + * @constant + * @type {number} + */ +const RAMPART_DECAY_AMOUNT = 300; + +/** + * @constant + * @type {number} + */ +const RAMPART_DECAY_TIME = 100; + +/** + * @constant + * @type {number} + */ +const RAMPART_HITS = 1; + +/** + * @constant + * @type {object} + */ +const RAMPART_HITS_MAX = { + "2": 300000, + "3": 1000000, + "4": 3000000, + "5": 10000000, + "6": 30000000, + "7": 100000000, + "8": 300000000 +}; + +/** + * @constant + * @type {number} + */ +const ENERGY_REGEN_TIME = 300; + +/** + * @constant + * @type {number} + */ +const ENERGY_DECAY = 1000; + +/** + * @constant + * @type {number} + */ +const SPAWN_HITS = 5000; + +/** + * @constant + * @type {number} + */ +const SPAWN_ENERGY_START = 300; + +/** + * @constant + * @type {number} + */ +const SPAWN_ENERGY_CAPACITY = 300; + +/** + * @constant + * @type {number} + */ +const CREEP_SPAWN_TIME = 3; + +/** + * @constant + * @type {number} + */ +const SPAWN_RENEW_RATIO = 1.2; + +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_CAPACITY = 3000; + +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_NEUTRAL_CAPACITY = 1500; + +/** + * @constant + * @type {number} + */ +const SOURCE_ENERGY_KEEPER_CAPACITY = 4000; + +/** + * @constant + * @type {number} + */ +const WALL_HITS = 1; + +/** + * @constant + * @type {number} + */ +const WALL_HITS_MAX = 300000000; + +/** + * @constant + * @type {number} + */ +const EXTENSION_HITS = 1000; + +/** + * @constant + * @type {object} + */ +const EXTENSION_ENERGY_CAPACITY = { + "0": 50, + "1": 50, + "2": 50, + "3": 50, + "4": 50, + "5": 50, + "6": 50, + "7": 100, + "8": 200 +}; + +/** + * @constant + * @type {number} + */ +const ROAD_HITS = 5000; + +/** + * @constant + * @type {number} + */ +const ROAD_WEAROUT = 1; + +/** + * @constant + * @type {number} + */ +const ROAD_WEAROUT_POWER_CREEP = 100; + +/** + * @constant + * @type {number} + */ +const ROAD_DECAY_AMOUNT = 100; + +/** + * @constant + * @type {number} + */ +const ROAD_DECAY_TIME = 1000; + +/** + * @constant + * @type {number} + */ +const LINK_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const LINK_HITS_MAX = 1000; + +/** + * @constant + * @type {number} + */ +const LINK_CAPACITY = 800; + +/** + * @constant + * @type {number} + */ +const LINK_COOLDOWN = 1; + +/** + * @constant + * @type {number} + */ +const LINK_LOSS_RATIO = 0.03; + +/** + * @constant + * @type {number} + */ +const STORAGE_CAPACITY = 1000000; + +/** + * @constant + * @type {number} + */ +const STORAGE_HITS = 10000; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_SPAWN = "spawn"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_EXTENSION = "extension"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_ROAD = "road"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_WALL = "constructedWall"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_RAMPART = "rampart"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_KEEPER_LAIR = "keeperLair"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_PORTAL = "portal"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_CONTROLLER = "controller"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_LINK = "link"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_STORAGE = "storage"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_TOWER = "tower"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_OBSERVER = "observer"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_POWER_BANK = "powerBank"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_POWER_SPAWN = "powerSpawn"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_EXTRACTOR = "extractor"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_LAB = "lab"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_TERMINAL = "terminal"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_CONTAINER = "container"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_NUKER = "nuker"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_FACTORY = "factory"; + +/** + * @constant + * @type {string} + */ +const STRUCTURE_INVADER_CORE = "invaderCore"; + +/** + * @constant + * @type {object} + */ +const CONSTRUCTION_COST = { + "spawn": 15000, + "extension": 3000, + "road": 300, + "constructedWall": 1, + "rampart": 1, + "link": 5000, + "storage": 30000, + "tower": 5000, + "observer": 8000, + "powerSpawn": 100000, + "extractor": 5000, + "lab": 50000, + "terminal": 100000, + "container": 5000, + "nuker": 100000, + "factory": 100000 +}; + +/** + * @constant + * @type {number} + */ +const CONSTRUCTION_COST_ROAD_SWAMP_RATIO = 5; + +/** + * @constant + * @type {number} + */ +const CONSTRUCTION_COST_ROAD_WALL_RATIO = 150; + +/** + * @constant + * @type {object} + */ +const CONTROLLER_LEVELS = { + "1": 200, + "2": 45000, + "3": 135000, + "4": 405000, + "5": 1215000, + "6": 3645000, + "7": 10935000 +}; + +/** + * @constant + * @type {object} + */ +const CONTROLLER_STRUCTURES = { + "spawn": { + "0": 0, + "1": 1, + "2": 1, + "3": 1, + "4": 1, + "5": 1, + "6": 1, + "7": 2, + "8": 3 + }, + "extension": { + "0": 0, + "1": 0, + "2": 5, + "3": 10, + "4": 20, + "5": 30, + "6": 40, + "7": 50, + "8": 60 + }, + "link": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 2, + "6": 3, + "7": 4, + "8": 6 + }, + "road": { + "0": 2500, + "1": 2500, + "2": 2500, + "3": 2500, + "4": 2500, + "5": 2500, + "6": 2500, + "7": 2500, + "8": 2500 + }, + "constructedWall": { + "1": 0, + "2": 2500, + "3": 2500, + "4": 2500, + "5": 2500, + "6": 2500, + "7": 2500, + "8": 2500 + }, + "rampart": { + "1": 0, + "2": 2500, + "3": 2500, + "4": 2500, + "5": 2500, + "6": 2500, + "7": 2500, + "8": 2500 + }, + "storage": { + "1": 0, + "2": 0, + "3": 0, + "4": 1, + "5": 1, + "6": 1, + "7": 1, + "8": 1 + }, + "tower": { + "1": 0, + "2": 0, + "3": 1, + "4": 1, + "5": 2, + "6": 2, + "7": 3, + "8": 6 + }, + "observer": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 1 + }, + "powerSpawn": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 1 + }, + "extractor": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 1, + "7": 1, + "8": 1 + }, + "terminal": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 1, + "7": 1, + "8": 1 + }, + "lab": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 3, + "7": 6, + "8": 10 + }, + "container": { + "0": 5, + "1": 5, + "2": 5, + "3": 5, + "4": 5, + "5": 5, + "6": 5, + "7": 5, + "8": 5 + }, + "nuker": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 0, + "8": 1 + }, + "factory": { + "1": 0, + "2": 0, + "3": 0, + "4": 0, + "5": 0, + "6": 0, + "7": 1, + "8": 1 + } +}; + +/** + * @constant + * @type {object} + */ +const CONTROLLER_DOWNGRADE = { + "1": 20000, + "2": 10000, + "3": 20000, + "4": 40000, + "5": 80000, + "6": 120000, + "7": 150000, + "8": 200000 +}; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_RESTORE = 100; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_DOWNGRADE_SAFEMODE_THRESHOLD = 5000; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_CLAIM_DOWNGRADE = 300; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_RESERVE = 1; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_RESERVE_MAX = 5000; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_MAX_UPGRADE_PER_TICK = 15; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_ATTACK_BLOCKED_UPGRADE = 1000; + +/** + * @constant + * @type {number} + */ +const CONTROLLER_NUKE_BLOCKED_UPGRADE = 200; + +/** + * @constant + * @type {number} + */ +const SAFE_MODE_DURATION = 20000; + +/** + * @constant + * @type {number} + */ +const SAFE_MODE_COOLDOWN = 50000; + +/** + * @constant + * @type {number} + */ +const SAFE_MODE_COST = 1000; + +/** + * @constant + * @type {number} + */ +const TOWER_HITS = 3000; + +/** + * @constant + * @type {number} + */ +const TOWER_CAPACITY = 1000; + +/** + * @constant + * @type {number} + */ +const TOWER_ENERGY_COST = 10; + +/** + * @constant + * @type {number} + */ +const TOWER_POWER_ATTACK = 600; + +/** + * @constant + * @type {number} + */ +const TOWER_POWER_HEAL = 400; + +/** + * @constant + * @type {number} + */ +const TOWER_POWER_REPAIR = 800; + +/** + * @constant + * @type {number} + */ +const TOWER_OPTIMAL_RANGE = 5; + +/** + * @constant + * @type {number} + */ +const TOWER_FALLOFF_RANGE = 20; + +/** + * @constant + * @type {number} + */ +const TOWER_FALLOFF = 0.75; + +/** + * @constant + * @type {number} + */ +const OBSERVER_HITS = 500; + +/** + * @constant + * @type {number} + */ +const OBSERVER_RANGE = 10; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_HITS = 2000000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_CAPACITY_MAX = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_CAPACITY_MIN = 500; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_CAPACITY_CRIT = 0.3; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_DECAY = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_HIT_BACK = 0.5; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_HITS = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_ENERGY_CAPACITY = 5000; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_POWER_CAPACITY = 100; + +/** + * @constant + * @type {number} + */ +const POWER_SPAWN_ENERGY_RATIO = 50; + +/** + * @constant + * @type {number} + */ +const EXTRACTOR_HITS = 500; + +/** + * @constant + * @type {number} + */ +const EXTRACTOR_COOLDOWN = 5; + +/** + * @constant + * @type {number} + */ +const LAB_HITS = 500; + +/** + * @constant + * @type {number} + */ +const LAB_MINERAL_CAPACITY = 3000; + +/** + * @constant + * @type {number} + */ +const LAB_ENERGY_CAPACITY = 2000; + +/** + * @constant + * @type {number} + */ +const LAB_BOOST_ENERGY = 20; + +/** + * @constant + * @type {number} + */ +const LAB_BOOST_MINERAL = 30; + +/** + * @constant + * @type {number} + */ +const LAB_COOLDOWN = 10; + +/** + * @constant + * @type {number} + */ +const LAB_REACTION_AMOUNT = 5; + +/** + * @constant + * @type {number} + */ +const LAB_UNBOOST_ENERGY = 0; + +/** + * @constant + * @type {number} + */ +const LAB_UNBOOST_MINERAL = 15; + +/** + * @constant + * @type {number} + */ +const GCL_POW = 2.4; + +/** + * @constant + * @type {number} + */ +const GCL_MULTIPLY = 1000000; + +/** + * @constant + * @type {number} + */ +const GCL_NOVICE = 3; + +/** + * @constant + * @type {object} + */ +const MODE_SIMULATION = null; + +/** + * @constant + * @type {object} + */ +const MODE_WORLD = null; + +/** + * @constant + * @type {number} + */ +const TERRAIN_MASK_WALL = 1; + +/** + * @constant + * @type {number} + */ +const TERRAIN_MASK_SWAMP = 2; + +/** + * @constant + * @type {number} + */ +const TERRAIN_MASK_LAVA = 4; + +/** + * @constant + * @type {number} + */ +const MAX_CONSTRUCTION_SITES = 100; + +/** + * @constant + * @type {number} + */ +const MAX_CREEP_SIZE = 50; + +/** + * @constant + * @type {number} + */ +const MINERAL_REGEN_TIME = 50000; + +/** + * @constant + * @type {object} + */ +const MINERAL_MIN_AMOUNT = { + "H": 35000, + "O": 35000, + "L": 35000, + "K": 35000, + "Z": 35000, + "U": 35000, + "X": 35000 +}; + +/** + * @constant + * @type {number} + */ +const MINERAL_RANDOM_FACTOR = 2; + +/** + * @constant + * @type {object} + */ +const MINERAL_DENSITY = { + "1": 15000, + "2": 35000, + "3": 70000, + "4": 100000 +}; + +/** + * @constant + * @type {object} + */ +const MINERAL_DENSITY_PROBABILITY = { + "1": 0.1, + "2": 0.5, + "3": 0.9, + "4": 1 +}; + +/** + * @constant + * @type {number} + */ +const MINERAL_DENSITY_CHANGE = 0.05; + +/** + * @constant + * @type {number} + */ +const DENSITY_LOW = 1; + +/** + * @constant + * @type {number} + */ +const DENSITY_MODERATE = 2; + +/** + * @constant + * @type {number} + */ +const DENSITY_HIGH = 3; + +/** + * @constant + * @type {number} + */ +const DENSITY_ULTRA = 4; + +/** + * @constant + * @type {number} + */ +const DEPOSIT_EXHAUST_MULTIPLY = 0.001; + +/** + * @constant + * @type {number} + */ +const DEPOSIT_EXHAUST_POW = 1.2; + +/** + * @constant + * @type {number} + */ +const DEPOSIT_DECAY_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_CAPACITY = 300000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_HITS = 3000; + +/** + * @constant + * @type {number} + */ +const TERMINAL_SEND_COST = 0.1; + +/** + * @constant + * @type {number} + */ +const TERMINAL_MIN_SEND = 100; + +/** + * @constant + * @type {number} + */ +const TERMINAL_COOLDOWN = 10; + +/** + * @constant + * @type {number} + */ +const CONTAINER_HITS = 250000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_CAPACITY = 2000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY = 5000; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY_TIME = 100; + +/** + * @constant + * @type {number} + */ +const CONTAINER_DECAY_TIME_OWNED = 500; + +/** + * @constant + * @type {number} + */ +const NUKER_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const NUKER_COOLDOWN = 100000; + +/** + * @constant + * @type {number} + */ +const NUKER_ENERGY_CAPACITY = 300000; + +/** + * @constant + * @type {number} + */ +const NUKER_GHODIUM_CAPACITY = 5000; + +/** + * @constant + * @type {number} + */ +const NUKE_LAND_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const NUKE_RANGE = 10; + +/** + * @constant + * @type {object} + */ +const NUKE_DAMAGE = { + "0": 10000000, + "2": 5000000 +}; + +/** + * @constant + * @type {number} + */ +const FACTORY_HITS = 1000; + +/** + * @constant + * @type {number} + */ +const FACTORY_CAPACITY = 50000; + +/** + * @constant + * @type {number} + */ +const TOMBSTONE_DECAY_PER_PART = 5; + +/** + * @constant + * @type {number} + */ +const TOMBSTONE_DECAY_POWER_CREEP = 500; + +/** + * @constant + * @type {number} + */ +const RUIN_DECAY = 500; + +/** + * @constant + * @type {object} + */ +const RUIN_DECAY_STRUCTURES = { + "powerBank": 10 +}; + +/** + * @constant + * @type {number} + */ +const PORTAL_DECAY = 30000; + +/** + * @constant + * @type {string} + */ +const ORDER_SELL = "sell"; + +/** + * @constant + * @type {string} + */ +const ORDER_BUY = "buy"; + +/** + * @constant + * @type {number} + */ +const MARKET_FEE = 0.05; + +/** + * @constant + * @type {number} + */ +const MARKET_MAX_ORDERS = 300; + +/** + * @constant + * @type {number} + */ +const MARKET_ORDER_LIFE_TIME = 2592000000; + +/** + * @constant + * @type {number} + */ +const FLAGS_LIMIT = 10000; + +/** + * @constant + * @type {string} + */ +const SUBSCRIPTION_TOKEN = "token"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ENERGY = "energy"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_POWER = "power"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_HYDROGEN = "H"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_OXYGEN = "O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM = "U"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM = "L"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM = "K"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM = "Z"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYST = "X"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM = "G"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_SILICON = "silicon"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_METAL = "metal"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_BIOMASS = "biomass"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MIST = "mist"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_HYDROXIDE = "OH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_KEANITE = "ZK"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_LEMERGITE = "UL"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_HYDRIDE = "UH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_OXIDE = "UO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_HYDRIDE = "KH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_OXIDE = "KO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_HYDRIDE = "LH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_OXIDE = "LO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_HYDRIDE = "ZH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_OXIDE = "ZO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_HYDRIDE = "GH"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_OXIDE = "GO"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_ACID = "UH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_ALKALIDE = "UHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_ACID = "KH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_ALKALIDE = "KHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_ACID = "LH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_ALKALIDE = "LHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_ACID = "ZH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_ALKALIDE = "ZHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_ACID = "GH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_ALKALIDE = "GHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_UTRIUM_ACID = "XUH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_UTRIUM_ALKALIDE = "XUHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_KEANIUM_ACID = "XKH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_KEANIUM_ALKALIDE = "XKHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_LEMERGIUM_ACID = "XLH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_LEMERGIUM_ALKALIDE = "XLHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_ZYNTHIUM_ACID = "XZH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_ZYNTHIUM_ALKALIDE = "XZHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_GHODIUM_ACID = "XGH2O"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CATALYZED_GHODIUM_ALKALIDE = "XGHO2"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_OPS = "ops"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_UTRIUM_BAR = "utrium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LEMERGIUM_BAR = "lemergium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ZYNTHIUM_BAR = "zynthium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_KEANIUM_BAR = "keanium_bar"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_GHODIUM_MELT = "ghodium_melt"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_OXIDANT = "oxidant"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_REDUCTANT = "reductant"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_PURIFIER = "purifier"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_BATTERY = "battery"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_COMPOSITE = "composite"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CRYSTAL = "crystal"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_LIQUID = "liquid"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_WIRE = "wire"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_SWITCH = "switch"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_TRANSISTOR = "transistor"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MICROCHIP = "microchip"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CIRCUIT = "circuit"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_DEVICE = "device"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CELL = "cell"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_PHLEGM = "phlegm"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_TISSUE = "tissue"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MUSCLE = "muscle"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ORGANOID = "organoid"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ORGANISM = "organism"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ALLOY = "alloy"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_TUBE = "tube"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_FIXTURES = "fixtures"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_FRAME = "frame"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_HYDRAULICS = "hydraulics"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_MACHINE = "machine"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CONDENSATE = "condensate"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_CONCENTRATE = "concentrate"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_EXTRACT = "extract"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_SPIRIT = "spirit"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_EMANATION = "emanation"; + +/** + * @constant + * @type {string} + */ +const RESOURCE_ESSENCE = "essence"; + +/** + * @constant + * @type {object} + */ +const REACTIONS = { + "H": { + "O": "OH", + "L": "LH", + "K": "KH", + "U": "UH", + "Z": "ZH", + "G": "GH" + }, + "O": { + "H": "OH", + "L": "LO", + "K": "KO", + "U": "UO", + "Z": "ZO", + "G": "GO" + }, + "Z": { + "K": "ZK", + "H": "ZH", + "O": "ZO" + }, + "L": { + "U": "UL", + "H": "LH", + "O": "LO" + }, + "K": { + "Z": "ZK", + "H": "KH", + "O": "KO" + }, + "G": { + "H": "GH", + "O": "GO" + }, + "U": { + "L": "UL", + "H": "UH", + "O": "UO" + }, + "OH": { + "UH": "UH2O", + "UO": "UHO2", + "ZH": "ZH2O", + "ZO": "ZHO2", + "KH": "KH2O", + "KO": "KHO2", + "LH": "LH2O", + "LO": "LHO2", + "GH": "GH2O", + "GO": "GHO2" + }, + "X": { + "UH2O": "XUH2O", + "UHO2": "XUHO2", + "LH2O": "XLH2O", + "LHO2": "XLHO2", + "KH2O": "XKH2O", + "KHO2": "XKHO2", + "ZH2O": "XZH2O", + "ZHO2": "XZHO2", + "GH2O": "XGH2O", + "GHO2": "XGHO2" + }, + "ZK": { + "UL": "G" + }, + "UL": { + "ZK": "G" + }, + "LH": { + "OH": "LH2O" + }, + "ZH": { + "OH": "ZH2O" + }, + "GH": { + "OH": "GH2O" + }, + "KH": { + "OH": "KH2O" + }, + "UH": { + "OH": "UH2O" + }, + "LO": { + "OH": "LHO2" + }, + "ZO": { + "OH": "ZHO2" + }, + "KO": { + "OH": "KHO2" + }, + "UO": { + "OH": "UHO2" + }, + "GO": { + "OH": "GHO2" + }, + "LH2O": { + "X": "XLH2O" + }, + "KH2O": { + "X": "XKH2O" + }, + "ZH2O": { + "X": "XZH2O" + }, + "UH2O": { + "X": "XUH2O" + }, + "GH2O": { + "X": "XGH2O" + }, + "LHO2": { + "X": "XLHO2" + }, + "UHO2": { + "X": "XUHO2" + }, + "KHO2": { + "X": "XKHO2" + }, + "ZHO2": { + "X": "XZHO2" + }, + "GHO2": { + "X": "XGHO2" + } +}; + +/** + * @constant + * @type {object} + */ +const BOOSTS = { + "work": { + "UO": { + "harvest": 3 + }, + "UHO2": { + "harvest": 5 + }, + "XUHO2": { + "harvest": 7 + }, + "LH": { + "build": 1.5, + "repair": 1.5 + }, + "LH2O": { + "build": 1.8, + "repair": 1.8 + }, + "XLH2O": { + "build": 2, + "repair": 2 + }, + "ZH": { + "dismantle": 2 + }, + "ZH2O": { + "dismantle": 3 + }, + "XZH2O": { + "dismantle": 4 + }, + "GH": { + "upgradeController": 1.5 + }, + "GH2O": { + "upgradeController": 1.8 + }, + "XGH2O": { + "upgradeController": 2 + } + }, + "attack": { + "UH": { + "attack": 2 + }, + "UH2O": { + "attack": 3 + }, + "XUH2O": { + "attack": 4 + } + }, + "ranged_attack": { + "KO": { + "rangedAttack": 2, + "rangedMassAttack": 2 + }, + "KHO2": { + "rangedAttack": 3, + "rangedMassAttack": 3 + }, + "XKHO2": { + "rangedAttack": 4, + "rangedMassAttack": 4 + } + }, + "heal": { + "LO": { + "heal": 2, + "rangedHeal": 2 + }, + "LHO2": { + "heal": 3, + "rangedHeal": 3 + }, + "XLHO2": { + "heal": 4, + "rangedHeal": 4 + } + }, + "carry": { + "KH": { + "capacity": 2 + }, + "KH2O": { + "capacity": 3 + }, + "XKH2O": { + "capacity": 4 + } + }, + "move": { + "ZO": { + "fatigue": 2 + }, + "ZHO2": { + "fatigue": 3 + }, + "XZHO2": { + "fatigue": 4 + } + }, + "tough": { + "GO": { + "damage": 0.7 + }, + "GHO2": { + "damage": 0.5 + }, + "XGHO2": { + "damage": 0.3 + } + } +}; + +/** + * @constant + * @type {object} + */ +const REACTION_TIME = { + "OH": 20, + "ZK": 5, + "UL": 5, + "G": 5, + "UH": 10, + "UH2O": 5, + "XUH2O": 60, + "UO": 10, + "UHO2": 5, + "XUHO2": 60, + "KH": 10, + "KH2O": 5, + "XKH2O": 60, + "KO": 10, + "KHO2": 5, + "XKHO2": 60, + "LH": 15, + "LH2O": 10, + "XLH2O": 65, + "LO": 10, + "LHO2": 5, + "XLHO2": 60, + "ZH": 20, + "ZH2O": 40, + "XZH2O": 160, + "ZO": 10, + "ZHO2": 5, + "XZHO2": 60, + "GH": 10, + "GH2O": 15, + "XGH2O": 80, + "GO": 10, + "GHO2": 30, + "XGHO2": 150 +}; + +/** + * @constant + * @type {number} + */ +const PORTAL_UNSTABLE = 864000000; + +/** + * @constant + * @type {number} + */ +const PORTAL_MIN_TIMEOUT = 1036800000; + +/** + * @constant + * @type {number} + */ +const PORTAL_MAX_TIMEOUT = 1900800000; + +/** + * @constant + * @type {number} + */ +const POWER_BANK_RESPAWN_TIME = 50000; + +/** + * @constant + * @type {number} + */ +const INVADERS_ENERGY_GOAL = 100000; + +/** + * @constant + * @type {string} + */ +const SYSTEM_USERNAME = "Screeps"; + +/** + * @constant + * @type {string} + */ +const SIGN_NOVICE_AREA = "A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved."; + +/** + * @constant + * @type {string} + */ +const SIGN_RESPAWN_AREA = "A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved."; + +/** + * @constant + * @type {string} + */ +const SIGN_PLANNED_AREA = "A new Novice or Respawn Area is being planned somewhere in this sector. Please make sure all important rooms are reserved."; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK = 1; + +/** + * @constant + * @type {number} + */ +const EVENT_OBJECT_DESTROYED = 2; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_CONTROLLER = 3; + +/** + * @constant + * @type {number} + */ +const EVENT_BUILD = 4; + +/** + * @constant + * @type {number} + */ +const EVENT_HARVEST = 5; + +/** + * @constant + * @type {number} + */ +const EVENT_HEAL = 6; + +/** + * @constant + * @type {number} + */ +const EVENT_REPAIR = 7; + +/** + * @constant + * @type {number} + */ +const EVENT_RESERVE_CONTROLLER = 8; + +/** + * @constant + * @type {number} + */ +const EVENT_UPGRADE_CONTROLLER = 9; + +/** + * @constant + * @type {number} + */ +const EVENT_EXIT = 10; + +/** + * @constant + * @type {number} + */ +const EVENT_POWER = 11; + +/** + * @constant + * @type {number} + */ +const EVENT_TRANSFER = 12; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_MELEE = 1; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_RANGED = 2; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_RANGED_MASS = 3; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_DISMANTLE = 4; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_HIT_BACK = 5; + +/** + * @constant + * @type {number} + */ +const EVENT_ATTACK_TYPE_NUKE = 6; + +/** + * @constant + * @type {number} + */ +const EVENT_HEAL_TYPE_MELEE = 1; + +/** + * @constant + * @type {number} + */ +const EVENT_HEAL_TYPE_RANGED = 2; + +/** + * @constant + * @type {number} + */ +const POWER_LEVEL_MULTIPLY = 1000; + +/** + * @constant + * @type {number} + */ +const POWER_LEVEL_POW = 2; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_SPAWN_COOLDOWN = 28800000; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_DELETE_COOLDOWN = 86400000; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_MAX_LEVEL = 25; + +/** + * @constant + * @type {number} + */ +const POWER_CREEP_LIFE_TIME = 5000; + +/** + * @constant + * @type {object} + */ +const POWER_CLASS = { + "OPERATOR": "operator" +}; + +/** + * @constant + * @type {number} + */ +const PWR_GENERATE_OPS = 1; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_SPAWN = 2; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_TOWER = 3; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_STORAGE = 4; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_LAB = 5; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_EXTENSION = 6; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_OBSERVER = 7; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_TERMINAL = 8; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_SPAWN = 9; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_TOWER = 10; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_SOURCE = 11; + +/** + * @constant + * @type {number} + */ +const PWR_SHIELD = 12; + +/** + * @constant + * @type {number} + */ +const PWR_REGEN_SOURCE = 13; + +/** + * @constant + * @type {number} + */ +const PWR_REGEN_MINERAL = 14; + +/** + * @constant + * @type {number} + */ +const PWR_DISRUPT_TERMINAL = 15; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_POWER = 16; + +/** + * @constant + * @type {number} + */ +const PWR_FORTIFY = 17; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_CONTROLLER = 18; + +/** + * @constant + * @type {number} + */ +const PWR_OPERATE_FACTORY = 19; + +/** + * @constant + * @type {number} + */ +const EFFECT_INVULNERABILITY = 1001; + +/** + * @constant + * @type {number} + */ +const EFFECT_COLLAPSE_TIMER = 1002; + +/** + * @constant + * @type {number} + */ +const INVADER_CORE_HITS = 100000; + +/** + * @constant + * @type {object} + */ +const INVADER_CORE_CREEP_SPAWN_TIME = { + "0": 0, + "1": 0, + "2": 6, + "3": 3, + "4": 2, + "5": 1 +}; + +/** + * @constant + * @type {object} + */ +const INVADER_CORE_EXPAND_TIME = { + "1": 4000, + "2": 3500, + "3": 3000, + "4": 2500, + "5": 2000 +}; + +/** + * @constant + * @type {number} + */ +const INVADER_CORE_CONTROLLER_POWER = 2; + +/** + * @constant + * @type {number} + */ +const INVADER_CORE_CONTROLLER_DOWNGRADE = 5000; + +/** + * @constant + * @type {object} + */ +const STRONGHOLD_RAMPART_HITS = { + "0": 0, + "1": 50000, + "2": 200000, + "3": 500000, + "4": 1000000, + "5": 2000000 +}; + +/** + * @constant + * @type {number} + */ +const STRONGHOLD_DECAY_TICKS = 75000; + +/** + * @constant + * @type {object} + */ +const POWER_INFO = { + "1": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 50, + "effect": [ + 1, + 2, + 4, + 6, + 8 + ] + }, + "2": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 300, + "duration": 1000, + "range": 3, + "ops": 100, + "effect": [ + 0.9, + 0.7, + 0.5, + 0.35, + 0.2 + ] + }, + "3": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 10, + "duration": 100, + "range": 3, + "ops": 10, + "effect": [ + 1.1, + 1.2, + 1.3, + 1.4, + 1.5 + ] + }, + "4": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 800, + "duration": 1000, + "range": 3, + "ops": 100, + "effect": [ + 500000, + 1000000, + 2000000, + 4000000, + 7000000 + ] + }, + "5": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 50, + "duration": 1000, + "range": 3, + "ops": 10, + "effect": [ + 2, + 4, + 6, + 8, + 10 + ] + }, + "6": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 50, + "range": 3, + "ops": 2, + "effect": [ + 0.2, + 0.4, + 0.6, + 0.8, + 1 + ] + }, + "7": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 400, + "duration": [ + 200, + 400, + 600, + 800, + 1000 + ], + "range": 3, + "ops": 10 + }, + "8": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 500, + "duration": 1000, + "range": 3, + "ops": 100, + "effect": [ + 0.9, + 0.8, + 0.7, + 0.6, + 0.5 + ] + }, + "9": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 5, + "range": 20, + "ops": 10, + "duration": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "10": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 0, + "duration": 5, + "range": 50, + "ops": 10, + "effect": [ + 0.9, + 0.8, + 0.7, + 0.6, + 0.5 + ] + }, + "11": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 100, + "range": 3, + "ops": 100, + "duration": [ + 100, + 200, + 300, + 400, + 500 + ] + }, + "12": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "effect": [ + 5000, + 10000, + 15000, + 20000, + 25000 + ], + "duration": 50, + "cooldown": 20, + "energy": 100 + }, + "13": { + "className": "operator", + "level": [ + 10, + 11, + 12, + 14, + 22 + ], + "cooldown": 100, + "duration": 300, + "range": 3, + "effect": [ + 50, + 100, + 150, + 200, + 250 + ], + "period": 15 + }, + "14": { + "className": "operator", + "level": [ + 10, + 11, + 12, + 14, + 22 + ], + "cooldown": 100, + "duration": 100, + "range": 3, + "effect": [ + 2, + 4, + 6, + 8, + 10 + ], + "period": 10 + }, + "15": { + "className": "operator", + "level": [ + 20, + 21, + 22, + 23, + 24 + ], + "cooldown": 8, + "duration": 10, + "range": 50, + "ops": [ + 50, + 40, + 30, + 20, + 10 + ] + }, + "16": { + "className": "operator", + "level": [ + 10, + 11, + 12, + 14, + 22 + ], + "cooldown": 800, + "range": 3, + "duration": 1000, + "ops": 200, + "effect": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "17": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 5, + "range": 3, + "ops": 5, + "duration": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "18": { + "className": "operator", + "level": [ + 20, + 21, + 22, + 23, + 24 + ], + "cooldown": 800, + "range": 3, + "duration": 1000, + "ops": 200, + "effect": [ + 10, + 20, + 30, + 40, + 50 + ] + }, + "19": { + "className": "operator", + "level": [ + 0, + 2, + 7, + 14, + 22 + ], + "cooldown": 800, + "range": 3, + "duration": 1000, + "ops": 100 + } +}; + +/** + * @constant + * @type {object} + */ +const BODYPARTS_ALL = [ + "move", + "work", + "carry", + "attack", + "ranged_attack", + "tough", + "heal", + "claim" +]; + +/** + * @constant + * @type {object} + */ +const RESOURCES_ALL = [ + "energy", + "power", + "H", + "O", + "U", + "K", + "L", + "Z", + "X", + "G", + "OH", + "ZK", + "UL", + "UH", + "UO", + "KH", + "KO", + "LH", + "LO", + "ZH", + "ZO", + "GH", + "GO", + "UH2O", + "UHO2", + "KH2O", + "KHO2", + "LH2O", + "LHO2", + "ZH2O", + "ZHO2", + "GH2O", + "GHO2", + "XUH2O", + "XUHO2", + "XKH2O", + "XKHO2", + "XLH2O", + "XLHO2", + "XZH2O", + "XZHO2", + "XGH2O", + "XGHO2", + "ops", + "silicon", + "metal", + "biomass", + "mist", + "utrium_bar", + "lemergium_bar", + "zynthium_bar", + "keanium_bar", + "ghodium_melt", + "oxidant", + "reductant", + "purifier", + "battery", + "composite", + "crystal", + "liquid", + "wire", + "switch", + "transistor", + "microchip", + "circuit", + "device", + "cell", + "phlegm", + "tissue", + "muscle", + "organoid", + "organism", + "alloy", + "tube", + "fixtures", + "frame", + "hydraulics", + "machine", + "condensate", + "concentrate", + "extract", + "spirit", + "emanation", + "essence" +]; + +/** + * @constant + * @type {object} + */ +const COLORS_ALL = [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10 +]; + +/** + * @constant + * @type {object} + */ +const INTERSHARD_RESOURCES = [ + "token" +]; + +/** + * @constant + * @type {object} + */ +const COMMODITIES = { + "utrium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "U": 500, + "energy": 200 + } + }, + "U": { + "amount": 500, + "cooldown": 20, + "components": { + "utrium_bar": 100, + "energy": 200 + } + }, + "lemergium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "L": 500, + "energy": 200 + } + }, + "L": { + "amount": 500, + "cooldown": 20, + "components": { + "lemergium_bar": 100, + "energy": 200 + } + }, + "zynthium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "Z": 500, + "energy": 200 + } + }, + "Z": { + "amount": 500, + "cooldown": 20, + "components": { + "zynthium_bar": 100, + "energy": 200 + } + }, + "keanium_bar": { + "amount": 100, + "cooldown": 20, + "components": { + "K": 500, + "energy": 200 + } + }, + "K": { + "amount": 500, + "cooldown": 20, + "components": { + "keanium_bar": 100, + "energy": 200 + } + }, + "ghodium_melt": { + "amount": 100, + "cooldown": 20, + "components": { + "G": 500, + "energy": 200 + } + }, + "G": { + "amount": 500, + "cooldown": 20, + "components": { + "ghodium_melt": 100, + "energy": 200 + } + }, + "oxidant": { + "amount": 100, + "cooldown": 20, + "components": { + "O": 500, + "energy": 200 + } + }, + "O": { + "amount": 500, + "cooldown": 20, + "components": { + "oxidant": 100, + "energy": 200 + } + }, + "reductant": { + "amount": 100, + "cooldown": 20, + "components": { + "H": 500, + "energy": 200 + } + }, + "H": { + "amount": 500, + "cooldown": 20, + "components": { + "reductant": 100, + "energy": 200 + } + }, + "purifier": { + "amount": 100, + "cooldown": 20, + "components": { + "X": 500, + "energy": 200 + } + }, + "X": { + "amount": 500, + "cooldown": 20, + "components": { + "purifier": 100, + "energy": 200 + } + }, + "battery": { + "amount": 50, + "cooldown": 10, + "components": { + "energy": 600 + } + }, + "energy": { + "amount": 500, + "cooldown": 10, + "components": { + "battery": 50 + } + }, + "composite": { + "level": 1, + "amount": 20, + "cooldown": 50, + "components": { + "utrium_bar": 20, + "zynthium_bar": 20, + "energy": 20 + } + }, + "crystal": { + "level": 2, + "amount": 6, + "cooldown": 21, + "components": { + "lemergium_bar": 6, + "keanium_bar": 6, + "purifier": 6, + "energy": 45 + } + }, + "liquid": { + "level": 3, + "amount": 12, + "cooldown": 60, + "components": { + "oxidant": 12, + "reductant": 12, + "ghodium_melt": 12, + "energy": 90 + } + }, + "wire": { + "amount": 20, + "cooldown": 8, + "components": { + "utrium_bar": 20, + "silicon": 100, + "energy": 40 + } + }, + "switch": { + "level": 1, + "amount": 5, + "cooldown": 70, + "components": { + "wire": 40, + "oxidant": 95, + "utrium_bar": 35, + "energy": 20 + } + }, + "transistor": { + "level": 2, + "amount": 1, + "cooldown": 59, + "components": { + "switch": 4, + "wire": 15, + "reductant": 85, + "energy": 8 + } + }, + "microchip": { + "level": 3, + "amount": 1, + "cooldown": 250, + "components": { + "transistor": 2, + "composite": 50, + "wire": 117, + "purifier": 25, + "energy": 16 + } + }, + "circuit": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "microchip": 1, + "transistor": 5, + "switch": 4, + "oxidant": 115, + "energy": 32 + } + }, + "device": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "circuit": 1, + "microchip": 3, + "crystal": 110, + "ghodium_melt": 150, + "energy": 64 + } + }, + "cell": { + "amount": 20, + "cooldown": 8, + "components": { + "lemergium_bar": 20, + "biomass": 100, + "energy": 40 + } + }, + "phlegm": { + "level": 1, + "amount": 2, + "cooldown": 35, + "components": { + "cell": 20, + "oxidant": 36, + "lemergium_bar": 16, + "energy": 8 + } + }, + "tissue": { + "level": 2, + "amount": 2, + "cooldown": 164, + "components": { + "phlegm": 10, + "cell": 10, + "reductant": 110, + "energy": 16 + } + }, + "muscle": { + "level": 3, + "amount": 1, + "cooldown": 250, + "components": { + "tissue": 3, + "phlegm": 3, + "zynthium_bar": 50, + "reductant": 50, + "energy": 16 + } + }, + "organoid": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "muscle": 1, + "tissue": 5, + "purifier": 208, + "oxidant": 256, + "energy": 32 + } + }, + "organism": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "organoid": 1, + "liquid": 150, + "tissue": 6, + "cell": 310, + "energy": 64 + } + }, + "alloy": { + "amount": 20, + "cooldown": 8, + "components": { + "zynthium_bar": 20, + "metal": 100, + "energy": 40 + } + }, + "tube": { + "level": 1, + "amount": 2, + "cooldown": 45, + "components": { + "alloy": 40, + "zynthium_bar": 16, + "energy": 8 + } + }, + "fixtures": { + "level": 2, + "amount": 1, + "cooldown": 115, + "components": { + "composite": 20, + "alloy": 41, + "oxidant": 161, + "energy": 8 + } + }, + "frame": { + "level": 3, + "amount": 1, + "cooldown": 125, + "components": { + "fixtures": 2, + "tube": 4, + "reductant": 330, + "zynthium_bar": 31, + "energy": 16 + } + }, + "hydraulics": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "liquid": 150, + "fixtures": 3, + "tube": 15, + "purifier": 208, + "energy": 32 + } + }, + "machine": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "hydraulics": 1, + "frame": 2, + "fixtures": 3, + "tube": 12, + "energy": 64 + } + }, + "condensate": { + "amount": 20, + "cooldown": 8, + "components": { + "keanium_bar": 20, + "mist": 100, + "energy": 40 + } + }, + "concentrate": { + "level": 1, + "amount": 3, + "cooldown": 41, + "components": { + "condensate": 30, + "keanium_bar": 15, + "reductant": 54, + "energy": 12 + } + }, + "extract": { + "level": 2, + "amount": 2, + "cooldown": 128, + "components": { + "concentrate": 10, + "condensate": 30, + "oxidant": 60, + "energy": 16 + } + }, + "spirit": { + "level": 3, + "amount": 1, + "cooldown": 200, + "components": { + "extract": 2, + "concentrate": 6, + "reductant": 90, + "purifier": 20, + "energy": 16 + } + }, + "emanation": { + "level": 4, + "amount": 1, + "cooldown": 800, + "components": { + "spirit": 2, + "extract": 2, + "concentrate": 3, + "keanium_bar": 112, + "energy": 32 + } + }, + "essence": { + "level": 5, + "amount": 1, + "cooldown": 600, + "components": { + "emanation": 1, + "spirit": 3, + "crystal": 110, + "ghodium_melt": 150, + "energy": 64 + } + } +}; diff --git a/Memory.js b/src/Memory.js similarity index 100% rename from Memory.js rename to src/Memory.js diff --git a/Mineral.js b/src/Mineral.js similarity index 100% rename from Mineral.js rename to src/Mineral.js diff --git a/Nuke.js b/src/Nuke.js similarity index 100% rename from Nuke.js rename to src/Nuke.js diff --git a/src/Order.js b/src/Order.js new file mode 100644 index 0000000..9af9518 --- /dev/null +++ b/src/Order.js @@ -0,0 +1,66 @@ +Order = { + /** + * The unique order ID. + * + * @type {string} + */ + id: "", + + /** + * The order creation time in game ticks. + * + * @type {number} + */ + created: 0, + + /** + * Whether this order is active and visible to other players. An order can become non-active when the terminal doesn't have enough resources to sell or you are out of credits to buy.Whether this order is active and visible to other players. An order can become non-active when the terminal doesn't have enough resources to sell or you are out of credits to buy. + * + * @type {boolean} + */ + active: true, + + /** + * Either ORDER_SELL or ORDER_BUY + * + * @type {ORDER_SELL|ORDER_BUY} + */ + type: 'sell', + + /** + * Either one of the RESOURCE_* constants or SUBSCRIPTION_TOKEN + * + * @type {string|SUBSCRIPTION_TOKEN} + */ + resourceType: "", + + /** + * The room where this order is placed. + * @type {string} + */ + roomName: "", + + /** + * Currently available amount to trade. + * @type {number} + */ + amount: 0, + + /** + * How many resources are left to trade via this order. + * @type {number} + */ + remainingAmount: 0, + + /** + * Initial order amount. + * @type {number} + */ + totalAmount: 0, + + /** + * Price + * @type {number} + */ + price: 0 +}; \ No newline at end of file diff --git a/OwnedStructure.js b/src/OwnedStructure.js similarity index 100% rename from OwnedStructure.js rename to src/OwnedStructure.js diff --git a/PathFinder.js b/src/PathFinder.js similarity index 100% rename from PathFinder.js rename to src/PathFinder.js diff --git a/src/PowerCreep.js b/src/PowerCreep.js new file mode 100644 index 0000000..dc22bb7 --- /dev/null +++ b/src/PowerCreep.js @@ -0,0 +1,468 @@ +/** + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/power.html#Power-Creeps} + */ +PowerCreep = function() { }; + +PowerCreep.prototype = +{ + + + /** + * A static method to create new Power Creep instance in your account. + * It will be added in an unspawned state, use spawn method to spawn it in the world. + * You need one free Power Level in your account to perform this action. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.PowerCreep-create} + * + * @type {function} + * + * @param {string} The name of the new power creep. + * + * @param {string} The class of the new power creep, one of the POWER_CLASS constants. + * + * @return {number|OK|ERR_NAME_EXISTS|ERR_NOT_ENOUGH_RESOURCES} + */ + create: function(name, className) { }, + + /** + * An object with the PowerCreep's cargo contents. + * Each object key is one of the RESOURCE_* constants, values are resources amounts. + * Use _.sum(creep.carry) to get the total amount of contents. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.carry} + * + * @type {object} + */ + carry: {}, + + /** + * The total amount of resources the PowerCreep can carry. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.carryCapacity} + * + * @type {number} + */ + carryCapacity: 0, + + /** + * The power creep's class, one of the POWER_CLASS constants. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.className} + * + * @type {string} + */ + className: "", + + + /** + * A timestamp when this creep is marked to be permanently deleted from the account, or undefined otherwise. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.deleteTime} + * + * @type {number} + */ + deleteTime: 0, + + /** + * The current amount of hit points of the PowerCreep. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.hits} + * + * @type {number} + */ + hits: 0, + + /** + * The maximum amount of hit points of the PowerCreep. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.hitsMax} + * + * @type {number} + */ + hitsMax: 0, + + /** + * A unique object identificator. + * You can use Game.getObjectById method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.id} + * + * @type {string} + */ + id: "", + + /** + * The PowerCreep's level. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.level} + * + * @type {number} + */ + level: 0, + + /** + * A shorthand to Memory.creeps[creep.name]. + * You can use it for quick access the creep’s specific memory data object. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.memory} + * + * @type {*} + */ + memory: {}, + + /** + * Whether it is your creep or foe. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.my} + * + * @type {boolean} + */ + my: true, + + /** + * Creep’s name. + * You can choose the name while creating a new creep, and it cannot be changed later. + * This name is a hash key to access the creep via the Game.creeps object. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.name} + * + * @type {string} + */ + name: "", + + /** + * The text message that the creep was saying at the last tick. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.saying} + * + * @type {string} + */ + saying: "", + + /** + * An object with the creep’s owner info + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.owner} + * + * @type {{username:string}} + */ + owner: + { + username: "" + }, + + /** + * Available powers, an object with power ID as a key, and the following properties: + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.powers} + * + * @type {object} + */ + powers: + { + level: "", + cooldown: "" + }, + + /** + * The name of the shard where the power creep is spawned, or undefined. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.shard} + * + * @type {string} + */ + shard: "", + + /** + * The timestamp when spawning or deleting this creep will become available. Undefined if the power creep is spawned in the world. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.spawnCooldownTime} + * + * @type {number} + */ + spawnCooldownTime: 0, + + /** + * TheThe remaining amount of game ticks after which the creep will die and become unspawned. Undefined if the creep is not spawned in the world. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.ticksToLive} + * + * @type {number} + */ + ticksToLive: 0, + + /** + * Cancel the order given during the current game tick. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.cancelOrder} + * + * @type {function} + * + * @param {string} methodName The name of a creep's method to be cancelled. + * + * @return {number|OK|ERR_NOT_FOUND} + */ + cancelOrder: function(methodName) { }, + + /** + * Delete the power creep permanently from your account. It should NOT be spawned in the world. + * The creep is not deleted immediately, but a 24-hours delete timer is started instead (see deleteTime). + * You can cancel deletion by calling delete(true). + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.delete} + * + * @type {function} + * + * @param {boolean} Set this to true to cancel previously scheduled deletion. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} + */ + delete: function([cancel]) { }, + + /** + * Drop this resource on the ground. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.drop} + * + * @type {function} + * + * @param {string} resourceType One of the RESOURCE_* constants. + * @param {number} [amount] The amount of resource units to be dropped. If omitted, all the available carried amount is used. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES} + */ + drop: function(resourceType, amount) { }, + + /** + * Enable powers usage in this room. The room controller should be at adjacent tile. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.enableRoom} + * + * @type {function} + * + * @param {StructureController} The room controller. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE} + */ + enableRoom: function(controller) { }, + + /** + * Move the creep one square in the specified direction. + * Requires the MOVE body part. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.move} + * + * @type {function} + * + * @param {number} direction One of the following constants: TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_TIRED|ERR_NO_BODYPART} + */ + move: function(direction) { }, + + /** + * Move the creep using the specified predefined path. + * Requires the MOVE body part. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.moveByPath} + * + * @type {function} + * + * @param {Array|string} path A path value as returned from Room.findPath or RoomPosition.findPathTo methods. Both array form and serialized string form are accepted. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_FOUND|ERR_INVALID_ARGS|ERR_TIRED|ERR_NO_BODYPART} + */ + moveByPath: function(path) { }, + + /** + * Find the optimal path to the target within the same room and move to it. + * A shorthand to consequent calls of pos.findPathTo() and move() methods. + * If the target is in another room, then the corresponding exit will be used as a target. + * Requires the MOVE body part. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.moveTo} + * + * @type {function} + * + * @param {number} x X position of the target in the same room. + * @param {number} [y] Y position of the target in the same room. + * @param {object} [opts] An object containing additional options + * @param {number} [opts.reusePath] This option enables reusing the path found along multiple game ticks. It allows to save CPU time, but can result in a slightly slower creep reaction behavior. The path is stored into the creep's memory to the _move property. The reusePath value defines the amount of ticks which the path should be reused for. The default value is 5. Increase the amount to save more CPU, decrease to make the movement more consistent. Set to 0 if you want to disable path reusing. + * @param {boolean} [opts.serializeMemory] If reusePath is enabled and this option is set to true, the path will be stored in memory in the short serialized form using Room.serializePath. The default value is true. + * @param {boolean} [opts.noPathFinding] If this option is set to true, moveTo method will return ERR_NOT_FOUND if there is no memorized path to reuse. This can significantly save CPU time in some cases. The default value is false. + * @note opts also supports any method from the Room.findPath options. + * + * @alias moveTo(target, [opts]) + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_TIRED|ERR_NO_BODYPART|ERR_INVALID_TARGET|ERR_NO_PATH} + */ + moveTo: function(x, y, opts) { }, + + /** + * Toggle auto notification when the creep is under attack. + * The notification will be sent to your account email. + * Turned on by default. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.notifyWhenAttacked} + * + * @type {function} + * + * @param {boolean} enabled Whether to enable notification or disable. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_INVALID_ARGS} + */ + notifyWhenAttacked: function(enabled) { }, + + /** + * Pick up an item (a dropped piece of energy). + * Requires the CARRY body part. + * The target has to be at adjacent square to the creep or at the same square. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.pickup} + * + * @type {function} + * + * @param {Resource} target The target object to be picked up. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE} + */ + pickup: function(target) { }, + + /** + * Rename the power creep. It must not be spawned in the world. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.rename} + * + * @type {function} + * + * @param {string} The new name of the power creep. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NAME_EXISTS|ERR_BUSY} + */ + rename: function(name) { }, + + /** + * Instantly restore time to live to the maximum using a Power Spawn or a Power Bank nearby. It has to be at adjacent tile. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.renew} + * + * @type {function} + * + * @param {StructurePowerBank|StructurePowerSpawn} The target structure. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_NOT_IN_RANGE} + */ + renew: function(target) { }, + + /** + * Display a visual speech balloon above the creep with the specified message. The message will be + * available for one tick. You can read the last message using the saying property. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.say} + * + * @type {function} + * + * @param {string} message The message to be displayed. Maximum length is 10 characters. + * @param {boolean} [public] Set to true to allow other players to see this message. Default is false. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} + */ + say: function(message, public) { }, + + /** + * Sign a controller with an arbitrary text visible to all players. + * This text will appear in the room UI, in the world map, and can be accessed via the API. + * You can sign unowned and hostile controllers. The target has to be at adjacent square to the creep. + * Pass an empty string to remove the sign. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.spawn} + * + * @type {function} + * + * @param {StructurePowerSpawn} Your Power Spawn structure. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_INVALID_TARGET|ERR_TIRED|ERR_RCL_NOT_ENOUGH} + */ + spawn: function(powerSpawn) { }, + + /** + * Kill the creep immediately. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.suicide} + * + * @type {function} + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY} + */ + suicide: function() { }, + + /** + * Transfer resource from the creep to another object. + * The target has to be at adjacent square to the creep. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.transfer} + * + * @type {function} + * + * @param {Creep|Spawn|Structure} target The target object. + * @param {string} resourceType One of the RESOURCE_* constants. + * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available carried amount is used. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} + */ + transfer: function(target, resourceType, amount) { }, + + /** + * Upgrade the creep, adding a new power ability to it or increasing level of the existing power. + * You need one free Power Level in your account to perform this action. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.upgrade} + * + * @type {function} + * + * @param {number} The power ability to upgrade, one of the PWR_* constants. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_NOT_ENOUGH_RESOURCES|ERR_FULL|ERR_INVALID_ARGS} + */ + upgrade: function(power) { }, + + /** + * Apply one the creep's powers on the specified target. + * You can only use powers in rooms either without a controller, or with a power-enabled controller. + * Only one power can be used during the same tick, each usePower call will override the previous one. + * If the target has the same effect of a lower or equal level, it is overridden. + * If the existing effect level is higher, an error is returned. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.usePower} + * + * @type {function} + * + * @param {number} The power ability to use, one of the PWR_* constants. + * @param {RoomObject} A target object in the room. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS|ERR_TIRED|ERR_NO_BODYPART} + */ + usePower: function(power, [target]) { }, + + /** + * Withdraw resources from a structure. + * The target has to be at adjacent square to the creep. + * Multiple creeps can withdraw from the same structure in the same tick. + * Your creeps can withdraw resources from hostile structures as well, in case if there is no hostile rampart on top of it. + * + * @see {@link https://docs.screeps.com/api/#PowerCreep.withdraw} + * + * @type {function} + * + * @param {Structure} target The target object. + * @param {string} resourceType One of the RESOURCE_* constants. + * @param {number|undefined|null} [amount] The amount of resources to be transferred. If omitted, all the available carried amount is used. + * + * @return {number|OK|ERR_NOT_OWNER|ERR_BUSY|ERR_NOT_ENOUGH_RESOURCES|ERR_INVALID_TARGET|ERR_FULL|ERR_NOT_IN_RANGE|ERR_INVALID_ARGS} + */ + withdraw: function(target, resourceType, amount) { } +}; \ No newline at end of file diff --git a/RawMemory.js b/src/RawMemory.js similarity index 100% rename from RawMemory.js rename to src/RawMemory.js diff --git a/Resource.js b/src/Resource.js similarity index 100% rename from Resource.js rename to src/Resource.js diff --git a/Room.js b/src/Room.js similarity index 100% rename from Room.js rename to src/Room.js diff --git a/RoomObject.js b/src/RoomObject.js similarity index 100% rename from RoomObject.js rename to src/RoomObject.js diff --git a/RoomPosition.js b/src/RoomPosition.js similarity index 100% rename from RoomPosition.js rename to src/RoomPosition.js diff --git a/src/RoomVisual.js b/src/RoomVisual.js new file mode 100644 index 0000000..cd20bf3 --- /dev/null +++ b/src/RoomVisual.js @@ -0,0 +1,138 @@ +/** + * Room visuals provide a way to show various visual debug info in game rooms. + * You can use the RoomVisual object to draw simple shapes that are visible only to you. + * Every existing Room object already contains the visual property, but you also can create new RoomVisual objects for any room (even without visibility) using the constructor. + * + * Room visuals are not stored in the database, their only purpose is to display something in your browser. + * All drawings will persist for one tick and will disappear if not updated. + * All RoomVisual API calls have no added CPU cost (their cost is natural and mostly related to simple JSON.serialize calls). + * However, there is a usage limit: you cannot post more than 500 KB of serialized data per one room (see getSize method). + * + * All draw coordinates are measured in game coordinates and centered to tile centers, i.e. (10,10) will point to the center of the creep at x:10; y:10 position. + * Fractional coordinates are allowed. + * + * @param {string} roomName + * + * @class + * @constructor + * + * @see {@link http://support.screeps.com/hc/en-us/articles/208488525-Nuke} + */ +RoomVisual = function(roomName) { }; + +RoomVisual.prototype = + { + /** + * The name of the room. + * + * @see {@link http://docs.screeps.com/api/#RoomVisual.roomName} + * + * @type {string} + */ + roomName: "", + + /** + * Draw a line. + * + * @see {@link http://docs.screeps.com/api/#RoomVisual.line} + * + * @type {function} + * + * @param {number} x1 The start X coordinate. + * @param {number} y1 The start Y coordinate. + * @param {number} x2 The finish X coordinate. + * @param {number} y2 The finish Y coordinate. + * @param {Object} [style] Style object + * + * @return {RoomVisual} + */ + line: function(x1, y1, x2, y2, style) { }, + + /** + * Draw a circle. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.circle} + * + * @type {function} + * + * @param {number} x The X coordinate of the center. + * @param {number} [y] The Y coordinate of the center. + * @param {Object} [style] Style object + * + * @alias circle(pos, [style]) + * + * @return {RoomVisual} + */ + circle: function(x, y, style) { }, + + /** + * Draw a rectangle. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.rect} + * + * @type {function} + * + * @param {number} x The X coordinate of the top-left corner. + * @param {number} y The Y coordinate of the top-left corner. + * @param {number} width The width of the rectangle. + * @param {number} height The height of the rectangle. + * @param {object} style Style object + * + * @alias rect(topLeftPos, width, height, [style]) + * + * @return {RoomVisual} + */ + rect(x, y, width, height, style) { }, + + /** + * Draw a line. + * + * @see {@link http://docs.screeps.com/api/#RoomVisual.poly} + * + * @type {function} + * + * @param {Array>|Array} points An array of points. Every item should be either an array with 2 numbers (i.e. [10,15]), or a RoomPosition object. + * @param {Object} [style] Style object + * + * @return {RoomVisual} + */ + poly: function(points, style) { }, + + /** + * Draw a text label. You can use any valid Unicode characters, including emoji. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.text} + * + * @type {function} + * + * @param {string} text The text message. + * @param {number} x The X coordinate of the label baseline point. + * @param {number} y The Y coordinate of the label baseline point. + * @param {object} [style] Style object + * + * @alias text(text, pos, [style]) + * + * @return {RoomVisual} + */ + text: function(text, x, y, style) { }, + + /** + * Remove all visuals from the room. + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.clear} + * + * @type {function} + * + * @return {RoomVisual} + */ + clear: function() { }, + + /** + * Get the stored size of all visuals added in the room in the current tick. It must not exceed 512,000 (500 KB). + * + * @see {@link https://docs.screeps.com/api/#RoomVisual.getSize} + * + * @return {number} The size of the visuals in bytes. + */ + getSize: function() { }, + }; diff --git a/src/Ruin.js b/src/Ruin.js new file mode 100644 index 0000000..bb32f11 --- /dev/null +++ b/src/Ruin.js @@ -0,0 +1,58 @@ +/** + * A destroyed structure. This is a walkable object. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Ruin} + */ +Ruin = function () { +}; + +Ruin.prototype = { + + /** + * The time when the structure has been destroyed. + * + * @see {@link https://docs.screeps.com/api/#Ruin.destroyTime} + * + * @return {number} + */ + destroyTime: 0, + + /** + * A unique object identificator. You can use {@link Game.getObjectById()} method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#Ruin.id} + * + * @return {string} + */ + id: "", + + /** + * A Store object that contains resources of this structure. + * + * @see {@link https://docs.screeps.com/api/#Ruin.store} + * + * @return {Object} + */ + store: {}, + + /** + * An object containing basic data of the destroyed structure. + * + * @see {@link https://docs.screeps.com/api/#Ruin.structure} + * + * @return {Structure|OwnedStructure} + */ + structure: {}, + + /** + * The amount of game ticks before this ruin decays. + * + * @see {@link https://docs.screeps.com/api/#Ruin.ticksToDecay} + * + * @return {number} + */ + ticksToDecay: 0 +}; diff --git a/Source.js b/src/Source.js similarity index 100% rename from Source.js rename to src/Source.js diff --git a/Structure.js b/src/Structure.js similarity index 100% rename from Structure.js rename to src/Structure.js diff --git a/Structures/StructureContainer.js b/src/Structures/StructureContainer.js similarity index 100% rename from Structures/StructureContainer.js rename to src/Structures/StructureContainer.js diff --git a/Structures/StructureController.js b/src/Structures/StructureController.js similarity index 100% rename from Structures/StructureController.js rename to src/Structures/StructureController.js diff --git a/Structures/StructureExtension.js b/src/Structures/StructureExtension.js similarity index 100% rename from Structures/StructureExtension.js rename to src/Structures/StructureExtension.js diff --git a/Structures/StructureExtractor.js b/src/Structures/StructureExtractor.js similarity index 100% rename from Structures/StructureExtractor.js rename to src/Structures/StructureExtractor.js diff --git a/Structures/StructureFactory.js b/src/Structures/StructureFactory.js similarity index 100% rename from Structures/StructureFactory.js rename to src/Structures/StructureFactory.js diff --git a/Structures/StructureInvaderCore.js b/src/Structures/StructureInvaderCore.js similarity index 100% rename from Structures/StructureInvaderCore.js rename to src/Structures/StructureInvaderCore.js diff --git a/Structures/StructureKeeperLair.js b/src/Structures/StructureKeeperLair.js similarity index 100% rename from Structures/StructureKeeperLair.js rename to src/Structures/StructureKeeperLair.js diff --git a/Structures/StructureLab.js b/src/Structures/StructureLab.js similarity index 100% rename from Structures/StructureLab.js rename to src/Structures/StructureLab.js diff --git a/Structures/StructureLink.js b/src/Structures/StructureLink.js similarity index 100% rename from Structures/StructureLink.js rename to src/Structures/StructureLink.js diff --git a/Structures/StructureNuker.js b/src/Structures/StructureNuker.js similarity index 100% rename from Structures/StructureNuker.js rename to src/Structures/StructureNuker.js diff --git a/Structures/StructureObserver.js b/src/Structures/StructureObserver.js similarity index 100% rename from Structures/StructureObserver.js rename to src/Structures/StructureObserver.js diff --git a/Structures/StructurePortal.js b/src/Structures/StructurePortal.js similarity index 100% rename from Structures/StructurePortal.js rename to src/Structures/StructurePortal.js diff --git a/Structures/StructurePowerBank.js b/src/Structures/StructurePowerBank.js similarity index 100% rename from Structures/StructurePowerBank.js rename to src/Structures/StructurePowerBank.js diff --git a/Structures/StructurePowerSpawn.js b/src/Structures/StructurePowerSpawn.js similarity index 100% rename from Structures/StructurePowerSpawn.js rename to src/Structures/StructurePowerSpawn.js diff --git a/Structures/StructureRampart.js b/src/Structures/StructureRampart.js similarity index 100% rename from Structures/StructureRampart.js rename to src/Structures/StructureRampart.js diff --git a/Structures/StructureRoad.js b/src/Structures/StructureRoad.js similarity index 100% rename from Structures/StructureRoad.js rename to src/Structures/StructureRoad.js diff --git a/Structures/StructureSpawn.js b/src/Structures/StructureSpawn.js similarity index 100% rename from Structures/StructureSpawn.js rename to src/Structures/StructureSpawn.js diff --git a/Structures/StructureStorage.js b/src/Structures/StructureStorage.js similarity index 100% rename from Structures/StructureStorage.js rename to src/Structures/StructureStorage.js diff --git a/Structures/StructureTerminal.js b/src/Structures/StructureTerminal.js similarity index 98% rename from Structures/StructureTerminal.js rename to src/Structures/StructureTerminal.js index 4da85a2..068a5a3 100644 --- a/Structures/StructureTerminal.js +++ b/src/Structures/StructureTerminal.js @@ -53,7 +53,7 @@ StructureTerminal.prototype = * @type {function} * * @param {string} resourceType One of the RESOURCE_* constants. - * @param {number} amount The amount of resources to be sent. The minimum amount is 100. + * @param {number} amount The amount of resources to be sent. * @param {string|undefined|null} [destination] The name of the target room. You don't have to gain visibility in this room. * @param {string|undefined|null} [description] The description of the transaction. It is visible to the recipient. The maximum length is 100 characters. * diff --git a/Structures/StructureTower.js b/src/Structures/StructureTower.js similarity index 100% rename from Structures/StructureTower.js rename to src/Structures/StructureTower.js diff --git a/Structures/StructureWall.js b/src/Structures/StructureWall.js similarity index 100% rename from Structures/StructureWall.js rename to src/Structures/StructureWall.js diff --git a/src/Tombstone.js b/src/Tombstone.js new file mode 100644 index 0000000..e663573 --- /dev/null +++ b/src/Tombstone.js @@ -0,0 +1,57 @@ +/** + * A remnant of dead creeps. This is a walkable object. + * + * @class + * @extends {RoomObject} + * + * @see {@link https://docs.screeps.com/api/#Tombstone} + */ +Tombstone = function() { }; + +Tombstone.prototype = +{ + /** + * An object containing the deceased creep. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.creep} + * + * @type {Creep} + */ + creep: { }, + + /** + * Time of death. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.deathTime} + * + * @type {number} + */ + deathTime: 0, + + /** + * A unique object identificator. You can use Game.getObjectById method to retrieve an object instance by its id. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.id} + * + * @type {string} + */ + id: "", + + /** + * An object with the tombstone contents. Each object key is one of the RESOURCE_* constants, values are resources amounts. RESOURCE_ENERGY is always defined and equals to 0 when empty, other resources are undefined when empty. You can use lodash.sum to get the total amount of contents. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.store} + * + * @type {object} + */ + store: { }, + + /** + * The amount of game ticks before this tombstone decays. + * + * @see {@link https://docs.screeps.com/api/#Tombstone.ticksToDecay} + * + * @type {number} + */ + ticksToDecay: 0, +}; \ No newline at end of file