From 7e1dc100c15aafe4f3e2f8fc1f567f876ff81e34 Mon Sep 17 00:00:00 2001 From: Mario Meltzow Date: Sat, 4 Mar 2017 11:46:36 +0100 Subject: [PATCH 01/15] first step for typescriptify it --- .gitignore | 2 + Characters/Animation.js | 1262 ++++++------- Characters/Animation.ts | 1062 +++++++++++ Characters/Building.js | 2254 ++++++++++++------------ Characters/Building.ts | 3116 +++++++++++++++++++++++++++++++++ Characters/Bullets.js | 1002 +++++------ Characters/Bullets.ts | 805 +++++++++ Characters/Burst.js | 1837 +++++++++---------- Characters/Burst.ts | 1526 ++++++++++++++++ Characters/Button.js | 944 +++++----- Characters/Button.ts | 760 ++++++++ Characters/Gobj.js | 326 ++-- Characters/Gobj.ts | 264 +++ Characters/Hero.js | 518 +++--- Characters/Hero.ts | 447 +++++ Characters/Magic.js | 2047 +++++++++++----------- Characters/Magic.ts | 1690 ++++++++++++++++++ Characters/Map.js | 451 +++-- Characters/Map.ts | 230 +++ Characters/Neutral.js | 343 ++-- Characters/Neutral.ts | 326 ++++ Characters/Protoss.js | 1467 ++++++++-------- Characters/Protoss.ts | 1210 +++++++++++++ Characters/Terran.js | 1293 +++++++------- Characters/Terran.ts | 1097 ++++++++++++ Characters/Units.js | 992 ++++++----- Characters/Units.ts | 997 +++++++++++ Characters/Upgrade.js | 1609 ++++++++--------- Characters/Upgrade.ts | 1130 ++++++++++++ Characters/Zerg.js | 2107 +++++++++++----------- Characters/Zerg.ts | 1645 +++++++++++++++++ Controller/keyController.js | 90 +- Controller/keyController.ts | 108 ++ Controller/mouseController.js | 232 +-- Controller/mouseController.ts | 291 +++ GameRule/Cheat.js | 116 +- GameRule/Cheat.ts | 145 ++ GameRule/Game.js | 2320 ++++++++++++------------ GameRule/Game.ts | 1191 +++++++++++++ GameRule/Levels.js | 1291 +++++++------- GameRule/Levels.ts | 944 ++++++++++ GameRule/Multiplayer.js | 782 +++++---- GameRule/Multiplayer.ts | 402 +++++ GameRule/Referee.js | 765 ++++---- GameRule/Referee.ts | 417 +++++ GameRule/Resource.js | 229 +-- GameRule/Resource.ts | 121 ++ GameRule/SC_server.js | 199 ++- GameRule/SC_server.ts | 166 ++ Utils/sourceLoader.js | 61 +- Utils/sourceLoader.ts | 54 + tsconfig.json | 12 + typings.json | 5 + 53 files changed, 32626 insertions(+), 12074 deletions(-) create mode 100644 Characters/Animation.ts create mode 100644 Characters/Building.ts create mode 100644 Characters/Bullets.ts create mode 100644 Characters/Burst.ts create mode 100644 Characters/Button.ts create mode 100644 Characters/Gobj.ts create mode 100644 Characters/Hero.ts create mode 100644 Characters/Magic.ts create mode 100644 Characters/Map.ts create mode 100644 Characters/Neutral.ts create mode 100644 Characters/Protoss.ts create mode 100644 Characters/Terran.ts create mode 100644 Characters/Units.ts create mode 100644 Characters/Upgrade.ts create mode 100644 Characters/Zerg.ts create mode 100644 Controller/keyController.ts create mode 100644 Controller/mouseController.ts create mode 100644 GameRule/Cheat.ts create mode 100644 GameRule/Game.ts create mode 100644 GameRule/Levels.ts create mode 100644 GameRule/Multiplayer.ts create mode 100644 GameRule/Referee.ts create mode 100644 GameRule/Resource.ts create mode 100644 GameRule/SC_server.ts create mode 100644 Utils/sourceLoader.ts create mode 100644 tsconfig.json create mode 100644 typings.json diff --git a/.gitignore b/.gitignore index c554ec8..e9bc4e2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ Thumbs.db .svn/ .idea/ Original/ +*.map +node_modules/ diff --git a/Characters/Animation.js b/Characters/Animation.js index e677bdf..b5f3179 100644 --- a/Characters/Animation.js +++ b/Characters/Animation.js @@ -1,1062 +1,1064 @@ //Alias -var Animation=Burst; -Animation.getAllAnimations=function(){ - var allAnimes=[]; - for (var attr in Animation){ - if (Animation[attr].super===Animation) allAnimes.push(Animation[attr]); +var Animation = Burst; +Animation.getAllAnimations = function () { + var allAnimes = []; + for (var attr in Animation) { + if (Animation[attr].super === Animation) + allAnimes.push(Animation[attr]); } return allAnimes; }; -Animation.getName=function(anime){ - for (var attr in Animation){ +Animation.getName = function (anime) { + for (var attr in Animation) { //Should be animation constructor firstly - if (Animation[attr].super===Animation && (anime instanceof Animation[attr])) return attr; + if (Animation[attr].super === Animation && (anime instanceof Animation[attr])) + return attr; } }; - -Animation.RightClickCursor=Animation.extends({ - constructorPlus:function(props){ +Animation.RightClickCursor = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Burst", - imgPos:{ - burst:{ - left:[0, 44, 88, 132], - top:[1087,1087,1087,1087] + name: "Burst", + imgPos: { + burst: { + left: [0, 44, 88, 132], + top: [1087, 1087, 1087, 1087] } }, - width:44, - height:28, - frame:{ - burst:4 + width: 44, + height: 28, + frame: { + burst: 4 } } }); -Animation.PsionicStorm=Animation.extends({ - constructorPlus:function(props){ +Animation.PsionicStorm = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 188, 376, 564, 0, 188, 376, 564, 0, 188, 376, 564, 0, 188], - top:[0, 0, 0, 0, 153, 153, 153, 153, 306, 306, 306, 306, 459, 459] + name: "Magic", + imgPos: { + burst: { + left: [0, 188, 376, 564, 0, 188, 376, 564, 0, 188, 376, 564, 0, 188], + top: [0, 0, 0, 0, 153, 153, 153, 153, 306, 306, 306, 306, 459, 459] } }, - width:188, - height:153, - scale:1.2, - duration:7000, - frame:{ - burst:14 + width: 188, + height: 153, + scale: 1.2, + duration: 7000, + frame: { + burst: 14 } } }); -Animation.Hallucination=Animation.extends({ - constructorPlus:function(props){ +Animation.Hallucination = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[752, 815, 878, 941, 1004, 1067, 1130, 1193, 1256, 752, 815, 878, 941, 1004, 1067, 1130, 1193, 1256], - top:[0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 63, 63, 63, 63, 63, 63, 63, 63] + name: "Magic", + imgPos: { + burst: { + left: [752, 815, 878, 941, 1004, 1067, 1130, 1193, 1256, 752, 815, 878, 941, 1004, 1067, 1130, 1193, 1256], + top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 63, 63, 63, 63, 63, 63, 63, 63] } }, - width:63, - height:63, - above:true, - frame:{ - burst:18 + width: 63, + height: 63, + above: true, + frame: { + burst: 18 } } }); -Animation.Consume=Animation.extends({ - constructorPlus:function(props){ +Animation.Consume = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[752, 826, 900, 974, 1048, 1122, 1196, 1270, 1344, 752, 826, 900, 974, 1048, 1122, 1196, 1270, 1344], - top:[126, 126, 126, 126, 126, 126, 126, 126, 126, 196, 196, 196, 196, 196, 196, 196, 196, 196] + name: "Magic", + imgPos: { + burst: { + left: [752, 826, 900, 974, 1048, 1122, 1196, 1270, 1344, 752, 826, 900, 974, 1048, 1122, 1196, 1270, 1344], + top: [126, 126, 126, 126, 126, 126, 126, 126, 126, 196, 196, 196, 196, 196, 196, 196, 196, 196] } }, - width:74, - height:70, - above:true, - autoSize:true, - frame:{ - burst:18 + width: 74, + height: 70, + above: true, + autoSize: true, + frame: { + burst: 18 } } }); -Animation.StasisField=Animation.extends({ - constructorPlus:function(props){ +Animation.StasisField = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:376, - top:459 + name: "Magic", + imgPos: { + burst: { + left: 376, + top: 459 } }, - width:130, - height:110, - above:true, - autoSize:'MAX', - scale:1.25, - duration:30000, - frame:{ - burst:1 + width: 130, + height: 110, + above: true, + autoSize: 'MAX', + scale: 1.25, + duration: 30000, + frame: { + burst: 1 } } }); -Animation.Lockdown=Animation.extends({ - constructorPlus:function(props){ +Animation.Lockdown = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[330, 0, 110, 220, 330, 0, 0, 0, 110, 220, 330, 0, 110, 220], - top:[723, 834, 834, 834, 834, 945, 0, 612, 612, 612, 612, 723, 723, 723] + name: "Magic", + imgPos: { + burst: { + left: [330, 0, 110, 220, 330, 0, 0, 0, 110, 220, 330, 0, 110, 220], + top: [723, 834, 834, 834, 834, 945, 0, 612, 612, 612, 612, 723, 723, 723] } }, - width:110, - height:111, - above:true, - autoSize:'MAX', - duration:60000, - frame:{ - burst:6 + width: 110, + height: 111, + above: true, + autoSize: 'MAX', + duration: 60000, + frame: { + burst: 6 } } }); -Animation.DarkSwarm=Animation.extends({ - constructorPlus:function(props){ +Animation.DarkSwarm = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1260, 752, 1006, 1260, 752, 0, 752, 1006, 1260, 752, 1006], - top:[456, 645, 645, 645, 834, 0, 267, 267, 267, 456, 456] + name: "Magic", + imgPos: { + burst: { + left: [1260, 752, 1006, 1260, 752, 0, 752, 1006, 1260, 752, 1006], + top: [456, 645, 645, 645, 834, 0, 267, 267, 267, 456, 456] } }, - width:254, - height:189, - scale:1.2, - duration:60000, - frame:{ - burst:5 + width: 254, + height: 189, + scale: 1.2, + duration: 60000, + frame: { + burst: 5 } } }); -Animation.Plague=Animation.extends({ - constructorPlus:function(props){ +Animation.Plague = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1144, 1274, 1404, 754, 884, 1014, 1144, 1274, 1404, 754, 884, 1014, 1144, 1274], - top:[892, 892, 892, 1022, 1022, 1022, 1022, 1022, 1022, 1152, 1152, 1152, 1152, 1152] + name: "Magic", + imgPos: { + burst: { + left: [1144, 1274, 1404, 754, 884, 1014, 1144, 1274, 1404, 754, 884, 1014, 1144, 1274], + top: [892, 892, 892, 1022, 1022, 1022, 1022, 1022, 1022, 1152, 1152, 1152, 1152, 1152] } }, - width:130, - height:130, - scale:1.2, - frame:{ - burst:14 + width: 130, + height: 130, + scale: 1.2, + frame: { + burst: 14 } } }); -Animation.PurpleEffect=Animation.extends({ - constructorPlus:function(props){ +Animation.PurpleEffect = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[440, 499, 558, 617], - top:[902,902,902,902] + name: "Magic", + imgPos: { + burst: { + left: [440, 499, 558, 617], + top: [902, 902, 902, 902] } }, - width:59, - height:60, - above:true, - autoSize:'MIN', - duration:30000, - frame:{ - burst:4 + width: 59, + height: 60, + above: true, + autoSize: 'MIN', + duration: 30000, + frame: { + burst: 4 } } }); -Animation.RedEffect=Animation.extends({ - constructorPlus:function(props){ +Animation.RedEffect = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1006, 1068, 1130, 1192], - top:[836,836,836,836] + name: "Magic", + imgPos: { + burst: { + left: [1006, 1068, 1130, 1192], + top: [836, 836, 836, 836] } }, - width:62, - height:50, - above:true, - autoSize:'MIN', - duration:30000, - frame:{ - burst:4 + width: 62, + height: 50, + above: true, + autoSize: 'MIN', + duration: 30000, + frame: { + burst: 4 } } }); -Animation.GreenEffect=Animation.extends({ - constructorPlus:function(props){ +Animation.GreenEffect = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1256, 1313, 1370, 1427], - top:[836,836,836,836] + name: "Magic", + imgPos: { + burst: { + left: [1256, 1313, 1370, 1427], + top: [836, 836, 836, 836] } }, - width:57, - height:46, - above:true, - autoSize:'MIN', - duration:30000, - frame:{ - burst:4 + width: 57, + height: 46, + above: true, + autoSize: 'MIN', + duration: 30000, + frame: { + burst: 4 } } }); -Animation.Ensnare=Animation.extends({ - constructorPlus:function(props){ +Animation.Ensnare = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 131, 262, 393, 524, 0, 131, 262, 393, 524, 0, 131, 262, 393, 524], - top:[1056, 1056, 1056, 1056, 1056, 1181, 1181, 1181, 1181, 1181, 1306, 1306, 1306, 1306, 1306] + name: "Magic", + imgPos: { + burst: { + left: [0, 131, 262, 393, 524, 0, 131, 262, 393, 524, 0, 131, 262, 393, 524], + top: [1056, 1056, 1056, 1056, 1056, 1181, 1181, 1181, 1181, 1181, 1306, 1306, 1306, 1306, 1306] } }, - width:131, - height:125, - scale:1.2, - frame:{ - burst:15 + width: 131, + height: 125, + scale: 1.2, + frame: { + burst: 15 } } }); -Animation.ScannerSweep=Animation.extends({ - constructorPlus:function(props){ +Animation.ScannerSweep = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1012, 1012, 1167, 1167, 1322, 1322, 1012, 1012, 1167, 1167, 1322, 1322], - top:[2220, 2220, 2220, 2220, 2220, 2220, 2335, 2335, 2335, 2335, 2335, 2335] + name: "Magic", + imgPos: { + burst: { + left: [1012, 1012, 1167, 1167, 1322, 1322, 1012, 1012, 1167, 1167, 1322, 1322], + top: [2220, 2220, 2220, 2220, 2220, 2220, 2335, 2335, 2335, 2335, 2335, 2335] } }, - width:155, - height:115, - scale:1.5, - duration:15600, - sight:350, - frame:{ - burst:12 + width: 155, + height: 115, + scale: 1.5, + duration: 15600, + sight: 350, + frame: { + burst: 12 } } }); -Animation.Feedback=Animation.extends({ - constructorPlus:function(props){ +Animation.Feedback = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[632, 702, 772, 842, 912, 982, 1052, 1122, 1192, 1262, 1332, 1402], - top:[2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872] + name: "Magic", + imgPos: { + burst: { + left: [632, 702, 772, 842, 912, 982, 1052, 1122, 1192, 1262, 1332, 1402], + top: [2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872] } }, - width:70, - height:70, - above:true, - autoSize:true, - frame:{ - burst:12 + width: 70, + height: 70, + above: true, + autoSize: true, + frame: { + burst: 12 } } }); -Animation.HellFire=Animation.extends({ - constructorPlus:function(props){ +Animation.HellFire = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[655, 730, 805, 880, 955, 1030, 1105, 1180, 1255, 1330], - top:[1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284] + name: "Magic", + imgPos: { + burst: { + left: [655, 730, 805, 880, 955, 1030, 1105, 1180, 1255, 1330], + top: [1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284] } }, - width:75, - height:75, - above:true, - autoSize:true, - frame:{ - burst:10 + width: 75, + height: 75, + above: true, + autoSize: true, + frame: { + burst: 10 } } }); -Animation.MindControl=Animation.extends({ - constructorPlus:function(props){ +Animation.MindControl = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[658, 720, 782, 844, 906, 968, 1030, 1092, 1154, 1216, 1278, 1340], - top:[1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378] + name: "Magic", + imgPos: { + burst: { + left: [658, 720, 782, 844, 906, 968, 1030, 1092, 1154, 1216, 1278, 1340], + top: [1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378] } }, - width:62, - height:40, - above:true, - autoSize:true, - frame:{ - burst:12 + width: 62, + height: 40, + above: true, + autoSize: true, + frame: { + burst: 12 } } }); -Animation.RechargeShields=Animation.extends({ - constructorPlus:function(props){ +Animation.RechargeShields = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 64, 128, 192, 256, 320, 384, 448, 0, 64, 128, 192, 256, 320, 384, 448], - top:[1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1496, 1496, 1496, 1496, 1496, 1496, 1496, 1496] + name: "Magic", + imgPos: { + burst: { + left: [0, 64, 128, 192, 256, 320, 384, 448, 0, 64, 128, 192, 256, 320, 384, 448], + top: [1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1496, 1496, 1496, 1496, 1496, 1496, 1496, 1496] } }, - width:64, - height:64, - above:true, - autoSize:true, - frame:{ - burst:16 + width: 64, + height: 64, + above: true, + autoSize: true, + frame: { + burst: 16 } } }); -Animation.DisruptionWeb=Animation.extends({ - constructorPlus:function(props){ +Animation.DisruptionWeb = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1396,1396,1396,1396,1088,1088,1242,1242,1392,1392,1392,1392], - top:[1194,1194,1322,1322,1432,1432,1432,1432,1432,1432,1538,1538] + name: "Magic", + imgPos: { + burst: { + left: [1396, 1396, 1396, 1396, 1088, 1088, 1242, 1242, 1392, 1392, 1392, 1392], + top: [1194, 1194, 1322, 1322, 1432, 1432, 1432, 1432, 1432, 1432, 1538, 1538] } }, - width:154, - height:112, - scale:1.2, - duration:25000, - frame:{ - burst:12 + width: 154, + height: 112, + scale: 1.2, + duration: 25000, + frame: { + burst: 12 } } }); -Animation.DefensiveMatrix=Animation.extends({ - constructorPlus:function(props){ +Animation.DefensiveMatrix = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1327, 1427, 1327, 1427, 1327], - top:[1664, 1664, 1751, 1751, 1838] + name: "Magic", + imgPos: { + burst: { + left: [1327, 1427, 1327, 1427, 1327], + top: [1664, 1664, 1751, 1751, 1838] } }, - width:90, - height:84, - above:true, - autoSize:true, - duration:60000, - frame:{ - burst:5 + width: 90, + height: 84, + above: true, + autoSize: true, + duration: 60000, + frame: { + burst: 5 } } }); -Animation.BlueShield=Animation.extends({ - constructorPlus:function(props){ +Animation.BlueShield = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 130, 260, 390, 520, 0, 130, 260, 390, 520], - top:[1560, 1560, 1560, 1560, 1560, 1690, 1690, 1690, 1690, 1690] + name: "Magic", + imgPos: { + burst: { + left: [0, 130, 260, 390, 520, 0, 130, 260, 390, 520], + top: [1560, 1560, 1560, 1560, 1560, 1690, 1690, 1690, 1690, 1690] } }, - width:130, - height:130, - above:true, - autoSize:true, - duration:60000, - frame:{ - burst:10 + width: 130, + height: 130, + above: true, + autoSize: true, + duration: 60000, + frame: { + burst: 10 } } }); -Animation.MaelStorm=Animation.extends({ - constructorPlus:function(props){ +Animation.MaelStorm = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[2, 70, 130, 195, 252, 312, 372, 430, 492, 554], - top:[2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870] + name: "Magic", + imgPos: { + burst: { + left: [2, 70, 130, 195, 252, 312, 372, 430, 492, 554], + top: [2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870] } }, - width:60, - height:60, - above:true, - autoSize:true, - duration:18000,//Normal 12 sec - frame:{ - burst:10 + width: 60, + height: 60, + above: true, + autoSize: true, + duration: 18000, + frame: { + burst: 10 } } }); -Animation.RedShield=Animation.extends({ - constructorPlus:function(props){ +Animation.RedShield = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[650, 780, 910, 1040, 1170, 650, 780, 910, 1040, 1170], - top:[1560, 1560, 1560, 1560, 1560, 1690, 1690, 1690, 1690, 1690] + name: "Magic", + imgPos: { + burst: { + left: [650, 780, 910, 1040, 1170, 650, 780, 910, 1040, 1170], + top: [1560, 1560, 1560, 1560, 1560, 1690, 1690, 1690, 1690, 1690] } }, - width:130, - height:130, - above:true, - autoSize:true, - duration:18000,//Normal 12 sec - frame:{ - burst:10 + width: 130, + height: 130, + above: true, + autoSize: true, + duration: 18000, + frame: { + burst: 10 } } }); -Animation.BurningCircle=Animation.extends({ - constructorPlus:function(props){ +Animation.BurningCircle = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 112, 224, 336, 448, 560], - top:[1820, 1820, 1820, 1820, 1820, 1820] + name: "Magic", + imgPos: { + burst: { + left: [0, 112, 224, 336, 448, 560], + top: [1820, 1820, 1820, 1820, 1820, 1820] } }, - width:112, - height:126, - above:true, - autoSize:true, - duration:18000, - frame:{ - burst:6 + width: 112, + height: 126, + above: true, + autoSize: true, + duration: 18000, + frame: { + burst: 6 } } }); -Animation.Irradiate=Animation.extends({ - constructorPlus:function(props){ +Animation.Irradiate = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[668, 792, 916, 1042, 1172], - top:[1820,1820,1820,1820,1820] + name: "Magic", + imgPos: { + burst: { + left: [668, 792, 916, 1042, 1172], + top: [1820, 1820, 1820, 1820, 1820] } }, - width:126, - height:110, - above:true, - autoSize:true, - duration:30000, - frame:{ - burst:5 + width: 126, + height: 110, + above: true, + autoSize: true, + duration: 30000, + frame: { + burst: 5 } } }); -Animation.Recall=Animation.extends({ - constructorPlus:function(props){ +Animation.Recall = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 86, 188, 282, 386, 488, 588, 688, 788, 894], - top:[1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938] + name: "Magic", + imgPos: { + burst: { + left: [0, 86, 188, 282, 386, 488, 588, 688, 788, 894], + top: [1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938] } }, - width:98, - height:98, - frame:{ - burst:10 + width: 98, + height: 98, + frame: { + burst: 10 } } }); -Animation.Ice=Animation.extends({ - constructorPlus:function(props){ +Animation.Ice = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1024, 1164, 1304, 1444], - top:[1942,1942,1942,1942] + name: "Magic", + imgPos: { + burst: { + left: [1024, 1164, 1304, 1444], + top: [1942, 1942, 1942, 1942] } }, - width:78, - height:88, - above:true, - autoSize:true, - duration:30000, - frame:{ - burst:4 + width: 78, + height: 88, + above: true, + autoSize: true, + duration: 30000, + frame: { + burst: 4 } } }); -Animation.EMPShockwave=Animation.extends({ - constructorPlus:function(props){ +Animation.EMPShockwave = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 180, 356, 534, 708, 886, 1068], - top:[2038, 2038, 2038, 2038, 2038, 2038, 2038] + name: "Magic", + imgPos: { + burst: { + left: [0, 180, 356, 534, 708, 886, 1068], + top: [2038, 2038, 2038, 2038, 2038, 2038, 2038] } }, - width:180, - height:146, - scale:1.5, - frame:{ - burst:7 + width: 180, + height: 146, + scale: 1.5, + frame: { + burst: 7 } } }); -Animation.StasisFieldSpell=Animation.extends({ - constructorPlus:function(props){ +Animation.StasisFieldSpell = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1384, 1250, 1250, 1384], - top:[2044, 2044, 2044, 2044] + name: "Magic", + imgPos: { + burst: { + left: [1384, 1250, 1250, 1384], + top: [2044, 2044, 2044, 2044] } }, - width:128, - height:84, - frame:{ - burst:4 + width: 128, + height: 84, + frame: { + burst: 4 } } }); -Animation.MaelStormSpell=Animation.extends({ - constructorPlus:function(props){ +Animation.MaelStormSpell = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[1384, 1250, 1250, 1384], - top:[2134, 2134, 2134, 2134] + name: "Magic", + imgPos: { + burst: { + left: [1384, 1250, 1250, 1384], + top: [2134, 2134, 2134, 2134] } }, - width:128, - height:84, - frame:{ - burst:4 + width: 128, + height: 84, + frame: { + burst: 4 } } }); -Animation.Restoration=Animation.extends({ - constructorPlus:function(props){ +Animation.Restoration = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 128, 256, 384, 512, 640, 768, 896, 0, 128, 256, 384, 512, 640, 768, 896], - top:[2190, 2190, 2190, 2190, 2190, 2190, 2190, 2190, 2318, 2318, 2318, 2318, 2318, 2318, 2318, 2318] + name: "Magic", + imgPos: { + burst: { + left: [0, 128, 256, 384, 512, 640, 768, 896, 0, 128, 256, 384, 512, 640, 768, 896], + top: [2190, 2190, 2190, 2190, 2190, 2190, 2190, 2190, 2318, 2318, 2318, 2318, 2318, 2318, 2318, 2318] } }, - width:128, - height:128, - above:true, - autoSize:true, - frame:{ - burst:16 + width: 128, + height: 128, + above: true, + autoSize: true, + frame: { + burst: 16 } } }); -Animation.Shockwave=Animation.extends({ - constructorPlus:function(props){ +Animation.Shockwave = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 135, 270, 405, 540, 675, 810, 945, 1080, 1215, 1350], - top:[2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446] + name: "Magic", + imgPos: { + burst: { + left: [0, 135, 270, 405, 540, 675, 810, 945, 1080, 1215, 1350], + top: [2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446] } }, - width:135, - height:120, - frame:{ - burst:11 + width: 135, + height: 120, + frame: { + burst: 11 } } }); -Animation.NuclearStrike=Animation.extends({ - constructorPlus:function(props){ +Animation.NuclearStrike = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ - left:[0, 154, 308, 462, 616, 770, 924, 1078, 1232, 1386, 0, 154, 308, 462, 616, 770, 924, 1078, 1232, 1386], - top:[2562,2562,2562,2562,2562,2562,2562,2562,2562,2562,2716,2716,2716,2716,2716,2716,2716,2716,2716,2716] + name: "Magic", + imgPos: { + burst: { + left: [0, 154, 308, 462, 616, 770, 924, 1078, 1232, 1386, 0, 154, 308, 462, 616, 770, 924, 1078, 1232, 1386], + top: [2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2562, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716, 2716] } }, - width:154, - height:154, - scale:2.5, - frame:{ - burst:20 + width: 154, + height: 154, + scale: 2.5, + frame: { + burst: 20 } } }); //Evolve related -Animation.EvolveGroundUnit=Animation.extends({ - constructorPlus:function(props){ +Animation.EvolveGroundUnit = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ + name: "Magic", + imgPos: { + burst: { left: [524, 562, 600, 638, 676, 714, 524, 562, 600, 638, 676, 714], top: [724, 724, 724, 724, 724, 724, 766, 766, 766, 766, 766, 766] } }, - width:38, - height:43, - frame:{ - burst:12 + width: 38, + height: 43, + frame: { + burst: 12 } } }); -Animation.EvolveFlyingUnit=Animation.extends({ - constructorPlus:function(props){ +Animation.EvolveFlyingUnit = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"Magic", - imgPos:{ - burst:{ + name: "Magic", + imgPos: { + burst: { left: [438, 501, 564, 627, 690, 438, 501, 564, 627], top: [810, 810, 810, 810, 810, 855, 855, 855, 855] } }, - width:63, - height:46, - frame:{ - burst:9 + width: 63, + height: 46, + frame: { + burst: 9 } } }); -Animation.SmallMutationComplete=Animation.extends({ - constructorPlus:function(props){ +Animation.SmallMutationComplete = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [1316, 1476, 1636, 1796], top: [962, 962, 962, 962] } }, - width:88, - height:84, - frame:{ - burst:4 + width: 88, + height: 84, + frame: { + burst: 4 } } }); -Animation.MiddleMutationComplete=Animation.extends({ - constructorPlus:function(props){ +Animation.MiddleMutationComplete = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [980, 1140, 1300], top: [1048, 1048, 1048] } }, - width:120, - height:112, - frame:{ - burst:3 + width: 120, + height: 112, + frame: { + burst: 3 } } }); -Animation.LargeMutationComplete=Animation.extends({ - constructorPlus:function(props){ +Animation.LargeMutationComplete = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [960, 1120, 1280], top: [1160, 1160, 1160] } }, - width:160, - height:150, - frame:{ - burst:3 + width: 160, + height: 150, + frame: { + burst: 3 } } }); -Animation.ProtossBuildingComplete=Animation.extends({ - constructorPlus:function(props){ +Animation.ProtossBuildingComplete = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ProtossBuilding", - imgPos:{ - burst:{ + name: "ProtossBuilding", + imgPos: { + burst: { left: [486, 486, 636, 636], top: [648, 648, 648, 648] } }, - width:152, - height:152, - frame:{ - burst:4 + width: 152, + height: 152, + frame: { + burst: 4 } } }); //Damaged related -Animation.redFireL=Animation.extends({ - constructorPlus:function(props){ +Animation.redFireL = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"TerranBuilding", - imgPos:{ - burst:{ + name: "TerranBuilding", + imgPos: { + burst: { left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], top: [546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546] } }, - width:40,//64N+14 - height:70, + width: 40, + height: 70, //above:true, //Keep playing until killed - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.redFireM=Animation.extends({ - constructorPlus:function(props){ +Animation.redFireM = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"TerranBuilding", - imgPos:{ - burst:{ + name: "TerranBuilding", + imgPos: { + burst: { left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], top: [632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632] } }, - width:40,//64N+14 - height:70, + width: 40, + height: 70, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.redFireR=Animation.extends({ - constructorPlus:function(props){ +Animation.redFireR = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"TerranBuilding", - imgPos:{ - burst:{ + name: "TerranBuilding", + imgPos: { + burst: { left: [10, 74, 138, 202, 266, 330, 394, 458, 522, 586, 650, 714], top: [722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722] } }, - width:48,//64N+10 - height:60, + width: 48, + height: 60, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.blueFireL=Animation.extends({ - constructorPlus:function(props){ +Animation.blueFireL = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ProtossBuilding", - imgPos:{ - burst:{ + name: "ProtossBuilding", + imgPos: { + burst: { left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], top: [424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424] } }, - width:40,//64N+14 - height:70, + width: 40, + height: 70, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.blueFireM=Animation.extends({ - constructorPlus:function(props){ +Animation.blueFireM = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ProtossBuilding", - imgPos:{ - burst:{ + name: "ProtossBuilding", + imgPos: { + burst: { left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], top: [506, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506] } }, - width:40,//64N+14 - height:70, + width: 40, + height: 70, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.blueFireR=Animation.extends({ - constructorPlus:function(props){ +Animation.blueFireR = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ProtossBuilding", - imgPos:{ - burst:{ + name: "ProtossBuilding", + imgPos: { + burst: { left: [10, 74, 138, 202, 266, 330, 394, 458, 522, 586, 650, 714], top: [588, 588, 588, 588, 588, 588, 588, 588, 588, 588, 588, 588] } }, - width:48,//64N+10 - height:60, + width: 48, + height: 60, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.bloodA=Animation.extends({ - constructorPlus:function(props){ +Animation.bloodA = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [768, 832, 896, 960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472], - top: [1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320] + top: [1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320] } }, - width:64, - height:50, + width: 64, + height: 50, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.bloodB=Animation.extends({ - constructorPlus:function(props){ +Animation.bloodB = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [768, 832, 896, 960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472], - top: [1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376] + top: [1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376] } }, - width:64, - height:50, + width: 64, + height: 50, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.bloodC=Animation.extends({ - constructorPlus:function(props){ +Animation.bloodC = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704], - top: [1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376] + top: [1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376, 1376] } }, - width:64, - height:50, + width: 64, + height: 50, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); -Animation.bloodD=Animation.extends({ - constructorPlus:function(props){ +Animation.bloodD = Animation.extends({ + constructorPlus: function (props) { //Nothing }, - prototypePlus:{ + prototypePlus: { //Add basic unit info - name:"ZergBuilding", - imgPos:{ - burst:{ + name: "ZergBuilding", + imgPos: { + burst: { left: [0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704], - top: [1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320] + top: [1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320, 1320] } }, - width:64, - height:50, + width: 64, + height: 50, //above:true, - forever:true, - frame:{ - burst:12 + forever: true, + frame: { + burst: 12 } } }); +//# sourceMappingURL=Animation.js.map \ No newline at end of file diff --git a/Characters/Animation.ts b/Characters/Animation.ts new file mode 100644 index 0000000..e677bdf --- /dev/null +++ b/Characters/Animation.ts @@ -0,0 +1,1062 @@ +//Alias +var Animation=Burst; +Animation.getAllAnimations=function(){ + var allAnimes=[]; + for (var attr in Animation){ + if (Animation[attr].super===Animation) allAnimes.push(Animation[attr]); + } + return allAnimes; +}; +Animation.getName=function(anime){ + for (var attr in Animation){ + //Should be animation constructor firstly + if (Animation[attr].super===Animation && (anime instanceof Animation[attr])) return attr; + } +}; + +Animation.RightClickCursor=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Burst", + imgPos:{ + burst:{ + left:[0, 44, 88, 132], + top:[1087,1087,1087,1087] + } + }, + width:44, + height:28, + frame:{ + burst:4 + } + } +}); +Animation.PsionicStorm=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 188, 376, 564, 0, 188, 376, 564, 0, 188, 376, 564, 0, 188], + top:[0, 0, 0, 0, 153, 153, 153, 153, 306, 306, 306, 306, 459, 459] + } + }, + width:188, + height:153, + scale:1.2, + duration:7000, + frame:{ + burst:14 + } + } +}); +Animation.Hallucination=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[752, 815, 878, 941, 1004, 1067, 1130, 1193, 1256, 752, 815, 878, 941, 1004, 1067, 1130, 1193, 1256], + top:[0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 63, 63, 63, 63, 63, 63, 63, 63] + } + }, + width:63, + height:63, + above:true, + frame:{ + burst:18 + } + } +}); +Animation.Consume=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[752, 826, 900, 974, 1048, 1122, 1196, 1270, 1344, 752, 826, 900, 974, 1048, 1122, 1196, 1270, 1344], + top:[126, 126, 126, 126, 126, 126, 126, 126, 126, 196, 196, 196, 196, 196, 196, 196, 196, 196] + } + }, + width:74, + height:70, + above:true, + autoSize:true, + frame:{ + burst:18 + } + } +}); +Animation.StasisField=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:376, + top:459 + } + }, + width:130, + height:110, + above:true, + autoSize:'MAX', + scale:1.25, + duration:30000, + frame:{ + burst:1 + } + } +}); +Animation.Lockdown=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[330, 0, 110, 220, 330, 0, 0, 0, 110, 220, 330, 0, 110, 220], + top:[723, 834, 834, 834, 834, 945, 0, 612, 612, 612, 612, 723, 723, 723] + } + }, + width:110, + height:111, + above:true, + autoSize:'MAX', + duration:60000, + frame:{ + burst:6 + } + } +}); +Animation.DarkSwarm=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1260, 752, 1006, 1260, 752, 0, 752, 1006, 1260, 752, 1006], + top:[456, 645, 645, 645, 834, 0, 267, 267, 267, 456, 456] + } + }, + width:254, + height:189, + scale:1.2, + duration:60000, + frame:{ + burst:5 + } + } +}); +Animation.Plague=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1144, 1274, 1404, 754, 884, 1014, 1144, 1274, 1404, 754, 884, 1014, 1144, 1274], + top:[892, 892, 892, 1022, 1022, 1022, 1022, 1022, 1022, 1152, 1152, 1152, 1152, 1152] + } + }, + width:130, + height:130, + scale:1.2, + frame:{ + burst:14 + } + } +}); +Animation.PurpleEffect=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[440, 499, 558, 617], + top:[902,902,902,902] + } + }, + width:59, + height:60, + above:true, + autoSize:'MIN', + duration:30000, + frame:{ + burst:4 + } + } +}); +Animation.RedEffect=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1006, 1068, 1130, 1192], + top:[836,836,836,836] + } + }, + width:62, + height:50, + above:true, + autoSize:'MIN', + duration:30000, + frame:{ + burst:4 + } + } +}); +Animation.GreenEffect=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1256, 1313, 1370, 1427], + top:[836,836,836,836] + } + }, + width:57, + height:46, + above:true, + autoSize:'MIN', + duration:30000, + frame:{ + burst:4 + } + } +}); +Animation.Ensnare=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 131, 262, 393, 524, 0, 131, 262, 393, 524, 0, 131, 262, 393, 524], + top:[1056, 1056, 1056, 1056, 1056, 1181, 1181, 1181, 1181, 1181, 1306, 1306, 1306, 1306, 1306] + } + }, + width:131, + height:125, + scale:1.2, + frame:{ + burst:15 + } + } +}); +Animation.ScannerSweep=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1012, 1012, 1167, 1167, 1322, 1322, 1012, 1012, 1167, 1167, 1322, 1322], + top:[2220, 2220, 2220, 2220, 2220, 2220, 2335, 2335, 2335, 2335, 2335, 2335] + } + }, + width:155, + height:115, + scale:1.5, + duration:15600, + sight:350, + frame:{ + burst:12 + } + } +}); +Animation.Feedback=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[632, 702, 772, 842, 912, 982, 1052, 1122, 1192, 1262, 1332, 1402], + top:[2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872, 2872] + } + }, + width:70, + height:70, + above:true, + autoSize:true, + frame:{ + burst:12 + } + } +}); +Animation.HellFire=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[655, 730, 805, 880, 955, 1030, 1105, 1180, 1255, 1330], + top:[1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284, 1284] + } + }, + width:75, + height:75, + above:true, + autoSize:true, + frame:{ + burst:10 + } + } +}); +Animation.MindControl=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[658, 720, 782, 844, 906, 968, 1030, 1092, 1154, 1216, 1278, 1340], + top:[1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378] + } + }, + width:62, + height:40, + above:true, + autoSize:true, + frame:{ + burst:12 + } + } +}); +Animation.RechargeShields=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 64, 128, 192, 256, 320, 384, 448, 0, 64, 128, 192, 256, 320, 384, 448], + top:[1432, 1432, 1432, 1432, 1432, 1432, 1432, 1432, 1496, 1496, 1496, 1496, 1496, 1496, 1496, 1496] + } + }, + width:64, + height:64, + above:true, + autoSize:true, + frame:{ + burst:16 + } + } +}); +Animation.DisruptionWeb=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1396,1396,1396,1396,1088,1088,1242,1242,1392,1392,1392,1392], + top:[1194,1194,1322,1322,1432,1432,1432,1432,1432,1432,1538,1538] + } + }, + width:154, + height:112, + scale:1.2, + duration:25000, + frame:{ + burst:12 + } + } +}); +Animation.DefensiveMatrix=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1327, 1427, 1327, 1427, 1327], + top:[1664, 1664, 1751, 1751, 1838] + } + }, + width:90, + height:84, + above:true, + autoSize:true, + duration:60000, + frame:{ + burst:5 + } + } +}); +Animation.BlueShield=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 130, 260, 390, 520, 0, 130, 260, 390, 520], + top:[1560, 1560, 1560, 1560, 1560, 1690, 1690, 1690, 1690, 1690] + } + }, + width:130, + height:130, + above:true, + autoSize:true, + duration:60000, + frame:{ + burst:10 + } + } +}); +Animation.MaelStorm=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[2, 70, 130, 195, 252, 312, 372, 430, 492, 554], + top:[2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870, 2870] + } + }, + width:60, + height:60, + above:true, + autoSize:true, + duration:18000,//Normal 12 sec + frame:{ + burst:10 + } + } +}); +Animation.RedShield=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[650, 780, 910, 1040, 1170, 650, 780, 910, 1040, 1170], + top:[1560, 1560, 1560, 1560, 1560, 1690, 1690, 1690, 1690, 1690] + } + }, + width:130, + height:130, + above:true, + autoSize:true, + duration:18000,//Normal 12 sec + frame:{ + burst:10 + } + } +}); +Animation.BurningCircle=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 112, 224, 336, 448, 560], + top:[1820, 1820, 1820, 1820, 1820, 1820] + } + }, + width:112, + height:126, + above:true, + autoSize:true, + duration:18000, + frame:{ + burst:6 + } + } +}); +Animation.Irradiate=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[668, 792, 916, 1042, 1172], + top:[1820,1820,1820,1820,1820] + } + }, + width:126, + height:110, + above:true, + autoSize:true, + duration:30000, + frame:{ + burst:5 + } + } +}); +Animation.Recall=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 86, 188, 282, 386, 488, 588, 688, 788, 894], + top:[1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938, 1938] + } + }, + width:98, + height:98, + frame:{ + burst:10 + } + } +}); +Animation.Ice=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1024, 1164, 1304, 1444], + top:[1942,1942,1942,1942] + } + }, + width:78, + height:88, + above:true, + autoSize:true, + duration:30000, + frame:{ + burst:4 + } + } +}); +Animation.EMPShockwave=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 180, 356, 534, 708, 886, 1068], + top:[2038, 2038, 2038, 2038, 2038, 2038, 2038] + } + }, + width:180, + height:146, + scale:1.5, + frame:{ + burst:7 + } + } +}); +Animation.StasisFieldSpell=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1384, 1250, 1250, 1384], + top:[2044, 2044, 2044, 2044] + } + }, + width:128, + height:84, + frame:{ + burst:4 + } + } +}); +Animation.MaelStormSpell=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[1384, 1250, 1250, 1384], + top:[2134, 2134, 2134, 2134] + } + }, + width:128, + height:84, + frame:{ + burst:4 + } + } +}); +Animation.Restoration=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 128, 256, 384, 512, 640, 768, 896, 0, 128, 256, 384, 512, 640, 768, 896], + top:[2190, 2190, 2190, 2190, 2190, 2190, 2190, 2190, 2318, 2318, 2318, 2318, 2318, 2318, 2318, 2318] + } + }, + width:128, + height:128, + above:true, + autoSize:true, + frame:{ + burst:16 + } + } +}); +Animation.Shockwave=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 135, 270, 405, 540, 675, 810, 945, 1080, 1215, 1350], + top:[2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446, 2446] + } + }, + width:135, + height:120, + frame:{ + burst:11 + } + } +}); +Animation.NuclearStrike=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left:[0, 154, 308, 462, 616, 770, 924, 1078, 1232, 1386, 0, 154, 308, 462, 616, 770, 924, 1078, 1232, 1386], + top:[2562,2562,2562,2562,2562,2562,2562,2562,2562,2562,2716,2716,2716,2716,2716,2716,2716,2716,2716,2716] + } + }, + width:154, + height:154, + scale:2.5, + frame:{ + burst:20 + } + } +}); +//Evolve related +Animation.EvolveGroundUnit=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left: [524, 562, 600, 638, 676, 714, 524, 562, 600, 638, 676, 714], + top: [724, 724, 724, 724, 724, 724, 766, 766, 766, 766, 766, 766] + } + }, + width:38, + height:43, + frame:{ + burst:12 + } + } +}); +Animation.EvolveFlyingUnit=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"Magic", + imgPos:{ + burst:{ + left: [438, 501, 564, 627, 690, 438, 501, 564, 627], + top: [810, 810, 810, 810, 810, 855, 855, 855, 855] + } + }, + width:63, + height:46, + frame:{ + burst:9 + } + } +}); +Animation.SmallMutationComplete=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [1316, 1476, 1636, 1796], + top: [962, 962, 962, 962] + } + }, + width:88, + height:84, + frame:{ + burst:4 + } + } +}); +Animation.MiddleMutationComplete=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [980, 1140, 1300], + top: [1048, 1048, 1048] + } + }, + width:120, + height:112, + frame:{ + burst:3 + } + } +}); +Animation.LargeMutationComplete=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [960, 1120, 1280], + top: [1160, 1160, 1160] + } + }, + width:160, + height:150, + frame:{ + burst:3 + } + } +}); +Animation.ProtossBuildingComplete=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ProtossBuilding", + imgPos:{ + burst:{ + left: [486, 486, 636, 636], + top: [648, 648, 648, 648] + } + }, + width:152, + height:152, + frame:{ + burst:4 + } + } +}); +//Damaged related +Animation.redFireL=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"TerranBuilding", + imgPos:{ + burst:{ + left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], + top: [546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546] + } + }, + width:40,//64N+14 + height:70, + //above:true, + //Keep playing until killed + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.redFireM=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"TerranBuilding", + imgPos:{ + burst:{ + left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], + top: [632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, 632] + } + }, + width:40,//64N+14 + height:70, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.redFireR=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"TerranBuilding", + imgPos:{ + burst:{ + left: [10, 74, 138, 202, 266, 330, 394, 458, 522, 586, 650, 714], + top: [722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722, 722] + } + }, + width:48,//64N+10 + height:60, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.blueFireL=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ProtossBuilding", + imgPos:{ + burst:{ + left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], + top: [424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, 424] + } + }, + width:40,//64N+14 + height:70, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.blueFireM=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ProtossBuilding", + imgPos:{ + burst:{ + left: [14, 78, 142, 206, 270, 334, 398, 462, 526, 590, 654, 718], + top: [506, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, 506] + } + }, + width:40,//64N+14 + height:70, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.blueFireR=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ProtossBuilding", + imgPos:{ + burst:{ + left: [10, 74, 138, 202, 266, 330, 394, 458, 522, 586, 650, 714], + top: [588, 588, 588, 588, 588, 588, 588, 588, 588, 588, 588, 588] + } + }, + width:48,//64N+10 + height:60, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.bloodA=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [768, 832, 896, 960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472], + top: [1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320] + } + }, + width:64, + height:50, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.bloodB=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [768, 832, 896, 960, 1024, 1088, 1152, 1216, 1280, 1344, 1408, 1472], + top: [1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376] + } + }, + width:64, + height:50, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.bloodC=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704], + top: [1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376,1376] + } + }, + width:64, + height:50, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); +Animation.bloodD=Animation.extends({ + constructorPlus:function(props){ + //Nothing + }, + prototypePlus:{ + //Add basic unit info + name:"ZergBuilding", + imgPos:{ + burst:{ + left: [0, 64, 128, 192, 256, 320, 384, 448, 512, 576, 640, 704], + top: [1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320,1320] + } + }, + width:64, + height:50, + //above:true, + forever:true, + frame:{ + burst:12 + } + } +}); diff --git a/Characters/Building.js b/Characters/Building.js index 5de0f52..0f8ec0b 100644 --- a/Characters/Building.js +++ b/Characters/Building.js @@ -1,60 +1,64 @@ -var Building=Gobj.extends({ - constructorPlus:function(props){ +var Building = Gobj.extends({ + constructorPlus: function (props) { //Add id for building - this.id=Unit.currentID++; - this.life=this.get('HP'); - if (this.SP) this.shield=this.get('SP'); - if (this.MP) this.magic=50; - this.selected=false; - this.isFlying=false; - this.injuryAnimations=[]; + this.id = Unit.currentID++; + this.life = this.get('HP'); + if (this.SP) + this.shield = this.get('SP'); + if (this.MP) + this.magic = 50; + this.selected = false; + this.isFlying = false; + this.injuryAnimations = []; // Finish below after fully constructed, postpone - var myself=this; - Game.commandTimeout(function(){ + var myself = this; + Game.commandTimeout(function () { //Add this unit into Game Building.allBuildings.push(myself); //Show unit myself.dock(); - },0); + }, 0); }, - prototypePlus:{ - name:"Building", - armor:0, - sight:385, + prototypePlus: { + name: "Building", + armor: 0, + sight: 385, //Override to support multiple hidden frames - animeFrame:function(){ + animeFrame: function () { //Animation play this.action++; //Override Gobj here, building doesn't have direction - var arrLimit=(this.imgPos[this.status].left instanceof Array)?(this.imgPos[this.status].left.length):1; - if (this.action==this.frame[this.status] || this.action>=arrLimit) this.action=0; + var arrLimit = (this.imgPos[this.status].left instanceof Array) ? (this.imgPos[this.status].left.length) : 1; + if (this.action == this.frame[this.status] || this.action >= arrLimit) + this.action = 0; //Multiple hidden frames support - if (this.imgPos[this.status].left[this.action]==-1) this.action=0; + if (this.imgPos[this.status].left[this.action] == -1) + this.action = 0; }, //Dock means stop moving but keep animation - dock:function(){ + dock: function () { //Clear old timer this.stop(); //Launch new dock timer - this.status="dock"; - var myself=this; - var animateFrame=function(){ + this.status = "dock"; + var myself = this; + var animateFrame = function () { //Only play animation, will not move myself.animeFrame(); }; - this.allFrames['animate']=animateFrame; + this.allFrames['animate'] = animateFrame; }, //Cannot move - moving:function(){ + moving: function () { //Nothing }, //Override for sound effect - die:function(){ + die: function () { //Old behavior Gobj.prototype.die.call(this); - this.life=0; + this.life = 0; //Clear all injury animations - this.injuryAnimations.forEach(function(anime){ + this.injuryAnimations.forEach(function (anime) { anime.die(); }); //If has sound effect @@ -62,12 +66,12 @@ var Building=Gobj.extends({ this.sound.death.play(); } }, - reactionWhenAttackedBy:function(enemy){ + reactionWhenAttackedBy: function (enemy) { //Cannot fight back or escape //Resign and give reward to enemy if has no life before dead - if (this.life<=0) { + if (this.life <= 0) { //If multiple target, only die once and give reward - if (this.status!="dead") { + if (this.status != "dead") { //Killed by enemy this.die(); //Give enemy reward @@ -76,147 +80,155 @@ var Building=Gobj.extends({ } }, //Fix bug, for consistent, cause 100% damage on building - calculateDamageBy:function(enemyObj){ - return (enemyObj instanceof Gobj)?enemyObj.get('damage'):enemyObj; + calculateDamageBy: function (enemyObj) { + return (enemyObj instanceof Gobj) ? enemyObj.get('damage') : enemyObj; }, //Calculate damage, for consistence - getDamageBy:function(enemy,percent){ - if (percent==undefined) percent=1;//100% by default - var damage=0; + getDamageBy: function (enemy, percent) { + if (percent == undefined) + percent = 1; //100% by default + var damage = 0; //If has SP and shield remain - if (this.shield>0) { - damage=((this.calculateDamageBy(enemy)-this.get('plasma'))*percent)>>0; - if (damage<1) damage=1; - this.shield-=damage; - if (this.shield<0) { + if (this.shield > 0) { + damage = ((this.calculateDamageBy(enemy) - this.get('plasma')) * percent) >> 0; + if (damage < 1) + damage = 1; + this.shield -= damage; + if (this.shield < 0) { //Inherit damage - this.life+=(this.shield); - this.shield=0; + this.life += (this.shield); + this.shield = 0; } } else { - damage=((enemy.get('damage')-this.get('armor'))*percent)>>0; - if (damage<1) damage=1; - this.life-=damage; + damage = ((enemy.get('damage') - this.get('armor')) * percent) >> 0; + if (damage < 1) + damage = 1; + this.life -= damage; } }, //Life status - lifeStatus:function(){ - var lifeRatio=this.life/this.get('HP'); - return ((lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red"); + lifeStatus: function () { + var lifeRatio = this.life / this.get('HP'); + return ((lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"); } } }); //Store all buildings -Building.allBuildings=[]; -Building.ourBuildings=function(){ - return Building.allBuildings.filter(function(chara){ +Building.allBuildings = []; +Building.ourBuildings = function () { + return Building.allBuildings.filter(function (chara) { return !(chara.isEnemy()); }); }; -Building.enemyBuildings=function(){ - return Building.allBuildings.filter(function(chara){ +Building.enemyBuildings = function () { + return Building.allBuildings.filter(function (chara) { return chara.isEnemy(); }); }; - //Zerg buildings -Building.ZergBuilding=Building.extends({ - constructorPlus:function(props){ - this.sound={ - selected:new Audio(Game.CDN+'bgm/ZergBuilding.selected.wav'), - death:new Audio(Game.CDN+'bgm/ZergBuilding.death.wav') +Building.ZergBuilding = Building.extends({ + constructorPlus: function (props) { + this.sound = { + selected: new Audio(Game.CDN + 'bgm/ZergBuilding.selected.wav'), + death: new Audio(Game.CDN + 'bgm/ZergBuilding.death.wav') }; //Need draw mud for it - Map.needRefresh="MAP"; + Map.needRefresh = "MAP"; }, prototypePlus: { //Add basic unit info name: "ZergBuilding", - dieEffect:Burst.ZergBuildingBurst, - injuryNames:['bloodA','bloodB','bloodC'], - recover:function(){ - if (this.life>0,centerY:Y>>0,radius:myself.AOE.radius}) - && !chara['isInvisible'+myself.team]) { + var N = Math.ceil(myself.distanceFrom(enemy) / (myself.AOE.radius)); + enemies = enemies.filter(function (chara) { + for (var n = 1; n <= N; n++) { + var X = myself.posX() + n * (enemy.posX() - myself.posX()) / N; + var Y = myself.posY() + n * (enemy.posY() - myself.posY()) / N; + if (chara.insideCircle({ centerX: X >> 0, centerY: Y >> 0, radius: myself.AOE.radius }) + && !chara['isInvisible' + myself.team]) { return true; } } @@ -275,172 +287,176 @@ Building.Attackable={ case "CIRCLE": //Default type is CIRCLE default: - enemies=enemies.filter(function(chara){ - return chara.insideCircle( - {centerX:enemy.posX(),centerY:enemy.posY(),radius:myself.AOE.radius}) - && !chara['isInvisible'+myself.team]; - }) + enemies = enemies.filter(function (chara) { + return chara.insideCircle({ centerX: enemy.posX(), centerY: enemy.posY(), radius: myself.AOE.radius }) + && !chara['isInvisible' + myself.team]; + }); } } //Show attack animation if has if (myself.imgPos.attack) { - myself.action=0; + myself.action = 0; //Change status to show attack frame - myself.status="attack"; + myself.status = "attack"; //Will return to dock after attack - Game.commandTimeout(function(){ + Game.commandTimeout(function () { //If still show attack - if (myself.status=="attack") { - myself.status="dock"; - myself.action=0; + if (myself.status == "attack") { + myself.status = "dock"; + myself.action = 0; } - },myself.frame.attack*100);//attackAnimation < attackInterval + }, myself.frame.attack * 100); //attackAnimation < attackInterval } //If has bullet if (myself.Bullet) { - var fireBullet=function(){ + var fireBullet = function () { //Will shoot multiple bullets in one time if (myself.continuousAttack) { - myself.bullet=[]; - for (var N=0;N>0)) { - bullet.noDamage=true; + if (myself.continuousAttack.layout) + myself.continuousAttack.layout(bullet, N); + if (myself.continuousAttack.onlyOnce && N != (myself.continuousAttack.count / 2 >> 0)) { + bullet.noDamage = true; } bullet.fire(); myself.bullet.push(bullet); } } else { - if (myself.AOE && myself.AOE.type=="MULTIPLE"){ - for (var N=0;N