From b918f5adfb59812f976f751833c1e86ddf2e08fd Mon Sep 17 00:00:00 2001 From: Nick Winter Date: Fri, 29 Aug 2014 17:18:03 -0700 Subject: [PATCH] Fixed #1262. --- app/models/Level.coffee | 6 +-- headless_client.coffee | 1 + headless_client/test.js | 107 ++++++++++++---------------------------- 3 files changed, 35 insertions(+), 79 deletions(-) diff --git a/app/models/Level.coffee b/app/models/Level.coffee index 59487f703..3b08b67eb 100644 --- a/app/models/Level.coffee +++ b/app/models/Level.coffee @@ -139,7 +139,7 @@ module.exports = class Level extends CocoModel for component in thang.components or [] continue unless lc = _.find levelComponents, {original: component.original} component.config ?= {} - TreemaNode.utils.populateDefaults(component.config, lc.configSchema) + TreemaUtils.populateDefaults(component.config, lc.configSchema) @lastType = 'component' @lastOriginal = component.original @walkDefaults component.config, lc.configSchema.properties @@ -147,7 +147,7 @@ module.exports = class Level extends CocoModel fillInDefaultSystemConfiguration: (levelSystems) -> for system in levelSystems ? [] system.config ?= {} - TreemaNode.utils.populateDefaults(system.config, system.model.configSchema) + TreemaUtils.populateDefaults(system.config, system.model.configSchema) @lastType = 'system' @lastOriginal = system.model.name @walkDefaults system.config, system.model.configSchema.properties @@ -165,7 +165,7 @@ module.exports = class Level extends CocoModel else if schema.type is 'array' and config[prop] for item in config[prop] or [] @walkDefaults item, schema.items - + dimensions: -> width = 0 height = 0 diff --git a/headless_client.coffee b/headless_client.coffee index 04fdc109a..1c426bdba 100644 --- a/headless_client.coffee +++ b/headless_client.coffee @@ -42,6 +42,7 @@ Worker::removeEventListener = (what) -> if what is 'message' @onmessage = -> #This webworker api has only one event listener at a time. GLOBAL.tv4 = require('tv4').tv4 +GLOBAL.TreemaUtils = require './bower_components/treema/treema-utils.js' GLOBAL.marked = setOptions: -> store = {} GLOBAL.localStorage = diff --git a/headless_client/test.js b/headless_client/test.js index fdd51bf83..3c92b64e0 100644 --- a/headless_client/test.js +++ b/headless_client/test.js @@ -1,87 +1,42 @@ module.exports = { - "messageGenerated": 1396792689279, - "sessions": [ - { - "sessionID": "533a2c4893b95d9319a58049", - "submitDate": "2014-04-06T06:31:11.806Z", + "messageGenerated": 1409357317134, + "sessions": [{ + "sessionID": "539bb9f86e1d92310506f138", "team": "humans", - "code": { - "ogre-base": { - "chooseAction": "// This is the code for your base. Decide which unit to build each frame.\n// Units you build will go into the this.built array.\n// Destroy the enemy base within 60 seconds!\n// Check out the Guide at the top for more info.\n\n// Choose your hero! You can only build one hero.\nvar hero;\n//hero = 'ironjaw'; // A leaping juggernaut hero, type 'brawler'.\nhero = 'yugargen'; // A devious spellcaster hero, type 'shaman'.\nif(hero && !this.builtHero) {\n this.builtHero = this.build(hero);\n return;\n}\n\n// Munchkins are weak melee units with 1.25s build cooldown.\n// Throwers are fragile, deadly ranged units with 2.5s build cooldown.\nvar buildOrder = ['munchkin', 'thrower', 'munchkin', 'thrower', 'munchkin', 'thrower'];\nvar type = buildOrder[this.built.length % buildOrder.length];\n//this.say('Unit #' + this.built.length + ' will be a ' + type);\nthis.build(type);\n//this.say(\"Move\", {to:{x:20, y:30}});{x: 68, y: 29}{x: 70, y: 30}" + "transpiledCode": { + "mak-fod": {}, + "tharin": { + "chooseAction": "var __interceptThis=(function(){var G=this;return function($this,sandbox){if($this==G){return sandbox;}return $this;};})();\nreturn (function (__global) {\n var tmp0, tmp1;\n tmp1 = function () {\n 'use strict'; _aether.logCallStart(_aether._userInfo); var rjust, debug_coin, use_terrify, player, items, tmp93, tmp94, tmp95, tmp96, tmp97, tmp103, tmp104, tmp105, tmp106, tmp107, tmp118, tmp119, tmp120, tmp121, tmp122, tmp123, tmp124, tmp125, tmp126, tmp127, tmp128, tmp129, tmp130, tmp131, tmp132, tmp133, tmp134, tmp135, tmp136, tmp137, tmp138, tmp139, tmp140, tmp141, tmp142, tmp143, tmp144, tmp145, tmp146, tmp147, tmp148, tmp149, tmp150, tmp151, tmp152, tmp153, tmp154, tmp155, tmp156, tmp157, tmp158, tmp159, tmp160, tmp161, tmp162, tmp163, tmp164, tmp165; for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n _aether.logStatementStart([{ofs: 0, row: 0, col: 0}, {ofs: 234, row: 9, col: 2}]); rjust = function (s, n, fill) {\n var num_pad_chars, out, i, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp16, tmp17, tmp18, tmp19, tmp20, tmp21, tmp22, tmp23, tmp24, tmp27, tmp28, tmp29, tmp30, tmp31; s = _aether.createAPIClone(_aether, s); n = _aether.createAPIClone(_aether, n); fill = _aether.createAPIClone(_aether, fill); for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n _aether.logStatementStart([{ofs: 43, row: 1, col: 8}, {ofs: 45, row: 1, col: 10}]); tmp2 = ''; _aether.logStatement([{ofs: 43, row: 1, col: 8}, {ofs: 45, row: 1, col: 10}], _aether._userInfo, false);\n tmp6 = 'Math';\n tmp7 = tmp6 in __global;\n if (tmp7) {\n tmp4 = __global[tmp6];\n } else { _aether.logStatementStart([{ofs: 46, row: 1, col: 11}, {ofs: 50, row: 1, col: 15}]);\n tmp8 = 'ReferenceError';\n tmp9 = __global[tmp8];\n tmp10 = new tmp9('ReferenceError: ' + (tmp6 + ' is not defined'));\n throw tmp10;\n _aether.logStatement([{ofs: 46, row: 1, col: 11}, {ofs: 50, row: 1, col: 15}], _aether._userInfo, false); }\n tmp5 = 'floor';\n tmp12 = s;\n _aether.logStatementStart([{ofs: 59, row: 1, col: 24}, {ofs: 61, row: 1, col: 26}]); tmp13 = 10; _aether.logStatement([{ofs: 59, row: 1, col: 24}, {ofs: 61, row: 1, col: 26}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 57, row: 1, col: 22}, {ofs: 61, row: 1, col: 26}]); tmp11 = tmp12 * tmp13; _aether.logStatement([{ofs: 57, row: 1, col: 22}, {ofs: 61, row: 1, col: 26}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 46, row: 1, col: 11}, {ofs: 62, row: 1, col: 27}]); tmp3 = _aether.createAPIClone(_aether, tmp4[tmp5](_aether.restoreAPIClone(_aether, tmp11))); _aether.logStatement([{ofs: 46, row: 1, col: 11}, {ofs: 62, row: 1, col: 27}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 39, row: 1, col: 4}, {ofs: 63, row: 1, col: 28}]); s = tmp2 + tmp3; _aether.logStatement([{ofs: 39, row: 1, col: 4}, {ofs: 63, row: 1, col: 28}], _aether._userInfo, false);\n tmp14 = n;\n tmp16 = s;\n tmp17 = 'length';\n _aether.logStatementStart([{ofs: 92, row: 2, col: 28}, {ofs: 100, row: 2, col: 36}]); tmp15 = tmp16[tmp17]; _aether.logStatement([{ofs: 92, row: 2, col: 28}, {ofs: 100, row: 2, col: 36}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 68, row: 2, col: 4}, {ofs: 101, row: 2, col: 37}]); num_pad_chars = tmp14 - tmp15; _aether.logStatement([{ofs: 68, row: 2, col: 4}, {ofs: 101, row: 2, col: 37}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 106, row: 3, col: 4}, {ofs: 119, row: 3, col: 17}]); out = ''; _aether.logStatement([{ofs: 106, row: 3, col: 4}, {ofs: 119, row: 3, col: 17}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 128, row: 4, col: 8}, {ofs: 137, row: 4, col: 17}]); i = 0; _aether.logStatement([{ofs: 128, row: 4, col: 8}, {ofs: 137, row: 4, col: 17}], _aether._userInfo, false);\n tmp19 = i;\n tmp20 = num_pad_chars;\n _aether.logStatementStart([{ofs: 139, row: 4, col: 19}, {ofs: 156, row: 4, col: 36}]); tmp18 = tmp19 < tmp20; _aether.logStatement([{ofs: 139, row: 4, col: 19}, {ofs: 156, row: 4, col: 36}], _aether._userInfo, false);\n tmp25: {\n while (tmp18) {\n tmp26: {\n tmp27 = out;\n tmp28 = fill;\n _aether.logStatementStart([{ofs: 173, row: 5, col: 8}, {ofs: 190, row: 5, col: 25}]); out = tmp27 + tmp28; _aether.logStatement([{ofs: 173, row: 5, col: 8}, {ofs: 190, row: 5, col: 25}], _aether._userInfo, false);\n }\n tmp23 = i;\n tmp24 = 1;\n i = tmp23 + tmp24;\n tmp21 = i;\n tmp22 = num_pad_chars;\n _aether.logStatementStart([{ofs: 139, row: 4, col: 19}, {ofs: 156, row: 4, col: 36}]); tmp18 = tmp21 < tmp22; _aether.logStatement([{ofs: 139, row: 4, col: 19}, {ofs: 156, row: 4, col: 36}], _aether._userInfo, false);\n }\n }\n tmp29 = out;\n tmp30 = s;\n _aether.logStatementStart([{ofs: 201, row: 7, col: 4}, {ofs: 215, row: 7, col: 18}]); out = tmp29 + tmp30; _aether.logStatement([{ofs: 201, row: 7, col: 4}, {ofs: 215, row: 7, col: 18}], _aether._userInfo, false);\n tmp31 = out;\n return _aether.restoreAPIClone(_aether, tmp31);\n }; _aether.logStatement([{ofs: 0, row: 0, col: 0}, {ofs: 234, row: 9, col: 2}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 236, row: 11, col: 0}, {ofs: 449, row: 15, col: 2}]); debug_coin = function (dist_and_coin) {\n var dist, coin, tmp32, tmp33, tmp34, tmp35, tmp36, tmp37, tmp38, tmp39, tmp40, tmp41, tmp42, tmp43, tmp44, tmp45, tmp46, tmp47, tmp48, tmp49, tmp50, tmp51, tmp52, tmp53, tmp54, tmp55, tmp56, tmp57, tmp58, tmp59, tmp60, tmp61, tmp62, tmp63, tmp64, tmp65, tmp66, tmp67, tmp68, tmp69, tmp70, tmp71, tmp72, tmp73, tmp74, tmp75, tmp76, tmp77, tmp78, tmp79, tmp80, tmp81, tmp82, tmp83, tmp84, tmp85, tmp86; dist_and_coin = _aether.createAPIClone(_aether, dist_and_coin); for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n tmp32 = dist_and_coin;\n _aether.logStatementStart([{ofs: 308, row: 12, col: 29}, {ofs: 309, row: 12, col: 30}]); tmp33 = 0; _aether.logStatement([{ofs: 308, row: 12, col: 29}, {ofs: 309, row: 12, col: 30}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 283, row: 12, col: 4}, {ofs: 311, row: 12, col: 32}]); dist = tmp32[tmp33]; _aether.logStatement([{ofs: 283, row: 12, col: 4}, {ofs: 311, row: 12, col: 32}], _aether._userInfo, false);\n tmp34 = dist_and_coin;\n _aether.logStatementStart([{ofs: 341, row: 13, col: 29}, {ofs: 342, row: 13, col: 30}]); tmp35 = 1; _aether.logStatement([{ofs: 341, row: 13, col: 29}, {ofs: 342, row: 13, col: 30}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 316, row: 13, col: 4}, {ofs: 344, row: 13, col: 32}]); coin = tmp34[tmp35]; _aether.logStatement([{ofs: 316, row: 13, col: 4}, {ofs: 344, row: 13, col: 32}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 358, row: 14, col: 13}]); tmp51 = ''; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 358, row: 14, col: 13}], _aether._userInfo, false);\n tmp55 = 'Math';\n tmp56 = tmp55 in __global;\n if (tmp56) {\n tmp53 = __global[tmp55];\n } else { _aether.logStatementStart([{ofs: 359, row: 14, col: 14}, {ofs: 363, row: 14, col: 18}]);\n tmp57 = 'ReferenceError';\n tmp58 = __global[tmp57];\n tmp59 = new tmp58('ReferenceError: ' + (tmp55 + ' is not defined'));\n throw tmp59;\n _aether.logStatement([{ofs: 359, row: 14, col: 14}, {ofs: 363, row: 14, col: 18}], _aether._userInfo, false); }\n tmp54 = 'floor';\n tmp60 = dist;\n _aether.logStatementStart([{ofs: 359, row: 14, col: 14}, {ofs: 375, row: 14, col: 30}]); tmp52 = _aether.createAPIClone(_aether, tmp53[tmp54](_aether.restoreAPIClone(_aether, tmp60))); _aether.logStatement([{ofs: 359, row: 14, col: 14}, {ofs: 375, row: 14, col: 30}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 375, row: 14, col: 30}]); tmp49 = tmp51 + tmp52; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 375, row: 14, col: 30}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 376, row: 14, col: 31}, {ofs: 379, row: 14, col: 34}]); tmp50 = ','; _aether.logStatement([{ofs: 376, row: 14, col: 31}, {ofs: 379, row: 14, col: 34}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 379, row: 14, col: 34}]); tmp47 = tmp49 + tmp50; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 379, row: 14, col: 34}], _aether._userInfo, false);\n tmp63 = 'Math';\n tmp64 = tmp63 in __global;\n if (tmp64) {\n tmp61 = __global[tmp63];\n } else { _aether.logStatementStart([{ofs: 380, row: 14, col: 35}, {ofs: 384, row: 14, col: 39}]);\n tmp65 = 'ReferenceError';\n tmp66 = __global[tmp65];\n tmp67 = new tmp66('ReferenceError: ' + (tmp63 + ' is not defined'));\n throw tmp67;\n _aether.logStatement([{ofs: 380, row: 14, col: 35}, {ofs: 384, row: 14, col: 39}], _aether._userInfo, false); }\n tmp62 = 'floor';\n tmp71 = coin;\n tmp72 = 'pos';\n _aether.logStatementStart([{ofs: 391, row: 14, col: 46}, {ofs: 399, row: 14, col: 54}]); tmp69 = tmp71[tmp72]; _aether.logStatement([{ofs: 391, row: 14, col: 46}, {ofs: 399, row: 14, col: 54}], _aether._userInfo, false);\n tmp70 = 'x';\n _aether.logStatementStart([{ofs: 391, row: 14, col: 46}, {ofs: 401, row: 14, col: 56}]); tmp68 = tmp69[tmp70]; _aether.logStatement([{ofs: 391, row: 14, col: 46}, {ofs: 401, row: 14, col: 56}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 380, row: 14, col: 35}, {ofs: 402, row: 14, col: 57}]); tmp48 = _aether.createAPIClone(_aether, tmp61[tmp62](_aether.restoreAPIClone(_aether, tmp68))); _aether.logStatement([{ofs: 380, row: 14, col: 35}, {ofs: 402, row: 14, col: 57}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 402, row: 14, col: 57}]); tmp45 = tmp47 + tmp48; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 402, row: 14, col: 57}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 403, row: 14, col: 58}, {ofs: 406, row: 14, col: 61}]); tmp46 = ','; _aether.logStatement([{ofs: 403, row: 14, col: 58}, {ofs: 406, row: 14, col: 61}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 406, row: 14, col: 61}]); tmp43 = tmp45 + tmp46; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 406, row: 14, col: 61}], _aether._userInfo, false);\n tmp75 = 'Math';\n tmp76 = tmp75 in __global;\n if (tmp76) {\n tmp73 = __global[tmp75];\n } else { _aether.logStatementStart([{ofs: 407, row: 14, col: 62}, {ofs: 411, row: 14, col: 66}]);\n tmp77 = 'ReferenceError';\n tmp78 = __global[tmp77];\n tmp79 = new tmp78('ReferenceError: ' + (tmp75 + ' is not defined'));\n throw tmp79;\n _aether.logStatement([{ofs: 407, row: 14, col: 62}, {ofs: 411, row: 14, col: 66}], _aether._userInfo, false); }\n tmp74 = 'floor';\n tmp83 = coin;\n tmp84 = 'pos';\n _aether.logStatementStart([{ofs: 418, row: 14, col: 73}, {ofs: 426, row: 14, col: 81}]); tmp81 = tmp83[tmp84]; _aether.logStatement([{ofs: 418, row: 14, col: 73}, {ofs: 426, row: 14, col: 81}], _aether._userInfo, false);\n tmp82 = 'y';\n _aether.logStatementStart([{ofs: 418, row: 14, col: 73}, {ofs: 428, row: 14, col: 83}]); tmp80 = tmp81[tmp82]; _aether.logStatement([{ofs: 418, row: 14, col: 73}, {ofs: 428, row: 14, col: 83}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 407, row: 14, col: 62}, {ofs: 429, row: 14, col: 84}]); tmp44 = _aether.createAPIClone(_aether, tmp73[tmp74](_aether.restoreAPIClone(_aether, tmp80))); _aether.logStatement([{ofs: 407, row: 14, col: 62}, {ofs: 429, row: 14, col: 84}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 429, row: 14, col: 84}]); tmp41 = tmp43 + tmp44; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 429, row: 14, col: 84}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 430, row: 14, col: 85}, {ofs: 433, row: 14, col: 88}]); tmp42 = ','; _aether.logStatement([{ofs: 430, row: 14, col: 85}, {ofs: 433, row: 14, col: 88}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 433, row: 14, col: 88}]); tmp39 = tmp41 + tmp42; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 433, row: 14, col: 88}], _aether._userInfo, false);\n tmp85 = coin;\n tmp86 = 'id';\n _aether.logStatementStart([{ofs: 434, row: 14, col: 89}, {ofs: 441, row: 14, col: 96}]); tmp40 = tmp85[tmp86]; _aether.logStatement([{ofs: 434, row: 14, col: 89}, {ofs: 441, row: 14, col: 96}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 441, row: 14, col: 96}]); tmp37 = tmp39 + tmp40; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 441, row: 14, col: 96}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 442, row: 14, col: 97}, {ofs: 445, row: 14, col: 100}]); tmp38 = '|'; _aether.logStatement([{ofs: 442, row: 14, col: 97}, {ofs: 445, row: 14, col: 100}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 356, row: 14, col: 11}, {ofs: 445, row: 14, col: 100}]); tmp36 = tmp37 + tmp38; _aether.logStatement([{ofs: 356, row: 14, col: 11}, {ofs: 445, row: 14, col: 100}], _aether._userInfo, false);\n return _aether.restoreAPIClone(_aether, tmp36);\n }; _aether.logStatement([{ofs: 236, row: 11, col: 0}, {ofs: 449, row: 15, col: 2}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 451, row: 17, col: 0}, {ofs: 543, row: 20, col: 2}]); use_terrify = function (player) {\n var tmp87, tmp88, tmp89, tmp90, tmp91, tmp92; player = _aether.createAPIClone(_aether, player); for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n tmp87 = player;\n tmp88 = 'terrify';\n _aether.logStatementStart([{ofs: 492, row: 18, col: 4}, {ofs: 508, row: 18, col: 20}]); tmp89 = _aether.createAPIClone(_aether, tmp87[tmp88]()); _aether.logStatement([{ofs: 492, row: 18, col: 4}, {ofs: 508, row: 18, col: 20}], _aether._userInfo, false);\n tmp90 = player;\n tmp91 = 'usedTerrify';\n _aether.logStatementStart([{ofs: 514, row: 19, col: 4}, {ofs: 540, row: 19, col: 30}]); tmp92 = true; _aether.logStatement([{ofs: 514, row: 19, col: 4}, {ofs: 540, row: 19, col: 30}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 514, row: 19, col: 4}, {ofs: 539, row: 19, col: 29}]); tmp90[tmp91] = tmp92; _aether.logStatement([{ofs: 514, row: 19, col: 4}, {ofs: 539, row: 19, col: 29}], _aether._userInfo, false);\n return;\n }; _aether.logStatement([{ofs: 451, row: 17, col: 0}, {ofs: 543, row: 20, col: 2}], _aether._userInfo, false);\n player = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp93 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp94 = 'getItems';\n _aether.logStatementStart([{ofs: 633, row: 25, col: 0}, {ofs: 661, row: 25, col: 28}]); items = _aether.createAPIClone(_aether, tmp93[tmp94]()); _aether.logStatement([{ofs: 633, row: 25, col: 0}, {ofs: 661, row: 25, col: 28}], _aether._userInfo, false);\n tmp95 = items;\n tmp96 = 'filter';\n _aether.logStatementStart([{ofs: 683, row: 26, col: 21}, {ofs: 723, row: 26, col: 61}]); tmp97 = function (x) {\n var tmp98, tmp99, tmp100, tmp101, tmp102; x = _aether.createAPIClone(_aether, x); for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n tmp101 = x;\n tmp102 = 'bountyGold';\n _aether.logStatementStart([{ofs: 704, row: 26, col: 42}, {ofs: 716, row: 26, col: 54}]); tmp99 = tmp101[tmp102]; _aether.logStatement([{ofs: 704, row: 26, col: 42}, {ofs: 716, row: 26, col: 54}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 719, row: 26, col: 57}, {ofs: 720, row: 26, col: 58}]); tmp100 = 2; _aether.logStatement([{ofs: 719, row: 26, col: 57}, {ofs: 720, row: 26, col: 58}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 704, row: 26, col: 42}, {ofs: 720, row: 26, col: 58}]); tmp98 = tmp99 > tmp100; _aether.logStatement([{ofs: 704, row: 26, col: 42}, {ofs: 720, row: 26, col: 58}], _aether._userInfo, false);\n return _aether.restoreAPIClone(_aether, tmp98);\n }; _aether.logStatement([{ofs: 683, row: 26, col: 21}, {ofs: 723, row: 26, col: 61}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 662, row: 26, col: 0}, {ofs: 725, row: 26, col: 63}]); items = _aether.createAPIClone(_aether, tmp95[tmp96](_aether.restoreAPIClone(_aether, tmp97))); _aether.logStatement([{ofs: 662, row: 26, col: 0}, {ofs: 725, row: 26, col: 63}], _aether._userInfo, false);\n tmp105 = items;\n tmp106 = 'map';\n _aether.logStatementStart([{ofs: 744, row: 27, col: 18}, {ofs: 806, row: 27, col: 80}]); tmp107 = function (x) {\n var tmp108, tmp109, tmp110, tmp111, tmp112, tmp113, tmp114, tmp115, tmp116, tmp117; x = _aether.createAPIClone(_aether, x); for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n tmp111 = rjust;\n tmp115 = player;\n tmp116 = 'distance';\n tmp117 = x;\n _aether.logStatementStart([{ofs: 772, row: 27, col: 46}, {ofs: 790, row: 27, col: 64}]); tmp112 = _aether.createAPIClone(_aether, tmp115[tmp116](_aether.restoreAPIClone(_aether, tmp117))); _aether.logStatement([{ofs: 772, row: 27, col: 46}, {ofs: 790, row: 27, col: 64}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 792, row: 27, col: 66}, {ofs: 793, row: 27, col: 67}]); tmp113 = 7; _aether.logStatement([{ofs: 792, row: 27, col: 66}, {ofs: 793, row: 27, col: 67}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 795, row: 27, col: 69}, {ofs: 798, row: 27, col: 72}]); tmp114 = '0'; _aether.logStatement([{ofs: 795, row: 27, col: 69}, {ofs: 798, row: 27, col: 72}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 766, row: 27, col: 40}, {ofs: 799, row: 27, col: 73}]); tmp109 = _aether.createAPIClone(_aether, tmp111(_aether.restoreAPIClone(_aether, tmp112), _aether.restoreAPIClone(_aether, tmp113), _aether.restoreAPIClone(_aether, tmp114))); _aether.logStatement([{ofs: 766, row: 27, col: 40}, {ofs: 799, row: 27, col: 73}], _aether._userInfo, false);\n tmp110 = x;\n _aether.logStatementStart([{ofs: 765, row: 27, col: 39}, {ofs: 803, row: 27, col: 77}]); tmp108 = [\n tmp109,\n tmp110\n ]; _aether.logStatement([{ofs: 765, row: 27, col: 39}, {ofs: 803, row: 27, col: 77}], _aether._userInfo, false);\n return _aether.restoreAPIClone(_aether, tmp108);\n }; _aether.logStatement([{ofs: 744, row: 27, col: 18}, {ofs: 806, row: 27, col: 80}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 734, row: 27, col: 8}, {ofs: 807, row: 27, col: 81}]); tmp103 = _aether.createAPIClone(_aether, tmp105[tmp106](_aether.restoreAPIClone(_aether, tmp107))); _aether.logStatement([{ofs: 734, row: 27, col: 8}, {ofs: 807, row: 27, col: 81}], _aether._userInfo, false);\n tmp104 = 'sort';\n _aether.logStatementStart([{ofs: 726, row: 27, col: 0}, {ofs: 815, row: 27, col: 89}]); items = _aether.createAPIClone(_aether, tmp103[tmp104]()); _aether.logStatement([{ofs: 726, row: 27, col: 0}, {ofs: 815, row: 27, col: 89}], _aether._userInfo, false);\n tmp118 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp119 = 'say';\n tmp121 = items;\n tmp122 = 'map';\n tmp123 = debug_coin;\n _aether.logStatementStart([{ofs: 825, row: 28, col: 9}, {ofs: 846, row: 28, col: 30}]); tmp120 = _aether.createAPIClone(_aether, tmp121[tmp122](_aether.restoreAPIClone(_aether, tmp123))); _aether.logStatement([{ofs: 825, row: 28, col: 9}, {ofs: 846, row: 28, col: 30}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 816, row: 28, col: 0}, {ofs: 847, row: 28, col: 31}]); tmp124 = _aether.createAPIClone(_aether, tmp118[tmp119](_aether.restoreAPIClone(_aether, tmp120))); _aether.logStatement([{ofs: 816, row: 28, col: 0}, {ofs: 847, row: 28, col: 31}], _aether._userInfo, false);\n tmp127 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp128 = 'usedTerrify';\n _aether.logStatementStart([{ofs: 854, row: 30, col: 4}, {ofs: 870, row: 30, col: 20}]); tmp126 = tmp127[tmp128]; _aether.logStatement([{ofs: 854, row: 30, col: 4}, {ofs: 870, row: 30, col: 20}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 853, row: 30, col: 3}, {ofs: 870, row: 30, col: 20}]); tmp125 = !tmp126; _aether.logStatement([{ofs: 853, row: 30, col: 3}, {ofs: 870, row: 30, col: 20}], _aether._userInfo, false);\n if (tmp125) {\n tmp132 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp133 = 'distance';\n tmp135 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp136 = 'getNearestEnemy';\n _aether.logStatementStart([{ofs: 895, row: 31, col: 21}, {ofs: 917, row: 31, col: 43}]); tmp134 = _aether.createAPIClone(_aether, tmp135[tmp136]()); _aether.logStatement([{ofs: 895, row: 31, col: 21}, {ofs: 917, row: 31, col: 43}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 881, row: 31, col: 7}, {ofs: 918, row: 31, col: 44}]); tmp130 = _aether.createAPIClone(_aether, tmp132[tmp133](_aether.restoreAPIClone(_aether, tmp134))); _aether.logStatement([{ofs: 881, row: 31, col: 7}, {ofs: 918, row: 31, col: 44}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 921, row: 31, col: 47}, {ofs: 922, row: 31, col: 48}]); tmp131 = 5; _aether.logStatement([{ofs: 921, row: 31, col: 47}, {ofs: 922, row: 31, col: 48}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 881, row: 31, col: 7}, {ofs: 922, row: 31, col: 48}]); tmp129 = tmp130 < tmp131; _aether.logStatement([{ofs: 881, row: 31, col: 7}, {ofs: 922, row: 31, col: 48}], _aether._userInfo, false);\n if (tmp129) {\n tmp138 = use_terrify;\n tmp139 = player;\n _aether.logStatementStart([{ofs: 941, row: 32, col: 15}, {ofs: 960, row: 32, col: 34}]); tmp137 = _aether.createAPIClone(_aether, tmp138(_aether.restoreAPIClone(_aether, tmp139))); _aether.logStatement([{ofs: 941, row: 32, col: 15}, {ofs: 960, row: 32, col: 34}], _aether._userInfo, false);\n _aether.logCallEnd(); return _aether.restoreAPIClone(_aether, tmp137);\n } else {\n ;\n }\n tmp143 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp144 = 'now';\n _aether.logStatementStart([{ofs: 975, row: 34, col: 7}, {ofs: 985, row: 34, col: 17}]); tmp141 = _aether.createAPIClone(_aether, tmp143[tmp144]()); _aether.logStatement([{ofs: 975, row: 34, col: 7}, {ofs: 985, row: 34, col: 17}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 988, row: 34, col: 20}, {ofs: 990, row: 34, col: 22}]); tmp142 = 40; _aether.logStatement([{ofs: 988, row: 34, col: 20}, {ofs: 990, row: 34, col: 22}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 975, row: 34, col: 7}, {ofs: 990, row: 34, col: 22}]); tmp140 = tmp141 > tmp142; _aether.logStatement([{ofs: 975, row: 34, col: 7}, {ofs: 990, row: 34, col: 22}], _aether._userInfo, false);\n if (tmp140) {\n tmp146 = use_terrify;\n tmp147 = player;\n _aether.logStatementStart([{ofs: 1009, row: 35, col: 15}, {ofs: 1028, row: 35, col: 34}]); tmp145 = _aether.createAPIClone(_aether, tmp146(_aether.restoreAPIClone(_aether, tmp147))); _aether.logStatement([{ofs: 1009, row: 35, col: 15}, {ofs: 1028, row: 35, col: 34}], _aether._userInfo, false);\n _aether.logCallEnd(); return _aether.restoreAPIClone(_aether, tmp145);\n } else {\n ;\n }\n } else {\n ;\n }\n tmp149 = items;\n _aether.logStatementStart([{ofs: 1049, row: 39, col: 10}, {ofs: 1050, row: 39, col: 11}]); tmp150 = 0; _aether.logStatement([{ofs: 1049, row: 39, col: 10}, {ofs: 1050, row: 39, col: 11}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1043, row: 39, col: 4}, {ofs: 1051, row: 39, col: 12}]); tmp148 = tmp149[tmp150]; _aether.logStatement([{ofs: 1043, row: 39, col: 4}, {ofs: 1051, row: 39, col: 12}], _aether._userInfo, false);\n if (tmp148) {\n tmp151 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp152 = 'move';\n tmp158 = items;\n _aether.logStatementStart([{ofs: 1075, row: 40, col: 20}, {ofs: 1076, row: 40, col: 21}]); tmp159 = 0; _aether.logStatement([{ofs: 1075, row: 40, col: 20}, {ofs: 1076, row: 40, col: 21}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1069, row: 40, col: 14}, {ofs: 1077, row: 40, col: 22}]); tmp156 = tmp158[tmp159]; _aether.logStatement([{ofs: 1069, row: 40, col: 14}, {ofs: 1077, row: 40, col: 22}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1078, row: 40, col: 23}, {ofs: 1079, row: 40, col: 24}]); tmp157 = 1; _aether.logStatement([{ofs: 1078, row: 40, col: 23}, {ofs: 1079, row: 40, col: 24}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1069, row: 40, col: 14}, {ofs: 1080, row: 40, col: 25}]); tmp154 = tmp156[tmp157]; _aether.logStatement([{ofs: 1069, row: 40, col: 14}, {ofs: 1080, row: 40, col: 25}], _aether._userInfo, false);\n tmp155 = 'pos';\n _aether.logStatementStart([{ofs: 1069, row: 40, col: 14}, {ofs: 1084, row: 40, col: 29}]); tmp153 = tmp154[tmp155]; _aether.logStatement([{ofs: 1069, row: 40, col: 14}, {ofs: 1084, row: 40, col: 29}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1059, row: 40, col: 4}, {ofs: 1085, row: 40, col: 30}]); tmp160 = _aether.createAPIClone(_aether, tmp151[tmp152](_aether.restoreAPIClone(_aether, tmp153))); _aether.logStatement([{ofs: 1059, row: 40, col: 4}, {ofs: 1085, row: 40, col: 30}], _aether._userInfo, false);\n } else {\n tmp161 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp162 = 'moveXY';\n _aether.logStatementStart([{ofs: 1112, row: 42, col: 16}, {ofs: 1114, row: 42, col: 18}]); tmp163 = 64; _aether.logStatement([{ofs: 1112, row: 42, col: 16}, {ofs: 1114, row: 42, col: 18}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1116, row: 42, col: 20}, {ofs: 1118, row: 42, col: 22}]); tmp164 = 40; _aether.logStatement([{ofs: 1116, row: 42, col: 20}, {ofs: 1118, row: 42, col: 22}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 1100, row: 42, col: 4}, {ofs: 1119, row: 42, col: 23}]); tmp165 = _aether.createAPIClone(_aether, tmp161[tmp162](_aether.restoreAPIClone(_aether, tmp163), _aether.restoreAPIClone(_aether, tmp164))); _aether.logStatement([{ofs: 1100, row: 42, col: 4}, {ofs: 1119, row: 42, col: 23}], _aether._userInfo, false);\n }\n _aether.logCallEnd(); return;\n };\n tmp0 = 'chooseAction';\n __global[tmp0] = tmp1;\n}(this));" }, - "programmable-shaman": { - "chooseAction": "if (this.hero !== undefined) {\n this.hero = this.getNearest(enemy);\n}\n// Shamans are spellcasters with a weak magic attack\n// and three spells: 'shrink', 'grow', and 'poison-cloud'.\n// Shrink: target has 2/3 health, 1.5x speed for 5s.\n// Grow: target has double health, half speed for 5s.\n// Once per match, she can cast poison cloud, which does\n// 5 poison dps for 10s to enemies in a 10m radius.\nvar right = 0;\nif(right === 0){this.move({x: 70, y: 40});\n}\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\nif (enemies.length === 0) return; // Chill if all enemies are dead.\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\n\nif(this.canCast('shrink', enemy)) \n{\n this.castShrink(enemy);\n}\nelse\n{\n this.castGrow(friend);\n}\n\nvar enemiesinpoisonrange = 0;\nfor (var i = 0; i < enemies.lenght; ++i) {\n var enemi = enemies[i];\n if (this.distance(enemi) <= 10) {\n enemiesinpoisonrange++;\n }\n}\nif (enemiesinpoisonrange >= 7) {\n this.castPoisonCloud(enemy);\n}\n//if (this.distance(ogrebase) > 10) {\n// this.move({x: 70, y: 30});\n//}\n//this.say(\"Defend!\", {targetPos: {x: 45, y: 30}});\n\n//this.say(\"Defend!\", {targetPos: {x: 35, y: 30}});\n\n//this.say(\"Defend!\", {targetPos: {x: 25, y: 30}});\n\n//this.say(\"Attack!\", {to:{x:20, y:30}});\n\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(this.canCast('shrink', enemy)) this.castShrink(enemy);\n//if(this.canCast('grow', friend)) this.castGrow(friend);\n//if(this.canCast('poison-cloud', enemy)) this.castPoisonCloud(enemy);\n//this.attack(enemy);\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 45, y: 30}});\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 50, y: 40});" - }, - "programmable-brawler": { - "chooseAction": "// The Brawler is a huge melee hero with mighty mass.\n// this.throw() hurls an enemy behind him.\n// this.jumpTo() leaps to a target within 20m every 10s.\n// this.stomp() knocks everyone away, once per match.\n\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\nif (enemies.length === 0) return; // Chill if all enemies are dead.\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(!this.getCooldown('jump')) this.jumpTo(enemy.pos);\n//if(!this.getCooldown('stomp') && this.distance(enemy) < 10) this.stomp();\n//if(!this.getCooldown('throw')) this.throw(enemy);\n//this.attack(enemy);\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 60, y: 30}}));\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 50, y: 40});\n\n// You can store state on this across frames:\n//this.lastHealth = this.health;{x: 68, y: 29}{x: 70, y: 30}" - }, - "programmable-librarian": { - "chooseAction": "var enemies = this.getEnemies();\nif (enemies.length === 0)\n return;\nvar enemy = this.getNearest(enemies);\nvar friends = this.getFriends();\nvar friend = this.getNearest(friends);\nvar archer = this.getFriends(type, \"archer\");\nvar soldier = this.getFriends(type, \"soldier\");\nvar hero = this.getFriends(type, \"hushbaum\");\nvar rand = Math.random();\nvar xmove;\nvar ymove;\nfor (var i = 0; i < enemies.length / 3; i += 1) {\n var e = enemies[i];\n var ehealth = Math.floor(e.health);\n if (this.canCast(\"haste\", friend)) {\n this.say(\"Godspeed \" + friend.id + \"!\");\n this.castHaste(friend);\n }\n if (this.canCast(\"haste\", this)) {\n this.say(\"I am Godspeed!\");\n this.castHaste(this);\n }\n if (this.canCast(\"slow\", e)) {\n this.say(\"Chill Out \" + e.id + \"!\");\n this.castSlow(e);\n }\n if (this.distance(e) < 45) {\n this.attack(e);\n this.say(\"Attacking \" + e.id + \" life is \" + ehealth + \".\");\n }\n if (this.health < this.maxHealth * 0.75) {\n if (this.pos.x > 20) {\n this.move({\n x: this.pos.x - 20,\n y: this.pos.y\n });\n } else {\n this.move({\n x: this.pos.x + 20,\n y: this.pos.y\n });\n }\n }\n if (this.canCast(\"regen\", this)) {\n this.castRegen(this);\n this.say(\"I won't die today bitch!\");\n }\n if (friend.health < friend.maxHealth * 0.5) {\n if (this.canCast(\"regen\", friend)) {\n this.say(\"You won't die today \" + friend.id + \".\");\n this.castRegen(friend);\n }\n }\n}\n;" - }, - "programmable-tharin": { - "chooseAction": "// Tharin is a melee fighter with shield, warcry, and terrify skills.\n// this.shield() lets him take one-third damage while defending.\n// this.warcry() gives allies within 10m 30% haste for 5s, every 10s.\n// this.terrify() sends foes within 30m fleeing for 5s, once per match.\n\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\nif (enemies.length === 0) return; // Chill if all enemies are dead.\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(!this.getCooldown('warcry')) this.warcry();\n//if(!this.getCooldown('terrify')) this.terrify();\n//this.shield();\n//this.attack(enemy);\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 30, y: 30}}));\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 40, y: 40});\n\n// You can store state on this across frames:\n//this.lastHealth = this.health;" - }, - "human-base": { - "chooseAction": "// This is the code for your base. Decide which unit to build each frame.\n// Units you build will go into the this.built array.\n// Destroy the enemy base within 60 seconds!\n// Check out the Guide at the top for more info.\n\n// CHOOSE YOUR HERO! You can only build one hero.\nvar hero;\n//hero = 'tharin'; // A fierce knight with battlecry abilities.\nhero = 'hushbaum'; // A fiery spellcaster hero.\n\nif(hero && !this.builtHero) {\n this.builtHero = this.build(hero);\n return;\n}\n\n// Soldiers are hard-to-kill, low damage melee units with 2s build cooldown.\n// Archers are fragile but deadly ranged units with 2.5s build cooldown.\nvar buildOrder = ['soldier', 'soldier', 'archer', 'archer', 'soldier', 'soldier'];\nvar type = buildOrder[this.built.length % buildOrder.length];\nthis.say('Unit #' + this.built.length + ' will be a ' + type);\nthis.build(type);\n\n " - } + "coin-generator-9000": {} }, + "submittedCodeLanguage": "javascript", "teamSpells": { - "ogres": [ - "programmable-brawler/chooseAction", - "programmable-shaman/chooseAction", - "ogre-base/chooseAction" - ], - "humans": [ - "programmable-librarian/chooseAction", - "programmable-tharin/chooseAction", - "human-base/chooseAction" - ] + "common": ["coin-generator-9000/chooseAction"], + "humans": ["tharin/chooseAction"], + "ogres": ["mak-fod/chooseAction"] }, - "levelID": "dungeon-arena", - "creator": "5338c38c4811eff221de2347", - "creatorName": "iC0DE" - }, - { - "sessionID": "532a777c2042708b711a6c29", - "submitDate": "2014-03-20T05:45:54.691Z", + "levelID": "gold-rush", + "creatorName": "s-krackas", + "creator": "539b4c9cb4c4f93805452aba", + "totalScore": 36.389248829587835 + }, { + "sessionID": "53fdc33abfe0d7f308a6906a", "team": "ogres", - "code": { - "ogre-base": { - "chooseAction": "// This is the code for your base. Decide which unit to build each frame.\n// Units you build will go into the this.built array.\n// Destroy the enemy base within 60 seconds!\n// Check out the Guide at the top for more info.\n\n// Choose your hero! You can only build one hero.\nvar hero;\n//hero = 'ironjaw'; // A leaping juggernaut hero, type 'brawler'.\nhero = 'yugargen'; // A devious spellcaster hero, type 'shaman'.\nif(hero && !this.builtHero) {\n this.builtHero = this.build(hero);\n return;\n}\n\n// Munchkins are weak melee units with 1.25s build cooldown.\n// Throwers are fragile, deadly ranged units with 2.5s build cooldown.\nvar buildOrder = ['munchkin', 'munchkin', 'munchkin', 'thrower'];\nvar type = buildOrder[this.built.length % buildOrder.length];\n//this.say('Unit #' + this.built.length + ' will be a ' + type);\nthis.build(type);" - }, - "programmable-shaman": { - "chooseAction": "// Shamans are spellcasters with a weak magic attack\n// and three spells: 'shrink', 'grow', and 'poison-cloud'.\n// Shrink: target has 2/3 health, 1.5x speed for 5s.\n// Grow: target has double health, half speed for 5s.\n// Once per match, she can cast poison cloud, which does\n// 5 poison dps for 10s to enemies in a 10m radius.\n\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\nif (enemies.length === 0) {\n return; // Chill if all enemies are dead.\n}\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\nif (enemies.length > 5) {\n if(this.canCast('poison-cloud', enemy)) {\n this.castPoisonCloud(enemy);\n return;\n }\n}\n\nif (friends.length > 4) {\n this.attack(enemy); \n}\nfor (var i = 0; i < friends.length; ++i) {\n if (friends[i].health < 0) {\n continue;\n }\n if(friends[i].type == \"thrower\" && this.canCast('shrink', friends[i])) {\n this.castShrink(friends[i]);\n return;\n } \n if(friends[i].type == \"munchkin\" && this.canCast('grow', friends[i])) {\n this.castGrow(friends[i]);\n return;\n } \n}\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(this.canCast('shrink', enemy)) this.castShrink(enemy);\n//if(this.canCast('grow', friend)) this.castGrow(friend);\n//if(this.canCast('poison-cloud', enemy)) this.castPoisonCloud(enemy);\n//this.attack(enemy);\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 60, y: 30}}));\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 50, y: 40});" - }, - "programmable-brawler": { - "chooseAction": "// The Brawler is a huge melee hero with mighty mass.\n// this.throw() hurls an enemy behind him.\n// this.jumpTo() leaps to a target within 20m every 10s.\n// this.stomp() knocks everyone away, once per match.\n\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\nif (enemies.length === 0) return; // Chill if all enemies are dead.\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(!this.getCooldown('jump')) this.jumpTo(enemy.pos);\n//if(!this.getCooldown('stomp') && this.distance(enemy) < 10) this.stomp();\n//if(!this.getCooldown('throw')) this.throw(enemy);\n//this.attack(enemy);\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 60, y: 30}}));\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 50, y: 40});\n\n// You can store state on this across frames:\n//this.lastHealth = this.health;" - }, - "human-base": { - "chooseAction": "// This is the code for your base. Decide which unit to build each frame.\n// Units you build will go into the this.built array.\n// Destroy the enemy base within 60 seconds!\n// Check out the Guide at the top for more info.\n\n// CHOOSE YOUR HERO! You can only build one hero.\nvar hero;\nhero = 'tharin'; // A fierce knight with battlecry abilities.\n//hero = 'hushbaum'; // A fiery spellcaster hero.\n\nif(hero && !this.builtHero) {\n this.builtHero = this.build(hero);\n return;\n}\n\n// Soldiers are hard-to-kill, low damage melee units with 2s build cooldown.\n// Archers are fragile but deadly ranged units with 2.5s build cooldown.\nvar buildOrder = ['archer', 'archer', 'soldier', 'archer', 'soldier'];\nvar type = buildOrder[this.built.length % buildOrder.length];\n//this.say('Unit #' + this.built.length + ' will be a ' + type);\nthis.build(type);" - }, - "programmable-tharin": { - "chooseAction": "this.findTypeInRange = function(units, type) {\n for (var i = 0; i < units.length; ++i) {\n var unit = units[i];\n if (unit.type === type && this.distance(unit) < 20)\n return unit;\n }\n return null;\n};\n\nthis.findType = function(units, type) {\n for (var i = 0; i < units.length; ++i) {\n var unit = units[i];\n if (unit.type === type)\n return unit;\n }\n return null;\n};\n\nthis.findHeroInRange = function(units, range) {\n for (var i = 0; i < units.length; ++i) {\n var unit = units[i];\n if ((unit.type === 'shaman' || unit.type === 'brawler') && this.distance(unit) < range)\n return unit;\n }\n return null;\n};\n\n// Tharin is a melee fighter with shield, warcry, and terrify skills.\n// this.shield() lets him take one-third damage while defending.\n// this.warcry() gives allies within 10m 30% haste for 5s, every 10s.\n// this.terrify() sends foes within 30m fleeing for 5s, once per match.\n\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\n\n//Enemies\nvar enemyBase = this.findType(enemies, 'base');\nvar brawler = this.findTypeInRange(enemies, 'brawler');\nvar shaman = this.findTypeInRange(enemies, 'shaman');\n\nif (enemies.length === 0) return; // Chill if all enemies are dead.\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(!this.getCooldown('warcry')) this.warcry();\n//if(!this.getCooldown('terrify')) this.terrify();\n//this.shield();\n\nif((brawler || shaman) && !this.attackTime)\n{\n this.attackTime = true;\n if(brawler)\n this.say(\"Attack!\", {target: brawler});\n else if(shaman)\n this.say(\"Attack!\", {target: shaman});\n}\nelse if(this.health < 15 && this.getCooldown('terrify'))\n{\n this.terrify();\n}\nelse if(this.findHeroInRange(enemies, 30) && this.getCooldown('terrify'))\n{\n this.terrify();\n}\nelse if(this.health < 25)\n{\n this.shield();\n}\nelse if(brawler && this.distance(brawler) <=10)\n{\n this.attack(brawler);\n}\nelse\n{\n this.attack(enemy);\n}\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 30, y: 30}}));\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 40, y: 40});\n\n// You can store state on this across frames:\n//this.lastHealth = this.health;" - }, - "programmable-librarian": { - "chooseAction": "// The Librarian is a spellcaster with a fireball attack\n// plus three useful spells: 'slow', 'regen', and 'haste'.\n// Slow makes a target move and attack at half speed for 5s.\n// Regen makes a target heal 10 hp/s for 10s.\n// Haste speeds up a target by 4x for 5s, once per match.\n\nvar friends = this.getFriends();\nvar enemies = this.getEnemies();\nif (enemies.length === 0) return; // Chill if all enemies are dead.\nvar enemy = this.getNearest(enemies);\nvar friend = this.getNearest(friends);\n\n// Which one do you do at any given time? Only the last called action happens.\n//if(this.canCast('slow', enemy)) this.castSlow(enemy);\n//if(this.canCast('regen', friend)) this.castRegen(friend);\n//if(this.canCast('haste', friend)) this.castHaste(friend);\n//this.attack(enemy);\n\n// You can also command your troops with this.say():\n//this.say(\"Defend!\", {targetPos: {x: 30, y: 30}}));\n//this.say(\"Attack!\", {target: enemy});\n//this.say(\"Move!\", {targetPos: {x: 50, y: 40});" + "transpiledCode": { + "mak-fod": { + "chooseAction": "var __interceptThis=(function(){var G=this;return function($this,sandbox){if($this==G){return sandbox;}return $this;};})();\nreturn (function (__global) {\n var tmp0, tmp1;\n tmp1 = function () {\n 'use strict'; _aether.logCallStart(_aether._userInfo); var items, saystring, currdistance, currindex, i, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15, tmp18, tmp19, tmp20, tmp21, tmp22, tmp23, tmp24, tmp25, tmp26, tmp27, tmp28, tmp29, tmp30, tmp31, tmp32, tmp33, tmp34, tmp35, tmp36, tmp37, tmp38, tmp39, tmp40, tmp41, tmp42, tmp43, tmp44, tmp45, tmp46, tmp47, tmp48, tmp49, tmp50, tmp51, tmp52, tmp53, tmp54, tmp55, tmp56, tmp57, tmp58, tmp59, tmp60, tmp61, tmp62, tmp63, tmp64; for(var __argIndexer = 0; __argIndexer < arguments.length; ++__argIndexer) arguments[__argIndexer] = _aether.createAPIClone(_aether, arguments[__argIndexer]);\n tmp2 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp3 = 'getItems';\n _aether.logStatementStart([{ofs: 173, row: 4, col: 0}, {ofs: 201, row: 4, col: 28}]); items = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp2[tmp3]())); _aether.logStatement([{ofs: 173, row: 4, col: 0}, {ofs: 201, row: 4, col: 28}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 202, row: 5, col: 0}, {ofs: 221, row: 5, col: 19}]); saystring = ''; _aether.logStatement([{ofs: 202, row: 5, col: 0}, {ofs: 221, row: 5, col: 19}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 242, row: 6, col: 20}, {ofs: 243, row: 6, col: 21}]); tmp4 = 1; _aether.logStatement([{ofs: 242, row: 6, col: 20}, {ofs: 243, row: 6, col: 21}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 222, row: 6, col: 0}, {ofs: 244, row: 6, col: 22}]); currdistance = -tmp4; _aether.logStatement([{ofs: 222, row: 6, col: 0}, {ofs: 244, row: 6, col: 22}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 245, row: 7, col: 0}, {ofs: 263, row: 7, col: 18}]); currindex = 0; _aether.logStatement([{ofs: 245, row: 7, col: 0}, {ofs: 263, row: 7, col: 18}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 268, row: 8, col: 4}, {ofs: 277, row: 8, col: 13}]); i = 0; _aether.logStatement([{ofs: 268, row: 8, col: 4}, {ofs: 277, row: 8, col: 13}], _aether._userInfo, false);\n tmp6 = i;\n tmp8 = items;\n tmp9 = 'length';\n _aether.logStatementStart([{ofs: 283, row: 8, col: 19}, {ofs: 295, row: 8, col: 31}]); tmp7 = tmp8[tmp9]; _aether.logStatement([{ofs: 283, row: 8, col: 19}, {ofs: 295, row: 8, col: 31}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 279, row: 8, col: 15}, {ofs: 295, row: 8, col: 31}]); tmp5 = tmp6 < tmp7; _aether.logStatement([{ofs: 279, row: 8, col: 15}, {ofs: 295, row: 8, col: 31}], _aether._userInfo, false);\n tmp16: {\n while (tmp5) {\n tmp17: {\n tmp19 = i;\n _aether.logStatementStart([{ofs: 325, row: 9, col: 21}, {ofs: 327, row: 9, col: 23}]); tmp20 = ''; _aether.logStatement([{ofs: 325, row: 9, col: 21}, {ofs: 327, row: 9, col: 23}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 308, row: 9, col: 4}, {ofs: 328, row: 9, col: 24}]); tmp18 = tmp19 + tmp20; _aether.logStatement([{ofs: 308, row: 9, col: 4}, {ofs: 328, row: 9, col: 24}], _aether._userInfo, false);\n tmp21 = saystring;\n tmp22 = tmp18;\n saystring = tmp21 + tmp22;\n tmp24 = currdistance;\n _aether.logStatementStart([{ofs: 353, row: 10, col: 24}, {ofs: 354, row: 10, col: 25}]); tmp26 = 1; _aether.logStatement([{ofs: 353, row: 10, col: 24}, {ofs: 354, row: 10, col: 25}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 352, row: 10, col: 23}, {ofs: 354, row: 10, col: 25}]); tmp25 = -tmp26; _aether.logStatement([{ofs: 352, row: 10, col: 23}, {ofs: 354, row: 10, col: 25}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 336, row: 10, col: 7}, {ofs: 354, row: 10, col: 25}]); tmp23 = tmp24 == tmp25; _aether.logStatement([{ofs: 336, row: 10, col: 7}, {ofs: 354, row: 10, col: 25}], _aether._userInfo, false);\n if (tmp23) {\n tmp27 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp28 = 'distance';\n tmp30 = items;\n tmp31 = i;\n _aether.logStatementStart([{ofs: 395, row: 11, col: 37}, {ofs: 403, row: 11, col: 45}]); tmp29 = tmp30[tmp31]; _aether.logStatement([{ofs: 395, row: 11, col: 37}, {ofs: 403, row: 11, col: 45}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 366, row: 11, col: 8}, {ofs: 405, row: 11, col: 47}]); currdistance = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp27[tmp28](_aether.restoreAPIClone(_aether, tmp29)))); _aether.logStatement([{ofs: 366, row: 11, col: 8}, {ofs: 405, row: 11, col: 47}], _aether._userInfo, false);\n } else {\n ;\n }\n tmp35 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp36 = 'distance';\n tmp38 = items;\n tmp39 = i;\n _aether.logStatementStart([{ofs: 433, row: 13, col: 21}, {ofs: 441, row: 13, col: 29}]); tmp37 = tmp38[tmp39]; _aether.logStatement([{ofs: 433, row: 13, col: 21}, {ofs: 441, row: 13, col: 29}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 419, row: 13, col: 7}, {ofs: 442, row: 13, col: 30}]); tmp33 = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp35[tmp36](_aether.restoreAPIClone(_aether, tmp37)))); _aether.logStatement([{ofs: 419, row: 13, col: 7}, {ofs: 442, row: 13, col: 30}], _aether._userInfo, false);\n tmp34 = currdistance;\n _aether.logStatementStart([{ofs: 419, row: 13, col: 7}, {ofs: 457, row: 13, col: 45}]); tmp32 = tmp33 < tmp34; _aether.logStatement([{ofs: 419, row: 13, col: 7}, {ofs: 457, row: 13, col: 45}], _aether._userInfo, false);\n if (tmp32) {\n tmp40 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp41 = 'distance';\n tmp43 = items;\n tmp44 = i;\n _aether.logStatementStart([{ofs: 498, row: 14, col: 37}, {ofs: 506, row: 14, col: 45}]); tmp42 = tmp43[tmp44]; _aether.logStatement([{ofs: 498, row: 14, col: 37}, {ofs: 506, row: 14, col: 45}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 469, row: 14, col: 8}, {ofs: 508, row: 14, col: 47}]); currdistance = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp40[tmp41](_aether.restoreAPIClone(_aether, tmp42)))); _aether.logStatement([{ofs: 469, row: 14, col: 8}, {ofs: 508, row: 14, col: 47}], _aether._userInfo, false);\n currindex = i;\n } else {\n ;\n }\n }\n tmp14 = i;\n tmp15 = 1;\n i = tmp14 + tmp15;\n tmp10 = i;\n tmp12 = items;\n tmp13 = 'length';\n _aether.logStatementStart([{ofs: 283, row: 8, col: 19}, {ofs: 295, row: 8, col: 31}]); tmp11 = tmp12[tmp13]; _aether.logStatement([{ofs: 283, row: 8, col: 19}, {ofs: 295, row: 8, col: 31}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 279, row: 8, col: 15}, {ofs: 295, row: 8, col: 31}]); tmp5 = tmp10 < tmp11; _aether.logStatement([{ofs: 279, row: 8, col: 15}, {ofs: 295, row: 8, col: 31}], _aether._userInfo, false);\n }\n }\n tmp45 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp46 = 'say';\n tmp47 = currindex;\n _aether.logStatementStart([{ofs: 546, row: 20, col: 0}, {ofs: 565, row: 20, col: 19}]); tmp48 = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp45[tmp46](_aether.restoreAPIClone(_aether, tmp47)))); _aether.logStatement([{ofs: 546, row: 20, col: 0}, {ofs: 565, row: 20, col: 19}], _aether._userInfo, false);\n tmp50 = items;\n tmp51 = currindex;\n _aether.logStatementStart([{ofs: 571, row: 21, col: 4}, {ofs: 587, row: 21, col: 20}]); tmp49 = tmp50[tmp51]; _aether.logStatement([{ofs: 571, row: 21, col: 4}, {ofs: 587, row: 21, col: 20}], _aether._userInfo, false);\n if (tmp49) {\n tmp52 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp53 = 'move';\n tmp57 = items;\n tmp58 = currindex;\n _aether.logStatementStart([{ofs: 605, row: 22, col: 14}, {ofs: 621, row: 22, col: 30}]); tmp55 = tmp57[tmp58]; _aether.logStatement([{ofs: 605, row: 22, col: 14}, {ofs: 621, row: 22, col: 30}], _aether._userInfo, false);\n tmp56 = 'pos';\n _aether.logStatementStart([{ofs: 605, row: 22, col: 14}, {ofs: 625, row: 22, col: 34}]); tmp54 = tmp55[tmp56]; _aether.logStatement([{ofs: 605, row: 22, col: 14}, {ofs: 625, row: 22, col: 34}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 595, row: 22, col: 4}, {ofs: 626, row: 22, col: 35}]); tmp59 = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp52[tmp53](_aether.restoreAPIClone(_aether, tmp54)))); _aether.logStatement([{ofs: 595, row: 22, col: 4}, {ofs: 626, row: 22, col: 35}], _aether._userInfo, false);\n } else {\n tmp60 = _aether.createAPIClone(_aether, __interceptThis(this, __global));\n tmp61 = 'moveXY';\n _aether.logStatementStart([{ofs: 653, row: 24, col: 16}, {ofs: 655, row: 24, col: 18}]); tmp62 = 18; _aether.logStatement([{ofs: 653, row: 24, col: 16}, {ofs: 655, row: 24, col: 18}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 657, row: 24, col: 20}, {ofs: 659, row: 24, col: 22}]); tmp63 = 36; _aether.logStatement([{ofs: 657, row: 24, col: 20}, {ofs: 659, row: 24, col: 22}], _aether._userInfo, false);\n _aether.logStatementStart([{ofs: 641, row: 24, col: 4}, {ofs: 660, row: 24, col: 23}]); tmp64 = _aether.convertToNativeType(_aether.createAPIClone(_aether, tmp60[tmp61](_aether.restoreAPIClone(_aether, tmp62), _aether.restoreAPIClone(_aether, tmp63)))); _aether.logStatement([{ofs: 641, row: 24, col: 4}, {ofs: 660, row: 24, col: 23}], _aether._userInfo, false);\n }\n _aether.logCallEnd(); return;\n };\n tmp0 = 'chooseAction';\n __global[tmp0] = tmp1;\n}(this));" } }, + "submittedCodeLanguage": "javascript", "teamSpells": { - "ogres": [ - "programmable-brawler/chooseAction", - "programmable-shaman/chooseAction", - "ogre-base/chooseAction" - ], - "humans": [ - "programmable-librarian/chooseAction", - "programmable-tharin/chooseAction", - "human-base/chooseAction" - ] + "common": ["coin-generator-9000/chooseAction"], + "humans": ["tharin/chooseAction"], + "ogres": ["mak-fod/chooseAction"] }, - "levelID": "dungeon-arena", - "creator": "53291a80b112e7240f324667", - "creatorName": "Imbal Oceanrage" - } -], - "taskID": "53415d71942d00aa43dbf3e9", - "receiptHandle": "cd50e44db7dbd4cc0bcce047aa822ba2fe3556cf" -} \ No newline at end of file + "levelID": "gold-rush", + "creatorName": "monkboll", + "creator": "53fdb782716abde208a0e7a4", + "totalScore": 24.174942315603005 + }] +}