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=arrLimit) this.action=0;
+ //Multiple hidden frames support
+ if (this.imgPos[this.status].left[this.action]==-1) this.action=0;
+ },
+ //Dock means stop moving but keep animation
+ dock:function(){
+ //Clear old timer
+ this.stop();
+ //Launch new dock timer
+ this.status="dock";
+ var myself=this;
+ var animateFrame=function(){
+ //Only play animation, will not move
+ myself.animeFrame();
+ };
+ this.allFrames['animate']=animateFrame;
+ },
+ //Cannot move
+ moving:function(){
+ //Nothing
+ },
+ //Override for sound effect
+ die:function(){
+ //Old behavior
+ Gobj.prototype.die.call(this);
+ this.life=0;
+ //Clear all injury animations
+ this.injuryAnimations.forEach(function(anime){
+ anime.die();
+ });
+ //If has sound effect
+ if (this.sound.death && this.insideScreen()) {
+ this.sound.death.play();
+ }
+ },
+ 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 multiple target, only die once and give reward
+ if (this.status!="dead") {
+ //Killed by enemy
+ this.die();
+ //Give enemy reward
+ enemy.kill++;
+ }
+ }
+ },
+ //Fix bug, for consistent, cause 100% damage on building
+ 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;
+ //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) {
+ //Inherit damage
+ 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;
+ }
+ },
+ //Life status
+ 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){
+ return !(chara.isEnemy());
+ });
+};
+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')
+ };
+ //Need draw mud for it
+ 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]) {
+ return true;
+ }
+ }
+ return false;
+ });
+ break;
+ case "MULTIPLE":
+ 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];
+ })
+ }
+ }
+ //Show attack animation if has
+ if (myself.imgPos.attack) {
+ myself.action=0;
+ //Change status to show attack frame
+ myself.status="attack";
+ //Will return to dock after attack
+ Game.commandTimeout(function(){
+ //If still show attack
+ if (myself.status=="attack") {
+ myself.status="dock";
+ myself.action=0;
+ }
+ },myself.frame.attack*100);//attackAnimation < attackInterval
+ }
+ //If has bullet
+ if (myself.Bullet) {
+ var fireBullet=function(){
+ //Will shoot multiple bullets in one time
+ if (myself.continuousAttack) {
+ myself.bullet=[];
+ for (var N=0;N>0)) {
+ bullet.noDamage=true;
+ }
+ bullet.fire();
+ myself.bullet.push(bullet);
+ }
+ }
+ else {
+ if (myself.AOE && myself.AOE.type=="MULTIPLE"){
+ for (var N=0;N>0,
- y:K*(targetY-ownerY)>>0
+ var K = this.speedVal / Math.pow((targetX - ownerX) * (targetX - ownerX) + (targetY - ownerY) * (targetY - ownerY), 0.5);
+ this.speed = {
+ x: K * (targetX - ownerX) >> 0,
+ y: K * (targetY - ownerY) >> 0
};
//For Lurker thron
- if (this.duration==null) this.duration=(1/K>>0)*100;
+ if (this.duration == null)
+ this.duration = (1 / K >> 0) * 100;
}
- //Initial by fixed duration: match frames and sound
else {
- this.speed={
- x:(targetX-ownerX)/(this.duration/100+1),
- y:(targetY-ownerY)/(this.duration/100+1)
+ this.speed = {
+ x: (targetX - ownerX) / (this.duration / 100 + 1),
+ y: (targetY - ownerY) / (this.duration / 100 + 1)
};
}
//By default it's not shown
- this.status="dead";
+ this.status = "dead";
//Fixed damage if be set
- if (props.damage!=null) this.damage=props.damage;
+ if (props.damage != null)
+ this.damage = props.damage;
//Will show after constructed
Bullets.allBullets.push(this);
},
- prototypePlus:{
+ prototypePlus: {
//Override to use 8 directions speed
- updateLocation:function(){
+ updateLocation: function () {
//No direction speed
- this.x+=this.speed.x;
- this.y+=this.speed.y;
+ this.x += this.speed.x;
+ this.y += this.speed.y;
},
- burst:function(){
- var owner=this.owner;
- var target=this.target;
+ burst: function () {
+ var owner = this.owner;
+ var target = this.target;
//Bullet over, now burst turn to show
this.die();
//Filter out magic bullet with fixed destination
- if (!(target instanceof Gobj)) return;
+ if (!(target instanceof Gobj))
+ return;
//Init targets if AOE
var targets;
if (owner.AOE) {
//Get possible targets
- switch(owner.attackLimit){
+ switch (owner.attackLimit) {
case "flying":
- targets=Unit.allUnits.filter(function(chara){
- return chara.team!=owner.team && chara.isFlying;
+ targets = Unit.allUnits.filter(function (chara) {
+ return chara.team != owner.team && chara.isFlying;
});
break;
case "ground":
- var enemyUnits=Unit.allUnits.filter(function(chara){
- return chara.team!=owner.team && !(chara.isFlying);
+ var enemyUnits = Unit.allUnits.filter(function (chara) {
+ return chara.team != owner.team && !(chara.isFlying);
});
- var enemyBuildings=Building.allBuildings.filter(function(chara){
- return chara.team!=owner.team;
+ var enemyBuildings = Building.allBuildings.filter(function (chara) {
+ return chara.team != owner.team;
});
- targets=enemyUnits.concat(enemyBuildings);
+ targets = enemyUnits.concat(enemyBuildings);
break;
default:
- targets=(Unit.allUnits.concat(Building.allBuildings)).filter(function(chara){
- return chara.team!=owner.team;
+ targets = (Unit.allUnits.concat(Building.allBuildings)).filter(function (chara) {
+ return chara.team != owner.team;
});
break;
}
@@ -84,13 +88,13 @@ var Bullets=Gobj.extends({
switch (owner.AOE.type) {
case "LINE":
//Calculate inter-points between enemy
- var N=Math.ceil(owner.distanceFrom(target)/(owner.AOE.radius));
- targets=targets.filter(function(chara){
- for (var n=1;n<=N;n++){
- var X=owner.posX()+n*(target.posX()-owner.posX())/N;
- var Y=owner.posY()+n*(target.posY()-owner.posY())/N;
- if (chara.insideCircle({centerX:X>>0,centerY:Y>>0,radius:owner.AOE.radius})
- && !chara['isInvisible'+owner.team]) {
+ var N = Math.ceil(owner.distanceFrom(target) / (owner.AOE.radius));
+ targets = targets.filter(function (chara) {
+ for (var n = 1; n <= N; n++) {
+ var X = owner.posX() + n * (target.posX() - owner.posX()) / N;
+ var Y = owner.posY() + n * (target.posY() - owner.posY()) / N;
+ if (chara.insideCircle({ centerX: X >> 0, centerY: Y >> 0, radius: owner.AOE.radius })
+ && !chara['isInvisible' + owner.team]) {
return true;
}
}
@@ -100,196 +104,203 @@ var Bullets=Gobj.extends({
//Default type is CIRCLE
case "CIRCLE":
default:
- targets=targets.filter(function(chara){
- return chara.insideCircle(
- {centerX:target.posX(),centerY:target.posY(),radius:owner.AOE.radius})
- && !chara['isInvisible'+owner.team];
+ targets = targets.filter(function (chara) {
+ return chara.insideCircle({ centerX: target.posX(), centerY: target.posY(), radius: owner.AOE.radius })
+ && !chara['isInvisible' + owner.team];
});
}
}
if (this.burstEffect) {
//Show burst effect on target
if (owner.AOE && owner.AOE.hasEffect) {
- var burstEffect=this.burstEffect;
- targets.forEach(function(chara){
- new burstEffect({target:chara,above:true,team:owner.team});
- })
+ var burstEffect = this.burstEffect;
+ targets.forEach(function (chara) {
+ new burstEffect({ target: chara, above: true, team: owner.team });
+ });
}
else {
- new this.burstEffect({target:target,above:true,team:owner.team});
+ new this.burstEffect({ target: target, above: true, team: owner.team });
}
}
//Real bullet
if (!this.noDamage) {
//Cause damage when burst appear
if (owner.AOE) {
- var myself=this;
- targets.forEach(function(chara){
- if (myself.damage!=null) chara.getDamageBy(myself.damage);
- else chara.getDamageBy(owner);
+ var myself = this;
+ targets.forEach(function (chara) {
+ if (myself.damage != null)
+ chara.getDamageBy(myself.damage);
+ else
+ chara.getDamageBy(owner);
chara.reactionWhenAttackedBy(owner);
- })
+ });
}
else {
- if (this.damage!=null) target.getDamageBy(this.damage);
- else target.getDamageBy(owner);
+ if (this.damage != null)
+ target.getDamageBy(this.damage);
+ else
+ target.getDamageBy(owner);
target.reactionWhenAttackedBy(owner);
}
}
//Fired flag
- this.used=true;
+ this.used = true;
},
//Upgrade Gobj moving, replace run as fire
- fire:function(callback){
+ fire: function (callback) {
//Start firing
this.moving();
//Layout bullet in front by add one frame
this.updateLocation();
this.detectOutOfBound();
//Sound effect
- if (this.insideScreen() && this.owner.sound && this.owner.sound.attack) this.owner.sound.attack.play();
+ if (this.insideScreen() && this.owner.sound && this.owner.sound.attack)
+ this.owner.sound.attack.play();
//Will burst and stop moving after time limit arrive
- var myself=this;
- Game.commandTimeout(function(){
+ var myself = this;
+ Game.commandTimeout(function () {
myself.burst();
//Something happens after bullet burst
- if (callback) callback();
- },this.duration);
+ if (callback)
+ callback();
+ }, this.duration);
}
}
});
//All bullets here for show
-Bullets.allBullets=[];
-Bullets.Spooge=Bullets.extends({
- constructorPlus:function(props){},
- prototypePlus:{
+Bullets.allBullets = [];
+Bullets.Spooge = Bullets.extends({
+ constructorPlus: function (props) { },
+ prototypePlus: {
//Add basic unit info
- name:"Hydralisk",
- duration:400,
- imgPos:{
- moving:{
- left:[14, 72, 136, 204],
- top:[758,758,758,758]
+ name: "Hydralisk",
+ duration: 400,
+ imgPos: {
+ moving: {
+ left: [14, 72, 136, 204],
+ top: [758, 758, 758, 758]
}
},
- width:56,
- height:28,
- frame:{
- moving:4
+ width: 56,
+ height: 28,
+ frame: {
+ moving: 4
},
- burstEffect:Burst.HydraSpark
+ burstEffect: Burst.HydraSpark
}
});
-Bullets.Thorn=Bullets.extends({
- constructorPlus:function(props){},
- prototypePlus:{
+Bullets.Thorn = Bullets.extends({
+ constructorPlus: function (props) { },
+ prototypePlus: {
//Add basic unit info
- name:"Lurker",
- speedVal:25,
- duration:600,
- imgPos:{
- moving:{
- left:[61,88,117,144,117,88],
- top:[711,711,711,711,711,711]
+ name: "Lurker",
+ speedVal: 25,
+ duration: 600,
+ imgPos: {
+ moving: {
+ left: [61, 88, 117, 144, 117, 88],
+ top: [711, 711, 711, 711, 711, 711]
}
},
- width:28,
- height:35,
- frame:{
- moving:6
+ width: 28,
+ height: 35,
+ frame: {
+ moving: 6
},
- forbidRotate:true
+ forbidRotate: true
}
});
-Bullets.Darts=Bullets.extends({
- constructorPlus:function(props){
- this.life=this.traceTimes;
+Bullets.Darts = Bullets.extends({
+ constructorPlus: function (props) {
+ this.life = this.traceTimes;
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- duration:400,
- imgPos:{
- moving:{
- left:[0, 36, 72, 108, 144, 180, 216, 252, 288, 324],
- top:[1051,1051,1051,1051,1051,1051,1051,1051,1051,1051]
+ name: "Burst",
+ duration: 400,
+ imgPos: {
+ moving: {
+ left: [0, 36, 72, 108, 144, 180, 216, 252, 288, 324],
+ top: [1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051]
}
},
- width:36,
- height:36,
- frame:{
- moving:10
+ width: 36,
+ height: 36,
+ frame: {
+ moving: 10
},
- burstEffect:Burst.GreenFog,
+ burstEffect: Burst.GreenFog,
//Chain tracing attack
- traceTimes:3,
- traceRadius:100,
+ traceTimes: 3,
+ traceRadius: 100,
//Override
- noDamage:true,
- die:function(){
- var target=this.target;
- var owner=this.owner;
+ noDamage: true,
+ die: function () {
+ var target = this.target;
+ var owner = this.owner;
//Interrupt tracing if target is dead first
- if (target.status=="dead") {
+ if (target.status == "dead") {
//Former behavior before override
this.inherited.die.call(this);
}
//Override damage, damage reduce
- target.getDamageBy(owner,this.life/this.traceTimes);
+ target.getDamageBy(owner, this.life / this.traceTimes);
target.reactionWhenAttackedBy(owner);
//Bullet reduce
this.life--;
- var myself=this;
+ var myself = this;
var traceEnemies;
//Get all possible enemies
- switch(owner.attackLimit){
+ switch (owner.attackLimit) {
case "flying":
- traceEnemies=Unit.allUnits.filter(function(chara){
- return chara.team!=owner.team && chara.isFlying;
+ traceEnemies = Unit.allUnits.filter(function (chara) {
+ return chara.team != owner.team && chara.isFlying;
});
break;
case "ground":
- traceEnemies=Unit.allUnits.filter(function(chara){
- return chara.team!=owner.team && !(chara.isFlying);
+ traceEnemies = Unit.allUnits.filter(function (chara) {
+ return chara.team != owner.team && !(chara.isFlying);
});
break;
default:
- traceEnemies=Unit.allUnits.filter(function(chara){
- return chara.team!=owner.team;
+ traceEnemies = Unit.allUnits.filter(function (chara) {
+ return chara.team != owner.team;
});
break;
}
//Filter out trace-able enemies
- traceEnemies=traceEnemies.filter(function(chara) {
- return (chara!=myself.target) &&
- chara.insideCircle({centerX:myself.posX(),centerY:myself.posY(),radius:myself.traceRadius});
+ traceEnemies = traceEnemies.filter(function (chara) {
+ return (chara != myself.target) &&
+ chara.insideCircle({ centerX: myself.posX(), centerY: myself.posY(), radius: myself.traceRadius });
});
//Attack trace enemy
- if (traceEnemies.length>0 && this.life>0){
+ if (traceEnemies.length > 0 && this.life > 0) {
//Initial position again before jumping
- this.x=target.posX()-this.width/2;
- this.y=target.posY()-this.height/2;
- this.target=traceEnemies[0];
- var targetX=this.target.posX();
- var targetY=this.target.posY();
- var myX=this.posX();
- var myY=this.posY();
+ this.x = target.posX() - this.width / 2;
+ this.y = target.posY() - this.height / 2;
+ this.target = traceEnemies[0];
+ var targetX = this.target.posX();
+ var targetY = this.target.posY();
+ var myX = this.posX();
+ var myY = this.posY();
//Update bullet speed
- this.speed={
- x:(targetX-myX)/(this.duration/100),
- y:(targetY-myY)/(this.duration/100)
+ this.speed = {
+ x: (targetX - myX) / (this.duration / 100),
+ y: (targetY - myY) / (this.duration / 100)
};
//Update bullet angle
- if (this.forbidRotate) this.angle=0;
+ if (this.forbidRotate)
+ this.angle = 0;
else {
//Below angle represents direction toward target
- this.angle=Math.atan((myY-targetY)/(targetX-myX));
- if (targetX0) {
+ if (this.owner.scarabNum > 0) {
this.owner.scarabNum--;
Button.refreshButtons();
}
}
}
});
-Bullets.ReaverBombII=Bullets.extends({
- constructorPlus:function(props){},
- prototypePlus:{
+Bullets.ReaverBombII = Bullets.extends({
+ constructorPlus: function (props) { },
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- speedVal:25,
- imgPos:{
- moving:{
- left:300,
- top:0
+ name: "Burst",
+ speedVal: 25,
+ imgPos: {
+ moving: {
+ left: 300,
+ top: 0
}
},
- width:40,
- height:30,
- frame:{
- moving:1
+ width: 40,
+ height: 30,
+ frame: {
+ moving: 1
},
- forbidRotate:true,
- burstEffect:Burst.ReaverBurst
+ forbidRotate: true,
+ burstEffect: Burst.ReaverBurst
}
});
-Bullets.Interceptor=Bullets.extends({
- constructorPlus:function(props){},
- prototypePlus:{
+Bullets.Interceptor = Bullets.extends({
+ constructorPlus: function (props) { },
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- duration:1000,
- imgPos:{
- moving:{
- left:[120,170,220,272,272,120,120,120,120,120],
- top:[582,582,582,582,582,582,582,582,582,582]
+ name: "Burst",
+ duration: 1000,
+ imgPos: {
+ moving: {
+ left: [120, 170, 220, 272, 272, 120, 120, 120, 120, 120],
+ top: [582, 582, 582, 582, 582, 582, 582, 582, 582, 582]
}
},
- width:44,
- height:28,
- frame:{
- moving:10
+ width: 44,
+ height: 28,
+ frame: {
+ moving: 10
},
//Override cause damage timing
- noDamage:true,
- fire:function(){
+ noDamage: true,
+ fire: function () {
this.inherited.fire.call(this);
- var target=this.target;
- var owner=this.owner;
- Game.commandTimeout(function(){
+ var target = this.target;
+ var owner = this.owner;
+ Game.commandTimeout(function () {
target.getDamageBy(owner);
target.reactionWhenAttackedBy(owner);
- },500);
+ }, 500);
}
}
});
-Bullets.DevilBall=Bullets.extends({
- constructorPlus:function(props){
- this.life=this.traceTimes;
+Bullets.DevilBall = Bullets.extends({
+ constructorPlus: function (props) {
+ this.life = this.traceTimes;
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Mutalisk",
- duration:300,
- imgPos:{
- moving:{
- left:352,
- top:442
+ name: "Mutalisk",
+ duration: 300,
+ imgPos: {
+ moving: {
+ left: 352,
+ top: 442
}
},
- width:20,
- height:20,
- frame:{
- moving:1
+ width: 20,
+ height: 20,
+ frame: {
+ moving: 1
},
- burstEffect:Burst.PurpleFog,
+ burstEffect: Burst.PurpleFog,
//Delay fire for Dragoon and PhotonCannon
- fire:Bullets.DragoonBall.prototype.fire,
+ fire: Bullets.DragoonBall.prototype.fire,
//Chain tracing attack
- traceTimes:4,
- traceRadius:200,
+ traceTimes: 4,
+ traceRadius: 200,
//Override
- noDamage:true,
+ noDamage: true,
//Chain attack type
- die:Bullets.Darts.prototype.die
+ die: Bullets.Darts.prototype.die
}
});
//Mapping for apply, need to move it into Units.js
-Zerg.Drone.prototype.Bullet=Bullets.Spooge;
-Zerg.Hydralisk.prototype.Bullet=Bullets.Spooge;
-Zerg.Lurker.prototype.Bullet=Bullets.Thorn;
-Zerg.Mutalisk.prototype.Bullet=Bullets.Darts;
-Zerg.Guardian.prototype.Bullet=Bullets.GreenBall;
-Zerg.Devourer.prototype.Bullet=Bullets.PurpleCloud;
-
-Terran.Wraith.prototype.attackMode.flying.Bullet=Bullets.Missile;
-Terran.Wraith.prototype.attackMode.ground.Bullet=Bullets.SmallLaser;
-Terran.BattleCruiser.prototype.Bullet=Bullets.Laser;
-Terran.Firebat.prototype.Bullet=Bullets.Flame;
-Terran.Vulture.prototype.Bullet=Bullets.VultureBall;
-Terran.Goliath.prototype.attackMode.flying.Bullet=Bullets.LongMissile;
-Terran.Valkyrie.prototype.Bullet=Bullets.MultipleMissile;
-
-Protoss.Dragoon.prototype.Bullet=Bullets.DragoonBall;
-Protoss.Archon.prototype.Bullet=Bullets.ArchonLightening;
-Protoss.Reaver.prototype.Bullet=Bullets.ReaverBomb;
-Protoss.Scout.prototype.attackMode.flying.Bullet=Bullets.ScoutMissile;
-Protoss.Arbiter.prototype.Bullet=Bullets.DragoonBall;
-Protoss.Carrier.prototype.Bullet=Bullets.Interceptor;
-
-Hero.HeroCruiser.prototype.Bullet=Bullets.Yamato;
-Hero.DevilHunter.prototype.Bullet=Bullets.DevilBall;
-
-Building.ZergBuilding.SporeColony.prototype.Bullet=Bullets.Spore;
-Building.TerranBuilding.MissileTurret.prototype.Bullet=Bullets.SingleMissile;
-Building.ProtossBuilding.PhotonCannon.prototype.Bullet=Bullets.DragoonBall;
+Zerg.Drone.prototype.Bullet = Bullets.Spooge;
+Zerg.Hydralisk.prototype.Bullet = Bullets.Spooge;
+Zerg.Lurker.prototype.Bullet = Bullets.Thorn;
+Zerg.Mutalisk.prototype.Bullet = Bullets.Darts;
+Zerg.Guardian.prototype.Bullet = Bullets.GreenBall;
+Zerg.Devourer.prototype.Bullet = Bullets.PurpleCloud;
+Terran.Wraith.prototype.attackMode.flying.Bullet = Bullets.Missile;
+Terran.Wraith.prototype.attackMode.ground.Bullet = Bullets.SmallLaser;
+Terran.BattleCruiser.prototype.Bullet = Bullets.Laser;
+Terran.Firebat.prototype.Bullet = Bullets.Flame;
+Terran.Vulture.prototype.Bullet = Bullets.VultureBall;
+Terran.Goliath.prototype.attackMode.flying.Bullet = Bullets.LongMissile;
+Terran.Valkyrie.prototype.Bullet = Bullets.MultipleMissile;
+Protoss.Dragoon.prototype.Bullet = Bullets.DragoonBall;
+Protoss.Archon.prototype.Bullet = Bullets.ArchonLightening;
+Protoss.Reaver.prototype.Bullet = Bullets.ReaverBomb;
+Protoss.Scout.prototype.attackMode.flying.Bullet = Bullets.ScoutMissile;
+Protoss.Arbiter.prototype.Bullet = Bullets.DragoonBall;
+Protoss.Carrier.prototype.Bullet = Bullets.Interceptor;
+Hero.HeroCruiser.prototype.Bullet = Bullets.Yamato;
+Hero.DevilHunter.prototype.Bullet = Bullets.DevilBall;
+Building.ZergBuilding.SporeColony.prototype.Bullet = Bullets.Spore;
+Building.TerranBuilding.MissileTurret.prototype.Bullet = Bullets.SingleMissile;
+Building.ProtossBuilding.PhotonCannon.prototype.Bullet = Bullets.DragoonBall;
+//# sourceMappingURL=Bullets.js.map
\ No newline at end of file
diff --git a/Characters/Bullets.ts b/Characters/Bullets.ts
new file mode 100644
index 0000000..c386a4c
--- /dev/null
+++ b/Characters/Bullets.ts
@@ -0,0 +1,805 @@
+var Bullets=Gobj.extends({
+ constructorPlus:function(props){
+ this.owner=props.from;
+ this.target=props.to;
+ //Makes below initial steps before fire
+ var ownerX=(this.owner instanceof Gobj)?(this.owner.posX()):(this.owner.x);
+ var ownerY=(this.owner instanceof Gobj)?(this.owner.posY()):(this.owner.y);
+ var targetX=(this.target instanceof Gobj)?(this.target.posX()):(this.target.x);
+ var targetY=(this.target instanceof Gobj)?(this.target.posY()):(this.target.y);
+ //Convert from center point to left-top
+ this.x=ownerX-this.width/2;
+ this.y=ownerY-this.height/2;
+ if (this.forbidRotate) this.angle=0;
+ else {
+ //Below angle represents direction toward target
+ this.angle=Math.atan((ownerY-targetY)/(targetX-ownerX));
+ if (targetX>0,
+ y:K*(targetY-ownerY)>>0
+ };
+ //For Lurker thron
+ if (this.duration==null) this.duration=(1/K>>0)*100;
+ }
+ //Initial by fixed duration: match frames and sound
+ else {
+ this.speed={
+ x:(targetX-ownerX)/(this.duration/100+1),
+ y:(targetY-ownerY)/(this.duration/100+1)
+ };
+ }
+ //By default it's not shown
+ this.status="dead";
+ //Fixed damage if be set
+ if (props.damage!=null) this.damage=props.damage;
+ //Will show after constructed
+ Bullets.allBullets.push(this);
+ },
+ prototypePlus:{
+ //Override to use 8 directions speed
+ updateLocation:function(){
+ //No direction speed
+ this.x+=this.speed.x;
+ this.y+=this.speed.y;
+ },
+ burst:function(){
+ var owner=this.owner;
+ var target=this.target;
+ //Bullet over, now burst turn to show
+ this.die();
+ //Filter out magic bullet with fixed destination
+ if (!(target instanceof Gobj)) return;
+ //Init targets if AOE
+ var targets;
+ if (owner.AOE) {
+ //Get possible targets
+ switch(owner.attackLimit){
+ case "flying":
+ targets=Unit.allUnits.filter(function(chara){
+ return chara.team!=owner.team && chara.isFlying;
+ });
+ break;
+ case "ground":
+ var enemyUnits=Unit.allUnits.filter(function(chara){
+ return chara.team!=owner.team && !(chara.isFlying);
+ });
+ var enemyBuildings=Building.allBuildings.filter(function(chara){
+ return chara.team!=owner.team;
+ });
+ targets=enemyUnits.concat(enemyBuildings);
+ break;
+ default:
+ targets=(Unit.allUnits.concat(Building.allBuildings)).filter(function(chara){
+ return chara.team!=owner.team;
+ });
+ break;
+ }
+ //Range filter
+ switch (owner.AOE.type) {
+ case "LINE":
+ //Calculate inter-points between enemy
+ var N=Math.ceil(owner.distanceFrom(target)/(owner.AOE.radius));
+ targets=targets.filter(function(chara){
+ for (var n=1;n<=N;n++){
+ var X=owner.posX()+n*(target.posX()-owner.posX())/N;
+ var Y=owner.posY()+n*(target.posY()-owner.posY())/N;
+ if (chara.insideCircle({centerX:X>>0,centerY:Y>>0,radius:owner.AOE.radius})
+ && !chara['isInvisible'+owner.team]) {
+ return true;
+ }
+ }
+ return false;
+ });
+ break;
+ //Default type is CIRCLE
+ case "CIRCLE":
+ default:
+ targets=targets.filter(function(chara){
+ return chara.insideCircle(
+ {centerX:target.posX(),centerY:target.posY(),radius:owner.AOE.radius})
+ && !chara['isInvisible'+owner.team];
+ });
+ }
+ }
+ if (this.burstEffect) {
+ //Show burst effect on target
+ if (owner.AOE && owner.AOE.hasEffect) {
+ var burstEffect=this.burstEffect;
+ targets.forEach(function(chara){
+ new burstEffect({target:chara,above:true,team:owner.team});
+ })
+ }
+ else {
+ new this.burstEffect({target:target,above:true,team:owner.team});
+ }
+ }
+ //Real bullet
+ if (!this.noDamage) {
+ //Cause damage when burst appear
+ if (owner.AOE) {
+ var myself=this;
+ targets.forEach(function(chara){
+ if (myself.damage!=null) chara.getDamageBy(myself.damage);
+ else chara.getDamageBy(owner);
+ chara.reactionWhenAttackedBy(owner);
+ })
+ }
+ else {
+ if (this.damage!=null) target.getDamageBy(this.damage);
+ else target.getDamageBy(owner);
+ target.reactionWhenAttackedBy(owner);
+ }
+ }
+ //Fired flag
+ this.used=true;
+ },
+ //Upgrade Gobj moving, replace run as fire
+ fire:function(callback){
+ //Start firing
+ this.moving();
+ //Layout bullet in front by add one frame
+ this.updateLocation();
+ this.detectOutOfBound();
+ //Sound effect
+ if (this.insideScreen() && this.owner.sound && this.owner.sound.attack) this.owner.sound.attack.play();
+ //Will burst and stop moving after time limit arrive
+ var myself=this;
+ Game.commandTimeout(function(){
+ myself.burst();
+ //Something happens after bullet burst
+ if (callback) callback();
+ },this.duration);
+ }
+ }
+});
+//All bullets here for show
+Bullets.allBullets=[];
+Bullets.Spooge=Bullets.extends({
+ constructorPlus:function(props){},
+ prototypePlus:{
+ //Add basic unit info
+ name:"Hydralisk",
+ duration:400,
+ imgPos:{
+ moving:{
+ left:[14, 72, 136, 204],
+ top:[758,758,758,758]
+ }
+ },
+ width:56,
+ height:28,
+ frame:{
+ moving:4
+ },
+ burstEffect:Burst.HydraSpark
+ }
+});
+Bullets.Thorn=Bullets.extends({
+ constructorPlus:function(props){},
+ prototypePlus:{
+ //Add basic unit info
+ name:"Lurker",
+ speedVal:25,
+ duration:600,
+ imgPos:{
+ moving:{
+ left:[61,88,117,144,117,88],
+ top:[711,711,711,711,711,711]
+ }
+ },
+ width:28,
+ height:35,
+ frame:{
+ moving:6
+ },
+ forbidRotate:true
+ }
+});
+Bullets.Darts=Bullets.extends({
+ constructorPlus:function(props){
+ this.life=this.traceTimes;
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ duration:400,
+ imgPos:{
+ moving:{
+ left:[0, 36, 72, 108, 144, 180, 216, 252, 288, 324],
+ top:[1051,1051,1051,1051,1051,1051,1051,1051,1051,1051]
+ }
+ },
+ width:36,
+ height:36,
+ frame:{
+ moving:10
+ },
+ burstEffect:Burst.GreenFog,
+ //Chain tracing attack
+ traceTimes:3,
+ traceRadius:100,
+ //Override
+ noDamage:true,
+ die:function(){
+ var target=this.target;
+ var owner=this.owner;
+ //Interrupt tracing if target is dead first
+ if (target.status=="dead") {
+ //Former behavior before override
+ this.inherited.die.call(this);
+ }
+ //Override damage, damage reduce
+ target.getDamageBy(owner,this.life/this.traceTimes);
+ target.reactionWhenAttackedBy(owner);
+ //Bullet reduce
+ this.life--;
+ var myself=this;
+ var traceEnemies;
+ //Get all possible enemies
+ switch(owner.attackLimit){
+ case "flying":
+ traceEnemies=Unit.allUnits.filter(function(chara){
+ return chara.team!=owner.team && chara.isFlying;
+ });
+ break;
+ case "ground":
+ traceEnemies=Unit.allUnits.filter(function(chara){
+ return chara.team!=owner.team && !(chara.isFlying);
+ });
+ break;
+ default:
+ traceEnemies=Unit.allUnits.filter(function(chara){
+ return chara.team!=owner.team;
+ });
+ break;
+ }
+ //Filter out trace-able enemies
+ traceEnemies=traceEnemies.filter(function(chara) {
+ return (chara!=myself.target) &&
+ chara.insideCircle({centerX:myself.posX(),centerY:myself.posY(),radius:myself.traceRadius});
+ });
+ //Attack trace enemy
+ if (traceEnemies.length>0 && this.life>0){
+ //Initial position again before jumping
+ this.x=target.posX()-this.width/2;
+ this.y=target.posY()-this.height/2;
+ this.target=traceEnemies[0];
+ var targetX=this.target.posX();
+ var targetY=this.target.posY();
+ var myX=this.posX();
+ var myY=this.posY();
+ //Update bullet speed
+ this.speed={
+ x:(targetX-myX)/(this.duration/100),
+ y:(targetY-myY)/(this.duration/100)
+ };
+ //Update bullet angle
+ if (this.forbidRotate) this.angle=0;
+ else {
+ //Below angle represents direction toward target
+ this.angle=Math.atan((myY-targetY)/(targetX-myX));
+ if (targetX0) {
+ this.owner.scarabNum--;
+ Button.refreshButtons();
+ }
+ }
+ }
+});
+Bullets.ReaverBombII=Bullets.extends({
+ constructorPlus:function(props){},
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ speedVal:25,
+ imgPos:{
+ moving:{
+ left:300,
+ top:0
+ }
+ },
+ width:40,
+ height:30,
+ frame:{
+ moving:1
+ },
+ forbidRotate:true,
+ burstEffect:Burst.ReaverBurst
+ }
+});
+Bullets.Interceptor=Bullets.extends({
+ constructorPlus:function(props){},
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ duration:1000,
+ imgPos:{
+ moving:{
+ left:[120,170,220,272,272,120,120,120,120,120],
+ top:[582,582,582,582,582,582,582,582,582,582]
+ }
+ },
+ width:44,
+ height:28,
+ frame:{
+ moving:10
+ },
+ //Override cause damage timing
+ noDamage:true,
+ fire:function(){
+ this.inherited.fire.call(this);
+ var target=this.target;
+ var owner=this.owner;
+ Game.commandTimeout(function(){
+ target.getDamageBy(owner);
+ target.reactionWhenAttackedBy(owner);
+ },500);
+ }
+ }
+});
+Bullets.DevilBall=Bullets.extends({
+ constructorPlus:function(props){
+ this.life=this.traceTimes;
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Mutalisk",
+ duration:300,
+ imgPos:{
+ moving:{
+ left:352,
+ top:442
+ }
+ },
+ width:20,
+ height:20,
+ frame:{
+ moving:1
+ },
+ burstEffect:Burst.PurpleFog,
+ //Delay fire for Dragoon and PhotonCannon
+ fire:Bullets.DragoonBall.prototype.fire,
+ //Chain tracing attack
+ traceTimes:4,
+ traceRadius:200,
+ //Override
+ noDamage:true,
+ //Chain attack type
+ die:Bullets.Darts.prototype.die
+ }
+});
+//Mapping for apply, need to move it into Units.js
+Zerg.Drone.prototype.Bullet=Bullets.Spooge;
+Zerg.Hydralisk.prototype.Bullet=Bullets.Spooge;
+Zerg.Lurker.prototype.Bullet=Bullets.Thorn;
+Zerg.Mutalisk.prototype.Bullet=Bullets.Darts;
+Zerg.Guardian.prototype.Bullet=Bullets.GreenBall;
+Zerg.Devourer.prototype.Bullet=Bullets.PurpleCloud;
+
+Terran.Wraith.prototype.attackMode.flying.Bullet=Bullets.Missile;
+Terran.Wraith.prototype.attackMode.ground.Bullet=Bullets.SmallLaser;
+Terran.BattleCruiser.prototype.Bullet=Bullets.Laser;
+Terran.Firebat.prototype.Bullet=Bullets.Flame;
+Terran.Vulture.prototype.Bullet=Bullets.VultureBall;
+Terran.Goliath.prototype.attackMode.flying.Bullet=Bullets.LongMissile;
+Terran.Valkyrie.prototype.Bullet=Bullets.MultipleMissile;
+
+Protoss.Dragoon.prototype.Bullet=Bullets.DragoonBall;
+Protoss.Archon.prototype.Bullet=Bullets.ArchonLightening;
+Protoss.Reaver.prototype.Bullet=Bullets.ReaverBomb;
+Protoss.Scout.prototype.attackMode.flying.Bullet=Bullets.ScoutMissile;
+Protoss.Arbiter.prototype.Bullet=Bullets.DragoonBall;
+Protoss.Carrier.prototype.Bullet=Bullets.Interceptor;
+
+Hero.HeroCruiser.prototype.Bullet=Bullets.Yamato;
+Hero.DevilHunter.prototype.Bullet=Bullets.DevilBall;
+
+Building.ZergBuilding.SporeColony.prototype.Bullet=Bullets.Spore;
+Building.TerranBuilding.MissileTurret.prototype.Bullet=Bullets.SingleMissile;
+Building.ProtossBuilding.PhotonCannon.prototype.Bullet=Bullets.DragoonBall;
diff --git a/Characters/Burst.js b/Characters/Burst.js
index a935dbb..5f8b20c 100644
--- a/Characters/Burst.js
+++ b/Characters/Burst.js
@@ -1,1526 +1,1545 @@
//One animation period which only play for a while and die
-var Burst=Gobj.extends({
- constructorPlus:function(props){
+var Burst = Gobj.extends({
+ constructorPlus: function (props) {
//Override if has props.scale
- if (props.scale) this.scale=props.scale;
+ if (props.scale)
+ this.scale = props.scale;
//Resize drawing by scale
- var times=this.scale?(this.scale):1;
+ var times = this.scale ? (this.scale) : 1;
//Behavior like effect on target
if (props.target) {
- this.target=props.target;
+ this.target = props.target;
//Ahead of owner
- if (props.above) this.above=true;
+ if (props.above)
+ this.above = true;
//Animation duration
//Match owner size
- if (props.autoSize) this.autoSize=true;
- if (this.autoSize!=null) {
+ if (props.autoSize)
+ this.autoSize = true;
+ if (this.autoSize != null) {
//Can mix autoSize with scale
- switch(this.autoSize){
+ switch (this.autoSize) {
case 'MAX':
- this.scale=Math.max(this.target.width,this.target.height)*2*times/(this.width+this.height);
+ this.scale = Math.max(this.target.width, this.target.height) * 2 * times / (this.width + this.height);
break;
case 'MIN':
- this.scale=Math.min(this.target.width,this.target.height)*2*times/(this.width+this.height);
+ this.scale = Math.min(this.target.width, this.target.height) * 2 * times / (this.width + this.height);
break;
default:
- this.scale=(this.target.width+this.target.height)*times/(this.width+this.height);
+ this.scale = (this.target.width + this.target.height) * times / (this.width + this.height);
}
- times=this.scale;
+ times = this.scale;
}
//Location
- this.x=(this.target.posX()-this.width*times/2)>>0;
- this.y=(this.target.posY()-this.height*times/2)>>0;
+ this.x = (this.target.posX() - this.width * times / 2) >> 0;
+ this.y = (this.target.posY() - this.height * times / 2) >> 0;
//Onfire or bleed will have offset
- if (props.offset){
- this.x+=props.offset.x;
- this.y+=props.offset.y;
+ if (props.offset) {
+ this.x += props.offset.x;
+ this.y += props.offset.y;
}
}
- //Independent burst
else {
//Target location, from centerP to top-left
- this.x=props.x-this.width*times/2;
- this.y=props.y-this.height*times/2;
+ this.x = props.x - this.width * times / 2;
+ this.y = props.y - this.height * times / 2;
}
//Play duration
- if (this.forever) this.duration=-1;//Keep playing until killed
- if (props.duration!=null) this.duration=props.duration;//Override duration
+ if (this.forever)
+ this.duration = -1; //Keep playing until killed
+ if (props.duration != null)
+ this.duration = props.duration; //Override duration
//Restore callback after burst finish
- if (props.callback) this.callback=props.callback;
+ if (props.callback)
+ this.callback = props.callback;
//By default it will burst
this.burst();
//Will show after constructed
Burst.allEffects.push(this);
},
- prototypePlus:{
+ prototypePlus: {
//Override Gobj method
- animeFrame:function(){
+ animeFrame: function () {
//Animation play
this.action++;
//Override Gobj here, can have hidden frames
- 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;
}
//Update location here
if (this.above && this.target) {
//Update location: copied from constructor
- var times=this.scale?(this.scale):1;
- this.x=(this.target.posX()-this.width*times/2)>>0;
- this.y=(this.target.posY()-this.height*times/2)>>0;
+ var times = this.scale ? (this.scale) : 1;
+ this.x = (this.target.posX() - this.width * times / 2) >> 0;
+ this.y = (this.target.posY() - this.height * times / 2) >> 0;
}
},
- burst:function(){
- this.status="burst";
+ burst: function () {
+ this.status = "burst";
//Start play burst animation
- var myself=this;
- var animateFrame=function(){
+ var myself = this;
+ var animateFrame = function () {
//Only play animation, will not move
myself.animeFrame();
};
- this.allFrames['animate']=animateFrame;
+ this.allFrames['animate'] = animateFrame;
//Will die(stop playing) after time limit arrive
- var duration=this.duration?this.duration:(this.frame['burst']*100);
+ var duration = this.duration ? this.duration : (this.frame['burst'] * 100);
//Last forever if duration<0 (-1)
- if (duration>0){
- Game.commandTimeout(function(){
+ if (duration > 0) {
+ Game.commandTimeout(function () {
myself.die();
- },duration);
+ }, duration);
}
},
- die:function(){
+ die: function () {
//Run callback when burst die
- if (this.callback) this.callback();
+ if (this.callback)
+ this.callback();
Gobj.prototype.die.call(this);
}
}
});
//All burst effects here for show
-Burst.allEffects=[];
+Burst.allEffects = [];
//Define different bursts
-Burst.GreenFog=Burst.extends({
- constructorPlus:function(props){
+Burst.GreenFog = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/GreenFog.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/GreenFog.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Mutalisk",//Source img inside Mutalisk.png
- imgPos:{
- burst:{
- left:[8,68,134,198,263,8,68,134,198,263],
- top:[468,468,468,468,468,532,532,532,532,532]
+ name: "Mutalisk",
+ imgPos: {
+ burst: {
+ left: [8, 68, 134, 198, 263, 8, 68, 134, 198, 263],
+ top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
}
},
- width:52,
- height:57,
- frame:{
- burst:10
+ width: 52,
+ height: 57,
+ frame: {
+ burst: 10
}
}
});
-Burst.Parasite=Burst.extends({
- constructorPlus:function(props){
+Burst.Parasite = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Parasite.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Parasite.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Mutalisk",
- imgPos:{
- burst:{
- left:[8,68,134,198,263,8,68,134,198,263],
- top:[468,468,468,468,468,532,532,532,532,532]
+ name: "Mutalisk",
+ imgPos: {
+ burst: {
+ left: [8, 68, 134, 198, 263, 8, 68, 134, 198, 263],
+ top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
}
},
- width:52,
- height:57,
- frame:{
- burst:10
+ width: 52,
+ height: 57,
+ frame: {
+ burst: 10
}
}
});
-Burst.Spore=Burst.extends({
- constructorPlus:function(props){
+Burst.Spore = Burst.extends({
+ constructorPlus: function (props) {
//No sound
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Mutalisk",
- imgPos:{
- burst:{
- left:[8,68,134,198,263,8,68,134,198,263],
- top:[468,468,468,468,468,532,532,532,532,532]
+ name: "Mutalisk",
+ imgPos: {
+ burst: {
+ left: [8, 68, 134, 198, 263, 8, 68, 134, 198, 263],
+ top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
}
},
- width:52,
- height:57,
- frame:{
- burst:10
+ width: 52,
+ height: 57,
+ frame: {
+ burst: 10
}
}
});
-Burst.GreenBallBroken=Burst.extends({
- constructorPlus:function(props){
+Burst.GreenBallBroken = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/Greenball.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/Greenball.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Guardian",
- imgPos:{
- burst:{
- left:[0,56,119,182,252,322,396,470],
- top:[556,556,556,556,556,556,556,556]
+ name: "Guardian",
+ imgPos: {
+ burst: {
+ left: [0, 56, 119, 182, 252, 322, 396, 470],
+ top: [556, 556, 556, 556, 556, 556, 556, 556]
}
},
- width:60,
- height:60,
- frame:{
- burst:8
+ width: 60,
+ height: 60,
+ frame: {
+ burst: 8
}
}
});
-Burst.PurpleCloudSpread=Burst.extends({
- constructorPlus:function(props){
+Burst.PurpleCloudSpread = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/PurpleCloud.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/PurpleCloud.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Devourer",
- imgPos:{
- burst:{
- left:[17,70,122,174,230,280,335,390,452],
- top:[1022,1022,1022,1022,1022,1022,1022,1022,1022]
+ name: "Devourer",
+ imgPos: {
+ burst: {
+ left: [17, 70, 122, 174, 230, 280, 335, 390, 452],
+ top: [1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022]
}
},
- width:50,
- height:60,
- callback:function(){
- var chara=this.target;
+ width: 50,
+ height: 60,
+ callback: function () {
+ var chara = this.target;
//Fix all spored issue
- if (chara.status=='dead' || chara.status==null) return;
+ if (chara.status == 'dead' || chara.status == null)
+ return;
//Effect:PurpleBuffer when cloud spread on target chara
//Buffer flag, can add up
- if (chara.buffer.PurpleCloud==9) return;//9 at max
- if (chara.buffer.PurpleCloud>0) chara.buffer.PurpleCloud++;
- else chara.buffer.PurpleCloud=1;
+ if (chara.buffer.PurpleCloud == 9)
+ return; //9 at max
+ if (chara.buffer.PurpleCloud > 0)
+ chara.buffer.PurpleCloud++;
+ else
+ chara.buffer.PurpleCloud = 1;
//Decrease defense and slow down attack rate
- var bufferObj={
- armor:chara.get('armor')-1
+ var bufferObj = {
+ armor: chara.get('armor') - 1
};
- if (chara.plasma!=null) bufferObj.plasma=chara.get('plasma')-1;
- if (chara.attackInterval) bufferObj.attackInterval=Math.round(chara.get('attackInterval')*1.1);
+ if (chara.plasma != null)
+ bufferObj.plasma = chara.get('plasma') - 1;
+ if (chara.attackInterval)
+ bufferObj.attackInterval = Math.round(chara.get('attackInterval') * 1.1);
//Apply buffer
chara.addBuffer(bufferObj);
- if (!chara.purpleBuffer) chara.purpleBuffer=[];
+ if (!chara.purpleBuffer)
+ chara.purpleBuffer = [];
chara.purpleBuffer.push(bufferObj);
//Purple effect
- new Animation.PurpleEffect({team:this.team,target:chara,callback:function(){
- //Restore in 30 seconds, Last In First Out
- if (chara.purpleBuffer && chara.removeBuffer(chara.purpleBuffer.pop())) {
- chara.buffer.PurpleCloud--;
- }
- //Full restore
- if (chara.buffer.PurpleCloud==0) {
- delete chara.buffer.PurpleCloud;
- delete chara.purpleBuffer;
- }
- }});
+ new Animation.PurpleEffect({ team: this.team, target: chara, callback: function () {
+ //Restore in 30 seconds, Last In First Out
+ if (chara.purpleBuffer && chara.removeBuffer(chara.purpleBuffer.pop())) {
+ chara.buffer.PurpleCloud--;
+ }
+ //Full restore
+ if (chara.buffer.PurpleCloud == 0) {
+ delete chara.buffer.PurpleCloud;
+ delete chara.purpleBuffer;
+ }
+ } });
},
- frame:{
- burst:9
+ frame: {
+ burst: 9
}
}
});
-Burst.Sunken=Burst.extends({
- constructorPlus:function(props){
+Burst.Sunken = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/Sunken.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/Sunken.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[46,174,302,432,560,688],
- top:[626,626,626,626,626,626]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [46, 174, 302, 432, 560, 688],
+ top: [626, 626, 626, 626, 626, 626]
}
},
- width:28,
- height:40,
- frame:{
- burst:6
+ width: 28,
+ height: 40,
+ frame: {
+ burst: 6
}
}
});
-Burst.SmallFireSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.SmallFireSpark = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/FireSpark.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Wraith",
- imgPos:{
- burst:{
- left:[64,106,64],
- top:[132,132,132]
+ name: "Wraith",
+ imgPos: {
+ burst: {
+ left: [64, 106, 64],
+ top: [132, 132, 132]
}
},
- width:32,
- height:30,
- frame:{
- burst:3
+ width: 32,
+ height: 30,
+ frame: {
+ burst: 3
}
}
});
-Burst.FireSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.FireSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Ghost",
- imgPos:{
- burst:{
- left:[0, 38, 76, 114, 152, 190, 228, 266, 304, 342],
- top:[596,596,596,596,596,596,596,596,596,596]
+ name: "Ghost",
+ imgPos: {
+ burst: {
+ left: [0, 38, 76, 114, 152, 190, 228, 266, 304, 342],
+ top: [596, 596, 596, 596, 596, 596, 596, 596, 596, 596]
}
},
- width:38,
- height:36,
- frame:{
- burst:10
+ width: 38,
+ height: 36,
+ frame: {
+ burst: 10
}
}
});
-Burst.FireSparkSound=Burst.FireSpark.extends({
- constructorPlus:function(props){
+Burst.FireSparkSound = Burst.FireSpark.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/FireSpark.burst.wav').play();
},
- prototypePlus:{
- //Nothing
- }
+ prototypePlus: {}
});
-Burst.LaserSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.LaserSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[18,70,128,182],
- top:[50,50,50,50]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [18, 70, 128, 182],
+ top: [50, 50, 50, 50]
}
},
- width:30,
- height:30,
- frame:{
- burst:4
+ width: 30,
+ height: 30,
+ frame: {
+ burst: 4
}
}
});
-Burst.VultureSpark=Burst.LaserSpark.extends({
- constructorPlus:function(props){
+Burst.VultureSpark = Burst.LaserSpark.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/VultureSpark.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/VultureSpark.burst.wav').play();
},
- prototypePlus: {
- //Nothing
- }
+ prototypePlus: {}
});
-Burst.HydraSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.HydraSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Hydralisk",
- imgPos:{
- burst:{
- left:[0, 34, 68, 102, 136, 170, 204, 238],
- top:[801,801,801,801,801,801,801,801]
+ name: "Hydralisk",
+ imgPos: {
+ burst: {
+ left: [0, 34, 68, 102, 136, 170, 204, 238],
+ top: [801, 801, 801, 801, 801, 801, 801, 801]
}
},
- width:34,
- height:35,
- frame:{
- burst:8
+ width: 34,
+ height: 35,
+ frame: {
+ burst: 8
}
}
});
-Burst.CorsairCloud=Burst.extends({
- constructorPlus:function(props){
+Burst.CorsairCloud = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[5,57],//[1, 64, 128]
- top:[576,576]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [5, 57],
+ top: [576, 576]
}
},
- width:40,//62
- height:44,//44
- frame:{
- burst:2
+ width: 40,
+ height: 44,
+ frame: {
+ burst: 2
}
}
});
-Burst.ArchonBurst=Burst.extends({
- constructorPlus:function(props){
+Burst.ArchonBurst = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[0, 80, 160, 240, 320, 400],
- top:[779,779,779,779,779,779]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [0, 80, 160, 240, 320, 400],
+ top: [779, 779, 779, 779, 779, 779]
}
},
- width:80,
- height:80,
- frame:{
- burst:6
+ width: 80,
+ height: 80,
+ frame: {
+ burst: 6
}
}
});
-Burst.DragoonBallBroken=Burst.extends({
- constructorPlus:function(props){
+Burst.DragoonBallBroken = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/DragoonBall.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/DragoonBall.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[0, 40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480, 520],
- top:[891,891,891,891,891,891,891,891,891,891,891,891,891,891]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [0, 40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480, 520],
+ top: [891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891]
}
},
- width:38,
- height:40,
- frame:{
- burst:14
+ width: 38,
+ height: 40,
+ frame: {
+ burst: 14
}
}
});
-Burst.ShootSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.ShootSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[0, 40, 80, 120, 160, 200, 240, 280, 320, 360],
- top:[1011,1011,1011,1011,1011,1011,1011,1011,1011,1011]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [0, 40, 80, 120, 160, 200, 240, 280, 320, 360],
+ top: [1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011]
}
},
- width:40,
- height:40,
- frame:{
- burst:10
+ width: 40,
+ height: 40,
+ frame: {
+ burst: 10
}
}
});
-Burst.BlueShootSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.BlueShootSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[32, 64, 96, 128, 160, 192, 224, 256],
- top:[1115,1115,1115,1115,1115,1115,1115,1115]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [32, 64, 96, 128, 160, 192, 224, 256],
+ top: [1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115]
}
},
- width:32,
- height:32,
- frame:{
- burst:8
+ width: 32,
+ height: 32,
+ frame: {
+ burst: 8
}
}
});
-Burst.SCVSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.SCVSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[0, 48, 96, 144, 192, 240, 288, 336, 384, 432],
- top:[1147,1147,1147,1147,1147,1147,1147,1147,1147,1147]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [0, 48, 96, 144, 192, 240, 288, 336, 384, 432],
+ top: [1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147]
}
},
- width:48,
- height:48,
- frame:{
- burst:10
+ width: 48,
+ height: 48,
+ frame: {
+ burst: 10
}
}
});
-Burst.ProbeSpark=Burst.extends({
- constructorPlus:function(props){
+Burst.ProbeSpark = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[0, 48, 96, 144, 192, 240, 288],
- top:[672,672,672,672,672,672,672]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [0, 48, 96, 144, 192, 240, 288],
+ top: [672, 672, 672, 672, 672, 672, 672]
}
},
- width:48,
- height:32,
- frame:{
- burst:7
+ width: 48,
+ height: 32,
+ frame: {
+ burst: 7
}
}
});
-Burst.ReaverBurst=Burst.extends({
- constructorPlus:function(props){
+Burst.ReaverBurst = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/ReaverBomb.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Burst",
- imgPos:{
- burst:{
- left:[0, 80, 160, 240, 320, 400, 480, 560, 640, 720],
- top:[931,931,931,931,931,931,931,931,931,931]
+ name: "Burst",
+ imgPos: {
+ burst: {
+ left: [0, 80, 160, 240, 320, 400, 480, 560, 640, 720],
+ top: [931, 931, 931, 931, 931, 931, 931, 931, 931, 931]
}
},
- width:78,
- height:64,
- frame:{
- burst:10
+ width: 78,
+ height: 64,
+ frame: {
+ burst: 10
}
}
});
-Burst.PurpleFog=Burst.extends({
- constructorPlus:function(props){
+Burst.PurpleFog = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/ReaverBomb.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Mutalisk",
- imgPos:{
- burst:{
- left:[338,398,464,528,593,338,398,464,528,593],
- top:[468,468,468,468,468,532,532,532,532,532]
+ name: "Mutalisk",
+ imgPos: {
+ burst: {
+ left: [338, 398, 464, 528, 593, 338, 398, 464, 528, 593],
+ top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
}
},
- width:52,
- height:57,
- frame:{
- burst:10
+ width: 52,
+ height: 57,
+ frame: {
+ burst: 10
}
}
});
-
-Burst.InfestedBomb=Burst.extends({
- constructorPlus:function(props){
+Burst.InfestedBomb = Burst.extends({
+ constructorPlus: function (props) {
//Has burst sound effect
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/ReaverBomb.burst.wav').play();
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"InfestedTerran",
- imgPos:{
- burst:{
- left:[0, 78, 156, 234, 312, 0, 78, 156, 234, 312],
- top:[432,432,432,432,432,496,496,496,496,496]
+ name: "InfestedTerran",
+ imgPos: {
+ burst: {
+ left: [0, 78, 156, 234, 312, 0, 78, 156, 234, 312],
+ top: [432, 432, 432, 432, 432, 496, 496, 496, 496, 496]
}
},
- width:78,
- height:64,
- frame:{
- burst:10
+ width: 78,
+ height: 64,
+ frame: {
+ burst: 10
}
}
});
-Burst.ScourgeBomb=Burst.extends({
- constructorPlus:function(props){
+Burst.ScourgeBomb = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Scourge",
- imgPos:{
- burst:{
- left:[0, 52, 104, 156, 208, 260, 312, 364, 416],
- top:[218,218,218,218,218,218,218,218,218]
+ name: "Scourge",
+ imgPos: {
+ burst: {
+ left: [0, 52, 104, 156, 208, 260, 312, 364, 416],
+ top: [218, 218, 218, 218, 218, 218, 218, 218, 218]
}
},
- width:52,
- height:46,
- frame:{
- burst:9
+ width: 52,
+ height: 46,
+ frame: {
+ burst: 9
}
}
});
-
-Burst.SmallExplode=Burst.extends({
- constructorPlus:function(props){
+Burst.SmallExplode = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[56,156,256,360],
- top:[1686,1686,1686,1686]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [56, 156, 256, 360],
+ top: [1686, 1686, 1686, 1686]
}
},
- width:80,
- height:60,
- frame:{
- burst:4
+ width: 80,
+ height: 60,
+ frame: {
+ burst: 4
}
}
});
-Burst.MiddleExplode=Burst.extends({
- constructorPlus:function(props){
+Burst.MiddleExplode = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[44,192,342,498],
- top:[1754,1754,1754,1754]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [44, 192, 342, 498],
+ top: [1754, 1754, 1754, 1754]
}
},
- width:120,
- height:90,
- frame:{
- burst:4
+ width: 120,
+ height: 90,
+ frame: {
+ burst: 4
}
}
});
-Burst.BigExplode=Burst.extends({
- constructorPlus:function(props){
+Burst.BigExplode = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[26,226,424,632],
- top:[1846,1846,1846,1846]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [26, 226, 424, 632],
+ top: [1846, 1846, 1846, 1846]
}
},
- width:160,
- height:120,
- frame:{
- burst:4
+ width: 160,
+ height: 120,
+ frame: {
+ burst: 4
}
}
});
-Burst.SmallBlueExplode=Burst.extends({
- constructorPlus:function(props){
+Burst.SmallBlueExplode = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[50,150,250,356],
- top:[1424,1424,1424,1424]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [50, 150, 250, 356],
+ top: [1424, 1424, 1424, 1424]
}
},
- width:80,
- height:60,
- frame:{
- burst:4
+ width: 80,
+ height: 60,
+ frame: {
+ burst: 4
}
}
});
-Burst.MiddleBlueExplode=Burst.extends({
- constructorPlus:function(props){
+Burst.MiddleBlueExplode = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[36,184,338,494],
- top:[1484,1484,1484,1484]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [36, 184, 338, 494],
+ top: [1484, 1484, 1484, 1484]
}
},
- width:120,
- height:90,
- frame:{
- burst:4
+ width: 120,
+ height: 90,
+ frame: {
+ burst: 4
}
}
});
-Burst.BigBlueExplode=Burst.extends({
- constructorPlus:function(props){
+Burst.BigBlueExplode = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[22,222,420,632],
- top:[1566,1566,1566,1566]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [22, 222, 420, 632],
+ top: [1566, 1566, 1566, 1566]
}
},
- width:160,
- height:120,
- frame:{
- burst:4
+ width: 160,
+ height: 120,
+ frame: {
+ burst: 4
}
}
});
-Burst.ZergBuildingBurst=Burst.extends({
- constructorPlus:function(props){
+Burst.ZergBuildingBurst = Burst.extends({
+ constructorPlus: function (props) {
//Need clear mud when ZergBuildingBurst finished
- this.callback=function(){
- Map.needRefresh="MAP";
+ this.callback = function () {
+ Map.needRefresh = "MAP";
};
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[0,200,400,600,800,0,200,400,600,800,0,200,400,400,600,600,800,800],
- top:[0,0,0,0,0,200,200,200,200,200,400,400,400,400,400,400,400,400]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [0, 200, 400, 600, 800, 0, 200, 400, 600, 800, 0, 200, 400, 400, 600, 600, 800, 800],
+ top: [0, 0, 0, 0, 0, 200, 200, 200, 200, 200, 400, 400, 400, 400, 400, 400, 400, 400]
}
},
- width:200,
- height:200,
- frame:{
- burst:18
+ width: 200,
+ height: 200,
+ frame: {
+ burst: 18
}
}
});
-Burst.TerranBuildingBurst=Burst.extends({
- constructorPlus:function(props){
+Burst.TerranBuildingBurst = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[0,0,200,200,400,400,600,600,800,800,0,0,200,200,400,400,600,600],
- top:[600,600,600,600,600,600,600,600,600,600,800,800,800,800,800,800,800,800]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [0, 0, 200, 200, 400, 400, 600, 600, 800, 800, 0, 0, 200, 200, 400, 400, 600, 600],
+ top: [600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 800, 800, 800, 800, 800, 800, 800, 800]
}
},
- width:200,
- height:200,
- frame:{
- burst:18
+ width: 200,
+ height: 200,
+ frame: {
+ burst: 18
}
}
});
-Burst.ProtossBuildingBurst=Burst.extends({
- constructorPlus:function(props){
+Burst.ProtossBuildingBurst = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"BuildingBurst",
- imgPos:{
- burst:{
- left:[0,0,200,200,400,400,600,600,800,800,0,0,200,200,400,400,600,600],
- top:[1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1200,1200,1200,1200,1200,1200,1200,1200]
+ name: "BuildingBurst",
+ imgPos: {
+ burst: {
+ left: [0, 0, 200, 200, 400, 400, 600, 600, 800, 800, 0, 0, 200, 200, 400, 400, 600, 600],
+ top: [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200]
}
},
- width:200,
- height:200,
- frame:{
- burst:18
+ width: 200,
+ height: 200,
+ frame: {
+ burst: 18
}
}
});
-Burst.HumanDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.HumanDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Civilian",
- imgPos:{
- burst:{
- left:[6,58,106,158,6,54,102,152],
- top:[286,286,286,286,320,320,320,320]
+ name: "Civilian",
+ imgPos: {
+ burst: {
+ left: [6, 58, 106, 158, 6, 54, 102, 152],
+ top: [286, 286, 286, 286, 320, 320, 320, 320]
}
},
- width:42,
- height:30,
- frame:{
- burst:8
+ width: 42,
+ height: 30,
+ frame: {
+ burst: 8
}
}
});
-Burst.MedicDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.MedicDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Medic",
- imgPos:{
- burst:{
- left:[0, 64, 128, 192, 256, 320, 384, 448],
- top:[832,832,832,832,832,832,832,832]
+ name: "Medic",
+ imgPos: {
+ burst: {
+ left: [0, 64, 128, 192, 256, 320, 384, 448],
+ top: [832, 832, 832, 832, 832, 832, 832, 832]
}
},
- width:64,
- height:64,
- frame:{
- burst:8
+ width: 64,
+ height: 64,
+ frame: {
+ burst: 8
}
}
});
-Burst.SmallZergFlyingDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.SmallZergFlyingDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Mutalisk",
- imgPos:{
- burst:{
- left:[71,143,215,283,355,432,502],
- top:[372,372,372,372,372,372,372]
+ name: "Mutalisk",
+ imgPos: {
+ burst: {
+ left: [71, 143, 215, 283, 355, 432, 502],
+ top: [372, 372, 372, 372, 372, 372, 372]
}
},
- width:64,
- height:62,
- frame:{
- burst:7
+ width: 64,
+ height: 62,
+ frame: {
+ burst: 7
}
}
});
-Burst.BigZergFlyingDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.BigZergFlyingDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Devourer",
- imgPos:{
- burst:{
- left:[0, 114, 228, 342, 456, 570, 684, 798],
- top:[860,860,860,860,860,860,860,860]
+ name: "Devourer",
+ imgPos: {
+ burst: {
+ left: [0, 114, 228, 342, 456, 570, 684, 798],
+ top: [860, 860, 860, 860, 860, 860, 860, 860]
}
},
- width:114,
- height:102,
- frame:{
- burst:8
+ width: 114,
+ height: 102,
+ frame: {
+ burst: 8
}
}
});
-Burst.DroneDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.DroneDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Drone",
- imgPos:{
- burst:{
- left:[0, 128, 256, 384, 512, 640, 768, 896],
- top:[1280,1280,1280,1280,1280,1280,1280,1280]
+ name: "Drone",
+ imgPos: {
+ burst: {
+ left: [0, 128, 256, 384, 512, 640, 768, 896],
+ top: [1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280]
}
},
- width:128,
- height:128,
- frame:{
- burst:8
+ width: 128,
+ height: 128,
+ frame: {
+ burst: 8
}
}
});
-Burst.ZerglingDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.ZerglingDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Zergling",
- imgPos:{
- burst:{
- left:[0, 68, 136, 204, 272, 340, 408],
- top:[506,506,506,506,506,506,506]
+ name: "Zergling",
+ imgPos: {
+ burst: {
+ left: [0, 68, 136, 204, 272, 340, 408],
+ top: [506, 506, 506, 506, 506, 506, 506]
}
},
- width:68,
- height:55,
- frame:{
- burst:7
+ width: 68,
+ height: 55,
+ frame: {
+ burst: 7
}
}
});
-Burst.HydraliskDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.HydraliskDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Hydralisk",
- imgPos:{
- burst:{
- left:[0, 66, 132, 198, 264, 330, 396, 462, 528, 594, 660, 726],
- top:[704,704,704,704,704,704,704,704,704,704,704,704]
+ name: "Hydralisk",
+ imgPos: {
+ burst: {
+ left: [0, 66, 132, 198, 264, 330, 396, 462, 528, 594, 660, 726],
+ top: [704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704]
}
},
- width:66,
- height:50,
- frame:{
- burst:12
+ width: 66,
+ height: 50,
+ frame: {
+ burst: 12
}
}
});
-Burst.LurkerDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.LurkerDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Lurker",
- imgPos:{
- burst:{
- left:[85, 170, 255, 340, 0, 85, 170, 255, 340],
- top:[582,582,582,582,646,646,646,646,646]
+ name: "Lurker",
+ imgPos: {
+ burst: {
+ left: [85, 170, 255, 340, 0, 85, 170, 255, 340],
+ top: [582, 582, 582, 582, 646, 646, 646, 646, 646]
}
},
- width:85,
- height:64,
- frame:{
- burst:9
+ width: 85,
+ height: 64,
+ frame: {
+ burst: 9
}
}
});
-Burst.UltraliskDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.UltraliskDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Ultralisk",
- imgPos:{
- burst:{
- left:[0, 101, 202, 303, 404, 505, 606, 707, 808, 909],
- top:[1620,1620,1620,1620,1620,1620,1620,1620,1620,1620]
+ name: "Ultralisk",
+ imgPos: {
+ burst: {
+ left: [0, 101, 202, 303, 404, 505, 606, 707, 808, 909],
+ top: [1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620]
}
},
- width:101,
- height:108,
- frame:{
- burst:10
+ width: 101,
+ height: 108,
+ frame: {
+ burst: 10
}
}
});
-Burst.DefilerDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.DefilerDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Defiler",
- imgPos:{
- burst:{
- left:[0, 70, 140, 210, 280, 350, 420, 490, 560, 630],
- top:[558,558,558,558,558,558,558,558,558,558]
+ name: "Defiler",
+ imgPos: {
+ burst: {
+ left: [0, 70, 140, 210, 280, 350, 420, 490, 560, 630],
+ top: [558, 558, 558, 558, 558, 558, 558, 558, 558, 558]
}
},
- width:70,
- height:46,
- frame:{
- burst:10
+ width: 70,
+ height: 46,
+ frame: {
+ burst: 10
}
}
});
-Burst.BroodlingDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.BroodlingDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Queen",
- imgPos:{
- burst:{
- left:[0, 40, 80, 120, 160],
- top:[782,782,782,782,782]
+ name: "Queen",
+ imgPos: {
+ burst: {
+ left: [0, 40, 80, 120, 160],
+ top: [782, 782, 782, 782, 782]
}
},
- width:40,
- height:22,
- frame:{
- burst:5
+ width: 40,
+ height: 22,
+ frame: {
+ burst: 5
}
}
});
-Burst.LarvaDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.LarvaDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,50,100,150,200,250,300,350,400],
- top:[146,146,146,146,146,146,146,146,146]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 50, 100, 150, 200, 250, 300, 350, 400],
+ top: [146, 146, 146, 146, 146, 146, 146, 146, 146]
}
},
- width:50,
- height:26,
- frame:{
- burst:9
+ width: 50,
+ height: 26,
+ frame: {
+ burst: 9
}
}
});
-Burst.EggDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.EggDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,70,140,210,280,350,0,70,140,210,280,350],
- top:[254,254,254,254,254,254,312,312,312,312,312,312]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 70, 140, 210, 280, 350, 0, 70, 140, 210, 280, 350],
+ top: [254, 254, 254, 254, 254, 254, 312, 312, 312, 312, 312, 312]
}
},
- width:70,
- height:59,
- frame:{
- burst:12
+ width: 70,
+ height: 59,
+ frame: {
+ burst: 12
}
}
});
-Burst.EggBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.EggBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[2,38,74,110,146,182,218,254],
- top:[372,372,372,372,372,372,372,372]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [2, 38, 74, 110, 146, 182, 218, 254],
+ top: [372, 372, 372, 372, 372, 372, 372, 372]
}
},
- width:36,
- height:40,
- frame:{
- burst:8
+ width: 36,
+ height: 40,
+ frame: {
+ burst: 8
}
}
});
-Burst.DroneBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.DroneBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[1,68,135,202,269,336,403],
- top:[442,442,442,442,442,442,442]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [1, 68, 135, 202, 269, 336, 403],
+ top: [442, 442, 442, 442, 442, 442, 442]
}
},
- width:67,
- height:44,
- frame:{
- burst:7
+ width: 67,
+ height: 44,
+ frame: {
+ burst: 7
}
}
});
-Burst.OverlordBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.OverlordBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,63,126,189,252,315,378],
- top:[486,486,486,486,486,486,486]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 63, 126, 189, 252, 315, 378],
+ top: [486, 486, 486, 486, 486, 486, 486]
}
},
- width:63,
- height:95,
- frame:{
- burst:7
+ width: 63,
+ height: 95,
+ frame: {
+ burst: 7
}
}
});
-Burst.ZerglingBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.ZerglingBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,59,118,177,236,295,354],
- top:[582,582,582,582,582,582,582]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 59, 118, 177, 236, 295, 354],
+ top: [582, 582, 582, 582, 582, 582, 582]
}
},
- width:59,
- height:45,
- frame:{
- burst:7
+ width: 59,
+ height: 45,
+ frame: {
+ burst: 7
}
}
});
-Burst.HydraliskBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.HydraliskBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,63,126,189,252,315,378],
- top:[666,666,666,666,666,666,666]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 63, 126, 189, 252, 315, 378],
+ top: [666, 666, 666, 666, 666, 666, 666]
}
},
- width:63,
- height:45,
- frame:{
- burst:7
+ width: 63,
+ height: 45,
+ frame: {
+ burst: 7
}
}
});
-Burst.MutaliskBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.MutaliskBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,66,132,198,264,330,396],
- top:[712,712,712,712,712,712,712]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 66, 132, 198, 264, 330, 396],
+ top: [712, 712, 712, 712, 712, 712, 712]
}
},
- width:66,
- height:88,
- frame:{
- burst:7
+ width: 66,
+ height: 88,
+ frame: {
+ burst: 7
}
}
});
-Burst.ScourgeBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.ScourgeBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,62,124,186,248,310,372],
- top:[798,798,798,798,798,798,798]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 62, 124, 186, 248, 310, 372],
+ top: [798, 798, 798, 798, 798, 798, 798]
}
},
- width:62,
- height:70,
- frame:{
- burst:7
+ width: 62,
+ height: 70,
+ frame: {
+ burst: 7
}
}
});
-Burst.QueenBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.QueenBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,62,124,186,248,310,372],
- top:[867,867,867,867,867,867,867]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 62, 124, 186, 248, 310, 372],
+ top: [867, 867, 867, 867, 867, 867, 867]
}
},
- width:62,
- height:84,
- frame:{
- burst:7
+ width: 62,
+ height: 84,
+ frame: {
+ burst: 7
}
}
});
-Burst.UltraliskBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.UltraliskBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,72,144,216,288,360,432],
- top:[950,950,950,950,950,950,950]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 72, 144, 216, 288, 360, 432],
+ top: [950, 950, 950, 950, 950, 950, 950]
}
},
- width:72,
- height:60,
- frame:{
- burst:7
+ width: 72,
+ height: 60,
+ frame: {
+ burst: 7
}
}
});
-Burst.DefilerBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.DefilerBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Larva",
- imgPos:{
- burst:{
- left:[0,64,128,192,256,320,384],
- top:[1011,1011,1011,1011,1011,1011,1011]
+ name: "Larva",
+ imgPos: {
+ burst: {
+ left: [0, 64, 128, 192, 256, 320, 384],
+ top: [1011, 1011, 1011, 1011, 1011, 1011, 1011]
}
},
- width:64,
- height:48,
- frame:{
- burst:7
+ width: 64,
+ height: 48,
+ frame: {
+ burst: 7
}
}
});
-Burst.LurkerBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.LurkerBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Lurker",
- imgPos:{
- burst:{
- left:[650, 722, 794, 866, 938, 1010, 1082],
- top:[480, 480, 480, 480, 480, 480, 480]
+ name: "Lurker",
+ imgPos: {
+ burst: {
+ left: [650, 722, 794, 866, 938, 1010, 1082],
+ top: [480, 480, 480, 480, 480, 480, 480]
}
},
- width:72,
- height:67,
- frame:{
- burst:7
+ width: 72,
+ height: 67,
+ frame: {
+ burst: 7
}
}
});
-Burst.GuardianBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.GuardianBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Guardian",
- imgPos:{
- burst:{
- left:[656, 737, 818, 899, 980, 1061],
- top:[538, 538, 538, 538, 538, 538]
+ name: "Guardian",
+ imgPos: {
+ burst: {
+ left: [656, 737, 818, 899, 980, 1061],
+ top: [538, 538, 538, 538, 538, 538]
}
},
- width:81,
- height:74,
- frame:{
- burst:6
+ width: 81,
+ height: 74,
+ frame: {
+ burst: 6
}
}
});
-Burst.DevourerBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.DevourerBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Devourer",
- imgPos:{
- burst:{
- left:[666,764,862,960,1058,1156],
- top:[998,998,998,998,998,998]
+ name: "Devourer",
+ imgPos: {
+ burst: {
+ left: [666, 764, 862, 960, 1058, 1156],
+ top: [998, 998, 998, 998, 998, 998]
}
},
- width:73,
- height:86,
- frame:{
- burst:6
+ width: 73,
+ height: 86,
+ frame: {
+ burst: 6
}
}
});
-Burst.SmallProtossDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.SmallProtossDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Zealot",
- imgPos:{
- burst:{
- left:[0, 57, 114, 171, 228, 285, 342],
- top:[575,575,575,575,575,575,575]
+ name: "Zealot",
+ imgPos: {
+ burst: {
+ left: [0, 57, 114, 171, 228, 285, 342],
+ top: [575, 575, 575, 575, 575, 575, 575]
}
},
- width:57,
- height:84,
- frame:{
- burst:7
+ width: 57,
+ height: 84,
+ frame: {
+ burst: 7
}
}
});
-Burst.DragoonDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.DragoonDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Dragoon",
- imgPos:{
- burst:{
- left:[15, 111, 207, 303, 399, 495, 591],
- top:[591,591,591,591,591,591,591]
+ name: "Dragoon",
+ imgPos: {
+ burst: {
+ left: [15, 111, 207, 303, 399, 495, 591],
+ top: [591, 591, 591, 591, 591, 591, 591]
}
},
- width:57,
- height:84,
- frame:{
- burst:7
+ width: 57,
+ height: 84,
+ frame: {
+ burst: 7
}
}
});
-Burst.TemplarDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.TemplarDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Templar",
- imgPos:{
- burst:{
- left:[30, 158, 286, 414, 542, 670],
- top:[2078,2078,2078,2078,2078,2078]
+ name: "Templar",
+ imgPos: {
+ burst: {
+ left: [30, 158, 286, 414, 542, 670],
+ top: [2078, 2078, 2078, 2078, 2078, 2078]
}
},
- width:57,
- height:84,
- frame:{
- burst:6
+ width: 57,
+ height: 84,
+ frame: {
+ burst: 6
}
}
});
-Burst.HallucinationDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.HallucinationDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Magic",
- imgPos:{
- burst:{
- left:[514, 593, 672, 514, 593, 672, 514, 593, 672, 514, 593, 672],
- top:[460,460,460,526,526,526,592,592,592,658,658,658]
+ name: "Magic",
+ imgPos: {
+ burst: {
+ left: [514, 593, 672, 514, 593, 672, 514, 593, 672, 514, 593, 672],
+ top: [460, 460, 460, 526, 526, 526, 592, 592, 592, 658, 658, 658]
}
},
- width:79,
- height:66,
- frame:{
- burst:12
+ width: 79,
+ height: 66,
+ frame: {
+ burst: 12
}
}
});
-Burst.ArchonBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.ArchonBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Archon",
- imgPos:{
- burst:{
- left:[20,140,260,380,500,620,740,860,980],
- top:[1700,1700,1700,1700,1700,1700,1700,1700,1700]
+ name: "Archon",
+ imgPos: {
+ burst: {
+ left: [20, 140, 260, 380, 500, 620, 740, 860, 980],
+ top: [1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700]
}
},
- width:80,
- height:80,
- frame:{
- burst:9
+ width: 80,
+ height: 80,
+ frame: {
+ burst: 9
}
}
});
-Burst.DarkArchonBirth=Burst.extends({
- constructorPlus:function(props){
+Burst.DarkArchonBirth = Burst.extends({
+ constructorPlus: function (props) {
//Mixin
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"DarkArchon",
- imgPos:{
- burst:{
- left:[20,140,260,380,500,620,740,860,980],
- top:[1220,1220,1220,1220,1220,1220,1220,1220,1220]
+ name: "DarkArchon",
+ imgPos: {
+ burst: {
+ left: [20, 140, 260, 380, 500, 620, 740, 860, 980],
+ top: [1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220]
}
},
- width:80,
- height:80,
- frame:{
- burst:9
+ width: 80,
+ height: 80,
+ frame: {
+ burst: 9
}
}
});
-
-Burst.RagnasaurDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.RagnasaurDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Ragnasaur",
- imgPos:{
- burst:{
- left:[0, 104, 208, 312, 416, 520, 624, 728],
- top:[936,936,936,936,936,936,936,936]
+ name: "Ragnasaur",
+ imgPos: {
+ burst: {
+ left: [0, 104, 208, 312, 416, 520, 624, 728],
+ top: [936, 936, 936, 936, 936, 936, 936, 936]
}
},
- width:128,
- height:128,
- frame:{
- burst:8
+ width: 128,
+ height: 128,
+ frame: {
+ burst: 8
}
}
});
-Burst.RhynsdonDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.RhynsdonDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Rhynsdon",
- imgPos:{
- burst:{
- left:[0, 104, 208, 312, 416, 520, 624, 728],
- top:[1144,1144,1144,1144,1144,1144,1144,1144]
+ name: "Rhynsdon",
+ imgPos: {
+ burst: {
+ left: [0, 104, 208, 312, 416, 520, 624, 728],
+ top: [1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144]
}
},
- width:104,
- height:128,
- frame:{
- burst:8
+ width: 104,
+ height: 128,
+ frame: {
+ burst: 8
}
}
});
-Burst.UrsadonDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.UrsadonDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Ursadon",
- imgPos:{
- burst:{
- left:[0, 92, 184, 276, 368, 460, 552, 644],
- top:[736,736,736,736,736,736,736,736]
+ name: "Ursadon",
+ imgPos: {
+ burst: {
+ left: [0, 92, 184, 276, 368, 460, 552, 644],
+ top: [736, 736, 736, 736, 736, 736, 736, 736]
}
},
- width:92,
- height:92,
- frame:{
- burst:8
+ width: 92,
+ height: 92,
+ frame: {
+ burst: 8
}
}
});
-Burst.BengalaasDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.BengalaasDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Bengalaas",
- imgPos:{
- burst:{
- left:[0, 128, 256, 384, 512, 640, 768, 896],
- top:[1536,1536,1536,1536,1536,1536,1536,1536]
+ name: "Bengalaas",
+ imgPos: {
+ burst: {
+ left: [0, 128, 256, 384, 512, 640, 768, 896],
+ top: [1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536]
}
},
- width:128,
- height:128,
- frame:{
- burst:8
+ width: 128,
+ height: 128,
+ frame: {
+ burst: 8
}
}
});
-Burst.ScantidDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.ScantidDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Scantid",
- imgPos:{
- burst:{
- left:[0, 92, 184, 276, 368, 460, 552, 644],
- top:[1104,1104,1104,1104,1104,1104,1104,1104]
+ name: "Scantid",
+ imgPos: {
+ burst: {
+ left: [0, 92, 184, 276, 368, 460, 552, 644],
+ top: [1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104]
}
},
- width:92,
- height:92,
- frame:{
- burst:8
+ width: 92,
+ height: 92,
+ frame: {
+ burst: 8
}
}
});
-Burst.KakaruDeath=Burst.extends({
- constructorPlus:function(props){
+Burst.KakaruDeath = Burst.extends({
+ constructorPlus: function (props) {
//Nothing
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"Kakaru",
- imgPos:{
- burst:{
- left:[0, 92, 184, 276, 368, 460, 552, 644],
- top:[1104,1104,1104,1104,1104,1104,1104,1104]
+ name: "Kakaru",
+ imgPos: {
+ burst: {
+ left: [0, 92, 184, 276, 368, 460, 552, 644],
+ top: [1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104]
}
},
- width:92,
- height:92,
- frame:{
- burst:8
+ width: 92,
+ height: 92,
+ frame: {
+ burst: 8
}
}
});
+//# sourceMappingURL=Burst.js.map
\ No newline at end of file
diff --git a/Characters/Burst.ts b/Characters/Burst.ts
new file mode 100644
index 0000000..a935dbb
--- /dev/null
+++ b/Characters/Burst.ts
@@ -0,0 +1,1526 @@
+//One animation period which only play for a while and die
+var Burst=Gobj.extends({
+ constructorPlus:function(props){
+ //Override if has props.scale
+ if (props.scale) this.scale=props.scale;
+ //Resize drawing by scale
+ var times=this.scale?(this.scale):1;
+ //Behavior like effect on target
+ if (props.target) {
+ this.target=props.target;
+ //Ahead of owner
+ if (props.above) this.above=true;
+ //Animation duration
+ //Match owner size
+ if (props.autoSize) this.autoSize=true;
+ if (this.autoSize!=null) {
+ //Can mix autoSize with scale
+ switch(this.autoSize){
+ case 'MAX':
+ this.scale=Math.max(this.target.width,this.target.height)*2*times/(this.width+this.height);
+ break;
+ case 'MIN':
+ this.scale=Math.min(this.target.width,this.target.height)*2*times/(this.width+this.height);
+ break;
+ default:
+ this.scale=(this.target.width+this.target.height)*times/(this.width+this.height);
+ }
+ times=this.scale;
+ }
+ //Location
+ this.x=(this.target.posX()-this.width*times/2)>>0;
+ this.y=(this.target.posY()-this.height*times/2)>>0;
+ //Onfire or bleed will have offset
+ if (props.offset){
+ this.x+=props.offset.x;
+ this.y+=props.offset.y;
+ }
+ }
+ //Independent burst
+ else {
+ //Target location, from centerP to top-left
+ this.x=props.x-this.width*times/2;
+ this.y=props.y-this.height*times/2;
+ }
+ //Play duration
+ if (this.forever) this.duration=-1;//Keep playing until killed
+ if (props.duration!=null) this.duration=props.duration;//Override duration
+ //Restore callback after burst finish
+ if (props.callback) this.callback=props.callback;
+ //By default it will burst
+ this.burst();
+ //Will show after constructed
+ Burst.allEffects.push(this);
+ },
+ prototypePlus:{
+ //Override Gobj method
+ animeFrame:function(){
+ //Animation play
+ this.action++;
+ //Override Gobj here, can have hidden frames
+ 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;
+ }
+ //Update location here
+ if (this.above && this.target) {
+ //Update location: copied from constructor
+ var times=this.scale?(this.scale):1;
+ this.x=(this.target.posX()-this.width*times/2)>>0;
+ this.y=(this.target.posY()-this.height*times/2)>>0;
+ }
+ },
+ burst:function(){
+ this.status="burst";
+ //Start play burst animation
+ var myself=this;
+ var animateFrame=function(){
+ //Only play animation, will not move
+ myself.animeFrame();
+ };
+ this.allFrames['animate']=animateFrame;
+ //Will die(stop playing) after time limit arrive
+ var duration=this.duration?this.duration:(this.frame['burst']*100);
+ //Last forever if duration<0 (-1)
+ if (duration>0){
+ Game.commandTimeout(function(){
+ myself.die();
+ },duration);
+ }
+ },
+ die:function(){
+ //Run callback when burst die
+ if (this.callback) this.callback();
+ Gobj.prototype.die.call(this);
+ }
+ }
+});
+//All burst effects here for show
+Burst.allEffects=[];
+//Define different bursts
+Burst.GreenFog=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/GreenFog.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Mutalisk",//Source img inside Mutalisk.png
+ imgPos:{
+ burst:{
+ left:[8,68,134,198,263,8,68,134,198,263],
+ top:[468,468,468,468,468,532,532,532,532,532]
+ }
+ },
+ width:52,
+ height:57,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.Parasite=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Parasite.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Mutalisk",
+ imgPos:{
+ burst:{
+ left:[8,68,134,198,263,8,68,134,198,263],
+ top:[468,468,468,468,468,532,532,532,532,532]
+ }
+ },
+ width:52,
+ height:57,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.Spore=Burst.extends({
+ constructorPlus:function(props){
+ //No sound
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Mutalisk",
+ imgPos:{
+ burst:{
+ left:[8,68,134,198,263,8,68,134,198,263],
+ top:[468,468,468,468,468,532,532,532,532,532]
+ }
+ },
+ width:52,
+ height:57,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.GreenBallBroken=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/Greenball.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Guardian",
+ imgPos:{
+ burst:{
+ left:[0,56,119,182,252,322,396,470],
+ top:[556,556,556,556,556,556,556,556]
+ }
+ },
+ width:60,
+ height:60,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.PurpleCloudSpread=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/PurpleCloud.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Devourer",
+ imgPos:{
+ burst:{
+ left:[17,70,122,174,230,280,335,390,452],
+ top:[1022,1022,1022,1022,1022,1022,1022,1022,1022]
+ }
+ },
+ width:50,
+ height:60,
+ callback:function(){
+ var chara=this.target;
+ //Fix all spored issue
+ if (chara.status=='dead' || chara.status==null) return;
+ //Effect:PurpleBuffer when cloud spread on target chara
+ //Buffer flag, can add up
+ if (chara.buffer.PurpleCloud==9) return;//9 at max
+ if (chara.buffer.PurpleCloud>0) chara.buffer.PurpleCloud++;
+ else chara.buffer.PurpleCloud=1;
+ //Decrease defense and slow down attack rate
+ var bufferObj={
+ armor:chara.get('armor')-1
+ };
+ if (chara.plasma!=null) bufferObj.plasma=chara.get('plasma')-1;
+ if (chara.attackInterval) bufferObj.attackInterval=Math.round(chara.get('attackInterval')*1.1);
+ //Apply buffer
+ chara.addBuffer(bufferObj);
+ if (!chara.purpleBuffer) chara.purpleBuffer=[];
+ chara.purpleBuffer.push(bufferObj);
+ //Purple effect
+ new Animation.PurpleEffect({team:this.team,target:chara,callback:function(){
+ //Restore in 30 seconds, Last In First Out
+ if (chara.purpleBuffer && chara.removeBuffer(chara.purpleBuffer.pop())) {
+ chara.buffer.PurpleCloud--;
+ }
+ //Full restore
+ if (chara.buffer.PurpleCloud==0) {
+ delete chara.buffer.PurpleCloud;
+ delete chara.purpleBuffer;
+ }
+ }});
+ },
+ frame:{
+ burst:9
+ }
+ }
+});
+Burst.Sunken=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/Sunken.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[46,174,302,432,560,688],
+ top:[626,626,626,626,626,626]
+ }
+ },
+ width:28,
+ height:40,
+ frame:{
+ burst:6
+ }
+ }
+});
+Burst.SmallFireSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Wraith",
+ imgPos:{
+ burst:{
+ left:[64,106,64],
+ top:[132,132,132]
+ }
+ },
+ width:32,
+ height:30,
+ frame:{
+ burst:3
+ }
+ }
+});
+Burst.FireSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Ghost",
+ imgPos:{
+ burst:{
+ left:[0, 38, 76, 114, 152, 190, 228, 266, 304, 342],
+ top:[596,596,596,596,596,596,596,596,596,596]
+ }
+ },
+ width:38,
+ height:36,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.FireSparkSound=Burst.FireSpark.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
+ },
+ prototypePlus:{
+ //Nothing
+ }
+});
+Burst.LaserSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[18,70,128,182],
+ top:[50,50,50,50]
+ }
+ },
+ width:30,
+ height:30,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.VultureSpark=Burst.LaserSpark.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/VultureSpark.burst.wav').play();
+ },
+ prototypePlus: {
+ //Nothing
+ }
+});
+Burst.HydraSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Hydralisk",
+ imgPos:{
+ burst:{
+ left:[0, 34, 68, 102, 136, 170, 204, 238],
+ top:[801,801,801,801,801,801,801,801]
+ }
+ },
+ width:34,
+ height:35,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.CorsairCloud=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[5,57],//[1, 64, 128]
+ top:[576,576]
+ }
+ },
+ width:40,//62
+ height:44,//44
+ frame:{
+ burst:2
+ }
+ }
+});
+Burst.ArchonBurst=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[0, 80, 160, 240, 320, 400],
+ top:[779,779,779,779,779,779]
+ }
+ },
+ width:80,
+ height:80,
+ frame:{
+ burst:6
+ }
+ }
+});
+Burst.DragoonBallBroken=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/DragoonBall.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[0, 40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480, 520],
+ top:[891,891,891,891,891,891,891,891,891,891,891,891,891,891]
+ }
+ },
+ width:38,
+ height:40,
+ frame:{
+ burst:14
+ }
+ }
+});
+Burst.ShootSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[0, 40, 80, 120, 160, 200, 240, 280, 320, 360],
+ top:[1011,1011,1011,1011,1011,1011,1011,1011,1011,1011]
+ }
+ },
+ width:40,
+ height:40,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.BlueShootSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[32, 64, 96, 128, 160, 192, 224, 256],
+ top:[1115,1115,1115,1115,1115,1115,1115,1115]
+ }
+ },
+ width:32,
+ height:32,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.SCVSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[0, 48, 96, 144, 192, 240, 288, 336, 384, 432],
+ top:[1147,1147,1147,1147,1147,1147,1147,1147,1147,1147]
+ }
+ },
+ width:48,
+ height:48,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.ProbeSpark=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[0, 48, 96, 144, 192, 240, 288],
+ top:[672,672,672,672,672,672,672]
+ }
+ },
+ width:48,
+ height:32,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.ReaverBurst=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Burst",
+ imgPos:{
+ burst:{
+ left:[0, 80, 160, 240, 320, 400, 480, 560, 640, 720],
+ top:[931,931,931,931,931,931,931,931,931,931]
+ }
+ },
+ width:78,
+ height:64,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.PurpleFog=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Mutalisk",
+ imgPos:{
+ burst:{
+ left:[338,398,464,528,593,338,398,464,528,593],
+ top:[468,468,468,468,468,532,532,532,532,532]
+ }
+ },
+ width:52,
+ height:57,
+ frame:{
+ burst:10
+ }
+ }
+});
+
+Burst.InfestedBomb=Burst.extends({
+ constructorPlus:function(props){
+ //Has burst sound effect
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"InfestedTerran",
+ imgPos:{
+ burst:{
+ left:[0, 78, 156, 234, 312, 0, 78, 156, 234, 312],
+ top:[432,432,432,432,432,496,496,496,496,496]
+ }
+ },
+ width:78,
+ height:64,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.ScourgeBomb=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Scourge",
+ imgPos:{
+ burst:{
+ left:[0, 52, 104, 156, 208, 260, 312, 364, 416],
+ top:[218,218,218,218,218,218,218,218,218]
+ }
+ },
+ width:52,
+ height:46,
+ frame:{
+ burst:9
+ }
+ }
+});
+
+Burst.SmallExplode=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[56,156,256,360],
+ top:[1686,1686,1686,1686]
+ }
+ },
+ width:80,
+ height:60,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.MiddleExplode=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[44,192,342,498],
+ top:[1754,1754,1754,1754]
+ }
+ },
+ width:120,
+ height:90,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.BigExplode=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[26,226,424,632],
+ top:[1846,1846,1846,1846]
+ }
+ },
+ width:160,
+ height:120,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.SmallBlueExplode=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[50,150,250,356],
+ top:[1424,1424,1424,1424]
+ }
+ },
+ width:80,
+ height:60,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.MiddleBlueExplode=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[36,184,338,494],
+ top:[1484,1484,1484,1484]
+ }
+ },
+ width:120,
+ height:90,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.BigBlueExplode=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[22,222,420,632],
+ top:[1566,1566,1566,1566]
+ }
+ },
+ width:160,
+ height:120,
+ frame:{
+ burst:4
+ }
+ }
+});
+Burst.ZergBuildingBurst=Burst.extends({
+ constructorPlus:function(props){
+ //Need clear mud when ZergBuildingBurst finished
+ this.callback=function(){
+ Map.needRefresh="MAP";
+ };
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[0,200,400,600,800,0,200,400,600,800,0,200,400,400,600,600,800,800],
+ top:[0,0,0,0,0,200,200,200,200,200,400,400,400,400,400,400,400,400]
+ }
+ },
+ width:200,
+ height:200,
+ frame:{
+ burst:18
+ }
+ }
+});
+Burst.TerranBuildingBurst=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[0,0,200,200,400,400,600,600,800,800,0,0,200,200,400,400,600,600],
+ top:[600,600,600,600,600,600,600,600,600,600,800,800,800,800,800,800,800,800]
+ }
+ },
+ width:200,
+ height:200,
+ frame:{
+ burst:18
+ }
+ }
+});
+Burst.ProtossBuildingBurst=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"BuildingBurst",
+ imgPos:{
+ burst:{
+ left:[0,0,200,200,400,400,600,600,800,800,0,0,200,200,400,400,600,600],
+ top:[1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1200,1200,1200,1200,1200,1200,1200,1200]
+ }
+ },
+ width:200,
+ height:200,
+ frame:{
+ burst:18
+ }
+ }
+});
+Burst.HumanDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Civilian",
+ imgPos:{
+ burst:{
+ left:[6,58,106,158,6,54,102,152],
+ top:[286,286,286,286,320,320,320,320]
+ }
+ },
+ width:42,
+ height:30,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.MedicDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Medic",
+ imgPos:{
+ burst:{
+ left:[0, 64, 128, 192, 256, 320, 384, 448],
+ top:[832,832,832,832,832,832,832,832]
+ }
+ },
+ width:64,
+ height:64,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.SmallZergFlyingDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Mutalisk",
+ imgPos:{
+ burst:{
+ left:[71,143,215,283,355,432,502],
+ top:[372,372,372,372,372,372,372]
+ }
+ },
+ width:64,
+ height:62,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.BigZergFlyingDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Devourer",
+ imgPos:{
+ burst:{
+ left:[0, 114, 228, 342, 456, 570, 684, 798],
+ top:[860,860,860,860,860,860,860,860]
+ }
+ },
+ width:114,
+ height:102,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.DroneDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Drone",
+ imgPos:{
+ burst:{
+ left:[0, 128, 256, 384, 512, 640, 768, 896],
+ top:[1280,1280,1280,1280,1280,1280,1280,1280]
+ }
+ },
+ width:128,
+ height:128,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.ZerglingDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Zergling",
+ imgPos:{
+ burst:{
+ left:[0, 68, 136, 204, 272, 340, 408],
+ top:[506,506,506,506,506,506,506]
+ }
+ },
+ width:68,
+ height:55,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.HydraliskDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Hydralisk",
+ imgPos:{
+ burst:{
+ left:[0, 66, 132, 198, 264, 330, 396, 462, 528, 594, 660, 726],
+ top:[704,704,704,704,704,704,704,704,704,704,704,704]
+ }
+ },
+ width:66,
+ height:50,
+ frame:{
+ burst:12
+ }
+ }
+});
+Burst.LurkerDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Lurker",
+ imgPos:{
+ burst:{
+ left:[85, 170, 255, 340, 0, 85, 170, 255, 340],
+ top:[582,582,582,582,646,646,646,646,646]
+ }
+ },
+ width:85,
+ height:64,
+ frame:{
+ burst:9
+ }
+ }
+});
+Burst.UltraliskDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Ultralisk",
+ imgPos:{
+ burst:{
+ left:[0, 101, 202, 303, 404, 505, 606, 707, 808, 909],
+ top:[1620,1620,1620,1620,1620,1620,1620,1620,1620,1620]
+ }
+ },
+ width:101,
+ height:108,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.DefilerDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Defiler",
+ imgPos:{
+ burst:{
+ left:[0, 70, 140, 210, 280, 350, 420, 490, 560, 630],
+ top:[558,558,558,558,558,558,558,558,558,558]
+ }
+ },
+ width:70,
+ height:46,
+ frame:{
+ burst:10
+ }
+ }
+});
+Burst.BroodlingDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Queen",
+ imgPos:{
+ burst:{
+ left:[0, 40, 80, 120, 160],
+ top:[782,782,782,782,782]
+ }
+ },
+ width:40,
+ height:22,
+ frame:{
+ burst:5
+ }
+ }
+});
+Burst.LarvaDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,50,100,150,200,250,300,350,400],
+ top:[146,146,146,146,146,146,146,146,146]
+ }
+ },
+ width:50,
+ height:26,
+ frame:{
+ burst:9
+ }
+ }
+});
+Burst.EggDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,70,140,210,280,350,0,70,140,210,280,350],
+ top:[254,254,254,254,254,254,312,312,312,312,312,312]
+ }
+ },
+ width:70,
+ height:59,
+ frame:{
+ burst:12
+ }
+ }
+});
+Burst.EggBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[2,38,74,110,146,182,218,254],
+ top:[372,372,372,372,372,372,372,372]
+ }
+ },
+ width:36,
+ height:40,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.DroneBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[1,68,135,202,269,336,403],
+ top:[442,442,442,442,442,442,442]
+ }
+ },
+ width:67,
+ height:44,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.OverlordBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,63,126,189,252,315,378],
+ top:[486,486,486,486,486,486,486]
+ }
+ },
+ width:63,
+ height:95,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.ZerglingBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,59,118,177,236,295,354],
+ top:[582,582,582,582,582,582,582]
+ }
+ },
+ width:59,
+ height:45,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.HydraliskBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,63,126,189,252,315,378],
+ top:[666,666,666,666,666,666,666]
+ }
+ },
+ width:63,
+ height:45,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.MutaliskBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,66,132,198,264,330,396],
+ top:[712,712,712,712,712,712,712]
+ }
+ },
+ width:66,
+ height:88,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.ScourgeBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,62,124,186,248,310,372],
+ top:[798,798,798,798,798,798,798]
+ }
+ },
+ width:62,
+ height:70,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.QueenBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,62,124,186,248,310,372],
+ top:[867,867,867,867,867,867,867]
+ }
+ },
+ width:62,
+ height:84,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.UltraliskBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,72,144,216,288,360,432],
+ top:[950,950,950,950,950,950,950]
+ }
+ },
+ width:72,
+ height:60,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.DefilerBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Larva",
+ imgPos:{
+ burst:{
+ left:[0,64,128,192,256,320,384],
+ top:[1011,1011,1011,1011,1011,1011,1011]
+ }
+ },
+ width:64,
+ height:48,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.LurkerBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Lurker",
+ imgPos:{
+ burst:{
+ left:[650, 722, 794, 866, 938, 1010, 1082],
+ top:[480, 480, 480, 480, 480, 480, 480]
+ }
+ },
+ width:72,
+ height:67,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.GuardianBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Guardian",
+ imgPos:{
+ burst:{
+ left:[656, 737, 818, 899, 980, 1061],
+ top:[538, 538, 538, 538, 538, 538]
+ }
+ },
+ width:81,
+ height:74,
+ frame:{
+ burst:6
+ }
+ }
+});
+Burst.DevourerBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Devourer",
+ imgPos:{
+ burst:{
+ left:[666,764,862,960,1058,1156],
+ top:[998,998,998,998,998,998]
+ }
+ },
+ width:73,
+ height:86,
+ frame:{
+ burst:6
+ }
+ }
+});
+Burst.SmallProtossDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Zealot",
+ imgPos:{
+ burst:{
+ left:[0, 57, 114, 171, 228, 285, 342],
+ top:[575,575,575,575,575,575,575]
+ }
+ },
+ width:57,
+ height:84,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.DragoonDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Dragoon",
+ imgPos:{
+ burst:{
+ left:[15, 111, 207, 303, 399, 495, 591],
+ top:[591,591,591,591,591,591,591]
+ }
+ },
+ width:57,
+ height:84,
+ frame:{
+ burst:7
+ }
+ }
+});
+Burst.TemplarDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Templar",
+ imgPos:{
+ burst:{
+ left:[30, 158, 286, 414, 542, 670],
+ top:[2078,2078,2078,2078,2078,2078]
+ }
+ },
+ width:57,
+ height:84,
+ frame:{
+ burst:6
+ }
+ }
+});
+Burst.HallucinationDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Magic",
+ imgPos:{
+ burst:{
+ left:[514, 593, 672, 514, 593, 672, 514, 593, 672, 514, 593, 672],
+ top:[460,460,460,526,526,526,592,592,592,658,658,658]
+ }
+ },
+ width:79,
+ height:66,
+ frame:{
+ burst:12
+ }
+ }
+});
+Burst.ArchonBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Archon",
+ imgPos:{
+ burst:{
+ left:[20,140,260,380,500,620,740,860,980],
+ top:[1700,1700,1700,1700,1700,1700,1700,1700,1700]
+ }
+ },
+ width:80,
+ height:80,
+ frame:{
+ burst:9
+ }
+ }
+});
+Burst.DarkArchonBirth=Burst.extends({
+ constructorPlus:function(props){
+ //Mixin
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"DarkArchon",
+ imgPos:{
+ burst:{
+ left:[20,140,260,380,500,620,740,860,980],
+ top:[1220,1220,1220,1220,1220,1220,1220,1220,1220]
+ }
+ },
+ width:80,
+ height:80,
+ frame:{
+ burst:9
+ }
+ }
+});
+
+Burst.RagnasaurDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Ragnasaur",
+ imgPos:{
+ burst:{
+ left:[0, 104, 208, 312, 416, 520, 624, 728],
+ top:[936,936,936,936,936,936,936,936]
+ }
+ },
+ width:128,
+ height:128,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.RhynsdonDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Rhynsdon",
+ imgPos:{
+ burst:{
+ left:[0, 104, 208, 312, 416, 520, 624, 728],
+ top:[1144,1144,1144,1144,1144,1144,1144,1144]
+ }
+ },
+ width:104,
+ height:128,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.UrsadonDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Ursadon",
+ imgPos:{
+ burst:{
+ left:[0, 92, 184, 276, 368, 460, 552, 644],
+ top:[736,736,736,736,736,736,736,736]
+ }
+ },
+ width:92,
+ height:92,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.BengalaasDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Bengalaas",
+ imgPos:{
+ burst:{
+ left:[0, 128, 256, 384, 512, 640, 768, 896],
+ top:[1536,1536,1536,1536,1536,1536,1536,1536]
+ }
+ },
+ width:128,
+ height:128,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.ScantidDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Scantid",
+ imgPos:{
+ burst:{
+ left:[0, 92, 184, 276, 368, 460, 552, 644],
+ top:[1104,1104,1104,1104,1104,1104,1104,1104]
+ }
+ },
+ width:92,
+ height:92,
+ frame:{
+ burst:8
+ }
+ }
+});
+Burst.KakaruDeath=Burst.extends({
+ constructorPlus:function(props){
+ //Nothing
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"Kakaru",
+ imgPos:{
+ burst:{
+ left:[0, 92, 184, 276, 368, 460, 552, 644],
+ top:[1104,1104,1104,1104,1104,1104,1104,1104]
+ }
+ },
+ width:92,
+ height:92,
+ frame:{
+ burst:8
+ }
+ }
+});
diff --git a/Characters/Button.js b/Characters/Button.js
index ddc030d..b35deda 100644
--- a/Characters/Button.js
+++ b/Characters/Button.js
@@ -1,84 +1,87 @@
-var Button={
- callback:null,
+var Button = {
+ callback: null,
/***************Functions***************/
- reset:function(){
+ reset: function () {
Game.changeSelectedTo(Game.selectedUnit);
},
- refreshButtons:function(){
+ refreshButtons: function () {
Button.equipButtonsFor(Game.selectedUnit);
},
//Equip all buttons for unit
- equipButtonsFor:function(chara){
+ equipButtonsFor: function (chara) {
//Clear all buttons
$('div.panel_Control button').removeAttr('class').removeAttr('disabled').removeAttr('style').off('click').off('mouseover').off('mouseout').html('').hide();
//Filter out enemy
- if (chara=={} || (chara.isEnemy && chara.isEnemy())) return;
+ if (chara == {} || (chara.isEnemy && chara.isEnemy()))
+ return;
//Add button press sound
- $('div.panel_Control button').on('click',function(){
+ $('div.panel_Control button').on('click', function () {
Referee.voice('button').play();
});
//Show buttons
- if (chara instanceof Unit){
- $('button[num="1"]').attr('class','move').show();
- $('button[num="2"]').attr('class','stop').show();
- $('button[num="4"]').attr('class','patrol').show();
- $('button[num="5"]').attr('class','hold').show();
- if (Game.selectedUnit.hold) $('button.hold').css('border-color','red');//Add for hold tag
+ if (chara instanceof Unit) {
+ $('button[num="1"]').attr('class', 'move').show();
+ $('button[num="2"]').attr('class', 'stop').show();
+ $('button[num="4"]').attr('class', 'patrol').show();
+ $('button[num="5"]').attr('class', 'hold').show();
+ if (Game.selectedUnit.hold)
+ $('button.hold').css('border-color', 'red'); //Add for hold tag
//Bind callbacks
- $('button.move').on('click',Button.moveHandler);
- $('button.patrol').on('click',Button.patrolHandler);
- $('button.stop').on('click',function(){
+ $('button.move').on('click', Button.moveHandler);
+ $('button.patrol').on('click', Button.patrolHandler);
+ $('button.stop').on('click', function () {
Button.stopHandler();
});
- $('button.hold').on('click',function(){
+ $('button.hold').on('click', function () {
Button.holdHandler();
});
}
- if (chara.attack){
- $('button[num="3"]').attr('class','attack').show();
- $('button.attack').on('click',Button.attackHandler);
+ if (chara.attack) {
+ $('button[num="3"]').attr('class', 'attack').show();
+ $('button.attack').on('click', Button.attackHandler);
}
//Add items
- if (chara.items){
- for (var N in chara.items){
- if (chara.items[N]!=null) {
- $('button[num="'+N+'"]').off('click').attr('class',chara.items[N].name).show();
+ if (chara.items) {
+ for (var N in chara.items) {
+ if (chara.items[N] != null) {
+ $('button[num="' + N + '"]').off('click').attr('class', chara.items[N].name).show();
if (chara.items[N].condition && !(chara.items[N].condition()))
- $('button[num="'+N+'"]').attr('disabled',true);
- else $('button[num="'+N+'"]').removeAttr('disabled');
+ $('button[num="' + N + '"]').attr('disabled', true);
+ else
+ $('button[num="' + N + '"]').removeAttr('disabled');
//Exceptions: need mark numbers on button
- switch (chara.items[N].name){
+ switch (chara.items[N].name) {
case 'SpiderMines':
- $('button[num="'+N+'"]')[0].innerHTML=chara.spiderMines;
+ $('button[num="' + N + '"]')[0].innerHTML = chara.spiderMines;
break;
case 'Scarab':
- $('button[num="'+N+'"]')[0].innerHTML=chara.scarabNum;
+ $('button[num="' + N + '"]')[0].innerHTML = chara.scarabNum;
break;
case 'Interceptor':
- $('button[num="'+N+'"]')[0].innerHTML=chara.continuousAttack.count;
+ $('button[num="' + N + '"]')[0].innerHTML = chara.continuousAttack.count;
break;
}
}
else {
- $('button[num="'+N+'"]').removeAttr('class').hide();
+ $('button[num="' + N + '"]').removeAttr('class').hide();
}
}
//Bind basic callbacks
- $('button.Cancel').on('click',function(){
+ $('button.Cancel').on('click', function () {
//Reset menu
Button.refreshButtons();
});
- $('button.SelectLarva').on('click',function(){
- var larvas=Game.selectedUnit.larvas;
- if (larvas){
- larvas=larvas.filter(function(chara){
- return chara.status!='dead';
+ $('button.SelectLarva').on('click', function () {
+ var larvas = Game.selectedUnit.larvas;
+ if (larvas) {
+ larvas = larvas.filter(function (chara) {
+ return chara.status != 'dead';
});
//If found alive larva
- if (larvas.length){
+ if (larvas.length) {
Game.unselectAll();
- Game.addIntoAllSelected(larvas,true);
- if (larvas[0] instanceof Gobj){
+ Game.addIntoAllSelected(larvas, true);
+ if (larvas[0] instanceof Gobj) {
Game.changeSelectedTo(larvas[0]);
//Sound effect
larvas[0].sound.selected.play();
@@ -86,105 +89,109 @@ var Button={
}
}
});
- $('button.BasicMutation').on('click',function(){
+ $('button.BasicMutation').on('click', function () {
Button.equipButtonsFor(Button.basicZergMutations);
});
- $('button.AdvancedMutation').on('click',function(){
+ $('button.AdvancedMutation').on('click', function () {
Button.equipButtonsFor(Button.advancedZergMutations);
});
- $('button.BasicBuilding').on('click',function(){
+ $('button.BasicBuilding').on('click', function () {
Button.equipButtonsFor(Button.basicTerranBuildings);
});
- $('button.AdvancedBuilding').on('click',function(){
+ $('button.AdvancedBuilding').on('click', function () {
Button.equipButtonsFor(Button.advancedTerranBuildings);
});
- $('button.BasicStructure').on('click',function(){
+ $('button.BasicStructure').on('click', function () {
Button.equipButtonsFor(Button.basicProtossStructures);
});
- $('button.AdvancedStructure').on('click',function(){
+ $('button.AdvancedStructure').on('click', function () {
Button.equipButtonsFor(Button.advancedProtossStructures);
});
//Upgrade callbacks
- var upgrades=[];
- for (var grade in Upgrade){
+ var upgrades = [];
+ for (var grade in Upgrade) {
upgrades.push(grade);
- }//Cannot use for-in bind together
- upgrades.forEach(function(grade){
- $('button.'+grade).on('click',function(){
+ } //Cannot use for-in bind together
+ upgrades.forEach(function (grade) {
+ $('button.' + grade).on('click', function () {
//Filter out when occupied
- if (Game.selectedUnit.processing) return;
+ if (Game.selectedUnit.processing)
+ return;
//Need time
- if (Resource.getCost(grade) && Resource.getCost(grade).time){
- var owner=Game.selectedUnit;
- var duration=Resource.getCost(grade).time;
+ if (Resource.getCost(grade) && Resource.getCost(grade).time) {
+ var owner = Game.selectedUnit;
+ var duration = Resource.getCost(grade).time;
//User move record
Multiplayer.cmds.push(JSON.stringify({
- uids:[owner.id],
- type:'upgrade',
- name:grade,
- duration:duration,
- team:Game.team
+ uids: [owner.id],
+ type: 'upgrade',
+ name: grade,
+ duration: duration,
+ team: Game.team
}));
}
- //Or will effect immediately
else {
Multiplayer.cmds.push(JSON.stringify({
- team:Game.team,
- type:'upgrade',
- name:grade
+ team: Game.team,
+ type: 'upgrade',
+ name: grade
}));
}
});
});
//Magic callbacks
- var magics=[];
- for (var magic in Magic){
+ var magics = [];
+ for (var magic in Magic) {
magics.push(magic);
- }//Cannot use for-in bind together
- var hasMagic=function(chara,magic){
- if (chara.items){
- for (var attr in chara.items){
- if (chara.items[attr] && chara.items[attr].name==magic){
- if (chara.items[attr].condition){
- if (chara.items[attr].condition()) return true;
+ } //Cannot use for-in bind together
+ var hasMagic = function (chara, magic) {
+ if (chara.items) {
+ for (var attr in chara.items) {
+ if (chara.items[attr] && chara.items[attr].name == magic) {
+ if (chara.items[attr].condition) {
+ if (chara.items[attr].condition())
+ return true;
}
- else return true;
+ else
+ return true;
}
}
}
return false;
};
- magics.forEach(function(magic){
- $('button.'+magic).on('click',function(){
- var duration=Resource.getCost(magic)?(Resource.getCost(magic).time):0;
- Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
- return (chara.team==Game.team && chara.selected && hasMagic(chara,magic));
- }).forEach(function(chara){
+ magics.forEach(function (magic) {
+ $('button.' + magic).on('click', function () {
+ var duration = Resource.getCost(magic) ? (Resource.getCost(magic).time) : 0;
+ Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
+ return (chara.team == Game.team && chara.selected && hasMagic(chara, magic));
+ }).forEach(function (chara) {
//For Scarab and Interceptor
- if (duration){
+ if (duration) {
//Filter out when occupied
- if (chara.processing) return;
+ if (chara.processing)
+ return;
Multiplayer.cmds.push(JSON.stringify({
- uids:[chara.id],
- type:'magic',
- name:magic,
- duration:duration
+ uids: [chara.id],
+ type: 'magic',
+ name: magic,
+ duration: duration
}));
}
else {
//Pay by credit card
- if (Magic[magic].credit) chara.creditBill=Resource.getCost(magic);
+ if (Magic[magic].credit)
+ chara.creditBill = Resource.getCost(magic);
//Execute magic immediately
- if (!(Magic[magic].credit || Magic[magic].needLocation)){
+ if (!(Magic[magic].credit || Magic[magic].needLocation)) {
Multiplayer.cmds.push(JSON.stringify({
- uids:[chara.id],
- type:'magic',
- name:magic
+ uids: [chara.id],
+ type: 'magic',
+ name: magic
}));
}
else {
//Payment: chara paypal cost
- if (Resource.paypal.call(chara,Resource.getCost(magic))){
+ if (Resource.paypal.call(chara, Resource.getCost(magic))) {
Magic[magic].spell.call(chara);
}
}
@@ -194,106 +201,106 @@ var Button={
});
//Unit callbacks:
//For Zerg units
- var unitTypes=[];
- for (var unitType in Zerg){
+ var unitTypes = [];
+ for (var unitType in Zerg) {
unitTypes.push(unitType);
}
- var exceptions=['Guardian','Devourer'];
- unitTypes.forEach(function(unitType){
- $('button.'+unitType).on('click',function(){
+ var exceptions = ['Guardian', 'Devourer'];
+ unitTypes.forEach(function (unitType) {
+ $('button.' + unitType).on('click', function () {
//Calculate duration
- var duration=Resource.getCost(unitType).time;
- Unit.allUnits.filter(function(chara){
- return (chara.team==Game.team && chara.selected && chara.name==Game.selectedUnit.name);
- }).forEach(function(chara){
+ var duration = Resource.getCost(unitType).time;
+ Unit.allUnits.filter(function (chara) {
+ return (chara.team == Game.team && chara.selected && chara.name == Game.selectedUnit.name);
+ }).forEach(function (chara) {
Multiplayer.cmds.push(JSON.stringify({
- uids:[chara.id],
- type:'unit',
- name:unitType,
- duration:duration,
- evolve:'zerg'
+ uids: [chara.id],
+ type: 'unit',
+ name: unitType,
+ duration: duration,
+ evolve: 'zerg'
}));
});
});
});
//For Terran and Protoss units, add InfestedTerran
- [Terran,Protoss,{InfestedTerran:Zerg.InfestedTerran}].forEach(function(Race){
- var unitTypes=[];
- for (var unitType in Race){
+ [Terran, Protoss, { InfestedTerran: Zerg.InfestedTerran }].forEach(function (Race) {
+ var unitTypes = [];
+ for (var unitType in Race) {
unitTypes.push(unitType);
- }//Cannot use for-in bind together
- var exceptions=['Archon','DarkArchon'];
- unitTypes.forEach(function(unitType){
+ } //Cannot use for-in bind together
+ var exceptions = ['Archon', 'DarkArchon'];
+ unitTypes.forEach(function (unitType) {
//Unit type isn't in exceptions
- if (exceptions.indexOf(unitType)==-1) {
- $('button.'+unitType).on('click',function(){
+ if (exceptions.indexOf(unitType) == -1) {
+ $('button.' + unitType).on('click', function () {
//Filter out when occupied
- if (Game.selectedUnit.processing) return;
+ if (Game.selectedUnit.processing)
+ return;
//Need time
- if (Resource.getCost(unitType) && Resource.getCost(unitType).time){
- var owner=Game.selectedUnit;
- var duration=Resource.getCost(unitType).time;
+ if (Resource.getCost(unitType) && Resource.getCost(unitType).time) {
+ var owner = Game.selectedUnit;
+ var duration = Resource.getCost(unitType).time;
Multiplayer.cmds.push(JSON.stringify({
- uids:[owner.id],
- type:'unit',
- name:unitType,
- duration:duration
+ uids: [owner.id],
+ type: 'unit',
+ name: unitType,
+ duration: duration
}));
}
});
}
- //Exception units
else {
- $('button.'+unitType).on('click',function(){
+ $('button.' + unitType).on('click', function () {
//Calculate duration
- var duration=Resource.getCost(unitType).time;
- Unit.allUnits.filter(function(chara){
- return (chara.team==Game.team && chara.selected && chara.name==Game.selectedUnit.name);
- }).forEach(function(chara){
+ var duration = Resource.getCost(unitType).time;
+ Unit.allUnits.filter(function (chara) {
+ return (chara.team == Game.team && chara.selected && chara.name == Game.selectedUnit.name);
+ }).forEach(function (chara) {
//Filter out when occupied
- if (chara.processing) return;
+ if (chara.processing)
+ return;
Multiplayer.cmds.push(JSON.stringify({
- uids:[chara.id],
- type:'unit',
- name:unitType,
- duration:duration,
- evolve:'archon'
+ uids: [chara.id],
+ type: 'unit',
+ name: unitType,
+ duration: duration,
+ evolve: 'archon'
}));
});
});
}
});
});
-
//Building callbacks
- var evolvedBuildings=['Lair','Hive','SunkenColony','SporeColony','GreaterSpire',
- 'ComstatStation','NuclearSilo','MachineShop','ControlTower','PhysicsLab','ConvertOps'];
- ['ZergBuilding','TerranBuilding','ProtossBuilding'].forEach(function(BuildType){
- var Build=Building[BuildType];
- var buildNames=[];
- for (var buildName in Build){
+ var evolvedBuildings = ['Lair', 'Hive', 'SunkenColony', 'SporeColony', 'GreaterSpire',
+ 'ComstatStation', 'NuclearSilo', 'MachineShop', 'ControlTower', 'PhysicsLab', 'ConvertOps'];
+ ['ZergBuilding', 'TerranBuilding', 'ProtossBuilding'].forEach(function (BuildType) {
+ var Build = Building[BuildType];
+ var buildNames = [];
+ for (var buildName in Build) {
//Filter out noise
- if (buildName!='inherited' && buildName!='super' && buildName!='extends'){
+ if (buildName != 'inherited' && buildName != 'super' && buildName != 'extends') {
buildNames.push(buildName);
}
}
- buildNames.forEach(function(buildName){
- $('button.'+buildName).on('click',function(){
+ buildNames.forEach(function (buildName) {
+ $('button.' + buildName).on('click', function () {
//Pay by credit card if not evolved building
- if (evolvedBuildings.indexOf(buildName)==-1) {
- Game.selectedUnit.creditBill=Resource.getCost(buildName);
+ if (evolvedBuildings.indexOf(buildName) == -1) {
+ Game.selectedUnit.creditBill = Resource.getCost(buildName);
//Payment: chara paypal cost
- if (Resource.paypal.call(Game.selectedUnit,Resource.getCost(buildName))){
- Game.selectedUnit.buildName=buildName;
- Game.selectedUnit['build'+BuildType]();
+ if (Resource.paypal.call(Game.selectedUnit, Resource.getCost(buildName))) {
+ Game.selectedUnit.buildName = buildName;
+ Game.selectedUnit['build' + BuildType]();
}
}
else {
Multiplayer.cmds.push(JSON.stringify({
- uids:[Game.selectedUnit.id],
- type:'build',
- name:buildName,
- buildType:BuildType
+ uids: [Game.selectedUnit.id],
+ type: 'build',
+ name: buildName,
+ buildType: BuildType
}));
}
});
@@ -301,460 +308,463 @@ var Button={
});
}
//Bind tooltip callbacks
- $('div.panel_Control button').on('mouseover',function(event){
- var _name=this.className;
- $('div.tooltip_Box').css('right',innerWidth-event.clientX).css('bottom',innerHeight-event.clientY).show();
- $('div.tooltip_Box div.itemName')[0].innerHTML=_name;
- var cost=Resource.getCost(_name);
+ $('div.panel_Control button').on('mouseover', function (event) {
+ var _name = this.className;
+ $('div.tooltip_Box').css('right', innerWidth - event.clientX).css('bottom', innerHeight - event.clientY).show();
+ $('div.tooltip_Box div.itemName')[0].innerHTML = _name;
+ var cost = Resource.getCost(_name);
if (cost) {
$('div.cost').show();
- ['mine','gas','man','magic'].forEach(function(res){
- if(cost[res]) {
- $('div.cost *[class*='+res+']').show();
- $('div.cost span.'+res+'Num')[0].innerHTML=cost[res];
+ ['mine', 'gas', 'man', 'magic'].forEach(function (res) {
+ if (cost[res]) {
+ $('div.cost *[class*=' + res + ']').show();
+ $('div.cost span.' + res + 'Num')[0].innerHTML = cost[res];
}
- else $('div.cost *[class*='+res+']').hide();
+ else
+ $('div.cost *[class*=' + res + ']').hide();
});
}
});
- $('div.panel_Control button').on('mouseout',function(){
+ $('div.panel_Control button').on('mouseout', function () {
$('div.tooltip_Box').hide();
$('div.tooltip_Box div.cost').hide();
- $('div.tooltip_Box div.itemName')[0].innerHTML='';
- ['mine','gas','man','magic'].forEach(function(res){
- $('div.cost span.'+res+'Num')[0].innerHTML='';
+ $('div.tooltip_Box div.itemName')[0].innerHTML = '';
+ ['mine', 'gas', 'man', 'magic'].forEach(function (res) {
+ $('div.cost span.' + res + 'Num')[0].innerHTML = '';
});
});
},
- equipButtonsForReplay:function(){
- $('button[num="1"]').attr('class','Play').attr('disabled',true).show();
- $('button[num="2"]').attr('class','Pause').show();
- $('button[num="4"]').attr('class','SpeedUp').show();
- $('button[num="5"]').attr('class','SlowDown').show();
+ equipButtonsForReplay: function () {
+ $('button[num="1"]').attr('class', 'Play').attr('disabled', true).show();
+ $('button[num="2"]').attr('class', 'Pause').show();
+ $('button[num="4"]').attr('class', 'SpeedUp').show();
+ $('button[num="5"]').attr('class', 'SlowDown').show();
//Bind callback for replay buttons
- $('button.Play').on('click',Button.playHandler);
- $('button.Pause').on('click',Button.pauseHandler);
- $('button.SpeedUp').on('click',Button.speedUpHandler);
- $('button.SlowDown').on('click',Button.slowDownHandler);
+ $('button.Play').on('click', Button.playHandler);
+ $('button.Pause').on('click', Button.pauseHandler);
+ $('button.SpeedUp').on('click', Button.speedUpHandler);
+ $('button.SlowDown').on('click', Button.slowDownHandler);
//Bind tooltip callbacks
- $('div.panel_Control button').on('mouseover',function(event){
- $('div.tooltip_Box').css('right',innerWidth-event.clientX).css('bottom',innerHeight-event.clientY).show();
- $('div.tooltip_Box div.itemName')[0].innerHTML=this.className;
+ $('div.panel_Control button').on('mouseover', function (event) {
+ $('div.tooltip_Box').css('right', innerWidth - event.clientX).css('bottom', innerHeight - event.clientY).show();
+ $('div.tooltip_Box div.itemName')[0].innerHTML = this.className;
});
- $('div.panel_Control button').on('mouseout',function(){
+ $('div.panel_Control button').on('mouseout', function () {
$('div.tooltip_Box').hide();
- $('div.tooltip_Box div.itemName')[0].innerHTML='';
+ $('div.tooltip_Box div.itemName')[0].innerHTML = '';
});
},
-
/***************Buttons***************/
- basicZergMutations:{
- items:{
- '1':{name:'Hatchery'},
- '2':{name:'CreepColony',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
- })
- }},
- '3':{name:'Extractor',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
- })
- }},
- '4':{name:'SpawningPool',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
- })
- }},
- '5':{name:'EvolutionChamber',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
- })
- }},
- '7':{name:'HydraliskDen',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='SpawningPool';
- })
- }},
- '9':{name:'Cancel'}
+ basicZergMutations: {
+ items: {
+ '1': { name: 'Hatchery' },
+ '2': { name: 'CreepColony', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
+ });
+ } },
+ '3': { name: 'Extractor', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
+ });
+ } },
+ '4': { name: 'SpawningPool', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
+ });
+ } },
+ '5': { name: 'EvolutionChamber', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
+ });
+ } },
+ '7': { name: 'HydraliskDen', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'SpawningPool';
+ });
+ } },
+ '9': { name: 'Cancel' }
}
},
- advancedZergMutations:{
- items:{
- '1':{name:'Spire',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Lair' || chara.name=='Hive');
- })
- }},
- '2':{name:'QueenNest',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Lair' || chara.name=='Hive');
- })
- }},
- '3':{name:'NydusCanal',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && (chara.name=='Hive');
- })
- }},
- '4':{name:'UltraliskCavern',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Hive';
- })
- }},
- '5':{name:'DefilerMound',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Hive';
- })
- }},
- '9':{name:'Cancel'}
+ advancedZergMutations: {
+ items: {
+ '1': { name: 'Spire', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Lair' || chara.name == 'Hive');
+ });
+ } },
+ '2': { name: 'QueenNest', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Lair' || chara.name == 'Hive');
+ });
+ } },
+ '3': { name: 'NydusCanal', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && (chara.name == 'Hive');
+ });
+ } },
+ '4': { name: 'UltraliskCavern', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Hive';
+ });
+ } },
+ '5': { name: 'DefilerMound', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Hive';
+ });
+ } },
+ '9': { name: 'Cancel' }
}
},
- basicTerranBuildings:{
- items:{
- '1':{name:'CommandCenter'},
- '2':{name:'SupplyDepot',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CommandCenter';
- })
- }},
- '3':{name:'Refinery',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CommandCenter';
- })
- }},
- '4':{name:'Barracks',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CommandCenter';
- })
- }},
- '5':{name:'EngineeringBay',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CommandCenter';
- })
- }},
- '6':{name:'MissileTurret',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='EngineeringBay';
- })
- }},
- '7':{name:'Academy',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Barracks';
- })
- }},
- '8':{name:'Bunker',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Barracks';
- })
- }},
- '9':{name:'Cancel'}
+ basicTerranBuildings: {
+ items: {
+ '1': { name: 'CommandCenter' },
+ '2': { name: 'SupplyDepot', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CommandCenter';
+ });
+ } },
+ '3': { name: 'Refinery', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CommandCenter';
+ });
+ } },
+ '4': { name: 'Barracks', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CommandCenter';
+ });
+ } },
+ '5': { name: 'EngineeringBay', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CommandCenter';
+ });
+ } },
+ '6': { name: 'MissileTurret', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'EngineeringBay';
+ });
+ } },
+ '7': { name: 'Academy', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Barracks';
+ });
+ } },
+ '8': { name: 'Bunker', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Barracks';
+ });
+ } },
+ '9': { name: 'Cancel' }
}
},
- advancedTerranBuildings:{
- items:{
- '1':{name:'Factory',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Barracks';
- })
- }},
- '2':{name:'Starport',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Factory';
- })
- }},
- '3':{name:'ScienceFacility',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Starport';
- })
- }},
- '4':{name:'Armory',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Factory';
- })
- }},
- '9':{name:'Cancel'}
+ advancedTerranBuildings: {
+ items: {
+ '1': { name: 'Factory', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Barracks';
+ });
+ } },
+ '2': { name: 'Starport', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Factory';
+ });
+ } },
+ '3': { name: 'ScienceFacility', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Starport';
+ });
+ } },
+ '4': { name: 'Armory', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Factory';
+ });
+ } },
+ '9': { name: 'Cancel' }
}
},
- basicProtossStructures:{
- items:{
- '1':{name:'Nexus'},
- '2':{name:'Pylon',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Nexus';
- })
- }},
- '3':{name:'Assimilator',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Nexus';
- })
- }},
- '4':{name:'Gateway',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Nexus';
- })
- }},
- '5':{name:'Forge',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Nexus';
- })
- }},
- '6':{name:'PhotonCannon',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Forge';
- })
- }},
- '7':{name:'CyberneticsCore',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Gateway';
- })
- }},
- '8':{name:'ShieldBattery',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='Gateway';
- })
- }},
- '9':{name:'Cancel'}
+ basicProtossStructures: {
+ items: {
+ '1': { name: 'Nexus' },
+ '2': { name: 'Pylon', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Nexus';
+ });
+ } },
+ '3': { name: 'Assimilator', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Nexus';
+ });
+ } },
+ '4': { name: 'Gateway', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Nexus';
+ });
+ } },
+ '5': { name: 'Forge', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Nexus';
+ });
+ } },
+ '6': { name: 'PhotonCannon', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Forge';
+ });
+ } },
+ '7': { name: 'CyberneticsCore', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Gateway';
+ });
+ } },
+ '8': { name: 'ShieldBattery', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'Gateway';
+ });
+ } },
+ '9': { name: 'Cancel' }
}
},
- advancedProtossStructures:{
- items:{
- '1':{name:'RoboticsFacility',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CyberneticsCore';
- })
- }},
- '2':{name:'StarGate',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CyberneticsCore';
- })
- }},
- '3':{name:'CitadelOfAdun',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CyberneticsCore';
- })
- }},
- '4':{name:'RoboticsSupportBay',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='RoboticsFacility';
- })
- }},
- '5':{name:'FleetBeacon',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='StarGate';
- })
- }},
- '6':{name:'TemplarArchives',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='CitadelOfAdun';
- })
- }},
- '7':{name:'Observatory',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='RoboticsFacility';
- })
- }},
- '8':{name:'ArbiterTribunal',condition:function(){
- return Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='StarGate';
- }) && Building.allBuildings.some(function(chara){
- return chara.team==Game.team && chara.name=='TemplarArchives';
- })
- }},
- '9':{name:'Cancel'}
+ advancedProtossStructures: {
+ items: {
+ '1': { name: 'RoboticsFacility', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CyberneticsCore';
+ });
+ } },
+ '2': { name: 'StarGate', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CyberneticsCore';
+ });
+ } },
+ '3': { name: 'CitadelOfAdun', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CyberneticsCore';
+ });
+ } },
+ '4': { name: 'RoboticsSupportBay', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'RoboticsFacility';
+ });
+ } },
+ '5': { name: 'FleetBeacon', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'StarGate';
+ });
+ } },
+ '6': { name: 'TemplarArchives', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'CitadelOfAdun';
+ });
+ } },
+ '7': { name: 'Observatory', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'RoboticsFacility';
+ });
+ } },
+ '8': { name: 'ArbiterTribunal', condition: function () {
+ return Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'StarGate';
+ }) && Building.allBuildings.some(function (chara) {
+ return chara.team == Game.team && chara.name == 'TemplarArchives';
+ });
+ } },
+ '9': { name: 'Cancel' }
}
},
-
/***************Handlers***************/
//Move button
- moveHandler:function(){
- if (Button.callback==null) {
- Button.callback='move';
- $('div.GameLayer').attr('status','button');
+ moveHandler: function () {
+ if (Button.callback == null) {
+ Button.callback = 'move';
+ $('div.GameLayer').attr('status', 'button');
}
else {
//Cancel handler
$('div.GameLayer').removeAttr('status');
- Button.callback=null;
+ Button.callback = null;
}
},
//Stop button
- stopHandler:function(charas){
- if (charas==null){
- var charas=Unit.allUnits.filter(function(chara){
- return chara.selected && chara.team==Game.team;
+ stopHandler: function (charas) {
+ if (charas == null) {
+ var charas = Unit.allUnits.filter(function (chara) {
+ return chara.selected && chara.team == Game.team;
});
//Buffer pool
Multiplayer.cmds.push(JSON.stringify({
- uids:Multiplayer.getUIDs(charas),
- type:'stop'
+ uids: Multiplayer.getUIDs(charas),
+ type: 'stop'
}));
}
else {
- charas.forEach(function(chara){
- if (chara.attack) chara.stopAttack();
+ charas.forEach(function (chara) {
+ if (chara.attack)
+ chara.stopAttack();
chara.dock();
//Interrupt old destination routing
if (chara.destination) {
//Break possible dead lock
- if (chara.destination.next) chara.destination.next=undefined;
+ if (chara.destination.next)
+ chara.destination.next = undefined;
delete chara.destination;
}
});
}
},
//Attack button
- attackHandler:function(){
- if (Button.callback==null) {
- Button.callback='attack';
- $('div.GameLayer').attr('status','button');
+ attackHandler: function () {
+ if (Button.callback == null) {
+ Button.callback = 'attack';
+ $('div.GameLayer').attr('status', 'button');
}
else {
//Cancel handler
$('div.GameLayer').removeAttr('status');
- Button.callback=null;
+ Button.callback = null;
}
},
//Patrol button
- patrolHandler:function(){
- if (Button.callback==null) {
- Button.callback='patrol';
- $('div.GameLayer').attr('status','button');
+ patrolHandler: function () {
+ if (Button.callback == null) {
+ Button.callback = 'patrol';
+ $('div.GameLayer').attr('status', 'button');
}
else {
//Cancel handler
$('div.GameLayer').removeAttr('status');
- Button.callback=null;
+ Button.callback = null;
}
},
//Hold button
- holdHandler:function(charas){
+ holdHandler: function (charas) {
//Part A: Before get charas
- if (charas==null){
- var charas=Unit.allUnits.filter(function(chara){
- return chara.selected && chara.team==Game.team;
+ if (charas == null) {
+ var charas = Unit.allUnits.filter(function (chara) {
+ return chara.selected && chara.team == Game.team;
});
//Buffer pool
Multiplayer.cmds.push(JSON.stringify({
- uids:Multiplayer.getUIDs(charas),
- type:'hold'
+ uids: Multiplayer.getUIDs(charas),
+ type: 'hold'
}));
}
- //Part B: After get charas callback
else {
Button.stopHandler(charas);
//Freeze all units
- charas.forEach(function(chara){
- if (chara.hold){
+ charas.forEach(function (chara) {
+ if (chara.hold) {
delete chara.AI;
delete chara.findNearbyTargets;
delete chara.hold;
Button.refreshButtons();
}
else {
- if (chara.attack){
+ if (chara.attack) {
//Use the same AI as attackable building
- chara.AI=Building.Attackable.prototypePlus.AI;
+ chara.AI = Building.Attackable.prototypePlus.AI;
//Can only find target inside attack range instead of in sight
- chara.findNearbyTargets=Building.Attackable.prototypePlus.findNearbyTargets;
+ chara.findNearbyTargets = Building.Attackable.prototypePlus.findNearbyTargets;
}
chara.dock();
- chara.hold=true;
+ chara.hold = true;
Button.refreshButtons();
}
});
}
},
//Replay relative
- playHandler:function(){
+ playHandler: function () {
Game.startAnimation();
- $('button.Play').attr('disabled',true);
- $('button.Pause').attr('disabled',false);
+ $('button.Play').attr('disabled', true);
+ $('button.Pause').attr('disabled', false);
},
- pauseHandler:function(){
+ pauseHandler: function () {
Game.stopAnimation();
- $('button.Pause').attr('disabled',true);
- $('button.Play').attr('disabled',false);
+ $('button.Pause').attr('disabled', true);
+ $('button.Play').attr('disabled', false);
},
- speedUpHandler:function(){
- if (Game.replayFlag){
+ speedUpHandler: function () {
+ if (Game.replayFlag) {
//Can speed up
- if (Game._frameInterval>25) {
- Game._frameInterval/=2;
+ if (Game._frameInterval > 25) {
+ Game._frameInterval /= 2;
//Cannot speed up any more
- if (Game._frameInterval<=25) $('button.SpeedUp').attr('disabled',true);
+ if (Game._frameInterval <= 25)
+ $('button.SpeedUp').attr('disabled', true);
//Need play speed refresh after speed up
Game.stopAnimation();
Button.playHandler();
}
//Enable SlowDown button
- $('button.SlowDown').attr('disabled',false);
+ $('button.SlowDown').attr('disabled', false);
}
},
- slowDownHandler:function(){
- if (Game.replayFlag){
+ slowDownHandler: function () {
+ if (Game.replayFlag) {
//Can slow down
- if (Game._frameInterval<400) {
- Game._frameInterval*=2;
+ if (Game._frameInterval < 400) {
+ Game._frameInterval *= 2;
//Cannot slow down any more
- if (Game._frameInterval>=400) $('button.SlowDown').attr('disabled',true);
+ if (Game._frameInterval >= 400)
+ $('button.SlowDown').attr('disabled', true);
//Need play speed refresh after slow down
Game.stopAnimation();
Button.playHandler();
}
//Enable SpeedUp button
- $('button.SpeedUp').attr('disabled',false);
+ $('button.SpeedUp').attr('disabled', false);
}
},
//Execute callback
- execute:function(event){
+ execute: function (event) {
//Finish part II
- switch (Button.callback){
+ switch (Button.callback) {
case 'move':
mouseController.rightClick(event);
break;
case 'attack':
- mouseController.rightClick(event,true,'attack');
+ mouseController.rightClick(event, true, 'attack');
break;
case 'patrol':
- mouseController.rightClick(event,true,'patrol');
+ mouseController.rightClick(event, true, 'patrol');
break;
default:
- if (typeof(Button.callback)=='function'){
+ if (typeof (Button.callback) == 'function') {
//Mouse at (clickX,clickY)
- var offset=$('#fogCanvas').offset();
- var clickX=event.pageX-offset.left;
- var clickY=event.pageY-offset.top;
- var location={x:clickX+Map.offsetX,y:clickY+Map.offsetY};
+ var offset = $('#fogCanvas').offset();
+ var clickX = event.pageX - offset.left;
+ var clickY = event.pageY - offset.top;
+ var location = { x: clickX + Map.offsetX, y: clickY + Map.offsetY };
//Show right click cursor
new Burst.RightClickCursor(location);
//Call back with location info
//Farmer build buildings
- if (Button.callback.farmer){
+ if (Button.callback.farmer) {
Multiplayer.cmds.push(JSON.stringify({
- uids:[Button.callback.farmer.id],
- type:'build',
- name:Button.callback.farmer.buildName,
- buildType:Button.callback.buildType,
- pos:location
+ uids: [Button.callback.farmer.id],
+ type: 'build',
+ name: Button.callback.farmer.buildName,
+ buildType: Button.callback.buildType,
+ pos: location
}));
}
- //Spell magic
else {
- var magicName='';
- for (var magic in Magic){
- if (Magic[magic].spell==Button.callback) magicName=magic;
+ var magicName = '';
+ for (var magic in Magic) {
+ if (Magic[magic].spell == Button.callback)
+ magicName = magic;
}
Multiplayer.cmds.push(JSON.stringify({
- uids:[Button.callback.owner.id],
- type:'magic',
- name:magicName,
- pos:location,
- creditBill:Button.callback.owner.creditBill
+ uids: [Button.callback.owner.id],
+ type: 'magic',
+ name: magicName,
+ pos: location,
+ creditBill: Button.callback.owner.creditBill
}));
}
}
}
$('div.GameLayer').removeAttr('status');
- Button.callback=null;
+ Button.callback = null;
}
-};
\ No newline at end of file
+};
+//# sourceMappingURL=Button.js.map
\ No newline at end of file
diff --git a/Characters/Button.ts b/Characters/Button.ts
new file mode 100644
index 0000000..ddc030d
--- /dev/null
+++ b/Characters/Button.ts
@@ -0,0 +1,760 @@
+var Button={
+ callback:null,
+ /***************Functions***************/
+ reset:function(){
+ Game.changeSelectedTo(Game.selectedUnit);
+ },
+ refreshButtons:function(){
+ Button.equipButtonsFor(Game.selectedUnit);
+ },
+ //Equip all buttons for unit
+ equipButtonsFor:function(chara){
+ //Clear all buttons
+ $('div.panel_Control button').removeAttr('class').removeAttr('disabled').removeAttr('style').off('click').off('mouseover').off('mouseout').html('').hide();
+ //Filter out enemy
+ if (chara=={} || (chara.isEnemy && chara.isEnemy())) return;
+ //Add button press sound
+ $('div.panel_Control button').on('click',function(){
+ Referee.voice('button').play();
+ });
+ //Show buttons
+ if (chara instanceof Unit){
+ $('button[num="1"]').attr('class','move').show();
+ $('button[num="2"]').attr('class','stop').show();
+ $('button[num="4"]').attr('class','patrol').show();
+ $('button[num="5"]').attr('class','hold').show();
+ if (Game.selectedUnit.hold) $('button.hold').css('border-color','red');//Add for hold tag
+ //Bind callbacks
+ $('button.move').on('click',Button.moveHandler);
+ $('button.patrol').on('click',Button.patrolHandler);
+ $('button.stop').on('click',function(){
+ Button.stopHandler();
+ });
+ $('button.hold').on('click',function(){
+ Button.holdHandler();
+ });
+ }
+ if (chara.attack){
+ $('button[num="3"]').attr('class','attack').show();
+ $('button.attack').on('click',Button.attackHandler);
+ }
+ //Add items
+ if (chara.items){
+ for (var N in chara.items){
+ if (chara.items[N]!=null) {
+ $('button[num="'+N+'"]').off('click').attr('class',chara.items[N].name).show();
+ if (chara.items[N].condition && !(chara.items[N].condition()))
+ $('button[num="'+N+'"]').attr('disabled',true);
+ else $('button[num="'+N+'"]').removeAttr('disabled');
+ //Exceptions: need mark numbers on button
+ switch (chara.items[N].name){
+ case 'SpiderMines':
+ $('button[num="'+N+'"]')[0].innerHTML=chara.spiderMines;
+ break;
+ case 'Scarab':
+ $('button[num="'+N+'"]')[0].innerHTML=chara.scarabNum;
+ break;
+ case 'Interceptor':
+ $('button[num="'+N+'"]')[0].innerHTML=chara.continuousAttack.count;
+ break;
+ }
+ }
+ else {
+ $('button[num="'+N+'"]').removeAttr('class').hide();
+ }
+ }
+ //Bind basic callbacks
+ $('button.Cancel').on('click',function(){
+ //Reset menu
+ Button.refreshButtons();
+ });
+ $('button.SelectLarva').on('click',function(){
+ var larvas=Game.selectedUnit.larvas;
+ if (larvas){
+ larvas=larvas.filter(function(chara){
+ return chara.status!='dead';
+ });
+ //If found alive larva
+ if (larvas.length){
+ Game.unselectAll();
+ Game.addIntoAllSelected(larvas,true);
+ if (larvas[0] instanceof Gobj){
+ Game.changeSelectedTo(larvas[0]);
+ //Sound effect
+ larvas[0].sound.selected.play();
+ }
+ }
+ }
+ });
+ $('button.BasicMutation').on('click',function(){
+ Button.equipButtonsFor(Button.basicZergMutations);
+ });
+ $('button.AdvancedMutation').on('click',function(){
+ Button.equipButtonsFor(Button.advancedZergMutations);
+ });
+ $('button.BasicBuilding').on('click',function(){
+ Button.equipButtonsFor(Button.basicTerranBuildings);
+ });
+ $('button.AdvancedBuilding').on('click',function(){
+ Button.equipButtonsFor(Button.advancedTerranBuildings);
+ });
+ $('button.BasicStructure').on('click',function(){
+ Button.equipButtonsFor(Button.basicProtossStructures);
+ });
+ $('button.AdvancedStructure').on('click',function(){
+ Button.equipButtonsFor(Button.advancedProtossStructures);
+ });
+ //Upgrade callbacks
+ var upgrades=[];
+ for (var grade in Upgrade){
+ upgrades.push(grade);
+ }//Cannot use for-in bind together
+ upgrades.forEach(function(grade){
+ $('button.'+grade).on('click',function(){
+ //Filter out when occupied
+ if (Game.selectedUnit.processing) return;
+ //Need time
+ if (Resource.getCost(grade) && Resource.getCost(grade).time){
+ var owner=Game.selectedUnit;
+ var duration=Resource.getCost(grade).time;
+ //User move record
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[owner.id],
+ type:'upgrade',
+ name:grade,
+ duration:duration,
+ team:Game.team
+ }));
+ }
+ //Or will effect immediately
+ else {
+ Multiplayer.cmds.push(JSON.stringify({
+ team:Game.team,
+ type:'upgrade',
+ name:grade
+ }));
+ }
+ });
+ });
+ //Magic callbacks
+ var magics=[];
+ for (var magic in Magic){
+ magics.push(magic);
+ }//Cannot use for-in bind together
+ var hasMagic=function(chara,magic){
+ if (chara.items){
+ for (var attr in chara.items){
+ if (chara.items[attr] && chara.items[attr].name==magic){
+ if (chara.items[attr].condition){
+ if (chara.items[attr].condition()) return true;
+ }
+ else return true;
+ }
+ }
+ }
+ return false;
+ };
+ magics.forEach(function(magic){
+ $('button.'+magic).on('click',function(){
+ var duration=Resource.getCost(magic)?(Resource.getCost(magic).time):0;
+ Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
+ return (chara.team==Game.team && chara.selected && hasMagic(chara,magic));
+ }).forEach(function(chara){
+ //For Scarab and Interceptor
+ if (duration){
+ //Filter out when occupied
+ if (chara.processing) return;
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[chara.id],
+ type:'magic',
+ name:magic,
+ duration:duration
+ }));
+ }
+ else {
+ //Pay by credit card
+ if (Magic[magic].credit) chara.creditBill=Resource.getCost(magic);
+ //Execute magic immediately
+ if (!(Magic[magic].credit || Magic[magic].needLocation)){
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[chara.id],
+ type:'magic',
+ name:magic
+ }));
+ }
+ else {
+ //Payment: chara paypal cost
+ if (Resource.paypal.call(chara,Resource.getCost(magic))){
+ Magic[magic].spell.call(chara);
+ }
+ }
+ }
+ });
+ });
+ });
+ //Unit callbacks:
+ //For Zerg units
+ var unitTypes=[];
+ for (var unitType in Zerg){
+ unitTypes.push(unitType);
+ }
+ var exceptions=['Guardian','Devourer'];
+ unitTypes.forEach(function(unitType){
+ $('button.'+unitType).on('click',function(){
+ //Calculate duration
+ var duration=Resource.getCost(unitType).time;
+ Unit.allUnits.filter(function(chara){
+ return (chara.team==Game.team && chara.selected && chara.name==Game.selectedUnit.name);
+ }).forEach(function(chara){
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[chara.id],
+ type:'unit',
+ name:unitType,
+ duration:duration,
+ evolve:'zerg'
+ }));
+ });
+ });
+ });
+ //For Terran and Protoss units, add InfestedTerran
+ [Terran,Protoss,{InfestedTerran:Zerg.InfestedTerran}].forEach(function(Race){
+ var unitTypes=[];
+ for (var unitType in Race){
+ unitTypes.push(unitType);
+ }//Cannot use for-in bind together
+ var exceptions=['Archon','DarkArchon'];
+ unitTypes.forEach(function(unitType){
+ //Unit type isn't in exceptions
+ if (exceptions.indexOf(unitType)==-1) {
+ $('button.'+unitType).on('click',function(){
+ //Filter out when occupied
+ if (Game.selectedUnit.processing) return;
+ //Need time
+ if (Resource.getCost(unitType) && Resource.getCost(unitType).time){
+ var owner=Game.selectedUnit;
+ var duration=Resource.getCost(unitType).time;
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[owner.id],
+ type:'unit',
+ name:unitType,
+ duration:duration
+ }));
+ }
+ });
+ }
+ //Exception units
+ else {
+ $('button.'+unitType).on('click',function(){
+ //Calculate duration
+ var duration=Resource.getCost(unitType).time;
+ Unit.allUnits.filter(function(chara){
+ return (chara.team==Game.team && chara.selected && chara.name==Game.selectedUnit.name);
+ }).forEach(function(chara){
+ //Filter out when occupied
+ if (chara.processing) return;
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[chara.id],
+ type:'unit',
+ name:unitType,
+ duration:duration,
+ evolve:'archon'
+ }));
+ });
+ });
+ }
+ });
+ });
+
+ //Building callbacks
+ var evolvedBuildings=['Lair','Hive','SunkenColony','SporeColony','GreaterSpire',
+ 'ComstatStation','NuclearSilo','MachineShop','ControlTower','PhysicsLab','ConvertOps'];
+ ['ZergBuilding','TerranBuilding','ProtossBuilding'].forEach(function(BuildType){
+ var Build=Building[BuildType];
+ var buildNames=[];
+ for (var buildName in Build){
+ //Filter out noise
+ if (buildName!='inherited' && buildName!='super' && buildName!='extends'){
+ buildNames.push(buildName);
+ }
+ }
+ buildNames.forEach(function(buildName){
+ $('button.'+buildName).on('click',function(){
+ //Pay by credit card if not evolved building
+ if (evolvedBuildings.indexOf(buildName)==-1) {
+ Game.selectedUnit.creditBill=Resource.getCost(buildName);
+ //Payment: chara paypal cost
+ if (Resource.paypal.call(Game.selectedUnit,Resource.getCost(buildName))){
+ Game.selectedUnit.buildName=buildName;
+ Game.selectedUnit['build'+BuildType]();
+ }
+ }
+ else {
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[Game.selectedUnit.id],
+ type:'build',
+ name:buildName,
+ buildType:BuildType
+ }));
+ }
+ });
+ });
+ });
+ }
+ //Bind tooltip callbacks
+ $('div.panel_Control button').on('mouseover',function(event){
+ var _name=this.className;
+ $('div.tooltip_Box').css('right',innerWidth-event.clientX).css('bottom',innerHeight-event.clientY).show();
+ $('div.tooltip_Box div.itemName')[0].innerHTML=_name;
+ var cost=Resource.getCost(_name);
+ if (cost) {
+ $('div.cost').show();
+ ['mine','gas','man','magic'].forEach(function(res){
+ if(cost[res]) {
+ $('div.cost *[class*='+res+']').show();
+ $('div.cost span.'+res+'Num')[0].innerHTML=cost[res];
+ }
+ else $('div.cost *[class*='+res+']').hide();
+ });
+ }
+ });
+ $('div.panel_Control button').on('mouseout',function(){
+ $('div.tooltip_Box').hide();
+ $('div.tooltip_Box div.cost').hide();
+ $('div.tooltip_Box div.itemName')[0].innerHTML='';
+ ['mine','gas','man','magic'].forEach(function(res){
+ $('div.cost span.'+res+'Num')[0].innerHTML='';
+ });
+ });
+ },
+ equipButtonsForReplay:function(){
+ $('button[num="1"]').attr('class','Play').attr('disabled',true).show();
+ $('button[num="2"]').attr('class','Pause').show();
+ $('button[num="4"]').attr('class','SpeedUp').show();
+ $('button[num="5"]').attr('class','SlowDown').show();
+ //Bind callback for replay buttons
+ $('button.Play').on('click',Button.playHandler);
+ $('button.Pause').on('click',Button.pauseHandler);
+ $('button.SpeedUp').on('click',Button.speedUpHandler);
+ $('button.SlowDown').on('click',Button.slowDownHandler);
+ //Bind tooltip callbacks
+ $('div.panel_Control button').on('mouseover',function(event){
+ $('div.tooltip_Box').css('right',innerWidth-event.clientX).css('bottom',innerHeight-event.clientY).show();
+ $('div.tooltip_Box div.itemName')[0].innerHTML=this.className;
+ });
+ $('div.panel_Control button').on('mouseout',function(){
+ $('div.tooltip_Box').hide();
+ $('div.tooltip_Box div.itemName')[0].innerHTML='';
+ });
+ },
+
+ /***************Buttons***************/
+ basicZergMutations:{
+ items:{
+ '1':{name:'Hatchery'},
+ '2':{name:'CreepColony',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
+ })
+ }},
+ '3':{name:'Extractor',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
+ })
+ }},
+ '4':{name:'SpawningPool',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
+ })
+ }},
+ '5':{name:'EvolutionChamber',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Hatchery' || chara.name=='Lair' || chara.name=='Hive');
+ })
+ }},
+ '7':{name:'HydraliskDen',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='SpawningPool';
+ })
+ }},
+ '9':{name:'Cancel'}
+ }
+ },
+ advancedZergMutations:{
+ items:{
+ '1':{name:'Spire',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Lair' || chara.name=='Hive');
+ })
+ }},
+ '2':{name:'QueenNest',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Lair' || chara.name=='Hive');
+ })
+ }},
+ '3':{name:'NydusCanal',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && (chara.name=='Hive');
+ })
+ }},
+ '4':{name:'UltraliskCavern',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Hive';
+ })
+ }},
+ '5':{name:'DefilerMound',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Hive';
+ })
+ }},
+ '9':{name:'Cancel'}
+ }
+ },
+ basicTerranBuildings:{
+ items:{
+ '1':{name:'CommandCenter'},
+ '2':{name:'SupplyDepot',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CommandCenter';
+ })
+ }},
+ '3':{name:'Refinery',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CommandCenter';
+ })
+ }},
+ '4':{name:'Barracks',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CommandCenter';
+ })
+ }},
+ '5':{name:'EngineeringBay',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CommandCenter';
+ })
+ }},
+ '6':{name:'MissileTurret',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='EngineeringBay';
+ })
+ }},
+ '7':{name:'Academy',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Barracks';
+ })
+ }},
+ '8':{name:'Bunker',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Barracks';
+ })
+ }},
+ '9':{name:'Cancel'}
+ }
+ },
+ advancedTerranBuildings:{
+ items:{
+ '1':{name:'Factory',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Barracks';
+ })
+ }},
+ '2':{name:'Starport',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Factory';
+ })
+ }},
+ '3':{name:'ScienceFacility',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Starport';
+ })
+ }},
+ '4':{name:'Armory',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Factory';
+ })
+ }},
+ '9':{name:'Cancel'}
+ }
+ },
+ basicProtossStructures:{
+ items:{
+ '1':{name:'Nexus'},
+ '2':{name:'Pylon',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Nexus';
+ })
+ }},
+ '3':{name:'Assimilator',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Nexus';
+ })
+ }},
+ '4':{name:'Gateway',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Nexus';
+ })
+ }},
+ '5':{name:'Forge',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Nexus';
+ })
+ }},
+ '6':{name:'PhotonCannon',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Forge';
+ })
+ }},
+ '7':{name:'CyberneticsCore',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Gateway';
+ })
+ }},
+ '8':{name:'ShieldBattery',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='Gateway';
+ })
+ }},
+ '9':{name:'Cancel'}
+ }
+ },
+ advancedProtossStructures:{
+ items:{
+ '1':{name:'RoboticsFacility',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CyberneticsCore';
+ })
+ }},
+ '2':{name:'StarGate',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CyberneticsCore';
+ })
+ }},
+ '3':{name:'CitadelOfAdun',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CyberneticsCore';
+ })
+ }},
+ '4':{name:'RoboticsSupportBay',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='RoboticsFacility';
+ })
+ }},
+ '5':{name:'FleetBeacon',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='StarGate';
+ })
+ }},
+ '6':{name:'TemplarArchives',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='CitadelOfAdun';
+ })
+ }},
+ '7':{name:'Observatory',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='RoboticsFacility';
+ })
+ }},
+ '8':{name:'ArbiterTribunal',condition:function(){
+ return Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='StarGate';
+ }) && Building.allBuildings.some(function(chara){
+ return chara.team==Game.team && chara.name=='TemplarArchives';
+ })
+ }},
+ '9':{name:'Cancel'}
+ }
+ },
+
+ /***************Handlers***************/
+ //Move button
+ moveHandler:function(){
+ if (Button.callback==null) {
+ Button.callback='move';
+ $('div.GameLayer').attr('status','button');
+ }
+ else {
+ //Cancel handler
+ $('div.GameLayer').removeAttr('status');
+ Button.callback=null;
+ }
+ },
+ //Stop button
+ stopHandler:function(charas){
+ if (charas==null){
+ var charas=Unit.allUnits.filter(function(chara){
+ return chara.selected && chara.team==Game.team;
+ });
+ //Buffer pool
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:Multiplayer.getUIDs(charas),
+ type:'stop'
+ }));
+ }
+ else {
+ charas.forEach(function(chara){
+ if (chara.attack) chara.stopAttack();
+ chara.dock();
+ //Interrupt old destination routing
+ if (chara.destination) {
+ //Break possible dead lock
+ if (chara.destination.next) chara.destination.next=undefined;
+ delete chara.destination;
+ }
+ });
+ }
+ },
+ //Attack button
+ attackHandler:function(){
+ if (Button.callback==null) {
+ Button.callback='attack';
+ $('div.GameLayer').attr('status','button');
+ }
+ else {
+ //Cancel handler
+ $('div.GameLayer').removeAttr('status');
+ Button.callback=null;
+ }
+ },
+ //Patrol button
+ patrolHandler:function(){
+ if (Button.callback==null) {
+ Button.callback='patrol';
+ $('div.GameLayer').attr('status','button');
+ }
+ else {
+ //Cancel handler
+ $('div.GameLayer').removeAttr('status');
+ Button.callback=null;
+ }
+ },
+ //Hold button
+ holdHandler:function(charas){
+ //Part A: Before get charas
+ if (charas==null){
+ var charas=Unit.allUnits.filter(function(chara){
+ return chara.selected && chara.team==Game.team;
+ });
+ //Buffer pool
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:Multiplayer.getUIDs(charas),
+ type:'hold'
+ }));
+ }
+ //Part B: After get charas callback
+ else {
+ Button.stopHandler(charas);
+ //Freeze all units
+ charas.forEach(function(chara){
+ if (chara.hold){
+ delete chara.AI;
+ delete chara.findNearbyTargets;
+ delete chara.hold;
+ Button.refreshButtons();
+ }
+ else {
+ if (chara.attack){
+ //Use the same AI as attackable building
+ chara.AI=Building.Attackable.prototypePlus.AI;
+ //Can only find target inside attack range instead of in sight
+ chara.findNearbyTargets=Building.Attackable.prototypePlus.findNearbyTargets;
+ }
+ chara.dock();
+ chara.hold=true;
+ Button.refreshButtons();
+ }
+ });
+ }
+ },
+ //Replay relative
+ playHandler:function(){
+ Game.startAnimation();
+ $('button.Play').attr('disabled',true);
+ $('button.Pause').attr('disabled',false);
+ },
+ pauseHandler:function(){
+ Game.stopAnimation();
+ $('button.Pause').attr('disabled',true);
+ $('button.Play').attr('disabled',false);
+ },
+ speedUpHandler:function(){
+ if (Game.replayFlag){
+ //Can speed up
+ if (Game._frameInterval>25) {
+ Game._frameInterval/=2;
+ //Cannot speed up any more
+ if (Game._frameInterval<=25) $('button.SpeedUp').attr('disabled',true);
+ //Need play speed refresh after speed up
+ Game.stopAnimation();
+ Button.playHandler();
+ }
+ //Enable SlowDown button
+ $('button.SlowDown').attr('disabled',false);
+ }
+ },
+ slowDownHandler:function(){
+ if (Game.replayFlag){
+ //Can slow down
+ if (Game._frameInterval<400) {
+ Game._frameInterval*=2;
+ //Cannot slow down any more
+ if (Game._frameInterval>=400) $('button.SlowDown').attr('disabled',true);
+ //Need play speed refresh after slow down
+ Game.stopAnimation();
+ Button.playHandler();
+ }
+ //Enable SpeedUp button
+ $('button.SpeedUp').attr('disabled',false);
+ }
+ },
+ //Execute callback
+ execute:function(event){
+ //Finish part II
+ switch (Button.callback){
+ case 'move':
+ mouseController.rightClick(event);
+ break;
+ case 'attack':
+ mouseController.rightClick(event,true,'attack');
+ break;
+ case 'patrol':
+ mouseController.rightClick(event,true,'patrol');
+ break;
+ default:
+ if (typeof(Button.callback)=='function'){
+ //Mouse at (clickX,clickY)
+ var offset=$('#fogCanvas').offset();
+ var clickX=event.pageX-offset.left;
+ var clickY=event.pageY-offset.top;
+ var location={x:clickX+Map.offsetX,y:clickY+Map.offsetY};
+ //Show right click cursor
+ new Burst.RightClickCursor(location);
+ //Call back with location info
+ //Farmer build buildings
+ if (Button.callback.farmer){
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[Button.callback.farmer.id],
+ type:'build',
+ name:Button.callback.farmer.buildName,
+ buildType:Button.callback.buildType,
+ pos:location
+ }));
+ }
+ //Spell magic
+ else {
+ var magicName='';
+ for (var magic in Magic){
+ if (Magic[magic].spell==Button.callback) magicName=magic;
+ }
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:[Button.callback.owner.id],
+ type:'magic',
+ name:magicName,
+ pos:location,
+ creditBill:Button.callback.owner.creditBill
+ }));
+ }
+ }
+ }
+ $('div.GameLayer').removeAttr('status');
+ Button.callback=null;
+ }
+};
\ No newline at end of file
diff --git a/Characters/Gobj.js b/Characters/Gobj.js
index a257951..af797be 100644
--- a/Characters/Gobj.js
+++ b/Characters/Gobj.js
@@ -1,264 +1,284 @@
//Gobj is original object used in StarCraft
-var Gobj=function(props){
- this.x=props.x;
- this.y=props.y;
- if (props.target instanceof Gobj){
- this.x=(props.target.posX()-this.width/2)>>0;
- this.y=(props.target.posY()-this.height/2)>>0;
+var Gobj = function (props) {
+ this.x = props.x;
+ this.y = props.y;
+ if (props.target instanceof Gobj) {
+ this.x = (props.target.posX() - this.width / 2) >> 0;
+ this.y = (props.target.posY() - this.height / 2) >> 0;
}
- this.action=0;//Only for moving
- this.status="";
- this.buffer={};//Buffer names
- this.override={};//Buffer effects
- this.bufferObjs=[];
- this.allFrames={};
- this.team=props.team?props.team:0;//team 0 by default
+ this.action = 0; //Only for moving
+ this.status = "";
+ this.buffer = {}; //Buffer names
+ this.override = {}; //Buffer effects
+ this.bufferObjs = [];
+ this.allFrames = {};
+ this.team = props.team ? props.team : 0; //team 0 by default
};
-
//Default value used if not initialize properly
-Gobj.prototype.name="Gobj";
-Gobj.prototype.width=0;
-Gobj.prototype.height=0;
-Gobj.prototype.isEnemy=function(){
- return this.team!=Game.team;
+Gobj.prototype.name = "Gobj";
+Gobj.prototype.width = 0;
+Gobj.prototype.height = 0;
+Gobj.prototype.isEnemy = function () {
+ return this.team != Game.team;
};
-Gobj.prototype.posX=function(){
- return this.x+this.width/2;
+Gobj.prototype.posX = function () {
+ return this.x + this.width / 2;
};
-Gobj.prototype.posY=function(){
- return this.y+this.height/2;
+Gobj.prototype.posY = function () {
+ return this.y + this.height / 2;
};
-Gobj.prototype.imgPos={
- moving:{
- left:[0,0,0,0,0,0,0,0],
- top:[0,0,0,0,0,0,0,0]
+Gobj.prototype.imgPos = {
+ moving: {
+ left: [0, 0, 0, 0, 0, 0, 0, 0],
+ top: [0, 0, 0, 0, 0, 0, 0, 0]
}
};
//Only for moving
-Gobj.prototype.frame={
- moving:1
+Gobj.prototype.frame = {
+ moving: 1
};
//Better only for moving
-Gobj.prototype.speed={x:0,y:0};
-
+Gobj.prototype.speed = { x: 0, y: 0 };
//Basic behaviors
-Gobj.prototype.detectOutOfBound=function(){
+Gobj.prototype.detectOutOfBound = function () {
//Do nothing here
};
//Only for moving
-Gobj.prototype.updateLocation=function(){
+Gobj.prototype.updateLocation = function () {
//Override here
};
-Gobj.prototype.animeFrame=function(){
+Gobj.prototype.animeFrame = function () {
//Animation play
this.action++;
- if (this.action>=this.frame[this.status]) {
- this.action=0;
+ if (this.action >= this.frame[this.status]) {
+ this.action = 0;
}
};
-Gobj.prototype.moving=function(){
+Gobj.prototype.moving = function () {
//Clear old timer
this.stop();
//Launch new moving timer
- this.status="moving";
- var myself=this;
- var movingFrame=function(){
+ this.status = "moving";
+ var myself = this;
+ var movingFrame = function () {
myself.animeFrame();
//Relocate character
myself.updateLocation();
//Detect OutOfBound
myself.detectOutOfBound();
};
- this.allFrames['moving']=movingFrame;
- var animateFrame=function(){
+ this.allFrames['moving'] = movingFrame;
+ var animateFrame = function () {
//Only play animation, will not move
myself.animeFrame();
};
- this.allFrames['animate']=animateFrame;
+ this.allFrames['animate'] = animateFrame;
};
-Gobj.prototype.stop=function(){
+Gobj.prototype.stop = function () {
//Clear both kinds of timer
delete this.allFrames['moving'];
delete this.allFrames['dock'];
delete this.allFrames['animate'];
};
-Gobj.prototype.playFrames=function(){
- var frames=this.allFrames;
- for (var type in frames){
+Gobj.prototype.playFrames = function () {
+ var frames = this.allFrames;
+ for (var type in frames) {
frames[type]();
}
};
-Gobj.prototype.die=function(){
+Gobj.prototype.die = function () {
//Clear old timer
this.stop();
- this.status="dead";
- this.action=0;
+ this.status = "dead";
+ this.action = 0;
//If has die animation
if (this.dieEffect) {
- new this.dieEffect({x:this.posX(),y:this.posY()});
+ new this.dieEffect({ x: this.posX(), y: this.posY() });
}
};
-Gobj.prototype.include=function(obj){
- return (obj.posY()>this.y)&&(obj.posY()this.x)&&(obj.posX() this.y) && (obj.posY() < this.y + this.height) && (obj.posX() > this.x) && (obj.posX() < this.x + this.width);
};
-Gobj.prototype.includePoint=function(x,y){
- return (y>this.y)&&(ythis.x)&&(x this.y) && (y < this.y + this.height) && (x > this.x) && (x < this.x + this.width);
};
//rect={centerX:?,centerY:?,radius:?} or {centerX:?,centerY:?,radius:[?,?]}
-Gobj.prototype.insideSquare=function(rect){
+Gobj.prototype.insideSquare = function (rect) {
if (rect.radius instanceof Array)
- return Math.abs(rect.centerX-this.posX())rect.start.x) && (this.posX()rect.start.y) && (this.posY() rect.start.x) && (this.posX() < rect.end.x) &&
+ (this.posY() > rect.start.y) && (this.posY() < rect.end.y);
};
//circle={centerX:?,centerY:?,radius:?}
-Gobj.prototype.insideCircle=function(circle){
- return Math.pow(circle.centerX-this.posX(),2)+Math.pow(circle.centerY-this.posY(),2)Map.offsetX) && (this.x<(Map.offsetX+Game.HBOUND))
- && ((this.y+this.height)>Map.offsetY) && (this.y<(Map.offsetY+Game.VBOUND));
+Gobj.prototype.insideScreen = function () {
+ return ((this.x + this.width) > Map.offsetX) && (this.x < (Map.offsetX + Game.HBOUND))
+ && ((this.y + this.height) > Map.offsetY) && (this.y < (Map.offsetY + Game.VBOUND));
};
-Gobj.prototype.sightInsideScreen=function(){
- return ((this.x+this.width)>(Map.offsetX-this.get('sight'))) && (this.x<(Map.offsetX+Game.HBOUND+this.get('sight')))
- && ((this.y+this.height)>(Map.offsetY-this.get('sight'))) && (this.y<(Map.offsetY+Game.VBOUND+this.get('sight')));
+Gobj.prototype.sightInsideScreen = function () {
+ return ((this.x + this.width) > (Map.offsetX - this.get('sight'))) && (this.x < (Map.offsetX + Game.HBOUND + this.get('sight')))
+ && ((this.y + this.height) > (Map.offsetY - this.get('sight'))) && (this.y < (Map.offsetY + Game.VBOUND + this.get('sight')));
};
-Gobj.prototype.softCollideWith=function(chara,N){
- if (N==null) N=1;
+Gobj.prototype.softCollideWith = function (chara, N) {
+ if (N == null)
+ N = 1;
//Twice radius of hard collision
- return chara.insideSquare({centerX:this.posX(),centerY:this.posY(),radius:[this.width*N,this.height*N]});
+ return chara.insideSquare({ centerX: this.posX(), centerY: this.posY(), radius: [this.width * N, this.height * N] });
};
-Gobj.prototype.collideWith=function(chara){
+Gobj.prototype.collideWith = function (chara) {
//Bounding box: right-left-down-up
- return !((this.x>(chara.x+chara.width)) || (chara.x>(this.x+this.width))
- || (this.y>(chara.y+chara.height)) || (chara.y>(this.y+this.height)));
+ return !((this.x > (chara.x + chara.width)) || (chara.x > (this.x + this.width))
+ || (this.y > (chara.y + chara.height)) || (chara.y > (this.y + this.height)));
};
-Gobj.prototype.isIdle=function(){
- return this.status=="dock";
+Gobj.prototype.isIdle = function () {
+ return this.status == "dock";
};
-Gobj.prototype.canSee=function(enemy){
- return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('sight')});
+Gobj.prototype.canSee = function (enemy) {
+ return enemy.inside({ centerX: this.posX(), centerY: this.posY(), radius: this.get('sight') });
};
-Gobj.prototype.get=function(prop){
+Gobj.prototype.get = function (prop) {
//Currently only support upgrade for unit properties, no buildings
- var result=eval('this.'+prop);//Can get A.B.C
+ var result = eval('this.' + prop); //Can get A.B.C
//ShareFlag is symbol for team sharing array, not speed matrix array
- if (result instanceof Array) return result[this.team];
- else return result;
+ if (result instanceof Array)
+ return result[this.team];
+ else
+ return result;
};
-Gobj.prototype.addBuffer=function(bufferObj,onAll){
- for (var prop in bufferObj){
+Gobj.prototype.addBuffer = function (bufferObj, onAll) {
+ for (var prop in bufferObj) {
//Register in override if not exist
- if (!this.override[prop]) this.override[prop]=[];
- var buffer=bufferObj[prop];
+ if (!this.override[prop])
+ this.override[prop] = [];
+ var buffer = bufferObj[prop];
//Add buffer into override list
this.override[prop].unshift(buffer);
//Override unit property by time sequence if has
- if (this[prop]!=null || prop.indexOf('isInvisible')!=-1 || onAll) this[prop]=buffer;
+ if (this[prop] != null || prop.indexOf('isInvisible') != -1 || onAll)
+ this[prop] = buffer;
}
this.bufferObjs.push(bufferObj);
//Refresh
- if (this==Game.selectedUnit) Game.refreshInfo();
+ if (this == Game.selectedUnit)
+ Game.refreshInfo();
};
-Gobj.prototype.removeBuffer=function(bufferObj){
- var bufferObjIndex=this.bufferObjs.indexOf(bufferObj);
+Gobj.prototype.removeBuffer = function (bufferObj) {
+ var bufferObjIndex = this.bufferObjs.indexOf(bufferObj);
//Buffer obj still exist, prevent remove twice
- if (bufferObjIndex!=-1){
- for (var prop in bufferObj){
- var buffer=bufferObj[prop];
- var overrideList=this.override[prop];
+ if (bufferObjIndex != -1) {
+ for (var prop in bufferObj) {
+ var buffer = bufferObj[prop];
+ var overrideList = this.override[prop];
//Remove buffer from override list
- var index=overrideList.indexOf(buffer);
- if (index!=-1) overrideList.splice(index,1);
+ var index = overrideList.indexOf(buffer);
+ if (index != -1)
+ overrideList.splice(index, 1);
//Have other buffer, apply it by time sequence
- if (overrideList.length>0) this[prop]=overrideList[0];
- else delete this[prop];
+ if (overrideList.length > 0)
+ this[prop] = overrideList[0];
+ else
+ delete this[prop];
}
//Remove from bufferObjs
- this.bufferObjs.splice(bufferObjIndex,1);
+ this.bufferObjs.splice(bufferObjIndex, 1);
//Refresh
- if (this==Game.selectedUnit) Game.refreshInfo();
+ if (this == Game.selectedUnit)
+ Game.refreshInfo();
//Remove successfully
return true;
}
- //Remove failure
- else return false;
+ else
+ return false;
};
-Gobj.prototype.cannotMove=function(){
+Gobj.prototype.cannotMove = function () {
return (this instanceof Building) || Boolean(this.burrowBuffer);
};
-Gobj.prototype.evolveTo=function(props){
+Gobj.prototype.evolveTo = function (props) {
//Init
- var charaType=props.type,burstArr=props.burstArr,mixin=props.mixin,rallyPoint=props.rallyPoint;
- var newTypeChara=null,selectedStatus=[this.selected,(this==Game.selectedUnit)],team=this.team;
+ var charaType = props.type, burstArr = props.burstArr, mixin = props.mixin, rallyPoint = props.rallyPoint;
+ var newTypeChara = null, selectedStatus = [this.selected, (this == Game.selectedUnit)], team = this.team;
//Hide die burst and sound for old unit, then die
- this.dieEffect=this.sound.death=null;
+ this.dieEffect = this.sound.death = null;
this.die();
- if (this.processing && !props.chain) delete this.processing;
+ if (this.processing && !props.chain)
+ delete this.processing;
//Birth function
- var bornAt=function(chara){
- var prop={target:chara,team:team};
- if (mixin) _$.mixin(prop,mixin);
- newTypeChara=new charaType(prop);
- if (rallyPoint) newTypeChara.destination=rallyPoint;
+ var bornAt = function (chara) {
+ var prop = { target: chara, team: team };
+ if (mixin)
+ _$.mixin(prop, mixin);
+ newTypeChara = new charaType(prop);
+ if (rallyPoint)
+ newTypeChara.destination = rallyPoint;
//Fix cannot select egg issue
- Game.commandTimeout(function(){
- if (selectedStatus[0]) Game.addIntoAllSelected(newTypeChara);
- if (selectedStatus[1]) Game.changeSelectedTo(newTypeChara);
- },0);
+ Game.commandTimeout(function () {
+ if (selectedStatus[0])
+ Game.addIntoAllSelected(newTypeChara);
+ if (selectedStatus[1])
+ Game.changeSelectedTo(newTypeChara);
+ }, 0);
};
//Burst chain
- if (burstArr){
- var pos={x:this.posX(),y:this.posY()};
- var birth=new Burst[burstArr[0]](pos);
- var evolveChain=function(N){
- return function(){
- birth=new Burst[burstArr[N]](pos);
- if ((N+1)1) birth.callback=evolveChain(1);
- //Finish evolve chain
- else birth.callback=function(){
- var times=charaType.prototype.birthCount;
- if (times==null) times=1;
- for (var N=0;N 1)
+ birth.callback = evolveChain(1);
+ else
+ birth.callback = function () {
+ var times = charaType.prototype.birthCount;
+ if (times == null)
+ times = 1;
+ for (var N = 0; N < times; N++) {
+ bornAt(birth);
+ }
+ };
}
- else bornAt(this);
+ else
+ bornAt(this);
return newTypeChara;
};
//This buffer makes invisible units visible
-Gobj.detectorBuffer=[];
\ No newline at end of file
+Gobj.detectorBuffer = [];
+//# sourceMappingURL=Gobj.js.map
\ No newline at end of file
diff --git a/Characters/Gobj.ts b/Characters/Gobj.ts
new file mode 100644
index 0000000..a257951
--- /dev/null
+++ b/Characters/Gobj.ts
@@ -0,0 +1,264 @@
+//Gobj is original object used in StarCraft
+var Gobj=function(props){
+ this.x=props.x;
+ this.y=props.y;
+ if (props.target instanceof Gobj){
+ this.x=(props.target.posX()-this.width/2)>>0;
+ this.y=(props.target.posY()-this.height/2)>>0;
+ }
+ this.action=0;//Only for moving
+ this.status="";
+ this.buffer={};//Buffer names
+ this.override={};//Buffer effects
+ this.bufferObjs=[];
+ this.allFrames={};
+ this.team=props.team?props.team:0;//team 0 by default
+};
+
+//Default value used if not initialize properly
+Gobj.prototype.name="Gobj";
+Gobj.prototype.width=0;
+Gobj.prototype.height=0;
+Gobj.prototype.isEnemy=function(){
+ return this.team!=Game.team;
+};
+Gobj.prototype.posX=function(){
+ return this.x+this.width/2;
+};
+Gobj.prototype.posY=function(){
+ return this.y+this.height/2;
+};
+Gobj.prototype.imgPos={
+ moving:{
+ left:[0,0,0,0,0,0,0,0],
+ top:[0,0,0,0,0,0,0,0]
+ }
+};
+//Only for moving
+Gobj.prototype.frame={
+ moving:1
+};
+//Better only for moving
+Gobj.prototype.speed={x:0,y:0};
+
+//Basic behaviors
+Gobj.prototype.detectOutOfBound=function(){
+ //Do nothing here
+};
+//Only for moving
+Gobj.prototype.updateLocation=function(){
+ //Override here
+};
+Gobj.prototype.animeFrame=function(){
+ //Animation play
+ this.action++;
+ if (this.action>=this.frame[this.status]) {
+ this.action=0;
+ }
+};
+Gobj.prototype.moving=function(){
+ //Clear old timer
+ this.stop();
+ //Launch new moving timer
+ this.status="moving";
+ var myself=this;
+ var movingFrame=function(){
+ myself.animeFrame();
+ //Relocate character
+ myself.updateLocation();
+ //Detect OutOfBound
+ myself.detectOutOfBound();
+ };
+ this.allFrames['moving']=movingFrame;
+ var animateFrame=function(){
+ //Only play animation, will not move
+ myself.animeFrame();
+ };
+ this.allFrames['animate']=animateFrame;
+};
+Gobj.prototype.stop=function(){
+ //Clear both kinds of timer
+ delete this.allFrames['moving'];
+ delete this.allFrames['dock'];
+ delete this.allFrames['animate'];
+};
+Gobj.prototype.playFrames=function(){
+ var frames=this.allFrames;
+ for (var type in frames){
+ frames[type]();
+ }
+};
+Gobj.prototype.die=function(){
+ //Clear old timer
+ this.stop();
+ this.status="dead";
+ this.action=0;
+ //If has die animation
+ if (this.dieEffect) {
+ new this.dieEffect({x:this.posX(),y:this.posY()});
+ }
+};
+Gobj.prototype.include=function(obj){
+ return (obj.posY()>this.y)&&(obj.posY()this.x)&&(obj.posX()this.y)&&(ythis.x)&&(xrect.start.x) && (this.posX()rect.start.y) && (this.posY()Map.offsetX) && (this.x<(Map.offsetX+Game.HBOUND))
+ && ((this.y+this.height)>Map.offsetY) && (this.y<(Map.offsetY+Game.VBOUND));
+};
+Gobj.prototype.sightInsideScreen=function(){
+ return ((this.x+this.width)>(Map.offsetX-this.get('sight'))) && (this.x<(Map.offsetX+Game.HBOUND+this.get('sight')))
+ && ((this.y+this.height)>(Map.offsetY-this.get('sight'))) && (this.y<(Map.offsetY+Game.VBOUND+this.get('sight')));
+};
+Gobj.prototype.softCollideWith=function(chara,N){
+ if (N==null) N=1;
+ //Twice radius of hard collision
+ return chara.insideSquare({centerX:this.posX(),centerY:this.posY(),radius:[this.width*N,this.height*N]});
+};
+Gobj.prototype.collideWith=function(chara){
+ //Bounding box: right-left-down-up
+ return !((this.x>(chara.x+chara.width)) || (chara.x>(this.x+this.width))
+ || (this.y>(chara.y+chara.height)) || (chara.y>(this.y+this.height)));
+};
+Gobj.prototype.isIdle=function(){
+ return this.status=="dock";
+};
+Gobj.prototype.canSee=function(enemy){
+ return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('sight')});
+};
+Gobj.prototype.get=function(prop){
+ //Currently only support upgrade for unit properties, no buildings
+ var result=eval('this.'+prop);//Can get A.B.C
+ //ShareFlag is symbol for team sharing array, not speed matrix array
+ if (result instanceof Array) return result[this.team];
+ else return result;
+};
+Gobj.prototype.addBuffer=function(bufferObj,onAll){
+ for (var prop in bufferObj){
+ //Register in override if not exist
+ if (!this.override[prop]) this.override[prop]=[];
+ var buffer=bufferObj[prop];
+ //Add buffer into override list
+ this.override[prop].unshift(buffer);
+ //Override unit property by time sequence if has
+ if (this[prop]!=null || prop.indexOf('isInvisible')!=-1 || onAll) this[prop]=buffer;
+ }
+ this.bufferObjs.push(bufferObj);
+ //Refresh
+ if (this==Game.selectedUnit) Game.refreshInfo();
+};
+Gobj.prototype.removeBuffer=function(bufferObj){
+ var bufferObjIndex=this.bufferObjs.indexOf(bufferObj);
+ //Buffer obj still exist, prevent remove twice
+ if (bufferObjIndex!=-1){
+ for (var prop in bufferObj){
+ var buffer=bufferObj[prop];
+ var overrideList=this.override[prop];
+ //Remove buffer from override list
+ var index=overrideList.indexOf(buffer);
+ if (index!=-1) overrideList.splice(index,1);
+ //Have other buffer, apply it by time sequence
+ if (overrideList.length>0) this[prop]=overrideList[0];
+ else delete this[prop];
+ }
+ //Remove from bufferObjs
+ this.bufferObjs.splice(bufferObjIndex,1);
+ //Refresh
+ if (this==Game.selectedUnit) Game.refreshInfo();
+ //Remove successfully
+ return true;
+ }
+ //Remove failure
+ else return false;
+};
+Gobj.prototype.cannotMove=function(){
+ return (this instanceof Building) || Boolean(this.burrowBuffer);
+};
+Gobj.prototype.evolveTo=function(props){
+ //Init
+ var charaType=props.type,burstArr=props.burstArr,mixin=props.mixin,rallyPoint=props.rallyPoint;
+ var newTypeChara=null,selectedStatus=[this.selected,(this==Game.selectedUnit)],team=this.team;
+ //Hide die burst and sound for old unit, then die
+ this.dieEffect=this.sound.death=null;
+ this.die();
+ if (this.processing && !props.chain) delete this.processing;
+ //Birth function
+ var bornAt=function(chara){
+ var prop={target:chara,team:team};
+ if (mixin) _$.mixin(prop,mixin);
+ newTypeChara=new charaType(prop);
+ if (rallyPoint) newTypeChara.destination=rallyPoint;
+ //Fix cannot select egg issue
+ Game.commandTimeout(function(){
+ if (selectedStatus[0]) Game.addIntoAllSelected(newTypeChara);
+ if (selectedStatus[1]) Game.changeSelectedTo(newTypeChara);
+ },0);
+ };
+ //Burst chain
+ if (burstArr){
+ var pos={x:this.posX(),y:this.posY()};
+ var birth=new Burst[burstArr[0]](pos);
+ var evolveChain=function(N){
+ return function(){
+ birth=new Burst[burstArr[N]](pos);
+ if ((N+1)1) birth.callback=evolveChain(1);
+ //Finish evolve chain
+ else birth.callback=function(){
+ var times=charaType.prototype.birthCount;
+ if (times==null) times=1;
+ for (var N=0;Nthis.get('MP')) this.magic=this.get('MP');
+ dieEffect: Burst.BigExplode,
+ isFlying: true,
+ unitType: Unit.BIG,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: function () {
+ if (this.magic < this.get('MP')) {
+ this.magic += 3;
+ if (this.magic > this.get('MP'))
+ this.magic = this.get('MP');
}
},
- items:{
- '6':{name:'Yamato'},
- '7':{name:'DefensiveMatrix'},
- '8':{name:'EMPShockwave'},
- '9':{name:'Irradiate'}
+ items: {
+ '6': { name: 'Yamato' },
+ '7': { name: 'DefensiveMatrix' },
+ '8': { name: 'EMPShockwave' },
+ '9': { name: 'Irradiate' }
},
- cost:{
- man:8
+ cost: {
+ man: 8
},
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Zerg.Devourer.prototype.dock.call(this);
}
}
});
-Hero.Tassadar=Unit.extends({
- constructorPlus:function(props){
+Hero.Tassadar = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
- this.frame.dock=this.frame.moving;
+ this.imgPos.dock = this.imgPos.moving;
+ this.frame.dock = this.frame.moving;
//Override
- this.magic=this.get('MP');
+ this.magic = this.get('MP');
},
prototypePlus: {
//Add basic unit info
name: "Tassadar",
imgPos: {
moving: {
- left: [0,95,190,285,380,475,570,665,0,95,190,285,380,475,570,665],
- top: [90,90,90,90,90,90,90,90,0,0,0,0,0,0,0,0]
+ left: [0, 95, 190, 285, 380, 475, 570, 665, 0, 95, 190, 285, 380, 475, 570, 665],
+ top: [90, 90, 90, 90, 90, 90, 90, 90, 0, 0, 0, 0, 0, 0, 0, 0]
}
},
- width: 95,//95N
+ width: 95,
height: 90,
frame: {
moving: 1,
stop: 1
},
//Only for moving status, override
- speed:15,
+ speed: 15,
HP: 999,
SP: 999,
- armor:3,
+ armor: 3,
MP: 999,
- sight:385,
+ sight: 385,
detector: Gobj.detectorBuffer,
- dieEffect:Burst.BigBlueExplode,
- isFlying:true,
- unitType:Unit.BIG,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:function(){
- if (this.lifethis.get('HP')) this.life=this.get('HP');
+ dieEffect: Burst.BigBlueExplode,
+ isFlying: true,
+ unitType: Unit.BIG,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: function () {
+ if (this.life < this.get('HP')) {
+ this.life += 3;
+ if (this.life > this.get('HP'))
+ this.life = this.get('HP');
}
- if (this.shieldthis.get('SP')) this.shield=this.get('SP');
+ if (this.shield < this.get('SP')) {
+ this.shield += 3;
+ if (this.shield > this.get('SP'))
+ this.shield = this.get('SP');
}
- if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ if (this.magic < this.get('MP')) {
+ this.magic += 3;
+ if (this.magic > this.get('MP'))
+ this.magic = this.get('MP');
}
},
- items:{
- '2':{name:'Ensnare'},
- '3':{name:'Plague'},
- '4':{name:'Lockdown'},
- '5':{name:'EMPShockwave'},
- '6':{name:'Irradiate'},
- '7':{name:'PsionicStorm'},
- '8':{name:'MaelStorm'},
- '9':{name:'StasisField'}
+ items: {
+ '2': { name: 'Ensnare' },
+ '3': { name: 'Plague' },
+ '4': { name: 'Lockdown' },
+ '5': { name: 'EMPShockwave' },
+ '6': { name: 'Irradiate' },
+ '7': { name: 'PsionicStorm' },
+ '8': { name: 'MaelStorm' },
+ '9': { name: 'StasisField' }
},
- cost:{
- man:8
+ cost: {
+ man: 8
},
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Zerg.Devourer.prototype.dock.call(this);
}
}
});
-Hero.Kerrigan=AttackableUnit.extends({
- constructorPlus:function(props){
+Hero.Kerrigan = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Override
- this.magic=this.get('MP');
+ this.magic = this.get('MP');
},
prototypePlus: {
//Add basic unit info
@@ -138,99 +142,100 @@ Hero.Kerrigan=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [0,0,0,0,0,0,0,0,0],[36,36,36,36,36,36,36,36,36],
- [73,73,73,73,73,73,73,73,73],[109,109,109,109,109,109,109,109,109],
- [146,146,146,146,146,146,146,146,146],[182,182,182,182,182,182,182,182,182],
- [219,219,219,219,219,219,219,219,219],[255,255,255,255,255,255,255,255,255],
- [292,292,292,292,292,292,292,292,292],[365,365,365,365,365,365,365,365,365],
- [401,401,401,401,401,401,401,401,401],[438,438,438,438,438,438,438,438,438],
- [474,474,474,474,474,474,474,474,474],[511,511,511,511,511,511,511,511,511],
- [547,547,547,547,547,547,547,547,547],[584,584,584,584,584,584,584,584,584]
+ [0, 0, 0, 0, 0, 0, 0, 0, 0], [36, 36, 36, 36, 36, 36, 36, 36, 36],
+ [73, 73, 73, 73, 73, 73, 73, 73, 73], [109, 109, 109, 109, 109, 109, 109, 109, 109],
+ [146, 146, 146, 146, 146, 146, 146, 146, 146], [182, 182, 182, 182, 182, 182, 182, 182, 182],
+ [219, 219, 219, 219, 219, 219, 219, 219, 219], [255, 255, 255, 255, 255, 255, 255, 255, 255],
+ [292, 292, 292, 292, 292, 292, 292, 292, 292], [365, 365, 365, 365, 365, 365, 365, 365, 365],
+ [401, 401, 401, 401, 401, 401, 401, 401, 401], [438, 438, 438, 438, 438, 438, 438, 438, 438],
+ [474, 474, 474, 474, 474, 474, 474, 474, 474], [511, 511, 511, 511, 511, 511, 511, 511, 511],
+ [547, 547, 547, 547, 547, 547, 547, 547, 547], [584, 584, 584, 584, 584, 584, 584, 584, 584]
],
top: [
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
- [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344]
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
+ [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344]
]
},
attack: {
left: [
- [0,0,0,0],[36,36,36,36],
- [73,73,73,73],[109,109,109,109],
- [146,146,146,146],[182,182,182,182],
- [219,219,219,219],[255,255,255,255],
- [292,292,292,292],[365,365,365,365],
- [401,401,401,401],[438,438,438,438],
- [474,474,474,474],[511,511,511,511],
- [547,547,547,547],[584,584,584,584]
+ [0, 0, 0, 0], [36, 36, 36, 36],
+ [73, 73, 73, 73], [109, 109, 109, 109],
+ [146, 146, 146, 146], [182, 182, 182, 182],
+ [219, 219, 219, 219], [255, 255, 255, 255],
+ [292, 292, 292, 292], [365, 365, 365, 365],
+ [401, 401, 401, 401], [438, 438, 438, 438],
+ [474, 474, 474, 474], [511, 511, 511, 511],
+ [547, 547, 547, 547], [584, 584, 584, 584]
],
top: [
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516],
- [387,430,473,516],[387,430,473,516]
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516],
+ [387, 430, 473, 516], [387, 430, 473, 516]
]
},
dock: {
- left: [0,36,73,109,146,182,219,255,292,365,401,438,474,511,547,584],
- top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ left: [0, 36, 73, 109, 146, 182, 219, 255, 292, 365, 401, 438, 474, 511, 547, 584],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
},
- width: 36,//36.5N>>0
- height: 43,//43N
+ width: 36,
+ height: 43,
frame: {
moving: 9,
dock: 1,
- attack:4
+ attack: 4
},
//Only for moving status, override
- speed:10,
+ speed: 10,
HP: 300,
damage: 20,
- armor:1,
+ armor: 1,
MP: 300,
- sight:315,
+ sight: 315,
attackRange: 210,
attackInterval: 2200,
- dieEffect:Burst.HumanDeath,
- attackEffect:Burst.FireSpark,
- isFlying:false,
- unitType:Unit.SMALL,
- attackType:AttackableUnit.WAVE_ATTACK,
- recover:function(){
- if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ dieEffect: Burst.HumanDeath,
+ attackEffect: Burst.FireSpark,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.WAVE_ATTACK,
+ recover: function () {
+ if (this.magic < this.get('MP')) {
+ this.magic += 2;
+ if (this.magic > this.get('MP'))
+ this.magic = this.get('MP');
}
},
- cost:{
- man:1
+ cost: {
+ man: 1
},
- items:{
- '6':{name:'StimPacks'},
- '7':{name:'Cloak'},
- '8':{name:'Lockdown'}
+ items: {
+ '6': { name: 'StimPacks' },
+ '7': { name: 'Cloak' },
+ '8': { name: 'Lockdown' }
},
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
-Hero.Sarah=AttackableUnit.extends({
- constructorPlus:function(props){
+Hero.Sarah = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Override
- this.magic=this.get('MP');
+ this.magic = this.get('MP');
},
prototypePlus: {
//Add basic unit info
@@ -238,110 +243,113 @@ Hero.Sarah=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
- [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
- [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
- [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
- [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
- [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
- [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
- [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
+ [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
+ [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
+ [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
+ [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
+ [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
+ [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
+ [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
],
top: [
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406]
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406]
]
},
attack: {
left: [
- [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
- [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
- [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
- [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
- [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
- [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
- [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
- [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
+ [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
+ [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
+ [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
+ [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
+ [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
+ [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
+ [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
],
top: [
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870]
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870]
]
},
dock: {
- left: [0,62,124,186,248,310,372,434,496,620,682,744,806,868,930,992],
- top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ left: [0, 62, 124, 186, 248, 310, 372, 434, 496, 620, 682, 744, 806, 868, 930, 992],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
},
- width: 62,//(N-1)
- height: 58,//(N-1)
+ width: 62,
+ height: 58,
frame: {
moving: 8,
dock: 1,
attack: 8
},
//Only for moving status, override
- speed:10,
+ speed: 10,
HP: 500,
SP: 500,
damage: 40,
- armor:2,
- plasma:0,
+ armor: 2,
+ plasma: 0,
MP: 500,
- sight:315,
+ sight: 315,
attackRange: 70,
attackInterval: 2000,
- dieEffect:Burst.HumanDeath,
- attackEffect:Burst.FireSpark,
- isFlying:false,
- unitType:Unit.SMALL,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:function(){
- if (this.lifethis.get('HP')) this.life=this.get('HP');
+ dieEffect: Burst.HumanDeath,
+ attackEffect: Burst.FireSpark,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: function () {
+ if (this.life < this.get('HP')) {
+ this.life += 3;
+ if (this.life > this.get('HP'))
+ this.life = this.get('HP');
}
- if (this.shieldthis.get('SP')) this.shield=this.get('SP');
+ if (this.shield < this.get('SP')) {
+ this.shield += 3;
+ if (this.shield > this.get('SP'))
+ this.shield = this.get('SP');
}
- if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ if (this.magic < this.get('MP')) {
+ this.magic += 3;
+ if (this.magic > this.get('MP'))
+ this.magic = this.get('MP');
}
},
- cost:{
- man:2
+ cost: {
+ man: 2
},
- items:{
- '6':{name:'Cloak'},
- '7':{name:'PsionicStorm'},
- '8':{name:'Plague'},
- '9':{name:'Ensnare'}
+ items: {
+ '6': { name: 'Cloak' },
+ '7': { name: 'PsionicStorm' },
+ '8': { name: 'Plague' },
+ '9': { name: 'Ensnare' }
},
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
-Hero.DevilHunter=AttackableUnit.extends({
- constructorPlus:function(props){
+Hero.DevilHunter = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Override
- this.magic=this.get('MP');
+ this.magic = this.get('MP');
},
prototypePlus: {
//Add basic unit info
@@ -349,99 +357,103 @@ Hero.DevilHunter=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
- [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
- [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
- [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
- [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
- [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
- [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
- [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
+ [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
+ [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
+ [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
+ [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
+ [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
+ [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
+ [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
],
top: [
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
- [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406]
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
+ [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406]
]
},
attack: {
left: [
- [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
- [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
- [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
- [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
- [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
- [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
- [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
- [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
+ [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
+ [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
+ [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
+ [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
+ [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
+ [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
+ [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
],
top: [
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
- [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870]
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
+ [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870]
]
},
dock: {
- left: [0,62,124,186,248,310,372,434,496,620,682,744,806,868,930,992],
- top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ left: [0, 62, 124, 186, 248, 310, 372, 434, 496, 620, 682, 744, 806, 868, 930, 992],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
},
- width: 62,//(N-1)
- height: 58,//(N-1)
+ width: 62,
+ height: 58,
frame: {
moving: 8,
dock: 1,
attack: 8
},
//Only for moving status, override
- speed:10,
+ speed: 10,
HP: 2000,
SP: 2000,
MP: 200,
damage: 30,
- armor:0,
- plasma:0,
- sight:315,
- detector:Gobj.detectorBuffer,
+ armor: 0,
+ plasma: 0,
+ sight: 315,
+ detector: Gobj.detectorBuffer,
attackRange: 210,
attackInterval: 1500,
- fireDelay:600,
- dieEffect:Burst.SmallZergFlyingDeath,
- isFlying:false,
- unitType:Unit.SMALL,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:function(){
- if (this.lifethis.get('HP')) this.life=this.get('HP');
+ fireDelay: 600,
+ dieEffect: Burst.SmallZergFlyingDeath,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: function () {
+ if (this.life < this.get('HP')) {
+ this.life += 5;
+ if (this.life > this.get('HP'))
+ this.life = this.get('HP');
}
- if (this.shieldthis.get('SP')) this.shield=this.get('SP');
+ if (this.shield < this.get('SP')) {
+ this.shield += 5;
+ if (this.shield > this.get('SP'))
+ this.shield = this.get('SP');
}
- if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ if (this.magic < this.get('MP')) {
+ this.magic += 5;
+ if (this.magic > this.get('MP'))
+ this.magic = this.get('MP');
}
},
- cost:{
- man:8
+ cost: {
+ man: 8
},
- upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields'],
+ upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
+//# sourceMappingURL=Hero.js.map
\ No newline at end of file
diff --git a/Characters/Hero.ts b/Characters/Hero.ts
new file mode 100644
index 0000000..a719970
--- /dev/null
+++ b/Characters/Hero.ts
@@ -0,0 +1,447 @@
+/******* Define Hero units *******/
+var Hero={};
+Hero.HeroCruiser=AttackableUnit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ this.frame.dock=this.frame.moving;
+ //Override
+ this.magic=this.get('MP');
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "HeroCruiser",
+ imgPos: {
+ moving: {
+ left: [10,130,250,370,490,610,730,850,10,130,250,370,490,610,730,850],
+ top: [10,10,10,10,10,10,10,10,130,130,130,130,130,130,130,130]
+ }
+ },
+ width: 100,//120N+10
+ height: 100,
+ frame: {
+ moving: 1,
+ stop: 1
+ },
+ //Only for moving status, override
+ speed:9,
+ HP: 1000,
+ damage: 50,
+ armor:3,
+ MP: 500,
+ sight:385,
+ attackRange: 250,
+ attackInterval: 3000,
+ dieEffect:Burst.BigExplode,
+ isFlying:true,
+ unitType:Unit.BIG,
+ attackType:AttackableUnit.NORMAL_ATTACK,
+ recover:function(){
+ if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ }
+ },
+ items:{
+ '6':{name:'Yamato'},
+ '7':{name:'DefensiveMatrix'},
+ '8':{name:'EMPShockwave'},
+ '9':{name:'Irradiate'}
+ },
+ cost:{
+ man:8
+ },
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Zerg.Devourer.prototype.dock.call(this);
+ }
+ }
+});
+Hero.Tassadar=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ this.frame.dock=this.frame.moving;
+ //Override
+ this.magic=this.get('MP');
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Tassadar",
+ imgPos: {
+ moving: {
+ left: [0,95,190,285,380,475,570,665,0,95,190,285,380,475,570,665],
+ top: [90,90,90,90,90,90,90,90,0,0,0,0,0,0,0,0]
+ }
+ },
+ width: 95,//95N
+ height: 90,
+ frame: {
+ moving: 1,
+ stop: 1
+ },
+ //Only for moving status, override
+ speed:15,
+ HP: 999,
+ SP: 999,
+ armor:3,
+ MP: 999,
+ sight:385,
+ detector: Gobj.detectorBuffer,
+ dieEffect:Burst.BigBlueExplode,
+ isFlying:true,
+ unitType:Unit.BIG,
+ attackType:AttackableUnit.NORMAL_ATTACK,
+ recover:function(){
+ if (this.lifethis.get('HP')) this.life=this.get('HP');
+ }
+ if (this.shieldthis.get('SP')) this.shield=this.get('SP');
+ }
+ if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ }
+ },
+ items:{
+ '2':{name:'Ensnare'},
+ '3':{name:'Plague'},
+ '4':{name:'Lockdown'},
+ '5':{name:'EMPShockwave'},
+ '6':{name:'Irradiate'},
+ '7':{name:'PsionicStorm'},
+ '8':{name:'MaelStorm'},
+ '9':{name:'StasisField'}
+ },
+ cost:{
+ man:8
+ },
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Zerg.Devourer.prototype.dock.call(this);
+ }
+ }
+});
+Hero.Kerrigan=AttackableUnit.extends({
+ constructorPlus:function(props){
+ //Override
+ this.magic=this.get('MP');
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Kerrigan",
+ imgPos: {
+ moving: {
+ left: [
+ [0,0,0,0,0,0,0,0,0],[36,36,36,36,36,36,36,36,36],
+ [73,73,73,73,73,73,73,73,73],[109,109,109,109,109,109,109,109,109],
+ [146,146,146,146,146,146,146,146,146],[182,182,182,182,182,182,182,182,182],
+ [219,219,219,219,219,219,219,219,219],[255,255,255,255,255,255,255,255,255],
+ [292,292,292,292,292,292,292,292,292],[365,365,365,365,365,365,365,365,365],
+ [401,401,401,401,401,401,401,401,401],[438,438,438,438,438,438,438,438,438],
+ [474,474,474,474,474,474,474,474,474],[511,511,511,511,511,511,511,511,511],
+ [547,547,547,547,547,547,547,547,547],[584,584,584,584,584,584,584,584,584]
+ ],
+ top: [
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344],
+ [0,43,86,129,172,215,258,301,344],[0,43,86,129,172,215,258,301,344]
+ ]
+ },
+ attack: {
+ left: [
+ [0,0,0,0],[36,36,36,36],
+ [73,73,73,73],[109,109,109,109],
+ [146,146,146,146],[182,182,182,182],
+ [219,219,219,219],[255,255,255,255],
+ [292,292,292,292],[365,365,365,365],
+ [401,401,401,401],[438,438,438,438],
+ [474,474,474,474],[511,511,511,511],
+ [547,547,547,547],[584,584,584,584]
+ ],
+ top: [
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516],
+ [387,430,473,516],[387,430,473,516]
+ ]
+ },
+ dock: {
+ left: [0,36,73,109,146,182,219,255,292,365,401,438,474,511,547,584],
+ top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ }
+ },
+ width: 36,//36.5N>>0
+ height: 43,//43N
+ frame: {
+ moving: 9,
+ dock: 1,
+ attack:4
+ },
+ //Only for moving status, override
+ speed:10,
+ HP: 300,
+ damage: 20,
+ armor:1,
+ MP: 300,
+ sight:315,
+ attackRange: 210,
+ attackInterval: 2200,
+ dieEffect:Burst.HumanDeath,
+ attackEffect:Burst.FireSpark,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ attackType:AttackableUnit.WAVE_ATTACK,
+ recover:function(){
+ if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ }
+ },
+ cost:{
+ man:1
+ },
+ items:{
+ '6':{name:'StimPacks'},
+ '7':{name:'Cloak'},
+ '8':{name:'Lockdown'}
+ },
+ //Override
+ dock:function(){
+ //Use the same behavior
+ AttackableUnit.turnAround.call(this);
+ }
+ }
+});
+Hero.Sarah=AttackableUnit.extends({
+ constructorPlus:function(props){
+ //Override
+ this.magic=this.get('MP');
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Sarah",
+ imgPos: {
+ moving: {
+ left: [
+ [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
+ [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
+ [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
+ [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
+ [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
+ [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
+ [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
+ [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ ],
+ top: [
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406]
+ ]
+ },
+ attack: {
+ left: [
+ [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
+ [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
+ [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
+ [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
+ [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
+ [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
+ [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
+ [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ ],
+ top: [
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870]
+ ]
+ },
+ dock: {
+ left: [0,62,124,186,248,310,372,434,496,620,682,744,806,868,930,992],
+ top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ }
+ },
+ width: 62,//(N-1)
+ height: 58,//(N-1)
+ frame: {
+ moving: 8,
+ dock: 1,
+ attack: 8
+ },
+ //Only for moving status, override
+ speed:10,
+ HP: 500,
+ SP: 500,
+ damage: 40,
+ armor:2,
+ plasma:0,
+ MP: 500,
+ sight:315,
+ attackRange: 70,
+ attackInterval: 2000,
+ dieEffect:Burst.HumanDeath,
+ attackEffect:Burst.FireSpark,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ attackType:AttackableUnit.NORMAL_ATTACK,
+ recover:function(){
+ if (this.lifethis.get('HP')) this.life=this.get('HP');
+ }
+ if (this.shieldthis.get('SP')) this.shield=this.get('SP');
+ }
+ if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ }
+ },
+ cost:{
+ man:2
+ },
+ items:{
+ '6':{name:'Cloak'},
+ '7':{name:'PsionicStorm'},
+ '8':{name:'Plague'},
+ '9':{name:'Ensnare'}
+ },
+ //Override
+ dock:function(){
+ //Use the same behavior
+ AttackableUnit.turnAround.call(this);
+ }
+ }
+});
+Hero.DevilHunter=AttackableUnit.extends({
+ constructorPlus:function(props){
+ //Override
+ this.magic=this.get('MP');
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "DevilHunter",
+ imgPos: {
+ moving: {
+ left: [
+ [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
+ [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
+ [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
+ [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
+ [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
+ [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
+ [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
+ [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ ],
+ top: [
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406],
+ [0,58,116,174,232,290,348,406],[0,58,116,174,232,290,348,406]
+ ]
+ },
+ attack: {
+ left: [
+ [0,0,0,0,0,0,0,0],[62,62,62,62,62,62,62,62],
+ [124,124,124,124,124,124,124,124],[186,186,186,186,186,186,186,186],
+ [248,248,248,248,248,248,248,248],[310,310,310,310,310,310,310,310],
+ [372,372,372,372,372,372,372,372],[434,434,434,434,434,434,434,434],
+ [496,496,496,496,496,496,496,496],[620,620,620,620,620,620,620,620],
+ [682,682,682,682,682,682,682,682],[744,744,744,744,744,744,744,744],
+ [806,806,806,806,806,806,806,806],[868,868,868,868,868,868,868,868],
+ [930,930,930,930,930,930,930,930],[992,992,992,992,992,992,992,992]
+ ],
+ top: [
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870],
+ [464,522,580,638,696,754,812,870],[464,522,580,638,696,754,812,870]
+ ]
+ },
+ dock: {
+ left: [0,62,124,186,248,310,372,434,496,620,682,744,806,868,930,992],
+ top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ }
+ },
+ width: 62,//(N-1)
+ height: 58,//(N-1)
+ frame: {
+ moving: 8,
+ dock: 1,
+ attack: 8
+ },
+ //Only for moving status, override
+ speed:10,
+ HP: 2000,
+ SP: 2000,
+ MP: 200,
+ damage: 30,
+ armor:0,
+ plasma:0,
+ sight:315,
+ detector:Gobj.detectorBuffer,
+ attackRange: 210,
+ attackInterval: 1500,
+ fireDelay:600,
+ dieEffect:Burst.SmallZergFlyingDeath,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ attackType:AttackableUnit.NORMAL_ATTACK,
+ recover:function(){
+ if (this.lifethis.get('HP')) this.life=this.get('HP');
+ }
+ if (this.shieldthis.get('SP')) this.shield=this.get('SP');
+ }
+ if (this.magicthis.get('MP')) this.magic=this.get('MP');
+ }
+ },
+ cost:{
+ man:8
+ },
+ upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields'],
+ //Override
+ dock:function(){
+ //Use the same behavior
+ AttackableUnit.turnAround.call(this);
+ }
+ }
+});
diff --git a/Characters/Magic.js b/Characters/Magic.js
index b406fd3..2d68b31 100644
--- a/Characters/Magic.js
+++ b/Characters/Magic.js
@@ -1,144 +1,157 @@
-var Magic={
+var Magic = {
//Zerg
- Burrow:{
- name:"Burrow",
- enabled:false,
- spell:function(){
+ Burrow: {
+ name: "Burrow",
+ enabled: false,
+ spell: function () {
this.dock();
- if (this.stopAttack) this.stopAttack();
- this.status="burrow";
- this.action=2;
- var myself=this;
+ if (this.stopAttack)
+ this.stopAttack();
+ this.status = "burrow";
+ this.action = 2;
+ var myself = this;
//Effect:Freeze target
- var bufferObj={
- moveTo:function(){},
- moveToward:function(){},
- dock:function(){},
- items:{'1':undefined,'2':undefined,'3':undefined,'4':undefined,'5':undefined,
- '6':undefined,'7':undefined,'8':undefined,'9':{name:'Unburrow'}}
+ var bufferObj = {
+ moveTo: function () { },
+ moveToward: function () { },
+ dock: function () { },
+ items: { '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined,
+ '6': undefined, '7': undefined, '8': undefined, '9': { name: 'Unburrow' } }
};
- if (this.attack) bufferObj.attack=function(){};
+ if (this.attack)
+ bufferObj.attack = function () { };
//Lurker has same behavior as attackable building
- if (this.name=="Lurker") {
- var mixin=$.extend({},Building.Attackable.prototypePlus);
+ if (this.name == "Lurker") {
+ var mixin = $.extend({}, Building.Attackable.prototypePlus);
delete mixin.name;
- mixin.die=AttackableUnit.prototype.die;//Override
- $.extend(bufferObj,mixin);
- delete bufferObj.items[3];//Enable attack icon
+ mixin.die = AttackableUnit.prototype.die; //Override
+ $.extend(bufferObj, mixin);
+ delete bufferObj.items[3]; //Enable attack icon
}
//Freeze immediately
- this.addBuffer(bufferObj,(this.name=="Lurker"));//onAll for Lurker
- this.burrowBuffer=[bufferObj];
+ this.addBuffer(bufferObj, (this.name == "Lurker")); //onAll for Lurker
+ this.burrowBuffer = [bufferObj];
//Sound effect
- if (this.insideScreen()) this.sound.burrow.play();
+ if (this.insideScreen())
+ this.sound.burrow.play();
//Forbid actions when burrowing
- var itemsBackup=this.items;
- this.items={'1':undefined,'2':undefined,'3':undefined,'4':undefined,'5':undefined,
- '6':undefined,'7':undefined,'8':undefined,'9':undefined};
- if (Game.selectedUnit==this) Button.refreshButtons();
+ var itemsBackup = this.items;
+ this.items = { '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined,
+ '6': undefined, '7': undefined, '8': undefined, '9': undefined };
+ if (Game.selectedUnit == this)
+ Button.refreshButtons();
//Finish burrow
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
//Invisible when finish burrow
- var bufferObjII={};
- for (var N=0;N>0,62*1.2>>0],myself.team.toString(),true);
+ var targets = Game.getInRangeOnes(location.x, location.y, [76 * 1.2 >> 0, 62 * 1.2 >> 0], myself.team.toString(), true);
//Slow moving speed
- var bufferObj={
- speed:2
+ var bufferObj = {
+ speed: 2
};
//Effect
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
//Buffer flag
- if (chara.buffer.Ensnare) return;//Not again
- chara.buffer.Ensnare=true;
+ if (chara.buffer.Ensnare)
+ return; //Not again
+ chara.buffer.Ensnare = true;
chara.addBuffer(bufferObj);
//Green effect
- new Animation.GreenEffect({team:myself.team,target:chara,callback:function(){
- if (chara.status!='dead' && chara.buffer.Ensnare){
- //Restore
- if (chara.removeBuffer(bufferObj)) delete chara.buffer.Ensnare;
- }
- }});
+ new Animation.GreenEffect({ team: myself.team, target: chara, callback: function () {
+ if (chara.status != 'dead' && chara.buffer.Ensnare) {
+ //Restore
+ if (chara.removeBuffer(bufferObj))
+ delete chara.buffer.Ensnare;
+ }
+ } });
});
});
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Consume:{
- name:"Consume",
- enabled:false,
- needLocation:true,
- spell:function(location){
+ Consume: {
+ name: "Consume",
+ enabled: false,
+ needLocation: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Kill our unit ground
- var target=Game.getSelectedOne(location.x,location.y,this.team,true,false);
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ var target = Game.getSelectedOne(location.x, location.y, this.team, true, false);
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to consume
- this.moveToward(target,70,function(){
+ this.moveToward(target, 70, function () {
//Effect
- var anime=new Animation.Consume({target:target,callback:function(){
- //Consume sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Consume.wav').play();
- //Consume animation missing
- target.die();
- myself.magic+=50;
- if (myself.magic>myself.get('MP')) myself.magic=myself.get('MP');
- }});
+ var anime = new Animation.Consume({ target: target, callback: function () {
+ //Consume sound
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Consume.wav').play();
+ //Consume animation missing
+ target.die();
+ myself.magic += 50;
+ if (myself.magic > myself.get('MP'))
+ myself.magic = myself.get('MP');
+ } });
});
}
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- DarkSwarm:{
- name:"DarkSwarm",
- cost:{magic:100},
- credit:true,
- _timer:false,
- enabled:true,
- spell:function(location){
+ DarkSwarm: {
+ name: "DarkSwarm",
+ cost: { magic: 100 },
+ credit: true,
+ _timer: false,
+ enabled: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire DarkSwarm
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//DarkSwarm animation, play hidden frames at first
- new Animation.DarkSwarm({x:location.x,y:location.y}).action=6;
+ new Animation.DarkSwarm({ x: location.x, y: location.y }).action = 6;
//Dynamic update targets every 1 second
- var targets=[];
+ var targets = [];
//Full guard from distance
- var bufferObj={
+ var bufferObj = {
//Full guard from distance
- calculateDamageBy:function(enemyObj,percent){
- if (enemyObj.meleeAttack){
- var enemyAttackType=enemyObj.attackType;
- if (!enemyAttackType && enemyObj.attackMode){
- enemyAttackType=(this.isFlying)?enemyObj.attackMode.flying.attackType:enemyObj.attackMode.ground.attackType;
+ calculateDamageBy: function (enemyObj, percent) {
+ if (enemyObj.meleeAttack) {
+ var enemyAttackType = enemyObj.attackType;
+ if (!enemyAttackType && enemyObj.attackMode) {
+ enemyAttackType = (this.isFlying) ? enemyObj.attackMode.flying.attackType : enemyObj.attackMode.ground.attackType;
}
- return enemyObj.get('damage')*Unit.attackMatrix[enemyAttackType][this.unitType];
+ return enemyObj.get('damage') * Unit.attackMatrix[enemyAttackType][this.unitType];
}
- //Full guard
- else return 0;
+ else
+ return 0;
}
};
//Dark swarm wave
- var darkSwarm=function(){
+ var darkSwarm = function () {
//Clear old units buffer
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
chara.removeBuffer(bufferObj);
});
- targets=[];
- var darkSwarms=Burst.allEffects.filter(function(effect){
+ targets = [];
+ var darkSwarms = Burst.allEffects.filter(function (effect) {
return effect instanceof Animation.DarkSwarm;
});
//Check if any swarm effect exist
if (darkSwarms.length) {
//Get targets inside all of swarms
- darkSwarms.forEach(function(swarm){
+ darkSwarms.forEach(function (swarm) {
//Update buffer on our ground units inside swarm
- targets=targets.concat(Game.getInRangeOnes(swarm.posX(),swarm.posY(),[126*1.2>>0,94*1.2>>0],null,true,false));
+ targets = targets.concat(Game.getInRangeOnes(swarm.posX(), swarm.posY(), [126 * 1.2 >> 0, 94 * 1.2 >> 0], null, true, false));
});
$.unique(targets);
//Effect
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
//Guard from range-attack enemy
chara.addBuffer(bufferObj);
});
- Game.commandTimeout(darkSwarm,1000);
- Magic.DarkSwarm._timer=true;
+ Game.commandTimeout(darkSwarm, 1000);
+ Magic.DarkSwarm._timer = true;
}
- else Magic.DarkSwarm._timer=false;
+ else
+ Magic.DarkSwarm._timer = false;
};
//If not calculating, execute
- if (!Magic.DarkSwarm._timer) darkSwarm();
+ if (!Magic.DarkSwarm._timer)
+ darkSwarm();
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Plague:{
- name:"Plague",
- cost:{magic:150},
- credit:true,
- enabled:false,
- spell:function(location){
+ Plague: {
+ name: "Plague",
+ cost: { magic: 150 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire Plague
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//Plague animation and sound
- var anime=new Animation.Plague({x:location.x,y:location.y});
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Ensnare.wav').play();
+ var anime = new Animation.Plague({ x: location.x, y: location.y });
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Ensnare.wav').play();
//Get in range enemy units
- var targets=Game.getInRangeOnes(location.x,location.y,[64*1.2>>0,64*1.2>>0],myself.team.toString(),true);
+ var targets = Game.getInRangeOnes(location.x, location.y, [64 * 1.2 >> 0, 64 * 1.2 >> 0], myself.team.toString(), true);
//Effect:HP losing every seconds
- var bufferObj={
- recover:function(){
- if (this.life>0) this.life-=25;//Refresh every 1 seconds
- if (this.life<=0) this.life=1;
+ var bufferObj = {
+ recover: function () {
+ if (this.life > 0)
+ this.life -= 25; //Refresh every 1 seconds
+ if (this.life <= 0)
+ this.life = 1;
}
};
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
//Buffer flag
- if (chara.buffer.Plague) return;//Not again
- chara.buffer.Plague=true;
+ if (chara.buffer.Plague)
+ return; //Not again
+ chara.buffer.Plague = true;
//HP losing every seconds
chara.addBuffer(bufferObj);
//Green effect
- new Animation.RedEffect({team:myself.team,target:chara,callback:function(){
- if (chara.status!='dead' && chara.buffer.Plague){
- //Restore
- if (chara.removeBuffer(bufferObj)) delete chara.buffer.Plague;
- }
- }});
+ new Animation.RedEffect({ team: myself.team, target: chara, callback: function () {
+ if (chara.status != 'dead' && chara.buffer.Plague) {
+ //Restore
+ if (chara.removeBuffer(bufferObj))
+ delete chara.buffer.Plague;
+ }
+ } });
});
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
//Terran
- StimPacks:{
- name:"StimPacks",
- enabled:false,
- spell:function(){
+ StimPacks: {
+ name: "StimPacks",
+ enabled: false,
+ spell: function () {
//Rage flag for units to decide stim or not
if (!this.buffer.Stim) {
//Cause damage
- this.life-=10;
- if (this.life<1) this.life=1;
+ this.life -= 10;
+ if (this.life < 1)
+ this.life = 1;
//Stim sound
- if (this.insideScreen()) new Audio(Game.CDN+'bgm/Magic.StimPacks.wav').play();
+ if (this.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.StimPacks.wav').play();
//Effect
- var bufferObj={
- attackInterval:800,
- speed:14
+ var bufferObj = {
+ attackInterval: 800,
+ speed: 14
};
this.addBuffer(bufferObj);
- this.buffer.Stim=true;
+ this.buffer.Stim = true;
//Will only be stim for 15sec
- var myself=this;
- Game.commandTimeout(function(){
- if (myself.status!='dead' && myself.buffer.Stim){
+ var myself = this;
+ Game.commandTimeout(function () {
+ if (myself.status != 'dead' && myself.buffer.Stim) {
//Special effect is over
- if (myself.removeBuffer(bufferObj)) delete myself.buffer.Stim;
+ if (myself.removeBuffer(bufferObj))
+ delete myself.buffer.Stim;
}
- },15000);
+ }, 15000);
}
}
},
- PersonalCloak:{
- name:"PersonalCloak",
- cost:{magic:25},
- enabled:false,
- spell:function(){
+ PersonalCloak: {
+ name: "PersonalCloak",
+ cost: { magic: 25 },
+ enabled: false,
+ spell: function () {
//Will only be invisible when having magic
if (!this.cloakBuffer) {
- var bufferObj={
+ var bufferObj = {
//Magic losing every seconds
- recover:function(){
+ recover: function () {
//Should not forbid old recover
this.constructor.prototype.recover.call(this);
//Losing magic
- if (this.magic>0 && !Cheat.gathering) this.magic--;
- if (this.magic<=0) {
+ if (this.magic > 0 && !Cheat.gathering)
+ this.magic--;
+ if (this.magic <= 0) {
//Might be negative float
- this.magic=0;
+ this.magic = 0;
//Special effect is over
if (this.removeBuffer(bufferObj)) {
delete this.buffer.Cloak;
delete this.cloakBuffer;
//Recover icons and apply callbacks
delete this.items;
- if (Game.selectedUnit==this) Button.reset();
+ if (Game.selectedUnit == this)
+ Button.reset();
}
}
}
};
- for (var N=0;N0 && myself.team==Game.team) {
+ if (Magic.NuclearStrike.enabled > 0 && myself.team == Game.team) {
Magic.NuclearStrike.enabled--;
- if (Game.selectedUnit==myself) Button.refreshButtons();
+ if (Game.selectedUnit == myself)
+ Button.refreshButtons();
}
});
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Heal:{
- name:"Heal",
- cost:{magic:1},
- credit:true,
- enabled:true,
- spell:function(location){
+ Heal: {
+ name: "Heal",
+ cost: { magic: 1 },
+ credit: true,
+ enabled: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
- var myself=this;
+ if (location) {
+ var myself = this;
//Heal our units on ground, animal unit
- var target=Game.getSelectedOne(location.x,location.y,this.team,true,false,function(chara){
+ var target = Game.getSelectedOne(location.x, location.y, this.team, true, false, function (chara) {
return !(chara.isMachine());
});
- if (target instanceof Gobj){
- this.targetLock=true;
+ if (target instanceof Gobj) {
+ this.targetLock = true;
//Move toward target to heal him
- this.moveToward(target,target.radius()+10,function(){
+ this.moveToward(target, target.radius() + 10, function () {
//Consume magic to heal injured target
- if (myself.magic && target.lifetarget.get('HP')) target.life=target.get('HP');
+ target.life += 10;
+ if (target.life > target.get('HP'))
+ target.life = target.get('HP');
myself.magic--;
//Heal action and sound
- if (myself.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Heal.wav').play();
+ if (myself.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Heal.wav').play();
}
//# Need heal target automatically until it becomes healthy
});
}
- delete this.creditBill;//else
+ delete this.creditBill; //else
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Restoration:{
- name:"Restoration",
- cost:{magic:50},
- credit:true,
- enabled:false,
- spell:function(location){
+ Restoration: {
+ name: "Restoration",
+ cost: { magic: 50 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Restore all units
- var target=Game.getSelectedOne(location.x,location.y,null,true);
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ var target = Game.getSelectedOne(location.x, location.y, null, true);
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to restore unit
- this.moveToward(target,140,function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, 140, function () {
+ if (Resource.payCreditBill.call(myself)) {
//Restore effect
- var anime=new Animation.Restoration({target:target});
+ var anime = new Animation.Restoration({ target: target });
//Restore sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Restoration.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Restoration.wav').play();
//Remove all bufferObjs
- $.extend([],target.bufferObjs).forEach(function(bufferObj){
+ $.extend([], target.bufferObjs).forEach(function (bufferObj) {
target.removeBuffer(bufferObj);
});
//Remove remaining buffer
- if (target.cloakBuffer) delete target.cloakBuffer;
- if (target.purpleBuffer) delete target.purpleBuffer;
+ if (target.cloakBuffer)
+ delete target.cloakBuffer;
+ if (target.purpleBuffer)
+ delete target.purpleBuffer;
//Delete all buffer animations on target
- var bufferAnimations=['StasisField','Lockdown','Plague','Ensnare','PurpleEffect','RedEffect','GreenEffect','DefensiveMatrix','MaelStorm','Irradiate'];
- $.extend([],Burst.allEffects).forEach(function(effect){
- if (effect.target==target && bufferAnimations.some(function(name){return (effect instanceof Animation[name]);}))
- Burst.allEffects.splice(Burst.allEffects.indexOf(effect),1);
+ var bufferAnimations = ['StasisField', 'Lockdown', 'Plague', 'Ensnare', 'PurpleEffect', 'RedEffect', 'GreenEffect', 'DefensiveMatrix', 'MaelStorm', 'Irradiate'];
+ $.extend([], Burst.allEffects).forEach(function (effect) {
+ if (effect.target == target && bufferAnimations.some(function (name) { return (effect instanceof Animation[name]); }))
+ Burst.allEffects.splice(Burst.allEffects.indexOf(effect), 1);
});
//Delete all buffers, some cannot delete
- if (target.buffer.Hallucination) target.buffer={Hallucination:true};
- else target.buffer={};
+ if (target.buffer.Hallucination)
+ target.buffer = { Hallucination: true };
+ else
+ target.buffer = {};
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- OpticalFlare:{
- name:"OpticalFlare",
- cost:{magic:75},
- credit:true,
- enabled:false,
- spell:function(location){
+ OpticalFlare: {
+ name: "OpticalFlare",
+ cost: { magic: 75 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Shoot enemy unit
- var target=Game.getSelectedOne(location.x,location.y,this.team.toString(),true);
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true);
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to fire optical flare
- this.moveToward(target,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//Fire optical flare
- var bullet=new Bullets.VultureBall({
- from:myself,
- to:target,
- damage:0
+ var bullet = new Bullets.VultureBall({
+ from: myself,
+ to: target,
+ damage: 0
});
- bullet.fire(function(){
+ bullet.fire(function () {
//Effect
- var bufferObj={
- sight:target.radius()
+ var bufferObj = {
+ sight: target.radius()
};
- if (target.status!='dead') target.addBuffer(bufferObj);
+ if (target.status != 'dead')
+ target.addBuffer(bufferObj);
//Buffer flag
- target.buffer.Blind=true;
+ target.buffer.Blind = true;
});
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- SpiderMines:{
- name:"SpiderMines",
- enabled:false,
- spell:function(location){}
+ SpiderMines: {
+ name: "SpiderMines",
+ enabled: false,
+ spell: function (location) { }
},
- SeigeMode:{
- name:"SeigeMode",
- enabled:false,
- spell:function(){}
+ SeigeMode: {
+ name: "SeigeMode",
+ enabled: false,
+ spell: function () { }
},
- Cloak:{
- name:"Cloak",
- cost:{magic:25},
- enabled:false,
- spell:function(){
+ Cloak: {
+ name: "Cloak",
+ cost: { magic: 25 },
+ enabled: false,
+ spell: function () {
Magic.PersonalCloak.spell.call(this);
}
},
- DefensiveMatrix:{
- name:"DefensiveMatrix",
- cost:{magic:100},
- credit:true,
- enabled:true,
- spell:function(location){
+ DefensiveMatrix: {
+ name: "DefensiveMatrix",
+ cost: { magic: 100 },
+ credit: true,
+ enabled: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Restore our units
- var target=Game.getSelectedOne(location.x,location.y,this.team,true,null,function(chara){
- return !chara.buffer.DefensiveMatrix;//Not again
+ var target = Game.getSelectedOne(location.x, location.y, this.team, true, null, function (chara) {
+ return !chara.buffer.DefensiveMatrix; //Not again
});
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to activate defensive matrix
- this.moveToward(target,250,function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, 250, function () {
+ if (Resource.payCreditBill.call(myself)) {
//Defensive matrix animation
- var anime=new Animation.DefensiveMatrix({target:target,callback:function(){
- //Restore after 60 seconds, if no restoration executed, or interrupted by enemy attack
- if (target.status!='dead' && anime.status!='dead' && target.buffer.DefensiveMatrix){
- if (target.removeBuffer(bufferObj)) delete target.buffer.DefensiveMatrix;
- }
- }});
+ var anime = new Animation.DefensiveMatrix({ target: target, callback: function () {
+ //Restore after 60 seconds, if no restoration executed, or interrupted by enemy attack
+ if (target.status != 'dead' && anime.status != 'dead' && target.buffer.DefensiveMatrix) {
+ if (target.removeBuffer(bufferObj))
+ delete target.buffer.DefensiveMatrix;
+ }
+ } });
//DefensiveMatrix sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.DefensiveMatrix.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.DefensiveMatrix.wav').play();
//Defensive matrix effect: absorb 250 damage
- var matrixHP=250;
- var bufferObj={
- calculateDamageBy:function(enemyObj){
+ var matrixHP = 250;
+ var bufferObj = {
+ calculateDamageBy: function (enemyObj) {
var damage;
- if (enemyObj instanceof Gobj){
- var enemyAttackType=enemyObj.attackType;
- if (!enemyAttackType && enemyObj.attackMode){
- enemyAttackType=(this.isFlying)?enemyObj.attackMode.flying.attackType:enemyObj.attackMode.ground.attackType;
+ if (enemyObj instanceof Gobj) {
+ var enemyAttackType = enemyObj.attackType;
+ if (!enemyAttackType && enemyObj.attackMode) {
+ enemyAttackType = (this.isFlying) ? enemyObj.attackMode.flying.attackType : enemyObj.attackMode.ground.attackType;
}
- damage=enemyObj.get('damage')*Unit.attackMatrix[enemyAttackType][this.unitType];
+ damage = enemyObj.get('damage') * Unit.attackMatrix[enemyAttackType][this.unitType];
}
- else damage=enemyObj;
+ else
+ damage = enemyObj;
//Consume matrixHP
- matrixHP-=damage;
+ matrixHP -= damage;
//Fully absorb damage if matrixHP still remain
- if (matrixHP>0) return 0;
+ if (matrixHP > 0)
+ return 0;
else {
anime.die();
//Release remaining damage
@@ -962,729 +1002,746 @@ var Magic={
//Apply effect
target.addBuffer(bufferObj);
//Buffer flag
- target.buffer.DefensiveMatrix=true;
+ target.buffer.DefensiveMatrix = true;
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- EMPShockwave:{
- name:"EMPShockwave",
- cost:{magic:100},
- credit:true,
- enabled:false,
- spell:function(location){
+ EMPShockwave: {
+ name: "EMPShockwave",
+ cost: { magic: 100 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire Plague
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//Fire EMPShockwave
- var bullet=new Bullets.SingleMissile({
- from:myself,
- to:{x:location.x,y:location.y}
+ var bullet = new Bullets.SingleMissile({
+ from: myself,
+ to: { x: location.x, y: location.y }
});
//Fire EMPShockwave bullet with callback
- bullet.fire(function(){
+ bullet.fire(function () {
//EMP shockwave animation
- var anime=new Animation.EMPShockwave({x:location.x,y:location.y});
+ var anime = new Animation.EMPShockwave({ x: location.x, y: location.y });
//EMPShockwave sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.EMPShockwave.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.EMPShockwave.wav').play();
//Get in range enemies
- var targets=Game.getInRangeOnes(location.x,location.y,[90*1.2>>0,74*1.2>>0],myself.team.toString());
+ var targets = Game.getInRangeOnes(location.x, location.y, [90 * 1.2 >> 0, 74 * 1.2 >> 0], myself.team.toString());
//Effect
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
//Losing all shield and magic
- if (chara.shield) chara.shield=0;
- if (chara.magic) chara.magic=0;
+ if (chara.shield)
+ chara.shield = 0;
+ if (chara.magic)
+ chara.magic = 0;
});
});
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Irradiate:{
- name:"Irradiate",
- cost:{magic:75},
- credit:true,
- enabled:false,
- spell:function(location){
+ Irradiate: {
+ name: "Irradiate",
+ cost: { magic: 75 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Target enemy unit, animal unit
- var target=Game.getSelectedOne(location.x,location.y,this.team.toString(),true,null,function(chara){
+ var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true, null, function (chara) {
return !(chara.isMachine()) && !chara.buffer.Irradiate;
});
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
- var irradiate=function(chara){
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
+ var irradiate = function (chara) {
//Irradiate effect
- var anime=new Animation.Irradiate({target:chara,callback:function(){
- //Restore after 25 seconds, dealing 250 damage
- if (chara.status!='dead' && chara.buffer.Irradiate){
- if (chara.removeBuffer(bufferObj)) delete chara.buffer.Irradiate;
- delete chara.allFrames['dock'];
- chara.dock();
- }
- }});
+ var anime = new Animation.Irradiate({ target: chara, callback: function () {
+ //Restore after 25 seconds, dealing 250 damage
+ if (chara.status != 'dead' && chara.buffer.Irradiate) {
+ if (chara.removeBuffer(bufferObj))
+ delete chara.buffer.Irradiate;
+ delete chara.allFrames['dock'];
+ chara.dock();
+ }
+ } });
//Irradiate sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Irradiate.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Irradiate.wav').play();
//Losing life over time and walk around
- chara.buffer.Irradiate=true;//Flag
- var bufferObj={
- recover:function(){
+ chara.buffer.Irradiate = true; //Flag
+ var bufferObj = {
+ recover: function () {
//Get in range enemies and infect
- Game.getInRangeOnes(chara.posX(),chara.posY(),50,myself.team.toString(),true,null,function(chara){
+ Game.getInRangeOnes(chara.posX(), chara.posY(), 50, myself.team.toString(), true, null, function (chara) {
return !(chara.isMachine()) && !chara.buffer.Irradiate;
- }).forEach(function(chara){
+ }).forEach(function (chara) {
irradiate(chara);
});
- if (this.life>0) this.life-=10;//Refresh every 1 seconds
- if (this.life<=0) {
+ if (this.life > 0)
+ this.life -= 10; //Refresh every 1 seconds
+ if (this.life <= 0) {
this.die();
}
},
- dock:Neutral.Bengalaas.prototype.dock
+ dock: Neutral.Bengalaas.prototype.dock
};
chara.addBuffer(bufferObj);
chara.dock();
};
//Move toward target to spell Irradiate
- this.moveToward(target,300,function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, 300, function () {
+ if (Resource.payCreditBill.call(myself)) {
irradiate(target);
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Yamato:{
- name:"Yamato",
- cost:{magic:150},
- credit:true,
- enabled:false,
- spell:function(location){
+ Yamato: {
+ name: "Yamato",
+ cost: { magic: 150 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Shoot all enemy
- var target=Game.getSelectedOne(location.x,location.y,this.team.toString());
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ var target = Game.getSelectedOne(location.x, location.y, this.team.toString());
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to fire yamato
- this.moveToward(target,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//Fire yamato
- var bullet=new Bullets.Yamato({
- from:myself,
- to:target,
- damage:250
+ var bullet = new Bullets.Yamato({
+ from: myself,
+ to: target,
+ damage: 250
});
bullet.fire();
- if (myself.insideScreen()) new Audio(Game.CDN+'bgm/HeroCruiser.attack.wav').play();
+ if (myself.insideScreen())
+ new Audio(Game.CDN + 'bgm/HeroCruiser.attack.wav').play();
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- ScannerSweep:{
- name:"ScannerSweep",
- cost:{magic:50},
- credit:true,
- enabled:true,
- spell:function(location){
+ ScannerSweep: {
+ name: "ScannerSweep",
+ cost: { magic: 50 },
+ credit: true,
+ enabled: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
- if (Resource.payCreditBill.call(this)){
+ if (location) {
+ if (Resource.payCreditBill.call(this)) {
//ScannerSweep animation
- var anime=new Animation.ScannerSweep({x:location.x,y:location.y,team:this.team});
+ var anime = new Animation.ScannerSweep({ x: location.x, y: location.y, team: this.team });
//ScannerSweep sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.ScannerSweep.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.ScannerSweep.wav').play();
}
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- ArmNuclearSilo:{
- name:"ArmNuclearSilo",
- cost:{
- mine:200,
- gas:200,
- man:8,
- time:600
+ ArmNuclearSilo: {
+ name: "ArmNuclearSilo",
+ cost: {
+ mine: 200,
+ gas: 200,
+ man: 8,
+ time: 600
},
- enabled:true,
- spell:function(){
+ enabled: true,
+ spell: function () {
Magic.NuclearStrike.enabled++;
}
},
- LiftOff:{
- name:"LiftOff",
- enabled:false,
- spell:function(){}
+ LiftOff: {
+ name: "LiftOff",
+ enabled: false,
+ spell: function () { }
},
- Land:{
- name:"Land",
- enabled:false,
- spell:function(location){}
+ Land: {
+ name: "Land",
+ enabled: false,
+ spell: function (location) { }
},
-
//Protoss
- PsionicStorm:{
- name:"PsionicStorm",
- cost:{magic:75},
- credit:true,
- _timer:false,
- speller:{},
- enabled:false,
- spell:function(location){
+ PsionicStorm: {
+ name: "PsionicStorm",
+ cost: { magic: 75 },
+ credit: true,
+ _timer: false,
+ speller: {},
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire PsionicStorm
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//PsionicStorm animation
- var anime=new Animation.PsionicStorm({x:location.x,y:location.y});
+ var anime = new Animation.PsionicStorm({ x: location.x, y: location.y });
//PsionicStorm sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.PsionicStorm.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.PsionicStorm.wav').play();
//PsionicStorm effect
- var targets=[];
- Magic.PsionicStorm.speller=this;
+ var targets = [];
+ Magic.PsionicStorm.speller = this;
//Psionic storm wave
- var stormWave=function(){
- targets=[];
+ var stormWave = function () {
+ targets = [];
//Check if any psionic storm exist
- var psionicStorms=Burst.allEffects.filter(function(effect){
+ var psionicStorms = Burst.allEffects.filter(function (effect) {
return effect instanceof Animation.PsionicStorm;
});
if (psionicStorms.length) {
//Get targets inside all of swarms
- psionicStorms.forEach(function(storm){
+ psionicStorms.forEach(function (storm) {
//Update buffer on enemy units inside storm
- targets=targets.concat(Game.getInRangeOnes(storm.posX(),storm.posY(),[94*1.2>>0,76*1.2>>0],null,true));
+ targets = targets.concat(Game.getInRangeOnes(storm.posX(), storm.posY(), [94 * 1.2 >> 0, 76 * 1.2 >> 0], null, true));
});
$.unique(targets);
//Effect
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
//Deal damage
chara.getDamageBy(16);
//Don't move, but will die if no life
- chara.reactionWhenAttackedBy(Magic.PsionicStorm.speller,true);
+ chara.reactionWhenAttackedBy(Magic.PsionicStorm.speller, true);
});
- Game.commandTimeout(stormWave,1000);
- Magic.PsionicStorm._timer=true;
+ Game.commandTimeout(stormWave, 1000);
+ Magic.PsionicStorm._timer = true;
}
- else Magic.PsionicStorm._timer=false;
+ else
+ Magic.PsionicStorm._timer = false;
};
//If not calculating, execute
- if (!Magic.PsionicStorm._timer) stormWave();
+ if (!Magic.PsionicStorm._timer)
+ stormWave();
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Hallucination:{
- name:"Hallucination",
- cost:{magic:100},
- credit:true,
- enabled:false,
- spell:function(location){
+ Hallucination: {
+ name: "Hallucination",
+ cost: { magic: 100 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Target all units
- var target=Game.getSelectedOne(location.x,location.y,null,true);
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ var target = Game.getSelectedOne(location.x, location.y, null, true);
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to create 2 hallucinations
- this.moveToward(target,245,function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, 245, function () {
+ if (Resource.payCreditBill.call(myself)) {
//Hallucination effect
- var anime=new Animation.Hallucination({target:target});
+ var anime = new Animation.Hallucination({ target: target });
//Hallucination sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Hallucination.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Hallucination.wav').play();
//Initial
- var halluDamage, halluAttackMode, Hallucinations=[];
- if (target.attack!=null) {
- if (target.attackMode){
- halluAttackMode=_$.clone(target.attackMode);
- halluAttackMode.flying.damage=0;
- halluAttackMode.ground.damage=0;
+ var halluDamage, halluAttackMode, Hallucinations = [];
+ if (target.attack != null) {
+ if (target.attackMode) {
+ halluAttackMode = _$.clone(target.attackMode);
+ halluAttackMode.flying.damage = 0;
+ halluAttackMode.ground.damage = 0;
}
- else halluDamage=0;
+ else
+ halluDamage = 0;
}
//Combine temp constructor for hallucination
- var halluConstructor=target.constructor.extends({
- constructorPlus:function(props){},
- prototypePlus:{
+ var halluConstructor = target.constructor.extends({
+ constructorPlus: function (props) { },
+ prototypePlus: {
//Override
- damage:halluDamage,//Might be undefined
- attackMode:halluAttackMode,//Might be undefined
- cost:{man:0},
- items:null,
- dieEffect:Burst.HallucinationDeath
+ damage: halluDamage,
+ attackMode: halluAttackMode,
+ cost: { man: 0 },
+ items: null,
+ dieEffect: Burst.HallucinationDeath
}
});
- for (var n=0;n<2;n++){
- var hallucination=new halluConstructor({x:target.posX(),y:target.posY(),team:myself.team});
+ for (var n = 0; n < 2; n++) {
+ var hallucination = new halluConstructor({ x: target.posX(), y: target.posY(), team: myself.team });
Hallucinations.push(hallucination);
}
//Will disappear after 180 seconds
- Game.commandTimeout(function(){
- Hallucinations.forEach(function(chara){
+ Game.commandTimeout(function () {
+ Hallucinations.forEach(function (chara) {
chara.die();
});
- },180000);
+ }, 180000);
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Feedback:{
- name:"Feedback",//ManaBurn
- cost:{magic:50},
- credit:true,
- enabled:true,
- spell:function(location){
+ Feedback: {
+ name: "Feedback",
+ cost: { magic: 50 },
+ credit: true,
+ enabled: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Target enemy unit, magician
- var target=Game.getSelectedOne(location.x,location.y,this.team.toString(),true,null,function(chara){
+ var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true, null, function (chara) {
return chara.MP;
});
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to spell Feedback
- this.moveToward(target,300,function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, 300, function () {
+ if (Resource.payCreditBill.call(myself)) {
//Feedback effect
- var anime=new Animation.Feedback({target:target});
+ var anime = new Animation.Feedback({ target: target });
//Feedback sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Feedback.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Feedback.wav').play();
//Deal damage same as its magic, lose all magic
target.getDamageBy(target.magic);
target.reactionWhenAttackedBy(myself);
- target.magic=0;
+ target.magic = 0;
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- MindControl:{
- name:"MindControl",
- cost:{magic:150},
- credit:true,
- enabled:false,
- spell:function(location){
+ MindControl: {
+ name: "MindControl",
+ cost: { magic: 150 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Can control all enemy
- var target=Game.getSelectedOne(location.x,location.y,this.team.toString());
- if (target instanceof Gobj){
- var myself=this;
- this.targetLock=true;
+ var target = Game.getSelectedOne(location.x, location.y, this.team.toString());
+ if (target instanceof Gobj) {
+ var myself = this;
+ this.targetLock = true;
//Move toward target to mind control it
- this.moveToward(target,280,function(){
- if (Resource.payCreditBill.call(myself)){
+ this.moveToward(target, 280, function () {
+ if (Resource.payCreditBill.call(myself)) {
//Mind control animation
- var anime=new Animation.MindControl({target:target});
+ var anime = new Animation.MindControl({ target: target });
//MindControl sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.MindControl.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.MindControl.wav').play();
//Control and tame enemy
- target.team=myself.team;
+ target.team = myself.team;
//Order ours not to attack it anymore
- Unit.allUnits.concat(Building.allBuildings).forEach(function(chara){
- if (chara.target==target) chara.stopAttack();
+ Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
+ if (chara.target == target)
+ chara.stopAttack();
});
//Freeze target
- if (target.stopAttack) target.stopAttack();
+ if (target.stopAttack)
+ target.stopAttack();
target.dock();
}
});
}
- //Empty object {}, cannot spell
- else delete this.creditBill;
+ else
+ delete this.creditBill;
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- MaelStorm:{
- name:"MaelStorm",
- cost:{magic:100},
- credit:true,
- enabled:false,
- spell:function(location){
+ MaelStorm: {
+ name: "MaelStorm",
+ cost: { magic: 100 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire MaelStorm
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//MaelStorm spell animation
- var anime=new Animation.MaelStormSpell({x:location.x,y:location.y,callback:function(){
- //Get in range enemy units, animal
- var targets=Game.getInRangeOnes(location.x,location.y,[64*1.2>>0,64*1.2>>0],myself.team.toString(),true,null,function(chara){
- return !(chara.isMachine()) && !chara.buffer.MaelStorm;
- });
- //Freeze target
- var bufferObj={
- moveTo:function(){},
- moveToward:function(){},
- attack:function(){}
- };
- //Effect
- targets.forEach(function(target){
- target.dock();
- if (target.stopAttack) target.stopAttack();
- target.addBuffer(bufferObj);
- //Buffer flag
- target.buffer.MaelStorm=true;
- //Mael storm effect
- new Animation.MaelStorm({target:target,callback:function(){
- //Restore in 18 seconds
- if (target.status!='dead' && target.buffer.MaelStorm){
- if (target.removeBuffer(bufferObj)) delete target.buffer.MaelStorm;
- }
- }});
- });
- //MaelStorm sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.MaelStorm.wav').play();
- }});
+ var anime = new Animation.MaelStormSpell({ x: location.x, y: location.y, callback: function () {
+ //Get in range enemy units, animal
+ var targets = Game.getInRangeOnes(location.x, location.y, [64 * 1.2 >> 0, 64 * 1.2 >> 0], myself.team.toString(), true, null, function (chara) {
+ return !(chara.isMachine()) && !chara.buffer.MaelStorm;
+ });
+ //Freeze target
+ var bufferObj = {
+ moveTo: function () { },
+ moveToward: function () { },
+ attack: function () { }
+ };
+ //Effect
+ targets.forEach(function (target) {
+ target.dock();
+ if (target.stopAttack)
+ target.stopAttack();
+ target.addBuffer(bufferObj);
+ //Buffer flag
+ target.buffer.MaelStorm = true;
+ //Mael storm effect
+ new Animation.MaelStorm({ target: target, callback: function () {
+ //Restore in 18 seconds
+ if (target.status != 'dead' && target.buffer.MaelStorm) {
+ if (target.removeBuffer(bufferObj))
+ delete target.buffer.MaelStorm;
+ }
+ } });
+ });
+ //MaelStorm sound
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.MaelStorm.wav').play();
+ } });
//MaelStormSpell sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.StasisField.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.StasisField.wav').play();
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- Scarab:{
- name:"Scarab",
- enabled:true,
- cost:{
- mine:15,
- time:70
+ Scarab: {
+ name: "Scarab",
+ enabled: true,
+ cost: {
+ mine: 15,
+ time: 70
},
- spell:function(){
+ spell: function () {
this.scarabNum++;
//Refresh to disabled
- if (Game.selectedUnit==this) Button.refreshButtons();
+ if (Game.selectedUnit == this)
+ Button.refreshButtons();
}
},
- Interceptor:{
- name:"Interceptor",
- enabled:true,
- cost:{
- mine:25,
- time:200
+ Interceptor: {
+ name: "Interceptor",
+ enabled: true,
+ cost: {
+ mine: 25,
+ time: 200
},
- spell:function(){
+ spell: function () {
//Build interceptor
this.continuousAttack.count++;
//Refresh to disabled
- if (Game.selectedUnit==this) Button.refreshButtons();
+ if (Game.selectedUnit == this)
+ Button.refreshButtons();
}
},
- Recall:{
- name:"Recall",
- cost:{magic:150},
- credit:true,
- enabled:false,
- spell:function(location){
+ Recall: {
+ name: "Recall",
+ cost: { magic: 150 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
- var myself=this;
- if (Resource.payCreditBill.call(myself)){
+ if (location) {
+ var myself = this;
+ if (Resource.payCreditBill.call(myself)) {
//Recall animation
- var anime=new Animation.Recall({x:location.x,y:location.y,callback:function(){
- //Get in range our units
- var targets=Game.getInRangeOnes(location.x,location.y,50*1.2>>0,myself.team,true);
- //Recall animation again
- var animeII=new Animation.Recall({x:myself.posX(),y:myself.posY()});
- //Recall sound
- if (animeII.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Recall.wav').play();
- //Effect
- targets.forEach(function(chara){
- //Relocate targets
- chara.x=myself.x;
- chara.y=myself.y;
- });
- }});
+ var anime = new Animation.Recall({ x: location.x, y: location.y, callback: function () {
+ //Get in range our units
+ var targets = Game.getInRangeOnes(location.x, location.y, 50 * 1.2 >> 0, myself.team, true);
+ //Recall animation again
+ var animeII = new Animation.Recall({ x: myself.posX(), y: myself.posY() });
+ //Recall sound
+ if (animeII.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Recall.wav').play();
+ //Effect
+ targets.forEach(function (chara) {
+ //Relocate targets
+ chara.x = myself.x;
+ chara.y = myself.y;
+ });
+ } });
//Recall sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Recall.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.Recall.wav').play();
}
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- StasisField:{
- name:"StasisField",
- cost:{magic:100},
- credit:true,
- enabled:false,
- spell:function(location){
+ StasisField: {
+ name: "StasisField",
+ cost: { magic: 100 },
+ credit: true,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire StasisField
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//Spell StasisField animation
- var anime=new Animation.StasisFieldSpell({x:location.x,y:location.y,callback:function(){
- //Get in range units
- var targets=Game.getInRangeOnes(location.x,location.y,64*1.2>>0,null,true);
- //Effect:Freeze target
- var bufferObj={
- moveTo:function(){},
- moveToward:function(){},
- attack:function(){},
- getDamageBy:function(){}
- };
- targets.forEach(function(target){
- if (target.status!='dead'){
- //Buffer flag
- if (target.buffer.StasisField) return;//Not again
- target.buffer.StasisField=true;
- //Effect
- target.dock();
- if (target.stopAttack) target.stopAttack();
- //Freeze target
- target.addBuffer(bufferObj);
- //Stasis status
- target.stop();
- //Stasis field animation
- new Animation.StasisField({target:target,callback:function(){
- //Restore in 30 seconds
- if (target.status!='dead' && target.buffer.StasisField){
- if (target.removeBuffer(bufferObj)) {
- delete target.buffer.StasisField;
- target.dock();
- }
- }
- }});
- }
- });
- }});
+ var anime = new Animation.StasisFieldSpell({ x: location.x, y: location.y, callback: function () {
+ //Get in range units
+ var targets = Game.getInRangeOnes(location.x, location.y, 64 * 1.2 >> 0, null, true);
+ //Effect:Freeze target
+ var bufferObj = {
+ moveTo: function () { },
+ moveToward: function () { },
+ attack: function () { },
+ getDamageBy: function () { }
+ };
+ targets.forEach(function (target) {
+ if (target.status != 'dead') {
+ //Buffer flag
+ if (target.buffer.StasisField)
+ return; //Not again
+ target.buffer.StasisField = true;
+ //Effect
+ target.dock();
+ if (target.stopAttack)
+ target.stopAttack();
+ //Freeze target
+ target.addBuffer(bufferObj);
+ //Stasis status
+ target.stop();
+ //Stasis field animation
+ new Animation.StasisField({ target: target, callback: function () {
+ //Restore in 30 seconds
+ if (target.status != 'dead' && target.buffer.StasisField) {
+ if (target.removeBuffer(bufferObj)) {
+ delete target.buffer.StasisField;
+ target.dock();
+ }
+ }
+ } });
+ }
+ });
+ } });
//StasisField sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.StasisField.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.StasisField.wav').play();
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- DisruptionWeb:{
- name:"DisruptionWeb",
- cost:{magic:125},
- credit:true,
- _timer:false,
- enabled:false,
- spell:function(location){
+ DisruptionWeb: {
+ name: "DisruptionWeb",
+ cost: { magic: 125 },
+ credit: true,
+ _timer: false,
+ enabled: false,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire DisruptionWeb
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,this.get('sight'),function(){
- if (Resource.payCreditBill.call(myself)){
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, this.get('sight'), function () {
+ if (Resource.payCreditBill.call(myself)) {
//DisruptionWeb animation
- var anime=new Animation.DisruptionWeb({x:location.x,y:location.y});
+ var anime = new Animation.DisruptionWeb({ x: location.x, y: location.y });
//DisruptionWeb sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.DisruptionWeb.wav').play();
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.DisruptionWeb.wav').play();
//Dynamic update targets every 1 second
- var targets=[];
+ var targets = [];
//Effect:Disable target attack
- var bufferObj={
- attack:function(){}
+ var bufferObj = {
+ attack: function () { }
};
//Disruption web wave
- var disruptionWeb=function(){
+ var disruptionWeb = function () {
//Clear old units buffer
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
chara.removeBuffer(bufferObj);
});
- targets=[];
- var disruptionWebs=Burst.allEffects.filter(function(effect){
+ targets = [];
+ var disruptionWebs = Burst.allEffects.filter(function (effect) {
return effect instanceof Animation.DisruptionWeb;
});
//Check if any disruption web exist
if (disruptionWebs.length) {
//Get targets inside all of webs
- disruptionWebs.forEach(function(web){
+ disruptionWebs.forEach(function (web) {
//Update buffer on enemy ground units inside web
- targets=targets.concat(Game.getInRangeOnes(web.posX(),web.posY(),[76*1.2>>0,56*1.2>>0],null,true,false));
+ targets = targets.concat(Game.getInRangeOnes(web.posX(), web.posY(), [76 * 1.2 >> 0, 56 * 1.2 >> 0], null, true, false));
});
$.unique(targets);
//Effect
- targets.forEach(function(chara){
+ targets.forEach(function (chara) {
//Cannot attack
if (chara.attack) {
chara.stopAttack();
chara.addBuffer(bufferObj);
}
});
- Game.commandTimeout(disruptionWeb,1000);
- Magic.DisruptionWeb._timer=true;
+ Game.commandTimeout(disruptionWeb, 1000);
+ Magic.DisruptionWeb._timer = true;
}
- else Magic.DisruptionWeb._timer=false;
+ else
+ Magic.DisruptionWeb._timer = false;
};
//If not calculating, execute
- if (!Magic.DisruptionWeb._timer) disruptionWeb();
+ if (!Magic.DisruptionWeb._timer)
+ disruptionWeb();
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
- RechargeShields:{
- name:"RechargeShields",
- enabled:true,
- needLocation:true,
- spell:function(location){
+ RechargeShields: {
+ name: "RechargeShields",
+ enabled: true,
+ needLocation: true,
+ spell: function (location) {
//Has location callback info or nothing
- if (location){
- var myself=this;
+ if (location) {
+ var myself = this;
//Restore our units, have shield and in sight
- var target=Game.getSelectedOne(location.x,location.y,this.team,true,null,function(chara){
+ var target = Game.getSelectedOne(location.x, location.y, this.team, true, null, function (chara) {
return chara.SP && myself.canSee(chara);
});
- if (target instanceof Gobj){
+ if (target instanceof Gobj) {
//Recharge shield animation
- var anime=new Animation.RechargeShields({target:target});
+ var anime = new Animation.RechargeShields({ target: target });
//Recharge shield sound
- if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.RechargeShields.wav').play();
- var hurt=target.get('SP')-target.shield;
- var needMagic=(hurt/2+0.5)>>0;
+ if (anime.insideScreen())
+ new Audio(Game.CDN + 'bgm/Magic.RechargeShields.wav').play();
+ var hurt = target.get('SP') - target.shield;
+ var needMagic = (hurt / 2 + 0.5) >> 0;
//Remaining magic is sufficient
- if (this.magic>needMagic) {
+ if (this.magic > needMagic) {
//Full recover
- target.shield=target.get('SP');
- this.magic-=needMagic;
+ target.shield = target.get('SP');
+ this.magic -= needMagic;
}
- //Remaining magic is not enough
else {
//Use all remaining magic
- target.shield+=(this.magic*2);
- this.magic=0;
+ target.shield += (this.magic * 2);
+ this.magic = 0;
}
}
else {
//Cannot reach target, pError
}
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.owner=this;
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.owner = this;
+ $('div.GameLayer').attr('status', 'button');
}
}
},
/********RPG level: Tower Defense********/
- CleanScreen:{
- name:"CleanScreen",
- cost:{
- mine:200
+ CleanScreen: {
+ name: "CleanScreen",
+ cost: {
+ mine: 200
},
- spell:function(){
+ spell: function () {
//Kill all enemies
Cheat.execute('fuck your mother');
}
}
-};
\ No newline at end of file
+};
+//# sourceMappingURL=Magic.js.map
\ No newline at end of file
diff --git a/Characters/Magic.ts b/Characters/Magic.ts
new file mode 100644
index 0000000..b406fd3
--- /dev/null
+++ b/Characters/Magic.ts
@@ -0,0 +1,1690 @@
+var Magic={
+ //Zerg
+ Burrow:{
+ name:"Burrow",
+ enabled:false,
+ spell:function(){
+ this.dock();
+ if (this.stopAttack) this.stopAttack();
+ this.status="burrow";
+ this.action=2;
+ var myself=this;
+ //Effect:Freeze target
+ var bufferObj={
+ moveTo:function(){},
+ moveToward:function(){},
+ dock:function(){},
+ items:{'1':undefined,'2':undefined,'3':undefined,'4':undefined,'5':undefined,
+ '6':undefined,'7':undefined,'8':undefined,'9':{name:'Unburrow'}}
+ };
+ if (this.attack) bufferObj.attack=function(){};
+ //Lurker has same behavior as attackable building
+ if (this.name=="Lurker") {
+ var mixin=$.extend({},Building.Attackable.prototypePlus);
+ delete mixin.name;
+ mixin.die=AttackableUnit.prototype.die;//Override
+ $.extend(bufferObj,mixin);
+ delete bufferObj.items[3];//Enable attack icon
+ }
+ //Freeze immediately
+ this.addBuffer(bufferObj,(this.name=="Lurker"));//onAll for Lurker
+ this.burrowBuffer=[bufferObj];
+ //Sound effect
+ if (this.insideScreen()) this.sound.burrow.play();
+ //Forbid actions when burrowing
+ var itemsBackup=this.items;
+ this.items={'1':undefined,'2':undefined,'3':undefined,'4':undefined,'5':undefined,
+ '6':undefined,'7':undefined,'8':undefined,'9':undefined};
+ if (Game.selectedUnit==this) Button.refreshButtons();
+ //Finish burrow
+ Game.commandTimeout(function(){
+ //Invisible when finish burrow
+ var bufferObjII={};
+ for (var N=0;N>0,62*1.2>>0],myself.team.toString(),true);
+ //Slow moving speed
+ var bufferObj={
+ speed:2
+ };
+ //Effect
+ targets.forEach(function(chara){
+ //Buffer flag
+ if (chara.buffer.Ensnare) return;//Not again
+ chara.buffer.Ensnare=true;
+ chara.addBuffer(bufferObj);
+ //Green effect
+ new Animation.GreenEffect({team:myself.team,target:chara,callback:function(){
+ if (chara.status!='dead' && chara.buffer.Ensnare){
+ //Restore
+ if (chara.removeBuffer(bufferObj)) delete chara.buffer.Ensnare;
+ }
+ }});
+ });
+ });
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Consume:{
+ name:"Consume",
+ enabled:false,
+ needLocation:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Kill our unit ground
+ var target=Game.getSelectedOne(location.x,location.y,this.team,true,false);
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to consume
+ this.moveToward(target,70,function(){
+ //Effect
+ var anime=new Animation.Consume({target:target,callback:function(){
+ //Consume sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Consume.wav').play();
+ //Consume animation missing
+ target.die();
+ myself.magic+=50;
+ if (myself.magic>myself.get('MP')) myself.magic=myself.get('MP');
+ }});
+ });
+ }
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ DarkSwarm:{
+ name:"DarkSwarm",
+ cost:{magic:100},
+ credit:true,
+ _timer:false,
+ enabled:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire DarkSwarm
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //DarkSwarm animation, play hidden frames at first
+ new Animation.DarkSwarm({x:location.x,y:location.y}).action=6;
+ //Dynamic update targets every 1 second
+ var targets=[];
+ //Full guard from distance
+ var bufferObj={
+ //Full guard from distance
+ calculateDamageBy:function(enemyObj,percent){
+ if (enemyObj.meleeAttack){
+ var enemyAttackType=enemyObj.attackType;
+ if (!enemyAttackType && enemyObj.attackMode){
+ enemyAttackType=(this.isFlying)?enemyObj.attackMode.flying.attackType:enemyObj.attackMode.ground.attackType;
+ }
+ return enemyObj.get('damage')*Unit.attackMatrix[enemyAttackType][this.unitType];
+ }
+ //Full guard
+ else return 0;
+ }
+ };
+ //Dark swarm wave
+ var darkSwarm=function(){
+ //Clear old units buffer
+ targets.forEach(function(chara){
+ chara.removeBuffer(bufferObj);
+ });
+ targets=[];
+ var darkSwarms=Burst.allEffects.filter(function(effect){
+ return effect instanceof Animation.DarkSwarm;
+ });
+ //Check if any swarm effect exist
+ if (darkSwarms.length) {
+ //Get targets inside all of swarms
+ darkSwarms.forEach(function(swarm){
+ //Update buffer on our ground units inside swarm
+ targets=targets.concat(Game.getInRangeOnes(swarm.posX(),swarm.posY(),[126*1.2>>0,94*1.2>>0],null,true,false));
+ });
+ $.unique(targets);
+ //Effect
+ targets.forEach(function(chara){
+ //Guard from range-attack enemy
+ chara.addBuffer(bufferObj);
+ });
+ Game.commandTimeout(darkSwarm,1000);
+ Magic.DarkSwarm._timer=true;
+ }
+ else Magic.DarkSwarm._timer=false;
+ };
+ //If not calculating, execute
+ if (!Magic.DarkSwarm._timer) darkSwarm();
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Plague:{
+ name:"Plague",
+ cost:{magic:150},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire Plague
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Plague animation and sound
+ var anime=new Animation.Plague({x:location.x,y:location.y});
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Ensnare.wav').play();
+ //Get in range enemy units
+ var targets=Game.getInRangeOnes(location.x,location.y,[64*1.2>>0,64*1.2>>0],myself.team.toString(),true);
+ //Effect:HP losing every seconds
+ var bufferObj={
+ recover:function(){
+ if (this.life>0) this.life-=25;//Refresh every 1 seconds
+ if (this.life<=0) this.life=1;
+ }
+ };
+ targets.forEach(function(chara){
+ //Buffer flag
+ if (chara.buffer.Plague) return;//Not again
+ chara.buffer.Plague=true;
+ //HP losing every seconds
+ chara.addBuffer(bufferObj);
+ //Green effect
+ new Animation.RedEffect({team:myself.team,target:chara,callback:function(){
+ if (chara.status!='dead' && chara.buffer.Plague){
+ //Restore
+ if (chara.removeBuffer(bufferObj)) delete chara.buffer.Plague;
+ }
+ }});
+ });
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ //Terran
+ StimPacks:{
+ name:"StimPacks",
+ enabled:false,
+ spell:function(){
+ //Rage flag for units to decide stim or not
+ if (!this.buffer.Stim) {
+ //Cause damage
+ this.life-=10;
+ if (this.life<1) this.life=1;
+ //Stim sound
+ if (this.insideScreen()) new Audio(Game.CDN+'bgm/Magic.StimPacks.wav').play();
+ //Effect
+ var bufferObj={
+ attackInterval:800,
+ speed:14
+ };
+ this.addBuffer(bufferObj);
+ this.buffer.Stim=true;
+ //Will only be stim for 15sec
+ var myself=this;
+ Game.commandTimeout(function(){
+ if (myself.status!='dead' && myself.buffer.Stim){
+ //Special effect is over
+ if (myself.removeBuffer(bufferObj)) delete myself.buffer.Stim;
+ }
+ },15000);
+ }
+ }
+ },
+ PersonalCloak:{
+ name:"PersonalCloak",
+ cost:{magic:25},
+ enabled:false,
+ spell:function(){
+ //Will only be invisible when having magic
+ if (!this.cloakBuffer) {
+ var bufferObj={
+ //Magic losing every seconds
+ recover:function(){
+ //Should not forbid old recover
+ this.constructor.prototype.recover.call(this);
+ //Losing magic
+ if (this.magic>0 && !Cheat.gathering) this.magic--;
+ if (this.magic<=0) {
+ //Might be negative float
+ this.magic=0;
+ //Special effect is over
+ if (this.removeBuffer(bufferObj)) {
+ delete this.buffer.Cloak;
+ delete this.cloakBuffer;
+ //Recover icons and apply callbacks
+ delete this.items;
+ if (Game.selectedUnit==this) Button.reset();
+ }
+ }
+ }
+ };
+ for (var N=0;N0 && myself.team==Game.team) {
+ Magic.NuclearStrike.enabled--;
+ if (Game.selectedUnit==myself) Button.refreshButtons();
+ }
+ });
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Heal:{
+ name:"Heal",
+ cost:{magic:1},
+ credit:true,
+ enabled:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ var myself=this;
+ //Heal our units on ground, animal unit
+ var target=Game.getSelectedOne(location.x,location.y,this.team,true,false,function(chara){
+ return !(chara.isMachine());
+ });
+ if (target instanceof Gobj){
+ this.targetLock=true;
+ //Move toward target to heal him
+ this.moveToward(target,target.radius()+10,function(){
+ //Consume magic to heal injured target
+ if (myself.magic && target.lifetarget.get('HP')) target.life=target.get('HP');
+ myself.magic--;
+ //Heal action and sound
+ if (myself.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Heal.wav').play();
+ }
+ //# Need heal target automatically until it becomes healthy
+ });
+ }
+ delete this.creditBill;//else
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Restoration:{
+ name:"Restoration",
+ cost:{magic:50},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Restore all units
+ var target=Game.getSelectedOne(location.x,location.y,null,true);
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to restore unit
+ this.moveToward(target,140,function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Restore effect
+ var anime=new Animation.Restoration({target:target});
+ //Restore sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Restoration.wav').play();
+ //Remove all bufferObjs
+ $.extend([],target.bufferObjs).forEach(function(bufferObj){
+ target.removeBuffer(bufferObj);
+ });
+ //Remove remaining buffer
+ if (target.cloakBuffer) delete target.cloakBuffer;
+ if (target.purpleBuffer) delete target.purpleBuffer;
+ //Delete all buffer animations on target
+ var bufferAnimations=['StasisField','Lockdown','Plague','Ensnare','PurpleEffect','RedEffect','GreenEffect','DefensiveMatrix','MaelStorm','Irradiate'];
+ $.extend([],Burst.allEffects).forEach(function(effect){
+ if (effect.target==target && bufferAnimations.some(function(name){return (effect instanceof Animation[name]);}))
+ Burst.allEffects.splice(Burst.allEffects.indexOf(effect),1);
+ });
+ //Delete all buffers, some cannot delete
+ if (target.buffer.Hallucination) target.buffer={Hallucination:true};
+ else target.buffer={};
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ OpticalFlare:{
+ name:"OpticalFlare",
+ cost:{magic:75},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Shoot enemy unit
+ var target=Game.getSelectedOne(location.x,location.y,this.team.toString(),true);
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to fire optical flare
+ this.moveToward(target,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Fire optical flare
+ var bullet=new Bullets.VultureBall({
+ from:myself,
+ to:target,
+ damage:0
+ });
+ bullet.fire(function(){
+ //Effect
+ var bufferObj={
+ sight:target.radius()
+ };
+ if (target.status!='dead') target.addBuffer(bufferObj);
+ //Buffer flag
+ target.buffer.Blind=true;
+ });
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ SpiderMines:{
+ name:"SpiderMines",
+ enabled:false,
+ spell:function(location){}
+ },
+ SeigeMode:{
+ name:"SeigeMode",
+ enabled:false,
+ spell:function(){}
+ },
+ Cloak:{
+ name:"Cloak",
+ cost:{magic:25},
+ enabled:false,
+ spell:function(){
+ Magic.PersonalCloak.spell.call(this);
+ }
+ },
+ DefensiveMatrix:{
+ name:"DefensiveMatrix",
+ cost:{magic:100},
+ credit:true,
+ enabled:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Restore our units
+ var target=Game.getSelectedOne(location.x,location.y,this.team,true,null,function(chara){
+ return !chara.buffer.DefensiveMatrix;//Not again
+ });
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to activate defensive matrix
+ this.moveToward(target,250,function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Defensive matrix animation
+ var anime=new Animation.DefensiveMatrix({target:target,callback:function(){
+ //Restore after 60 seconds, if no restoration executed, or interrupted by enemy attack
+ if (target.status!='dead' && anime.status!='dead' && target.buffer.DefensiveMatrix){
+ if (target.removeBuffer(bufferObj)) delete target.buffer.DefensiveMatrix;
+ }
+ }});
+ //DefensiveMatrix sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.DefensiveMatrix.wav').play();
+ //Defensive matrix effect: absorb 250 damage
+ var matrixHP=250;
+ var bufferObj={
+ calculateDamageBy:function(enemyObj){
+ var damage;
+ if (enemyObj instanceof Gobj){
+ var enemyAttackType=enemyObj.attackType;
+ if (!enemyAttackType && enemyObj.attackMode){
+ enemyAttackType=(this.isFlying)?enemyObj.attackMode.flying.attackType:enemyObj.attackMode.ground.attackType;
+ }
+ damage=enemyObj.get('damage')*Unit.attackMatrix[enemyAttackType][this.unitType];
+ }
+ else damage=enemyObj;
+ //Consume matrixHP
+ matrixHP-=damage;
+ //Fully absorb damage if matrixHP still remain
+ if (matrixHP>0) return 0;
+ else {
+ anime.die();
+ //Release remaining damage
+ return -matrixHP;
+ }
+ }
+ };
+ //Apply effect
+ target.addBuffer(bufferObj);
+ //Buffer flag
+ target.buffer.DefensiveMatrix=true;
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ EMPShockwave:{
+ name:"EMPShockwave",
+ cost:{magic:100},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire Plague
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Fire EMPShockwave
+ var bullet=new Bullets.SingleMissile({
+ from:myself,
+ to:{x:location.x,y:location.y}
+ });
+ //Fire EMPShockwave bullet with callback
+ bullet.fire(function(){
+ //EMP shockwave animation
+ var anime=new Animation.EMPShockwave({x:location.x,y:location.y});
+ //EMPShockwave sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.EMPShockwave.wav').play();
+ //Get in range enemies
+ var targets=Game.getInRangeOnes(location.x,location.y,[90*1.2>>0,74*1.2>>0],myself.team.toString());
+ //Effect
+ targets.forEach(function(chara){
+ //Losing all shield and magic
+ if (chara.shield) chara.shield=0;
+ if (chara.magic) chara.magic=0;
+ });
+ });
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Irradiate:{
+ name:"Irradiate",
+ cost:{magic:75},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Target enemy unit, animal unit
+ var target=Game.getSelectedOne(location.x,location.y,this.team.toString(),true,null,function(chara){
+ return !(chara.isMachine()) && !chara.buffer.Irradiate;
+ });
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ var irradiate=function(chara){
+ //Irradiate effect
+ var anime=new Animation.Irradiate({target:chara,callback:function(){
+ //Restore after 25 seconds, dealing 250 damage
+ if (chara.status!='dead' && chara.buffer.Irradiate){
+ if (chara.removeBuffer(bufferObj)) delete chara.buffer.Irradiate;
+ delete chara.allFrames['dock'];
+ chara.dock();
+ }
+ }});
+ //Irradiate sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Irradiate.wav').play();
+ //Losing life over time and walk around
+ chara.buffer.Irradiate=true;//Flag
+ var bufferObj={
+ recover:function(){
+ //Get in range enemies and infect
+ Game.getInRangeOnes(chara.posX(),chara.posY(),50,myself.team.toString(),true,null,function(chara){
+ return !(chara.isMachine()) && !chara.buffer.Irradiate;
+ }).forEach(function(chara){
+ irradiate(chara);
+ });
+ if (this.life>0) this.life-=10;//Refresh every 1 seconds
+ if (this.life<=0) {
+ this.die();
+ }
+ },
+ dock:Neutral.Bengalaas.prototype.dock
+ };
+ chara.addBuffer(bufferObj);
+ chara.dock();
+ };
+ //Move toward target to spell Irradiate
+ this.moveToward(target,300,function(){
+ if (Resource.payCreditBill.call(myself)){
+ irradiate(target);
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Yamato:{
+ name:"Yamato",
+ cost:{magic:150},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Shoot all enemy
+ var target=Game.getSelectedOne(location.x,location.y,this.team.toString());
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to fire yamato
+ this.moveToward(target,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Fire yamato
+ var bullet=new Bullets.Yamato({
+ from:myself,
+ to:target,
+ damage:250
+ });
+ bullet.fire();
+ if (myself.insideScreen()) new Audio(Game.CDN+'bgm/HeroCruiser.attack.wav').play();
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ ScannerSweep:{
+ name:"ScannerSweep",
+ cost:{magic:50},
+ credit:true,
+ enabled:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ if (Resource.payCreditBill.call(this)){
+ //ScannerSweep animation
+ var anime=new Animation.ScannerSweep({x:location.x,y:location.y,team:this.team});
+ //ScannerSweep sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.ScannerSweep.wav').play();
+ }
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ ArmNuclearSilo:{
+ name:"ArmNuclearSilo",
+ cost:{
+ mine:200,
+ gas:200,
+ man:8,
+ time:600
+ },
+ enabled:true,
+ spell:function(){
+ Magic.NuclearStrike.enabled++;
+ }
+ },
+ LiftOff:{
+ name:"LiftOff",
+ enabled:false,
+ spell:function(){}
+ },
+ Land:{
+ name:"Land",
+ enabled:false,
+ spell:function(location){}
+ },
+
+ //Protoss
+ PsionicStorm:{
+ name:"PsionicStorm",
+ cost:{magic:75},
+ credit:true,
+ _timer:false,
+ speller:{},
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire PsionicStorm
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //PsionicStorm animation
+ var anime=new Animation.PsionicStorm({x:location.x,y:location.y});
+ //PsionicStorm sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.PsionicStorm.wav').play();
+ //PsionicStorm effect
+ var targets=[];
+ Magic.PsionicStorm.speller=this;
+ //Psionic storm wave
+ var stormWave=function(){
+ targets=[];
+ //Check if any psionic storm exist
+ var psionicStorms=Burst.allEffects.filter(function(effect){
+ return effect instanceof Animation.PsionicStorm;
+ });
+ if (psionicStorms.length) {
+ //Get targets inside all of swarms
+ psionicStorms.forEach(function(storm){
+ //Update buffer on enemy units inside storm
+ targets=targets.concat(Game.getInRangeOnes(storm.posX(),storm.posY(),[94*1.2>>0,76*1.2>>0],null,true));
+ });
+ $.unique(targets);
+ //Effect
+ targets.forEach(function(chara){
+ //Deal damage
+ chara.getDamageBy(16);
+ //Don't move, but will die if no life
+ chara.reactionWhenAttackedBy(Magic.PsionicStorm.speller,true);
+ });
+ Game.commandTimeout(stormWave,1000);
+ Magic.PsionicStorm._timer=true;
+ }
+ else Magic.PsionicStorm._timer=false;
+ };
+ //If not calculating, execute
+ if (!Magic.PsionicStorm._timer) stormWave();
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Hallucination:{
+ name:"Hallucination",
+ cost:{magic:100},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Target all units
+ var target=Game.getSelectedOne(location.x,location.y,null,true);
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to create 2 hallucinations
+ this.moveToward(target,245,function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Hallucination effect
+ var anime=new Animation.Hallucination({target:target});
+ //Hallucination sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Hallucination.wav').play();
+ //Initial
+ var halluDamage, halluAttackMode, Hallucinations=[];
+ if (target.attack!=null) {
+ if (target.attackMode){
+ halluAttackMode=_$.clone(target.attackMode);
+ halluAttackMode.flying.damage=0;
+ halluAttackMode.ground.damage=0;
+ }
+ else halluDamage=0;
+ }
+ //Combine temp constructor for hallucination
+ var halluConstructor=target.constructor.extends({
+ constructorPlus:function(props){},
+ prototypePlus:{
+ //Override
+ damage:halluDamage,//Might be undefined
+ attackMode:halluAttackMode,//Might be undefined
+ cost:{man:0},
+ items:null,
+ dieEffect:Burst.HallucinationDeath
+ }
+ });
+ for (var n=0;n<2;n++){
+ var hallucination=new halluConstructor({x:target.posX(),y:target.posY(),team:myself.team});
+ Hallucinations.push(hallucination);
+ }
+ //Will disappear after 180 seconds
+ Game.commandTimeout(function(){
+ Hallucinations.forEach(function(chara){
+ chara.die();
+ });
+ },180000);
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Feedback:{
+ name:"Feedback",//ManaBurn
+ cost:{magic:50},
+ credit:true,
+ enabled:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Target enemy unit, magician
+ var target=Game.getSelectedOne(location.x,location.y,this.team.toString(),true,null,function(chara){
+ return chara.MP;
+ });
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to spell Feedback
+ this.moveToward(target,300,function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Feedback effect
+ var anime=new Animation.Feedback({target:target});
+ //Feedback sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Feedback.wav').play();
+ //Deal damage same as its magic, lose all magic
+ target.getDamageBy(target.magic);
+ target.reactionWhenAttackedBy(myself);
+ target.magic=0;
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ MindControl:{
+ name:"MindControl",
+ cost:{magic:150},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Can control all enemy
+ var target=Game.getSelectedOne(location.x,location.y,this.team.toString());
+ if (target instanceof Gobj){
+ var myself=this;
+ this.targetLock=true;
+ //Move toward target to mind control it
+ this.moveToward(target,280,function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Mind control animation
+ var anime=new Animation.MindControl({target:target});
+ //MindControl sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.MindControl.wav').play();
+ //Control and tame enemy
+ target.team=myself.team;
+ //Order ours not to attack it anymore
+ Unit.allUnits.concat(Building.allBuildings).forEach(function(chara){
+ if (chara.target==target) chara.stopAttack();
+ });
+ //Freeze target
+ if (target.stopAttack) target.stopAttack();
+ target.dock();
+ }
+ });
+ }
+ //Empty object {}, cannot spell
+ else delete this.creditBill;
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ MaelStorm:{
+ name:"MaelStorm",
+ cost:{magic:100},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire MaelStorm
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //MaelStorm spell animation
+ var anime=new Animation.MaelStormSpell({x:location.x,y:location.y,callback:function(){
+ //Get in range enemy units, animal
+ var targets=Game.getInRangeOnes(location.x,location.y,[64*1.2>>0,64*1.2>>0],myself.team.toString(),true,null,function(chara){
+ return !(chara.isMachine()) && !chara.buffer.MaelStorm;
+ });
+ //Freeze target
+ var bufferObj={
+ moveTo:function(){},
+ moveToward:function(){},
+ attack:function(){}
+ };
+ //Effect
+ targets.forEach(function(target){
+ target.dock();
+ if (target.stopAttack) target.stopAttack();
+ target.addBuffer(bufferObj);
+ //Buffer flag
+ target.buffer.MaelStorm=true;
+ //Mael storm effect
+ new Animation.MaelStorm({target:target,callback:function(){
+ //Restore in 18 seconds
+ if (target.status!='dead' && target.buffer.MaelStorm){
+ if (target.removeBuffer(bufferObj)) delete target.buffer.MaelStorm;
+ }
+ }});
+ });
+ //MaelStorm sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.MaelStorm.wav').play();
+ }});
+ //MaelStormSpell sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.StasisField.wav').play();
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ Scarab:{
+ name:"Scarab",
+ enabled:true,
+ cost:{
+ mine:15,
+ time:70
+ },
+ spell:function(){
+ this.scarabNum++;
+ //Refresh to disabled
+ if (Game.selectedUnit==this) Button.refreshButtons();
+ }
+ },
+ Interceptor:{
+ name:"Interceptor",
+ enabled:true,
+ cost:{
+ mine:25,
+ time:200
+ },
+ spell:function(){
+ //Build interceptor
+ this.continuousAttack.count++;
+ //Refresh to disabled
+ if (Game.selectedUnit==this) Button.refreshButtons();
+ }
+ },
+ Recall:{
+ name:"Recall",
+ cost:{magic:150},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ var myself=this;
+ if (Resource.payCreditBill.call(myself)){
+ //Recall animation
+ var anime=new Animation.Recall({x:location.x,y:location.y,callback:function(){
+ //Get in range our units
+ var targets=Game.getInRangeOnes(location.x,location.y,50*1.2>>0,myself.team,true);
+ //Recall animation again
+ var animeII=new Animation.Recall({x:myself.posX(),y:myself.posY()});
+ //Recall sound
+ if (animeII.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Recall.wav').play();
+ //Effect
+ targets.forEach(function(chara){
+ //Relocate targets
+ chara.x=myself.x;
+ chara.y=myself.y;
+ });
+ }});
+ //Recall sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Recall.wav').play();
+ }
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ StasisField:{
+ name:"StasisField",
+ cost:{magic:100},
+ credit:true,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire StasisField
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //Spell StasisField animation
+ var anime=new Animation.StasisFieldSpell({x:location.x,y:location.y,callback:function(){
+ //Get in range units
+ var targets=Game.getInRangeOnes(location.x,location.y,64*1.2>>0,null,true);
+ //Effect:Freeze target
+ var bufferObj={
+ moveTo:function(){},
+ moveToward:function(){},
+ attack:function(){},
+ getDamageBy:function(){}
+ };
+ targets.forEach(function(target){
+ if (target.status!='dead'){
+ //Buffer flag
+ if (target.buffer.StasisField) return;//Not again
+ target.buffer.StasisField=true;
+ //Effect
+ target.dock();
+ if (target.stopAttack) target.stopAttack();
+ //Freeze target
+ target.addBuffer(bufferObj);
+ //Stasis status
+ target.stop();
+ //Stasis field animation
+ new Animation.StasisField({target:target,callback:function(){
+ //Restore in 30 seconds
+ if (target.status!='dead' && target.buffer.StasisField){
+ if (target.removeBuffer(bufferObj)) {
+ delete target.buffer.StasisField;
+ target.dock();
+ }
+ }
+ }});
+ }
+ });
+ }});
+ //StasisField sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.StasisField.wav').play();
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ DisruptionWeb:{
+ name:"DisruptionWeb",
+ cost:{magic:125},
+ credit:true,
+ _timer:false,
+ enabled:false,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ //Move toward target to fire DisruptionWeb
+ this.targetLock=true;
+ var myself=this;
+ this.moveTo(location.x,location.y,this.get('sight'),function(){
+ if (Resource.payCreditBill.call(myself)){
+ //DisruptionWeb animation
+ var anime=new Animation.DisruptionWeb({x:location.x,y:location.y});
+ //DisruptionWeb sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.DisruptionWeb.wav').play();
+ //Dynamic update targets every 1 second
+ var targets=[];
+ //Effect:Disable target attack
+ var bufferObj={
+ attack:function(){}
+ };
+ //Disruption web wave
+ var disruptionWeb=function(){
+ //Clear old units buffer
+ targets.forEach(function(chara){
+ chara.removeBuffer(bufferObj);
+ });
+ targets=[];
+ var disruptionWebs=Burst.allEffects.filter(function(effect){
+ return effect instanceof Animation.DisruptionWeb;
+ });
+ //Check if any disruption web exist
+ if (disruptionWebs.length) {
+ //Get targets inside all of webs
+ disruptionWebs.forEach(function(web){
+ //Update buffer on enemy ground units inside web
+ targets=targets.concat(Game.getInRangeOnes(web.posX(),web.posY(),[76*1.2>>0,56*1.2>>0],null,true,false));
+ });
+ $.unique(targets);
+ //Effect
+ targets.forEach(function(chara){
+ //Cannot attack
+ if (chara.attack) {
+ chara.stopAttack();
+ chara.addBuffer(bufferObj);
+ }
+ });
+ Game.commandTimeout(disruptionWeb,1000);
+ Magic.DisruptionWeb._timer=true;
+ }
+ else Magic.DisruptionWeb._timer=false;
+ };
+ //If not calculating, execute
+ if (!Magic.DisruptionWeb._timer) disruptionWeb();
+ }
+ });
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ RechargeShields:{
+ name:"RechargeShields",
+ enabled:true,
+ needLocation:true,
+ spell:function(location){
+ //Has location callback info or nothing
+ if (location){
+ var myself=this;
+ //Restore our units, have shield and in sight
+ var target=Game.getSelectedOne(location.x,location.y,this.team,true,null,function(chara){
+ return chara.SP && myself.canSee(chara);
+ });
+ if (target instanceof Gobj){
+ //Recharge shield animation
+ var anime=new Animation.RechargeShields({target:target});
+ //Recharge shield sound
+ if (anime.insideScreen()) new Audio(Game.CDN+'bgm/Magic.RechargeShields.wav').play();
+ var hurt=target.get('SP')-target.shield;
+ var needMagic=(hurt/2+0.5)>>0;
+ //Remaining magic is sufficient
+ if (this.magic>needMagic) {
+ //Full recover
+ target.shield=target.get('SP');
+ this.magic-=needMagic;
+ }
+ //Remaining magic is not enough
+ else {
+ //Use all remaining magic
+ target.shield+=(this.magic*2);
+ this.magic=0;
+ }
+ }
+ else {
+ //Cannot reach target, pError
+ }
+ }
+ //If missing location info, mark Button.callback, mouseController will call back with location
+ else {
+ Button.callback=arguments.callee;
+ Button.callback.owner=this;
+ $('div.GameLayer').attr('status','button');
+ }
+ }
+ },
+ /********RPG level: Tower Defense********/
+ CleanScreen:{
+ name:"CleanScreen",
+ cost:{
+ mine:200
+ },
+ spell:function(){
+ //Kill all enemies
+ Cheat.execute('fuck your mother');
+ }
+ }
+};
\ No newline at end of file
diff --git a/Characters/Map.js b/Characters/Map.js
index f26d6e4..a9db0d2 100644
--- a/Characters/Map.js
+++ b/Characters/Map.js
@@ -1,230 +1,229 @@
-var Map={
- currentMap:'Switchback',//By default
- ready:false,
- offsetX:0,
- offsetY:0,
- speed:40,
- triggerMargin:20,
- //To synchronize drawing map and units, will not refresh immediately
- needRefresh:false,
- fogFlag:true,
- fogUnits:[],//Units need to draw fog on screen
- allUnits:[],//Units need to draw fog on minimap
- batchSize:0,//Draw fog by each batch
- miniCxt:$('canvas[name="mini_map"]')[0].getContext('2d'),
- fogCanvas:document.createElement('canvas'),
- shadowCanvas:document.createElement('canvas'),//Pre-render for fog shadow
- insideStroke:{
- width:0,
- height:0
- },
- //Init map
- setCurrentMap:function(name){
- Map.currentMap=name;
- $('canvas[name="mini_map"]').attr('class',name);
- //Init inside stroke size
- Map.insideStroke.width=(130*Game.HBOUND/Map.getCurrentMap().width)>>0;
- Map.insideStroke.height=(130*Game.VBOUND/Map.getCurrentMap().height)>>0;
- //Init fog relative
- Map.fogCxt=Map.fogCanvas.getContext('2d');
- Map.fogCanvas.width=130;
- Map.fogCanvas.height=Math.round(130*Map.getCurrentMap().height/Map.getCurrentMap().width);
- Map.fogCanvas.ratio=130/Map.getCurrentMap().width;
- Map.shadowCanvas.width=Map.shadowCanvas.height=100;
- Map.shadowCxt=Map.shadowCanvas.getContext('2d');
- //Prepared fog shadow for quick render
- var radial=Map.shadowCxt.createRadialGradient(50,50,25,50,50,50);
- radial.addColorStop(0,'rgba(0,0,0,1)');
- radial.addColorStop(1,'rgba(0,0,0,0)');
- Map.shadowCxt.fillStyle=radial;
- Map.shadowCxt.beginPath();
- Map.shadowCxt.arc(50,50,50,0,Math.PI*2);
- Map.shadowCxt.fill();
- //Map is ready after current map set
- Map.ready=true;
- },
- getCurrentMap:function(){
- return sourceLoader.sources['Map_'+Map.currentMap];
- },
- //Draw interface call
- drawFogAndMinimap:function(){
- if (Map.fogFlag){
- Map.refreshFog();
- //Draw fog on main map
- var ratio=Map.fogCanvas.ratio;
- Game.fogCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
- Game.fogCxt.drawImage(Map.fogCanvas,Math.round(Map.offsetX*ratio),Math.round(Map.offsetY*ratio),
- Math.round(Game.HBOUND*ratio),Math.round(Game.VBOUND*ratio),0,0,Game.HBOUND,Game.VBOUND);
- }
- //Draw mini-map
- Map.drawMiniMap();
- },
- //Used by drawFogAndMinimap
- refreshFog:function(){
- //Reset composite operation
- Map.fogCxt.globalCompositeOperation='source-over';
- //Brush black fog to clean old fog
- Map.fogCxt.fillStyle='rgba(0,0,0,1)';
- Map.fogCxt.fillRect(0,0,Map.fogCanvas.width,Map.fogCanvas.height);
- //Other things have sight
- var parasitedEnemies=Unit.allEnemyUnits().filter(function(chara){
- return chara.buffer.Parasite==Game.team;
- });
- var scannerSweeps=Burst.allEffects.filter(function(anime){
- return anime.constructor.name=="ScannerSweep" && anime.team==Game.team;
- });
- var addInObjs=parasitedEnemies.concat(scannerSweeps);
- //Clear fog
- Map.fogCxt.globalCompositeOperation='destination-out';
- //Initial
- Map.allUnits=Unit.allOurUnits().concat(Building.ourBuildings()).concat(addInObjs);
- //Draw fog
- Map.fogCxt.fillStyle='rgba(0,0,0,1)';
- var ratio=Map.fogCanvas.ratio;
- Map.allUnits.forEach(function(chara){
- //Clear fog on screen for our units inside screen
- var centerX=Math.round(chara.posX()*ratio);
- var centerY=Math.round(chara.posY()*ratio);
- var radius=Math.round(chara.get('sight')*ratio<<1);
- Map.fogCxt.drawImage(Map.shadowCanvas,0,0,100,100,centerX-radius,centerY-radius,radius<<1,radius<<1);
- });
- },
- //Used by drawFogAndMinimap: draw red&green block and white stroke
- drawMiniMap:function(){
- //Selected map size
- var mapWidth=Map.getCurrentMap().width;
- var mapHeight=Map.getCurrentMap().height;
- //Clear mini-map
- Map.miniCxt.clearRect(0,0,130,130);
- //Re-draw mini-map points
- var miniX,miniY,rectSize;
- Building.allBuildings.concat(Unit.allUnits).forEach(function(chara){
- //Filter out invisible enemy
- if (chara['isInvisible'+Game.team] && chara.isEnemy()) return;
- miniX=(130*chara.x/mapWidth)>>0;
- miniY=(130*chara.y/mapHeight)>>0;
- Map.miniCxt.fillStyle=(chara.isEnemy())?'red':'lime';
- rectSize=(chara instanceof Building)?4:3;
- Map.miniCxt.fillRect(miniX,miniY,rectSize,rectSize);
- });
- //Draw fog on mini-map
- if (Map.fogFlag) Map.miniCxt.drawImage(Map.fogCanvas,0,0,Map.fogCanvas.width,Map.fogCanvas.height,0,0,130,130);
- //Re-draw inside stroke
- Map.miniCxt.strokeStyle='white';
- Map.miniCxt.lineWidth=2;
- Map.miniCxt.strokeRect((130*Map.offsetX/mapWidth)>>0,(130*Map.offsetY/mapHeight)>>0,Map.insideStroke.width,Map.insideStroke.height);
- },
- drawMud:function(){
- var _increments=[[0,1],[-1,0],[0,-1],[1,0]];
- var mudRadius=120;
- var mudIncrements=_$.mapTraverse(_increments,function(x){
- return x*mudRadius/2;
- });
- Game.backCxt.save();
- Game.backCxt.beginPath();
- //Create fill style for mud
- var mudPattern=Game.backCxt.createPattern(sourceLoader.sources['Mud'],"repeat");
- Game.backCxt.fillStyle=mudPattern;
- Building.allBuildings.filter(function(chara){
- return (chara instanceof Building.ZergBuilding) && !chara.noMud && chara.insideScreen();
- }).forEach(function(chara){
- var centerX=chara.posX()-Map.offsetX;
- var centerY=chara.posY()-Map.offsetY;
- var pos=[centerX+mudRadius,centerY-mudRadius];
- Game.backCxt.moveTo(pos[0],pos[1]);
- for(var M=0,angle=-Math.PI/4;M<4;M++,angle+=Math.PI/2){
- for(var N=0;N<5;N++){
- Game.backCxt.arc(pos[0],pos[1],mudRadius/4,angle,angle+Math.PI/2);
- if (N<4) {
- pos[0]+=mudIncrements[M][0];
- pos[1]+=mudIncrements[M][1];
+var Map = (function () {
+ function Map() {
+ this.miniCxt = ('canvas[name="mini_map"]')[0].getContext('2d');
+ this.fogCanvas = ('canvas');
+ this.shadowCanvas = ('canvas');
+ //Init map
+ this.setCurrentMap = function (name) {
+ Map.currentMap = name;
+ $('canvas[name="mini_map"]').attr('class', name);
+ //Init inside stroke size
+ Map.insideStroke.width = (130 * Game.HBOUND / Map.getCurrentMap().width) >> 0;
+ Map.insideStroke.height = (130 * Game.VBOUND / Map.getCurrentMap().height) >> 0;
+ //Init fog relative
+ Map.fogCxt = Map.fogCanvas.getContext('2d');
+ Map.fogCanvas.width = 130;
+ Map.fogCanvas.height = Math.round(130 * Map.getCurrentMap().height / Map.getCurrentMap().width);
+ Map.fogCanvas.ratio = 130 / Map.getCurrentMap().width;
+ Map.shadowCanvas.width = Map.shadowCanvas.height = 100;
+ Map.shadowCxt = Map.shadowCanvas.getContext('2d');
+ //Prepared fog shadow for quick render
+ var radial = Map.shadowCxt.createRadialGradient(50, 50, 25, 50, 50, 50);
+ radial.addColorStop(0, 'rgba(0,0,0,1)');
+ radial.addColorStop(1, 'rgba(0,0,0,0)');
+ Map.shadowCxt.fillStyle = radial;
+ Map.shadowCxt.beginPath();
+ Map.shadowCxt.arc(50, 50, 50, 0, Math.PI * 2);
+ Map.shadowCxt.fill();
+ //Map is ready after current map set
+ Map.ready = true;
+ };
+ this.getCurrentMap = function () {
+ return sourceLoader.sources['Map_' + Map.currentMap];
+ };
+ //Draw interface call
+ this.drawFogAndMinimap = function () {
+ if (Map.fogFlag) {
+ Map.refreshFog();
+ //Draw fog on main map
+ var ratio = Map.fogCanvas.ratio;
+ Game.fogCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
+ Game.fogCxt.drawImage(Map.fogCanvas, Math.round(Map.offsetX * ratio), Math.round(Map.offsetY * ratio), Math.round(Game.HBOUND * ratio), Math.round(Game.VBOUND * ratio), 0, 0, Game.HBOUND, Game.VBOUND);
+ }
+ //Draw mini-map
+ Map.drawMiniMap();
+ };
+ //Used by drawFogAndMinimap
+ this.refreshFog = function () {
+ //Reset composite operation
+ Map.fogCxt.globalCompositeOperation = 'source-over';
+ //Brush black fog to clean old fog
+ Map.fogCxt.fillStyle = 'rgba(0,0,0,1)';
+ Map.fogCxt.fillRect(0, 0, Map.fogCanvas.width, Map.fogCanvas.height);
+ //Other things have sight
+ var parasitedEnemies = Unit.allEnemyUnits().filter(function (chara) {
+ return chara.buffer.Parasite == Game.team;
+ });
+ var scannerSweeps = Burst.allEffects.filter(function (anime) {
+ return anime.constructor.name == "ScannerSweep" && anime.team == Game.team;
+ });
+ var addInObjs = parasitedEnemies.concat(scannerSweeps);
+ //Clear fog
+ Map.fogCxt.globalCompositeOperation = 'destination-out';
+ //Initial
+ Map.allUnits = Unit.allOurUnits().concat(Building.ourBuildings()).concat(addInObjs);
+ //Draw fog
+ Map.fogCxt.fillStyle = 'rgba(0,0,0,1)';
+ var ratio = Map.fogCanvas.ratio;
+ Map.allUnits.forEach(function (chara) {
+ //Clear fog on screen for our units inside screen
+ var centerX = Math.round(chara.posX() * ratio);
+ var centerY = Math.round(chara.posY() * ratio);
+ var radius = Math.round(chara.get('sight') * ratio << 1);
+ Map.fogCxt.drawImage(Map.shadowCanvas, 0, 0, 100, 100, centerX - radius, centerY - radius, radius << 1, radius << 1);
+ });
+ };
+ //Used by drawFogAndMinimap: draw red&green block and white stroke
+ this.drawMiniMap = function () {
+ //Selected map size
+ var mapWidth = Map.getCurrentMap().width;
+ var mapHeight = Map.getCurrentMap().height;
+ //Clear mini-map
+ Map.miniCxt.clearRect(0, 0, 130, 130);
+ //Re-draw mini-map points
+ var miniX, miniY, rectSize;
+ Building.allBuildings.concat(Unit.allUnits).forEach(function (chara) {
+ //Filter out invisible enemy
+ if (chara['isInvisible' + Game.team] && chara.isEnemy())
+ return;
+ miniX = (130 * chara.x / mapWidth) >> 0;
+ miniY = (130 * chara.y / mapHeight) >> 0;
+ Map.miniCxt.fillStyle = (chara.isEnemy()) ? 'red' : 'lime';
+ rectSize = (chara instanceof Building) ? 4 : 3;
+ Map.miniCxt.fillRect(miniX, miniY, rectSize, rectSize);
+ });
+ //Draw fog on mini-map
+ if (Map.fogFlag)
+ Map.miniCxt.drawImage(Map.fogCanvas, 0, 0, Map.fogCanvas.width, Map.fogCanvas.height, 0, 0, 130, 130);
+ //Re-draw inside stroke
+ Map.miniCxt.strokeStyle = 'white';
+ Map.miniCxt.lineWidth = 2;
+ Map.miniCxt.strokeRect((130 * Map.offsetX / mapWidth) >> 0, (130 * Map.offsetY / mapHeight) >> 0, Map.insideStroke.width, Map.insideStroke.height);
+ };
+ this.drawMud = function () {
+ var _increments = [[0, 1], [-1, 0], [0, -1], [1, 0]];
+ var mudRadius = 120;
+ var mudIncrements = _$.mapTraverse(_increments, function (x) {
+ return x * mudRadius / 2;
+ });
+ Game.backCxt.save();
+ Game.backCxt.beginPath();
+ //Create fill style for mud
+ var mudPattern = Game.backCxt.createPattern(sourceLoader.sources['Mud'], "repeat");
+ Game.backCxt.fillStyle = mudPattern;
+ Building.allBuildings.filter(function (chara) {
+ return (chara instanceof Building.ZergBuilding) && !chara.noMud && chara.insideScreen();
+ }).forEach(function (chara) {
+ var centerX = chara.posX() - Map.offsetX;
+ var centerY = chara.posY() - Map.offsetY;
+ var pos = [centerX + mudRadius, centerY - mudRadius];
+ Game.backCxt.moveTo(pos[0], pos[1]);
+ for (var M = 0, angle = -Math.PI / 4; M < 4; M++, angle += Math.PI / 2) {
+ for (var N = 0; N < 5; N++) {
+ Game.backCxt.arc(pos[0], pos[1], mudRadius / 4, angle, angle + Math.PI / 2);
+ if (N < 4) {
+ pos[0] += mudIncrements[M][0];
+ pos[1] += mudIncrements[M][1];
+ }
}
}
+ });
+ //Stroke edge clearly
+ Game.backCxt.strokeStyle = "#212";
+ Game.backCxt.lineWidth = 3;
+ Game.backCxt.stroke();
+ //Fill mud
+ Game.backCxt.fill();
+ Game.backCxt.restore();
+ };
+ this.drawBg = function () {
+ //Clear background
+ Game.backCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
+ //Draw map as background
+ Game.backCxt.drawImage(Map.getCurrentMap(), Map.offsetX, Map.offsetY, Game.HBOUND, Game.VBOUND - Game.infoBox.height + 5, 0, 0, Game.HBOUND, Game.VBOUND - Game.infoBox.height + 5);
+ //Draw mud for ZergBuildings
+ Map.drawMud();
+ };
+ this.refresh = function (direction) {
+ var edgeX = Map.getCurrentMap().width - Game.HBOUND;
+ var edgeY = Map.getCurrentMap().height - Game.VBOUND + Game.infoBox.height - 5;
+ var onlyMap;
+ switch (direction) {
+ case "LEFT":
+ Map.offsetX -= Map.speed;
+ if (Map.offsetX < 0)
+ Map.offsetX = 0;
+ break;
+ case "RIGHT":
+ Map.offsetX += Map.speed;
+ if (Map.offsetX > edgeX)
+ Map.offsetX = edgeX;
+ break;
+ case "TOP":
+ Map.offsetY -= Map.speed;
+ if (Map.offsetY < 0)
+ Map.offsetY = 0;
+ break;
+ case "BOTTOM":
+ Map.offsetY += Map.speed;
+ if (Map.offsetY > edgeY)
+ Map.offsetY = edgeY;
+ break;
+ case "MAP":
+ onlyMap = true;
+ break;
}
- });
- //Stroke edge clearly
- Game.backCxt.strokeStyle="#212";
- Game.backCxt.lineWidth=3;
- Game.backCxt.stroke();
- //Fill mud
- Game.backCxt.fill();
- Game.backCxt.restore();
- },
- drawBg:function(){
- //Clear background
- Game.backCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
- //Draw map as background
- Game.backCxt.drawImage(Map.getCurrentMap(),Map.offsetX,Map.offsetY,Game.HBOUND,Game.VBOUND-Game.infoBox.height+5,
- 0,0,Game.HBOUND,Game.VBOUND-Game.infoBox.height+5);
- //Draw mud for ZergBuildings
- Map.drawMud();
- },
- refresh:function(direction){
- var edgeX=Map.getCurrentMap().width-Game.HBOUND;
- var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
- var onlyMap;
- switch (direction){
- case "LEFT":
- Map.offsetX-=Map.speed;
- if (Map.offsetX<0) Map.offsetX=0;
- break;
- case "RIGHT":
- Map.offsetX+=Map.speed;
- if (Map.offsetX>edgeX) Map.offsetX=edgeX;
- break;
- case "TOP":
- Map.offsetY-=Map.speed;
- if (Map.offsetY<0) Map.offsetY=0;
- break;
- case "BOTTOM":
- Map.offsetY+=Map.speed;
- if (Map.offsetY>edgeY) Map.offsetY=edgeY;
- break;
- case "MAP":
- onlyMap=true;
- break;
- }
- Map.drawBg();
- //Need re-calculate fog when screen moves
- if (!onlyMap) Map.drawFogAndMinimap();
- },
- clickHandler:function(event){
- //Mouse at (clickX,clickY)
- var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
- var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
- //Relocate map center
- Map.relocateAt(Map.getCurrentMap().width*clickX/130,Map.getCurrentMap().height*clickY/130);
- },
- dblClickHandler:function(event){
- //Mouse at (clickX,clickY)
- var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
- var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
- //Map (clickX,clickY) to position (mapX,mapY) on map
- var mapX=Map.getCurrentMap().width*clickX/130;
- var mapY=Map.getCurrentMap().height*clickY/130;
- //Move selected units to (mapX,mapY)
- Unit.allUnits.filter(function(chara){
- return (chara.team==Game.team) && chara.selected;
- }).forEach(function(chara){
- if (chara.attack) chara.stopAttack();
- chara.targetLock=true;
- chara.moveTo(mapX,mapY);
- });
- },
- relocateAt:function(centerX,centerY){
- //Get map edge
- var edgeX=Map.getCurrentMap().width-Game.HBOUND;
- var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
- //Map (centerX,centerY) to position (offsetX,offsetY) on top-left in map
- var offsetX=(centerX-Game.HBOUND/2)>>0;
- if (offsetX<0) offsetX=0;
- if (offsetX>edgeX) offsetX=edgeX;
- var offsetY=(centerY-(Game.VBOUND-Game.infoBox.height+5)/2)>>0;
- if (offsetY<0) offsetY=0;
- if (offsetY>edgeY) offsetY=edgeY;
- //Relocate map
- Map.offsetX=offsetX;
- Map.offsetY=offsetY;
- Map.needRefresh=true;//For synchronize
+ Map.drawBg();
+ //Need re-calculate fog when screen moves
+ if (!onlyMap)
+ Map.drawFogAndMinimap();
+ };
+ this.clickHandler = function (event) {
+ //Mouse at (clickX,clickY)
+ var clickX = event.pageX - $('canvas[name="mini_map"]').offset().left;
+ var clickY = event.pageY - $('canvas[name="mini_map"]').offset().top;
+ //Relocate map center
+ Map.relocateAt(Map.getCurrentMap().width * clickX / 130, Map.getCurrentMap().height * clickY / 130);
+ };
+ this.dblClickHandler = function (event) {
+ //Mouse at (clickX,clickY)
+ var clickX = event.pageX - $('canvas[name="mini_map"]').offset().left;
+ var clickY = event.pageY - $('canvas[name="mini_map"]').offset().top;
+ //Map (clickX,clickY) to position (mapX,mapY) on map
+ var mapX = Map.getCurrentMap().width * clickX / 130;
+ var mapY = Map.getCurrentMap().height * clickY / 130;
+ //Move selected units to (mapX,mapY)
+ Unit.allUnits.filter(function (chara) {
+ return (chara.team == Game.team) && chara.selected;
+ }).forEach(function (chara) {
+ if (chara.attack)
+ chara.stopAttack();
+ chara.targetLock = true;
+ chara.moveTo(mapX, mapY);
+ });
+ };
+ this.relocateAt = function (centerX, centerY) {
+ //Get map edge
+ var edgeX = Map.getCurrentMap().width - Game.HBOUND;
+ var edgeY = Map.getCurrentMap().height - Game.VBOUND + Game.infoBox.height - 5;
+ //Map (centerX,centerY) to position (offsetX,offsetY) on top-left in map
+ var offsetX = (centerX - Game.HBOUND / 2) >> 0;
+ if (offsetX < 0)
+ offsetX = 0;
+ if (offsetX > edgeX)
+ offsetX = edgeX;
+ var offsetY = (centerY - (Game.VBOUND - Game.infoBox.height + 5) / 2) >> 0;
+ if (offsetY < 0)
+ offsetY = 0;
+ if (offsetY > edgeY)
+ offsetY = edgeY;
+ //Relocate map
+ Map.offsetX = offsetX;
+ Map.offsetY = offsetY;
+ Map.needRefresh = true; //For synchronize
+ };
}
-};
\ No newline at end of file
+ return Map;
+}());
+;
+//# sourceMappingURL=Map.js.map
\ No newline at end of file
diff --git a/Characters/Map.ts b/Characters/Map.ts
new file mode 100644
index 0000000..74273d2
--- /dev/null
+++ b/Characters/Map.ts
@@ -0,0 +1,230 @@
+class Map {
+ currentMap:'Switchback',//By default
+ ready:false,
+ offsetX:0,
+ offsetY:0,
+ speed:40,
+ triggerMargin:20,
+ //To synchronize drawing map and units, will not refresh immediately
+ needRefresh:false,
+ fogFlag:true,
+ fogUnits:[],//Units need to draw fog on screen
+ allUnits:[],//Units need to draw fog on minimap
+ batchSize:0,//Draw fog by each batch
+ miniCxt:$('canvas[name="mini_map"]')[0].getContext('2d'),
+ fogCanvas:document.createElement('canvas'),
+ shadowCanvas:document.createElement('canvas'),//Pre-render for fog shadow
+ insideStroke:{
+ width:0,
+ height:0
+ },
+ //Init map
+ setCurrentMap:function(name){
+ Map.currentMap=name;
+ $('canvas[name="mini_map"]').attr('class',name);
+ //Init inside stroke size
+ Map.insideStroke.width=(130*Game.HBOUND/Map.getCurrentMap().width)>>0;
+ Map.insideStroke.height=(130*Game.VBOUND/Map.getCurrentMap().height)>>0;
+ //Init fog relative
+ Map.fogCxt=Map.fogCanvas.getContext('2d');
+ Map.fogCanvas.width=130;
+ Map.fogCanvas.height=Math.round(130*Map.getCurrentMap().height/Map.getCurrentMap().width);
+ Map.fogCanvas.ratio=130/Map.getCurrentMap().width;
+ Map.shadowCanvas.width=Map.shadowCanvas.height=100;
+ Map.shadowCxt=Map.shadowCanvas.getContext('2d');
+ //Prepared fog shadow for quick render
+ var radial=Map.shadowCxt.createRadialGradient(50,50,25,50,50,50);
+ radial.addColorStop(0,'rgba(0,0,0,1)');
+ radial.addColorStop(1,'rgba(0,0,0,0)');
+ Map.shadowCxt.fillStyle=radial;
+ Map.shadowCxt.beginPath();
+ Map.shadowCxt.arc(50,50,50,0,Math.PI*2);
+ Map.shadowCxt.fill();
+ //Map is ready after current map set
+ Map.ready=true;
+ },
+ getCurrentMap:function(){
+ return sourceLoader.sources['Map_'+Map.currentMap];
+ },
+ //Draw interface call
+ drawFogAndMinimap:function(){
+ if (Map.fogFlag){
+ Map.refreshFog();
+ //Draw fog on main map
+ var ratio=Map.fogCanvas.ratio;
+ Game.fogCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
+ Game.fogCxt.drawImage(Map.fogCanvas,Math.round(Map.offsetX*ratio),Math.round(Map.offsetY*ratio),
+ Math.round(Game.HBOUND*ratio),Math.round(Game.VBOUND*ratio),0,0,Game.HBOUND,Game.VBOUND);
+ }
+ //Draw mini-map
+ Map.drawMiniMap();
+ },
+ //Used by drawFogAndMinimap
+ refreshFog:function(){
+ //Reset composite operation
+ Map.fogCxt.globalCompositeOperation='source-over';
+ //Brush black fog to clean old fog
+ Map.fogCxt.fillStyle='rgba(0,0,0,1)';
+ Map.fogCxt.fillRect(0,0,Map.fogCanvas.width,Map.fogCanvas.height);
+ //Other things have sight
+ var parasitedEnemies=Unit.allEnemyUnits().filter(function(chara){
+ return chara.buffer.Parasite==Game.team;
+ });
+ var scannerSweeps=Burst.allEffects.filter(function(anime){
+ return anime.constructor.name=="ScannerSweep" && anime.team==Game.team;
+ });
+ var addInObjs=parasitedEnemies.concat(scannerSweeps);
+ //Clear fog
+ Map.fogCxt.globalCompositeOperation='destination-out';
+ //Initial
+ Map.allUnits=Unit.allOurUnits().concat(Building.ourBuildings()).concat(addInObjs);
+ //Draw fog
+ Map.fogCxt.fillStyle='rgba(0,0,0,1)';
+ var ratio=Map.fogCanvas.ratio;
+ Map.allUnits.forEach(function(chara){
+ //Clear fog on screen for our units inside screen
+ var centerX=Math.round(chara.posX()*ratio);
+ var centerY=Math.round(chara.posY()*ratio);
+ var radius=Math.round(chara.get('sight')*ratio<<1);
+ Map.fogCxt.drawImage(Map.shadowCanvas,0,0,100,100,centerX-radius,centerY-radius,radius<<1,radius<<1);
+ });
+ },
+ //Used by drawFogAndMinimap: draw red&green block and white stroke
+ drawMiniMap:function(){
+ //Selected map size
+ var mapWidth=Map.getCurrentMap().width;
+ var mapHeight=Map.getCurrentMap().height;
+ //Clear mini-map
+ Map.miniCxt.clearRect(0,0,130,130);
+ //Re-draw mini-map points
+ var miniX,miniY,rectSize;
+ Building.allBuildings.concat(Unit.allUnits).forEach(function(chara){
+ //Filter out invisible enemy
+ if (chara['isInvisible'+Game.team] && chara.isEnemy()) return;
+ miniX=(130*chara.x/mapWidth)>>0;
+ miniY=(130*chara.y/mapHeight)>>0;
+ Map.miniCxt.fillStyle=(chara.isEnemy())?'red':'lime';
+ rectSize=(chara instanceof Building)?4:3;
+ Map.miniCxt.fillRect(miniX,miniY,rectSize,rectSize);
+ });
+ //Draw fog on mini-map
+ if (Map.fogFlag) Map.miniCxt.drawImage(Map.fogCanvas,0,0,Map.fogCanvas.width,Map.fogCanvas.height,0,0,130,130);
+ //Re-draw inside stroke
+ Map.miniCxt.strokeStyle='white';
+ Map.miniCxt.lineWidth=2;
+ Map.miniCxt.strokeRect((130*Map.offsetX/mapWidth)>>0,(130*Map.offsetY/mapHeight)>>0,Map.insideStroke.width,Map.insideStroke.height);
+ },
+ drawMud:function(){
+ var _increments=[[0,1],[-1,0],[0,-1],[1,0]];
+ var mudRadius=120;
+ var mudIncrements=_$.mapTraverse(_increments,function(x){
+ return x*mudRadius/2;
+ });
+ Game.backCxt.save();
+ Game.backCxt.beginPath();
+ //Create fill style for mud
+ var mudPattern=Game.backCxt.createPattern(sourceLoader.sources['Mud'],"repeat");
+ Game.backCxt.fillStyle=mudPattern;
+ Building.allBuildings.filter(function(chara){
+ return (chara instanceof Building.ZergBuilding) && !chara.noMud && chara.insideScreen();
+ }).forEach(function(chara){
+ var centerX=chara.posX()-Map.offsetX;
+ var centerY=chara.posY()-Map.offsetY;
+ var pos=[centerX+mudRadius,centerY-mudRadius];
+ Game.backCxt.moveTo(pos[0],pos[1]);
+ for(var M=0,angle=-Math.PI/4;M<4;M++,angle+=Math.PI/2){
+ for(var N=0;N<5;N++){
+ Game.backCxt.arc(pos[0],pos[1],mudRadius/4,angle,angle+Math.PI/2);
+ if (N<4) {
+ pos[0]+=mudIncrements[M][0];
+ pos[1]+=mudIncrements[M][1];
+ }
+ }
+ }
+ });
+ //Stroke edge clearly
+ Game.backCxt.strokeStyle="#212";
+ Game.backCxt.lineWidth=3;
+ Game.backCxt.stroke();
+ //Fill mud
+ Game.backCxt.fill();
+ Game.backCxt.restore();
+ },
+ drawBg:function(){
+ //Clear background
+ Game.backCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
+ //Draw map as background
+ Game.backCxt.drawImage(Map.getCurrentMap(),Map.offsetX,Map.offsetY,Game.HBOUND,Game.VBOUND-Game.infoBox.height+5,
+ 0,0,Game.HBOUND,Game.VBOUND-Game.infoBox.height+5);
+ //Draw mud for ZergBuildings
+ Map.drawMud();
+ },
+ refresh:function(direction){
+ var edgeX=Map.getCurrentMap().width-Game.HBOUND;
+ var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
+ var onlyMap;
+ switch (direction){
+ case "LEFT":
+ Map.offsetX-=Map.speed;
+ if (Map.offsetX<0) Map.offsetX=0;
+ break;
+ case "RIGHT":
+ Map.offsetX+=Map.speed;
+ if (Map.offsetX>edgeX) Map.offsetX=edgeX;
+ break;
+ case "TOP":
+ Map.offsetY-=Map.speed;
+ if (Map.offsetY<0) Map.offsetY=0;
+ break;
+ case "BOTTOM":
+ Map.offsetY+=Map.speed;
+ if (Map.offsetY>edgeY) Map.offsetY=edgeY;
+ break;
+ case "MAP":
+ onlyMap=true;
+ break;
+ }
+ Map.drawBg();
+ //Need re-calculate fog when screen moves
+ if (!onlyMap) Map.drawFogAndMinimap();
+ },
+ clickHandler:function(event){
+ //Mouse at (clickX,clickY)
+ var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
+ var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
+ //Relocate map center
+ Map.relocateAt(Map.getCurrentMap().width*clickX/130,Map.getCurrentMap().height*clickY/130);
+ },
+ dblClickHandler:function(event){
+ //Mouse at (clickX,clickY)
+ var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
+ var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
+ //Map (clickX,clickY) to position (mapX,mapY) on map
+ var mapX=Map.getCurrentMap().width*clickX/130;
+ var mapY=Map.getCurrentMap().height*clickY/130;
+ //Move selected units to (mapX,mapY)
+ Unit.allUnits.filter(function(chara){
+ return (chara.team==Game.team) && chara.selected;
+ }).forEach(function(chara){
+ if (chara.attack) chara.stopAttack();
+ chara.targetLock=true;
+ chara.moveTo(mapX,mapY);
+ });
+ },
+ relocateAt:function(centerX,centerY){
+ //Get map edge
+ var edgeX=Map.getCurrentMap().width-Game.HBOUND;
+ var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
+ //Map (centerX,centerY) to position (offsetX,offsetY) on top-left in map
+ var offsetX=(centerX-Game.HBOUND/2)>>0;
+ if (offsetX<0) offsetX=0;
+ if (offsetX>edgeX) offsetX=edgeX;
+ var offsetY=(centerY-(Game.VBOUND-Game.infoBox.height+5)/2)>>0;
+ if (offsetY<0) offsetY=0;
+ if (offsetY>edgeY) offsetY=edgeY;
+ //Relocate map
+ Map.offsetX=offsetX;
+ Map.offsetY=offsetY;
+ Map.needRefresh=true;//For synchronize
+ }
+};
\ No newline at end of file
diff --git a/Characters/Neutral.js b/Characters/Neutral.js
index 6750bae..e3279b7 100644
--- a/Characters/Neutral.js
+++ b/Characters/Neutral.js
@@ -1,9 +1,9 @@
/******* Define Neutral units *******/
-var Neutral={};
-Neutral.Ragnasaur=Unit.extends({
- constructorPlus:function(props){
+var Neutral = {};
+Neutral.Ragnasaur = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
+ this.imgPos.dock = this.imgPos.moving;
},
prototypePlus: {
//Add basic unit info
@@ -11,53 +11,53 @@ Neutral.Ragnasaur=Unit.extends({
imgPos: {
moving: {
left: [
- [26,26,26,26,26,26,26,26,26],[130,130,130,130,130,130,130,130,130],
- [234,234,234,234,234,234,234,234,234],[338,338,338,338,338,338,338,338,338],
- [442,442,442,442,442,442,442,442,442],[546,546,546,546,546,546,546,546,546],
- [650,650,650,650,650,650,650,650,650],[754,754,754,754,754,754,754,754,754],
- [858,858,858,858,858,858,858,858,858],[1066,1066,1066,1066,1066,1066,1066,1066,1066],
- [1170,1170,1170,1170,1170,1170,1170,1170,1170],[1274,1274,1274,1274,1274,1274,1274,1274,1274],
- [1378,1378,1378,1378,1378,1378,1378,1378,1378],[1482,1482,1482,1482,1482,1482,1482,1482,1482],
- [1586,1586,1586,1586,1586,1586,1586,1586,1586],[1690,1690,1690,1690,1690,1690,1690,1690,1690]
+ [26, 26, 26, 26, 26, 26, 26, 26, 26], [130, 130, 130, 130, 130, 130, 130, 130, 130],
+ [234, 234, 234, 234, 234, 234, 234, 234, 234], [338, 338, 338, 338, 338, 338, 338, 338, 338],
+ [442, 442, 442, 442, 442, 442, 442, 442, 442], [546, 546, 546, 546, 546, 546, 546, 546, 546],
+ [650, 650, 650, 650, 650, 650, 650, 650, 650], [754, 754, 754, 754, 754, 754, 754, 754, 754],
+ [858, 858, 858, 858, 858, 858, 858, 858, 858], [1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066],
+ [1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170], [1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274],
+ [1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378], [1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482],
+ [1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586], [1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690]
],
top: [
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
- [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858]
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858]
]
}
},
- width: 52,//104N+26
+ width: 52,
height: 52,
frame: {
moving: 9,
dock: 1
},
//Only for moving status, override
- speed:6,
+ speed: 6,
HP: 60,
- armor:0,
- sight:175,
- dieEffect:Burst.RagnasaurDeath,
- isFlying:false,
- unitType:Unit.SMALL,
- recover:Building.ZergBuilding.prototype.recover,
+ armor: 0,
+ sight: 175,
+ dieEffect: Burst.RagnasaurDeath,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ recover: Building.ZergBuilding.prototype.recover,
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.walkAround.call(this);
}
}
});
-Neutral.Rhynsdon=Unit.extends({
- constructorPlus:function(props){
+Neutral.Rhynsdon = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
+ this.imgPos.dock = this.imgPos.moving;
},
prototypePlus: {
//Add basic unit info
@@ -65,53 +65,53 @@ Neutral.Rhynsdon=Unit.extends({
imgPos: {
moving: {
left: [
- [26,26,26,26,26,26,26,26,26,26,26],[130,130,130,130,130,130,130,130,130,130,130],
- [234,234,234,234,234,234,234,234,234,234,234],[338,338,338,338,338,338,338,338,338,338,338],
- [442,442,442,442,442,442,442,442,442,442,442],[546,546,546,546,546,546,546,546,546,546,546],
- [650,650,650,650,650,650,650,650,650,650,650],[754,754,754,754,754,754,754,754,754,754,754],
- [858,858,858,858,858,858,858,858,858,858,858],[1066,1066,1066,1066,1066,1066,1066,1066,1066,1066,1066],
- [1170,1170,1170,1170,1170,1170,1170,1170,1170,1170,1170],[1274,1274,1274,1274,1274,1274,1274,1274,1274,1274,1274],
- [1378,1378,1378,1378,1378,1378,1378,1378,1378,1378,1378],[1482,1482,1482,1482,1482,1482,1482,1482,1482,1482,1482],
- [1586,1586,1586,1586,1586,1586,1586,1586,1586,1586,1586],[1690,1690,1690,1690,1690,1690,1690,1690,1690,1690,1690]
+ [26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26], [130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130],
+ [234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234], [338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338],
+ [442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 442], [546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546],
+ [650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650], [754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754],
+ [858, 858, 858, 858, 858, 858, 858, 858, 858, 858, 858], [1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066],
+ [1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170], [1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274],
+ [1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378], [1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482],
+ [1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586], [1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690]
],
top: [
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
- [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066]
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
+ [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066]
]
}
},
- width: 52,//104N+26
+ width: 52,
height: 52,
frame: {
moving: 11,
dock: 1
},
//Only for moving status, override
- speed:6,
+ speed: 6,
HP: 60,
- armor:0,
- sight:175,
- dieEffect:Burst.RhynsdonDeath,
- isFlying:false,
- unitType:Unit.SMALL,
- recover:Building.ZergBuilding.prototype.recover,
+ armor: 0,
+ sight: 175,
+ dieEffect: Burst.RhynsdonDeath,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ recover: Building.ZergBuilding.prototype.recover,
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.walkAround.call(this);
}
}
});
-Neutral.Ursadon=Unit.extends({
- constructorPlus:function(props){
+Neutral.Ursadon = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
+ this.imgPos.dock = this.imgPos.moving;
},
prototypePlus: {
//Add basic unit info
@@ -119,53 +119,53 @@ Neutral.Ursadon=Unit.extends({
imgPos: {
moving: {
left: [
- [15,15,15,15,15,15,15,15],[107,107,107,107,107,107,107,107],
- [199,199,199,199,199,199,199,199],[291,291,291,291,291,291,291,291],
- [383,383,383,383,383,383,383,383],[475,475,475,475,475,475,475,475],
- [567,567,567,567,567,567,567,567],[659,659,659,659,659,659,659,659],
- [751,751,751,751,751,751,751,751],[935,935,935,935,935,935,935,935],
- [1027,1027,1027,1027,1027,1027,1027,1027],[1119,1119,1119,1119,1119,1119,1119,1119],
- [1211,1211,1211,1211,1211,1211,1211,1211],[1303,1303,1303,1303,1303,1303,1303,1303],
- [1395,1395,1395,1395,1395,1395,1395,1395],[1487,1487,1487,1487,1487,1487,1487,1487]
+ [15, 15, 15, 15, 15, 15, 15, 15], [107, 107, 107, 107, 107, 107, 107, 107],
+ [199, 199, 199, 199, 199, 199, 199, 199], [291, 291, 291, 291, 291, 291, 291, 291],
+ [383, 383, 383, 383, 383, 383, 383, 383], [475, 475, 475, 475, 475, 475, 475, 475],
+ [567, 567, 567, 567, 567, 567, 567, 567], [659, 659, 659, 659, 659, 659, 659, 659],
+ [751, 751, 751, 751, 751, 751, 751, 751], [935, 935, 935, 935, 935, 935, 935, 935],
+ [1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027], [1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119],
+ [1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211], [1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303],
+ [1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395], [1487, 1487, 1487, 1487, 1487, 1487, 1487, 1487]
],
top: [
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
- [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659]
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
+ [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659]
]
}
},
- width: 62,//92N+15
+ width: 62,
height: 62,
frame: {
moving: 8,
dock: 1
},
//Only for moving status, override
- speed:6,
+ speed: 6,
HP: 60,
- armor:0,
- sight:175,
- dieEffect:Burst.UrsadonDeath,
- isFlying:false,
- unitType:Unit.SMALL,
- recover:Building.ZergBuilding.prototype.recover,
+ armor: 0,
+ sight: 175,
+ dieEffect: Burst.UrsadonDeath,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ recover: Building.ZergBuilding.prototype.recover,
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.walkAround.call(this);
}
}
});
-Neutral.Bengalaas=Unit.extends({
- constructorPlus:function(props){
+Neutral.Bengalaas = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
+ this.imgPos.dock = this.imgPos.moving;
},
prototypePlus: {
//Add basic unit info
@@ -173,53 +173,53 @@ Neutral.Bengalaas=Unit.extends({
imgPos: {
moving: {
left: [
- [38,38,38,38,38,38,38,38,38,38,38,38],[166,166,166,166,166,166,166,166,166,166,166,166],
- [294,294,294,294,294,294,294,294,294,294,294,294],[422,422,422,422,422,422,422,422,422,422,422,422],
- [550,550,550,550,550,550,550,550,550,550,550,550],[678,678,678,678,678,678,678,678,678,678,678,678],
- [806,806,806,806,806,806,806,806,806,806,806,806],[934,934,934,934,934,934,934,934,934,934,934,934],
- [1062,1062,1062,1062,1062,1062,1062,1062,1062,1062,1062,1062],[1318,1318,1318,1318,1318,1318,1318,1318,1318,1318,1318,1318],
- [1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446],[1574,1574,1574,1574,1574,1574,1574,1574,1574,1574,1574,1574],
- [1702,1702,1702,1702,1702,1702,1702,1702,1702,1702,1702,1702],[1830,1830,1830,1830,1830,1830,1830,1830,1830,1830,1830,1830],
- [1958,1958,1958,1958,1958,1958,1958,1958,1958,1958,1958,1958],[2086,2086,2086,2086,2086,2086,2086,2086,2086,2086,2086,2086]
+ [38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38], [166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166],
+ [294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294], [422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422],
+ [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550], [678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678],
+ [806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806], [934, 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, 934],
+ [1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062], [1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318],
+ [1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446], [1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574],
+ [1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702], [1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830],
+ [1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958], [2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086]
],
top: [
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
- [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446]
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
+ [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446]
]
}
},
width: 52,
- height: 52,//128N+38
+ height: 52,
frame: {
moving: 12,
dock: 1
},
//Only for moving status, override
- speed:6,
+ speed: 6,
HP: 60,
- armor:0,
- sight:175,
- dieEffect:Burst.BengalaasDeath,
- isFlying:false,
- unitType:Unit.SMALL,
- recover:Building.ZergBuilding.prototype.recover,
+ armor: 0,
+ sight: 175,
+ dieEffect: Burst.BengalaasDeath,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ recover: Building.ZergBuilding.prototype.recover,
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.walkAround.call(this);
}
}
});
-Neutral.Scantid=Unit.extends({
- constructorPlus:function(props){
+Neutral.Scantid = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
+ this.imgPos.dock = this.imgPos.moving;
},
prototypePlus: {
//Add basic unit info
@@ -227,54 +227,54 @@ Neutral.Scantid=Unit.extends({
imgPos: {
moving: {
left: [
- [12,12,12,12,12,12,12,12,12,12,12,12],[104,104,104,104,104,104,104,104,104,104,104,104],
- [196,196,196,196,196,196,196,196,196,196,196,196],[288,288,288,288,288,288,288,288,288,288,288,288],
- [380,380,380,380,380,380,380,380,380,380,380,380],[472,472,472,472,472,472,472,472,472,472,472,472],
- [564,564,564,564,564,564,564,564,564,564,564,564],[656,656,656,656,656,656,656,656,656,656,656,656],
- [748,748,748,748,748,748,748,748,748,748,748,748],[932,932,932,932,932,932,932,932,932,932,932,932],
- [1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024],[1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116],
- [1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208],[1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300],
- [1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392],[1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484]
+ [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104],
+ [196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196], [288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288],
+ [380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380], [472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472],
+ [564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564], [656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656],
+ [748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748], [932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932],
+ [1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024], [1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116],
+ [1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208], [1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300],
+ [1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392], [1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484]
],
top: [
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024]
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024]
]
}
},
- width: 68,//92N+12
+ width: 68,
height: 68,
frame: {
moving: 12,
dock: 1
},
//Only for moving status, override
- speed:6,
+ speed: 6,
HP: 60,
- armor:0,
- sight:175,
- dieEffect:Burst.ScantidDeath,
- isFlying:false,
- unitType:Unit.SMALL,
- recover:Building.ZergBuilding.prototype.recover,
+ armor: 0,
+ sight: 175,
+ dieEffect: Burst.ScantidDeath,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ recover: Building.ZergBuilding.prototype.recover,
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.walkAround.call(this);
}
}
});
-Neutral.Kakaru=Unit.extends({
- constructorPlus:function(props){
+Neutral.Kakaru = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
- this.frame.dock=this.frame.moving;
+ this.imgPos.dock = this.imgPos.moving;
+ this.frame.dock = this.frame.moving;
},
prototypePlus: {
//Add basic unit info
@@ -282,45 +282,46 @@ Neutral.Kakaru=Unit.extends({
imgPos: {
moving: {
left: [
- [12,12,12,12,12,12,12,12,12,12,12,12],[104,104,104,104,104,104,104,104,104,104,104,104],
- [196,196,196,196,196,196,196,196,196,196,196,196],[288,288,288,288,288,288,288,288,288,288,288,288],
- [380,380,380,380,380,380,380,380,380,380,380,380],[472,472,472,472,472,472,472,472,472,472,472,472],
- [564,564,564,564,564,564,564,564,564,564,564,564],[656,656,656,656,656,656,656,656,656,656,656,656],
- [748,748,748,748,748,748,748,748,748,748,748,748],[932,932,932,932,932,932,932,932,932,932,932,932],
- [1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024],[1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116],
- [1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208],[1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300],
- [1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392],[1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484]
+ [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104],
+ [196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196], [288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288],
+ [380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380], [472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472],
+ [564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564], [656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656],
+ [748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748], [932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932],
+ [1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024], [1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116],
+ [1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208], [1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300],
+ [1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392], [1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484]
],
top: [
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
- [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024]
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
+ [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024]
]
}
},
- width: 68,//92N+12
+ width: 68,
height: 68,
frame: {
moving: 12
},
//Only for moving status, override
- speed:6,
+ speed: 6,
HP: 60,
- armor:0,
- sight:210,
- dieEffect:Burst.KakaruDeath,
- isFlying:true,
- unitType:Unit.SMALL,
- recover:Building.ZergBuilding.prototype.recover,
+ armor: 0,
+ sight: 210,
+ dieEffect: Burst.KakaruDeath,
+ isFlying: true,
+ unitType: Unit.SMALL,
+ recover: Building.ZergBuilding.prototype.recover,
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.walkAround.call(this);
}
}
-});
\ No newline at end of file
+});
+//# sourceMappingURL=Neutral.js.map
\ No newline at end of file
diff --git a/Characters/Neutral.ts b/Characters/Neutral.ts
new file mode 100644
index 0000000..6750bae
--- /dev/null
+++ b/Characters/Neutral.ts
@@ -0,0 +1,326 @@
+/******* Define Neutral units *******/
+var Neutral={};
+Neutral.Ragnasaur=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Ragnasaur",
+ imgPos: {
+ moving: {
+ left: [
+ [26,26,26,26,26,26,26,26,26],[130,130,130,130,130,130,130,130,130],
+ [234,234,234,234,234,234,234,234,234],[338,338,338,338,338,338,338,338,338],
+ [442,442,442,442,442,442,442,442,442],[546,546,546,546,546,546,546,546,546],
+ [650,650,650,650,650,650,650,650,650],[754,754,754,754,754,754,754,754,754],
+ [858,858,858,858,858,858,858,858,858],[1066,1066,1066,1066,1066,1066,1066,1066,1066],
+ [1170,1170,1170,1170,1170,1170,1170,1170,1170],[1274,1274,1274,1274,1274,1274,1274,1274,1274],
+ [1378,1378,1378,1378,1378,1378,1378,1378,1378],[1482,1482,1482,1482,1482,1482,1482,1482,1482],
+ [1586,1586,1586,1586,1586,1586,1586,1586,1586],[1690,1690,1690,1690,1690,1690,1690,1690,1690]
+ ],
+ top: [
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858],
+ [26,130,234,338,442,546,650,754,858],[26,130,234,338,442,546,650,754,858]
+ ]
+ }
+ },
+ width: 52,//104N+26
+ height: 52,
+ frame: {
+ moving: 9,
+ dock: 1
+ },
+ //Only for moving status, override
+ speed:6,
+ HP: 60,
+ armor:0,
+ sight:175,
+ dieEffect:Burst.RagnasaurDeath,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ recover:Building.ZergBuilding.prototype.recover,
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Unit.walkAround.call(this);
+ }
+ }
+});
+Neutral.Rhynsdon=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Rhynsdon",
+ imgPos: {
+ moving: {
+ left: [
+ [26,26,26,26,26,26,26,26,26,26,26],[130,130,130,130,130,130,130,130,130,130,130],
+ [234,234,234,234,234,234,234,234,234,234,234],[338,338,338,338,338,338,338,338,338,338,338],
+ [442,442,442,442,442,442,442,442,442,442,442],[546,546,546,546,546,546,546,546,546,546,546],
+ [650,650,650,650,650,650,650,650,650,650,650],[754,754,754,754,754,754,754,754,754,754,754],
+ [858,858,858,858,858,858,858,858,858,858,858],[1066,1066,1066,1066,1066,1066,1066,1066,1066,1066,1066],
+ [1170,1170,1170,1170,1170,1170,1170,1170,1170,1170,1170],[1274,1274,1274,1274,1274,1274,1274,1274,1274,1274,1274],
+ [1378,1378,1378,1378,1378,1378,1378,1378,1378,1378,1378],[1482,1482,1482,1482,1482,1482,1482,1482,1482,1482,1482],
+ [1586,1586,1586,1586,1586,1586,1586,1586,1586,1586,1586],[1690,1690,1690,1690,1690,1690,1690,1690,1690,1690,1690]
+ ],
+ top: [
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066],
+ [26,130,234,338,442,546,650,754,858,962,1066],[26,130,234,338,442,546,650,754,858,962,1066]
+ ]
+ }
+ },
+ width: 52,//104N+26
+ height: 52,
+ frame: {
+ moving: 11,
+ dock: 1
+ },
+ //Only for moving status, override
+ speed:6,
+ HP: 60,
+ armor:0,
+ sight:175,
+ dieEffect:Burst.RhynsdonDeath,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ recover:Building.ZergBuilding.prototype.recover,
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Unit.walkAround.call(this);
+ }
+ }
+});
+Neutral.Ursadon=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Ursadon",
+ imgPos: {
+ moving: {
+ left: [
+ [15,15,15,15,15,15,15,15],[107,107,107,107,107,107,107,107],
+ [199,199,199,199,199,199,199,199],[291,291,291,291,291,291,291,291],
+ [383,383,383,383,383,383,383,383],[475,475,475,475,475,475,475,475],
+ [567,567,567,567,567,567,567,567],[659,659,659,659,659,659,659,659],
+ [751,751,751,751,751,751,751,751],[935,935,935,935,935,935,935,935],
+ [1027,1027,1027,1027,1027,1027,1027,1027],[1119,1119,1119,1119,1119,1119,1119,1119],
+ [1211,1211,1211,1211,1211,1211,1211,1211],[1303,1303,1303,1303,1303,1303,1303,1303],
+ [1395,1395,1395,1395,1395,1395,1395,1395],[1487,1487,1487,1487,1487,1487,1487,1487]
+ ],
+ top: [
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659],
+ [15,107,199,291,383,475,567,659],[15,107,199,291,383,475,567,659]
+ ]
+ }
+ },
+ width: 62,//92N+15
+ height: 62,
+ frame: {
+ moving: 8,
+ dock: 1
+ },
+ //Only for moving status, override
+ speed:6,
+ HP: 60,
+ armor:0,
+ sight:175,
+ dieEffect:Burst.UrsadonDeath,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ recover:Building.ZergBuilding.prototype.recover,
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Unit.walkAround.call(this);
+ }
+ }
+});
+Neutral.Bengalaas=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Bengalaas",
+ imgPos: {
+ moving: {
+ left: [
+ [38,38,38,38,38,38,38,38,38,38,38,38],[166,166,166,166,166,166,166,166,166,166,166,166],
+ [294,294,294,294,294,294,294,294,294,294,294,294],[422,422,422,422,422,422,422,422,422,422,422,422],
+ [550,550,550,550,550,550,550,550,550,550,550,550],[678,678,678,678,678,678,678,678,678,678,678,678],
+ [806,806,806,806,806,806,806,806,806,806,806,806],[934,934,934,934,934,934,934,934,934,934,934,934],
+ [1062,1062,1062,1062,1062,1062,1062,1062,1062,1062,1062,1062],[1318,1318,1318,1318,1318,1318,1318,1318,1318,1318,1318,1318],
+ [1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446],[1574,1574,1574,1574,1574,1574,1574,1574,1574,1574,1574,1574],
+ [1702,1702,1702,1702,1702,1702,1702,1702,1702,1702,1702,1702],[1830,1830,1830,1830,1830,1830,1830,1830,1830,1830,1830,1830],
+ [1958,1958,1958,1958,1958,1958,1958,1958,1958,1958,1958,1958],[2086,2086,2086,2086,2086,2086,2086,2086,2086,2086,2086,2086]
+ ],
+ top: [
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446],
+ [38,166,294,422,550,678,806,934,1062,1190,1318,1446],[38,166,294,422,550,678,806,934,1062,1190,1318,1446]
+ ]
+ }
+ },
+ width: 52,
+ height: 52,//128N+38
+ frame: {
+ moving: 12,
+ dock: 1
+ },
+ //Only for moving status, override
+ speed:6,
+ HP: 60,
+ armor:0,
+ sight:175,
+ dieEffect:Burst.BengalaasDeath,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ recover:Building.ZergBuilding.prototype.recover,
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Unit.walkAround.call(this);
+ }
+ }
+});
+Neutral.Scantid=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Scantid",
+ imgPos: {
+ moving: {
+ left: [
+ [12,12,12,12,12,12,12,12,12,12,12,12],[104,104,104,104,104,104,104,104,104,104,104,104],
+ [196,196,196,196,196,196,196,196,196,196,196,196],[288,288,288,288,288,288,288,288,288,288,288,288],
+ [380,380,380,380,380,380,380,380,380,380,380,380],[472,472,472,472,472,472,472,472,472,472,472,472],
+ [564,564,564,564,564,564,564,564,564,564,564,564],[656,656,656,656,656,656,656,656,656,656,656,656],
+ [748,748,748,748,748,748,748,748,748,748,748,748],[932,932,932,932,932,932,932,932,932,932,932,932],
+ [1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024],[1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116],
+ [1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208],[1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300],
+ [1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392],[1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484]
+ ],
+ top: [
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024]
+ ]
+ }
+ },
+ width: 68,//92N+12
+ height: 68,
+ frame: {
+ moving: 12,
+ dock: 1
+ },
+ //Only for moving status, override
+ speed:6,
+ HP: 60,
+ armor:0,
+ sight:175,
+ dieEffect:Burst.ScantidDeath,
+ isFlying:false,
+ unitType:Unit.SMALL,
+ recover:Building.ZergBuilding.prototype.recover,
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Unit.walkAround.call(this);
+ }
+ }
+});
+Neutral.Kakaru=Unit.extends({
+ constructorPlus:function(props){
+ //Same action mapping
+ this.imgPos.dock=this.imgPos.moving;
+ this.frame.dock=this.frame.moving;
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Kakaru",
+ imgPos: {
+ moving: {
+ left: [
+ [12,12,12,12,12,12,12,12,12,12,12,12],[104,104,104,104,104,104,104,104,104,104,104,104],
+ [196,196,196,196,196,196,196,196,196,196,196,196],[288,288,288,288,288,288,288,288,288,288,288,288],
+ [380,380,380,380,380,380,380,380,380,380,380,380],[472,472,472,472,472,472,472,472,472,472,472,472],
+ [564,564,564,564,564,564,564,564,564,564,564,564],[656,656,656,656,656,656,656,656,656,656,656,656],
+ [748,748,748,748,748,748,748,748,748,748,748,748],[932,932,932,932,932,932,932,932,932,932,932,932],
+ [1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024,1024],[1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116,1116],
+ [1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208,1208],[1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300,1300],
+ [1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392,1392],[1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484,1484]
+ ],
+ top: [
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024],
+ [12,104,196,288,380,472,564,656,748,840,932,1024],[12,104,196,288,380,472,564,656,748,840,932,1024]
+ ]
+ }
+ },
+ width: 68,//92N+12
+ height: 68,
+ frame: {
+ moving: 12
+ },
+ //Only for moving status, override
+ speed:6,
+ HP: 60,
+ armor:0,
+ sight:210,
+ dieEffect:Burst.KakaruDeath,
+ isFlying:true,
+ unitType:Unit.SMALL,
+ recover:Building.ZergBuilding.prototype.recover,
+ //Override
+ dock:function(){
+ //Use the same behavior
+ Unit.walkAround.call(this);
+ }
+ }
+});
\ No newline at end of file
diff --git a/Characters/Protoss.js b/Characters/Protoss.js
index 34cd7da..1198ce9 100644
--- a/Characters/Protoss.js
+++ b/Characters/Protoss.js
@@ -1,101 +1,101 @@
/******* Define Protoss units *******/
-var Protoss={};
-Protoss.Probe=AttackableUnit.extends({
- constructorPlus:function(props){
+var Protoss = {};
+Protoss.Probe = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
- this.frame.dock=this.frame.moving;
+ this.imgPos.dock = this.imgPos.moving;
+ this.frame.dock = this.frame.moving;
},
prototypePlus: {
//Add basic unit info
name: "Probe",
imgPos: {
moving: {
- left: [0,32,64,96,128,160,192,224,256,32,64,96,128,160,192,224],
- top: [0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32]
+ left: [0, 32, 64, 96, 128, 160, 192, 224, 256, 32, 64, 96, 128, 160, 192, 224],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, 32]
},
attack: {
- left: [0,32,64,96,128,160,192,224,256,32,64,96,128,160,192,224],
- top: [0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32]
+ left: [0, 32, 64, 96, 128, 160, 192, 224, 256, 32, 64, 96, 128, 160, 192, 224],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, 32]
}
},
- width: 32,//32N
- height: 32,//32N
+ width: 32,
+ height: 32,
frame: {
moving: 1
},
//Only for moving status, override
- speed:12,
+ speed: 12,
HP: 20,
SP: 20,
damage: 5,
- armor:0,
- plasma:0,
- sight:280,
+ armor: 0,
+ plasma: 0,
+ sight: 280,
meleeAttack: true,
attackInterval: 2200,
- dieEffect:Burst.SmallBlueExplode,
- attackEffect:Burst.ProbeSpark,
- isFlying:false,
- attackLimit:"ground",
- unitType:Unit.SMALL,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:50,
- man:1,
- time:200
+ dieEffect: Burst.SmallBlueExplode,
+ attackEffect: Burst.ProbeSpark,
+ isFlying: false,
+ attackLimit: "ground",
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 50,
+ man: 1,
+ time: 200
},
- upgrade:['UpgradeGroundArmor','UpgradePlasmaShields'],
- items:{'4':undefined,
- '5':{name:'gather'},
- '7':{name:'BasicStructure'},
- '8':{name:'AdvancedStructure'}
+ upgrade: ['UpgradeGroundArmor', 'UpgradePlasmaShields'],
+ items: { '4': undefined,
+ '5': { name: 'gather' },
+ '7': { name: 'BasicStructure' },
+ '8': { name: 'AdvancedStructure' }
},
- buildProtossBuilding:function(location){
+ buildProtossBuilding: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire Ensnare
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,40,function(){
- if (Resource.payCreditBill.call(myself)){
- var transfer=new Building.ProtossBuilding.WrapRift({x:location.x-32,y:location.y-32,team:myself.team});
- transfer.buildName=myself.buildName;
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, 40, function () {
+ if (Resource.payCreditBill.call(myself)) {
+ var transfer = new Building.ProtossBuilding.WrapRift({ x: location.x - 32, y: location.y - 32, team: myself.team });
+ transfer.buildName = myself.buildName;
//Calculate duration
- var duration=Resource.getCost(myself.buildName).time;
+ var duration = Resource.getCost(myself.buildName).time;
//Cheat: Operation cwal
- if (Cheat.cwal) duration=20;
- Game.commandTimeout(function(){
- if (transfer.status!='dead'){
+ if (Cheat.cwal)
+ duration = 20;
+ Game.commandTimeout(function () {
+ if (transfer.status != 'dead') {
//Evolve
transfer.evolveTo({
- type:Building.ProtossBuilding[transfer.buildName],
- burstArr:['ProtossBuildingComplete']
+ type: Building.ProtossBuilding[transfer.buildName],
+ burstArr: ['ProtossBuildingComplete']
});
}
- },duration*100);
+ }, duration * 100);
//Processing flag on transfer
- transfer.processing={
- name:transfer.buildName,
- startTime:Game.mainTick,//new Date().getTime()
- time:duration
+ transfer.processing = {
+ name: transfer.buildName,
+ startTime: Game.mainTick,
+ time: duration
};
}
});
}
- //If missing location info, mark Button.callback, mouseController will call back with location
else {
- Button.callback=arguments.callee;
- Button.callback.farmer=this;
- Button.callback.buildType='ProtossBuilding';
- $('div.GameLayer').attr('status','button');
+ Button.callback = arguments.callee;
+ Button.callback.farmer = this;
+ Button.callback.buildType = 'ProtossBuilding';
+ $('div.GameLayer').attr('status', 'button');
}
}
}
});
-Protoss.Zealot=AttackableUnit.extends({
- constructorPlus:function(props){
+Protoss.Zealot = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Nothing
},
prototypePlus: {
@@ -104,86 +104,86 @@ Protoss.Zealot=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [0,0,0,0,0,0,0,0],[42,42,42,42,42,42,42,42],
- [84,84,84,84,84,84,84,84],[126,126,126,126,126,126,126,126],
- [168,168,168,168,168,168,168,168],[210,210,210,210,210,210,210,210],
- [252,252,252,252,252,252,252,252],[294,294,294,294,294,294,294,294],
- [336,336,336,336,336,336,336,336],[420,420,420,420,420,420,420,420],
- [462,462,462,462,462,462,462,462],[504,504,504,504,504,504,504,504],
- [546,546,546,546,546,546,546,546],[588,588,588,588,588,588,588,588],
- [630,630,630,630,630,630,630,630],[672,672,672,672,672,672,672,672]
+ [0, 0, 0, 0, 0, 0, 0, 0], [42, 42, 42, 42, 42, 42, 42, 42],
+ [84, 84, 84, 84, 84, 84, 84, 84], [126, 126, 126, 126, 126, 126, 126, 126],
+ [168, 168, 168, 168, 168, 168, 168, 168], [210, 210, 210, 210, 210, 210, 210, 210],
+ [252, 252, 252, 252, 252, 252, 252, 252], [294, 294, 294, 294, 294, 294, 294, 294],
+ [336, 336, 336, 336, 336, 336, 336, 336], [420, 420, 420, 420, 420, 420, 420, 420],
+ [462, 462, 462, 462, 462, 462, 462, 462], [504, 504, 504, 504, 504, 504, 504, 504],
+ [546, 546, 546, 546, 546, 546, 546, 546], [588, 588, 588, 588, 588, 588, 588, 588],
+ [630, 630, 630, 630, 630, 630, 630, 630], [672, 672, 672, 672, 672, 672, 672, 672]
],
top: [
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308],
- [0,44,88,132,176,220,264,308],[0,44,88,132,176,220,264,308]
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
+ [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308]
]
},
dock: {
- left: [0,42,84,126,168,210,252,294,336,420,462,504,546,588,630,672],
- top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ left: [0, 42, 84, 126, 168, 210, 252, 294, 336, 420, 462, 504, 546, 588, 630, 672],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
- attack:{
+ attack: {
left: [
- [0,0,0,0,0],[42,42,42,42,42],
- [84,84,84,84,84],[126,126,126,126,126],
- [168,168,168,168,168],[210,210,210,210,210],
- [252,252,252,252,252],[294,294,294,294,294],
- [336,336,336,336,336],[420,420,420,420,420],
- [462,462,462,462,462],[504,504,504,504,504],
- [546,546,546,546,546],[588,588,588,588,588],
- [630,630,630,630,630],[672,672,672,672,672]
+ [0, 0, 0, 0, 0], [42, 42, 42, 42, 42],
+ [84, 84, 84, 84, 84], [126, 126, 126, 126, 126],
+ [168, 168, 168, 168, 168], [210, 210, 210, 210, 210],
+ [252, 252, 252, 252, 252], [294, 294, 294, 294, 294],
+ [336, 336, 336, 336, 336], [420, 420, 420, 420, 420],
+ [462, 462, 462, 462, 462], [504, 504, 504, 504, 504],
+ [546, 546, 546, 546, 546], [588, 588, 588, 588, 588],
+ [630, 630, 630, 630, 630], [672, 672, 672, 672, 672]
],
top: [
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528],
- [352,396,440,484,528],[352,396,440,484,528]
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
+ [352, 396, 440, 484, 528], [352, 396, 440, 484, 528]
]
}
},
- width: 42,//42N
- height: 44,//44N
+ width: 42,
+ height: 44,
frame: {
moving: 8,
dock: 1,
attack: 5
},
//Only for moving status, override
- speed:10,
+ speed: 10,
HP: 80,
SP: 80,
damage: 16,
- armor:1,
- plasma:0,
- sight:245,
+ armor: 1,
+ plasma: 0,
+ sight: 245,
meleeAttack: true,
attackInterval: 2200,
- dieEffect:Burst.SmallProtossDeath,
- isFlying:false,
- attackLimit:"ground",
- unitType:Unit.SMALL,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:100,
- man:2,
- time:400
+ dieEffect: Burst.SmallProtossDeath,
+ isFlying: false,
+ attackLimit: "ground",
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 100,
+ man: 2,
+ time: 400
},
- upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields']
+ upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields']
}
});
-Protoss.Dragoon=AttackableUnit.extends({
- constructorPlus:function(props){
+Protoss.Dragoon = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Nothing
},
prototypePlus: {
@@ -192,105 +192,105 @@ Protoss.Dragoon=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[687,591,495,399,303,207,111,15],
- [687,591,495,399,303,207,111,15],[687,591,495,399,303,207,111,15],
- [687,591,495,399,303,207,111,15],[687,591,495,399,303,207,111,15],
- [687,591,495,399,303,207,111,15],[687,591,495,399,303,207,111,15]
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [687, 591, 495, 399, 303, 207, 111, 15],
+ [687, 591, 495, 399, 303, 207, 111, 15], [687, 591, 495, 399, 303, 207, 111, 15],
+ [687, 591, 495, 399, 303, 207, 111, 15], [687, 591, 495, 399, 303, 207, 111, 15],
+ [687, 591, 495, 399, 303, 207, 111, 15], [687, 591, 495, 399, 303, 207, 111, 15]
],
top: [
- [111,111,111,111,111,111,111,111],[111,111,111,111,111,111,111,111],
- [207,207,207,207,207,207,207,207],[207,207,207,207,207,207,207,207],
- [207,207,207,207,207,207,207,207],[207,207,207,207,207,207,207,207],
- [207,207,207,207,207,207,207,207],[399,399,399,399,399,399,399,399],
- [399,399,399,399,399,399,399,399],[399,399,399,399,399,399,399,399],
- [303,303,303,303,303,303,303,303],[303,303,303,303,303,303,303,303],
- [303,303,303,303,303,303,303,303],[303,303,303,303,303,303,303,303],
- [303,303,303,303,303,303,303,303],[111,111,111,111,111,111,111,111]
+ [111, 111, 111, 111, 111, 111, 111, 111], [111, 111, 111, 111, 111, 111, 111, 111],
+ [207, 207, 207, 207, 207, 207, 207, 207], [207, 207, 207, 207, 207, 207, 207, 207],
+ [207, 207, 207, 207, 207, 207, 207, 207], [207, 207, 207, 207, 207, 207, 207, 207],
+ [207, 207, 207, 207, 207, 207, 207, 207], [399, 399, 399, 399, 399, 399, 399, 399],
+ [399, 399, 399, 399, 399, 399, 399, 399], [399, 399, 399, 399, 399, 399, 399, 399],
+ [303, 303, 303, 303, 303, 303, 303, 303], [303, 303, 303, 303, 303, 303, 303, 303],
+ [303, 303, 303, 303, 303, 303, 303, 303], [303, 303, 303, 303, 303, 303, 303, 303],
+ [303, 303, 303, 303, 303, 303, 303, 303], [111, 111, 111, 111, 111, 111, 111, 111]
]
},
dock: {
left: [
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687],
- [15,111,207,303,399,495,591,687],[15,111,207,303,399,495,591,687]
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
+ [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687]
],
top: [
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15],
- [15,15,15,15,15,15,15,15],[15,15,15,15,15,15,15,15]
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
+ [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15]
]
},
attack: {
left: [
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495],
- [15,111,207,303,399,495,591,687,495,495,495,495],[15,111,207,303,399,495,591,687,495,495,495,495]
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
+ [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495]
],
top: [
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495],
- [495,495,495,495,495,495,495,495,495,495,495,495],[495,495,495,495,495,495,495,495,495,495,495,495]
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
+ [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495]
]
}
},
- width: 66,//96N+15
- height: 66,//96N+15
+ width: 66,
+ height: 66,
frame: {
moving: 8,
dock: 8,
attack: 12
},
//Only for moving status, override
- speed:12,
+ speed: 12,
HP: 100,
SP: 80,
damage: 20,
- armor:1,
- plasma:0,
- sight:280,
+ armor: 1,
+ plasma: 0,
+ sight: 280,
attackRange: 140,
attackInterval: 3000,
- fireDelay:800,
- dieEffect:Burst.DragoonDeath,
- isFlying:false,
- unitType:Unit.BIG,
- attackType:AttackableUnit.BURST_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:125,
- gas:50,
- man:2,
- time:500
+ fireDelay: 800,
+ dieEffect: Burst.DragoonDeath,
+ isFlying: false,
+ unitType: Unit.BIG,
+ attackType: AttackableUnit.BURST_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 125,
+ gas: 50,
+ man: 2,
+ time: 500
},
- upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields']
+ upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields']
}
});
-Protoss.Templar=AttackableUnit.extends({
- constructorPlus:function(props){
+Protoss.Templar = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Nothing
},
prototypePlus: {
@@ -299,115 +299,115 @@ Protoss.Templar=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [30,30,30,30],[158,158,158,158],
- [286,286,286,286],[414,414,414,414],
- [542,542,542,542],[670,670,670,670],
- [798,798,798,798],[926,926,926,926],
- [1054,1054,1054,1054],[1310,1310,1310,1310],
- [1438,1438,1438,1438],[1566,1566,1566,1566],
- [1694,1694,1694,1694],[1822,1822,1822,1822],
- [1950,1950,1950,1950],[2078,2078,2078,2078]
+ [30, 30, 30, 30], [158, 158, 158, 158],
+ [286, 286, 286, 286], [414, 414, 414, 414],
+ [542, 542, 542, 542], [670, 670, 670, 670],
+ [798, 798, 798, 798], [926, 926, 926, 926],
+ [1054, 1054, 1054, 1054], [1310, 1310, 1310, 1310],
+ [1438, 1438, 1438, 1438], [1566, 1566, 1566, 1566],
+ [1694, 1694, 1694, 1694], [1822, 1822, 1822, 1822],
+ [1950, 1950, 1950, 1950], [2078, 2078, 2078, 2078]
],
top: [
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670],
- [1694,1822,1950,670],[1694,1822,1950,670]
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
+ [1694, 1822, 1950, 670], [1694, 1822, 1950, 670]
]
},
dock: {
left: [
- [30,30,30,30,30,30,30],[158,158,158,158,158,158,158],
- [286,286,286,286,286,286,286],[414,414,414,414,414,414,414],
- [542,542,542,542,542,542,542],[670,670,670,670,670,670,670],
- [798,798,798,798,798,798,798],[926,926,926,926,926,926,926],
- [1054,1054,1054,1054,1054,1054,1054],[1310,1310,1310,1310,1310,1310,1310],
- [1438,1438,1438,1438,1438,1438,1438],[1566,1566,1566,1566,1566,1566,1566],
- [1694,1694,1694,1694,1694,1694,1694],[1822,1822,1822,1822,1822,1822,1822],
- [1950,1950,1950,1950,1950,1950,1950],[2078,2078,2078,2078,2078,2078,2078]
+ [30, 30, 30, 30, 30, 30, 30], [158, 158, 158, 158, 158, 158, 158],
+ [286, 286, 286, 286, 286, 286, 286], [414, 414, 414, 414, 414, 414, 414],
+ [542, 542, 542, 542, 542, 542, 542], [670, 670, 670, 670, 670, 670, 670],
+ [798, 798, 798, 798, 798, 798, 798], [926, 926, 926, 926, 926, 926, 926],
+ [1054, 1054, 1054, 1054, 1054, 1054, 1054], [1310, 1310, 1310, 1310, 1310, 1310, 1310],
+ [1438, 1438, 1438, 1438, 1438, 1438, 1438], [1566, 1566, 1566, 1566, 1566, 1566, 1566],
+ [1694, 1694, 1694, 1694, 1694, 1694, 1694], [1822, 1822, 1822, 1822, 1822, 1822, 1822],
+ [1950, 1950, 1950, 1950, 1950, 1950, 1950], [2078, 2078, 2078, 2078, 2078, 2078, 2078]
],
top: [
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566],
- [798,926,1054,1182,1310,1438,1566],[798,926,1054,1182,1310,1438,1566]
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
+ [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566]
]
},
attack: {
left: [
- [30,30,30,30,30],[158,158,158,158,158],
- [286,286,286,286,286],[414,414,414,414,414],
- [542,542,542,542,542],[670,670,670,670,670],
- [798,798,798,798,798],[926,926,926,926,926],
- [1054,1054,1054,1054,1054],[1310,1310,1310,1310,1310],
- [1438,1438,1438,1438,1438],[1566,1566,1566,1566,1566],
- [1694,1694,1694,1694,1694],[1822,1822,1822,1822,1822],
- [1950,1950,1950,1950,1950],[2078,2078,2078,2078,2078]
+ [30, 30, 30, 30, 30], [158, 158, 158, 158, 158],
+ [286, 286, 286, 286, 286], [414, 414, 414, 414, 414],
+ [542, 542, 542, 542, 542], [670, 670, 670, 670, 670],
+ [798, 798, 798, 798, 798], [926, 926, 926, 926, 926],
+ [1054, 1054, 1054, 1054, 1054], [1310, 1310, 1310, 1310, 1310],
+ [1438, 1438, 1438, 1438, 1438], [1566, 1566, 1566, 1566, 1566],
+ [1694, 1694, 1694, 1694, 1694], [1822, 1822, 1822, 1822, 1822],
+ [1950, 1950, 1950, 1950, 1950], [2078, 2078, 2078, 2078, 2078]
],
top: [
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542],
- [30,158,286,414,542],[30,158,286,414,542]
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
+ [30, 158, 286, 414, 542], [30, 158, 286, 414, 542]
]
}
},
- width: 68,//128N+30
- height: 68,//128N+30
+ width: 68,
+ height: 68,
frame: {
- moving: 4,//3 or 4
- dock: 7,//7 or 8
+ moving: 4,
+ dock: 7,
attack: 5
},
//Only for moving status, override
- speed:8,
+ speed: 8,
HP: 40,
SP: 40,
damage: 10,
- armor:0,
- plasma:0,
+ armor: 0,
+ plasma: 0,
MP: 200,
- sight:245,
+ sight: 245,
attackRange: 100,
attackInterval: 2000,
- dieEffect:Burst.TemplarDeath,
- attackEffect:Burst.FireSpark,
- isFlying:false,
- unitType:Unit.SMALL,
- attackType:AttackableUnit.WAVE_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:50,
- gas:150,
- man:2,
- time:500
+ dieEffect: Burst.TemplarDeath,
+ attackEffect: Burst.FireSpark,
+ isFlying: false,
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.WAVE_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 50,
+ gas: 150,
+ man: 2,
+ time: 500
},
- upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields'],
- items:{
- '7':{name:'PsionicStorm',condition:function(){
- return Magic.PsionicStorm.enabled
- }},
- '8':{name:'Hallucination',condition:function(){
- return Magic.Hallucination.enabled
- }},
- '9':{name:'Archon'}
+ upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
+ items: {
+ '7': { name: 'PsionicStorm', condition: function () {
+ return Magic.PsionicStorm.enabled;
+ } },
+ '8': { name: 'Hallucination', condition: function () {
+ return Magic.Hallucination.enabled;
+ } },
+ '9': { name: 'Archon' }
}
}
});
-Protoss.DarkTemplar=AttackableUnit.extends({
- constructorPlus:function(props){
+Protoss.DarkTemplar = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Nothing
},
prototypePlus: {
@@ -416,95 +416,95 @@ Protoss.DarkTemplar=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [3,3,3,3,3,3,3,3,3],[60,60,60,60,60,60,60,60,60],
- [117,117,117,117,117,117,117,117,117],[174,174,174,174,174,174,174,174,174],
- [231,231,231,231,231,231,231,231,231],[288,288,288,288,288,288,288,288,288],
- [345,345,345,345,345,345,345,345,345],[402,402,402,402,402,402,402,402,402],
- [459,459,459,459,459,459,459,459,459],[573,573,573,573,573,573,573,573,573],
- [630,630,630,630,630,630,630,630,630],[687,687,687,687,687,687,687,687,687],
- [744,744,744,744,744,744,744,744,744],[801,801,801,801,801,801,801,801,801],
- [858,858,858,858,858,858,858,858,858],[915,915,915,915,915,915,915,915,915]
+ [3, 3, 3, 3, 3, 3, 3, 3, 3], [60, 60, 60, 60, 60, 60, 60, 60, 60],
+ [117, 117, 117, 117, 117, 117, 117, 117, 117], [174, 174, 174, 174, 174, 174, 174, 174, 174],
+ [231, 231, 231, 231, 231, 231, 231, 231, 231], [288, 288, 288, 288, 288, 288, 288, 288, 288],
+ [345, 345, 345, 345, 345, 345, 345, 345, 345], [402, 402, 402, 402, 402, 402, 402, 402, 402],
+ [459, 459, 459, 459, 459, 459, 459, 459, 459], [573, 573, 573, 573, 573, 573, 573, 573, 573],
+ [630, 630, 630, 630, 630, 630, 630, 630, 630], [687, 687, 687, 687, 687, 687, 687, 687, 687],
+ [744, 744, 744, 744, 744, 744, 744, 744, 744], [801, 801, 801, 801, 801, 801, 801, 801, 801],
+ [858, 858, 858, 858, 858, 858, 858, 858, 858], [915, 915, 915, 915, 915, 915, 915, 915, 915]
],
top: [
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496],
- [0,62,124,186,248,310,372,434,496],[0,62,124,186,248,310,372,434,496]
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
+ [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496]
]
},
dock: {
- left: [3,60,117,174,231,288,345,402,459,573,630,687,744,801,858,915],
- top: [248,248,248,248,248,248,248,248,248,248,248,248,248,248,248,248]
+ left: [3, 60, 117, 174, 231, 288, 345, 402, 459, 573, 630, 687, 744, 801, 858, 915],
+ top: [248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248]
},
attack: {
left: [
- [3,3,3,3,3,3,3,3,3],[60,60,60,60,60,60,60,60,60],
- [117,117,117,117,117,117,117,117,117],[174,174,174,174,174,174,174,174,174],
- [231,231,231,231,231,231,231,231,231],[288,288,288,288,288,288,288,288,288],
- [345,345,345,345,345,345,345,345,345],[402,402,402,402,402,402,402,402,402],
- [459,459,459,459,459,459,459,459,459],[573,573,573,573,573,573,573,573,573],
- [630,630,630,630,630,630,630,630,630],[687,687,687,687,687,687,687,687,687],
- [744,744,744,744,744,744,744,744,744],[801,801,801,801,801,801,801,801,801],
- [858,858,858,858,858,858,858,858,858],[915,915,915,915,915,915,915,915,915]
+ [3, 3, 3, 3, 3, 3, 3, 3, 3], [60, 60, 60, 60, 60, 60, 60, 60, 60],
+ [117, 117, 117, 117, 117, 117, 117, 117, 117], [174, 174, 174, 174, 174, 174, 174, 174, 174],
+ [231, 231, 231, 231, 231, 231, 231, 231, 231], [288, 288, 288, 288, 288, 288, 288, 288, 288],
+ [345, 345, 345, 345, 345, 345, 345, 345, 345], [402, 402, 402, 402, 402, 402, 402, 402, 402],
+ [459, 459, 459, 459, 459, 459, 459, 459, 459], [573, 573, 573, 573, 573, 573, 573, 573, 573],
+ [630, 630, 630, 630, 630, 630, 630, 630, 630], [687, 687, 687, 687, 687, 687, 687, 687, 687],
+ [744, 744, 744, 744, 744, 744, 744, 744, 744], [801, 801, 801, 801, 801, 801, 801, 801, 801],
+ [858, 858, 858, 858, 858, 858, 858, 858, 858], [915, 915, 915, 915, 915, 915, 915, 915, 915]
],
top: [
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054],
- [558,620,682,744,806,868,930,992,1054],[558,620,682,744,806,868,930,992,1054]
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
+ [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054]
]
}
},
- width: 57,//57N+3
- height: 62,//62N
+ width: 57,
+ height: 62,
frame: {
moving: 9,
dock: 1,
attack: 9
},
//Only for moving status, override
- speed:12,
+ speed: 12,
HP: 80,
SP: 40,
damage: 40,
- armor:1,
- plasma:0,
- sight:245,
+ armor: 1,
+ plasma: 0,
+ sight: 245,
meleeAttack: true,
attackInterval: 3000,
- dieEffect:Burst.SmallProtossDeath,
- isFlying:false,
- isInvisible:true,
- attackLimit:"ground",
- unitType:Unit.SMALL,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:125,
- gas:100,
- man:2,
- time:500
+ dieEffect: Burst.SmallProtossDeath,
+ isFlying: false,
+ isInvisible: true,
+ attackLimit: "ground",
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 125,
+ gas: 100,
+ man: 2,
+ time: 500
},
- upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields'],
- items:{
- '9':{name:'DarkArchon'}
+ upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
+ items: {
+ '9': { name: 'DarkArchon' }
}
}
});
-Protoss.Archon=AttackableUnit.extends({
- constructorPlus:function(props){
+Protoss.Archon = AttackableUnit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
- this.frame.dock=this.frame.moving;
- this.direction=6;
+ this.imgPos.dock = this.imgPos.moving;
+ this.frame.dock = this.frame.moving;
+ this.direction = 6;
},
prototypePlus: {
//Add basic unit info
@@ -512,90 +512,90 @@ Protoss.Archon=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [2060,2060,2060,2060],[140,140,140,140],
- [260,260,260,260],[380,380,380,380],
- [500,500,500,500],[620,620,620,620],
- [740,740,740,740],[860,860,860,860],
- [980,980,980,980],[1220,1220,1220,1220],
- [1340,1340,1340,1340],[1460,1460,1460,1460],
- [1580,1580,1580,1580],[1700,1700,1700,1700],
- [1820,1820,1820,1820],[1940,1940,1940,1940]
+ [2060, 2060, 2060, 2060], [140, 140, 140, 140],
+ [260, 260, 260, 260], [380, 380, 380, 380],
+ [500, 500, 500, 500], [620, 620, 620, 620],
+ [740, 740, 740, 740], [860, 860, 860, 860],
+ [980, 980, 980, 980], [1220, 1220, 1220, 1220],
+ [1340, 1340, 1340, 1340], [1460, 1460, 1460, 1460],
+ [1580, 1580, 1580, 1580], [1700, 1700, 1700, 1700],
+ [1820, 1820, 1820, 1820], [1940, 1940, 1940, 1940]
],
top: [
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580],
- [1220,1340,1460,1580],[1220,1340,1460,1580]
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
+ [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580]
]
},
attack: {
left: [
- [2060,2060,2060,2060,2060,2060,2060,2060,2060,2060],[140,140,140,140,140,140,140,140,140,140],
- [260,260,260,260,260,260,260,260,260,260],[380,380,380,380,380,380,380,380,380,380],
- [500,500,500,500,500,500,500,500,500,500],[620,620,620,620,620,620,620,620,620,620],
- [740,740,740,740,740,740,740,740,740,740],[860,860,860,860,860,860,860,860,860,860],
- [980,980,980,980,980,980,980,980,980,980],[1220,1220,1220,1220,1220,1220,1220,1220,1220,1220],
- [1340,1340,1340,1340,1340,1340,1340,1340,1340,1340],[1460,1460,1460,1460,1460,1460,1460,1460,1460,1460],
- [1580,1580,1580,1580,1580,1580,1580,1580,1580,1580],[1700,1700,1700,1700,1700,1700,1700,1700,1700,1700],
- [1820,1820,1820,1820,1820,1820,1820,1820,1820,1820],[1940,1940,1940,1940,1940,1940,1940,1940,1940,1940]
+ [2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060], [140, 140, 140, 140, 140, 140, 140, 140, 140, 140],
+ [260, 260, 260, 260, 260, 260, 260, 260, 260, 260], [380, 380, 380, 380, 380, 380, 380, 380, 380, 380],
+ [500, 500, 500, 500, 500, 500, 500, 500, 500, 500], [620, 620, 620, 620, 620, 620, 620, 620, 620, 620],
+ [740, 740, 740, 740, 740, 740, 740, 740, 740, 740], [860, 860, 860, 860, 860, 860, 860, 860, 860, 860],
+ [980, 980, 980, 980, 980, 980, 980, 980, 980, 980], [1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220],
+ [1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340], [1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460],
+ [1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580], [1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700],
+ [1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820], [1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940]
],
top: [
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100]
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100]
]
}
},
- width: 80,//120N+20
- height: 80,//120N+20
+ width: 80,
+ height: 80,
frame: {
moving: 4,
attack: 10
},
//Only for moving status, override
- speed:12,
+ speed: 12,
HP: 10,
SP: 350,
damage: 30,
- armor:0,
- plasma:0,
- sight:280,
+ armor: 0,
+ plasma: 0,
+ sight: 280,
attackRange: 70,
attackInterval: 1000,
- attackEffect:Burst.ArchonBurst,
- dieEffect:Burst.BigBlueExplode,
- isFlying:false,
- unitType:Unit.BIG,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:50,
- gas:150,
- man:4,
- time:200
+ attackEffect: Burst.ArchonBurst,
+ dieEffect: Burst.BigBlueExplode,
+ isFlying: false,
+ unitType: Unit.BIG,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 50,
+ gas: 150,
+ man: 4,
+ time: 200
},
- upgrade:['UpgradeGroundWeapons','UpgradeGroundArmor','UpgradePlasmaShields'],
- AOE:{
- hasEffect:false,
- radius:20
+ upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
+ AOE: {
+ hasEffect: false,
+ radius: 20
}
}
});
-Protoss.DarkArchon=Unit.extends({
- constructorPlus:function(props){
+Protoss.DarkArchon = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
- this.frame.dock=this.frame.moving;
- this.direction=3;
+ this.imgPos.dock = this.imgPos.moving;
+ this.frame.dock = this.frame.moving;
+ this.direction = 3;
},
prototypePlus: {
//Add basic unit info
@@ -603,122 +603,124 @@ Protoss.DarkArchon=Unit.extends({
imgPos: {
moving: {
left: [
- [20,20,20,20,20,20,20,20,20,20],[140,140,140,140,140,140,140,140,140,140],
- [260,260,260,260,260,260,260,260,260,260],[380,380,380,380,380,380,380,380,380,380],
- [500,500,500,500,500,500,500,500,500,500],[620,620,620,620,620,620,620,620,620,620],
- [740,740,740,740,740,740,740,740,740,740],[860,860,860,860,860,860,860,860,860,860],
- [980,980,980,980,980,980,980,980,980,980],[1220,1220,1220,1220,1220,1220,1220,1220,1220,1220],
- [1340,1340,1340,1340,1340,1340,1340,1340,1340,1340],[1460,1460,1460,1460,1460,1460,1460,1460,1460,1460],
- [1580,1580,1580,1580,1580,1580,1580,1580,1580,1580],[1700,1700,1700,1700,1700,1700,1700,1700,1700,1700],
- [1820,1820,1820,1820,1820,1820,1820,1820,1820,1820],[1940,1940,1940,1940,1940,1940,1940,1940,1940,1940]
+ [20, 20, 20, 20, 20, 20, 20, 20, 20, 20], [140, 140, 140, 140, 140, 140, 140, 140, 140, 140],
+ [260, 260, 260, 260, 260, 260, 260, 260, 260, 260], [380, 380, 380, 380, 380, 380, 380, 380, 380, 380],
+ [500, 500, 500, 500, 500, 500, 500, 500, 500, 500], [620, 620, 620, 620, 620, 620, 620, 620, 620, 620],
+ [740, 740, 740, 740, 740, 740, 740, 740, 740, 740], [860, 860, 860, 860, 860, 860, 860, 860, 860, 860],
+ [980, 980, 980, 980, 980, 980, 980, 980, 980, 980], [1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220],
+ [1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340], [1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460],
+ [1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580], [1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700],
+ [1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820], [1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940]
],
top: [
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100],
- [20,140,260,380,500,620,740,860,980,1100],[20,140,260,380,500,620,740,860,980,1100]
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
+ [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100]
]
}
},
- width: 80,//120N+20
- height: 80,//120N+20
+ width: 80,
+ height: 80,
frame: {
moving: 10
},
//Only for moving status, override
- speed:12,
+ speed: 12,
HP: 25,
SP: 200,
- armor:1,
- plasma:0,
+ armor: 1,
+ plasma: 0,
MP: 200,
- sight:350,
- dieEffect:Burst.BigBlueExplode,
- isFlying:false,
- unitType:Unit.BIG,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:125,
- gas:100,
- man:4,
- time:200
+ sight: 350,
+ dieEffect: Burst.BigBlueExplode,
+ isFlying: false,
+ unitType: Unit.BIG,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 125,
+ gas: 100,
+ man: 4,
+ time: 200
},
- upgrade:['UpgradeGroundArmor','UpgradePlasmaShields'],
- items:{
- '7':{name:'Feedback'},
- '8':{name:'MindControl',condition:function(){
- return Magic.MindControl.enabled
- }},
- '9':{name:'MaelStorm',condition:function(){
- return Magic.MaelStorm.enabled
- }}
+ upgrade: ['UpgradeGroundArmor', 'UpgradePlasmaShields'],
+ items: {
+ '7': { name: 'Feedback' },
+ '8': { name: 'MindControl', condition: function () {
+ return Magic.MindControl.enabled;
+ } },
+ '9': { name: 'MaelStorm', condition: function () {
+ return Magic.MaelStorm.enabled;
+ } }
}
}
});
-Protoss.Shuttle=Unit.extends({
- constructorPlus:function(props){
+Protoss.Shuttle = Unit.extends({
+ constructorPlus: function (props) {
//Same action mapping
- this.imgPos.dock=this.imgPos.moving;
- this.frame.dock=this.frame.moving;
+ this.imgPos.dock = this.imgPos.moving;
+ this.frame.dock = this.frame.moving;
//Transport
- this.loadedUnits=[];
+ this.loadedUnits = [];
},
prototypePlus: {
//Add basic unit info
name: "Shuttle",
imgPos: {
moving: {
- left: [5,65,125,185,245,305,365,425,485,65,125,185,245,305,365,425],
- top: [5,5,5,5,5,5,5,5,5,65,65,65,65,65,65,65]
+ left: [5, 65, 125, 185, 245, 305, 365, 425, 485, 65, 125, 185, 245, 305, 365, 425],
+ top: [5, 5, 5, 5, 5, 5, 5, 5, 5, 65, 65, 65, 65, 65, 65, 65]
}
},
- width: 50,//60N+5
- height: 50,//60N+5
+ width: 50,
+ height: 50,
frame: {
moving: 1
},
//Only for moving status, override
- speed:11,
+ speed: 11,
HP: 80,
SP: 60,
- armor:1,
- plasma:0,
- sight:280,
- dieEffect:Burst.MiddleBlueExplode,
- isFlying:true,
- unitType:Unit.BIG,
- recover:Building.ProtossBuilding.prototype.recover,
- cost:{
- mine:200,
- man:2,
- time:600
+ armor: 1,
+ plasma: 0,
+ sight: 280,
+ dieEffect: Burst.MiddleBlueExplode,
+ isFlying: true,
+ unitType: Unit.BIG,
+ recover: Building.ProtossBuilding.prototype.recover,
+ cost: {
+ mine: 200,
+ man: 2,
+ time: 600
},
- upgrade:['UpgradeAirArmor','UpgradePlasmaShields'],
- items:{
- '8':{name:'Load'},
- '9':{name:'UnloadAll'}
+ upgrade: ['UpgradeAirArmor', 'UpgradePlasmaShields'],
+ items: {
+ '8': { name: 'Load' },
+ '9': { name: 'UnloadAll' }
},
//Override
- dock:function(){
+ dock: function () {
//Use the same behavior
Unit.hover.call(this);
},
- die:Zerg.Overlord.prototype.die
+ die: Zerg.Overlord.prototype.die
}
});
-Protoss.Reaver=AttackableUnit.extends({
- constructorPlus:function(props){
- this.imgPos.attack=this.imgPos.dock;
- this.frame.attack=this.frame.dock;
- if (Multiplayer.ON) this.scarabNum=0;
- else this.scarabNum=(props.team!=Game.team)?999:0;
+Protoss.Reaver = AttackableUnit.extends({
+ constructorPlus: function (props) {
+ this.imgPos.attack = this.imgPos.dock;
+ this.frame.attack = this.frame.dock;
+ if (Multiplayer.ON)
+ this.scarabNum = 0;
+ else
+ this.scarabNum = (props.team != Game.team) ? 999 : 0;
//Override
- this.isReloaded=function(){
- return this.coolDown && this.scarabNum>0;
+ this.isReloaded = function () {
+ return this.coolDown && this.scarabNum > 0;
};
},
prototypePlus: {
@@ -727,223 +729,225 @@ Protoss.Reaver=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [0,0,0,0,0,0,0,0,0],[84,84,84,84,84,84,84,84,84],
- [168,168,168,168,168,168,168,168,168],[252,252,252,252,252,252,252,252,252],
- [336,336,336,336,336,336,336,336,336],[420,420,420,420,420,420,420,420,420],
- [504,504,504,504,504,504,504,504,504],[588,588,588,588,588,588,588,588,588],
- [672,672,672,672,672,672,672,672,672],[840,840,840,840,840,840,840,840,840],
- [924,924,924,924,924,924,924,924,924],[1008,1008,1008,1008,1008,1008,1008,1008,1008],
- [1092,1092,1092,1092,1092,1092,1092,1092,1092],[1176,1176,1176,1176,1176,1176,1176,1176,1176],
- [1260,1260,1260,1260,1260,1260,1260,1260,1260],[1344,1344,1344,1344,1344,1344,1344,1344,1344]
+ [0, 0, 0, 0, 0, 0, 0, 0, 0], [84, 84, 84, 84, 84, 84, 84, 84, 84],
+ [168, 168, 168, 168, 168, 168, 168, 168, 168], [252, 252, 252, 252, 252, 252, 252, 252, 252],
+ [336, 336, 336, 336, 336, 336, 336, 336, 336], [420, 420, 420, 420, 420, 420, 420, 420, 420],
+ [504, 504, 504, 504, 504, 504, 504, 504, 504], [588, 588, 588, 588, 588, 588, 588, 588, 588],
+ [672, 672, 672, 672, 672, 672, 672, 672, 672], [840, 840, 840, 840, 840, 840, 840, 840, 840],
+ [924, 924, 924, 924, 924, 924, 924, 924, 924], [1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008],
+ [1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092], [1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176],
+ [1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260], [1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344]
],
top: [
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
- [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672]
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
+ [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672]
]
},
dock: {
- left: [0,84,168,252,336,420,504,588,672,840,924,1008,1092,1176,1260,1344],
- top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ left: [0, 84, 168, 252, 336, 420, 504, 588, 672, 840, 924, 1008, 1092, 1176, 1260, 1344],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
}
},
- width: 84,//84N
- height: 84,//84N
+ width: 84,
+ height: 84,
frame: {
moving: 9,
dock: 1
},
//Only for moving status, override
- speed:4,
+ speed: 4,
HP: 100,
SP: 80,
damage: 100,
- armor:0,
- plasma:0,
- sight:350,
+ armor: 0,
+ plasma: 0,
+ sight: 350,
attackRange: 280,
attackInterval: 6000,
- dieEffect:Burst.BigBlueExplode,
- isFlying:false,
- attackLimit:"ground",
- unitType:Unit.BIG,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:Building.ProtossBuilding.prototype.recover,
- scarabCapacity:5,
- cost:{
- mine:200,
- gas:100,
- man:4,
- time:700
+ dieEffect: Burst.BigBlueExplode,
+ isFlying: false,
+ attackLimit: "ground",
+ unitType: Unit.BIG,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: Building.ProtossBuilding.prototype.recover,
+ scarabCapacity: 5,
+ cost: {
+ mine: 200,
+ gas: 100,
+ man: 4,
+ time: 700
},
- upgrade:['UpgradeGroundArmor','UpgradePlasmaShields'],
- items:{
- '7':{name:'Scarab',condition:function(){
- if (!Game.selectedUnit.scarabNum) $('button.attack').attr('disabled',true);
- else $('button.attack').removeAttr('disabled');
- return Game.selectedUnit.scarabNum0;
+ this.isReloaded = function () {
+ return this.coolDown && this.continuousAttack.count > 0;
};
},
prototypePlus: {
@@ -951,260 +955,263 @@ Protoss.Carrier=AttackableUnit.extends({
name: "Carrier",
imgPos: {
moving: {
- left: [0,256,512,768,1024,1408,1664,1920,0,256,512,768,1024,1408,1664,1920],
- top: [0,0,0,0,0,0,0,0,128,128,128,128,128,128,128,128]
+ left: [0, 256, 512, 768, 1024, 1408, 1664, 1920, 0, 256, 512, 768, 1024, 1408, 1664, 1920],
+ top: [0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128]
}
},
- width: 128,//128N(0,2,4,6,8,11,13,15)
- height: 128,//128N
+ width: 128,
+ height: 128,
frame: {
moving: 1
},
//Only for moving status, override
- speed:8,
+ speed: 8,
HP: 300,
SP: 150,
damage: 6,
- armor:4,
- plasma:0,
- sight:385,
+ armor: 4,
+ plasma: 0,
+ sight: 385,
attackRange: 280,
attackInterval: 1000,
- recover:Building.ProtossBuilding.prototype.recover,
- interceptorCapacity:4,
- continuousAttack:{
- count:4,//8
- layout:function(bullet,num){
+ recover: Building.ProtossBuilding.prototype.recover,
+ interceptorCapacity: 4,
+ continuousAttack: {
+ count: 4,
+ layout: function (bullet, num) {
//Reassign location, surround target
- var centerX=bullet.target.posX();
- var centerY=bullet.target.posY();
- var radius=120;
- switch (num){
+ var centerX = bullet.target.posX();
+ var centerY = bullet.target.posY();
+ var radius = 120;
+ switch (num) {
//Left
case 0:
- bullet.x=centerX-radius-bullet.width/2;
- bullet.y=centerY-bullet.height/2;
- bullet.speed={x:radius/4,y:0};
- bullet.angle=0;
+ bullet.x = centerX - radius - bullet.width / 2;
+ bullet.y = centerY - bullet.height / 2;
+ bullet.speed = { x: radius / 4, y: 0 };
+ bullet.angle = 0;
break;
//Right
case 1:
- bullet.x=centerX+radius-bullet.width/2;
- bullet.y=centerY-bullet.height/2;
- bullet.speed={x:-radius/4,y:0};
- bullet.angle=Math.PI;
+ bullet.x = centerX + radius - bullet.width / 2;
+ bullet.y = centerY - bullet.height / 2;
+ bullet.speed = { x: -radius / 4, y: 0 };
+ bullet.angle = Math.PI;
break;
//Top
case 2:
- bullet.x=centerX-bullet.width/2;
- bullet.y=centerY-radius-bullet.height/2;
- bullet.speed={x:0,y:radius/4};
- bullet.angle=-Math.PI/2;
+ bullet.x = centerX - bullet.width / 2;
+ bullet.y = centerY - radius - bullet.height / 2;
+ bullet.speed = { x: 0, y: radius / 4 };
+ bullet.angle = -Math.PI / 2;
break;
//Bottom
case 3:
- bullet.x=centerX-bullet.width/2;
- bullet.y=centerY+radius-bullet.height/2;
- bullet.speed={x:0,y:-radius/4};
- bullet.angle=Math.PI/2;
+ bullet.x = centerX - bullet.width / 2;
+ bullet.y = centerY + radius - bullet.height / 2;
+ bullet.speed = { x: 0, y: -radius / 4 };
+ bullet.angle = Math.PI / 2;
break;
//Top-left
case 4:
- bullet.x=centerX-radius*0.7-bullet.width/2;
- bullet.y=centerY-radius*0.7-bullet.height/2;
- bullet.speed={x:0.7*radius/4,y:0.7*radius/4};
- bullet.angle=-Math.PI/4;
+ bullet.x = centerX - radius * 0.7 - bullet.width / 2;
+ bullet.y = centerY - radius * 0.7 - bullet.height / 2;
+ bullet.speed = { x: 0.7 * radius / 4, y: 0.7 * radius / 4 };
+ bullet.angle = -Math.PI / 4;
break;
//Top-right
case 5:
- bullet.x=centerX+radius*0.7-bullet.width/2;
- bullet.y=centerY-radius*0.7-bullet.height/2;
- bullet.speed={x:-0.7*radius/4,y:0.7*radius/4};
- bullet.angle=-Math.PI*3/4;
+ bullet.x = centerX + radius * 0.7 - bullet.width / 2;
+ bullet.y = centerY - radius * 0.7 - bullet.height / 2;
+ bullet.speed = { x: -0.7 * radius / 4, y: 0.7 * radius / 4 };
+ bullet.angle = -Math.PI * 3 / 4;
break;
//Bottom-left
case 6:
- bullet.x=centerX-radius*0.7-bullet.width/2;
- bullet.y=centerY+radius*0.7-bullet.height/2;
- bullet.speed={x:0.7*radius/4,y:-0.7*radius/4};
- bullet.angle=Math.PI/4;
+ bullet.x = centerX - radius * 0.7 - bullet.width / 2;
+ bullet.y = centerY + radius * 0.7 - bullet.height / 2;
+ bullet.speed = { x: 0.7 * radius / 4, y: -0.7 * radius / 4 };
+ bullet.angle = Math.PI / 4;
break;
//Bottom-right
case 7:
- bullet.x=centerX+radius*0.7-bullet.width/2;
- bullet.y=centerY+radius*0.7-bullet.height/2;
- bullet.speed={x:-0.7*radius/4,y:-0.7*radius/4};
- bullet.angle=Math.PI*3/4;
+ bullet.x = centerX + radius * 0.7 - bullet.width / 2;
+ bullet.y = centerY + radius * 0.7 - bullet.height / 2;
+ bullet.speed = { x: -0.7 * radius / 4, y: -0.7 * radius / 4 };
+ bullet.angle = Math.PI * 3 / 4;
break;
}
}
},
- dieEffect:Burst.BigBlueExplode,
- isFlying:true,
- unitType:Unit.BIG,
- attackType:AttackableUnit.NORMAL_ATTACK,
- cost:{
- mine:350,
- gas:250,
- man:8,
- time:1400
+ dieEffect: Burst.BigBlueExplode,
+ isFlying: true,
+ unitType: Unit.BIG,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ cost: {
+ mine: 350,
+ gas: 250,
+ man: 8,
+ time: 1400
},
- upgrade:['UpgradeAirWeapons','UpgradeAirArmor','UpgradePlasmaShields'],
- items:{
- '7':{name:'Interceptor',condition:function(){
- if (!Game.selectedUnit.continuousAttack.count) $('button.attack').attr('disabled',true);
- else $('button.attack').removeAttr('disabled');
- return Game.selectedUnit.continuousAttack.count0;
+ };
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Reaver",
+ imgPos: {
+ moving: {
+ left: [
+ [0,0,0,0,0,0,0,0,0],[84,84,84,84,84,84,84,84,84],
+ [168,168,168,168,168,168,168,168,168],[252,252,252,252,252,252,252,252,252],
+ [336,336,336,336,336,336,336,336,336],[420,420,420,420,420,420,420,420,420],
+ [504,504,504,504,504,504,504,504,504],[588,588,588,588,588,588,588,588,588],
+ [672,672,672,672,672,672,672,672,672],[840,840,840,840,840,840,840,840,840],
+ [924,924,924,924,924,924,924,924,924],[1008,1008,1008,1008,1008,1008,1008,1008,1008],
+ [1092,1092,1092,1092,1092,1092,1092,1092,1092],[1176,1176,1176,1176,1176,1176,1176,1176,1176],
+ [1260,1260,1260,1260,1260,1260,1260,1260,1260],[1344,1344,1344,1344,1344,1344,1344,1344,1344]
+ ],
+ top: [
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672],
+ [0,84,168,252,336,420,504,588,672],[0,84,168,252,336,420,504,588,672]
+ ]
+ },
+ dock: {
+ left: [0,84,168,252,336,420,504,588,672,840,924,1008,1092,1176,1260,1344],
+ top: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
+ }
+ },
+ width: 84,//84N
+ height: 84,//84N
+ frame: {
+ moving: 9,
+ dock: 1
+ },
+ //Only for moving status, override
+ speed:4,
+ HP: 100,
+ SP: 80,
+ damage: 100,
+ armor:0,
+ plasma:0,
+ sight:350,
+ attackRange: 280,
+ attackInterval: 6000,
+ dieEffect:Burst.BigBlueExplode,
+ isFlying:false,
+ attackLimit:"ground",
+ unitType:Unit.BIG,
+ attackType:AttackableUnit.NORMAL_ATTACK,
+ recover:Building.ProtossBuilding.prototype.recover,
+ scarabCapacity:5,
+ cost:{
+ mine:200,
+ gas:100,
+ man:4,
+ time:700
+ },
+ upgrade:['UpgradeGroundArmor','UpgradePlasmaShields'],
+ items:{
+ '7':{name:'Scarab',condition:function(){
+ if (!Game.selectedUnit.scarabNum) $('button.attack').attr('disabled',true);
+ else $('button.attack').removeAttr('disabled');
+ return Game.selectedUnit.scarabNum0;
+ };
+ },
+ prototypePlus: {
+ //Add basic unit info
+ name: "Carrier",
+ imgPos: {
+ moving: {
+ left: [0,256,512,768,1024,1408,1664,1920,0,256,512,768,1024,1408,1664,1920],
+ top: [0,0,0,0,0,0,0,0,128,128,128,128,128,128,128,128]
+ }
+ },
+ width: 128,//128N(0,2,4,6,8,11,13,15)
+ height: 128,//128N
+ frame: {
+ moving: 1
+ },
+ //Only for moving status, override
+ speed:8,
+ HP: 300,
+ SP: 150,
+ damage: 6,
+ armor:4,
+ plasma:0,
+ sight:385,
+ attackRange: 280,
+ attackInterval: 1000,
+ recover:Building.ProtossBuilding.prototype.recover,
+ interceptorCapacity:4,
+ continuousAttack:{
+ count:4,//8
+ layout:function(bullet,num){
+ //Reassign location, surround target
+ var centerX=bullet.target.posX();
+ var centerY=bullet.target.posY();
+ var radius=120;
+ switch (num){
+ //Left
+ case 0:
+ bullet.x=centerX-radius-bullet.width/2;
+ bullet.y=centerY-bullet.height/2;
+ bullet.speed={x:radius/4,y:0};
+ bullet.angle=0;
+ break;
+ //Right
+ case 1:
+ bullet.x=centerX+radius-bullet.width/2;
+ bullet.y=centerY-bullet.height/2;
+ bullet.speed={x:-radius/4,y:0};
+ bullet.angle=Math.PI;
+ break;
+ //Top
+ case 2:
+ bullet.x=centerX-bullet.width/2;
+ bullet.y=centerY-radius-bullet.height/2;
+ bullet.speed={x:0,y:radius/4};
+ bullet.angle=-Math.PI/2;
+ break;
+ //Bottom
+ case 3:
+ bullet.x=centerX-bullet.width/2;
+ bullet.y=centerY+radius-bullet.height/2;
+ bullet.speed={x:0,y:-radius/4};
+ bullet.angle=Math.PI/2;
+ break;
+ //Top-left
+ case 4:
+ bullet.x=centerX-radius*0.7-bullet.width/2;
+ bullet.y=centerY-radius*0.7-bullet.height/2;
+ bullet.speed={x:0.7*radius/4,y:0.7*radius/4};
+ bullet.angle=-Math.PI/4;
+ break;
+ //Top-right
+ case 5:
+ bullet.x=centerX+radius*0.7-bullet.width/2;
+ bullet.y=centerY-radius*0.7-bullet.height/2;
+ bullet.speed={x:-0.7*radius/4,y:0.7*radius/4};
+ bullet.angle=-Math.PI*3/4;
+ break;
+ //Bottom-left
+ case 6:
+ bullet.x=centerX-radius*0.7-bullet.width/2;
+ bullet.y=centerY+radius*0.7-bullet.height/2;
+ bullet.speed={x:0.7*radius/4,y:-0.7*radius/4};
+ bullet.angle=Math.PI/4;
+ break;
+ //Bottom-right
+ case 7:
+ bullet.x=centerX+radius*0.7-bullet.width/2;
+ bullet.y=centerY+radius*0.7-bullet.height/2;
+ bullet.speed={x:-0.7*radius/4,y:-0.7*radius/4};
+ bullet.angle=Math.PI*3/4;
+ break;
+ }
+ }
+ },
+ dieEffect:Burst.BigBlueExplode,
+ isFlying:true,
+ unitType:Unit.BIG,
+ attackType:AttackableUnit.NORMAL_ATTACK,
+ cost:{
+ mine:350,
+ gas:250,
+ man:8,
+ time:1400
+ },
+ upgrade:['UpgradeAirWeapons','UpgradeAirArmor','UpgradePlasmaShields'],
+ items:{
+ '7':{name:'Interceptor',condition:function(){
+ if (!Game.selectedUnit.continuousAttack.count) $('button.attack').attr('disabled',true);
+ else $('button.attack').removeAttr('disabled');
+ return Game.selectedUnit.continuousAttack.count=arrLimit) {
- this.action=0;
+ var arrLimit = (this.imgPos[this.status].left[0] instanceof Array) ? (this.imgPos[this.status].left[0].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[0][this.action]==-1) this.action=0;
+ if (this.imgPos[this.status].left[0][this.action] == -1)
+ this.action = 0;
},
- detectOutOfBound:function(){
- var boundX=Map.getCurrentMap().width-this.width;
- var boundY=Map.getCurrentMap().height-this.height;
+ detectOutOfBound: function () {
+ var boundX = Map.getCurrentMap().width - this.width;
+ var boundY = Map.getCurrentMap().height - this.height;
//Right Bound
- if (this.x>boundX) {
- this.x=boundX;
+ if (this.x > boundX) {
+ this.x = boundX;
}
//Left Bound
- if (this.x<0) {
- this.x=0;
+ if (this.x < 0) {
+ this.x = 0;
}
//Bottom Bound
- if (this.y>boundY) {
- this.y=boundY;
+ if (this.y > boundY) {
+ this.y = boundY;
}
//Top Bound
- if (this.y<0) {
- this.y=0;
+ if (this.y < 0) {
+ this.y = 0;
}
},
//Can move in any direction
- updateLocation:function(){
- this.x=Math.round(this.x+this.get('speed')*Math.cos(this.angle));
- this.y=Math.round(this.y+this.get('speed')*Math.sin(this.angle));
+ updateLocation: function () {
+ this.x = Math.round(this.x + this.get('speed') * Math.cos(this.angle));
+ this.y = Math.round(this.y + this.get('speed') * Math.sin(this.angle));
},
//Add new functions to prototype
- turnTo:function(direction){
+ turnTo: function (direction) {
//Change direction
- this.direction=direction;
+ this.direction = direction;
},
//Dock means stop moving but keep animation
- dock:function(){
+ dock: function () {
//Clear old timer
this.stop();
//Launch new dock timer
- this.status="dock";
- this.action=0;
+ this.status = "dock";
+ this.action = 0;
//Stop routing
delete this.allFrames['routing'];
- var myself=this;
- var animateFrame=function(){
+ var myself = this;
+ var animateFrame = function () {
//Only play animation, will not move
myself.animeFrame();
};
- this.allFrames['animate']=animateFrame;
+ this.allFrames['animate'] = animateFrame;
},
- stand:function(){
+ stand: function () {
this.dock();
- },//alias
- stopMoving:function(){
+ },
+ stopMoving: function () {
this.dock();
- },//alias
- run:function(){
+ },
+ run: function () {
this.moving();
- },//alias
- navigateTo:function(clickX,clickY,range){
- if (!range) range=Unit.moveRange;//Smallest limit by default
+ },
+ navigateTo: function (clickX, clickY, range) {
+ if (!range)
+ range = Unit.moveRange; //Smallest limit by default
//Center position
- var charaX=this.posX();
- var charaY=this.posY();
+ var charaX = this.posX();
+ var charaY = this.posY();
//Already at check point
- if (this.insideCircle({centerX:clickX,centerY:clickY,radius:range})) {
+ if (this.insideCircle({ centerX: clickX, centerY: clickY, radius: range })) {
this.dock();
//Stop routing
delete this.allFrames['routing'];
//Reach destination flag
return true;
}
- //Need move
else {
- var vector=[clickX-this.posX(),clickY-this.posY()];
- vector=vector.map(function(n){
- return n/_$.hypot(vector);
+ var vector = [clickX - this.posX(), clickY - this.posY()];
+ vector = vector.map(function (n) {
+ return n / _$.hypot(vector);
});
//Only unit on ground will collide with others
- const FORCE=0.4;
- if (!this.isFlying){
- const myself=this;
+ var FORCE_1 = 0.4;
+ if (!this.isFlying) {
+ var myself_1 = this;
//Soft collision
- var softCollisions=Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
- if (chara==myself) return false;
- else return !(chara.isFlying) && chara.softCollideWith(myself);
+ var softCollisions = Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
+ if (chara == myself_1)
+ return false;
+ else
+ return !(chara.isFlying) && chara.softCollideWith(myself_1);
});
- softCollisions.forEach(function(chara){
- var softResist=[myself.posX()-chara.posX(),myself.posY()-chara.posY()];
- softResist=softResist.map(function(n){
- return n*FORCE/_$.hypot(softResist);
+ softCollisions.forEach(function (chara) {
+ var softResist = [myself_1.posX() - chara.posX(), myself_1.posY() - chara.posY()];
+ softResist = softResist.map(function (n) {
+ return n * FORCE_1 / _$.hypot(softResist);
});
- vector[0]+=softResist[0];
- vector[1]+=softResist[1];
+ vector[0] += softResist[0];
+ vector[1] += softResist[1];
});
//Hard collision
- softCollisions.filter(function(chara){
- return chara.collideWith(myself);
- }).forEach(function(chara){
- var hardResist=[myself.posX()-chara.posX(),myself.posY()-chara.posY()];
- hardResist=hardResist.map(function(n){
- return n*FORCE/_$.hypot(hardResist);
+ softCollisions.filter(function (chara) {
+ return chara.collideWith(myself_1);
+ }).forEach(function (chara) {
+ var hardResist = [myself_1.posX() - chara.posX(), myself_1.posY() - chara.posY()];
+ hardResist = hardResist.map(function (n) {
+ return n * FORCE_1 / _$.hypot(hardResist);
});
- vector[0]+=hardResist[0];
- vector[1]+=hardResist[1];
+ vector[0] += hardResist[0];
+ vector[1] += hardResist[1];
});
}
this.turnTo(Unit.wrapDirection(vector));
- vector.reverse();//y,x
- this.angle=Math.atan2(vector[0],vector[1]);
+ vector.reverse(); //y,x
+ this.angle = Math.atan2(vector[0], vector[1]);
}
},
- faceTo:function(target,preventAction){
+ faceTo: function (target, preventAction) {
var direction;
//Unit or Building
- if (target instanceof Gobj){
- direction=Unit.wrapDirection([target.posX()-this.posX(),target.posY()-this.posY()]);
+ if (target instanceof Gobj) {
+ direction = Unit.wrapDirection([target.posX() - this.posX(), target.posY() - this.posY()]);
}
else {
//Location={x:1,y:2}
- direction=Unit.wrapDirection([target.x-this.posX(),target.y-this.posY()]);
+ direction = Unit.wrapDirection([target.x - this.posX(), target.y - this.posY()]);
}
- if (!preventAction) this.turnTo(direction);
+ if (!preventAction)
+ this.turnTo(direction);
return direction;
},
- escapeFrom:function(enemy){
+ escapeFrom: function (enemy) {
//Add to fix holding issue
- if (this.hold) return;
+ if (this.hold)
+ return;
//From enemy to myself
- var escapeVector=[this.posX()-enemy.posX(),this.posY()-enemy.posY()];
+ var escapeVector = [this.posX() - enemy.posX(), this.posY() - enemy.posY()];
//Move by 100px
- escapeVector=escapeVector.map(function(n){
- return n*100/_$.hypot(escapeVector);
+ escapeVector = escapeVector.map(function (n) {
+ return n * 100 / _$.hypot(escapeVector);
});
//Escape along vector
- this.moveTo(this.posX()+escapeVector[0],this.posY()+escapeVector[1]);
+ this.moveTo(this.posX() + escapeVector[0], this.posY() + escapeVector[1]);
},
- moveTo:function(clickX,clickY,range,callback){
- if (!range) range=Unit.moveRange;//Smallest limit by default
+ moveTo: function (clickX, clickY, range, callback) {
+ if (!range)
+ range = Unit.moveRange; //Smallest limit by default
//Start new routing
- var myself=this;
- var routingFrame=function(){
- if (myself.navigateTo(clickX,clickY,range)){
+ var myself = this;
+ var routingFrame = function () {
+ if (myself.navigateTo(clickX, clickY, range)) {
//Run callback when reach target
- if (typeof(callback)=='function') callback();
+ if (typeof (callback) == 'function')
+ callback();
return true;
}
};
- this.allFrames['routing']=routingFrame;
+ this.allFrames['routing'] = routingFrame;
//Start moving
this.run();
},
- moveToward:function(target,range,callback){
- if (!range) range=Unit.moveRange;//Smallest limit by default
+ moveToward: function (target, range, callback) {
+ if (!range)
+ range = Unit.moveRange; //Smallest limit by default
//Start new routing
- var myself=this;
- var routingFrame=function(){
- if (target.status!='dead'){
- if (myself.navigateTo(target.posX(),target.posY(),range)) {
+ var myself = this;
+ var routingFrame = function () {
+ if (target.status != 'dead') {
+ if (myself.navigateTo(target.posX(), target.posY(), range)) {
//Run callback when reach target
- if (typeof(callback)=='function') callback();
+ if (typeof (callback) == 'function')
+ callback();
//Reach destination flag, fix twice callback issue
return true;
}
}
- //Will stop move toward dead target
else {
delete myself.allFrames['routing'];
myself.dock();
}
};
- this.allFrames['routing']=routingFrame;
+ this.allFrames['routing'] = routingFrame;
//Start moving
this.run();
},
//Override for sound effect
- die:function(){
+ die: function () {
//Old behavior
Gobj.prototype.die.call(this);
- this.life=0;
+ this.life = 0;
//Stop routing
delete this.allFrames['routing'];
//If has sound effect
@@ -225,11 +235,11 @@ var Unit=Gobj.extends({
}
},
//AI when attacked by enemy
- reactionWhenAttackedBy:function(enemy,onlyDamage){
+ reactionWhenAttackedBy: function (enemy, onlyDamage) {
//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
@@ -239,412 +249,443 @@ var Unit=Gobj.extends({
return;
}
//Run away toward bullet direction
- if (this.status=="dock" && !onlyDamage){
+ if (this.status == "dock" && !onlyDamage) {
this.escapeFrom(enemy);
}
},
//Calculate damage, if enemy is damage itself, return that damage directly
- calculateDamageBy:function(enemyObj){
- var damage=0;
- if (enemyObj instanceof Gobj){
- var enemyAttackType=enemyObj.attackType;
- if (!enemyAttackType && enemyObj.attackMode){
- enemyAttackType=(this.isFlying)?enemyObj.attackMode.flying.attackType:enemyObj.attackMode.ground.attackType;
+ calculateDamageBy: function (enemyObj) {
+ var damage = 0;
+ if (enemyObj instanceof Gobj) {
+ var enemyAttackType = enemyObj.attackType;
+ if (!enemyAttackType && enemyObj.attackMode) {
+ enemyAttackType = (this.isFlying) ? enemyObj.attackMode.flying.attackType : enemyObj.attackMode.ground.attackType;
}
- damage=enemyObj.get('damage')*Unit.attackMatrix[enemyAttackType][this.unitType];
+ damage = enemyObj.get('damage') * Unit.attackMatrix[enemyAttackType][this.unitType];
}
- else damage=enemyObj;
+ else
+ damage = enemyObj;
return damage;
},
- 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=0.5;
- this.shield-=damage;
- if (this.shield<0) {
+ if (this.shield > 0) {
+ damage = ((this.calculateDamageBy(enemy) - this.get('plasma')) * percent) >> 0;
+ if (damage < 1)
+ damage = 0.5;
+ 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=((this.calculateDamageBy(enemy)-this.get('armor'))*percent)>>0;
- if (damage<1) damage=0.5;
- this.life-=damage;
+ damage = ((this.calculateDamageBy(enemy) - this.get('armor')) * percent) >> 0;
+ if (damage < 1)
+ damage = 0.5;
+ this.life -= damage;
}
},
//Attack ground action
- attackGround:function(position,loop){
+ attackGround: function (position, loop) {
//Convert to array
- var positions=[].concat(position);
- if (this.attack) this.stopAttack();
+ var positions = [].concat(position);
+ if (this.attack)
+ this.stopAttack();
//Move to first position
- this.moveTo(positions[0].x,positions[0].y);
- this.targetLock=false;
- var checkpoint=this.destination=positions[0];
+ this.moveTo(positions[0].x, positions[0].y);
+ this.targetLock = false;
+ var checkpoint = this.destination = positions[0];
//Join destination chain from next
- positions.slice(1).forEach(function(pos){
- checkpoint.next=pos;
- checkpoint=checkpoint.next;
+ positions.slice(1).forEach(function (pos) {
+ checkpoint.next = pos;
+ checkpoint = checkpoint.next;
});
//Patrol loop, dead lock
- if (loop) checkpoint.next=this.destination;
+ if (loop)
+ checkpoint.next = this.destination;
},
//Patrol action
- patrol:function(position,addHere){
+ patrol: function (position, addHere) {
//Convert to array
- var positions=[].concat(position);
- if (addHere) positions.push({x:this.posX(),y:this.posY()});
- this.attackGround(positions,true);
+ var positions = [].concat(position);
+ if (addHere)
+ positions.push({ x: this.posX(), y: this.posY() });
+ this.attackGround(positions, true);
},
- isMachine:function(){
- return ["SCV","Vulture","Tank","Goliath","Wraith","Dropship","Vessel","BattleCruiser","Valkyrie",
- "Probe","Dragoon","Shuttle","Reaver","Observer","Scout","Carrier","Arbiter","Corsair","HeroCruiser"]
- .indexOf(this.name)!=-1;
+ isMachine: function () {
+ return ["SCV", "Vulture", "Tank", "Goliath", "Wraith", "Dropship", "Vessel", "BattleCruiser", "Valkyrie",
+ "Probe", "Dragoon", "Shuttle", "Reaver", "Observer", "Scout", "Carrier", "Arbiter", "Corsair", "HeroCruiser"]
+ .indexOf(this.name) != -1;
},
//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");
}
}
});
//Assign current ID to each newly born unit
-Unit.currentID=0;
+Unit.currentID = 0;
//Smallest range for move precision
-Unit.moveRange=20;
+Unit.moveRange = 20;
//Range for mouse select
-Unit.selectRange=20;
+Unit.selectRange = 20;
//Range for melee attack
-Unit.meleeRange=25;//50
+Unit.meleeRange = 25; //50
//Speed matrix, 2^0.5=>0.7
-Unit.speedMatrix=[
- {x: 0, y: -1},{x: 0.4, y: -0.9},
- {x: 0.7, y: -0.7},{x: 0.9, y: -0.4},
- {x: 1, y: 0},{x: 0.9, y: 0.4},
- {x: 0.7, y: 0.7},{x: 0.4, y: 0.9},
- {x: 0, y: 1},{x: -0.4, y: 0.9},
- {x: -0.7, y: 0.7},{x: -0.9, y: 0.4},
- {x: -1, y: 0},{x: -0.9, y: -0.4},
- {x: -0.7, y: -0.7},{x: -0.4, y: -0.9}
+Unit.speedMatrix = [
+ { x: 0, y: -1 }, { x: 0.4, y: -0.9 },
+ { x: 0.7, y: -0.7 }, { x: 0.9, y: -0.4 },
+ { x: 1, y: 0 }, { x: 0.9, y: 0.4 },
+ { x: 0.7, y: 0.7 }, { x: 0.4, y: 0.9 },
+ { x: 0, y: 1 }, { x: -0.4, y: 0.9 },
+ { x: -0.7, y: 0.7 }, { x: -0.9, y: 0.4 },
+ { x: -1, y: 0 }, { x: -0.9, y: -0.4 },
+ { x: -0.7, y: -0.7 }, { x: -0.4, y: -0.9 }
];
//Get speed matrix by unit speed
-Unit.getSpeedMatrixBy=function(speed){
- var speedMatrix=_$.clone(Unit.speedMatrix);
- _$.matrixOperation(speedMatrix,function(N){
- return N*speed;
+Unit.getSpeedMatrixBy = function (speed) {
+ var speedMatrix = _$.clone(Unit.speedMatrix);
+ _$.matrixOperation(speedMatrix, function (N) {
+ return N * speed;
});
return speedMatrix;
};
//All units' sight
-Unit.sight=300;
+Unit.sight = 300;
//Attack type matrix
-Unit.attackMatrix=[
- [1,1,1],
- [0.5,0.75,1],
- [1,0.5,0.25]
+Unit.attackMatrix = [
+ [1, 1, 1],
+ [0.5, 0.75, 1],
+ [1, 0.5, 0.25]
];
//Unit type
-Unit.SMALL=0;
-Unit.MIDDLE=1;
-Unit.BIG=2;
+Unit.SMALL = 0;
+Unit.MIDDLE = 1;
+Unit.BIG = 2;
//All existed units, class property
-Unit.allUnits=[];
-Unit.allOurUnits=function(){
- return Unit.allUnits.filter(function(chara){
+Unit.allUnits = [];
+Unit.allOurUnits = function () {
+ return Unit.allUnits.filter(function (chara) {
return !(chara.isEnemy());
});
};
-Unit.allEnemyUnits=function(){
- return Unit.allUnits.filter(function(chara){
+Unit.allEnemyUnits = function () {
+ return Unit.allUnits.filter(function (chara) {
return chara.isEnemy();
});
};
-Unit.allFlyingUnits=function(){
- return Unit.allUnits.filter(function(chara){
+Unit.allFlyingUnits = function () {
+ return Unit.allUnits.filter(function (chara) {
return chara.isFlying;
});
};
-Unit.allGroundUnits=function(){
- return Unit.allUnits.filter(function(chara){
+Unit.allGroundUnits = function () {
+ return Unit.allUnits.filter(function (chara) {
return !(chara.isFlying);
});
};
//Get all units count
-Unit.count=function(){
- return Unit.allUnits.reduce(function(counts,chara){
+Unit.count = function () {
+ return Unit.allUnits.reduce(function (counts, chara) {
counts[chara.team]++;
return counts;
- },Game.getPropArray(0));
+ }, Game.getPropArray(0));
};
//Sort all units to show flying unit above/after ground unit
-Unit.sortAllUnits=function(){
- Unit.allUnits.sort(function(unit1,unit2){
- return (unit1.isFlying?1:0)-(unit2.isFlying?1:0);
+Unit.sortAllUnits = function () {
+ Unit.allUnits.sort(function (unit1, unit2) {
+ return (unit1.isFlying ? 1 : 0) - (unit2.isFlying ? 1 : 0);
});
};
//Sort units
-Unit.sortUnits=function(units){
- units.sort(function(unit1,unit2){
- return (unit1.isFlying?1:0)-(unit2.isFlying?1:0);
+Unit.sortUnits = function (units) {
+ units.sort(function (unit1, unit2) {
+ return (unit1.isFlying ? 1 : 0) - (unit2.isFlying ? 1 : 0);
});
};
//Random direction but can keep all clients same
-Unit.randomDirection=function(){
+Unit.randomDirection = function () {
//Clossure variable and function
- var rands=[];
- var getRands=function(){
+ var rands = [];
+ var getRands = function () {
//Use current tick X randomSeed as seed
- var seed=Game.mainTick+Game.randomSeed;
- var rands=[];
- for (var N=0;N<16;N++){
+ var seed = Game.mainTick + Game.randomSeed;
+ var rands = [];
+ for (var N = 0; N < 16; N++) {
//Seed grows up
- seed=(seed*5+3)%16;//range=16
+ seed = (seed * 5 + 3) % 16; //range=16
rands.push(seed);
}
return rands;
};
- return function(){
+ return function () {
//If all rands used, generate new ones
- if (rands.length==0) rands=getRands();
+ if (rands.length == 0)
+ rands = getRands();
return rands.shift();
- }
+ };
}();
//Convert from vector to 16 directions
-Unit.wrapDirection=function(vector){
+Unit.wrapDirection = function (vector) {
//Atan2 can distinguish from -PI~PI, Y-axis is reverse
- var angle=Math.atan2(vector[1],vector[0]);
- var piece=Math.PI/16;
- if (angle>(piece*15)) return 12;
- if (angle>(piece*13)) return 11;
- if (angle>(piece*11)) return 10;
- if (angle>(piece*9)) return 9;
- if (angle>(piece*7)) return 8;
- if (angle>(piece*5)) return 7;
- if (angle>(piece*3)) return 6;
- if (angle>piece) return 5;
- if (angle>(-piece)) return 4;
- if (angle>(-piece*3)) return 3;
- if (angle>(-piece*5)) return 2;
- if (angle>(-piece*7)) return 1;
- if (angle>(-piece*9)) return 0;
- if (angle>(-piece*11)) return 15;
- if (angle>(-piece*13)) return 14;
- if (angle>(-piece*15)) return 13;
- else return 12;
+ var angle = Math.atan2(vector[1], vector[0]);
+ var piece = Math.PI / 16;
+ if (angle > (piece * 15))
+ return 12;
+ if (angle > (piece * 13))
+ return 11;
+ if (angle > (piece * 11))
+ return 10;
+ if (angle > (piece * 9))
+ return 9;
+ if (angle > (piece * 7))
+ return 8;
+ if (angle > (piece * 5))
+ return 7;
+ if (angle > (piece * 3))
+ return 6;
+ if (angle > piece)
+ return 5;
+ if (angle > (-piece))
+ return 4;
+ if (angle > (-piece * 3))
+ return 3;
+ if (angle > (-piece * 5))
+ return 2;
+ if (angle > (-piece * 7))
+ return 1;
+ if (angle > (-piece * 9))
+ return 0;
+ if (angle > (-piece * 11))
+ return 15;
+ if (angle > (-piece * 13))
+ return 14;
+ if (angle > (-piece * 15))
+ return 13;
+ else
+ return 12;
};
//Dock action I
-Unit.turnAround=function(){
+Unit.turnAround = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var dockFrame=function(){
+ var myself = this;
+ var dockFrame = function () {
//Every 2 sec
- if ((Game.mainTick+myself.id)%20==0){
+ if ((Game.mainTick + myself.id) % 20 == 0) {
//Look around animation
- if (myself.status=="dock") {
- myself.turnTo((myself.direction+1)%16);//For all ground soldier to use
+ if (myself.status == "dock") {
+ myself.turnTo((myself.direction + 1) % 16); //For all ground soldier to use
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
}
};
- this.allFrames['dock']=dockFrame;
+ this.allFrames['dock'] = dockFrame;
};
//Dock action II
-Unit.walkAround=function(){
+Unit.walkAround = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var dockFrame=function(){
+ var myself = this;
+ var dockFrame = function () {
//Every 2 sec
- if ((Game.mainTick+myself.id)%20==0){
- var direction=Unit.randomDirection();
+ if ((Game.mainTick + myself.id) % 20 == 0) {
+ var direction = Unit.randomDirection();
//Walk around, for all critters to use
- if (myself.status=="dock") {
- myself.moveTo(myself.posX()+myself.get('speed')*(Unit.speedMatrix[direction].x)*6,
- myself.posY()+myself.get('speed')*(Unit.speedMatrix[direction].y)*6);
+ if (myself.status == "dock") {
+ myself.moveTo(myself.posX() + myself.get('speed') * (Unit.speedMatrix[direction].x) * 6, myself.posY() + myself.get('speed') * (Unit.speedMatrix[direction].y) * 6);
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
}
};
- this.allFrames['dock']=dockFrame;
+ this.allFrames['dock'] = dockFrame;
};
//Dock action III
-Unit.hover=function(){
+Unit.hover = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var N=0;
- var hoverOffset=1;
- var dockFrame=function(){
+ var myself = this;
+ var N = 0;
+ var hoverOffset = 1;
+ var dockFrame = function () {
//Every 200 ms
- if (Game.mainTick%2==0){
+ if (Game.mainTick % 2 == 0) {
//Hover animation
- if (myself.status=="dock") {
- myself.y+=hoverOffset;
- if (N%4==0) {
+ if (myself.status == "dock") {
+ myself.y += hoverOffset;
+ if (N % 4 == 0) {
//myself.turnTo((myself.direction+1)%16);//For marine to use
- hoverOffset=-hoverOffset;//Hover up and down
+ hoverOffset = -hoverOffset; //Hover up and down
}
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
N++;
}
};
- this.allFrames['dock']=dockFrame;
+ this.allFrames['dock'] = dockFrame;
};
//Dock action IV
-Unit.walkAroundLarva=function(){
+Unit.walkAroundLarva = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var dockFrame=function(){
+ var myself = this;
+ var dockFrame = function () {
//Every 2 sec
- if (Game.mainTick%20==0){
+ if (Game.mainTick % 20 == 0) {
//Walk around, for larva to use
- if (myself.status=="dock") {
+ if (myself.status == "dock") {
if (myself.moved) {
//Return to original position, range=larva.speed=4
- Unit.prototype.moveTo.call(myself,myself.originX,myself.originY,4);
- myself.moved=false;
+ Unit.prototype.moveTo.call(myself, myself.originX, myself.originY, 4);
+ myself.moved = false;
}
else {
//Left from original position, range=larva.speed=4
- myself.direction=Unit.randomDirection();
- Unit.prototype.moveTo.call(myself,
- myself.posX()+myself.get('speed')*(Unit.speedMatrix[myself.direction].x)*2,
- myself.posY()+myself.get('speed')*(Unit.speedMatrix[myself.direction].y)*2,4);
- myself.moved=true;
+ myself.direction = Unit.randomDirection();
+ Unit.prototype.moveTo.call(myself, myself.posX() + myself.get('speed') * (Unit.speedMatrix[myself.direction].x) * 2, myself.posY() + myself.get('speed') * (Unit.speedMatrix[myself.direction].y) * 2, 4);
+ myself.moved = true;
}
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
}
};
- this.allFrames['dock']=dockFrame;
+ this.allFrames['dock'] = dockFrame;
};
-var AttackableUnit=Unit.extends({
- constructorPlus:function(props){
- this.bullet={};
- this.kill=0;
- this.target={};
+var AttackableUnit = Unit.extends({
+ constructorPlus: function (props) {
+ this.bullet = {};
+ this.kill = 0;
+ this.target = {};
//Idle by default
- this.targetLock=false;
+ this.targetLock = false;
//Can fire by default
- this.coolDown=true;
+ this.coolDown = true;
//Init attack range
- if (this.meleeAttack) this.attackRange=Math.max(this.radius(),35);
+ if (this.meleeAttack)
+ this.attackRange = Math.max(this.radius(), 35);
//Add attack sound for AttackableUnit
- this.sound.attack=new Audio(Game.CDN+'bgm/'+this.name+'.attack.wav');
+ this.sound.attack = new Audio(Game.CDN + 'bgm/' + this.name + '.attack.wav');
},
- prototypePlus:{
+ prototypePlus: {
//Add basic unit info
- name:"AttackableUnit",
- isInAttackRange:function(enemy){
- return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('attackRange')});
+ name: "AttackableUnit",
+ isInAttackRange: function (enemy) {
+ return enemy.inside({ centerX: this.posX(), centerY: this.posY(), radius: this.get('attackRange') });
},
- matchAttackLimit:function(enemy){
+ matchAttackLimit: function (enemy) {
//Has attack limit
- if (this.attackLimit){
+ if (this.attackLimit) {
//Doesn't match attack limit
- if ((this.attackLimit=="flying" && !(enemy.isFlying)) ||
- (this.attackLimit=="ground" && enemy.isFlying)) return false;
+ if ((this.attackLimit == "flying" && !(enemy.isFlying)) ||
+ (this.attackLimit == "ground" && enemy.isFlying))
+ return false;
}
//No attack limit or match attack limit
return true;
},
- attack:function(enemy){
+ attack: function (enemy) {
//Cannot attack invisible unit or unit who mismatch your attack type
- if (enemy['isInvisible'+this.team] || !(this.matchAttackLimit(enemy))) {
+ if (enemy['isInvisible' + this.team] || !(this.matchAttackLimit(enemy))) {
Referee.voice('pError').play();
this.stopAttack();
return;
}
//Don't attack same target again unless miss target or tracing target
- if (this.target==enemy) {
+ if (this.target == enemy) {
if (this.cannotReachTarget()) {
- if (this.status=='moving') return;//tracing
+ if (this.status == 'moving')
+ return; //tracing
}
- else return;
+ else
+ return;
}
- //Recover attack range
- else delete this.tracing;
- if (enemy instanceof Gobj && enemy.status!="dead") {
+ else
+ delete this.tracing;
+ if (enemy instanceof Gobj && enemy.status != "dead") {
//Stop old attack and moving
this.stopAttack();
this.dock();
//New attack
- this.target=enemy;
+ this.target = enemy;
//Get melee attack range if melee attack unit
if (this.meleeAttack) {
//Override
- this.attackRange=this.radius()+enemy.radius();
+ this.attackRange = this.radius() + enemy.radius();
}
//If separate attack mode, override
if (this.attackMode) {
- this.Bullet=(enemy.isFlying)?this.attackMode.flying.Bullet:this.attackMode.ground.Bullet;
- this.attackRange=(enemy.isFlying)?this.get('attackMode.flying.attackRange'):this.get('attackMode.ground.attackRange');
- this.attackEffect=(enemy.isFlying)?this.attackMode.flying.attackEffect:this.attackMode.ground.attackEffect;
- this.attackInterval=(enemy.isFlying)?this.get('attackMode.flying.attackInterval'):this.get('attackMode.ground.attackInterval');
+ this.Bullet = (enemy.isFlying) ? this.attackMode.flying.Bullet : this.attackMode.ground.Bullet;
+ this.attackRange = (enemy.isFlying) ? this.get('attackMode.flying.attackRange') : this.get('attackMode.ground.attackRange');
+ this.attackEffect = (enemy.isFlying) ? this.attackMode.flying.attackEffect : this.attackMode.ground.attackEffect;
+ this.attackInterval = (enemy.isFlying) ? this.get('attackMode.flying.attackInterval') : this.get('attackMode.ground.attackInterval');
//Change attack bgm
- this.sound.attack=(enemy.isFlying)?this.sound.attackF:this.sound.attackG;
- this.damage=(enemy.isFlying)?this.get('attackMode.flying.damage'):this.get('attackMode.ground.damage');
- this.attackType=(enemy.isFlying)?this.attackMode.flying.attackType:this.attackMode.ground.attackType;
- this.attackMode.status=enemy.isFlying;
+ this.sound.attack = (enemy.isFlying) ? this.sound.attackF : this.sound.attackG;
+ this.damage = (enemy.isFlying) ? this.get('attackMode.flying.damage') : this.get('attackMode.ground.damage');
+ this.attackType = (enemy.isFlying) ? this.attackMode.flying.attackType : this.attackMode.ground.attackType;
+ this.attackMode.status = enemy.isFlying;
}
//Move in attack range, no need to move melee
- var range=this.get('attackRange');
+ var range = this.get('attackRange');
if (this.tracing) {
//Adjust attack range for tracing
- range=Math.max(this.get('attackRange')*0.7,(this.radius()+enemy.radius())*0.6);
+ range = Math.max(this.get('attackRange') * 0.7, (this.radius() + enemy.radius()) * 0.6);
delete this.tracing;
}
//Add to fix holding issue
- if (!this.hold) this.moveToward(enemy,range);
- var myself=this;
- var attackFrame=function(){
+ if (!this.hold)
+ this.moveToward(enemy, range);
+ var myself = this;
+ var attackFrame = function () {
//If enemy already dead or becomes invisible or we just miss enemy
- if (enemy.status=="dead" || enemy['isInvisible'+myself.team] || myself.isMissingTarget()) {
+ if (enemy.status == "dead" || enemy['isInvisible' + myself.team] || myself.isMissingTarget()) {
myself.stopAttack();
myself.dock();
}
else {
//Cannot come in until reload cool down, only dock down can finish attack animation
- if (myself.isReloaded && myself.isReloaded() && myself.isInAttackRange(enemy) && myself.status=="dock") {
+ if (myself.isReloaded && myself.isReloaded() && myself.isInAttackRange(enemy) && myself.status == "dock") {
//Load bullet
- myself.coolDown=false;
+ myself.coolDown = false;
//Cool down after attack interval
- Game.commandTimeout(function(){
- myself.coolDown=true;
- },myself.get('attackInterval'));
+ Game.commandTimeout(function () {
+ myself.coolDown = true;
+ }, myself.get('attackInterval'));
//If AOE, init enemies
var enemies;
if (myself.AOE) {
//Get possible targets
- switch(myself.attackLimit){
+ switch (myself.attackLimit) {
case "flying":
- enemies=Unit.allUnits.filter(function(chara){
- return chara.team!=myself.team && chara.isFlying;
+ enemies = Unit.allUnits.filter(function (chara) {
+ return chara.team != myself.team && chara.isFlying;
});
break;
case "ground":
- var enemyUnits=Unit.allUnits.filter(function(chara){
- return chara.team!=myself.team && !(chara.isFlying);
+ var enemyUnits = Unit.allUnits.filter(function (chara) {
+ return chara.team != myself.team && !(chara.isFlying);
});
- var enemyBuildings=Building.allBuildings.filter(function(chara){
- return chara.team!=myself.team;
+ var enemyBuildings = Building.allBuildings.filter(function (chara) {
+ return chara.team != myself.team;
});
- enemies=enemyUnits.concat(enemyBuildings);
+ enemies = enemyUnits.concat(enemyBuildings);
break;
default:
- enemies=(Unit.allUnits.concat(Building.allBuildings)).filter(function(chara){
- return chara.team!=myself.team;
+ enemies = (Unit.allUnits.concat(Building.allBuildings)).filter(function (chara) {
+ return chara.team != myself.team;
});
break;
}
@@ -652,13 +693,13 @@ var AttackableUnit=Unit.extends({
switch (myself.AOE.type) {
case "LINE":
//Calculate inter-points between enemy
- 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]) {
+ 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;
}
}
@@ -669,160 +710,169 @@ var AttackableUnit=Unit.extends({
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];
+ });
}
}
//First facing to enemy
myself.faceTo(enemy);
//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>unattackable,unit>>building,near>>far as priority, will attracted if be attacked
return results;
},
- highestPriorityTarget:function(){
+ highestPriorityTarget: function () {
return this.findNearbyTargets()[0];
},
- AI:function(){
+ AI: function () {
//Dead unit doesn't have following AI
- if (this.status=='dead') return;
+ if (this.status == 'dead')
+ return;
//If no mission, return it to scout status
- if (this.isIdle()) this.targetLock=false;
+ if (this.isIdle())
+ this.targetLock = false;
//AI:Attack insight enemy automatically when alive
//If locking target
if (this.targetLock) {
@@ -831,10 +881,9 @@ var AttackableUnit=Unit.extends({
this.followEnemy();
}
}
- //If not lock target
else {
//Find in-range enemy by attack priority
- var enemy=this.highestPriorityTarget();
+ var enemy = this.highestPriorityTarget();
//If not attacking but find in-range enemy
if (!this.isAttacking() && enemy) {
this.attack(enemy);
@@ -842,10 +891,9 @@ var AttackableUnit=Unit.extends({
//If target ran outside attack range
if (this.cannotReachTarget()) {
//but find insight other enemy
- if (enemy && this.target!=enemy) {
+ if (enemy && this.target != enemy) {
this.attack(enemy);
}
- //No other enemy in sight
else {
this.followEnemy();
}
@@ -853,11 +901,11 @@ var AttackableUnit=Unit.extends({
}
},
//Override
- reactionWhenAttackedBy:function(enemy,onlyDamage){
+ reactionWhenAttackedBy: function (enemy, onlyDamage) {
//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
@@ -867,131 +915,137 @@ var AttackableUnit=Unit.extends({
return;
}
//AI when attacked by enemy
- if (!onlyDamage){
- if (this.attack && this.matchAttackLimit(enemy) && !enemy['isInvisible'+this.team]){
+ if (!onlyDamage) {
+ if (this.attack && this.matchAttackLimit(enemy) && !enemy['isInvisible' + this.team]) {
if (this.isIdle()) {
//Will hatred toward enemy
this.attack(enemy);
}
- else if (!this.targetLock && this.target.target!==this){
+ else if (!this.targetLock && this.target.target !== this) {
//Will be attracted by higher hatred enemy
this.attack(enemy);
}
}
else {
- if (this.isIdle()) this.escapeFrom(enemy);
+ if (this.isIdle())
+ this.escapeFrom(enemy);
}
}
},
- isAttacking:function(){
+ isAttacking: function () {
//Has target
return (this.target instanceof Gobj);
},
- followEnemy:function(){
+ followEnemy: function () {
//Remind to attack again
this.attack(this.target);
//Filter out building target
- if (this.target instanceof Unit) this.tracing=true;
+ if (this.target instanceof Unit)
+ this.tracing = true;
},
- isTracing:function(){
- return this.isAttacking() && this.status=="moving";
+ isTracing: function () {
+ return this.isAttacking() && this.status == "moving";
},
- isFiring:function(){
+ isFiring: function () {
//May out of range and cannot fire, don't follow when attack status
- return this.isAttacking() && this.status=="dock";
+ return this.isAttacking() && this.status == "dock";
},
//Override
- isIdle:function(){
+ isIdle: function () {
//Not moving or attacking
- return !this.isAttacking() && this.status=="dock";
+ return !this.isAttacking() && this.status == "dock";
},
- cannotReachTarget:function(){
+ cannotReachTarget: function () {
//Found target outside attack range after once firing, need follow once
return this.isFiring() && !(this.isInAttackRange(this.target));
},
- isMissingTarget:function(){
+ isMissingTarget: function () {
//Lock on target has global sight, lock off (attackGround) use its own sight
return !this.targetLock && this.isAttacking() && !(this.canSee(this.target));
},
- isReloaded:function(){
+ isReloaded: function () {
//Add for newly reloaded yamato, two kinds of bullet conflict, ignore bullet array
- if ((this.bullet instanceof Gobj) && this.bullet.status!='dead') return false;
+ if ((this.bullet instanceof Gobj) && this.bullet.status != 'dead')
+ return false;
return this.coolDown;
},
//Override for attackable unit
- die:function(){
+ die: function () {
//Old behavior
Unit.prototype.die.call(this);
//Clear new timer for unit
this.stopAttack();
- this.selected=false;
+ this.selected = false;
}
}
});
//Attack type
-AttackableUnit.NORMAL_ATTACK=0;
-AttackableUnit.BURST_ATTACK=1;
-AttackableUnit.WAVE_ATTACK=2;
+AttackableUnit.NORMAL_ATTACK = 0;
+AttackableUnit.BURST_ATTACK = 1;
+AttackableUnit.WAVE_ATTACK = 2;
//Dock action I, override
-AttackableUnit.turnAround=function(){
+AttackableUnit.turnAround = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var dockFrame=function(){
+ var myself = this;
+ var dockFrame = function () {
//Every 2 sec
- if ((Game.mainTick+myself.id)%20==0){
+ if ((Game.mainTick + myself.id) % 20 == 0) {
//Look around animation
if (myself.isIdle()) {
- myself.turnTo((myself.direction+1)%16);//For all ground soldier to use
+ myself.turnTo((myself.direction + 1) % 16); //For all ground soldier to use
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
}
};
- this.allFrames['dock']=dockFrame;
+ this.allFrames['dock'] = dockFrame;
};
//Dock action II, override
-AttackableUnit.walkAround=function(){
+AttackableUnit.walkAround = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var dockFrame=function(){
+ var myself = this;
+ var dockFrame = function () {
//Every 2 sec
- if ((Game.mainTick+myself.id)%20==0){
- var direction=Unit.randomDirection();
+ if ((Game.mainTick + myself.id) % 20 == 0) {
+ var direction = Unit.randomDirection();
//Walk around, for all critters to use
if (myself.isIdle()) {
- myself.moveTo(myself.posX()+myself.get('speed')*(Unit.speedMatrix[direction].x)*6,
- myself.posY()+myself.get('speed')*(Unit.speedMatrix[direction].y)*6);
+ myself.moveTo(myself.posX() + myself.get('speed') * (Unit.speedMatrix[direction].x) * 6, myself.posY() + myself.get('speed') * (Unit.speedMatrix[direction].y) * 6);
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
}
};
- this.allFrames['dock']=dockFrame;
+ this.allFrames['dock'] = dockFrame;
};
//Dock action III, override
-AttackableUnit.hover=function(){
+AttackableUnit.hover = function () {
//Inherited dock from Unit.js
Unit.prototype.dock.call(this);
//Add in new things
- var myself=this;
- var N=0;
- var hoverOffset=1;
- var dockFrame=function(){
+ var myself = this;
+ var N = 0;
+ var hoverOffset = 1;
+ var dockFrame = function () {
//Every 200 ms
- if (Game.mainTick%2==0){
+ if (Game.mainTick % 2 == 0) {
//Hover animation
if (myself.isIdle()) {
- myself.y+=hoverOffset;
- if (N%4==0) {
+ myself.y += hoverOffset;
+ if (N % 4 == 0) {
//myself.turnTo((myself.direction+1)%8);//For marine to use
- hoverOffset=-hoverOffset;//Hover up and down
+ hoverOffset = -hoverOffset; //Hover up and down
}
}
- else delete myself.allFrames['dock'];
+ else
+ delete myself.allFrames['dock'];
N++;
}
};
- this.allFrames['dock']=dockFrame;
-};
\ No newline at end of file
+ this.allFrames['dock'] = dockFrame;
+};
+//# sourceMappingURL=Units.js.map
\ No newline at end of file
diff --git a/Characters/Units.ts b/Characters/Units.ts
new file mode 100644
index 0000000..0365664
--- /dev/null
+++ b/Characters/Units.ts
@@ -0,0 +1,997 @@
+//Define unit which has HP/direction and be selectable, unattackable unit
+var Unit=Gobj.extends({
+ constructorPlus:function(props){
+ //Add id for unit
+ this.id=Unit.currentID++;
+ this.direction=Unit.randomDirection();
+ this.angle=0;
+ this.life=this.get('HP');
+ if (this.SP) this.shield=this.get('SP');
+ if (this.MP) this.magic=50;
+ this.selected=false;
+ //Each unit instance has its own sound
+ this.sound={
+ selected:new Audio(Game.CDN+'bgm/'+this.name+'.selected.wav'),
+ moving:new Audio(Game.CDN+'bgm/'+this.name+'.moving.wav'),
+ death:new Audio(Game.CDN+'bgm/'+this.name+'.death.wav')
+ };
+ //Execute below after inherited class fully constructed, postpone
+ var myself=this;
+ Game.commandTimeout(function(){
+ //Add this unit into Game
+ Unit.allUnits.push(myself);
+ //Flying units show above ground units
+ Unit.sortAllUnits();
+ //Show unit
+ myself.dock();
+ },0);
+ },
+ prototypePlus:{
+ name:"Unit",
+ isFlying:true,
+ //Override Gobj method
+ animeFrame:function(){
+ //Animation play
+ this.action++;
+ //Override Gobj here, support hidden frames
+ var arrLimit=(this.imgPos[this.status].left[0] instanceof Array)?(this.imgPos[this.status].left[0].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[0][this.action]==-1) this.action=0;
+ },
+ detectOutOfBound:function(){
+ var boundX=Map.getCurrentMap().width-this.width;
+ var boundY=Map.getCurrentMap().height-this.height;
+ //Right Bound
+ if (this.x>boundX) {
+ this.x=boundX;
+ }
+ //Left Bound
+ if (this.x<0) {
+ this.x=0;
+ }
+ //Bottom Bound
+ if (this.y>boundY) {
+ this.y=boundY;
+ }
+ //Top Bound
+ if (this.y<0) {
+ this.y=0;
+ }
+ },
+ //Can move in any direction
+ updateLocation:function(){
+ this.x=Math.round(this.x+this.get('speed')*Math.cos(this.angle));
+ this.y=Math.round(this.y+this.get('speed')*Math.sin(this.angle));
+ },
+ //Add new functions to prototype
+ turnTo:function(direction){
+ //Change direction
+ this.direction=direction;
+ },
+ //Dock means stop moving but keep animation
+ dock:function(){
+ //Clear old timer
+ this.stop();
+ //Launch new dock timer
+ this.status="dock";
+ this.action=0;
+ //Stop routing
+ delete this.allFrames['routing'];
+ var myself=this;
+ var animateFrame=function(){
+ //Only play animation, will not move
+ myself.animeFrame();
+ };
+ this.allFrames['animate']=animateFrame;
+ },
+ stand:function(){
+ this.dock();
+ },//alias
+ stopMoving:function(){
+ this.dock();
+ },//alias
+ run:function(){
+ this.moving();
+ },//alias
+ navigateTo:function(clickX,clickY,range){
+ if (!range) range=Unit.moveRange;//Smallest limit by default
+ //Center position
+ var charaX=this.posX();
+ var charaY=this.posY();
+ //Already at check point
+ if (this.insideCircle({centerX:clickX,centerY:clickY,radius:range})) {
+ this.dock();
+ //Stop routing
+ delete this.allFrames['routing'];
+ //Reach destination flag
+ return true;
+ }
+ //Need move
+ else {
+ var vector=[clickX-this.posX(),clickY-this.posY()];
+ vector=vector.map(function(n){
+ return n/_$.hypot(vector);
+ });
+ //Only unit on ground will collide with others
+ const FORCE=0.4;
+ if (!this.isFlying){
+ const myself=this;
+ //Soft collision
+ var softCollisions=Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
+ if (chara==myself) return false;
+ else return !(chara.isFlying) && chara.softCollideWith(myself);
+ });
+ softCollisions.forEach(function(chara){
+ var softResist=[myself.posX()-chara.posX(),myself.posY()-chara.posY()];
+ softResist=softResist.map(function(n){
+ return n*FORCE/_$.hypot(softResist);
+ });
+ vector[0]+=softResist[0];
+ vector[1]+=softResist[1];
+ });
+ //Hard collision
+ softCollisions.filter(function(chara){
+ return chara.collideWith(myself);
+ }).forEach(function(chara){
+ var hardResist=[myself.posX()-chara.posX(),myself.posY()-chara.posY()];
+ hardResist=hardResist.map(function(n){
+ return n*FORCE/_$.hypot(hardResist);
+ });
+ vector[0]+=hardResist[0];
+ vector[1]+=hardResist[1];
+ });
+ }
+ this.turnTo(Unit.wrapDirection(vector));
+ vector.reverse();//y,x
+ this.angle=Math.atan2(vector[0],vector[1]);
+ }
+ },
+ faceTo:function(target,preventAction){
+ var direction;
+ //Unit or Building
+ if (target instanceof Gobj){
+ direction=Unit.wrapDirection([target.posX()-this.posX(),target.posY()-this.posY()]);
+ }
+ else {
+ //Location={x:1,y:2}
+ direction=Unit.wrapDirection([target.x-this.posX(),target.y-this.posY()]);
+ }
+ if (!preventAction) this.turnTo(direction);
+ return direction;
+ },
+ escapeFrom:function(enemy){
+ //Add to fix holding issue
+ if (this.hold) return;
+ //From enemy to myself
+ var escapeVector=[this.posX()-enemy.posX(),this.posY()-enemy.posY()];
+ //Move by 100px
+ escapeVector=escapeVector.map(function(n){
+ return n*100/_$.hypot(escapeVector);
+ });
+ //Escape along vector
+ this.moveTo(this.posX()+escapeVector[0],this.posY()+escapeVector[1]);
+ },
+ moveTo:function(clickX,clickY,range,callback){
+ if (!range) range=Unit.moveRange;//Smallest limit by default
+ //Start new routing
+ var myself=this;
+ var routingFrame=function(){
+ if (myself.navigateTo(clickX,clickY,range)){
+ //Run callback when reach target
+ if (typeof(callback)=='function') callback();
+ return true;
+ }
+ };
+ this.allFrames['routing']=routingFrame;
+ //Start moving
+ this.run();
+ },
+ moveToward:function(target,range,callback){
+ if (!range) range=Unit.moveRange;//Smallest limit by default
+ //Start new routing
+ var myself=this;
+ var routingFrame=function(){
+ if (target.status!='dead'){
+ if (myself.navigateTo(target.posX(),target.posY(),range)) {
+ //Run callback when reach target
+ if (typeof(callback)=='function') callback();
+ //Reach destination flag, fix twice callback issue
+ return true;
+ }
+ }
+ //Will stop move toward dead target
+ else {
+ delete myself.allFrames['routing'];
+ myself.dock();
+ }
+ };
+ this.allFrames['routing']=routingFrame;
+ //Start moving
+ this.run();
+ },
+ //Override for sound effect
+ die:function(){
+ //Old behavior
+ Gobj.prototype.die.call(this);
+ this.life=0;
+ //Stop routing
+ delete this.allFrames['routing'];
+ //If has sound effect
+ if (this.sound.death && this.insideScreen()) {
+ this.sound.death.play();
+ }
+ },
+ //AI when attacked by enemy
+ reactionWhenAttackedBy:function(enemy,onlyDamage){
+ //Resign and give reward to enemy if has no life before dead
+ if (this.life<=0) {
+ //If multiple target, only die once and give reward
+ if (this.status!="dead") {
+ //Killed by enemy
+ this.die();
+ //Give enemy reward
+ enemy.kill++;
+ }
+ //Already dead, cannot take following actions
+ return;
+ }
+ //Run away toward bullet direction
+ if (this.status=="dock" && !onlyDamage){
+ this.escapeFrom(enemy);
+ }
+ },
+ //Calculate damage, if enemy is damage itself, return that damage directly
+ calculateDamageBy:function(enemyObj){
+ var damage=0;
+ if (enemyObj instanceof Gobj){
+ var enemyAttackType=enemyObj.attackType;
+ if (!enemyAttackType && enemyObj.attackMode){
+ enemyAttackType=(this.isFlying)?enemyObj.attackMode.flying.attackType:enemyObj.attackMode.ground.attackType;
+ }
+ damage=enemyObj.get('damage')*Unit.attackMatrix[enemyAttackType][this.unitType];
+ }
+ else damage=enemyObj;
+ return damage;
+ },
+ 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=0.5;
+ this.shield-=damage;
+ if (this.shield<0) {
+ //Inherit damage
+ this.life+=(this.shield);
+ this.shield=0;
+ }
+ }
+ else {
+ damage=((this.calculateDamageBy(enemy)-this.get('armor'))*percent)>>0;
+ if (damage<1) damage=0.5;
+ this.life-=damage;
+ }
+ },
+ //Attack ground action
+ attackGround:function(position,loop){
+ //Convert to array
+ var positions=[].concat(position);
+ if (this.attack) this.stopAttack();
+ //Move to first position
+ this.moveTo(positions[0].x,positions[0].y);
+ this.targetLock=false;
+ var checkpoint=this.destination=positions[0];
+ //Join destination chain from next
+ positions.slice(1).forEach(function(pos){
+ checkpoint.next=pos;
+ checkpoint=checkpoint.next;
+ });
+ //Patrol loop, dead lock
+ if (loop) checkpoint.next=this.destination;
+ },
+ //Patrol action
+ patrol:function(position,addHere){
+ //Convert to array
+ var positions=[].concat(position);
+ if (addHere) positions.push({x:this.posX(),y:this.posY()});
+ this.attackGround(positions,true);
+ },
+ isMachine:function(){
+ return ["SCV","Vulture","Tank","Goliath","Wraith","Dropship","Vessel","BattleCruiser","Valkyrie",
+ "Probe","Dragoon","Shuttle","Reaver","Observer","Scout","Carrier","Arbiter","Corsair","HeroCruiser"]
+ .indexOf(this.name)!=-1;
+ },
+ //Life status
+ lifeStatus:function(){
+ var lifeRatio=this.life/this.get('HP');
+ return ((lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red");
+ }
+ }
+});
+//Assign current ID to each newly born unit
+Unit.currentID=0;
+//Smallest range for move precision
+Unit.moveRange=20;
+//Range for mouse select
+Unit.selectRange=20;
+//Range for melee attack
+Unit.meleeRange=25;//50
+//Speed matrix, 2^0.5=>0.7
+Unit.speedMatrix=[
+ {x: 0, y: -1},{x: 0.4, y: -0.9},
+ {x: 0.7, y: -0.7},{x: 0.9, y: -0.4},
+ {x: 1, y: 0},{x: 0.9, y: 0.4},
+ {x: 0.7, y: 0.7},{x: 0.4, y: 0.9},
+ {x: 0, y: 1},{x: -0.4, y: 0.9},
+ {x: -0.7, y: 0.7},{x: -0.9, y: 0.4},
+ {x: -1, y: 0},{x: -0.9, y: -0.4},
+ {x: -0.7, y: -0.7},{x: -0.4, y: -0.9}
+];
+//Get speed matrix by unit speed
+Unit.getSpeedMatrixBy=function(speed){
+ var speedMatrix=_$.clone(Unit.speedMatrix);
+ _$.matrixOperation(speedMatrix,function(N){
+ return N*speed;
+ });
+ return speedMatrix;
+};
+//All units' sight
+Unit.sight=300;
+//Attack type matrix
+Unit.attackMatrix=[
+ [1,1,1],
+ [0.5,0.75,1],
+ [1,0.5,0.25]
+];
+//Unit type
+Unit.SMALL=0;
+Unit.MIDDLE=1;
+Unit.BIG=2;
+//All existed units, class property
+Unit.allUnits=[];
+Unit.allOurUnits=function(){
+ return Unit.allUnits.filter(function(chara){
+ return !(chara.isEnemy());
+ });
+};
+Unit.allEnemyUnits=function(){
+ return Unit.allUnits.filter(function(chara){
+ return chara.isEnemy();
+ });
+};
+Unit.allFlyingUnits=function(){
+ return Unit.allUnits.filter(function(chara){
+ return chara.isFlying;
+ });
+};
+Unit.allGroundUnits=function(){
+ return Unit.allUnits.filter(function(chara){
+ return !(chara.isFlying);
+ });
+};
+//Get all units count
+Unit.count=function(){
+ return Unit.allUnits.reduce(function(counts,chara){
+ counts[chara.team]++;
+ return counts;
+ },Game.getPropArray(0));
+};
+//Sort all units to show flying unit above/after ground unit
+Unit.sortAllUnits=function(){
+ Unit.allUnits.sort(function(unit1,unit2){
+ return (unit1.isFlying?1:0)-(unit2.isFlying?1:0);
+ });
+};
+//Sort units
+Unit.sortUnits=function(units){
+ units.sort(function(unit1,unit2){
+ return (unit1.isFlying?1:0)-(unit2.isFlying?1:0);
+ });
+};
+//Random direction but can keep all clients same
+Unit.randomDirection=function(){
+ //Clossure variable and function
+ var rands=[];
+ var getRands=function(){
+ //Use current tick X randomSeed as seed
+ var seed=Game.mainTick+Game.randomSeed;
+ var rands=[];
+ for (var N=0;N<16;N++){
+ //Seed grows up
+ seed=(seed*5+3)%16;//range=16
+ rands.push(seed);
+ }
+ return rands;
+ };
+ return function(){
+ //If all rands used, generate new ones
+ if (rands.length==0) rands=getRands();
+ return rands.shift();
+ }
+}();
+//Convert from vector to 16 directions
+Unit.wrapDirection=function(vector){
+ //Atan2 can distinguish from -PI~PI, Y-axis is reverse
+ var angle=Math.atan2(vector[1],vector[0]);
+ var piece=Math.PI/16;
+ if (angle>(piece*15)) return 12;
+ if (angle>(piece*13)) return 11;
+ if (angle>(piece*11)) return 10;
+ if (angle>(piece*9)) return 9;
+ if (angle>(piece*7)) return 8;
+ if (angle>(piece*5)) return 7;
+ if (angle>(piece*3)) return 6;
+ if (angle>piece) return 5;
+ if (angle>(-piece)) return 4;
+ if (angle>(-piece*3)) return 3;
+ if (angle>(-piece*5)) return 2;
+ if (angle>(-piece*7)) return 1;
+ if (angle>(-piece*9)) return 0;
+ if (angle>(-piece*11)) return 15;
+ if (angle>(-piece*13)) return 14;
+ if (angle>(-piece*15)) return 13;
+ else return 12;
+};
+//Dock action I
+Unit.turnAround=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var dockFrame=function(){
+ //Every 2 sec
+ if ((Game.mainTick+myself.id)%20==0){
+ //Look around animation
+ if (myself.status=="dock") {
+ myself.turnTo((myself.direction+1)%16);//For all ground soldier to use
+ }
+ else delete myself.allFrames['dock'];
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
+//Dock action II
+Unit.walkAround=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var dockFrame=function(){
+ //Every 2 sec
+ if ((Game.mainTick+myself.id)%20==0){
+ var direction=Unit.randomDirection();
+ //Walk around, for all critters to use
+ if (myself.status=="dock") {
+ myself.moveTo(myself.posX()+myself.get('speed')*(Unit.speedMatrix[direction].x)*6,
+ myself.posY()+myself.get('speed')*(Unit.speedMatrix[direction].y)*6);
+ }
+ else delete myself.allFrames['dock'];
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
+//Dock action III
+Unit.hover=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var N=0;
+ var hoverOffset=1;
+ var dockFrame=function(){
+ //Every 200 ms
+ if (Game.mainTick%2==0){
+ //Hover animation
+ if (myself.status=="dock") {
+ myself.y+=hoverOffset;
+ if (N%4==0) {
+ //myself.turnTo((myself.direction+1)%16);//For marine to use
+ hoverOffset=-hoverOffset;//Hover up and down
+ }
+ }
+ else delete myself.allFrames['dock'];
+ N++;
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
+//Dock action IV
+Unit.walkAroundLarva=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var dockFrame=function(){
+ //Every 2 sec
+ if (Game.mainTick%20==0){
+ //Walk around, for larva to use
+ if (myself.status=="dock") {
+ if (myself.moved) {
+ //Return to original position, range=larva.speed=4
+ Unit.prototype.moveTo.call(myself,myself.originX,myself.originY,4);
+ myself.moved=false;
+ }
+ else {
+ //Left from original position, range=larva.speed=4
+ myself.direction=Unit.randomDirection();
+ Unit.prototype.moveTo.call(myself,
+ myself.posX()+myself.get('speed')*(Unit.speedMatrix[myself.direction].x)*2,
+ myself.posY()+myself.get('speed')*(Unit.speedMatrix[myself.direction].y)*2,4);
+ myself.moved=true;
+ }
+ }
+ else delete myself.allFrames['dock'];
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
+var AttackableUnit=Unit.extends({
+ constructorPlus:function(props){
+ this.bullet={};
+ this.kill=0;
+ this.target={};
+ //Idle by default
+ this.targetLock=false;
+ //Can fire by default
+ this.coolDown=true;
+ //Init attack range
+ if (this.meleeAttack) this.attackRange=Math.max(this.radius(),35);
+ //Add attack sound for AttackableUnit
+ this.sound.attack=new Audio(Game.CDN+'bgm/'+this.name+'.attack.wav');
+ },
+ prototypePlus:{
+ //Add basic unit info
+ name:"AttackableUnit",
+ isInAttackRange:function(enemy){
+ return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('attackRange')});
+ },
+ matchAttackLimit:function(enemy){
+ //Has attack limit
+ if (this.attackLimit){
+ //Doesn't match attack limit
+ if ((this.attackLimit=="flying" && !(enemy.isFlying)) ||
+ (this.attackLimit=="ground" && enemy.isFlying)) return false;
+ }
+ //No attack limit or match attack limit
+ return true;
+ },
+ attack:function(enemy){
+ //Cannot attack invisible unit or unit who mismatch your attack type
+ if (enemy['isInvisible'+this.team] || !(this.matchAttackLimit(enemy))) {
+ Referee.voice('pError').play();
+ this.stopAttack();
+ return;
+ }
+ //Don't attack same target again unless miss target or tracing target
+ if (this.target==enemy) {
+ if (this.cannotReachTarget()) {
+ if (this.status=='moving') return;//tracing
+ }
+ else return;
+ }
+ //Recover attack range
+ else delete this.tracing;
+ if (enemy instanceof Gobj && enemy.status!="dead") {
+ //Stop old attack and moving
+ this.stopAttack();
+ this.dock();
+ //New attack
+ this.target=enemy;
+ //Get melee attack range if melee attack unit
+ if (this.meleeAttack) {
+ //Override
+ this.attackRange=this.radius()+enemy.radius();
+ }
+ //If separate attack mode, override
+ if (this.attackMode) {
+ this.Bullet=(enemy.isFlying)?this.attackMode.flying.Bullet:this.attackMode.ground.Bullet;
+ this.attackRange=(enemy.isFlying)?this.get('attackMode.flying.attackRange'):this.get('attackMode.ground.attackRange');
+ this.attackEffect=(enemy.isFlying)?this.attackMode.flying.attackEffect:this.attackMode.ground.attackEffect;
+ this.attackInterval=(enemy.isFlying)?this.get('attackMode.flying.attackInterval'):this.get('attackMode.ground.attackInterval');
+ //Change attack bgm
+ this.sound.attack=(enemy.isFlying)?this.sound.attackF:this.sound.attackG;
+ this.damage=(enemy.isFlying)?this.get('attackMode.flying.damage'):this.get('attackMode.ground.damage');
+ this.attackType=(enemy.isFlying)?this.attackMode.flying.attackType:this.attackMode.ground.attackType;
+ this.attackMode.status=enemy.isFlying;
+ }
+ //Move in attack range, no need to move melee
+ var range=this.get('attackRange');
+ if (this.tracing) {
+ //Adjust attack range for tracing
+ range=Math.max(this.get('attackRange')*0.7,(this.radius()+enemy.radius())*0.6);
+ delete this.tracing;
+ }
+ //Add to fix holding issue
+ if (!this.hold) this.moveToward(enemy,range);
+ var myself=this;
+ var attackFrame=function(){
+ //If enemy already dead or becomes invisible or we just miss enemy
+ if (enemy.status=="dead" || enemy['isInvisible'+myself.team] || myself.isMissingTarget()) {
+ myself.stopAttack();
+ myself.dock();
+ }
+ else {
+ //Cannot come in until reload cool down, only dock down can finish attack animation
+ if (myself.isReloaded && myself.isReloaded() && myself.isInAttackRange(enemy) && myself.status=="dock") {
+ //Load bullet
+ myself.coolDown=false;
+ //Cool down after attack interval
+ Game.commandTimeout(function(){
+ myself.coolDown=true;
+ },myself.get('attackInterval'));
+ //If AOE, init enemies
+ var enemies;
+ if (myself.AOE) {
+ //Get possible targets
+ switch(myself.attackLimit){
+ case "flying":
+ enemies=Unit.allUnits.filter(function(chara){
+ return chara.team!=myself.team && chara.isFlying;
+ });
+ break;
+ case "ground":
+ var enemyUnits=Unit.allUnits.filter(function(chara){
+ return chara.team!=myself.team && !(chara.isFlying);
+ });
+ var enemyBuildings=Building.allBuildings.filter(function(chara){
+ return chara.team!=myself.team;
+ });
+ enemies=enemyUnits.concat(enemyBuildings);
+ break;
+ default:
+ enemies=(Unit.allUnits.concat(Building.allBuildings)).filter(function(chara){
+ return chara.team!=myself.team;
+ });
+ break;
+ }
+ //Range filter
+ switch (myself.AOE.type) {
+ case "LINE":
+ //Calculate inter-points between enemy
+ 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;
+ }
+ }
+ return false;
+ });
+ break;
+ case "MULTIPLE":
+ 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];
+ })
+ }
+ }
+ //First facing to enemy
+ myself.faceTo(enemy);
+ //Show attack animation if has
+ if (myself.imgPos.attack) {
+ myself.action=0;
+ //Change status to show attack frame
+ myself.status="attack";
+ //Will return to dock after attack
+ Game.commandTimeout(function(){
+ //If still show attack
+ if (myself.status=="attack") {
+ myself.status="dock";
+ myself.action=0;
+ }
+ },myself.frame.attack*100);//attackAnimation < attackInterval
+ }
+ //If has bullet
+ if (myself.Bullet) {
+ var fireBullet=function(){
+ //Will shoot multiple bullets in one time
+ if (myself.continuousAttack) {
+ myself.bullet=[];
+ for (var N=0;N>0)) {
+ bullet.noDamage=true;
+ }
+ bullet.fire();
+ myself.bullet.push(bullet);
+ }
+ }
+ else {
+ if (myself.AOE && myself.AOE.type=="MULTIPLE"){
+ for (var N=0;N>unattackable,unit>>building,near>>far as priority, will attracted if be attacked
+ return results;
+ },
+ highestPriorityTarget:function(){
+ return this.findNearbyTargets()[0];
+ },
+ AI:function(){
+ //Dead unit doesn't have following AI
+ if (this.status=='dead') return;
+ //If no mission, return it to scout status
+ if (this.isIdle()) this.targetLock=false;
+ //AI:Attack insight enemy automatically when alive
+ //If locking target
+ if (this.targetLock) {
+ // target ran out of attack range
+ if (this.cannotReachTarget()) {
+ this.followEnemy();
+ }
+ }
+ //If not lock target
+ else {
+ //Find in-range enemy by attack priority
+ var enemy=this.highestPriorityTarget();
+ //If not attacking but find in-range enemy
+ if (!this.isAttacking() && enemy) {
+ this.attack(enemy);
+ }
+ //If target ran outside attack range
+ if (this.cannotReachTarget()) {
+ //but find insight other enemy
+ if (enemy && this.target!=enemy) {
+ this.attack(enemy);
+ }
+ //No other enemy in sight
+ else {
+ this.followEnemy();
+ }
+ }
+ }
+ },
+ //Override
+ reactionWhenAttackedBy:function(enemy,onlyDamage){
+ //Resign and give reward to enemy if has no life before dead
+ if (this.life<=0) {
+ //If multiple target, only die once and give reward
+ if (this.status!="dead") {
+ //Killed by enemy
+ this.die();
+ //Give enemy reward
+ enemy.kill++;
+ }
+ //Already dead, cannot take following actions
+ return;
+ }
+ //AI when attacked by enemy
+ if (!onlyDamage){
+ if (this.attack && this.matchAttackLimit(enemy) && !enemy['isInvisible'+this.team]){
+ if (this.isIdle()) {
+ //Will hatred toward enemy
+ this.attack(enemy);
+ }
+ else if (!this.targetLock && this.target.target!==this){
+ //Will be attracted by higher hatred enemy
+ this.attack(enemy);
+ }
+ }
+ else {
+ if (this.isIdle()) this.escapeFrom(enemy);
+ }
+ }
+ },
+ isAttacking:function(){
+ //Has target
+ return (this.target instanceof Gobj);
+ },
+ followEnemy:function(){
+ //Remind to attack again
+ this.attack(this.target);
+ //Filter out building target
+ if (this.target instanceof Unit) this.tracing=true;
+ },
+ isTracing:function(){
+ return this.isAttacking() && this.status=="moving";
+ },
+ isFiring:function(){
+ //May out of range and cannot fire, don't follow when attack status
+ return this.isAttacking() && this.status=="dock";
+ },
+ //Override
+ isIdle:function(){
+ //Not moving or attacking
+ return !this.isAttacking() && this.status=="dock";
+ },
+ cannotReachTarget:function(){
+ //Found target outside attack range after once firing, need follow once
+ return this.isFiring() && !(this.isInAttackRange(this.target));
+ },
+ isMissingTarget:function(){
+ //Lock on target has global sight, lock off (attackGround) use its own sight
+ return !this.targetLock && this.isAttacking() && !(this.canSee(this.target));
+ },
+ isReloaded:function(){
+ //Add for newly reloaded yamato, two kinds of bullet conflict, ignore bullet array
+ if ((this.bullet instanceof Gobj) && this.bullet.status!='dead') return false;
+ return this.coolDown;
+ },
+ //Override for attackable unit
+ die:function(){
+ //Old behavior
+ Unit.prototype.die.call(this);
+ //Clear new timer for unit
+ this.stopAttack();
+ this.selected=false;
+ }
+ }
+});
+//Attack type
+AttackableUnit.NORMAL_ATTACK=0;
+AttackableUnit.BURST_ATTACK=1;
+AttackableUnit.WAVE_ATTACK=2;
+//Dock action I, override
+AttackableUnit.turnAround=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var dockFrame=function(){
+ //Every 2 sec
+ if ((Game.mainTick+myself.id)%20==0){
+ //Look around animation
+ if (myself.isIdle()) {
+ myself.turnTo((myself.direction+1)%16);//For all ground soldier to use
+ }
+ else delete myself.allFrames['dock'];
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
+//Dock action II, override
+AttackableUnit.walkAround=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var dockFrame=function(){
+ //Every 2 sec
+ if ((Game.mainTick+myself.id)%20==0){
+ var direction=Unit.randomDirection();
+ //Walk around, for all critters to use
+ if (myself.isIdle()) {
+ myself.moveTo(myself.posX()+myself.get('speed')*(Unit.speedMatrix[direction].x)*6,
+ myself.posY()+myself.get('speed')*(Unit.speedMatrix[direction].y)*6);
+ }
+ else delete myself.allFrames['dock'];
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
+//Dock action III, override
+AttackableUnit.hover=function(){
+ //Inherited dock from Unit.js
+ Unit.prototype.dock.call(this);
+ //Add in new things
+ var myself=this;
+ var N=0;
+ var hoverOffset=1;
+ var dockFrame=function(){
+ //Every 200 ms
+ if (Game.mainTick%2==0){
+ //Hover animation
+ if (myself.isIdle()) {
+ myself.y+=hoverOffset;
+ if (N%4==0) {
+ //myself.turnTo((myself.direction+1)%8);//For marine to use
+ hoverOffset=-hoverOffset;//Hover up and down
+ }
+ }
+ else delete myself.allFrames['dock'];
+ N++;
+ }
+ };
+ this.allFrames['dock']=dockFrame;
+};
\ No newline at end of file
diff --git a/Characters/Upgrade.js b/Characters/Upgrade.js
index 4def362..a17dc74 100644
--- a/Characters/Upgrade.js
+++ b/Characters/Upgrade.js
@@ -1,1130 +1,1153 @@
-var Upgrade={
+var Upgrade = {
//Terran
- UpgradeInfantryWeapons:{
- name:"UpgradeInfantryWeapons",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Terran.Marine.prototype.damage[team]+=1;
- Terran.Firebat.prototype.damage[team]+=2;
- Terran.Ghost.prototype.damage[team]+=1;
+ UpgradeInfantryWeapons: {
+ name: "UpgradeInfantryWeapons",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Terran.Marine.prototype.damage[team] += 1;
+ Terran.Firebat.prototype.damage[team] += 2;
+ Terran.Ghost.prototype.damage[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.TerranBuilding.EngineeringBay.prototype.items[1];
- }
- },
- UpgradeInfantryArmors:{
- name:"UpgradeInfantryArmors",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Terran.SCV.prototype.armor[team]+=1;
- Terran.Marine.prototype.armor[team]+=1;
- Terran.Firebat.prototype.armor[team]+=1;
- Terran.Ghost.prototype.armor[team]+=1;
- Terran.Medic.prototype.armor[team]+=1;
- Terran.Civilian.prototype.armor[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.TerranBuilding.EngineeringBay.prototype.items[1];
+ }
+ },
+ UpgradeInfantryArmors: {
+ name: "UpgradeInfantryArmors",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Terran.SCV.prototype.armor[team] += 1;
+ Terran.Marine.prototype.armor[team] += 1;
+ Terran.Firebat.prototype.armor[team] += 1;
+ Terran.Ghost.prototype.armor[team] += 1;
+ Terran.Medic.prototype.armor[team] += 1;
+ Terran.Civilian.prototype.armor[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.TerranBuilding.EngineeringBay.prototype.items[2];
+ if (this.level[Game.team] >= 3)
+ delete Building.TerranBuilding.EngineeringBay.prototype.items[2];
}
},
- ResearchU238Shells:{
- name:"ResearchU238Shells",
- cost:{
- mine:150,
- gas:150,
- time:1000
+ ResearchU238Shells: {
+ name: "ResearchU238Shells",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1000
},
- effect:function(team){
- Terran.Marine.prototype.attackRange[team]=175;
+ effect: function (team) {
+ Terran.Marine.prototype.attackRange[team] = 175;
delete Building.TerranBuilding.Academy.prototype.items[1];
}
},
- ResearchStimPackTech:{
- name:"ResearchStimPackTech",
- cost:{
- mine:100,
- gas:100,
- time:800
+ ResearchStimPackTech: {
+ name: "ResearchStimPackTech",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 800
},
- effect:function(){
- Magic.StimPacks.enabled=true;
+ effect: function () {
+ Magic.StimPacks.enabled = true;
delete Building.TerranBuilding.Academy.prototype.items[2];
}
},
- ResearchRestoration:{
- name:"ResearchRestoration",
- cost:{
- mine:100,
- gas:100,
- time:800
+ ResearchRestoration: {
+ name: "ResearchRestoration",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 800
},
- effect:function(){
- Magic.Restoration.enabled=true;
+ effect: function () {
+ Magic.Restoration.enabled = true;
delete Building.TerranBuilding.Academy.prototype.items[4];
}
},
- ResearchOpticalFlare:{
- name:"ResearchOpticalFlare",
- cost:{
- mine:100,
- gas:100,
- time:1200
+ ResearchOpticalFlare: {
+ name: "ResearchOpticalFlare",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1200
},
- effect:function(){
- Magic.OpticalFlare.enabled=true;
+ effect: function () {
+ Magic.OpticalFlare.enabled = true;
delete Building.TerranBuilding.Academy.prototype.items[5];
}
},
- ResearchCaduceusReactor:{
- name:"ResearchCaduceusReactor",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ ResearchCaduceusReactor: {
+ name: "ResearchCaduceusReactor",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Terran.Medic.prototype.MP[team]=250;
+ effect: function (team) {
+ Terran.Medic.prototype.MP[team] = 250;
delete Building.TerranBuilding.Academy.prototype.items[6];
}
},
- ResearchIonThrusters:{
- name:"ResearchIonThrusters",
- cost:{
- mine:100,
- gas:100,
- time:1000
+ ResearchIonThrusters: {
+ name: "ResearchIonThrusters",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1000
},
- effect:function(team){
- Terran.Vulture.prototype.speed[team]=20;
+ effect: function (team) {
+ Terran.Vulture.prototype.speed[team] = 20;
delete Building.TerranBuilding.MachineShop.prototype.items[1];
}
},
- ResearchSpiderMines:{
- name:"ResearchSpiderMines",
- cost:{
- mine:100,
- gas:100,
- time:800
+ ResearchSpiderMines: {
+ name: "ResearchSpiderMines",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 800
},
- effect:function(){
- Magic.SpiderMines.enabled=true;
+ effect: function () {
+ Magic.SpiderMines.enabled = true;
delete Building.TerranBuilding.MachineShop.prototype.items[2];
}
},
- ResearchSiegeTech:{
- name:"ResearchSiegeTech",
- cost:{
- mine:150,
- gas:150,
- time:800
+ ResearchSiegeTech: {
+ name: "ResearchSiegeTech",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 800
},
- effect:function(){
- Magic.SeigeMode.enabled=true;
+ effect: function () {
+ Magic.SeigeMode.enabled = true;
delete Building.TerranBuilding.MachineShop.prototype.items[3];
}
},
- ResearchCharonBoosters:{
- name:"ResearchCharonBoosters",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ ResearchCharonBoosters: {
+ name: "ResearchCharonBoosters",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Terran.Goliath.prototype.attackMode.flying.attackRange[team]=300;
+ effect: function (team) {
+ Terran.Goliath.prototype.attackMode.flying.attackRange[team] = 300;
delete Building.TerranBuilding.MachineShop.prototype.items[4];
}
},
- ResearchCloakingField:{
- name:"ResearchCloakingField",
- cost:{
- mine:150,
- gas:150,
- time:1000
+ ResearchCloakingField: {
+ name: "ResearchCloakingField",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1000
},
- effect:function(){
- Magic.Cloak.enabled=true;
+ effect: function () {
+ Magic.Cloak.enabled = true;
delete Building.TerranBuilding.ControlTower.prototype.items[1];
}
},
- ResearchApolloReactor:{
- name:"ResearchApolloReactor",
- cost:{
- mine:200,
- gas:200,
- time:1660
+ ResearchApolloReactor: {
+ name: "ResearchApolloReactor",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1660
},
- effect:function(team){
- Terran.Wraith.prototype.MP[team]=250;
+ effect: function (team) {
+ Terran.Wraith.prototype.MP[team] = 250;
delete Building.TerranBuilding.ControlTower.prototype.items[2];
}
},
- ResearchEMPShockwaves:{
- name:"ResearchEMPShockwaves",
- cost:{
- mine:200,
- gas:200,
- time:1200
+ ResearchEMPShockwaves: {
+ name: "ResearchEMPShockwaves",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1200
},
- effect:function(){
- Magic.EMPShockwave.enabled=true;
+ effect: function () {
+ Magic.EMPShockwave.enabled = true;
delete Building.TerranBuilding.ScienceFacility.prototype.items[1];
}
},
- ResearchIrradiate:{
- name:"ResearchIrradiate",
- cost:{
- mine:150,
- gas:150,
- time:800
+ ResearchIrradiate: {
+ name: "ResearchIrradiate",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 800
},
- effect:function(){
- Magic.Irradiate.enabled=true;
+ effect: function () {
+ Magic.Irradiate.enabled = true;
delete Building.TerranBuilding.ScienceFacility.prototype.items[2];
}
},
- ResearchTitanReactor:{
- name:"ResearchTitanReactor",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ ResearchTitanReactor: {
+ name: "ResearchTitanReactor",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Terran.Vessel.prototype.MP[team]=250;
+ effect: function (team) {
+ Terran.Vessel.prototype.MP[team] = 250;
delete Building.TerranBuilding.ScienceFacility.prototype.items[3];
}
},
- ResearchLockdown:{
- name:"ResearchLockdown",
- cost:{
- mine:200,
- gas:200,
- time:1000
+ ResearchLockdown: {
+ name: "ResearchLockdown",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1000
},
- effect:function(){
- Magic.Lockdown.enabled=true;
+ effect: function () {
+ Magic.Lockdown.enabled = true;
delete Building.TerranBuilding.ConvertOps.prototype.items[1];
}
},
- ResearchPersonalCloaking:{
- name:"ResearchPersonalCloaking",
- cost:{
- mine:100,
- gas:100,
- time:800
+ ResearchPersonalCloaking: {
+ name: "ResearchPersonalCloaking",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 800
},
- effect:function(){
- Magic.PersonalCloak.enabled=true;
+ effect: function () {
+ Magic.PersonalCloak.enabled = true;
delete Building.TerranBuilding.ConvertOps.prototype.items[2];
}
},
- ResearchOcularImplants:{
- name:"ResearchOcularImplants",
- cost:{
- mine:100,
- gas:100,
- time:1660
+ ResearchOcularImplants: {
+ name: "ResearchOcularImplants",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1660
},
- effect:function(team){
- Terran.Ghost.prototype.sight[team]=385;
+ effect: function (team) {
+ Terran.Ghost.prototype.sight[team] = 385;
delete Building.TerranBuilding.ConvertOps.prototype.items[4];
}
},
- ResearchMoebiusReactor:{
- name:"ResearchMoebiusReactor",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ ResearchMoebiusReactor: {
+ name: "ResearchMoebiusReactor",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Terran.Ghost.prototype.MP[team]=250;
+ effect: function (team) {
+ Terran.Ghost.prototype.MP[team] = 250;
delete Building.TerranBuilding.ConvertOps.prototype.items[5];
}
},
- ResearchYamatoGun:{
- name:"ResearchYamatoGun",
- cost:{
- mine:200,
- gas:200,
- time:1200
+ ResearchYamatoGun: {
+ name: "ResearchYamatoGun",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1200
},
- effect:function(){
- Magic.Yamato.enabled=true;
+ effect: function () {
+ Magic.Yamato.enabled = true;
delete Building.TerranBuilding.PhysicsLab.prototype.items[1];
}
},
- ResearchColossusReactor:{
- name:"ResearchColossusReactor",
- cost:{
- mine:150,
- gas:150,
- time:1600
+ ResearchColossusReactor: {
+ name: "ResearchColossusReactor",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1600
},
- effect:function(team){
- Terran.BattleCruiser.prototype.MP[team]=250;
+ effect: function (team) {
+ Terran.BattleCruiser.prototype.MP[team] = 250;
delete Building.TerranBuilding.PhysicsLab.prototype.items[2];
}
},
- UpgradeVehicleWeapons:{
- name:"UpgradeVehicleWeapons",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
+ UpgradeVehicleWeapons: {
+ name: "UpgradeVehicleWeapons",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
},
- level:0,
- effect:function(team){
- Terran.Vulture.prototype.damage[team]+=2;
- Terran.Tank.prototype.damage[team]+=3;
- Terran.Goliath.prototype.attackMode.ground.damage[team]+=2;
- Terran.Goliath.prototype.attackMode.flying.damage[team]+=4;
+ level: 0,
+ effect: function (team) {
+ Terran.Vulture.prototype.damage[team] += 2;
+ Terran.Tank.prototype.damage[team] += 3;
+ Terran.Goliath.prototype.attackMode.ground.damage[team] += 2;
+ Terran.Goliath.prototype.attackMode.flying.damage[team] += 4;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[1];
- }
- },
- UpgradeShipWeapons:{
- name:"UpgradeShipWeapons",
- cost:{
- mine:[100,150,200],
- gas:[100,150,200],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Terran.Wraith.prototype.attackMode.ground.damage[team]+=1;
- Terran.Wraith.prototype.attackMode.flying.damage[team]+=2;
- Terran.BattleCruiser.prototype.damage[team]+=3;
- Terran.Valkyrie.prototype.damage[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.TerranBuilding.Armory.prototype.items[1];
+ }
+ },
+ UpgradeShipWeapons: {
+ name: "UpgradeShipWeapons",
+ cost: {
+ mine: [100, 150, 200],
+ gas: [100, 150, 200],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Terran.Wraith.prototype.attackMode.ground.damage[team] += 1;
+ Terran.Wraith.prototype.attackMode.flying.damage[team] += 2;
+ Terran.BattleCruiser.prototype.damage[team] += 3;
+ Terran.Valkyrie.prototype.damage[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[2];
- }
- },
- UpgradeVehicleArmors:{
- name:"UpgradeVehicleArmors",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Terran.Vulture.prototype.armor[team]+=1;
- Terran.Tank.prototype.armor[team]+=1;
- Terran.Goliath.prototype.armor[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.TerranBuilding.Armory.prototype.items[2];
+ }
+ },
+ UpgradeVehicleArmors: {
+ name: "UpgradeVehicleArmors",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Terran.Vulture.prototype.armor[team] += 1;
+ Terran.Tank.prototype.armor[team] += 1;
+ Terran.Goliath.prototype.armor[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[4];
- }
- },
- UpgradeShipArmors:{
- name:"UpgradeShipArmors",
- cost:{
- mine:[150,225,300],
- gas:[150,225,300],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Terran.Wraith.prototype.armor[team]+=1;
- Terran.Dropship.prototype.armor[team]+=1;
- Terran.BattleCruiser.prototype.armor[team]+=1;
- Terran.Vessel.prototype.armor[team]+=1;
- Terran.Valkyrie.prototype.armor[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.TerranBuilding.Armory.prototype.items[4];
+ }
+ },
+ UpgradeShipArmors: {
+ name: "UpgradeShipArmors",
+ cost: {
+ mine: [150, 225, 300],
+ gas: [150, 225, 300],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Terran.Wraith.prototype.armor[team] += 1;
+ Terran.Dropship.prototype.armor[team] += 1;
+ Terran.BattleCruiser.prototype.armor[team] += 1;
+ Terran.Vessel.prototype.armor[team] += 1;
+ Terran.Valkyrie.prototype.armor[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[5];
+ if (this.level[Game.team] >= 3)
+ delete Building.TerranBuilding.Armory.prototype.items[5];
}
},
//Zerg
- EvolveBurrow:{
- name:"EvolveBurrow",
- cost:{
- mine:100,
- gas:100,
- time:800
- },
- effect:function(){
- Magic.Burrow.enabled=Magic.Unburrow.enabled=true;
+ EvolveBurrow: {
+ name: "EvolveBurrow",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 800
+ },
+ effect: function () {
+ Magic.Burrow.enabled = Magic.Unburrow.enabled = true;
delete Building.ZergBuilding.Hatchery.prototype.items[3];
delete Building.ZergBuilding.Lair.prototype.items[3];
delete Building.ZergBuilding.Hive.prototype.items[3];
}
},
- EvolveVentralSacs:{
- name:"EvolveVentralSacs",
- cost:{
- mine:200,
- gas:200,
- time:1600
+ EvolveVentralSacs: {
+ name: "EvolveVentralSacs",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1600
},
- effect:function(){
- Magic.Load.enabled=Magic.UnloadAll.enabled=true;
+ effect: function () {
+ Magic.Load.enabled = Magic.UnloadAll.enabled = true;
delete Building.ZergBuilding.Lair.prototype.items[4];
delete Building.ZergBuilding.Hive.prototype.items[4];
}
},
- EvolveAntennas:{
- name:"EvolveAntennas",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ EvolveAntennas: {
+ name: "EvolveAntennas",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Zerg.Overlord.prototype.sight[team]=385;
+ effect: function (team) {
+ Zerg.Overlord.prototype.sight[team] = 385;
delete Building.ZergBuilding.Lair.prototype.items[5];
delete Building.ZergBuilding.Hive.prototype.items[5];
}
},
- EvolvePneumatizedCarapace:{
- name:"EvolvePneumatizedCarapace",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ EvolvePneumatizedCarapace: {
+ name: "EvolvePneumatizedCarapace",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Zerg.Overlord.prototype.speed[team]=8;
+ effect: function (team) {
+ Zerg.Overlord.prototype.speed[team] = 8;
delete Building.ZergBuilding.Lair.prototype.items[6];
delete Building.ZergBuilding.Hive.prototype.items[6];
}
},
- EvolveMetabolicBoost:{
- name:"EvolveMetabolicBoost",
- cost:{
- mine:100,
- gas:100,
- time:1000
+ EvolveMetabolicBoost: {
+ name: "EvolveMetabolicBoost",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1000
},
- effect:function(team){
- Zerg.Zergling.prototype.speed[team]=18;
+ effect: function (team) {
+ Zerg.Zergling.prototype.speed[team] = 18;
delete Building.ZergBuilding.SpawningPool.prototype.items[1];
}
},
- EvolveAdrenalGlands:{
- name:"EvolveAdrenalGlands",
- cost:{
- mine:200,
- gas:200,
- time:1000
+ EvolveAdrenalGlands: {
+ name: "EvolveAdrenalGlands",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1000
},
- effect:function(team){
- Zerg.Zergling.prototype.attackInterval[team]=600;
+ effect: function (team) {
+ Zerg.Zergling.prototype.attackInterval[team] = 600;
delete Building.ZergBuilding.SpawningPool.prototype.items[2];
}
},
- UpgradeMeleeAttacks:{
- name:"UpgradeMeleeAttacks",
- cost:{
- mine:[100,150,200],
- gas:[100,150,200],
- time:[2660,2980,3300]
+ UpgradeMeleeAttacks: {
+ name: "UpgradeMeleeAttacks",
+ cost: {
+ mine: [100, 150, 200],
+ gas: [100, 150, 200],
+ time: [2660, 2980, 3300]
},
- level:0,
- effect:function(team){
- Zerg.Zergling.prototype.damage[team]+=1;
- Zerg.Ultralisk.prototype.damage[team]+=3;
- Zerg.Broodling.prototype.damage[team]+=1;
+ level: 0,
+ effect: function (team) {
+ Zerg.Zergling.prototype.damage[team] += 1;
+ Zerg.Ultralisk.prototype.damage[team] += 3;
+ Zerg.Broodling.prototype.damage[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ZergBuilding.EvolutionChamber.prototype.items[1];
+ if (this.level[Game.team] >= 3)
+ delete Building.ZergBuilding.EvolutionChamber.prototype.items[1];
}
},
- UpgradeMissileAttacks:{
- name:"UpgradeMissileAttacks",
- cost:{
- mine:[100,150,200],
- gas:[100,150,200],
- time:[2660,2980,3300]
+ UpgradeMissileAttacks: {
+ name: "UpgradeMissileAttacks",
+ cost: {
+ mine: [100, 150, 200],
+ gas: [100, 150, 200],
+ time: [2660, 2980, 3300]
},
- level:0,
- effect:function(team){
- Zerg.Hydralisk.prototype.damage[team]+=1;
- Zerg.Lurker.prototype.damage[team]+=2;
+ level: 0,
+ effect: function (team) {
+ Zerg.Hydralisk.prototype.damage[team] += 1;
+ Zerg.Lurker.prototype.damage[team] += 2;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ZergBuilding.EvolutionChamber.prototype.items[2];
- }
- },
- EvolveCarapace:{
- name:"EvolveCarapace",
- cost:{
- mine:[150,225,300],
- gas:[150,225,300],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Zerg.Drone.prototype.armor[team]+=1;
- Zerg.Zergling.prototype.armor[team]+=1;
- Zerg.Hydralisk.prototype.armor[team]+=1;
- Zerg.Lurker.prototype.armor[team]+=1;
- Zerg.Ultralisk.prototype.armor[team]+=1;
- Zerg.Defiler.prototype.armor[team]+=1;
- Zerg.Broodling.prototype.armor[team]+=1;
- Zerg.InfestedTerran.prototype.armor[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.ZergBuilding.EvolutionChamber.prototype.items[2];
+ }
+ },
+ EvolveCarapace: {
+ name: "EvolveCarapace",
+ cost: {
+ mine: [150, 225, 300],
+ gas: [150, 225, 300],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Zerg.Drone.prototype.armor[team] += 1;
+ Zerg.Zergling.prototype.armor[team] += 1;
+ Zerg.Hydralisk.prototype.armor[team] += 1;
+ Zerg.Lurker.prototype.armor[team] += 1;
+ Zerg.Ultralisk.prototype.armor[team] += 1;
+ Zerg.Defiler.prototype.armor[team] += 1;
+ Zerg.Broodling.prototype.armor[team] += 1;
+ Zerg.InfestedTerran.prototype.armor[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ZergBuilding.EvolutionChamber.prototype.items[3];
+ if (this.level[Game.team] >= 3)
+ delete Building.ZergBuilding.EvolutionChamber.prototype.items[3];
}
},
- EvolveMuscularAugments:{
- name:"EvolveMuscularAugments",
- cost:{
- mine:100,
- gas:100,
- time:1000
+ EvolveMuscularAugments: {
+ name: "EvolveMuscularAugments",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1000
},
- effect:function(team){
- Zerg.Hydralisk.prototype.speed[team]=13;
+ effect: function (team) {
+ Zerg.Hydralisk.prototype.speed[team] = 13;
delete Building.ZergBuilding.HydraliskDen.prototype.items[1];
}
},
- EvolveGroovedSpines:{
- name:"EvolveGroovedSpines",
- cost:{
- mine:150,
- gas:150,
- time:1000
+ EvolveGroovedSpines: {
+ name: "EvolveGroovedSpines",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1000
},
- effect:function(team){
- Zerg.Hydralisk.prototype.attackRange[team]=175;
+ effect: function (team) {
+ Zerg.Hydralisk.prototype.attackRange[team] = 175;
delete Building.ZergBuilding.HydraliskDen.prototype.items[2];
}
},
- EvolveLurkerAspect:{
- name:"EvolveLurkerAspect",
- cost:{
- mine:125,
- gas:125,
- time:1200
+ EvolveLurkerAspect: {
+ name: "EvolveLurkerAspect",
+ cost: {
+ mine: 125,
+ gas: 125,
+ time: 1200
},
- effect:function(){
- Magic.Lurker.enabled=true;
+ effect: function () {
+ Magic.Lurker.enabled = true;
delete Building.ZergBuilding.HydraliskDen.prototype.items[4];
}
},
- UpgradeFlyerAttacks:{
- name:"UpgradeFlyerAttacks",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
+ UpgradeFlyerAttacks: {
+ name: "UpgradeFlyerAttacks",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
},
- level:0,
- effect:function(team){
- Zerg.Mutalisk.prototype.damage[team]+=1;
- Zerg.Guardian.prototype.damage[team]+=2;
- Zerg.Devourer.prototype.damage[team]+=2;
+ level: 0,
+ effect: function (team) {
+ Zerg.Mutalisk.prototype.damage[team] += 1;
+ Zerg.Guardian.prototype.damage[team] += 2;
+ Zerg.Devourer.prototype.damage[team] += 2;
this.level[team]++;
- if (this.level[Game.team]>=3) {
+ if (this.level[Game.team] >= 3) {
delete Building.ZergBuilding.Spire.prototype.items[1];
delete Building.ZergBuilding.GreaterSpire.prototype.items[1];
}
}
},
- UpgradeFlyerCarapace:{
- name:"UpgradeFlyerCarapace",
- cost:{
- mine:[150,225,300],
- gas:[150,225,300],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Zerg.Overlord.prototype.armor[team]+=1;
- Zerg.Mutalisk.prototype.armor[team]+=1;
- Zerg.Guardian.prototype.armor[team]+=1;
- Zerg.Devourer.prototype.armor[team]+=1;
- Zerg.Scourge.prototype.armor[team]+=1;
- Zerg.Queen.prototype.armor[team]+=1;
+ UpgradeFlyerCarapace: {
+ name: "UpgradeFlyerCarapace",
+ cost: {
+ mine: [150, 225, 300],
+ gas: [150, 225, 300],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Zerg.Overlord.prototype.armor[team] += 1;
+ Zerg.Mutalisk.prototype.armor[team] += 1;
+ Zerg.Guardian.prototype.armor[team] += 1;
+ Zerg.Devourer.prototype.armor[team] += 1;
+ Zerg.Scourge.prototype.armor[team] += 1;
+ Zerg.Queen.prototype.armor[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) {
+ if (this.level[Game.team] >= 3) {
delete Building.ZergBuilding.Spire.prototype.items[2];
delete Building.ZergBuilding.GreaterSpire.prototype.items[2];
}
}
},
- EvolveSpawnBroodling:{
- name:"EvolveSpawnBroodling",
- cost:{
- mine:200,
- gas:200,
- time:800
+ EvolveSpawnBroodling: {
+ name: "EvolveSpawnBroodling",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 800
},
- effect:function(){
- Magic.SpawnBroodlings.enabled=true;
+ effect: function () {
+ Magic.SpawnBroodlings.enabled = true;
delete Building.ZergBuilding.QueenNest.prototype.items[1];
}
},
- EvolveEnsnare:{
- name:"EvolveEnsnare",
- cost:{
- mine:100,
- gas:100,
- time:800
+ EvolveEnsnare: {
+ name: "EvolveEnsnare",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 800
},
- effect:function(){
- Magic.Ensnare.enabled=true;
+ effect: function () {
+ Magic.Ensnare.enabled = true;
delete Building.ZergBuilding.QueenNest.prototype.items[2];
}
},
- EvolveGameteMeiosis:{
- name:"EvolveGameteMeiosis",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ EvolveGameteMeiosis: {
+ name: "EvolveGameteMeiosis",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Zerg.Queen.prototype.MP[team]=250;
+ effect: function (team) {
+ Zerg.Queen.prototype.MP[team] = 250;
delete Building.ZergBuilding.QueenNest.prototype.items[3];
}
},
- EvolveAnabolicSynthesis:{
- name:"EvolveAnabolicSynthesis",
- cost:{
- mine:200,
- gas:200,
- time:1330
+ EvolveAnabolicSynthesis: {
+ name: "EvolveAnabolicSynthesis",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1330
},
- effect:function(team){
- Zerg.Ultralisk.prototype.speed[team]=18;
+ effect: function (team) {
+ Zerg.Ultralisk.prototype.speed[team] = 18;
delete Building.ZergBuilding.UltraliskCavern.prototype.items[1];
}
},
- EvolveChitinousPlating:{
- name:"EvolveChitinousPlating",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ EvolveChitinousPlating: {
+ name: "EvolveChitinousPlating",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Zerg.Ultralisk.prototype.armor[team]+=2;
+ effect: function (team) {
+ Zerg.Ultralisk.prototype.armor[team] += 2;
delete Building.ZergBuilding.UltraliskCavern.prototype.items[2];
}
},
- EvolvePlague:{
- name:"EvolvePlague",
- cost:{
- mine:200,
- gas:200,
- time:1000
+ EvolvePlague: {
+ name: "EvolvePlague",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1000
},
- effect:function(){
- Magic.Plague.enabled=true;
+ effect: function () {
+ Magic.Plague.enabled = true;
delete Building.ZergBuilding.DefilerMound.prototype.items[1];
}
},
- EvolveConsume:{
- name:"EvolveConsume",
- cost:{
- mine:100,
- gas:100,
- time:1000
+ EvolveConsume: {
+ name: "EvolveConsume",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1000
},
- effect:function(){
- Magic.Consume.enabled=true;
+ effect: function () {
+ Magic.Consume.enabled = true;
delete Building.ZergBuilding.DefilerMound.prototype.items[2];
}
},
- EvolveMetasynapticNode:{
- name:"EvolveMetasynapticNode",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ EvolveMetasynapticNode: {
+ name: "EvolveMetasynapticNode",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Zerg.Defiler.prototype.MP[team]=250;
+ effect: function (team) {
+ Zerg.Defiler.prototype.MP[team] = 250;
delete Building.ZergBuilding.DefilerMound.prototype.items[3];
}
},
//Protoss
- UpgradeGroundWeapons:{
- name:"UpgradeGroundWeapons",
- cost:{
- mine:[100,150,200],
- gas:[100,150,200],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Protoss.Zealot.prototype.damage[team]+=2;
- Protoss.Dragoon.prototype.damage[team]+=2;
- Protoss.Templar.prototype.damage[team]+=1;
- Protoss.DarkTemplar.prototype.damage[team]+=3;
- Protoss.Archon.prototype.damage[team]+=3;
+ UpgradeGroundWeapons: {
+ name: "UpgradeGroundWeapons",
+ cost: {
+ mine: [100, 150, 200],
+ gas: [100, 150, 200],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Protoss.Zealot.prototype.damage[team] += 2;
+ Protoss.Dragoon.prototype.damage[team] += 2;
+ Protoss.Templar.prototype.damage[team] += 1;
+ Protoss.DarkTemplar.prototype.damage[team] += 3;
+ Protoss.Archon.prototype.damage[team] += 3;
//New RPG level
- Hero.DevilHunter.prototype.damage[team]+=2;
+ Hero.DevilHunter.prototype.damage[team] += 2;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ProtossBuilding.Forge.prototype.items[1];
- }
- },
- UpgradeGroundArmor:{
- name:"UpgradeGroundArmor",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Protoss.Probe.prototype.armor[team]+=1;
- Protoss.Zealot.prototype.armor[team]+=1;
- Protoss.Dragoon.prototype.armor[team]+=1;
- Protoss.Templar.prototype.armor[team]+=1;
- Protoss.DarkTemplar.prototype.armor[team]+=1;
- Protoss.Archon.prototype.armor[team]+=1;
- Protoss.DarkArchon.prototype.armor[team]+=1;
- Protoss.Reaver.prototype.armor[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.ProtossBuilding.Forge.prototype.items[1];
+ }
+ },
+ UpgradeGroundArmor: {
+ name: "UpgradeGroundArmor",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Protoss.Probe.prototype.armor[team] += 1;
+ Protoss.Zealot.prototype.armor[team] += 1;
+ Protoss.Dragoon.prototype.armor[team] += 1;
+ Protoss.Templar.prototype.armor[team] += 1;
+ Protoss.DarkTemplar.prototype.armor[team] += 1;
+ Protoss.Archon.prototype.armor[team] += 1;
+ Protoss.DarkArchon.prototype.armor[team] += 1;
+ Protoss.Reaver.prototype.armor[team] += 1;
//New RPG level
- Hero.DevilHunter.prototype.armor[team]+=2;
+ Hero.DevilHunter.prototype.armor[team] += 2;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ProtossBuilding.Forge.prototype.items[2];
+ if (this.level[Game.team] >= 3)
+ delete Building.ProtossBuilding.Forge.prototype.items[2];
}
},
- UpgradePlasmaShields:{
- name:"UpgradePlasmaShields",
- cost:{
- mine:[200,300,400],
- gas:[200,300,400],
- time:[2660,2980,3300]
+ UpgradePlasmaShields: {
+ name: "UpgradePlasmaShields",
+ cost: {
+ mine: [200, 300, 400],
+ gas: [200, 300, 400],
+ time: [2660, 2980, 3300]
},
- level:0,
- effect:function(team){
- for (var unitType in Protoss){
- Protoss[unitType].prototype.plasma[team]+=1;
+ level: 0,
+ effect: function (team) {
+ for (var unitType in Protoss) {
+ Protoss[unitType].prototype.plasma[team] += 1;
}
//New RPG level
- Hero.DevilHunter.prototype.plasma[team]+=2;
+ Hero.DevilHunter.prototype.plasma[team] += 2;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ProtossBuilding.Forge.prototype.items[3];
- }
- },
- UpgradeAirWeapons:{
- name:"UpgradeAirWeapons",
- cost:{
- mine:[100,175,250],
- gas:[100,175,250],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Protoss.Scout.prototype.attackMode.ground.damage[team]+=1;
- Protoss.Scout.prototype.attackMode.flying.damage[team]+=2;
- Protoss.Carrier.prototype.damage[team]+=1;
- Protoss.Arbiter.prototype.damage[team]+=1;
- Protoss.Corsair.prototype.damage[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.ProtossBuilding.Forge.prototype.items[3];
+ }
+ },
+ UpgradeAirWeapons: {
+ name: "UpgradeAirWeapons",
+ cost: {
+ mine: [100, 175, 250],
+ gas: [100, 175, 250],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Protoss.Scout.prototype.attackMode.ground.damage[team] += 1;
+ Protoss.Scout.prototype.attackMode.flying.damage[team] += 2;
+ Protoss.Carrier.prototype.damage[team] += 1;
+ Protoss.Arbiter.prototype.damage[team] += 1;
+ Protoss.Corsair.prototype.damage[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ProtossBuilding.CyberneticsCore.prototype.items[1];
- }
- },
- UpgradeAirArmor:{
- name:"UpgradeAirArmor",
- cost:{
- mine:[150,225,300],
- gas:[150,225,300],
- time:[2660,2980,3300]
- },
- level:0,
- effect:function(team){
- Protoss.Scout.prototype.armor[team]+=1;
- Protoss.Carrier.prototype.armor[team]+=1;
- Protoss.Arbiter.prototype.armor[team]+=1;
- Protoss.Corsair.prototype.armor[team]+=1;
+ if (this.level[Game.team] >= 3)
+ delete Building.ProtossBuilding.CyberneticsCore.prototype.items[1];
+ }
+ },
+ UpgradeAirArmor: {
+ name: "UpgradeAirArmor",
+ cost: {
+ mine: [150, 225, 300],
+ gas: [150, 225, 300],
+ time: [2660, 2980, 3300]
+ },
+ level: 0,
+ effect: function (team) {
+ Protoss.Scout.prototype.armor[team] += 1;
+ Protoss.Carrier.prototype.armor[team] += 1;
+ Protoss.Arbiter.prototype.armor[team] += 1;
+ Protoss.Corsair.prototype.armor[team] += 1;
this.level[team]++;
- if (this.level[Game.team]>=3) delete Building.ProtossBuilding.CyberneticsCore.prototype.items[2];
+ if (this.level[Game.team] >= 3)
+ delete Building.ProtossBuilding.CyberneticsCore.prototype.items[2];
}
},
- DevelopSingularityCharge:{
- name:"DevelopSingularityCharge",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ DevelopSingularityCharge: {
+ name: "DevelopSingularityCharge",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Protoss.Dragoon.prototype.attackRange[team]=210;
+ effect: function (team) {
+ Protoss.Dragoon.prototype.attackRange[team] = 210;
delete Building.ProtossBuilding.CyberneticsCore.prototype.items[3];
}
},
- DevelopLegEnhancements:{
- name:"DevelopLegEnhancements",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ DevelopLegEnhancements: {
+ name: "DevelopLegEnhancements",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Protoss.Zealot.prototype.speed[team]=14;
+ effect: function (team) {
+ Protoss.Zealot.prototype.speed[team] = 14;
delete Building.ProtossBuilding.CitadelOfAdun.prototype.items[1];
}
},
- UpgradeScarabDamage:{
- name:"UpgradeScarabDamage",
- cost:{
- mine:200,
- gas:200,
- time:1660
+ UpgradeScarabDamage: {
+ name: "UpgradeScarabDamage",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1660
},
- effect:function(team){
- Protoss.Reaver.prototype.damage[team]=125;
+ effect: function (team) {
+ Protoss.Reaver.prototype.damage[team] = 125;
delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[1];
}
},
- IncreaseReaverCapacity:{
- name:"IncreaseReaverCapacity",
- cost:{
- mine:200,
- gas:200,
- time:1660
+ IncreaseReaverCapacity: {
+ name: "IncreaseReaverCapacity",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1660
},
- effect:function(team){
- Protoss.Reaver.prototype.scarabCapacity[team]=10;
+ effect: function (team) {
+ Protoss.Reaver.prototype.scarabCapacity[team] = 10;
delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[2];
}
},
- DevelopGraviticDrive:{
- name:"DevelopGraviticDrive",
- cost:{
- mine:200,
- gas:200,
- time:1660
+ DevelopGraviticDrive: {
+ name: "DevelopGraviticDrive",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1660
},
- effect:function(team){
- Protoss.Shuttle.prototype.speed[team]=16;
+ effect: function (team) {
+ Protoss.Shuttle.prototype.speed[team] = 16;
delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[3];
}
},
- DevelopApialSensors:{
- name:"DevelopApialSensors",
- cost:{
- mine:100,
- gas:100,
- time:1660
+ DevelopApialSensors: {
+ name: "DevelopApialSensors",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1660
},
- effect:function(team){
- Protoss.Scout.prototype.sight[team]=350;
+ effect: function (team) {
+ Protoss.Scout.prototype.sight[team] = 350;
delete Building.ProtossBuilding.FleetBeacon.prototype.items[1];
}
},
- DevelopGraviticThrusters:{
- name:"DevelopGraviticThrusters",
- cost:{
- mine:200,
- gas:200,
- time:1660
+ DevelopGraviticThrusters: {
+ name: "DevelopGraviticThrusters",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1660
},
- effect:function(team){
- Protoss.Scout.prototype.speed[team]=16;
+ effect: function (team) {
+ Protoss.Scout.prototype.speed[team] = 16;
delete Building.ProtossBuilding.FleetBeacon.prototype.items[2];
}
},
- IncreaseCarrierCapacity:{
- name:"IncreaseCarrierCapacity",
- cost:{
- mine:100,
- gas:100,
- time:1000
+ IncreaseCarrierCapacity: {
+ name: "IncreaseCarrierCapacity",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1000
},
- effect:function(team){
+ effect: function (team) {
//Protoss.Carrier.prototype.continuousAttack.count[team]=8;
- Protoss.Carrier.prototype.interceptorCapacity[team]=8;
+ Protoss.Carrier.prototype.interceptorCapacity[team] = 8;
delete Building.ProtossBuilding.FleetBeacon.prototype.items[3];
}
},
- DevelopDistruptionWeb:{
- name:"DevelopDistruptionWeb",
- cost:{
- mine:200,
- gas:200,
- time:800
+ DevelopDistruptionWeb: {
+ name: "DevelopDistruptionWeb",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 800
},
- effect:function(){
- Magic.DisruptionWeb.enabled=true;
+ effect: function () {
+ Magic.DisruptionWeb.enabled = true;
delete Building.ProtossBuilding.FleetBeacon.prototype.items[4];
}
},
- DevelopArgusJewel:{
- name:"DevelopArgusJewel",
- cost:{
- mine:100,
- gas:100,
- time:1660
+ DevelopArgusJewel: {
+ name: "DevelopArgusJewel",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1660
},
- effect:function(team){
- Protoss.Corsair.prototype.MP[team]=250;
+ effect: function (team) {
+ Protoss.Corsair.prototype.MP[team] = 250;
delete Building.ProtossBuilding.FleetBeacon.prototype.items[5];
}
},
- DevelopPsionicStorm:{
- name:"DevelopPsionicStorm",
- cost:{
- mine:200,
- gas:200,
- time:1200
+ DevelopPsionicStorm: {
+ name: "DevelopPsionicStorm",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1200
},
- effect:function(){
- Magic.PsionicStorm.enabled=true;
+ effect: function () {
+ Magic.PsionicStorm.enabled = true;
delete Building.ProtossBuilding.TemplarArchives.prototype.items[1];
}
},
- DevelopHallucination:{
- name:"DevelopHallucination",
- cost:{
- mine:150,
- gas:150,
- time:800
+ DevelopHallucination: {
+ name: "DevelopHallucination",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 800
},
- effect:function(){
- Magic.Hallucination.enabled=true;
+ effect: function () {
+ Magic.Hallucination.enabled = true;
delete Building.ProtossBuilding.TemplarArchives.prototype.items[2];
}
},
- DevelopKhaydarinAmulet:{
- name:"DevelopKhaydarinAmulet",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ DevelopKhaydarinAmulet: {
+ name: "DevelopKhaydarinAmulet",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Protoss.Templar.prototype.MP[team]=250;
+ effect: function (team) {
+ Protoss.Templar.prototype.MP[team] = 250;
delete Building.ProtossBuilding.TemplarArchives.prototype.items[3];
}
},
- DevelopMindControl:{
- name:"DevelopMindControl",
- cost:{
- mine:200,
- gas:200,
- time:1200
+ DevelopMindControl: {
+ name: "DevelopMindControl",
+ cost: {
+ mine: 200,
+ gas: 200,
+ time: 1200
},
- effect:function(){
- Magic.MindControl.enabled=true;
+ effect: function () {
+ Magic.MindControl.enabled = true;
delete Building.ProtossBuilding.TemplarArchives.prototype.items[4];
}
},
- DevelopMaelStorm:{
- name:"DevelopMaelStorm",
- cost:{
- mine:100,
- gas:100,
- time:1000
+ DevelopMaelStorm: {
+ name: "DevelopMaelStorm",
+ cost: {
+ mine: 100,
+ gas: 100,
+ time: 1000
},
- effect:function(){
- Magic.MaelStorm.enabled=true;
+ effect: function () {
+ Magic.MaelStorm.enabled = true;
delete Building.ProtossBuilding.TemplarArchives.prototype.items[5];
}
},
- DevelopArgusTalisman:{
- name:"DevelopArgusTalisman",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ DevelopArgusTalisman: {
+ name: "DevelopArgusTalisman",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Protoss.DarkArchon.prototype.MP[team]=250;
+ effect: function (team) {
+ Protoss.DarkArchon.prototype.MP[team] = 250;
delete Building.ProtossBuilding.TemplarArchives.prototype.items[6];
}
},
- DevelopGraviticBooster:{
- name:"DevelopGraviticBooster",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ DevelopGraviticBooster: {
+ name: "DevelopGraviticBooster",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Protoss.Observer.prototype.speed[team]=12;
+ effect: function (team) {
+ Protoss.Observer.prototype.speed[team] = 12;
delete Building.ProtossBuilding.Observatory.prototype.items[1];
}
},
- DevelopSensorArray:{
- name:"DevelopSensorArray",
- cost:{
- mine:150,
- gas:150,
- time:1330
+ DevelopSensorArray: {
+ name: "DevelopSensorArray",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1330
},
- effect:function(team){
- Protoss.Observer.prototype.sight[team]=385;
+ effect: function (team) {
+ Protoss.Observer.prototype.sight[team] = 385;
delete Building.ProtossBuilding.Observatory.prototype.items[2];
}
},
- DevelopRecall:{
- name:"DevelopRecall",
- cost:{
- mine:150,
- gas:150,
- time:1200
+ DevelopRecall: {
+ name: "DevelopRecall",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1200
},
- effect:function(){
- Magic.Recall.enabled=true;
+ effect: function () {
+ Magic.Recall.enabled = true;
delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[1];
}
},
- DevelopStasisField:{
- name:"DevelopStasisField",
- cost:{
- mine:150,
- gas:150,
- time:1000
+ DevelopStasisField: {
+ name: "DevelopStasisField",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1000
},
- effect:function(){
- Magic.StasisField.enabled=true;
+ effect: function () {
+ Magic.StasisField.enabled = true;
delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[2];
}
},
- DevelopKhaydarinCore:{
- name:"DevelopKhaydarinCore",
- cost:{
- mine:150,
- gas:150,
- time:1660
+ DevelopKhaydarinCore: {
+ name: "DevelopKhaydarinCore",
+ cost: {
+ mine: 150,
+ gas: 150,
+ time: 1660
},
- effect:function(team){
- Protoss.Arbiter.prototype.MP[team]=250;
+ effect: function (team) {
+ Protoss.Arbiter.prototype.MP[team] = 250;
delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[3];
}
},
/********RPG level: Tower Defense********/
- UpgradeSunkenDamage:{
- name:"UpgradeSunkenDamage",
- cost:{
- mine:[50,75,100,125,150],
- time:[300,300,300,300,300]
- },
- level:0,
- effect:function(team){
+ UpgradeSunkenDamage: {
+ name: "UpgradeSunkenDamage",
+ cost: {
+ mine: [50, 75, 100, 125, 150],
+ time: [300, 300, 300, 300, 300]
+ },
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Building.ZergBuilding.SunkenColony.prototype.damage+=5;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Building.ZergBuilding.SunkenColony.prototype.damage += 5;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[1];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[1];
}
}
},
- EnlargeSunkenArea:{
- name:"UpgradeSunkenArea",
- cost:{
- mine:[100,125,150,175,200],
- time:[300,400,500,600,700]
+ EnlargeSunkenArea: {
+ name: "UpgradeSunkenArea",
+ cost: {
+ mine: [100, 125, 150, 175, 200],
+ time: [300, 400, 500, 600, 700]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Building.ZergBuilding.SunkenColony.prototype.AOE.radius+=50;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Building.ZergBuilding.SunkenColony.prototype.AOE.radius += 50;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[2];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[2];
}
}
},
- UpgradeSporeDamage:{
- name:"UpgradeSporeDamage",
- cost:{
- mine:[50,60,70,80,90],
- time:[300,300,300,300,300]
+ UpgradeSporeDamage: {
+ name: "UpgradeSporeDamage",
+ cost: {
+ mine: [50, 60, 70, 80, 90],
+ time: [300, 300, 300, 300, 300]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Building.ZergBuilding.SporeColony.prototype.damage+=3;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Building.ZergBuilding.SporeColony.prototype.damage += 3;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[3];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[3];
}
}
},
- EnlargeSporeChain:{
- name:"EnlargeSporeChain",
- cost:{
- mine:[80,90,100,110,120],
- time:[300,400,500,600,700]
+ EnlargeSporeChain: {
+ name: "EnlargeSporeChain",
+ cost: {
+ mine: [80, 90, 100, 110, 120],
+ time: [300, 400, 500, 600, 700]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Bullets.Spore.prototype.traceTimes+=1;
- Bullets.Spore.prototype.traceRadius+=50;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Bullets.Spore.prototype.traceTimes += 1;
+ Bullets.Spore.prototype.traceRadius += 50;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[4];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[4];
}
}
},
- UpgradeMissileDamage:{
- name:"UpgradeMissileDamage",
- cost:{
- mine:[50,65,80,95,110],
- time:[300,300,300,300,300]
+ UpgradeMissileDamage: {
+ name: "UpgradeMissileDamage",
+ cost: {
+ mine: [50, 65, 80, 95, 110],
+ time: [300, 300, 300, 300, 300]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Building.TerranBuilding.MissileTurret.prototype.damage+=4;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Building.TerranBuilding.MissileTurret.prototype.damage += 4;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[5];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[5];
}
}
},
- IncreaseMissileCount:{
- name:"IncreaseMissileCount",
- cost:{
- mine:[80,95,110,125,140],
- time:[300,300,300,300,300]
+ IncreaseMissileCount: {
+ name: "IncreaseMissileCount",
+ cost: {
+ mine: [80, 95, 110, 125, 140],
+ time: [300, 300, 300, 300, 300]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Building.TerranBuilding.MissileTurret.prototype.AOE.radius+=30;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Building.TerranBuilding.MissileTurret.prototype.AOE.radius += 30;
Building.TerranBuilding.MissileTurret.prototype.AOE.count++;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[6];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[6];
}
}
},
- UpgradePhotonCannonDamage:{
- name:"UpgradePhotonCannonDamage",
- cost:{
- mine:[50,70,90,110,130],
- time:[300,300,300,300,300]
+ UpgradePhotonCannonDamage: {
+ name: "UpgradePhotonCannonDamage",
+ cost: {
+ mine: [50, 70, 90, 110, 130],
+ time: [300, 300, 300, 300, 300]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
- Building.ProtossBuilding.PhotonCannon.prototype.damage+=4;
+ if (Game.level == 11 || Game.replayLevel == 11) {
+ Building.ProtossBuilding.PhotonCannon.prototype.damage += 4;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[7];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[7];
}
}
},
- IncreasePhotonCannonCount:{
- name:"IncreasePhotonCannonCount",
- cost:{
- mine:[80,95,110,125,140],
- time:[300,300,300,300,300]
+ IncreasePhotonCannonCount: {
+ name: "IncreasePhotonCannonCount",
+ cost: {
+ mine: [80, 95, 110, 125, 140],
+ time: [300, 300, 300, 300, 300]
},
- level:0,
- effect:function(team){
+ level: 0,
+ effect: function (team) {
//RPG level lock
- if (Game.level==11 || Game.replayLevel==11) {
+ if (Game.level == 11 || Game.replayLevel == 11) {
Building.ProtossBuilding.PhotonCannon.prototype.continuousAttack.count++;
this.level[team]++;
- if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[8];
+ if (this.level[Game.team] >= 5)
+ delete Building.ProtossBuilding.TeleportPoint.prototype.items[8];
}
}
}
-};
\ No newline at end of file
+};
+//# sourceMappingURL=Upgrade.js.map
\ No newline at end of file
diff --git a/Characters/Upgrade.ts b/Characters/Upgrade.ts
new file mode 100644
index 0000000..4def362
--- /dev/null
+++ b/Characters/Upgrade.ts
@@ -0,0 +1,1130 @@
+var Upgrade={
+ //Terran
+ UpgradeInfantryWeapons:{
+ name:"UpgradeInfantryWeapons",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Terran.Marine.prototype.damage[team]+=1;
+ Terran.Firebat.prototype.damage[team]+=2;
+ Terran.Ghost.prototype.damage[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.TerranBuilding.EngineeringBay.prototype.items[1];
+ }
+ },
+ UpgradeInfantryArmors:{
+ name:"UpgradeInfantryArmors",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Terran.SCV.prototype.armor[team]+=1;
+ Terran.Marine.prototype.armor[team]+=1;
+ Terran.Firebat.prototype.armor[team]+=1;
+ Terran.Ghost.prototype.armor[team]+=1;
+ Terran.Medic.prototype.armor[team]+=1;
+ Terran.Civilian.prototype.armor[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.TerranBuilding.EngineeringBay.prototype.items[2];
+ }
+ },
+ ResearchU238Shells:{
+ name:"ResearchU238Shells",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1000
+ },
+ effect:function(team){
+ Terran.Marine.prototype.attackRange[team]=175;
+ delete Building.TerranBuilding.Academy.prototype.items[1];
+ }
+ },
+ ResearchStimPackTech:{
+ name:"ResearchStimPackTech",
+ cost:{
+ mine:100,
+ gas:100,
+ time:800
+ },
+ effect:function(){
+ Magic.StimPacks.enabled=true;
+ delete Building.TerranBuilding.Academy.prototype.items[2];
+ }
+ },
+ ResearchRestoration:{
+ name:"ResearchRestoration",
+ cost:{
+ mine:100,
+ gas:100,
+ time:800
+ },
+ effect:function(){
+ Magic.Restoration.enabled=true;
+ delete Building.TerranBuilding.Academy.prototype.items[4];
+ }
+ },
+ ResearchOpticalFlare:{
+ name:"ResearchOpticalFlare",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1200
+ },
+ effect:function(){
+ Magic.OpticalFlare.enabled=true;
+ delete Building.TerranBuilding.Academy.prototype.items[5];
+ }
+ },
+ ResearchCaduceusReactor:{
+ name:"ResearchCaduceusReactor",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Terran.Medic.prototype.MP[team]=250;
+ delete Building.TerranBuilding.Academy.prototype.items[6];
+ }
+ },
+ ResearchIonThrusters:{
+ name:"ResearchIonThrusters",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1000
+ },
+ effect:function(team){
+ Terran.Vulture.prototype.speed[team]=20;
+ delete Building.TerranBuilding.MachineShop.prototype.items[1];
+ }
+ },
+ ResearchSpiderMines:{
+ name:"ResearchSpiderMines",
+ cost:{
+ mine:100,
+ gas:100,
+ time:800
+ },
+ effect:function(){
+ Magic.SpiderMines.enabled=true;
+ delete Building.TerranBuilding.MachineShop.prototype.items[2];
+ }
+ },
+ ResearchSiegeTech:{
+ name:"ResearchSiegeTech",
+ cost:{
+ mine:150,
+ gas:150,
+ time:800
+ },
+ effect:function(){
+ Magic.SeigeMode.enabled=true;
+ delete Building.TerranBuilding.MachineShop.prototype.items[3];
+ }
+ },
+ ResearchCharonBoosters:{
+ name:"ResearchCharonBoosters",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Terran.Goliath.prototype.attackMode.flying.attackRange[team]=300;
+ delete Building.TerranBuilding.MachineShop.prototype.items[4];
+ }
+ },
+ ResearchCloakingField:{
+ name:"ResearchCloakingField",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1000
+ },
+ effect:function(){
+ Magic.Cloak.enabled=true;
+ delete Building.TerranBuilding.ControlTower.prototype.items[1];
+ }
+ },
+ ResearchApolloReactor:{
+ name:"ResearchApolloReactor",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1660
+ },
+ effect:function(team){
+ Terran.Wraith.prototype.MP[team]=250;
+ delete Building.TerranBuilding.ControlTower.prototype.items[2];
+ }
+ },
+ ResearchEMPShockwaves:{
+ name:"ResearchEMPShockwaves",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1200
+ },
+ effect:function(){
+ Magic.EMPShockwave.enabled=true;
+ delete Building.TerranBuilding.ScienceFacility.prototype.items[1];
+ }
+ },
+ ResearchIrradiate:{
+ name:"ResearchIrradiate",
+ cost:{
+ mine:150,
+ gas:150,
+ time:800
+ },
+ effect:function(){
+ Magic.Irradiate.enabled=true;
+ delete Building.TerranBuilding.ScienceFacility.prototype.items[2];
+ }
+ },
+ ResearchTitanReactor:{
+ name:"ResearchTitanReactor",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Terran.Vessel.prototype.MP[team]=250;
+ delete Building.TerranBuilding.ScienceFacility.prototype.items[3];
+ }
+ },
+ ResearchLockdown:{
+ name:"ResearchLockdown",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1000
+ },
+ effect:function(){
+ Magic.Lockdown.enabled=true;
+ delete Building.TerranBuilding.ConvertOps.prototype.items[1];
+ }
+ },
+ ResearchPersonalCloaking:{
+ name:"ResearchPersonalCloaking",
+ cost:{
+ mine:100,
+ gas:100,
+ time:800
+ },
+ effect:function(){
+ Magic.PersonalCloak.enabled=true;
+ delete Building.TerranBuilding.ConvertOps.prototype.items[2];
+ }
+ },
+ ResearchOcularImplants:{
+ name:"ResearchOcularImplants",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1660
+ },
+ effect:function(team){
+ Terran.Ghost.prototype.sight[team]=385;
+ delete Building.TerranBuilding.ConvertOps.prototype.items[4];
+ }
+ },
+ ResearchMoebiusReactor:{
+ name:"ResearchMoebiusReactor",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Terran.Ghost.prototype.MP[team]=250;
+ delete Building.TerranBuilding.ConvertOps.prototype.items[5];
+ }
+ },
+ ResearchYamatoGun:{
+ name:"ResearchYamatoGun",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1200
+ },
+ effect:function(){
+ Magic.Yamato.enabled=true;
+ delete Building.TerranBuilding.PhysicsLab.prototype.items[1];
+ }
+ },
+ ResearchColossusReactor:{
+ name:"ResearchColossusReactor",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1600
+ },
+ effect:function(team){
+ Terran.BattleCruiser.prototype.MP[team]=250;
+ delete Building.TerranBuilding.PhysicsLab.prototype.items[2];
+ }
+ },
+ UpgradeVehicleWeapons:{
+ name:"UpgradeVehicleWeapons",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Terran.Vulture.prototype.damage[team]+=2;
+ Terran.Tank.prototype.damage[team]+=3;
+ Terran.Goliath.prototype.attackMode.ground.damage[team]+=2;
+ Terran.Goliath.prototype.attackMode.flying.damage[team]+=4;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[1];
+ }
+ },
+ UpgradeShipWeapons:{
+ name:"UpgradeShipWeapons",
+ cost:{
+ mine:[100,150,200],
+ gas:[100,150,200],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Terran.Wraith.prototype.attackMode.ground.damage[team]+=1;
+ Terran.Wraith.prototype.attackMode.flying.damage[team]+=2;
+ Terran.BattleCruiser.prototype.damage[team]+=3;
+ Terran.Valkyrie.prototype.damage[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[2];
+ }
+ },
+ UpgradeVehicleArmors:{
+ name:"UpgradeVehicleArmors",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Terran.Vulture.prototype.armor[team]+=1;
+ Terran.Tank.prototype.armor[team]+=1;
+ Terran.Goliath.prototype.armor[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[4];
+ }
+ },
+ UpgradeShipArmors:{
+ name:"UpgradeShipArmors",
+ cost:{
+ mine:[150,225,300],
+ gas:[150,225,300],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Terran.Wraith.prototype.armor[team]+=1;
+ Terran.Dropship.prototype.armor[team]+=1;
+ Terran.BattleCruiser.prototype.armor[team]+=1;
+ Terran.Vessel.prototype.armor[team]+=1;
+ Terran.Valkyrie.prototype.armor[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.TerranBuilding.Armory.prototype.items[5];
+ }
+ },
+ //Zerg
+ EvolveBurrow:{
+ name:"EvolveBurrow",
+ cost:{
+ mine:100,
+ gas:100,
+ time:800
+ },
+ effect:function(){
+ Magic.Burrow.enabled=Magic.Unburrow.enabled=true;
+ delete Building.ZergBuilding.Hatchery.prototype.items[3];
+ delete Building.ZergBuilding.Lair.prototype.items[3];
+ delete Building.ZergBuilding.Hive.prototype.items[3];
+ }
+ },
+ EvolveVentralSacs:{
+ name:"EvolveVentralSacs",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1600
+ },
+ effect:function(){
+ Magic.Load.enabled=Magic.UnloadAll.enabled=true;
+ delete Building.ZergBuilding.Lair.prototype.items[4];
+ delete Building.ZergBuilding.Hive.prototype.items[4];
+ }
+ },
+ EvolveAntennas:{
+ name:"EvolveAntennas",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Zerg.Overlord.prototype.sight[team]=385;
+ delete Building.ZergBuilding.Lair.prototype.items[5];
+ delete Building.ZergBuilding.Hive.prototype.items[5];
+ }
+ },
+ EvolvePneumatizedCarapace:{
+ name:"EvolvePneumatizedCarapace",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Zerg.Overlord.prototype.speed[team]=8;
+ delete Building.ZergBuilding.Lair.prototype.items[6];
+ delete Building.ZergBuilding.Hive.prototype.items[6];
+ }
+ },
+ EvolveMetabolicBoost:{
+ name:"EvolveMetabolicBoost",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1000
+ },
+ effect:function(team){
+ Zerg.Zergling.prototype.speed[team]=18;
+ delete Building.ZergBuilding.SpawningPool.prototype.items[1];
+ }
+ },
+ EvolveAdrenalGlands:{
+ name:"EvolveAdrenalGlands",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1000
+ },
+ effect:function(team){
+ Zerg.Zergling.prototype.attackInterval[team]=600;
+ delete Building.ZergBuilding.SpawningPool.prototype.items[2];
+ }
+ },
+ UpgradeMeleeAttacks:{
+ name:"UpgradeMeleeAttacks",
+ cost:{
+ mine:[100,150,200],
+ gas:[100,150,200],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Zerg.Zergling.prototype.damage[team]+=1;
+ Zerg.Ultralisk.prototype.damage[team]+=3;
+ Zerg.Broodling.prototype.damage[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ZergBuilding.EvolutionChamber.prototype.items[1];
+ }
+ },
+ UpgradeMissileAttacks:{
+ name:"UpgradeMissileAttacks",
+ cost:{
+ mine:[100,150,200],
+ gas:[100,150,200],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Zerg.Hydralisk.prototype.damage[team]+=1;
+ Zerg.Lurker.prototype.damage[team]+=2;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ZergBuilding.EvolutionChamber.prototype.items[2];
+ }
+ },
+ EvolveCarapace:{
+ name:"EvolveCarapace",
+ cost:{
+ mine:[150,225,300],
+ gas:[150,225,300],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Zerg.Drone.prototype.armor[team]+=1;
+ Zerg.Zergling.prototype.armor[team]+=1;
+ Zerg.Hydralisk.prototype.armor[team]+=1;
+ Zerg.Lurker.prototype.armor[team]+=1;
+ Zerg.Ultralisk.prototype.armor[team]+=1;
+ Zerg.Defiler.prototype.armor[team]+=1;
+ Zerg.Broodling.prototype.armor[team]+=1;
+ Zerg.InfestedTerran.prototype.armor[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ZergBuilding.EvolutionChamber.prototype.items[3];
+ }
+ },
+ EvolveMuscularAugments:{
+ name:"EvolveMuscularAugments",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1000
+ },
+ effect:function(team){
+ Zerg.Hydralisk.prototype.speed[team]=13;
+ delete Building.ZergBuilding.HydraliskDen.prototype.items[1];
+ }
+ },
+ EvolveGroovedSpines:{
+ name:"EvolveGroovedSpines",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1000
+ },
+ effect:function(team){
+ Zerg.Hydralisk.prototype.attackRange[team]=175;
+ delete Building.ZergBuilding.HydraliskDen.prototype.items[2];
+ }
+ },
+ EvolveLurkerAspect:{
+ name:"EvolveLurkerAspect",
+ cost:{
+ mine:125,
+ gas:125,
+ time:1200
+ },
+ effect:function(){
+ Magic.Lurker.enabled=true;
+ delete Building.ZergBuilding.HydraliskDen.prototype.items[4];
+ }
+ },
+ UpgradeFlyerAttacks:{
+ name:"UpgradeFlyerAttacks",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Zerg.Mutalisk.prototype.damage[team]+=1;
+ Zerg.Guardian.prototype.damage[team]+=2;
+ Zerg.Devourer.prototype.damage[team]+=2;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) {
+ delete Building.ZergBuilding.Spire.prototype.items[1];
+ delete Building.ZergBuilding.GreaterSpire.prototype.items[1];
+ }
+ }
+ },
+ UpgradeFlyerCarapace:{
+ name:"UpgradeFlyerCarapace",
+ cost:{
+ mine:[150,225,300],
+ gas:[150,225,300],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Zerg.Overlord.prototype.armor[team]+=1;
+ Zerg.Mutalisk.prototype.armor[team]+=1;
+ Zerg.Guardian.prototype.armor[team]+=1;
+ Zerg.Devourer.prototype.armor[team]+=1;
+ Zerg.Scourge.prototype.armor[team]+=1;
+ Zerg.Queen.prototype.armor[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) {
+ delete Building.ZergBuilding.Spire.prototype.items[2];
+ delete Building.ZergBuilding.GreaterSpire.prototype.items[2];
+ }
+ }
+ },
+ EvolveSpawnBroodling:{
+ name:"EvolveSpawnBroodling",
+ cost:{
+ mine:200,
+ gas:200,
+ time:800
+ },
+ effect:function(){
+ Magic.SpawnBroodlings.enabled=true;
+ delete Building.ZergBuilding.QueenNest.prototype.items[1];
+ }
+ },
+ EvolveEnsnare:{
+ name:"EvolveEnsnare",
+ cost:{
+ mine:100,
+ gas:100,
+ time:800
+ },
+ effect:function(){
+ Magic.Ensnare.enabled=true;
+ delete Building.ZergBuilding.QueenNest.prototype.items[2];
+ }
+ },
+ EvolveGameteMeiosis:{
+ name:"EvolveGameteMeiosis",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Zerg.Queen.prototype.MP[team]=250;
+ delete Building.ZergBuilding.QueenNest.prototype.items[3];
+ }
+ },
+ EvolveAnabolicSynthesis:{
+ name:"EvolveAnabolicSynthesis",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1330
+ },
+ effect:function(team){
+ Zerg.Ultralisk.prototype.speed[team]=18;
+ delete Building.ZergBuilding.UltraliskCavern.prototype.items[1];
+ }
+ },
+ EvolveChitinousPlating:{
+ name:"EvolveChitinousPlating",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Zerg.Ultralisk.prototype.armor[team]+=2;
+ delete Building.ZergBuilding.UltraliskCavern.prototype.items[2];
+ }
+ },
+ EvolvePlague:{
+ name:"EvolvePlague",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1000
+ },
+ effect:function(){
+ Magic.Plague.enabled=true;
+ delete Building.ZergBuilding.DefilerMound.prototype.items[1];
+ }
+ },
+ EvolveConsume:{
+ name:"EvolveConsume",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1000
+ },
+ effect:function(){
+ Magic.Consume.enabled=true;
+ delete Building.ZergBuilding.DefilerMound.prototype.items[2];
+ }
+ },
+ EvolveMetasynapticNode:{
+ name:"EvolveMetasynapticNode",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Zerg.Defiler.prototype.MP[team]=250;
+ delete Building.ZergBuilding.DefilerMound.prototype.items[3];
+ }
+ },
+ //Protoss
+ UpgradeGroundWeapons:{
+ name:"UpgradeGroundWeapons",
+ cost:{
+ mine:[100,150,200],
+ gas:[100,150,200],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Protoss.Zealot.prototype.damage[team]+=2;
+ Protoss.Dragoon.prototype.damage[team]+=2;
+ Protoss.Templar.prototype.damage[team]+=1;
+ Protoss.DarkTemplar.prototype.damage[team]+=3;
+ Protoss.Archon.prototype.damage[team]+=3;
+ //New RPG level
+ Hero.DevilHunter.prototype.damage[team]+=2;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ProtossBuilding.Forge.prototype.items[1];
+ }
+ },
+ UpgradeGroundArmor:{
+ name:"UpgradeGroundArmor",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Protoss.Probe.prototype.armor[team]+=1;
+ Protoss.Zealot.prototype.armor[team]+=1;
+ Protoss.Dragoon.prototype.armor[team]+=1;
+ Protoss.Templar.prototype.armor[team]+=1;
+ Protoss.DarkTemplar.prototype.armor[team]+=1;
+ Protoss.Archon.prototype.armor[team]+=1;
+ Protoss.DarkArchon.prototype.armor[team]+=1;
+ Protoss.Reaver.prototype.armor[team]+=1;
+ //New RPG level
+ Hero.DevilHunter.prototype.armor[team]+=2;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ProtossBuilding.Forge.prototype.items[2];
+ }
+ },
+ UpgradePlasmaShields:{
+ name:"UpgradePlasmaShields",
+ cost:{
+ mine:[200,300,400],
+ gas:[200,300,400],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ for (var unitType in Protoss){
+ Protoss[unitType].prototype.plasma[team]+=1;
+ }
+ //New RPG level
+ Hero.DevilHunter.prototype.plasma[team]+=2;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ProtossBuilding.Forge.prototype.items[3];
+ }
+ },
+ UpgradeAirWeapons:{
+ name:"UpgradeAirWeapons",
+ cost:{
+ mine:[100,175,250],
+ gas:[100,175,250],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Protoss.Scout.prototype.attackMode.ground.damage[team]+=1;
+ Protoss.Scout.prototype.attackMode.flying.damage[team]+=2;
+ Protoss.Carrier.prototype.damage[team]+=1;
+ Protoss.Arbiter.prototype.damage[team]+=1;
+ Protoss.Corsair.prototype.damage[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ProtossBuilding.CyberneticsCore.prototype.items[1];
+ }
+ },
+ UpgradeAirArmor:{
+ name:"UpgradeAirArmor",
+ cost:{
+ mine:[150,225,300],
+ gas:[150,225,300],
+ time:[2660,2980,3300]
+ },
+ level:0,
+ effect:function(team){
+ Protoss.Scout.prototype.armor[team]+=1;
+ Protoss.Carrier.prototype.armor[team]+=1;
+ Protoss.Arbiter.prototype.armor[team]+=1;
+ Protoss.Corsair.prototype.armor[team]+=1;
+ this.level[team]++;
+ if (this.level[Game.team]>=3) delete Building.ProtossBuilding.CyberneticsCore.prototype.items[2];
+ }
+ },
+ DevelopSingularityCharge:{
+ name:"DevelopSingularityCharge",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Dragoon.prototype.attackRange[team]=210;
+ delete Building.ProtossBuilding.CyberneticsCore.prototype.items[3];
+ }
+ },
+ DevelopLegEnhancements:{
+ name:"DevelopLegEnhancements",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Protoss.Zealot.prototype.speed[team]=14;
+ delete Building.ProtossBuilding.CitadelOfAdun.prototype.items[1];
+ }
+ },
+ UpgradeScarabDamage:{
+ name:"UpgradeScarabDamage",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Reaver.prototype.damage[team]=125;
+ delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[1];
+ }
+ },
+ IncreaseReaverCapacity:{
+ name:"IncreaseReaverCapacity",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Reaver.prototype.scarabCapacity[team]=10;
+ delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[2];
+ }
+ },
+ DevelopGraviticDrive:{
+ name:"DevelopGraviticDrive",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Shuttle.prototype.speed[team]=16;
+ delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[3];
+ }
+ },
+ DevelopApialSensors:{
+ name:"DevelopApialSensors",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Scout.prototype.sight[team]=350;
+ delete Building.ProtossBuilding.FleetBeacon.prototype.items[1];
+ }
+ },
+ DevelopGraviticThrusters:{
+ name:"DevelopGraviticThrusters",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Scout.prototype.speed[team]=16;
+ delete Building.ProtossBuilding.FleetBeacon.prototype.items[2];
+ }
+ },
+ IncreaseCarrierCapacity:{
+ name:"IncreaseCarrierCapacity",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1000
+ },
+ effect:function(team){
+ //Protoss.Carrier.prototype.continuousAttack.count[team]=8;
+ Protoss.Carrier.prototype.interceptorCapacity[team]=8;
+ delete Building.ProtossBuilding.FleetBeacon.prototype.items[3];
+ }
+ },
+ DevelopDistruptionWeb:{
+ name:"DevelopDistruptionWeb",
+ cost:{
+ mine:200,
+ gas:200,
+ time:800
+ },
+ effect:function(){
+ Magic.DisruptionWeb.enabled=true;
+ delete Building.ProtossBuilding.FleetBeacon.prototype.items[4];
+ }
+ },
+ DevelopArgusJewel:{
+ name:"DevelopArgusJewel",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Corsair.prototype.MP[team]=250;
+ delete Building.ProtossBuilding.FleetBeacon.prototype.items[5];
+ }
+ },
+ DevelopPsionicStorm:{
+ name:"DevelopPsionicStorm",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1200
+ },
+ effect:function(){
+ Magic.PsionicStorm.enabled=true;
+ delete Building.ProtossBuilding.TemplarArchives.prototype.items[1];
+ }
+ },
+ DevelopHallucination:{
+ name:"DevelopHallucination",
+ cost:{
+ mine:150,
+ gas:150,
+ time:800
+ },
+ effect:function(){
+ Magic.Hallucination.enabled=true;
+ delete Building.ProtossBuilding.TemplarArchives.prototype.items[2];
+ }
+ },
+ DevelopKhaydarinAmulet:{
+ name:"DevelopKhaydarinAmulet",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Templar.prototype.MP[team]=250;
+ delete Building.ProtossBuilding.TemplarArchives.prototype.items[3];
+ }
+ },
+ DevelopMindControl:{
+ name:"DevelopMindControl",
+ cost:{
+ mine:200,
+ gas:200,
+ time:1200
+ },
+ effect:function(){
+ Magic.MindControl.enabled=true;
+ delete Building.ProtossBuilding.TemplarArchives.prototype.items[4];
+ }
+ },
+ DevelopMaelStorm:{
+ name:"DevelopMaelStorm",
+ cost:{
+ mine:100,
+ gas:100,
+ time:1000
+ },
+ effect:function(){
+ Magic.MaelStorm.enabled=true;
+ delete Building.ProtossBuilding.TemplarArchives.prototype.items[5];
+ }
+ },
+ DevelopArgusTalisman:{
+ name:"DevelopArgusTalisman",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.DarkArchon.prototype.MP[team]=250;
+ delete Building.ProtossBuilding.TemplarArchives.prototype.items[6];
+ }
+ },
+ DevelopGraviticBooster:{
+ name:"DevelopGraviticBooster",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Protoss.Observer.prototype.speed[team]=12;
+ delete Building.ProtossBuilding.Observatory.prototype.items[1];
+ }
+ },
+ DevelopSensorArray:{
+ name:"DevelopSensorArray",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1330
+ },
+ effect:function(team){
+ Protoss.Observer.prototype.sight[team]=385;
+ delete Building.ProtossBuilding.Observatory.prototype.items[2];
+ }
+ },
+ DevelopRecall:{
+ name:"DevelopRecall",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1200
+ },
+ effect:function(){
+ Magic.Recall.enabled=true;
+ delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[1];
+ }
+ },
+ DevelopStasisField:{
+ name:"DevelopStasisField",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1000
+ },
+ effect:function(){
+ Magic.StasisField.enabled=true;
+ delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[2];
+ }
+ },
+ DevelopKhaydarinCore:{
+ name:"DevelopKhaydarinCore",
+ cost:{
+ mine:150,
+ gas:150,
+ time:1660
+ },
+ effect:function(team){
+ Protoss.Arbiter.prototype.MP[team]=250;
+ delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[3];
+ }
+ },
+ /********RPG level: Tower Defense********/
+ UpgradeSunkenDamage:{
+ name:"UpgradeSunkenDamage",
+ cost:{
+ mine:[50,75,100,125,150],
+ time:[300,300,300,300,300]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.ZergBuilding.SunkenColony.prototype.damage+=5;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[1];
+ }
+ }
+ },
+ EnlargeSunkenArea:{
+ name:"UpgradeSunkenArea",
+ cost:{
+ mine:[100,125,150,175,200],
+ time:[300,400,500,600,700]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.ZergBuilding.SunkenColony.prototype.AOE.radius+=50;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[2];
+ }
+ }
+ },
+ UpgradeSporeDamage:{
+ name:"UpgradeSporeDamage",
+ cost:{
+ mine:[50,60,70,80,90],
+ time:[300,300,300,300,300]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.ZergBuilding.SporeColony.prototype.damage+=3;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[3];
+ }
+ }
+ },
+ EnlargeSporeChain:{
+ name:"EnlargeSporeChain",
+ cost:{
+ mine:[80,90,100,110,120],
+ time:[300,400,500,600,700]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Bullets.Spore.prototype.traceTimes+=1;
+ Bullets.Spore.prototype.traceRadius+=50;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[4];
+ }
+ }
+ },
+ UpgradeMissileDamage:{
+ name:"UpgradeMissileDamage",
+ cost:{
+ mine:[50,65,80,95,110],
+ time:[300,300,300,300,300]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.TerranBuilding.MissileTurret.prototype.damage+=4;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[5];
+ }
+ }
+ },
+ IncreaseMissileCount:{
+ name:"IncreaseMissileCount",
+ cost:{
+ mine:[80,95,110,125,140],
+ time:[300,300,300,300,300]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.TerranBuilding.MissileTurret.prototype.AOE.radius+=30;
+ Building.TerranBuilding.MissileTurret.prototype.AOE.count++;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[6];
+ }
+ }
+ },
+ UpgradePhotonCannonDamage:{
+ name:"UpgradePhotonCannonDamage",
+ cost:{
+ mine:[50,70,90,110,130],
+ time:[300,300,300,300,300]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.ProtossBuilding.PhotonCannon.prototype.damage+=4;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[7];
+ }
+ }
+ },
+ IncreasePhotonCannonCount:{
+ name:"IncreasePhotonCannonCount",
+ cost:{
+ mine:[80,95,110,125,140],
+ time:[300,300,300,300,300]
+ },
+ level:0,
+ effect:function(team){
+ //RPG level lock
+ if (Game.level==11 || Game.replayLevel==11) {
+ Building.ProtossBuilding.PhotonCannon.prototype.continuousAttack.count++;
+ this.level[team]++;
+ if (this.level[Game.team]>=5) delete Building.ProtossBuilding.TeleportPoint.prototype.items[8];
+ }
+ }
+ }
+};
\ No newline at end of file
diff --git a/Characters/Zerg.js b/Characters/Zerg.js
index 238e4f7..c990c47 100644
--- a/Characters/Zerg.js
+++ b/Characters/Zerg.js
@@ -1,10 +1,10 @@
/******* Define Zerg units *******/
-var Zerg={};
-Zerg.Drone=AttackableUnit.extends({
- constructorPlus:function(props){
- this.sound.burrow=new Audio(Game.CDN+'bgm/Zerg.burrow.wav');
- this.sound.unburrow=new Audio(Game.CDN+'bgm/Zerg.unburrow.wav');
- this.direction=7;
+var Zerg = {};
+Zerg.Drone = AttackableUnit.extends({
+ constructorPlus: function (props) {
+ this.sound.burrow = new Audio(Game.CDN + 'bgm/Zerg.burrow.wav');
+ this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
+ this.direction = 7;
},
prototypePlus: {
//Add basic unit info
@@ -12,215 +12,214 @@ Zerg.Drone=AttackableUnit.extends({
imgPos: {
moving: {
left: [
- [36,36,36],[164,164,164],
- [292,292,292],[420,420,420],
- [548,548,548],[676,676,676],
- [804,804,804],[932,932,932],
- [1060,1060,1060],[1316,1316,1316],
- [1444,1444,1444],[1572,1572,1572],
- [1700,1700,1700],[1828,1828,1828],
- [1956,1956,1956],[2084,2084,2084]
+ [36, 36, 36], [164, 164, 164],
+ [292, 292, 292], [420, 420, 420],
+ [548, 548, 548], [676, 676, 676],
+ [804, 804, 804], [932, 932, 932],
+ [1060, 1060, 1060], [1316, 1316, 1316],
+ [1444, 1444, 1444], [1572, 1572, 1572],
+ [1700, 1700, 1700], [1828, 1828, 1828],
+ [1956, 1956, 1956], [2084, 2084, 2084]
],
top: [
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292],
- [36,164,292],[36,164,292]
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292],
+ [36, 164, 292], [36, 164, 292]
]
},
attack: {
left: [
- [36,36,36,36,36,36,36],[164,164,164,164,164,164,164],
- [292,292,292,292,292,292,292],[420,420,420,420,420,420,420],
- [548,548,548,548,548,548,548],[676,676,676,676,676,676,676],
- [804,804,804,804,804,804,804],[932,932,932,932,932,932,932],
- [1060,1060,1060,1060,1060,1060,1060],[1316,1316,1316,1316,1316,1316,1316],
- [1444,1444,1444,1444,1444,1444,1444],[1572,1572,1572,1572,1572,1572,1572],
- [1700,1700,1700,1700,1700,1700,1700],[1828,1828,1828,1828,1828,1828,1828],
- [1956,1956,1956,1956,1956,1956,1956],[2084,2084,2084,2084,2084,2084,2084]
+ [36, 36, 36, 36, 36, 36, 36], [164, 164, 164, 164, 164, 164, 164],
+ [292, 292, 292, 292, 292, 292, 292], [420, 420, 420, 420, 420, 420, 420],
+ [548, 548, 548, 548, 548, 548, 548], [676, 676, 676, 676, 676, 676, 676],
+ [804, 804, 804, 804, 804, 804, 804], [932, 932, 932, 932, 932, 932, 932],
+ [1060, 1060, 1060, 1060, 1060, 1060, 1060], [1316, 1316, 1316, 1316, 1316, 1316, 1316],
+ [1444, 1444, 1444, 1444, 1444, 1444, 1444], [1572, 1572, 1572, 1572, 1572, 1572, 1572],
+ [1700, 1700, 1700, 1700, 1700, 1700, 1700], [1828, 1828, 1828, 1828, 1828, 1828, 1828],
+ [1956, 1956, 1956, 1956, 1956, 1956, 1956], [2084, 2084, 2084, 2084, 2084, 2084, 2084]
],
top: [
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188],
- [420,548,676,804,932,1060,1188],[420,548,676,804,932,1060,1188]
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
+ [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188]
]
},
dock: {
- left: [36,164,292,420,548,676,804,932,1060,1316,1444,1572,1700,1828,1956,2084],
- top: [36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36]
+ left: [36, 164, 292, 420, 548, 676, 804, 932, 1060, 1316, 1444, 1572, 1700, 1828, 1956, 2084],
+ top: [36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36]
},
burrow: {
left: [
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572],
- [1700,-1,1188,1316,1444,1572],[1700,-1,1188,1316,1444,1572]
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
+ [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572]
],
top: [
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316],
- [1316,-1,1316,1316,1316,1316],[1316,-1,1316,1316,1316,1316]
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
+ [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316]
]
},
unburrow: {
left: [
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188],
- [1572,1444,1316,1188,1188,1188],[1572,1444,1316,1188,1188,1188]
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
+ [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188]
],
top: [
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316],
- [1316,1316,1316,1316,1316,1316],[1316,1316,1316,1316,1316,1316]
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
+ [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316]
]
}
},
- width: 56,//128N+36
+ width: 56,
height: 56,
frame: {
moving: 3,
dock: 1,
- attack:7,
+ attack: 7,
burrow: 1,
unburrow: 6
},
//Only for moving status, override
- speed:12,
+ speed: 12,
HP: 40,
damage: 5,
- armor:0,
- sight:245,
+ armor: 0,
+ sight: 245,
meleeAttack: true,
attackInterval: 2200,
- dieEffect:Burst.DroneDeath,
- isFlying:false,
- attackLimit:"ground",
- unitType:Unit.SMALL,
- attackType:AttackableUnit.NORMAL_ATTACK,
- recover:Building.ZergBuilding.prototype.recover,
- cost:{
- mine:50,
- man:1,
- time:200
+ dieEffect: Burst.DroneDeath,
+ isFlying: false,
+ attackLimit: "ground",
+ unitType: Unit.SMALL,
+ attackType: AttackableUnit.NORMAL_ATTACK,
+ recover: Building.ZergBuilding.prototype.recover,
+ cost: {
+ mine: 50,
+ man: 1,
+ time: 200
},
- upgrade:['EvolveCarapace'],
- items:{'4':undefined,
- '5':{name:'gather'},
- '7':{name:'BasicMutation'},
- '8':{name:'AdvancedMutation'},
- '9':{name:'Burrow',condition:function(){
- return Magic.Burrow.enabled
- }}
+ upgrade: ['EvolveCarapace'],
+ items: { '4': undefined,
+ '5': { name: 'gather' },
+ '7': { name: 'BasicMutation' },
+ '8': { name: 'AdvancedMutation' },
+ '9': { name: 'Burrow', condition: function () {
+ return Magic.Burrow.enabled;
+ } }
},
- buildZergBuilding:function(location){
+ buildZergBuilding: function (location) {
//Has location callback info or nothing
- if (location){
+ if (location) {
//Move toward target to fire Ensnare
- this.targetLock=true;
- var myself=this;
- this.moveTo(location.x,location.y,20,function(){
- if (Resource.payCreditBill.call(myself)){
- var target=Building.ZergBuilding[myself.buildName];
+ this.targetLock = true;
+ var myself = this;
+ this.moveTo(location.x, location.y, 20, function () {
+ if (Resource.payCreditBill.call(myself)) {
+ var target = Building.ZergBuilding[myself.buildName];
//Adjust location
- myself.x=(location.x-myself.width/2)>>0;
- myself.y=(location.y-myself.height/2)>>0;
- var mutation=myself.evolveTo({
- type:eval('Building.'+target.prototype.evolves[0].step),
- chain:true
+ myself.x = (location.x - myself.width / 2) >> 0;
+ myself.y = (location.y - myself.height / 2) >> 0;
+ var mutation = myself.evolveTo({
+ type: eval('Building.' + target.prototype.evolves[0].step),
+ chain: true
});
- mutation.buildName=myself.buildName;
+ mutation.buildName = myself.buildName;
//Calculate duration
- var duration=Resource.getCost(myself.buildName).time;
+ var duration = Resource.getCost(myself.buildName).time;
//Cheat: Operation cwal
- if (Cheat.cwal) duration=40;
+ if (Cheat.cwal)
+ duration = 40;
//Processing flag on transfer
- mutation.processing={
- name:mutation.buildName,
- startTime:Game.mainTick,//new Date().getTime()
- time:duration
+ mutation.processing = {
+ name: mutation.buildName,
+ startTime: Game.mainTick,
+ time: duration
};
//Evolve chain
- for (var N=1;N>0;
+ myself.y=(location.y-myself.height/2)>>0;
+ var mutation=myself.evolveTo({
+ type:eval('Building.'+target.prototype.evolves[0].step),
+ chain:true
+ });
+ mutation.buildName=myself.buildName;
+ //Calculate duration
+ var duration=Resource.getCost(myself.buildName).time;
+ //Cheat: Operation cwal
+ if (Cheat.cwal) duration=40;
+ //Processing flag on transfer
+ mutation.processing={
+ name:mutation.buildName,
+ startTime:Game.mainTick,//new Date().getTime()
+ time:duration
+ };
+ //Evolve chain
+ for (var N=1;NGame.infoBox.y) return;
+ if (clickY > Game.infoBox.y)
+ return;
//Selection mode
- if (Button.callback==null) {
+ if (Button.callback == null) {
//Find selected one, convert position
- var selectedOne=Game.getSelectedOne(clickX+Map.offsetX,clickY+Map.offsetY);
+ var selectedOne = Game.getSelectedOne(clickX + Map.offsetX, clickY + Map.offsetY);
//Cannot select enemy invisible unit
- if ((selectedOne instanceof Gobj) && selectedOne['isInvisible'+Game.team] && selectedOne.isEnemy()) return;
+ if ((selectedOne instanceof Gobj) && selectedOne['isInvisible' + Game.team] && selectedOne.isEnemy())
+ return;
//Single select will unselect all units and only choose selected one
//Multi select will keep selected status and do nothing
if (!mouseController.isMultiSelect())
@@ -29,7 +31,8 @@ var mouseController={
//If has selected one
if (selectedOne instanceof Gobj) {
//Sound effect
- if (!(selectedOne.isEnemy())) selectedOne.sound.selected.play();
+ if (!(selectedOne.isEnemy()))
+ selectedOne.sound.selected.play();
//Cannot multiSelect with enemy
if (selectedOne.isEnemy() || (Game.selectedUnit.isEnemy && Game.selectedUnit.isEnemy()))
Game.unselectAll();
@@ -44,7 +47,6 @@ var mouseController={
Game.unselectAll();
}
}
- //Button mode
else {
//Callback
Button.execute(event);
@@ -52,43 +54,48 @@ var mouseController={
//Hide tooltip when click
$('div.tooltip_Box').hide();
//Login user statistic
- if (Multiplayer.statistic!=null) Multiplayer.statistic.left++;
+ if (Multiplayer.statistic != null)
+ Multiplayer.statistic.left++;
},
- rightClick:function(event,unlock,btn){
+ rightClick: function (event, unlock, btn) {
//Mouse at (clickX,clickY)
- var offset=$('#fogCanvas').offset();
- var clickX=event.pageX-offset.left;
- var clickY=event.pageY-offset.top;
+ var offset = $('#fogCanvas').offset();
+ var clickX = event.pageX - offset.left;
+ var clickY = event.pageY - offset.top;
//Intercept event inside infoBox
- if (clickY>Game.infoBox.y) return;
+ if (clickY > Game.infoBox.y)
+ return;
//Show right click cursor
- var pos={x:(clickX+Map.offsetX),y:(clickY+Map.offsetY)};
+ var pos = { x: (clickX + Map.offsetX), y: (clickY + Map.offsetY) };
new Burst.RightClickCursor(pos);
- var charas=Game.allSelected.filter(function(chara){
+ var charas = Game.allSelected.filter(function (chara) {
//Can only control our alive unit
- return chara.team==Game.team && chara.status!="dead";
+ return chara.team == Game.team && chara.status != "dead";
});
//Handle user right click
Multiplayer.cmds.push(JSON.stringify({
- uids:Multiplayer.getUIDs(charas),
- type:'rightClick',
- pos:pos,
- unlock:Boolean(unlock),
- btn:btn
+ uids: Multiplayer.getUIDs(charas),
+ type: 'rightClick',
+ pos: pos,
+ unlock: Boolean(unlock),
+ btn: btn
}));
//Login user statistic
- if (Multiplayer.statistic!=null) Multiplayer.statistic.right++;
+ if (Multiplayer.statistic != null)
+ Multiplayer.statistic.right++;
},
- rightClickHandler:function(charas,pos,unlock,btn){
+ rightClickHandler: function (charas, pos, unlock, btn) {
//Find selected one or nothing
- var selectedEnemy=(charas.length>0)?Game.getSelectedOne(pos.x,pos.y,charas[0].team.toString()):null;
- charas.forEach(function(chara){
+ var selectedEnemy = (charas.length > 0) ? Game.getSelectedOne(pos.x, pos.y, charas[0].team.toString()) : null;
+ charas.forEach(function (chara) {
//Sound effect
- if (!chara.isEnemy() && chara.sound.moving) chara.sound.moving.play();
+ if (!chara.isEnemy() && chara.sound.moving)
+ chara.sound.moving.play();
//Interrupt old destination routing
if (chara.destination) {
//Break possible dead lock
- if (chara.destination.next) chara.destination.next=null;
+ if (chara.destination.next)
+ chara.destination.next = null;
delete chara.destination;
}
//Cancel possible hold
@@ -99,193 +106,198 @@ var mouseController={
Button.refreshButtons();
}
//Unit cannot attack will always choose move mode
- var attackOrMove=(chara.attack)?(selectedEnemy instanceof Gobj):false;
+ var attackOrMove = (chara.attack) ? (selectedEnemy instanceof Gobj) : false;
//Attack mode
if (attackOrMove) {
- if (chara.cannotMove() && !(chara.isInAttackRange(selectedEnemy))) return;
+ if (chara.cannotMove() && !(chara.isInAttackRange(selectedEnemy)))
+ return;
//Intercept invisible enemy
- if (selectedEnemy['isInvisible'+Game.team]) {
- if (!chara.isEnemy()) Referee.voice('pError').play();
+ if (selectedEnemy['isInvisible' + Game.team]) {
+ if (!chara.isEnemy())
+ Referee.voice('pError').play();
return;
}
- chara.targetLock=true;
+ chara.targetLock = true;
chara.attack(selectedEnemy);
}
- //Move mode
else {
- if (chara.cannotMove()) return;
+ if (chara.cannotMove())
+ return;
//Only attackable units can stop attack
- if (chara.attack) chara.stopAttack();
+ if (chara.attack)
+ chara.stopAttack();
//Lock destination by default
- chara.targetLock=!unlock;
- chara.moveTo(pos.x,pos.y);
+ chara.targetLock = !unlock;
+ chara.moveTo(pos.x, pos.y);
//Record destination
- if (btn=='attack') {
- chara.destination={x:pos.x,y:pos.y};
+ if (btn == 'attack') {
+ chara.destination = { x: pos.x, y: pos.y };
}
- if (btn=='patrol') {
+ if (btn == 'patrol') {
//Patrol dead lock
- chara.destination={x:pos.x,y:pos.y};
- chara.destination.next={x:chara.posX(),y:chara.posY(),next:chara.destination};
+ chara.destination = { x: pos.x, y: pos.y };
+ chara.destination.next = { x: chara.posX(), y: chara.posY(), next: chara.destination };
}
}
});
},
- dblClick:function(){
+ dblClick: function () {
//Multi select same type units
if (!(Game.selectedUnit.isEnemy && Game.selectedUnit.isEnemy())) {
- var charas=Unit.allUnits.filter(function(chara){
- return !(chara.isEnemy()) && chara.insideScreen() && (chara.name==Game.selectedUnit.name);
+ var charas = Unit.allUnits.filter(function (chara) {
+ return !(chara.isEnemy()) && chara.insideScreen() && (chara.name == Game.selectedUnit.name);
});
Game.addIntoAllSelected(charas);
}
},
//Can control all units
- toControlAll:function(){
+ toControlAll: function () {
//For desktop
- if (!Game.isApp){
+ if (!Game.isApp) {
//Mouse left click
- $('#fogCanvas')[0].onclick=function(event){
+ $('#fogCanvas')[0].onclick = function (event) {
event.preventDefault();
if (mouseController.drag) {
//End drag, onclick triggered after onmouseup, don't do default left click action
- mouseController.drag=false;
+ mouseController.drag = false;
}
else {
mouseController.leftClick(event);
}
};
//Mouse right click
- $('#fogCanvas')[0].oncontextmenu=function(event){
+ $('#fogCanvas')[0].oncontextmenu = function (event) {
//Prevent context menu show
event.preventDefault();
//Should not control units during replay
- if (Game.replayFlag) return;
+ if (Game.replayFlag)
+ return;
mouseController.rightClick(event);
//Cancel pointer
$('div.GameLayer').removeAttr('status');
//Cancel callback
- Button.callback=null;
+ Button.callback = null;
};
//Double click
- $('#fogCanvas')[0].ondblclick=function(event){
+ $('#fogCanvas')[0].ondblclick = function (event) {
//Prevent screen select
event.preventDefault();
mouseController.dblClick();
};
//Mouse click start
- $('#fogCanvas')[0].onmousedown=function(event){
+ $('#fogCanvas')[0].onmousedown = function (event) {
event.preventDefault();
//Do not allow rectangular-multi-select with right click, only left clicks
- if (event.which === 3){
+ if (event.which === 3) {
return;
}
if (!mouseController.down) {
//Mouse at (clickX,clickY)
- var clickX=event.pageX-$('#fogCanvas').offset().left;
- var clickY=event.pageY-$('#fogCanvas').offset().top;
- mouseController.startPoint={x:clickX,y:clickY};
- mouseController.down=true;
+ var clickX = event.pageX - $('#fogCanvas').offset().left;
+ var clickY = event.pageY - $('#fogCanvas').offset().top;
+ mouseController.startPoint = { x: clickX, y: clickY };
+ mouseController.down = true;
}
};
//Mouse drag
- $('#fogCanvas')[0].onmousemove=function(event){
+ $('#fogCanvas')[0].onmousemove = function (event) {
event.preventDefault();
if (mouseController.down) {
//Mouse at (clickX,clickY)
- var clickX=event.pageX-$('#fogCanvas').offset().left;
- var clickY=event.pageY-$('#fogCanvas').offset().top;
- mouseController.endPoint={x:clickX,y:clickY};
- if (Math.abs(clickX-mouseController.startPoint.x)>5 &&
- Math.abs(clickY-mouseController.startPoint.y)>5) {
- mouseController.drag=true;
+ var clickX = event.pageX - $('#fogCanvas').offset().left;
+ var clickY = event.pageY - $('#fogCanvas').offset().top;
+ mouseController.endPoint = { x: clickX, y: clickY };
+ if (Math.abs(clickX - mouseController.startPoint.x) > 5 &&
+ Math.abs(clickY - mouseController.startPoint.y) > 5) {
+ mouseController.drag = true;
}
}
};
//Global client refresh map
- window.onmousemove=function(event){
+ window.onmousemove = function (event) {
event.preventDefault();
//Mouse at (clickX,clickY)
- mouseController.mouseX=event.clientX;
- mouseController.mouseY=event.clientY;
+ mouseController.mouseX = event.clientX;
+ mouseController.mouseY = event.clientY;
};
//Mouse click end
- $('#fogCanvas')[0].onmouseup=function(event){
+ $('#fogCanvas')[0].onmouseup = function (event) {
event.preventDefault();
- mouseController.down=false;
+ mouseController.down = false;
if (mouseController.drag) {
//Multi select inside rect
Game.multiSelectInRect();
}
};
}
- //For mobile
else {
- $('#fogCanvas')[0].ontouchstart=function(event){
+ $('#fogCanvas')[0].ontouchstart = function (event) {
event.preventDefault();
//Drag rectangle
- if (event.touches.length==2){
- var offsetX=$('#fogCanvas').offset().left;
- var offsetY=$('#fogCanvas').offset().top;
- mouseController.drag=true;
- mouseController.startPoint={x:event.touches[0].pageX-offsetX,y:event.touches[0].pageY-offsetY};
- mouseController.endPoint={x:event.touches[1].pageX-offsetX,y:event.touches[1].pageY-offsetY};
+ if (event.touches.length == 2) {
+ var offsetX = $('#fogCanvas').offset().left;
+ var offsetY = $('#fogCanvas').offset().top;
+ mouseController.drag = true;
+ mouseController.startPoint = { x: event.touches[0].pageX - offsetX, y: event.touches[0].pageY - offsetY };
+ mouseController.endPoint = { x: event.touches[1].pageX - offsetX, y: event.touches[1].pageY - offsetY };
}
};
- $('#fogCanvas')[0].ontouchend=function(event){
+ $('#fogCanvas')[0].ontouchend = function (event) {
event.preventDefault();
if (mouseController.drag) {
//Multi select inside rect
Game.multiSelectInRect();
//End drag
- mouseController.drag=false;
+ mouseController.drag = false;
}
};
- mouseController.mobileScreen=new Hammer(window);
- mouseController.canvasScreen=new Hammer($('#fogCanvas')[0]);
- mouseController.canvasScreen.on('tap',function(event){
+ mouseController.mobileScreen = new Hammer(window);
+ mouseController.canvasScreen = new Hammer($('#fogCanvas')[0]);
+ mouseController.canvasScreen.on('tap', function (event) {
event.preventDefault();
//Callback
mouseController.leftClick(event.pointers[0]);
});
- mouseController.canvasScreen.on('doubletap',function(event){
+ mouseController.canvasScreen.on('doubletap', function (event) {
event.preventDefault();
mouseController.dblClick();
});
- mouseController.canvasScreen.on('press',function(event){
+ mouseController.canvasScreen.on('press', function (event) {
//Prevent context menu show
event.preventDefault();
//Should not control units during replay
- if (Game.replayFlag) return;
+ if (Game.replayFlag)
+ return;
mouseController.rightClick(event.changedPointers[0]);
//Cancel handler
$('div.GameLayer').removeAttr('status');
- Button.callback=null;
+ Button.callback = null;
});
- mouseController.canvasScreen.on('panleft',function(event){
- Map.needRefresh="RIGHT";
+ mouseController.canvasScreen.on('panleft', function (event) {
+ Map.needRefresh = "RIGHT";
});
- mouseController.canvasScreen.on('panright',function(event){
- Map.needRefresh="LEFT";
+ mouseController.canvasScreen.on('panright', function (event) {
+ Map.needRefresh = "LEFT";
});
- mouseController.mobileScreen.on('panup',function(event){
- Map.needRefresh="BOTTOM";
+ mouseController.mobileScreen.on('panup', function (event) {
+ Map.needRefresh = "BOTTOM";
});
- mouseController.mobileScreen.on('pandown',function(event){
- Map.needRefresh="TOP";
+ mouseController.mobileScreen.on('pandown', function (event) {
+ Map.needRefresh = "TOP";
});
}
//Both sides
- $('div#GamePlay div').on('contextmenu',function(event){
+ $('div#GamePlay div').on('contextmenu', function (event) {
event.preventDefault();
});
- $('canvas[name="mini_map"]').on('click',function(event){
+ $('canvas[name="mini_map"]').on('click', function (event) {
event.preventDefault();
Map.clickHandler(event);
});
- $('canvas[name="mini_map"]').on('contextmenu',function(event){
+ $('canvas[name="mini_map"]').on('contextmenu', function (event) {
event.preventDefault();
Map.dblClickHandler(event);
});
}
};
+//# sourceMappingURL=mouseController.js.map
\ No newline at end of file
diff --git a/Controller/mouseController.ts b/Controller/mouseController.ts
new file mode 100644
index 0000000..b16fe6c
--- /dev/null
+++ b/Controller/mouseController.ts
@@ -0,0 +1,291 @@
+var mouseController={
+ down:false,
+ drag:false,
+ startPoint:{x:0,y:0},
+ endPoint:{x:0,y:0},
+ isMultiSelect:function(){
+ return keyController.shift;
+ },
+ isJoinTeam:function(){
+ return keyController.ctrl;
+ },
+ leftClick:function(event){
+ //Mouse at (clickX,clickY)
+ var offset=$('#fogCanvas').offset();
+ var clickX=event.pageX-offset.left;
+ var clickY=event.pageY-offset.top;
+ //Intercept event inside infoBox
+ if (clickY>Game.infoBox.y) return;
+ //Selection mode
+ if (Button.callback==null) {
+ //Find selected one, convert position
+ var selectedOne=Game.getSelectedOne(clickX+Map.offsetX,clickY+Map.offsetY);
+ //Cannot select enemy invisible unit
+ if ((selectedOne instanceof Gobj) && selectedOne['isInvisible'+Game.team] && selectedOne.isEnemy()) return;
+ //Single select will unselect all units and only choose selected one
+ //Multi select will keep selected status and do nothing
+ if (!mouseController.isMultiSelect())
+ Game.unselectAll();
+ //If has selected one
+ if (selectedOne instanceof Gobj) {
+ //Sound effect
+ if (!(selectedOne.isEnemy())) selectedOne.sound.selected.play();
+ //Cannot multiSelect with enemy
+ if (selectedOne.isEnemy() || (Game.selectedUnit.isEnemy && Game.selectedUnit.isEnemy()))
+ Game.unselectAll();
+ //Only selected one to show portrait
+ Game.changeSelectedTo(selectedOne);
+ //Add into allSelected if not included
+ Game.addIntoAllSelected(selectedOne);
+ }
+ else {
+ //Click null
+ Game.changeSelectedTo({});
+ Game.unselectAll();
+ }
+ }
+ //Button mode
+ else {
+ //Callback
+ Button.execute(event);
+ }
+ //Hide tooltip when click
+ $('div.tooltip_Box').hide();
+ //Login user statistic
+ if (Multiplayer.statistic!=null) Multiplayer.statistic.left++;
+ },
+ rightClick:function(event,unlock,btn){
+ //Mouse at (clickX,clickY)
+ var offset=$('#fogCanvas').offset();
+ var clickX=event.pageX-offset.left;
+ var clickY=event.pageY-offset.top;
+ //Intercept event inside infoBox
+ if (clickY>Game.infoBox.y) return;
+ //Show right click cursor
+ var pos={x:(clickX+Map.offsetX),y:(clickY+Map.offsetY)};
+ new Burst.RightClickCursor(pos);
+ var charas=Game.allSelected.filter(function(chara){
+ //Can only control our alive unit
+ return chara.team==Game.team && chara.status!="dead";
+ });
+ //Handle user right click
+ Multiplayer.cmds.push(JSON.stringify({
+ uids:Multiplayer.getUIDs(charas),
+ type:'rightClick',
+ pos:pos,
+ unlock:Boolean(unlock),
+ btn:btn
+ }));
+ //Login user statistic
+ if (Multiplayer.statistic!=null) Multiplayer.statistic.right++;
+ },
+ rightClickHandler:function(charas,pos,unlock,btn){
+ //Find selected one or nothing
+ var selectedEnemy=(charas.length>0)?Game.getSelectedOne(pos.x,pos.y,charas[0].team.toString()):null;
+ charas.forEach(function(chara){
+ //Sound effect
+ if (!chara.isEnemy() && chara.sound.moving) chara.sound.moving.play();
+ //Interrupt old destination routing
+ if (chara.destination) {
+ //Break possible dead lock
+ if (chara.destination.next) chara.destination.next=null;
+ delete chara.destination;
+ }
+ //Cancel possible hold
+ if (chara.hold) {
+ delete chara.AI;
+ delete chara.findNearbyTargets;
+ delete chara.hold;
+ Button.refreshButtons();
+ }
+ //Unit cannot attack will always choose move mode
+ var attackOrMove=(chara.attack)?(selectedEnemy instanceof Gobj):false;
+ //Attack mode
+ if (attackOrMove) {
+ if (chara.cannotMove() && !(chara.isInAttackRange(selectedEnemy))) return;
+ //Intercept invisible enemy
+ if (selectedEnemy['isInvisible'+Game.team]) {
+ if (!chara.isEnemy()) Referee.voice('pError').play();
+ return;
+ }
+ chara.targetLock=true;
+ chara.attack(selectedEnemy);
+ }
+ //Move mode
+ else {
+ if (chara.cannotMove()) return;
+ //Only attackable units can stop attack
+ if (chara.attack) chara.stopAttack();
+ //Lock destination by default
+ chara.targetLock=!unlock;
+ chara.moveTo(pos.x,pos.y);
+ //Record destination
+ if (btn=='attack') {
+ chara.destination={x:pos.x,y:pos.y};
+ }
+ if (btn=='patrol') {
+ //Patrol dead lock
+ chara.destination={x:pos.x,y:pos.y};
+ chara.destination.next={x:chara.posX(),y:chara.posY(),next:chara.destination};
+ }
+ }
+ });
+ },
+ dblClick:function(){
+ //Multi select same type units
+ if (!(Game.selectedUnit.isEnemy && Game.selectedUnit.isEnemy())) {
+ var charas=Unit.allUnits.filter(function(chara){
+ return !(chara.isEnemy()) && chara.insideScreen() && (chara.name==Game.selectedUnit.name);
+ });
+ Game.addIntoAllSelected(charas);
+ }
+ },
+ //Can control all units
+ toControlAll:function(){
+ //For desktop
+ if (!Game.isApp){
+ //Mouse left click
+ $('#fogCanvas')[0].onclick=function(event){
+ event.preventDefault();
+ if (mouseController.drag) {
+ //End drag, onclick triggered after onmouseup, don't do default left click action
+ mouseController.drag=false;
+ }
+ else {
+ mouseController.leftClick(event);
+ }
+ };
+ //Mouse right click
+ $('#fogCanvas')[0].oncontextmenu=function(event){
+ //Prevent context menu show
+ event.preventDefault();
+ //Should not control units during replay
+ if (Game.replayFlag) return;
+ mouseController.rightClick(event);
+ //Cancel pointer
+ $('div.GameLayer').removeAttr('status');
+ //Cancel callback
+ Button.callback=null;
+ };
+ //Double click
+ $('#fogCanvas')[0].ondblclick=function(event){
+ //Prevent screen select
+ event.preventDefault();
+ mouseController.dblClick();
+ };
+ //Mouse click start
+ $('#fogCanvas')[0].onmousedown=function(event){
+ event.preventDefault();
+ //Do not allow rectangular-multi-select with right click, only left clicks
+ if (event.which === 3){
+ return;
+ }
+ if (!mouseController.down) {
+ //Mouse at (clickX,clickY)
+ var clickX=event.pageX-$('#fogCanvas').offset().left;
+ var clickY=event.pageY-$('#fogCanvas').offset().top;
+ mouseController.startPoint={x:clickX,y:clickY};
+ mouseController.down=true;
+ }
+ };
+ //Mouse drag
+ $('#fogCanvas')[0].onmousemove=function(event){
+ event.preventDefault();
+ if (mouseController.down) {
+ //Mouse at (clickX,clickY)
+ var clickX=event.pageX-$('#fogCanvas').offset().left;
+ var clickY=event.pageY-$('#fogCanvas').offset().top;
+ mouseController.endPoint={x:clickX,y:clickY};
+ if (Math.abs(clickX-mouseController.startPoint.x)>5 &&
+ Math.abs(clickY-mouseController.startPoint.y)>5) {
+ mouseController.drag=true;
+ }
+ }
+ };
+ //Global client refresh map
+ window.onmousemove=function(event){
+ event.preventDefault();
+ //Mouse at (clickX,clickY)
+ mouseController.mouseX=event.clientX;
+ mouseController.mouseY=event.clientY;
+ };
+ //Mouse click end
+ $('#fogCanvas')[0].onmouseup=function(event){
+ event.preventDefault();
+ mouseController.down=false;
+ if (mouseController.drag) {
+ //Multi select inside rect
+ Game.multiSelectInRect();
+ }
+ };
+ }
+ //For mobile
+ else {
+ $('#fogCanvas')[0].ontouchstart=function(event){
+ event.preventDefault();
+ //Drag rectangle
+ if (event.touches.length==2){
+ var offsetX=$('#fogCanvas').offset().left;
+ var offsetY=$('#fogCanvas').offset().top;
+ mouseController.drag=true;
+ mouseController.startPoint={x:event.touches[0].pageX-offsetX,y:event.touches[0].pageY-offsetY};
+ mouseController.endPoint={x:event.touches[1].pageX-offsetX,y:event.touches[1].pageY-offsetY};
+ }
+ };
+ $('#fogCanvas')[0].ontouchend=function(event){
+ event.preventDefault();
+ if (mouseController.drag) {
+ //Multi select inside rect
+ Game.multiSelectInRect();
+ //End drag
+ mouseController.drag=false;
+ }
+ };
+ mouseController.mobileScreen=new Hammer(window);
+ mouseController.canvasScreen=new Hammer($('#fogCanvas')[0]);
+ mouseController.canvasScreen.on('tap',function(event){
+ event.preventDefault();
+ //Callback
+ mouseController.leftClick(event.pointers[0]);
+ });
+ mouseController.canvasScreen.on('doubletap',function(event){
+ event.preventDefault();
+ mouseController.dblClick();
+ });
+ mouseController.canvasScreen.on('press',function(event){
+ //Prevent context menu show
+ event.preventDefault();
+ //Should not control units during replay
+ if (Game.replayFlag) return;
+ mouseController.rightClick(event.changedPointers[0]);
+ //Cancel handler
+ $('div.GameLayer').removeAttr('status');
+ Button.callback=null;
+ });
+ mouseController.canvasScreen.on('panleft',function(event){
+ Map.needRefresh="RIGHT";
+ });
+ mouseController.canvasScreen.on('panright',function(event){
+ Map.needRefresh="LEFT";
+ });
+ mouseController.mobileScreen.on('panup',function(event){
+ Map.needRefresh="BOTTOM";
+ });
+ mouseController.mobileScreen.on('pandown',function(event){
+ Map.needRefresh="TOP";
+ });
+ }
+ //Both sides
+ $('div#GamePlay div').on('contextmenu',function(event){
+ event.preventDefault();
+ });
+ $('canvas[name="mini_map"]').on('click',function(event){
+ event.preventDefault();
+ Map.clickHandler(event);
+ });
+ $('canvas[name="mini_map"]').on('contextmenu',function(event){
+ event.preventDefault();
+ Map.dblClickHandler(event);
+ });
+ }
+};
diff --git a/GameRule/Cheat.js b/GameRule/Cheat.js
index 130a7c0..74be824 100644
--- a/GameRule/Cheat.js
+++ b/GameRule/Cheat.js
@@ -1,21 +1,21 @@
-var Cheat={
- isShown:false,
- cwal:false,
- gathering:false,
- manUnlimited:false,
- handler:function(){
- if (Cheat.isShown){
- if (Multiplayer.ON){
+var Cheat = {
+ isShown: false,
+ cwal: false,
+ gathering: false,
+ manUnlimited: false,
+ handler: function () {
+ if (Cheat.isShown) {
+ if (Multiplayer.ON) {
Multiplayer.webSocket.send(JSON.stringify({
- type:'chat',
- from:Game.team,
- msg:$('input#cheatInput').val()
+ type: 'chat',
+ from: Game.team,
+ msg: $('input#cheatInput').val()
}));
}
else {
//Forbid cheating during replay
- if (!Game.replayFlag){
- var cheatFlag=Cheat.execute($('input#cheatInput').val().toLowerCase());
+ if (!Game.replayFlag) {
+ var cheatFlag = Cheat.execute($('input#cheatInput').val().toLowerCase());
if (cheatFlag) {
//Refresh control panel
Game.changeSelectedTo(Game.selectedUnit);
@@ -25,87 +25,94 @@ var Cheat={
}
$('#cheat_Box').hide();
$('input#cheatInput').val('');
- Cheat.isShown=false;
- keyController.disable=false;
+ Cheat.isShown = false;
+ keyController.disable = false;
}
else {
$('#cheat_Box').show();
$('input#cheatInput').focus();
- Cheat.isShown=true;
- keyController.disable=true;
+ Cheat.isShown = true;
+ keyController.disable = true;
}
},
- execute:function(cheatCode){
+ execute: function (cheatCode) {
//Forbid cheating when multiplayer mode
- if (Multiplayer.ON) return;
- var cheatFlag=true;
- switch (cheatCode){
+ if (Multiplayer.ON)
+ return;
+ var cheatFlag = true;
+ switch (cheatCode) {
case "show me the money":
- Resource[Game.team].mine+=10000;
- Resource[Game.team].gas+=10000;
+ Resource[Game.team].mine += 10000;
+ Resource[Game.team].gas += 10000;
break;
case "black sheep wall":
//Switch between show fog or not show
- Map.fogFlag=!Map.fogFlag;
- if (Map.fogFlag==false){
+ Map.fogFlag = !Map.fogFlag;
+ if (Map.fogFlag == false) {
//Clear old fog on screen
- Game.fogCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
+ Game.fogCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
//Redraw mini-map
Map.drawFogAndMinimap();
}
break;
case "something for nothing":
//Upgrade all grades
- for (var grade in Upgrade){
+ for (var grade in Upgrade) {
Upgrade[grade].effect(Game.team);
}
break;
case "full recovery":
- Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function(chara){
- chara.life=chara.get('HP');
- if (chara.SP) chara.shield=chara.get('SP');
- if (chara.MP) chara.magic=chara.get('MP');
+ Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function (chara) {
+ chara.life = chara.get('HP');
+ if (chara.SP)
+ chara.shield = chara.get('SP');
+ if (chara.MP)
+ chara.magic = chara.get('MP');
});
break;
case "staying alive":
- Referee.winCondition=Referee.loseCondition=function(){
+ Referee.winCondition = Referee.loseCondition = function () {
return false;
};
break;
case "operation cwal":
- Cheat.cwal=!(Cheat.cwal);
+ Cheat.cwal = !(Cheat.cwal);
break;
case "the gathering":
- Cheat.gathering=!(Cheat.gathering);
+ Cheat.gathering = !(Cheat.gathering);
break;
case "food for thought":
- Cheat.manUnlimited=!(Cheat.manUnlimited);
+ Cheat.manUnlimited = !(Cheat.manUnlimited);
break;
case "power overwhelming":
- if (Cheat.oldCalculateDamageBy){
- var tempCalculateDamageBy= $.extend([],Cheat.oldCalculateDamageBy);
- Cheat.oldCalculateDamageBy=[Unit.prototype.calculateDamageBy,Building.prototype.calculateDamageBy];
- Unit.prototype.calculateDamageBy=tempCalculateDamageBy[0];
- Building.prototype.calculateDamageBy=tempCalculateDamageBy[1];
+ if (Cheat.oldCalculateDamageBy) {
+ var tempCalculateDamageBy = $.extend([], Cheat.oldCalculateDamageBy);
+ Cheat.oldCalculateDamageBy = [Unit.prototype.calculateDamageBy, Building.prototype.calculateDamageBy];
+ Unit.prototype.calculateDamageBy = tempCalculateDamageBy[0];
+ Building.prototype.calculateDamageBy = tempCalculateDamageBy[1];
}
else {
- Cheat.oldCalculateDamageBy=[Unit.prototype.calculateDamageBy,Building.prototype.calculateDamageBy];
- Unit.prototype.calculateDamageBy=function(enemyObj){
- if (enemyObj.isEnemy && enemyObj.isEnemy()) return 0;
- else return Cheat.oldCalculateDamageBy[0].call(this,enemyObj);
+ Cheat.oldCalculateDamageBy = [Unit.prototype.calculateDamageBy, Building.prototype.calculateDamageBy];
+ Unit.prototype.calculateDamageBy = function (enemyObj) {
+ if (enemyObj.isEnemy && enemyObj.isEnemy())
+ return 0;
+ else
+ return Cheat.oldCalculateDamageBy[0].call(this, enemyObj);
};
- Building.prototype.calculateDamageBy=function(enemyObj){
- if (enemyObj.isEnemy && enemyObj.isEnemy()) return 0;
- else return Cheat.oldCalculateDamageBy[1].call(this,enemyObj);
+ Building.prototype.calculateDamageBy = function (enemyObj) {
+ if (enemyObj.isEnemy && enemyObj.isEnemy())
+ return 0;
+ else
+ return Cheat.oldCalculateDamageBy[1].call(this, enemyObj);
};
}
break;
case "big daddy":
- var daddy=new Hero.HeroCruiser({x:Map.offsetX+Game.HBOUND/2,y:Map.offsetY+Game.VBOUND/2});
+ var daddy = new Hero.HeroCruiser({ x: Map.offsetX + Game.HBOUND / 2, y: Map.offsetY + Game.VBOUND / 2 });
Game.changeSelectedTo(daddy);
break;
case "big mommy":
- var mommy=new Hero.Sarah({x:Map.offsetX+Game.HBOUND/2,y:Map.offsetY+Game.VBOUND/2});
+ var mommy = new Hero.Sarah({ x: Map.offsetX + Game.HBOUND / 2, y: Map.offsetY + Game.VBOUND / 2 });
Game.changeSelectedTo(mommy);
break;
case "game over man":
@@ -117,29 +124,30 @@ var Cheat={
Game.win();
break;
case "fuck your mother":
- Unit.allEnemyUnits().concat(Building.enemyBuildings()).forEach(function(chara){
+ Unit.allEnemyUnits().concat(Building.enemyBuildings()).forEach(function (chara) {
chara.die();
});
break;
case "fuck my asshole":
- Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function(chara){
+ Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function (chara) {
chara.die();
});
break;
case "liuda is god":
Cheat.execute('black sheep wall');
- Referee.winCondition=Referee.loseCondition=function(){
+ Referee.winCondition = Referee.loseCondition = function () {
return false;
};
- Unit.allUnits.concat(Building.allBuildings).forEach(function(chara){
+ Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
chara.die();
});
break;
default:
//Not match any of above cheating code
- cheatFlag=false;
+ cheatFlag = false;
break;
}
return cheatFlag;
}
};
+//# sourceMappingURL=Cheat.js.map
\ No newline at end of file
diff --git a/GameRule/Cheat.ts b/GameRule/Cheat.ts
new file mode 100644
index 0000000..130a7c0
--- /dev/null
+++ b/GameRule/Cheat.ts
@@ -0,0 +1,145 @@
+var Cheat={
+ isShown:false,
+ cwal:false,
+ gathering:false,
+ manUnlimited:false,
+ handler:function(){
+ if (Cheat.isShown){
+ if (Multiplayer.ON){
+ Multiplayer.webSocket.send(JSON.stringify({
+ type:'chat',
+ from:Game.team,
+ msg:$('input#cheatInput').val()
+ }));
+ }
+ else {
+ //Forbid cheating during replay
+ if (!Game.replayFlag){
+ var cheatFlag=Cheat.execute($('input#cheatInput').val().toLowerCase());
+ if (cheatFlag) {
+ //Refresh control panel
+ Game.changeSelectedTo(Game.selectedUnit);
+ Game.showMessage('Cheat enabled');
+ }
+ }
+ }
+ $('#cheat_Box').hide();
+ $('input#cheatInput').val('');
+ Cheat.isShown=false;
+ keyController.disable=false;
+ }
+ else {
+ $('#cheat_Box').show();
+ $('input#cheatInput').focus();
+ Cheat.isShown=true;
+ keyController.disable=true;
+ }
+ },
+ execute:function(cheatCode){
+ //Forbid cheating when multiplayer mode
+ if (Multiplayer.ON) return;
+ var cheatFlag=true;
+ switch (cheatCode){
+ case "show me the money":
+ Resource[Game.team].mine+=10000;
+ Resource[Game.team].gas+=10000;
+ break;
+ case "black sheep wall":
+ //Switch between show fog or not show
+ Map.fogFlag=!Map.fogFlag;
+ if (Map.fogFlag==false){
+ //Clear old fog on screen
+ Game.fogCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
+ //Redraw mini-map
+ Map.drawFogAndMinimap();
+ }
+ break;
+ case "something for nothing":
+ //Upgrade all grades
+ for (var grade in Upgrade){
+ Upgrade[grade].effect(Game.team);
+ }
+ break;
+ case "full recovery":
+ Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function(chara){
+ chara.life=chara.get('HP');
+ if (chara.SP) chara.shield=chara.get('SP');
+ if (chara.MP) chara.magic=chara.get('MP');
+ });
+ break;
+ case "staying alive":
+ Referee.winCondition=Referee.loseCondition=function(){
+ return false;
+ };
+ break;
+ case "operation cwal":
+ Cheat.cwal=!(Cheat.cwal);
+ break;
+ case "the gathering":
+ Cheat.gathering=!(Cheat.gathering);
+ break;
+ case "food for thought":
+ Cheat.manUnlimited=!(Cheat.manUnlimited);
+ break;
+ case "power overwhelming":
+ if (Cheat.oldCalculateDamageBy){
+ var tempCalculateDamageBy= $.extend([],Cheat.oldCalculateDamageBy);
+ Cheat.oldCalculateDamageBy=[Unit.prototype.calculateDamageBy,Building.prototype.calculateDamageBy];
+ Unit.prototype.calculateDamageBy=tempCalculateDamageBy[0];
+ Building.prototype.calculateDamageBy=tempCalculateDamageBy[1];
+ }
+ else {
+ Cheat.oldCalculateDamageBy=[Unit.prototype.calculateDamageBy,Building.prototype.calculateDamageBy];
+ Unit.prototype.calculateDamageBy=function(enemyObj){
+ if (enemyObj.isEnemy && enemyObj.isEnemy()) return 0;
+ else return Cheat.oldCalculateDamageBy[0].call(this,enemyObj);
+ };
+ Building.prototype.calculateDamageBy=function(enemyObj){
+ if (enemyObj.isEnemy && enemyObj.isEnemy()) return 0;
+ else return Cheat.oldCalculateDamageBy[1].call(this,enemyObj);
+ };
+ }
+ break;
+ case "big daddy":
+ var daddy=new Hero.HeroCruiser({x:Map.offsetX+Game.HBOUND/2,y:Map.offsetY+Game.VBOUND/2});
+ Game.changeSelectedTo(daddy);
+ break;
+ case "big mommy":
+ var mommy=new Hero.Sarah({x:Map.offsetX+Game.HBOUND/2,y:Map.offsetY+Game.VBOUND/2});
+ Game.changeSelectedTo(mommy);
+ break;
+ case "game over man":
+ case "gg":
+ Game.lose();
+ break;
+ case "there is no cow level":
+ case "your gg":
+ Game.win();
+ break;
+ case "fuck your mother":
+ Unit.allEnemyUnits().concat(Building.enemyBuildings()).forEach(function(chara){
+ chara.die();
+ });
+ break;
+ case "fuck my asshole":
+ Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function(chara){
+ chara.die();
+ });
+ break;
+ case "liuda is god":
+ Cheat.execute('black sheep wall');
+ Referee.winCondition=Referee.loseCondition=function(){
+ return false;
+ };
+ Unit.allUnits.concat(Building.allBuildings).forEach(function(chara){
+ chara.die();
+ });
+ break;
+ default:
+ //Not match any of above cheating code
+ cheatFlag=false;
+ break;
+ }
+ return cheatFlag;
+ }
+};
diff --git a/GameRule/Game.js b/GameRule/Game.js
index ff71f37..64dd4a5 100644
--- a/GameRule/Game.js
+++ b/GameRule/Game.js
@@ -1,1191 +1,1271 @@
-var Game={
- //Global variables
- HBOUND:innerWidth,//$('body')[0].scrollWidth
- VBOUND:innerHeight,//$('body')[0].scrollHeight
- infoBox:{
- x:145,
- y:innerHeight-110,
- width:innerWidth-295,
- height:110
- },
- team:0,
- playerNum:2,//By default
- teams:{},
- multiplayer:false,//By default
- cxt:$('#middleCanvas')[0].getContext('2d'),
- frontCxt:$('#frontCanvas')[0].getContext('2d'),
- backCxt:$('#backCanvas')[0].getContext('2d'),
- fogCxt:$('#fogCanvas')[0].getContext('2d'),
- _timer:-1,
- _frameInterval:100,
- mainTick:0,
- serverTick:0,
- commands:{},
- replay:{},
- randomSeed:0,//For later use
- selectedUnit:{},
- allSelected:[],
- _oldAllSelected:[],
- hackMode:false,
- isApp:false,
- offline:false,
- CDN:'',
- addIntoAllSelected:function(chara,override){
- if (chara instanceof Gobj){
- //Add into allSelected if not included
- if (Game.allSelected.indexOf(chara)==-1) {
- if (override) Game.allSelected=chara;
- else Game.allSelected.push(chara);
- chara.selected=true;
- }
+var Game = (function () {
+ function Game() {
+ this.infoBox = -110;
+ this.width = -295;
+ }
+ return Game;
+}());
+team: 0,
+ playerNum;
+2,
+ teams;
+{ }
+multiplayer: false,
+ cxt;
+$('#middleCanvas')[0].getContext('2d'),
+ frontCxt;
+$('#frontCanvas')[0].getContext('2d'),
+ backCxt;
+$('#backCanvas')[0].getContext('2d'),
+ fogCxt;
+$('#fogCanvas')[0].getContext('2d'),
+ _timer;
+-1,
+ _frameInterval;
+100,
+ mainTick;
+0,
+ serverTick;
+0,
+ commands;
+{ }
+replay: { }
+randomSeed: 0,
+ selectedUnit;
+{ }
+allSelected: [],
+ _oldAllSelected;
+[],
+ hackMode;
+false,
+ isApp;
+false,
+ offline;
+false,
+ CDN;
+'',
+ addIntoAllSelected;
+function (chara, override) {
+ if (chara instanceof Gobj) {
+ //Add into allSelected if not included
+ if (Game.allSelected.indexOf(chara) == -1) {
+ if (override)
+ Game.allSelected = chara;
+ else
+ Game.allSelected.push(chara);
+ chara.selected = true;
}
- //Override directly
- if (chara instanceof Array) {
- if (override) Game.allSelected=chara;
- else chara.forEach(function(char){
+ }
+ //Override directly
+ if (chara instanceof Array) {
+ if (override)
+ Game.allSelected = chara;
+ else
+ chara.forEach(function (char) {
//Add into allSelected if not included
- if (Game.allSelected.indexOf(char)==-1) Game.allSelected.push(char);
- });
- chara.forEach(function(char){
- char.selected=true;
+ if (Game.allSelected.indexOf(char) == -1)
+ Game.allSelected.push(char);
});
- }
- //Sort allSelected by its name order
- Game.allSelected.sort(function(chara1,chara2){
- //Need sort building icon together
- var name1=(chara1 instanceof Building)?(chara1.inherited.name+'.'+chara1.name):chara1.name;
- var name2=(chara2 instanceof Building)?(chara2.inherited.name+'.'+chara2.name):chara2.name;
- return ([name1,name2].sort()[0]!=name1)?1:-1;
+ chara.forEach(function (char) {
+ char.selected = true;
});
- //Notify referee to redraw
- Referee.alterSelectionMode();
- },
- //To replace setTimeout
- commandTimeout:function(func,delay){
- var dueTick=Game.mainTick+(delay/100>>0);
- if (!Game.commands[dueTick]) Game.commands[dueTick]=[];
- Game.commands[dueTick].push(func);
- },
- //To replace setInterval
- commandInterval:function(func,interval){
- var funcAdjust=function(){
- func();
- Game.commandTimeout(funcAdjust,interval);
- };
- Game.commandTimeout(funcAdjust,interval);
- },
- race:{
- selected:'Terran',//Terran race by default
- choose:function(race){
- this.selected=race;
- $('div#GamePlay').attr('race',race);
+ }
+ //Sort allSelected by its name order
+ Game.allSelected.sort(function (chara1, chara2) {
+ //Need sort building icon together
+ var name1 = (chara1 instanceof Building) ? (chara1.inherited.name + '.' + chara1.name) : chara1.name;
+ var name2 = (chara2 instanceof Building) ? (chara2.inherited.name + '.' + chara2.name) : chara2.name;
+ return ([name1, name2].sort()[0] != name1) ? 1 : -1;
+ });
+ //Notify referee to redraw
+ Referee.alterSelectionMode();
+}
+//To replace setTimeout
+commandTimeout: function (func, delay) {
+ var dueTick = Game.mainTick + (delay / 100 >> 0);
+ if (!Game.commands[dueTick])
+ Game.commands[dueTick] = [];
+ Game.commands[dueTick].push(func);
+}
+//To replace setInterval
+commandInterval: function (func, interval) {
+ var funcAdjust = function () {
+ func();
+ Game.commandTimeout(funcAdjust, interval);
+ };
+ Game.commandTimeout(funcAdjust, interval);
+}
+race: {
+ selected: 'Terran',
+ choose;
+ function (race) {
+ this.selected = race;
+ $('div#GamePlay').attr('race', race);
+ }
+}
+layerSwitchTo: function (layerName) {
+ $('div.GameLayer').hide();
+ $('#' + layerName).show(); //show('slow')
+}
+init: function () {
+ //Prevent full select
+ $('div.GameLayer').on("selectstart", function (event) {
+ event.preventDefault();
+ });
+ //Bind resize canvas handler
+ window.onresize = Game.resizeWindow;
+ /*window.requestAnimationFrame=requestAnimationFrame || webkitRequestAnimationFrame
+ || mozRequestAnimationFrame || msRequestAnimationFrame || oRequestAnimationFrame;//Old browser compatible*/
+ //Online mode
+ if (!Game.offline) {
+ Game.CDN = prompt('Please input CDN location for images and audios:');
+ if (Game.CDN) {
+ if (!Game.CDN.startsWith('http://'))
+ Game.CDN = 'http://' + Game.CDN;
+ if (!Game.CDN.endsWith('/'))
+ Game.CDN += '/';
}
- },
- layerSwitchTo:function(layerName){
- $('div.GameLayer').hide();
- $('#'+layerName).show(); //show('slow')
- },
- init:function(){
- //Prevent full select
- $('div.GameLayer').on("selectstart",function(event){
- event.preventDefault();
- });
- //Bind resize canvas handler
- window.onresize=Game.resizeWindow;
- /*window.requestAnimationFrame=requestAnimationFrame || webkitRequestAnimationFrame
- || mozRequestAnimationFrame || msRequestAnimationFrame || oRequestAnimationFrame;//Old browser compatible*/
- //Online mode
- if (!Game.offline){
- Game.CDN=prompt('Please input CDN location for images and audios:');
- if (Game.CDN){
- if (!Game.CDN.startsWith('http://')) Game.CDN='http://'+Game.CDN;
- if (!Game.CDN.endsWith('/')) Game.CDN+='/';
- }
+ }
+ //Start loading
+ Game.layerSwitchTo("GameLoading");
+ //Zerg
+ sourceLoader.load("img", Game.CDN + "img/Charas/Mutalisk.png", "Mutalisk");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Devourer.png", "Devourer");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Guardian.png", "Guardian");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Overlord.png", "Overlord");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Drone.png", "Drone");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Zergling.png", "Zergling");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Hydralisk.png", "Hydralisk");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Scourge.png", "Scourge");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Lurker.png", "Lurker");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Ultralisk.png", "Ultralisk");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Broodling.png", "Broodling");
+ sourceLoader.load("img", Game.CDN + "img/Charas/InfestedTerran.png", "InfestedTerran");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Queen.png", "Queen");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Defiler.png", "Defiler");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Larva.png", "Larva");
+ //Terran
+ sourceLoader.load("img", Game.CDN + "img/Charas/BattleCruiser.png", "BattleCruiser");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Wraith.png", "Wraith");
+ sourceLoader.load("img", Game.CDN + "img/Charas/SCV.png", "SCV");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Civilian.png", "Civilian");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Marine.png", "Marine");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Firebat.png", "Firebat");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Ghost.png", "Ghost");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Vulture.png", "Vulture");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Tank.png", "Tank");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Goliath.png", "Goliath");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Medic.png", "Medic");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Dropship.png", "Dropship");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Vessel.png", "Vessel");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Valkyrie.png", "Valkyrie");
+ //Protoss
+ sourceLoader.load("img", Game.CDN + "img/Charas/Probe.png", "Probe");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Zealot.png", "Zealot");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Dragoon.png", "Dragoon");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Templar.png", "Templar");
+ sourceLoader.load("img", Game.CDN + "img/Charas/DarkTemplar.png", "DarkTemplar");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Reaver.png", "Reaver");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Archon.png", "Archon");
+ sourceLoader.load("img", Game.CDN + "img/Charas/DarkArchon.png", "DarkArchon");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Shuttle.png", "Shuttle");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Observer.png", "Observer");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Arbiter.png", "Arbiter");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Scout.png", "Scout");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Carrier.png", "Carrier");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Corsair.png", "Corsair");
+ //Neuture
+ sourceLoader.load("img", Game.CDN + "img/Charas/Ragnasaur.png", "Ragnasaur");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Rhynsdon.png", "Rhynsdon");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Ursadon.png", "Ursadon");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Bengalaas.png", "Bengalaas");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Scantid.png", "Scantid");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Kakaru.png", "Kakaru");
+ //Hero
+ sourceLoader.load("img", Game.CDN + "img/Charas/HeroCruiser.png", "HeroCruiser");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Sarah.png", "Sarah");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Kerrigan.png", "Kerrigan");
+ sourceLoader.load("img", Game.CDN + "img/Charas/DevilHunter.png", "DevilHunter");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Tassadar.png", "Tassadar");
+ //Building
+ sourceLoader.load("img", Game.CDN + "img/Charas/ZergBuilding.png", "ZergBuilding");
+ sourceLoader.load("img", Game.CDN + "img/Charas/TerranBuilding.png", "TerranBuilding");
+ sourceLoader.load("img", Game.CDN + "img/Charas/ProtossBuilding.png", "ProtossBuilding");
+ /*sourceLoader.load("audio","bgm/PointError.wav","PointError");*/
+ //Map
+ sourceLoader.load("img", Game.CDN + "img/Maps/(2)Switchback.jpg", "Map_Switchback");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(2)Volcanis.jpg", "Map_Volcanis");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(3)Trench wars.jpg", "Map_TrenchWars");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(4)Blood Bath.jpg", "Map_BloodBath");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(4)Orbital Relay.jpg", "Map_OrbitalRelay");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(4)TowerDefense.jpg", "Map_TowerDefense");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(6)Thin Ice.jpg", "Map_ThinIce");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(8)BigGameHunters.jpg", "Map_BigGameHunters");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(8)TheHunters.jpg", "Map_TheHunters");
+ sourceLoader.load("img", Game.CDN + "img/Maps/(8)Turbo.jpg", "Map_Turbo");
+ sourceLoader.load("img", Game.CDN + "img/Maps/Map_Grass.jpg", "Map_Grass");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Mud.png", "Mud");
+ //Extra
+ sourceLoader.load("img", Game.CDN + "img/Charas/Burst.png", "Burst");
+ sourceLoader.load("img", Game.CDN + "img/Charas/BuildingBurst.png", "BuildingBurst");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Portrait.png", "Portrait");
+ sourceLoader.load("img", Game.CDN + "img/Charas/Magic.png", "Magic");
+ sourceLoader.load("img", Game.CDN + "img/Menu/ControlPanel.png", "ControlPanel");
+ sourceLoader.load("img", Game.CDN + "img/Bg/GameStart.jpg", "GameStart");
+ sourceLoader.load("img", Game.CDN + "img/Bg/GameWin.jpg", "GameWin");
+ sourceLoader.load("img", Game.CDN + "img/Bg/GameLose.jpg", "GameLose");
+ sourceLoader.allOnLoad(function () {
+ $('#GameStart').prepend(sourceLoader.sources['GameStart']);
+ $('#GameWin').prepend(sourceLoader.sources['GameWin']);
+ $('#GameLose').prepend(sourceLoader.sources['GameLose']);
+ $('#GamePlay>canvas').attr('width', Game.HBOUND); //Canvas width adjust
+ $('#GamePlay>canvas').attr('height', Game.VBOUND - Game.infoBox.height + 5); //Canvas height adjust
+ for (var N = 1; N <= 9; N++) {
+ $('div.panel_Control').append("");
}
- //Start loading
- Game.layerSwitchTo("GameLoading");
- //Zerg
- sourceLoader.load("img",Game.CDN+"img/Charas/Mutalisk.png","Mutalisk");
- sourceLoader.load("img",Game.CDN+"img/Charas/Devourer.png","Devourer");
- sourceLoader.load("img",Game.CDN+"img/Charas/Guardian.png","Guardian");
- sourceLoader.load("img",Game.CDN+"img/Charas/Overlord.png","Overlord");
- sourceLoader.load("img",Game.CDN+"img/Charas/Drone.png","Drone");
- sourceLoader.load("img",Game.CDN+"img/Charas/Zergling.png","Zergling");
- sourceLoader.load("img",Game.CDN+"img/Charas/Hydralisk.png","Hydralisk");
- sourceLoader.load("img",Game.CDN+"img/Charas/Scourge.png","Scourge");
- sourceLoader.load("img",Game.CDN+"img/Charas/Lurker.png","Lurker");
- sourceLoader.load("img",Game.CDN+"img/Charas/Ultralisk.png","Ultralisk");
- sourceLoader.load("img",Game.CDN+"img/Charas/Broodling.png","Broodling");
- sourceLoader.load("img",Game.CDN+"img/Charas/InfestedTerran.png","InfestedTerran");
- sourceLoader.load("img",Game.CDN+"img/Charas/Queen.png","Queen");
- sourceLoader.load("img",Game.CDN+"img/Charas/Defiler.png","Defiler");
- sourceLoader.load("img",Game.CDN+"img/Charas/Larva.png","Larva");
- //Terran
- sourceLoader.load("img",Game.CDN+"img/Charas/BattleCruiser.png","BattleCruiser");
- sourceLoader.load("img",Game.CDN+"img/Charas/Wraith.png","Wraith");
- sourceLoader.load("img",Game.CDN+"img/Charas/SCV.png","SCV");
- sourceLoader.load("img",Game.CDN+"img/Charas/Civilian.png","Civilian");
- sourceLoader.load("img",Game.CDN+"img/Charas/Marine.png","Marine");
- sourceLoader.load("img",Game.CDN+"img/Charas/Firebat.png","Firebat");
- sourceLoader.load("img",Game.CDN+"img/Charas/Ghost.png","Ghost");
- sourceLoader.load("img",Game.CDN+"img/Charas/Vulture.png","Vulture");
- sourceLoader.load("img",Game.CDN+"img/Charas/Tank.png","Tank");
- sourceLoader.load("img",Game.CDN+"img/Charas/Goliath.png","Goliath");
- sourceLoader.load("img",Game.CDN+"img/Charas/Medic.png","Medic");
- sourceLoader.load("img",Game.CDN+"img/Charas/Dropship.png","Dropship");
- sourceLoader.load("img",Game.CDN+"img/Charas/Vessel.png","Vessel");
- sourceLoader.load("img",Game.CDN+"img/Charas/Valkyrie.png","Valkyrie");
- //Protoss
- sourceLoader.load("img",Game.CDN+"img/Charas/Probe.png","Probe");
- sourceLoader.load("img",Game.CDN+"img/Charas/Zealot.png","Zealot");
- sourceLoader.load("img",Game.CDN+"img/Charas/Dragoon.png","Dragoon");
- sourceLoader.load("img",Game.CDN+"img/Charas/Templar.png","Templar");
- sourceLoader.load("img",Game.CDN+"img/Charas/DarkTemplar.png","DarkTemplar");
- sourceLoader.load("img",Game.CDN+"img/Charas/Reaver.png","Reaver");
- sourceLoader.load("img",Game.CDN+"img/Charas/Archon.png","Archon");
- sourceLoader.load("img",Game.CDN+"img/Charas/DarkArchon.png","DarkArchon");
- sourceLoader.load("img",Game.CDN+"img/Charas/Shuttle.png","Shuttle");
- sourceLoader.load("img",Game.CDN+"img/Charas/Observer.png","Observer");
- sourceLoader.load("img",Game.CDN+"img/Charas/Arbiter.png","Arbiter");
- sourceLoader.load("img",Game.CDN+"img/Charas/Scout.png","Scout");
- sourceLoader.load("img",Game.CDN+"img/Charas/Carrier.png","Carrier");
- sourceLoader.load("img",Game.CDN+"img/Charas/Corsair.png","Corsair");
- //Neuture
- sourceLoader.load("img",Game.CDN+"img/Charas/Ragnasaur.png","Ragnasaur");
- sourceLoader.load("img",Game.CDN+"img/Charas/Rhynsdon.png","Rhynsdon");
- sourceLoader.load("img",Game.CDN+"img/Charas/Ursadon.png","Ursadon");
- sourceLoader.load("img",Game.CDN+"img/Charas/Bengalaas.png","Bengalaas");
- sourceLoader.load("img",Game.CDN+"img/Charas/Scantid.png","Scantid");
- sourceLoader.load("img",Game.CDN+"img/Charas/Kakaru.png","Kakaru");
- //Hero
- sourceLoader.load("img",Game.CDN+"img/Charas/HeroCruiser.png","HeroCruiser");
- sourceLoader.load("img",Game.CDN+"img/Charas/Sarah.png","Sarah");
- sourceLoader.load("img",Game.CDN+"img/Charas/Kerrigan.png","Kerrigan");
- sourceLoader.load("img",Game.CDN+"img/Charas/DevilHunter.png","DevilHunter");
- sourceLoader.load("img",Game.CDN+"img/Charas/Tassadar.png","Tassadar");
- //Building
- sourceLoader.load("img",Game.CDN+"img/Charas/ZergBuilding.png","ZergBuilding");
- sourceLoader.load("img",Game.CDN+"img/Charas/TerranBuilding.png","TerranBuilding");
- sourceLoader.load("img",Game.CDN+"img/Charas/ProtossBuilding.png","ProtossBuilding");
- /*sourceLoader.load("audio","bgm/PointError.wav","PointError");*/
- //Map
- sourceLoader.load("img",Game.CDN+"img/Maps/(2)Switchback.jpg","Map_Switchback");
- sourceLoader.load("img",Game.CDN+"img/Maps/(2)Volcanis.jpg","Map_Volcanis");
- sourceLoader.load("img",Game.CDN+"img/Maps/(3)Trench wars.jpg","Map_TrenchWars");
- sourceLoader.load("img",Game.CDN+"img/Maps/(4)Blood Bath.jpg","Map_BloodBath");
- sourceLoader.load("img",Game.CDN+"img/Maps/(4)Orbital Relay.jpg","Map_OrbitalRelay");
- sourceLoader.load("img",Game.CDN+"img/Maps/(4)TowerDefense.jpg","Map_TowerDefense");
- sourceLoader.load("img",Game.CDN+"img/Maps/(6)Thin Ice.jpg","Map_ThinIce");
- sourceLoader.load("img",Game.CDN+"img/Maps/(8)BigGameHunters.jpg","Map_BigGameHunters");
- sourceLoader.load("img",Game.CDN+"img/Maps/(8)TheHunters.jpg","Map_TheHunters");
- sourceLoader.load("img",Game.CDN+"img/Maps/(8)Turbo.jpg","Map_Turbo");
- sourceLoader.load("img",Game.CDN+"img/Maps/Map_Grass.jpg","Map_Grass");
- sourceLoader.load("img",Game.CDN+"img/Charas/Mud.png","Mud");
- //Extra
- sourceLoader.load("img",Game.CDN+"img/Charas/Burst.png","Burst");
- sourceLoader.load("img",Game.CDN+"img/Charas/BuildingBurst.png","BuildingBurst");
- sourceLoader.load("img",Game.CDN+"img/Charas/Portrait.png","Portrait");
- sourceLoader.load("img",Game.CDN+"img/Charas/Magic.png","Magic");
- sourceLoader.load("img",Game.CDN+"img/Menu/ControlPanel.png","ControlPanel");
- sourceLoader.load("img",Game.CDN+"img/Bg/GameStart.jpg","GameStart");
- sourceLoader.load("img",Game.CDN+"img/Bg/GameWin.jpg","GameWin");
- sourceLoader.load("img",Game.CDN+"img/Bg/GameLose.jpg","GameLose");
-
- sourceLoader.allOnLoad(function(){
- $('#GameStart').prepend(sourceLoader.sources['GameStart']);
- $('#GameWin').prepend(sourceLoader.sources['GameWin']);
- $('#GameLose').prepend(sourceLoader.sources['GameLose']);
- $('#GamePlay>canvas').attr('width',Game.HBOUND);//Canvas width adjust
- $('#GamePlay>canvas').attr('height',Game.VBOUND-Game.infoBox.height+5);//Canvas height adjust
- for (var N=1;N<=9;N++){
- $('div.panel_Control').append("");
+ /*//Test image effect
+ AlloyImage(sourceLoader.sources['Wraith']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['Wraith']);
+ AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
+ Game.start();
+ });
+}
+start: function () {
+ //Game start
+ Game.layerSwitchTo("GameStart");
+ //Init level selector
+ for (var level = 1; level <= Levels.length; level++) {
+ $('.levelSelectionBg').append("" +
+ "" +
+ (Levels[level - 1].label ? (Levels[level - 1].label) : ("Level " + level))
+ + "
");
+ }
+ //Wait for user select level and play game
+ $('input[name="levelSelect"]').click(function () {
+ //Prevent vibration
+ if (Game.level != null)
+ return;
+ Game.level = parseInt(this.value);
+ Game.play();
+ });
+}
+play: function () {
+ //Load level to initial when no error occurs
+ if (!(Levels[Game.level - 1].load())) {
+ //Need Game.playerNum before expansion
+ Game.expandUnitProps();
+ Resource.init();
+ //Game background
+ Game.layerSwitchTo("GamePlay");
+ Game.resizeWindow();
+ //Collect login user info
+ if (Game.hackMode)
+ Multiplayer.sendUserInfo();
+ //Bind controller
+ mouseController.toControlAll(); //Can control all units
+ keyController.start(); //Start monitor
+ Game.pauseWhenHide(); //Hew H5 feature:Page Visibility
+ Game.initIndexDB(); //Hew H5 feature:Indexed DB
+ Game.animation();
+ }
+}
+getPropArray: function (prop) {
+ var result = [];
+ for (var N = 0; N < Game.playerNum; N++) {
+ result.push(typeof (prop) == 'object' ? (_$.clone(prop)) : prop);
+ }
+ return result;
+}
+//Do we need this because we only support Zerg vs Terran vs Protoss?
+expandUnitProps: function () {
+ //Post-operation for all unit types, prepare basic properties for different team numbers, init in level.js
+ _$.traverse([Zerg, Terran, Protoss, Neutral, Hero], function (unitType) {
+ ['HP', 'SP', 'MP', 'damage', 'armor', 'speed', 'attackRange', 'attackInterval', 'plasma', 'sight'].forEach(function (prop) {
+ //Prop array, first one for us, second for enemy
+ if (unitType.prototype[prop] != undefined) {
+ unitType.prototype[prop] = Game.getPropArray(unitType.prototype[prop]);
}
- /*//Test image effect
- AlloyImage(sourceLoader.sources['Wraith']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['Wraith']);
- AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
- Game.start();
- })
- },
- start:function(){
- //Game start
- Game.layerSwitchTo("GameStart");
- //Init level selector
- for (var level=1; level<=Levels.length; level++){
- $('.levelSelectionBg').append("" +
- ""+
- (Levels[level-1].label?(Levels[level-1].label):("Level "+level))
- +"
");
- }
- //Wait for user select level and play game
- $('input[name="levelSelect"]').click(function(){
- //Prevent vibration
- if (Game.level!=null) return;
- Game.level=parseInt(this.value);
- Game.play();
});
- },
- play:function(){
- //Load level to initial when no error occurs
- if (!(Levels[Game.level-1].load())){
- //Need Game.playerNum before expansion
- Game.expandUnitProps();
- Resource.init();
- //Game background
- Game.layerSwitchTo("GamePlay");
- Game.resizeWindow();
- //Collect login user info
- if (Game.hackMode) Multiplayer.sendUserInfo();
- //Bind controller
- mouseController.toControlAll();//Can control all units
- keyController.start();//Start monitor
- Game.pauseWhenHide();//Hew H5 feature:Page Visibility
- Game.initIndexDB();//Hew H5 feature:Indexed DB
- Game.animation();
- }
- },
- getPropArray:function(prop){
- var result=[];
- for (var N=0;N0) Game.changeSelectedTo(inRectUnits[0]);
- else Game.changeSelectedTo({});
- Game.addIntoAllSelected(inRectUnits,true);
- },
- getSelectedOne:function(clickX,clickY,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
- var distance=function(chara){
- return (clickX-chara.posX())*(clickX-chara.posX())+(clickY-chara.posY())*(clickY-chara.posY());//Math.pow2
- };
- //Initial
- var selectedOne={},charas=[];
- switch (unitBuildingFilter){
- case true:
- charas=Unit.allUnits;
- break;
- case false:
- charas=Building.allBuildings;
- break;
- default:
- charas=Unit.allUnits.concat(Building.allBuildings);
- }
- switch (isEnemyFilter){
- case true:case false:
- charas=charas.filter(function(chara){
- return chara.isEnemy()==isEnemyFilter;
- });
- break;
- case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:
- charas=charas.filter(function(chara){
- return chara.team==isEnemyFilter;
- });
- break;
- case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':
- charas=charas.filter(function(chara){
- return chara.team!=isEnemyFilter;
- });
+ Game.addIntoAllSelected(team, true);
+ if (team[0] instanceof Gobj) {
+ Game.changeSelectedTo(team[0]);
+ //Sound effect
+ team[0].sound.selected.play();
+ //Relocate map center
+ Map.relocateAt(team[0].posX(), team[0].posY());
}
- if (isFlyingFilter!=null) {
- charas=charas.filter(function(chara){
- return chara.isFlying==isFlyingFilter;
+ }
+}
+unselectAll: function () {
+ //Unselect all
+ var units = Unit.allUnits.concat(Building.allBuildings);
+ units.forEach(function (chara) { chara.selected = false; });
+ Game.addIntoAllSelected([], true);
+}
+multiSelectInRect: function () {
+ Game.unselectAll();
+ //Multi select in rect
+ var startPoint = { x: Map.offsetX + Math.min(mouseController.startPoint.x, mouseController.endPoint.x),
+ y: Map.offsetY + Math.min(mouseController.startPoint.y, mouseController.endPoint.y) };
+ var endPoint = { x: Map.offsetX + Math.max(mouseController.startPoint.x, mouseController.endPoint.x),
+ y: Map.offsetY + Math.max(mouseController.startPoint.y, mouseController.endPoint.y) };
+ var inRectUnits = Unit.allOurUnits().filter(function (chara) {
+ return chara.insideRect({ start: (startPoint), end: (endPoint) });
+ });
+ if (inRectUnits.length > 0)
+ Game.changeSelectedTo(inRectUnits[0]);
+ else
+ Game.changeSelectedTo({});
+ Game.addIntoAllSelected(inRectUnits, true);
+}
+getSelectedOne: function (clickX, clickY, isEnemyFilter, unitBuildingFilter, isFlyingFilter, customFilter) {
+ var distance = function (chara) {
+ return (clickX - chara.posX()) * (clickX - chara.posX()) + (clickY - chara.posY()) * (clickY - chara.posY()); //Math.pow2
+ };
+ //Initial
+ var selectedOne = {}, charas = [];
+ switch (unitBuildingFilter) {
+ case true:
+ charas = Unit.allUnits;
+ break;
+ case false:
+ charas = Building.allBuildings;
+ break;
+ default:
+ charas = Unit.allUnits.concat(Building.allBuildings);
+ }
+ switch (isEnemyFilter) {
+ case true:
+ case false:
+ charas = charas.filter(function (chara) {
+ return chara.isEnemy() == isEnemyFilter;
+ });
+ break;
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ charas = charas.filter(function (chara) {
+ return chara.team == isEnemyFilter;
+ });
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ charas = charas.filter(function (chara) {
+ return chara.team != isEnemyFilter;
+ });
+ }
+ if (isFlyingFilter != null) {
+ charas = charas.filter(function (chara) {
+ return chara.isFlying == isFlyingFilter;
+ });
+ }
+ //customFilter is filter function
+ if (customFilter != null) {
+ charas = charas.filter(customFilter);
+ }
+ //Find nearest one
+ selectedOne = charas.filter(function (chara) {
+ return chara.status != 'dead' && chara.includePoint(clickX, clickY);
+ }).sort(function (chara1, chara2) {
+ return distance(chara1) - distance(chara2);
+ })[0];
+ if (!selectedOne)
+ selectedOne = {};
+ return selectedOne;
+}
+getInRangeOnes: function (clickX, clickY, range, isEnemyFilter, unitBuildingFilter, isFlyingFilter, customFilter) {
+ //Initial
+ var selectedOnes = [], charas = [];
+ switch (unitBuildingFilter) {
+ case true:
+ charas = Unit.allUnits;
+ break;
+ case false:
+ charas = Building.allBuildings;
+ break;
+ default:
+ charas = Unit.allUnits.concat(Building.allBuildings);
+ }
+ switch (isEnemyFilter) {
+ case true:
+ case false:
+ charas = charas.filter(function (chara) {
+ return chara.isEnemy() == isEnemyFilter;
+ });
+ break;
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ charas = charas.filter(function (chara) {
+ return chara.team == isEnemyFilter;
+ });
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ charas = charas.filter(function (chara) {
+ return chara.team != isEnemyFilter;
});
+ }
+ if (isFlyingFilter != null) {
+ charas = charas.filter(function (chara) {
+ return chara.isFlying == isFlyingFilter;
+ });
+ }
+ //customFilter is filter function
+ if (customFilter != null) {
+ charas = charas.filter(customFilter);
+ }
+ //Find in range ones
+ selectedOnes = charas.filter(function (chara) {
+ return chara.status != 'dead' && chara.insideSquare({ centerX: clickX, centerY: clickY, radius: range });
+ });
+ return selectedOnes;
+}
+//For test use
+getSelected: function () {
+ return Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
+ return chara.selected;
+ });
+}
+showInfoFor: function (chara) {
+ //Show selected living unit info
+ if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status != "dead") {
+ //Display info
+ $('div.panel_Info>div[class*="info"]').show();
+ //Draw selected unit portrait
+ if (chara.portrait)
+ $('div.infoLeft div[name="portrait"]')[0].className = chara.portrait; //Override portrait
+ else {
+ if (Game.selectedUnit instanceof Unit)
+ $('div.infoLeft div[name="portrait"]')[0].className = Game.selectedUnit.name;
+ if (Game.selectedUnit instanceof Building)
+ $('div.infoLeft div[name="portrait"]')[0].className =
+ Game.selectedUnit.attack ? Game.selectedUnit.inherited.inherited.name : Game.selectedUnit.inherited.name;
}
- //customFilter is filter function
- if (customFilter!=null){
- charas=charas.filter(customFilter);
+ //Show selected unit HP,SP and MP
+ $('div.infoLeft span._Health')[0].style.color = Game.selectedUnit.lifeStatus();
+ $('div.infoLeft span.life')[0].innerHTML = Game.selectedUnit.life >> 0;
+ $('div.infoLeft span.HP')[0].innerHTML = Game.selectedUnit.get('HP');
+ if (Game.selectedUnit.SP) {
+ $('div.infoLeft span.shield')[0].innerHTML = Game.selectedUnit.shield >> 0;
+ $('div.infoLeft span.SP')[0].innerHTML = Game.selectedUnit.get('SP');
+ $('div.infoLeft span._Shield').show();
}
- //Find nearest one
- selectedOne=charas.filter(function(chara){
- return chara.status!='dead' && chara.includePoint(clickX,clickY);
- }).sort(function(chara1,chara2){
- return distance(chara1)-distance(chara2);
- })[0];
- if (!selectedOne) selectedOne={};
- return selectedOne;
- },
- getInRangeOnes:function(clickX,clickY,range,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
- //Initial
- var selectedOnes=[],charas=[];
- switch (unitBuildingFilter){
- case true:
- charas=Unit.allUnits;
- break;
- case false:
- charas=Building.allBuildings;
- break;
- default:
- charas=Unit.allUnits.concat(Building.allBuildings);
+ else {
+ $('div.infoLeft span._Shield').hide();
}
- switch (isEnemyFilter){
- case true:case false:
- charas=charas.filter(function(chara){
- return chara.isEnemy()==isEnemyFilter;
- });
- break;
- case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:
- charas=charas.filter(function(chara){
- return chara.team==isEnemyFilter;
- });
- break;
- case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':
- charas=charas.filter(function(chara){
- return chara.team!=isEnemyFilter;
- });
+ if (Game.selectedUnit.MP) {
+ $('div.infoLeft span.magic')[0].innerHTML = Game.selectedUnit.magic >> 0;
+ $('div.infoLeft span.MP')[0].innerHTML = Game.selectedUnit.get('MP');
+ $('div.infoLeft span._Magic').show();
}
- if (isFlyingFilter!=null) {
- charas=charas.filter(function(chara){
- return chara.isFlying==isFlyingFilter;
- });
+ else {
+ $('div.infoLeft span._Magic').hide();
}
- //customFilter is filter function
- if (customFilter!=null){
- charas=charas.filter(customFilter);
+ //Draw selected unit name,kill,damage,armor and shield
+ $('div.infoCenter h3.name')[0].innerHTML = Game.selectedUnit.name;
+ if (Game.selectedUnit.detector) {
+ $('div.infoCenter p.detector').show();
}
- //Find in range ones
- selectedOnes=charas.filter(function(chara){
- return chara.status!='dead' && chara.insideSquare({centerX:clickX,centerY:clickY,radius:range});
- });
- return selectedOnes;
- },
- //For test use
- getSelected:function(){
- return Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
- return chara.selected;
- });
- },
- showInfoFor:function(chara){
- //Show selected living unit info
- if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
- //Display info
- $('div.panel_Info>div[class*="info"]').show();
- //Draw selected unit portrait
- if (chara.portrait) $('div.infoLeft div[name="portrait"]')[0].className=chara.portrait;//Override portrait
- else {
- if (Game.selectedUnit instanceof Unit)
- $('div.infoLeft div[name="portrait"]')[0].className=Game.selectedUnit.name;
- if (Game.selectedUnit instanceof Building)
- $('div.infoLeft div[name="portrait"]')[0].className=
- Game.selectedUnit.attack?Game.selectedUnit.inherited.inherited.name:Game.selectedUnit.inherited.name;
- }
- //Show selected unit HP,SP and MP
- $('div.infoLeft span._Health')[0].style.color=Game.selectedUnit.lifeStatus();
- $('div.infoLeft span.life')[0].innerHTML=Game.selectedUnit.life>>0;
- $('div.infoLeft span.HP')[0].innerHTML=Game.selectedUnit.get('HP');
- if (Game.selectedUnit.SP) {
- $('div.infoLeft span.shield')[0].innerHTML=Game.selectedUnit.shield>>0;
- $('div.infoLeft span.SP')[0].innerHTML=Game.selectedUnit.get('SP');
- $('div.infoLeft span._Shield').show();
- }
- else {
- $('div.infoLeft span._Shield').hide();
- }
- if (Game.selectedUnit.MP) {
- $('div.infoLeft span.magic')[0].innerHTML=Game.selectedUnit.magic>>0;
- $('div.infoLeft span.MP')[0].innerHTML=Game.selectedUnit.get('MP');
- $('div.infoLeft span._Magic').show();
- }
- else {
- $('div.infoLeft span._Magic').hide();
- }
- //Draw selected unit name,kill,damage,armor and shield
- $('div.infoCenter h3.name')[0].innerHTML=Game.selectedUnit.name;
- if (Game.selectedUnit.detector) {
- $('div.infoCenter p.detector').show();
- }
- else {
- $('div.infoCenter p.detector').hide();
- }
- if (Game.selectedUnit.attack){
- $('div.infoCenter p.kill span')[0].innerHTML=Game.selectedUnit.kill;
- if (Game.selectedUnit.attackMode) {
- $('div.infoCenter p.damage span')[0].innerHTML=(Game.selectedUnit.get('attackMode.ground.damage')+'/'+Game.selectedUnit.get('attackMode.flying.damage'));
- }
- else {
- $('div.infoCenter p.damage span')[0].innerHTML=(Game.selectedUnit.get('damage')+(Game.selectedUnit.suicide?' (1)':''));
- }
- //Show kill and damage
- $('div.infoCenter p.kill').show();
- $('div.infoCenter p.damage').show();
- }
- else {
- //Hide kill and damage
- $('div.infoCenter p.kill').hide();
- $('div.infoCenter p.damage').hide();
- }
- $('div.infoCenter p.armor span')[0].innerHTML=Game.selectedUnit.get('armor');
- if (Game.selectedUnit.get('plasma')!=undefined) {
- $('div.infoCenter p.plasma span')[0].innerHTML=Game.selectedUnit.get('plasma');
- $('div.infoCenter p.plasma').show();
- }
- else {
- $('div.infoCenter p.plasma').hide();
- }
- //Can disable this filter for testing
- if (Game.selectedUnit.loadedUnits && Game.selectedUnit.team==Game.team) {
- $('div.infoCenter p.passenger span')[0].innerHTML=Game.selectedUnit.loadedUnits.length;
- $('div.infoCenter p.passenger').show();
- //Clear old icons
- $('div.infoCenter p.icons')[0].innerHTML='';
- //Show passenger icons
- Game.selectedUnit.loadedUnits.forEach(function(passenger){
- $('div.infoCenter p.icons').append($('')
- .attr('class',passenger.name).css('border-color',passenger.lifeStatus()));
- });
- $('div.infoCenter p.icons').show();
- }
- else {
- $('div.infoCenter p.passenger').hide();
- $('div.infoCenter p.icons').hide();
- }
- //Draw upgraded
- var upgraded=Game.selectedUnit.upgrade;
- var team=Game.selectedUnit.team;
- if (upgraded){
- for (var N=0;N<3;N++){
- var upgradeIcon=$('div.upgraded div[name="icon"]')[N];
- upgradeIcon.innerHTML='';
- upgradeIcon.style.display='none';
- if (Ndiv').hide();
+ //Hide kill and damage
+ $('div.infoCenter p.kill').hide();
+ $('div.infoCenter p.damage').hide();
}
- },
- refreshInfo:function(){
- Game.showInfoFor(Game.selectedUnit);
- },
- changeSelectedTo:function(chara){
- Game.selectedUnit=chara;
- Button.equipButtonsFor(chara);
- if (chara instanceof Gobj){
- chara.selected=true;
+ $('div.infoCenter p.armor span')[0].innerHTML = Game.selectedUnit.get('armor');
+ if (Game.selectedUnit.get('plasma') != undefined) {
+ $('div.infoCenter p.plasma span')[0].innerHTML = Game.selectedUnit.get('plasma');
+ $('div.infoCenter p.plasma').show();
}
- Game.showInfoFor(chara);
- },
- draw:function(chara){
- //Can draw units and no-rotate bullets
- if (!(chara instanceof Gobj)) return;//Will only show Gobj
- if (chara.status=="dead") return;//Will not show dead
- //Won't draw units outside screen
- if (!chara.insideScreen()) return;
- //Choose context
- var cxt=((chara instanceof Unit) || (chara instanceof Building))?Game.cxt:Game.frontCxt;
- //Draw shadow
- cxt.save();
- //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
- cxt.shadowOffsetX=(chara.isFlying)?5:3;
- cxt.shadowOffsetY=(chara.isFlying)?20:8;
- cxt.shadowColor="rgba(0,0,0,0.4)";
- //Close shadow for burrowed
- if (chara.buffer.Burrow) cxt.shadowOffsetX=cxt.shadowOffsetY=0;
- //Draw invisible
- if (chara['isInvisible'+Game.team]!=null){
- cxt.globalAlpha=(chara.isEnemy() && chara['isInvisible'+Game.team])?0:0.5;
- if (chara.burrowBuffer){
- if (chara.isEnemy()){
- if (!chara['isInvisible'+Game.team]) cxt.globalAlpha=1;
- }
- else cxt.globalAlpha=1;
- }
+ else {
+ $('div.infoCenter p.plasma').hide();
}
- //Draw unit or building
- var imgSrc;
- if (chara instanceof Building){
- if (chara.source) imgSrc=sourceLoader.sources[chara.source];
- else {
- imgSrc=sourceLoader.sources[chara.attack?chara.inherited.inherited.name:chara.inherited.name];
- }
+ //Can disable this filter for testing
+ if (Game.selectedUnit.loadedUnits && Game.selectedUnit.team == Game.team) {
+ $('div.infoCenter p.passenger span')[0].innerHTML = Game.selectedUnit.loadedUnits.length;
+ $('div.infoCenter p.passenger').show();
+ //Clear old icons
+ $('div.infoCenter p.icons')[0].innerHTML = '';
+ //Show passenger icons
+ Game.selectedUnit.loadedUnits.forEach(function (passenger) {
+ $('div.infoCenter p.icons').append($('')
+ .attr('class', passenger.name).css('border-color', passenger.lifeStatus()));
+ });
+ $('div.infoCenter p.icons').show();
}
- //Unit, not building
- else imgSrc=sourceLoader.sources[chara.source?chara.source:chara.name];
- //Convert position
- var charaX=(chara.x-Map.offsetX)>>0;
- var charaY=(chara.y-Map.offsetY)>>0;
- //Same image in different directions
- if (chara.direction==undefined){
- var _left=chara.imgPos[chara.status].left;
- var _top=chara.imgPos[chara.status].top;
- //Multiple actions status
- if (_left instanceof Array || _top instanceof Array){
- cxt.drawImage(imgSrc,
- _left[chara.action],_top[chara.action],chara.width,chara.height,
- charaX,charaY,chara.width,chara.height);
- }
- //One action status
- else{
- cxt.drawImage(imgSrc,
- _left,_top,chara.width,chara.height,
- charaX,charaY,chara.width,chara.height);
- }
+ else {
+ $('div.infoCenter p.passenger').hide();
+ $('div.infoCenter p.icons').hide();
}
- //Different image in different directions
- else{
- var _left=chara.imgPos[chara.status].left[chara.direction];
- var _top=chara.imgPos[chara.status].top[chara.direction];
- //Multiple actions status
- if (_left instanceof Array || _top instanceof Array){
- cxt.drawImage(imgSrc,
- _left[chara.action],_top[chara.action],chara.width,chara.height,
- charaX,charaY,chara.width,chara.height);
- }
- //One action status
- else{
- cxt.drawImage(imgSrc,
- _left,_top,chara.width,chara.height,
- charaX,charaY,chara.width,chara.height);
+ //Draw upgraded
+ var upgraded = Game.selectedUnit.upgrade;
+ var team = Game.selectedUnit.team;
+ if (upgraded) {
+ for (var N = 0; N < 3; N++) {
+ var upgradeIcon = $('div.upgraded div[name="icon"]')[N];
+ upgradeIcon.innerHTML = '';
+ upgradeIcon.style.display = 'none';
+ if (N < upgraded.length) {
+ upgradeIcon.className = upgradeIcon.title = upgraded[N];
+ upgradeIcon.innerHTML = Upgrade[upgraded[N]].level[team];
+ if (Upgrade[upgraded[N]].level[team]) {
+ upgradeIcon.setAttribute('disabled', 'false');
+ upgradeIcon.style.color = 'aqua';
+ }
+ else {
+ upgradeIcon.setAttribute('disabled', 'true');
+ upgradeIcon.style.color = 'red';
+ }
+ upgradeIcon.style.display = 'inline-block';
+ }
}
+ $('div.upgraded').show();
}
- //Remove shadow
- cxt.restore();
- //Draw HP if has selected and is true
- if (chara.selected==true){
- cxt=Game.frontCxt;
- //Draw selected circle
- cxt.strokeStyle=(chara.isEnemy())?"red":"green";//Distinguish enemy
- cxt.lineWidth=2;//Cannot see 1px width circle clearly
- cxt.beginPath();
- cxt.arc(chara.posX()-Map.offsetX,chara.posY()-Map.offsetY,chara.radius(),0,2*Math.PI);
- cxt.stroke();
- //Draw HP bar and SP bar and magic bar
- cxt.globalAlpha=1;
- cxt.lineWidth=1;
- var offsetY=-6-(chara.MP?5:0)-(chara.SP?5:0);
- var lifeRatio=chara.life/chara.get('HP');
- cxt.strokeStyle="black";
- if (chara.SP) {
- //Draw HP and SP
- cxt.fillStyle="blue";
- cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width*chara.shield/chara.get('SP'),5);
- cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width,5);
- cxt.fillStyle=(lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red";//Distinguish life
- cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+5,chara.width*lifeRatio,5);
- cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+5,chara.width,5);
- }
- else {
- //Only draw HP
- cxt.fillStyle=(lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red";//Distinguish life
- cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width*lifeRatio,5);
- cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width,5);
- }
- if (chara.MP) {
- //Draw MP
- cxt.fillStyle="darkviolet";
- cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+(chara.SP?10:5),chara.width*chara.magic/chara.get('MP'),5);
- cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+(chara.SP?10:5),chara.width,5);
+ else {
+ //$('div.upgraded div[name="icon"]').html('').removeAttr('title').hide();
+ $('div.upgraded').hide();
+ }
+ }
+ else {
+ //Hide info
+ $('div.panel_Info>div').hide();
+ }
+}
+refreshInfo: function () {
+ Game.showInfoFor(Game.selectedUnit);
+}
+changeSelectedTo: function (chara) {
+ Game.selectedUnit = chara;
+ Button.equipButtonsFor(chara);
+ if (chara instanceof Gobj) {
+ chara.selected = true;
+ }
+ Game.showInfoFor(chara);
+}
+draw: function (chara) {
+ //Can draw units and no-rotate bullets
+ if (!(chara instanceof Gobj))
+ return; //Will only show Gobj
+ if (chara.status == "dead")
+ return; //Will not show dead
+ //Won't draw units outside screen
+ if (!chara.insideScreen())
+ return;
+ //Choose context
+ var cxt = ((chara instanceof Unit) || (chara instanceof Building)) ? Game.cxt : Game.frontCxt;
+ //Draw shadow
+ cxt.save();
+ //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ cxt.shadowOffsetX = (chara.isFlying) ? 5 : 3;
+ cxt.shadowOffsetY = (chara.isFlying) ? 20 : 8;
+ cxt.shadowColor = "rgba(0,0,0,0.4)";
+ //Close shadow for burrowed
+ if (chara.buffer.Burrow)
+ cxt.shadowOffsetX = cxt.shadowOffsetY = 0;
+ //Draw invisible
+ if (chara['isInvisible' + Game.team] != null) {
+ cxt.globalAlpha = (chara.isEnemy() && chara['isInvisible' + Game.team]) ? 0 : 0.5;
+ if (chara.burrowBuffer) {
+ if (chara.isEnemy()) {
+ if (!chara['isInvisible' + Game.team])
+ cxt.globalAlpha = 1;
}
+ else
+ cxt.globalAlpha = 1;
+ }
+ }
+ //Draw unit or building
+ var imgSrc;
+ if (chara instanceof Building) {
+ if (chara.source)
+ imgSrc = sourceLoader.sources[chara.source];
+ else {
+ imgSrc = sourceLoader.sources[chara.attack ? chara.inherited.inherited.name : chara.inherited.name];
}
- },
- drawEffect:function(chara){
- //Can draw units and no-rotate bullets
- if (!(chara instanceof Burst)) return;//Will only show Burst
- if (chara.status=="dead") return;//Will not show dead
- //Won't draw units outside screen
- if (!chara.insideScreen()) return;
- //Choose context
- var cxt=Game.frontCxt;
- //Draw shadow
- cxt.save();
- //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
- cxt.shadowOffsetX=(chara.isFlying)?5:3;
- cxt.shadowOffsetY=(chara.isFlying)?20:8;
- cxt.shadowColor="rgba(0,0,0,0.4)";
- var imgSrc=sourceLoader.sources[chara.name];
- //Convert position
- var charaX=(chara.x-Map.offsetX)>>0;
- var charaY=(chara.y-Map.offsetY)>>0;
- var _left=chara.imgPos[chara.status].left;
- var _top=chara.imgPos[chara.status].top;
- //Will stretch effect if scale
- var times=chara.scale?chara.scale:1;
+ }
+ else
+ imgSrc = sourceLoader.sources[chara.source ? chara.source : chara.name];
+ //Convert position
+ var charaX = (chara.x - Map.offsetX) >> 0;
+ var charaY = (chara.y - Map.offsetY) >> 0;
+ //Same image in different directions
+ if (chara.direction == undefined) {
+ var _left = chara.imgPos[chara.status].left;
+ var _top = chara.imgPos[chara.status].top;
//Multiple actions status
- if (_left instanceof Array || _top instanceof Array){
- cxt.drawImage(imgSrc,
- _left[chara.action],_top[chara.action],chara.width,chara.height,
- charaX,charaY,chara.width*times>>0,chara.height*times>>0);
+ if (_left instanceof Array || _top instanceof Array) {
+ cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width, chara.height);
}
- //One action status
- else{
- cxt.drawImage(imgSrc,
- _left,_top,chara.width,chara.height,
- charaX,charaY,chara.width*times>>0,chara.height*times>>0);
+ else {
+ cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width, chara.height);
}
- //Remove shadow
- cxt.restore();
- },
- drawBullet:function(chara){
- //Can draw bullets need rotate
- if (!(chara instanceof Bullets)) return;//Will only show bullet
- if (chara.status=="dead") return;//Will not show dead
- //Won't draw bullets outside screen
- if (!chara.insideScreen()) return;
- //Draw unit
- var imgSrc=sourceLoader.sources[chara.name];
- var _left=chara.imgPos[chara.status].left;
- var _top=chara.imgPos[chara.status].top;
- //Convert position
- var centerX=(chara.posX()-Map.offsetX)>>0;
- var centerY=(chara.posY()-Map.offsetY)>>0;
- //Rotate canvas
- Game.frontCxt.save();
- //Rotate to draw bullet
- Game.frontCxt.translate(centerX,centerY);
- Game.frontCxt.rotate(-chara.angle);
- //Draw shadow
- //Game.frontCxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
- Game.frontCxt.shadowOffsetX=(chara.owner.isFlying)?5:3;
- Game.frontCxt.shadowOffsetY=(chara.owner.isFlying)?20:5;
- Game.frontCxt.shadowColor="rgba(0,0,0,0.4)";
- //Game.frontCxt.shadowColor="rgba(255,0,0,1)";
+ }
+ else {
+ var _left = chara.imgPos[chara.status].left[chara.direction];
+ var _top = chara.imgPos[chara.status].top[chara.direction];
//Multiple actions status
- if (_left instanceof Array || _top instanceof Array){
- Game.frontCxt.drawImage(imgSrc,
- _left[chara.action],_top[chara.action],chara.width,chara.height,
- -chara.width/2>>0,-chara.height/2>>0,chara.width,chara.height);
- }
- //One action status
- else{
- Game.frontCxt.drawImage(imgSrc,
- _left,_top,chara.width,chara.height,
- -chara.width/2>>0,-chara.height/2>>0,chara.width,chara.height);
+ if (_left instanceof Array || _top instanceof Array) {
+ cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width, chara.height);
}
- //Rotate canvas back and remove shadow
- Game.frontCxt.restore();
- //Below 2 separated steps might cause mess
- //Game.frontCxt.translate(-centerX,-centerY);
- //Game.frontCxt.rotate(chara.angle);
- },
- drawInfoBox:function(){
- //Update selected unit active info which need refresh
- if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
- //Update selected unit life,shield and magic
- var lifeRatio=Game.selectedUnit.life/Game.selectedUnit.get('HP');
- $('div.infoLeft span._Health')[0].style.color=((lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red");
- $('div.infoLeft span.life')[0].innerHTML=Game.selectedUnit.life>>0;
- if (Game.selectedUnit.SP) {
- $('div.infoLeft span.shield')[0].innerHTML=Game.selectedUnit.shield>>0;
- }
- if (Game.selectedUnit.MP) {
- $('div.infoLeft span.magic')[0].innerHTML=Game.selectedUnit.magic>>0;
- }
- //Update selected unit kill
- if (Game.selectedUnit.kill!=null){
- $('div.infoCenter p.kill span')[0].innerHTML=Game.selectedUnit.kill;
- }
+ else {
+ cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width, chara.height);
}
- },
- drawSourceBox:function(){
- //Update min, gas, curMan and totalMan
- $('div.resource_Box span.mineNum')[0].innerHTML=Resource[Game.team].mine;
- $('div.resource_Box span.gasNum')[0].innerHTML=Resource[Game.team].gas;
- $('div.resource_Box span.manNum>span')[0].innerHTML=Resource[Game.team].curMan;
- $('div.resource_Box span.manNum>span')[1].innerHTML=Resource[Game.team].totalMan;
- //Check if man overflow
- $('div.resource_Box span.manNum')[0].style.color=(Resource[Game.team].curMan>Resource[Game.team].totalMan)?"red":"#00ff00";
- },
- drawProcessingBox:function(){
- //Show processing box if it's processing
- var processing=Game.selectedUnit.processing;
- //Can disable this filter for testing
- if (processing && Game.selectedUnit.team==Game.team){
- $('div.upgrading div[name="icon"]')[0].className=processing.name;
- //var percent=((new Date().getTime()-processing.startTime)/(processing.time)+0.5)>>0;
- var percent=((Game.mainTick-processing.startTime)*100/(processing.time)+0.5)>>0;
- $('div.upgrading div[name="processing"] span')[0].innerHTML=percent;
- $('div.upgrading div[name="processing"] div.processedBar')[0].style.width=percent+'%';
- $('div.upgrading').attr('title',processing.name).show();
+ }
+ //Remove shadow
+ cxt.restore();
+ //Draw HP if has selected and is true
+ if (chara.selected == true) {
+ cxt = Game.frontCxt;
+ //Draw selected circle
+ cxt.strokeStyle = (chara.isEnemy()) ? "red" : "green"; //Distinguish enemy
+ cxt.lineWidth = 2; //Cannot see 1px width circle clearly
+ cxt.beginPath();
+ cxt.arc(chara.posX() - Map.offsetX, chara.posY() - Map.offsetY, chara.radius(), 0, 2 * Math.PI);
+ cxt.stroke();
+ //Draw HP bar and SP bar and magic bar
+ cxt.globalAlpha = 1;
+ cxt.lineWidth = 1;
+ var offsetY = -6 - (chara.MP ? 5 : 0) - (chara.SP ? 5 : 0);
+ var lifeRatio = chara.life / chara.get('HP');
+ cxt.strokeStyle = "black";
+ if (chara.SP) {
+ //Draw HP and SP
+ cxt.fillStyle = "blue";
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width * chara.shield / chara.get('SP'), 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width, 5);
+ cxt.fillStyle = (lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"; //Distinguish life
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + 5, chara.width * lifeRatio, 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + 5, chara.width, 5);
}
else {
- //Select nothing, show replay progress
- if (Game.replayFlag && Game.endTick>0){
- $('div.upgrading div[name="icon"]')[0].className='Replay';
- var percent=(Game.mainTick*100/(Game.endTick)+0.5)>>0;
- $('div.upgrading div[name="processing"] span')[0].innerHTML=percent;
- $('div.upgrading div[name="processing"] div.processedBar')[0].style.width=percent+'%';
- $('div.upgrading').attr('title','Replay Progress').show();
- if (!(Game.selectedUnit instanceof Gobj)){
- $('div.infoRight').show();
- $('div.upgraded').hide();
- }
- }
- else $('div.upgrading').removeAttr('title').hide();
+ //Only draw HP
+ cxt.fillStyle = (lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"; //Distinguish life
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width * lifeRatio, 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width, 5);
}
- },
- refreshMultiSelectBox:function(){
- var divs=$('div.override div.multiSelection div');
- //Only refresh border color on current multiSelect box
- for (var n=0;n12?Math.ceil(iconNum/2)*55:330)+'px');
- //Adjust background position after added into DOM, nth starts from 1st(no 0th)
- for (var n=1;n<=iconNum;n++){
- var bgPosition=$('div.override div.multiSelection div:nth-child('+n+')').css('background-position');
- bgPosition=bgPosition.split(' ').map(function(pos){
- return parseInt(pos)*0.75+'px';
- }).join(' ');
- $('div.override div.multiSelection div:nth-child('+n+')').css('background-position',bgPosition);
+ }
+}
+drawEffect: function (chara) {
+ //Can draw units and no-rotate bullets
+ if (!(chara instanceof Burst))
+ return; //Will only show Burst
+ if (chara.status == "dead")
+ return; //Will not show dead
+ //Won't draw units outside screen
+ if (!chara.insideScreen())
+ return;
+ //Choose context
+ var cxt = Game.frontCxt;
+ //Draw shadow
+ cxt.save();
+ //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ cxt.shadowOffsetX = (chara.isFlying) ? 5 : 3;
+ cxt.shadowOffsetY = (chara.isFlying) ? 20 : 8;
+ cxt.shadowColor = "rgba(0,0,0,0.4)";
+ var imgSrc = sourceLoader.sources[chara.name];
+ //Convert position
+ var charaX = (chara.x - Map.offsetX) >> 0;
+ var charaY = (chara.y - Map.offsetY) >> 0;
+ var _left = chara.imgPos[chara.status].left;
+ var _top = chara.imgPos[chara.status].top;
+ //Will stretch effect if scale
+ var times = chara.scale ? chara.scale : 1;
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array) {
+ cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width * times >> 0, chara.height * times >> 0);
+ }
+ else {
+ cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width * times >> 0, chara.height * times >> 0);
+ }
+ //Remove shadow
+ cxt.restore();
+}
+drawBullet: function (chara) {
+ //Can draw bullets need rotate
+ if (!(chara instanceof Bullets))
+ return; //Will only show bullet
+ if (chara.status == "dead")
+ return; //Will not show dead
+ //Won't draw bullets outside screen
+ if (!chara.insideScreen())
+ return;
+ //Draw unit
+ var imgSrc = sourceLoader.sources[chara.name];
+ var _left = chara.imgPos[chara.status].left;
+ var _top = chara.imgPos[chara.status].top;
+ //Convert position
+ var centerX = (chara.posX() - Map.offsetX) >> 0;
+ var centerY = (chara.posY() - Map.offsetY) >> 0;
+ //Rotate canvas
+ Game.frontCxt.save();
+ //Rotate to draw bullet
+ Game.frontCxt.translate(centerX, centerY);
+ Game.frontCxt.rotate(-chara.angle);
+ //Draw shadow
+ //Game.frontCxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ Game.frontCxt.shadowOffsetX = (chara.owner.isFlying) ? 5 : 3;
+ Game.frontCxt.shadowOffsetY = (chara.owner.isFlying) ? 20 : 5;
+ Game.frontCxt.shadowColor = "rgba(0,0,0,0.4)";
+ //Game.frontCxt.shadowColor="rgba(255,0,0,1)";
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array) {
+ Game.frontCxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, -chara.width / 2 >> 0, -chara.height / 2 >> 0, chara.width, chara.height);
+ }
+ else {
+ Game.frontCxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, -chara.width / 2 >> 0, -chara.height / 2 >> 0, chara.width, chara.height);
+ }
+ //Rotate canvas back and remove shadow
+ Game.frontCxt.restore();
+ //Below 2 separated steps might cause mess
+ //Game.frontCxt.translate(-centerX,-centerY);
+ //Game.frontCxt.rotate(chara.angle);
+}
+drawInfoBox: function () {
+ //Update selected unit active info which need refresh
+ if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status != "dead") {
+ //Update selected unit life,shield and magic
+ var lifeRatio = Game.selectedUnit.life / Game.selectedUnit.get('HP');
+ $('div.infoLeft span._Health')[0].style.color = ((lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red");
+ $('div.infoLeft span.life')[0].innerHTML = Game.selectedUnit.life >> 0;
+ if (Game.selectedUnit.SP) {
+ $('div.infoLeft span.shield')[0].innerHTML = Game.selectedUnit.shield >> 0;
}
- },
- animation:function(){
- Game.animation.loop=function(){
- //Process due commands for current frame before drawing
- var commands=Game.commands[Game.mainTick];
- if (commands instanceof Array){
- for (var N=0;N(Game.HBOUND-Map.triggerMargin)) Map.needRefresh="RIGHT";
- if (mouseController.mouseY(Game.VBOUND-Map.triggerMargin)) Map.needRefresh="BOTTOM";
- if (Map.needRefresh) {
- Map.refresh(Map.needRefresh);
- Map.needRefresh=false;
- }
- //DrawLayer1: Show all buildings
- for (var N=0;N> 0;
+ }
+ //Update selected unit kill
+ if (Game.selectedUnit.kill != null) {
+ $('div.infoCenter p.kill span')[0].innerHTML = Game.selectedUnit.kill;
+ }
+ }
+}
+drawSourceBox: function () {
+ //Update min, gas, curMan and totalMan
+ $('div.resource_Box span.mineNum')[0].innerHTML = Resource[Game.team].mine;
+ $('div.resource_Box span.gasNum')[0].innerHTML = Resource[Game.team].gas;
+ $('div.resource_Box span.manNum>span')[0].innerHTML = Resource[Game.team].curMan;
+ $('div.resource_Box span.manNum>span')[1].innerHTML = Resource[Game.team].totalMan;
+ //Check if man overflow
+ $('div.resource_Box span.manNum')[0].style.color = (Resource[Game.team].curMan > Resource[Game.team].totalMan) ? "red" : "#00ff00";
+}
+drawProcessingBox: function () {
+ //Show processing box if it's processing
+ var processing = Game.selectedUnit.processing;
+ //Can disable this filter for testing
+ if (processing && Game.selectedUnit.team == Game.team) {
+ $('div.upgrading div[name="icon"]')[0].className = processing.name;
+ //var percent=((new Date().getTime()-processing.startTime)/(processing.time)+0.5)>>0;
+ var percent = ((Game.mainTick - processing.startTime) * 100 / (processing.time) + 0.5) >> 0;
+ $('div.upgrading div[name="processing"] span')[0].innerHTML = percent;
+ $('div.upgrading div[name="processing"] div.processedBar')[0].style.width = percent + '%';
+ $('div.upgrading').attr('title', processing.name).show();
+ }
+ else {
+ //Select nothing, show replay progress
+ if (Game.replayFlag && Game.endTick > 0) {
+ $('div.upgrading div[name="icon"]')[0].className = 'Replay';
+ var percent = (Game.mainTick * 100 / (Game.endTick) + 0.5) >> 0;
+ $('div.upgrading div[name="processing"] span')[0].innerHTML = percent;
+ $('div.upgrading div[name="processing"] div.processedBar')[0].style.width = percent + '%';
+ $('div.upgrading').attr('title', 'Replay Progress').show();
+ if (!(Game.selectedUnit instanceof Gobj)) {
+ $('div.infoRight').show();
+ $('div.upgraded').hide();
}
- //DrawLayerBottom: Draw info box and resource box
- Game.drawInfoBox();
- Game.drawSourceBox();
- Game.drawProcessingBox();
- /************ Calculate for next frame *************/
- //Clock ticking
- Game.mainTick++;
- //For network mode
- if (Multiplayer.ON){
- //Send current tick to server
- Multiplayer.webSocket.send(JSON.stringify({
- type:'tick',
- tick:Game.mainTick,
- cmds:(Multiplayer.cmds.length?Multiplayer.cmds:null)
- }));
+ }
+ else
+ $('div.upgrading').removeAttr('title').hide();
+ }
+}
+refreshMultiSelectBox: function () {
+ var divs = $('div.override div.multiSelection div');
+ //Only refresh border color on current multiSelect box
+ for (var n = 0; n < divs.length; n++) {
+ divs[n].style.borderColor = Game.allSelected[n].lifeStatus();
+ }
+}
+drawMultiSelectBox: function () {
+ //Clear old icons
+ $('div.override div.multiSelection')[0].innerHTML = '';
+ //Redraw all icons
+ Game.allSelected.forEach(function (chara, N) {
+ var node = document.createElement('div');
+ node.setAttribute('name', 'portrait');
+ //Override portrait
+ if (chara.portrait)
+ node.className = chara.portrait;
+ else
+ node.className = (chara instanceof Building) ? (chara.attack ? chara.inherited.inherited.name : chara.inherited.name) : chara.name;
+ node.title = chara.name;
+ node.style.borderColor = chara.lifeStatus();
+ node.onclick = function () {
+ //Selection execute
+ Game.unselectAll();
+ Game.changeSelectedTo(chara);
+ //Single selection mode
+ $('div.override').hide();
+ $('div.override div.multiSelection').hide();
+ };
+ $('div.override div.multiSelection')[0].appendChild(node);
+ });
+ var iconNum = $('div.override div.multiSelection div').length;
+ //Adjust width if unit icon space overflow
+ $('div.override div.multiSelection').css('width', (iconNum > 12 ? Math.ceil(iconNum / 2) * 55 : 330) + 'px');
+ //Adjust background position after added into DOM, nth starts from 1st(no 0th)
+ for (var n = 1; n <= iconNum; n++) {
+ var bgPosition = $('div.override div.multiSelection div:nth-child(' + n + ')').css('background-position');
+ bgPosition = bgPosition.split(' ').map(function (pos) {
+ return parseInt(pos) * 0.75 + 'px';
+ }).join(' ');
+ $('div.override div.multiSelection div:nth-child(' + n + ')').css('background-position', bgPosition);
+ }
+}
+animation: function () {
+ Game.animation.loop = function () {
+ //Process due commands for current frame before drawing
+ var commands = Game.commands[Game.mainTick];
+ if (commands instanceof Array) {
+ for (var N = 0; N < commands.length; N++) {
+ commands[N]();
}
- else {
- //Record user moves and execute if have
- if (Multiplayer.cmds.length>0) {
- //MainTick++ just before this code piece
- Game.replay[Game.mainTick]=$.extend([],Multiplayer.cmds);
- //Execute command
- Multiplayer.parseTickCmd({
- tick:Game.mainTick,
- cmds:Multiplayer.cmds
- });
- }
+ delete Game.commands[Game.mainTick];
+ }
+ /************ Draw part *************/
+ //Clear all canvas
+ Game.cxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
+ Game.frontCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
+ //DrawLayer0: Refresh map if needed
+ if (mouseController.mouseX < Map.triggerMargin)
+ Map.needRefresh = "LEFT";
+ if (mouseController.mouseX > (Game.HBOUND - Map.triggerMargin))
+ Map.needRefresh = "RIGHT";
+ if (mouseController.mouseY < Map.triggerMargin)
+ Map.needRefresh = "TOP";
+ if (mouseController.mouseY > (Game.VBOUND - Map.triggerMargin))
+ Map.needRefresh = "BOTTOM";
+ if (Map.needRefresh) {
+ Map.refresh(Map.needRefresh);
+ Map.needRefresh = false;
+ }
+ //DrawLayer1: Show all buildings
+ for (var N = 0; N < Building.allBuildings.length; N++) {
+ var build = Building.allBuildings[N];
+ //GC
+ if (build.status == "dead") {
+ Building.allBuildings.splice(N, 1);
+ N--; //Next unit come to this position
+ continue;
}
- //Clear commands
- if (Multiplayer.cmds.length>0){
- Multiplayer.cmds=[];
+ //Draw
+ Game.draw(build);
+ }
+ //DrawLayer2: Show all existed units
+ for (var N = 0; N < Unit.allUnits.length; N++) {
+ var chara = Unit.allUnits[N];
+ //GC
+ if (chara.status == "dead") {
+ Unit.allUnits.splice(N, 1);
+ N--;
+ continue;
}
- //Postpone play frames and AI after drawing (consume time)
- Building.allBuildings.concat(Unit.allUnits).concat(Bullets.allBullets).concat(Burst.allEffects).forEach(function(chara){
- //Add this makes chara intelligent for attack
- if (chara.AI) chara.AI();
- //Judge reach destination
- if (chara instanceof Unit) Referee.judgeReachDestination(chara);
- //Join timers together
- chara.playFrames();
- });
- //Will invite Mr.Referee to make some judgments
- Referee.tasks.forEach(function(task){
- Referee[task]();
- });
- //Release selected unit when unit died or is invisible enemy
- if (Game.selectedUnit instanceof Gobj){
- if (Game.selectedUnit.status=="dead" || (Game.selectedUnit['isInvisible'+Game.team] && Game.selectedUnit.isEnemy())) {
- Game.selectedUnit.selected=false;
- Game.changeSelectedTo({});
- }
+ //Draw
+ Game.draw(chara);
+ }
+ //DrawLayer3: Draw all bullets
+ for (var N = 0; N < Bullets.allBullets.length; N++) {
+ var bullet = Bullets.allBullets[N];
+ //GC
+ if (bullet.status == "dead" && bullet.used) {
+ Bullets.allBullets.splice(N, 1);
+ N--;
+ continue;
}
- };
- if (Multiplayer.ON){
- Game._timer=setInterval(function(){
- if (Game.mainTick 0) {
+ //MainTick++ just before this code piece
+ Game.replay[Game.mainTick] = $.extend([], Multiplayer.cmds);
+ //Execute command
+ Multiplayer.parseTickCmd({
+ tick: Game.mainTick,
+ cmds: Multiplayer.cmds
+ });
+ }
}
- $('div#GamePlay').fadeOut(3000,function(){
- Game.stop(Unit.allUnits);
- //Lose poster
- Game.layerSwitchTo("GameLose");
- new Audio(Game.CDN+'bgm/GameLose.wav').play();
+ //Clear commands
+ if (Multiplayer.cmds.length > 0) {
+ Multiplayer.cmds = [];
+ }
+ //Postpone play frames and AI after drawing (consume time)
+ Building.allBuildings.concat(Unit.allUnits).concat(Bullets.allBullets).concat(Burst.allEffects).forEach(function (chara) {
+ //Add this makes chara intelligent for attack
+ if (chara.AI)
+ chara.AI();
+ //Judge reach destination
+ if (chara instanceof Unit)
+ Referee.judgeReachDestination(chara);
+ //Join timers together
+ chara.playFrames();
});
- //Self destruction to prevent duplicate fadeout
- Game.lose=function(){};
- },
- saveReplay:function(replayData){
- if (!Game.replayFlag) {
- localStorage.setItem('lastReplay',JSON.stringify({
- level:Game.level,
- team:Game.team,
- //Save Game.replay by default
- cmds:(replayData!=null)?replayData:(Game.replay),
- end:Game.mainTick
- }));
+ //Will invite Mr.Referee to make some judgments
+ Referee.tasks.forEach(function (task) {
+ Referee[task]();
+ });
+ //Release selected unit when unit died or is invisible enemy
+ if (Game.selectedUnit instanceof Gobj) {
+ if (Game.selectedUnit.status == "dead" || (Game.selectedUnit['isInvisible' + Game.team] && Game.selectedUnit.isEnemy())) {
+ Game.selectedUnit.selected = false;
+ Game.changeSelectedTo({});
+ }
}
- },
- showWarning:function(msg,interval){
+ };
+ if (Multiplayer.ON) {
+ Game._timer = setInterval(function () {
+ if (Game.mainTick < Game.serverTick)
+ Game.animation.loop();
+ }, Game._frameInterval);
+ }
+ else
+ Game.startAnimation();
+}
+stopAnimation: function () {
+ if (Game._timer != -1)
+ clearInterval(Game._timer);
+ Game._timer = -1;
+}
+startAnimation: function () {
+ if (Game._timer == -1)
+ Game._timer = setInterval(Game.animation.loop, Game._frameInterval);
+}
+stop: function (charas) {
+ charas.forEach(function (chara) {
+ chara.stop();
+ });
+ Game.stopAnimation();
+}
+win: function () {
+ if (Multiplayer.ON) {
+ Multiplayer.webSocket.send(JSON.stringify({
+ type: 'getReplay'
+ }));
+ }
+ else {
+ Game.saveReplay();
+ Game.saveReplayIntoDB();
+ }
+ $('div#GamePlay').fadeOut(3000, function () {
+ Game.stop(Unit.allUnits);
+ //Win poster
+ Game.layerSwitchTo("GameWin");
+ new Audio(Game.CDN + 'bgm/GameWin.wav').play();
+ });
+ //Self destruction to prevent duplicate fadeout
+ Game.win = function () { };
+}
+lose: function () {
+ if (Multiplayer.ON) {
+ Multiplayer.webSocket.send(JSON.stringify({
+ type: 'getReplay'
+ }));
+ }
+ else {
+ Game.saveReplay();
+ Game.saveReplayIntoDB();
+ }
+ $('div#GamePlay').fadeOut(3000, function () {
+ Game.stop(Unit.allUnits);
+ //Lose poster
+ Game.layerSwitchTo("GameLose");
+ new Audio(Game.CDN + 'bgm/GameLose.wav').play();
+ });
+ //Self destruction to prevent duplicate fadeout
+ Game.lose = function () { };
+}
+saveReplay: function (replayData) {
+ if (!Game.replayFlag) {
+ localStorage.setItem('lastReplay', JSON.stringify({
+ level: Game.level,
+ team: Game.team,
+ //Save Game.replay by default
+ cmds: (replayData != null) ? replayData : (Game.replay),
+ end: Game.mainTick
+ }));
+ }
+}
+showWarning: function (msg, interval) {
+ //Default interval
+ if (!interval)
+ interval = 3000;
+ //Show message for a period
+ $('div.warning_Box').html(msg).show();
+ //Hide message after a period
+ setTimeout(function () {
+ $('div.warning_Box').html('').hide();
+ }, interval);
+}
+showMessage: function () {
+ //Clossure timer
+ var _timer = 0;
+ return function (msg, interval) {
//Default interval
- if (!interval) interval=3000;
+ if (!interval)
+ interval = 3000;
//Show message for a period
- $('div.warning_Box').html(msg).show();
+ $('div.message_Box').append('' + msg + '
').show();
+ //Can show multiple lines together
+ if (_timer)
+ clearTimeout(_timer);
//Hide message after a period
- setTimeout(function(){
- $('div.warning_Box').html('').hide();
- },interval);
- },
- showMessage:function(){
- //Clossure timer
- var _timer=0;
- return function(msg,interval){
- //Default interval
- if (!interval) interval=3000;
- //Show message for a period
- $('div.message_Box').append(''+msg+'
').show();
- //Can show multiple lines together
- if (_timer) clearTimeout(_timer);
- //Hide message after a period
- _timer=setTimeout(function(){
- $('div.message_Box').html('').hide();
- },interval);
- };
- }(),
+ _timer = setTimeout(function () {
+ $('div.message_Box').html('').hide();
+ }, interval);
+ };
+}
+(),
//Return from 0 to 0.99
- getNextRandom:(function(){
- //Clossure variable and function
- var rands=[];
- var getRands=function(){
- //Use current tick as seed
- var seed=Game.mainTick+Game.randomSeed;
- var rands=[];
- for (var N=0;N<100;N++){
- //Seed grows up in range 100
- seed=(seed*21+3)%100;
- rands.push(seed);
- }
- return rands;
- };
- return function(){
- //If all rands used, generate new ones
- if (rands.length==0) rands=getRands();
- return rands.shift()/100;
- };
- })(),
- resizeWindow:function(){
- //Update parameters
- Game.HBOUND=innerWidth;//$('body')[0].scrollWidth
- Game.VBOUND=innerHeight;//$('body')[0].scrollHeight
- Game.infoBox.width=Game.HBOUND-295;
- Game.infoBox.y=Game.VBOUND-110;
- //Resize canvas
- $('#GamePlay>canvas').attr('width',Game.HBOUND);//Canvas width adjust
- $('#GamePlay>canvas').attr('height',Game.VBOUND-Game.infoBox.height+5);//Canvas height adjust
- //Resize panel_Info
- $('div.panel_Info')[0].style.width=((Game.HBOUND-295)+'px');
- if (Map.ready){
- //Update map inside-stroke size
- Map.insideStroke.width=(130*Game.HBOUND/Map.getCurrentMap().width)>>0;
- Map.insideStroke.height=(130*Game.VBOUND/Map.getCurrentMap().height)>>0;
- //Redraw background
- Map.drawBg();
- //Need re-calculate fog immediately
- Map.drawFogAndMinimap();
+ getNextRandom;
+(function () {
+ //Clossure variable and function
+ var rands = [];
+ var getRands = function () {
+ //Use current tick as seed
+ var seed = Game.mainTick + Game.randomSeed;
+ var rands = [];
+ for (var N = 0; N < 100; N++) {
+ //Seed grows up in range 100
+ seed = (seed * 21 + 3) % 100;
+ rands.push(seed);
}
- },
- getCurrentTs:function(){
- var now=new Date();
- var formatNum=function(num){
- if (num<10) return ('0'+num);
- else return num.toString();
- };
- var timestamp=now.getFullYear()+'-'+formatNum(now.getMonth()+1)+'-'+formatNum(now.getDate())+' '
- +formatNum(now.getHours())+':'+formatNum(now.getMinutes())+':'+formatNum(now.getSeconds());
- return timestamp;
- },
- //New H5 features demo
- pauseWhenHide:function(){
- //Add pause when hide window
- $(document).on('visibilitychange',function(){
- if ($(document).attr('hidden')!=null){
- if ($(document).attr('hidden')){
- Button.pauseHandler();
- $('title').html('Paused...');
- }
- else {
- Button.playHandler();
- $('title').html('StarCraft');
- }
+ return rands;
+ };
+ return function () {
+ //If all rands used, generate new ones
+ if (rands.length == 0)
+ rands = getRands();
+ return rands.shift() / 100;
+ };
+})(),
+ resizeWindow;
+function () {
+ //Update parameters
+ Game.HBOUND = innerWidth; //$('body')[0].scrollWidth
+ Game.VBOUND = innerHeight; //$('body')[0].scrollHeight
+ Game.infoBox.width = Game.HBOUND - 295;
+ Game.infoBox.y = Game.VBOUND - 110;
+ //Resize canvas
+ $('#GamePlay>canvas').attr('width', Game.HBOUND); //Canvas width adjust
+ $('#GamePlay>canvas').attr('height', Game.VBOUND - Game.infoBox.height + 5); //Canvas height adjust
+ //Resize panel_Info
+ $('div.panel_Info')[0].style.width = ((Game.HBOUND - 295) + 'px');
+ if (Map.ready) {
+ //Update map inside-stroke size
+ Map.insideStroke.width = (130 * Game.HBOUND / Map.getCurrentMap().width) >> 0;
+ Map.insideStroke.height = (130 * Game.VBOUND / Map.getCurrentMap().height) >> 0;
+ //Redraw background
+ Map.drawBg();
+ //Need re-calculate fog immediately
+ Map.drawFogAndMinimap();
+ }
+}
+getCurrentTs: function () {
+ var now = new Date();
+ var formatNum = function (num) {
+ if (num < 10)
+ return ('0' + num);
+ else
+ return num.toString();
+ };
+ var timestamp = now.getFullYear() + '-' + formatNum(now.getMonth() + 1) + '-' + formatNum(now.getDate()) + ' '
+ + formatNum(now.getHours()) + ':' + formatNum(now.getMinutes()) + ':' + formatNum(now.getSeconds());
+ return timestamp;
+}
+//New H5 features demo
+pauseWhenHide: function () {
+ //Add pause when hide window
+ $(document).on('visibilitychange', function () {
+ if ($(document).attr('hidden') != null) {
+ if ($(document).attr('hidden')) {
+ Button.pauseHandler();
+ $('title').html('Paused...');
+ }
+ else {
+ Button.playHandler();
+ $('title').html('StarCraft');
}
- });
- },
- initIndexDB:function(){
- window.indexedDB=(indexedDB || webkitIndexedDB || mozIndexedDB || msIndexedDB);
- var connect=indexedDB.open('StarCraftHTML5',1);
- connect.onupgradeneeded=function(evt){
- var db=evt.target.result;
- var objStore=db.createObjectStore('Replays',{keyPath:'id',autoIncrement:true});
- objStore.createIndex('levelIndex','level',{unique:false});
- objStore.createIndex('teamIndex','team',{unique:false});
- objStore.createIndex('endIndex','end',{unique:false});
- objStore.createIndex('msIndex','millisec',{unique:false});
- objStore.createIndex('tsIndex','timestamp',{unique:false});
- objStore.createIndex('offlineIndex','offline',{unique:false});
- db.close();
- }
- },
- saveReplayIntoDB:function(){
- var connect=indexedDB.open('StarCraftHTML5',1);
- connect.onsuccess=function(evt){
- var db=evt.target.result;
- var objStore=db.transaction(['Replays'],'readwrite').objectStore('Replays');
- objStore.add({
- level:Game.level,
- team:Game.team,
- cmds:Game.replay,
- end:Game.mainTick,
- millisec:new Date().getTime(),
- timestamp:Game.getCurrentTs(),
- offline:Boolean(Game.offline).toString()
- });
- db.close();
}
- }
-};
+ });
+}
+initIndexDB: function () {
+ window.indexedDB = (indexedDB || webkitIndexedDB || mozIndexedDB || msIndexedDB);
+ var connect = indexedDB.open('StarCraftHTML5', 1);
+ connect.onupgradeneeded = function (evt) {
+ var db = evt.target.result;
+ var objStore = db.createObjectStore('Replays', { keyPath: 'id', autoIncrement: true });
+ objStore.createIndex('levelIndex', 'level', { unique: false });
+ objStore.createIndex('teamIndex', 'team', { unique: false });
+ objStore.createIndex('endIndex', 'end', { unique: false });
+ objStore.createIndex('msIndex', 'millisec', { unique: false });
+ objStore.createIndex('tsIndex', 'timestamp', { unique: false });
+ objStore.createIndex('offlineIndex', 'offline', { unique: false });
+ db.close();
+ };
+}
+saveReplayIntoDB: function () {
+ var connect = indexedDB.open('StarCraftHTML5', 1);
+ connect.onsuccess = function (evt) {
+ var db = evt.target.result;
+ var objStore = db.transaction(['Replays'], 'readwrite').objectStore('Replays');
+ objStore.add({
+ level: Game.level,
+ team: Game.team,
+ cmds: Game.replay,
+ end: Game.mainTick,
+ millisec: new Date().getTime(),
+ timestamp: Game.getCurrentTs(),
+ offline: Boolean(Game.offline).toString()
+ });
+ db.close();
+ };
+}
+;
+//# sourceMappingURL=Game.js.map
\ No newline at end of file
diff --git a/GameRule/Game.ts b/GameRule/Game.ts
new file mode 100644
index 0000000..4fa69b8
--- /dev/null
+++ b/GameRule/Game.ts
@@ -0,0 +1,1191 @@
+class Game {
+ //Global variables
+ HBOUND:innerWidth,//$('body')[0].scrollWidth
+ VBOUND:innerHeight,//$('body')[0].scrollHeight
+ infoBox:{
+ x:145,
+ y:innerHeight-110,
+ width:innerWidth-295,
+ height:110
+ },
+ team:0,
+ playerNum:2,//By default
+ teams:{},
+ multiplayer:false,//By default
+ cxt:$('#middleCanvas')[0].getContext('2d'),
+ frontCxt:$('#frontCanvas')[0].getContext('2d'),
+ backCxt:$('#backCanvas')[0].getContext('2d'),
+ fogCxt:$('#fogCanvas')[0].getContext('2d'),
+ _timer:-1,
+ _frameInterval:100,
+ mainTick:0,
+ serverTick:0,
+ commands:{},
+ replay:{},
+ randomSeed:0,//For later use
+ selectedUnit:{},
+ allSelected:[],
+ _oldAllSelected:[],
+ hackMode:false,
+ isApp:false,
+ offline:false,
+ CDN:'',
+ addIntoAllSelected:function(chara,override){
+ if (chara instanceof Gobj){
+ //Add into allSelected if not included
+ if (Game.allSelected.indexOf(chara)==-1) {
+ if (override) Game.allSelected=chara;
+ else Game.allSelected.push(chara);
+ chara.selected=true;
+ }
+ }
+ //Override directly
+ if (chara instanceof Array) {
+ if (override) Game.allSelected=chara;
+ else chara.forEach(function(char){
+ //Add into allSelected if not included
+ if (Game.allSelected.indexOf(char)==-1) Game.allSelected.push(char);
+ });
+ chara.forEach(function(char){
+ char.selected=true;
+ });
+ }
+ //Sort allSelected by its name order
+ Game.allSelected.sort(function(chara1,chara2){
+ //Need sort building icon together
+ var name1=(chara1 instanceof Building)?(chara1.inherited.name+'.'+chara1.name):chara1.name;
+ var name2=(chara2 instanceof Building)?(chara2.inherited.name+'.'+chara2.name):chara2.name;
+ return ([name1,name2].sort()[0]!=name1)?1:-1;
+ });
+ //Notify referee to redraw
+ Referee.alterSelectionMode();
+ },
+ //To replace setTimeout
+ commandTimeout:function(func,delay){
+ var dueTick=Game.mainTick+(delay/100>>0);
+ if (!Game.commands[dueTick]) Game.commands[dueTick]=[];
+ Game.commands[dueTick].push(func);
+ },
+ //To replace setInterval
+ commandInterval:function(func,interval){
+ var funcAdjust=function(){
+ func();
+ Game.commandTimeout(funcAdjust,interval);
+ };
+ Game.commandTimeout(funcAdjust,interval);
+ },
+ race:{
+ selected:'Terran',//Terran race by default
+ choose:function(race){
+ this.selected=race;
+ $('div#GamePlay').attr('race',race);
+ }
+ },
+ layerSwitchTo:function(layerName){
+ $('div.GameLayer').hide();
+ $('#'+layerName).show(); //show('slow')
+ },
+ static init:function(){
+ //Prevent full select
+ $('div.GameLayer').on("selectstart",function(event){
+ event.preventDefault();
+ });
+ //Bind resize canvas handler
+ window.onresize=Game.resizeWindow;
+ /*window.requestAnimationFrame=requestAnimationFrame || webkitRequestAnimationFrame
+ || mozRequestAnimationFrame || msRequestAnimationFrame || oRequestAnimationFrame;//Old browser compatible*/
+ //Online mode
+ if (!Game.offline){
+ Game.CDN=prompt('Please input CDN location for images and audios:');
+ if (Game.CDN){
+ if (!Game.CDN.startsWith('http://')) Game.CDN='http://'+Game.CDN;
+ if (!Game.CDN.endsWith('/')) Game.CDN+='/';
+ }
+ }
+ //Start loading
+ Game.layerSwitchTo("GameLoading");
+ //Zerg
+ sourceLoader.load("img",Game.CDN+"img/Charas/Mutalisk.png","Mutalisk");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Devourer.png","Devourer");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Guardian.png","Guardian");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Overlord.png","Overlord");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Drone.png","Drone");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Zergling.png","Zergling");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Hydralisk.png","Hydralisk");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Scourge.png","Scourge");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Lurker.png","Lurker");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Ultralisk.png","Ultralisk");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Broodling.png","Broodling");
+ sourceLoader.load("img",Game.CDN+"img/Charas/InfestedTerran.png","InfestedTerran");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Queen.png","Queen");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Defiler.png","Defiler");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Larva.png","Larva");
+ //Terran
+ sourceLoader.load("img",Game.CDN+"img/Charas/BattleCruiser.png","BattleCruiser");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Wraith.png","Wraith");
+ sourceLoader.load("img",Game.CDN+"img/Charas/SCV.png","SCV");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Civilian.png","Civilian");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Marine.png","Marine");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Firebat.png","Firebat");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Ghost.png","Ghost");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Vulture.png","Vulture");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Tank.png","Tank");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Goliath.png","Goliath");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Medic.png","Medic");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Dropship.png","Dropship");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Vessel.png","Vessel");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Valkyrie.png","Valkyrie");
+ //Protoss
+ sourceLoader.load("img",Game.CDN+"img/Charas/Probe.png","Probe");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Zealot.png","Zealot");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Dragoon.png","Dragoon");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Templar.png","Templar");
+ sourceLoader.load("img",Game.CDN+"img/Charas/DarkTemplar.png","DarkTemplar");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Reaver.png","Reaver");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Archon.png","Archon");
+ sourceLoader.load("img",Game.CDN+"img/Charas/DarkArchon.png","DarkArchon");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Shuttle.png","Shuttle");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Observer.png","Observer");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Arbiter.png","Arbiter");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Scout.png","Scout");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Carrier.png","Carrier");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Corsair.png","Corsair");
+ //Neuture
+ sourceLoader.load("img",Game.CDN+"img/Charas/Ragnasaur.png","Ragnasaur");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Rhynsdon.png","Rhynsdon");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Ursadon.png","Ursadon");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Bengalaas.png","Bengalaas");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Scantid.png","Scantid");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Kakaru.png","Kakaru");
+ //Hero
+ sourceLoader.load("img",Game.CDN+"img/Charas/HeroCruiser.png","HeroCruiser");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Sarah.png","Sarah");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Kerrigan.png","Kerrigan");
+ sourceLoader.load("img",Game.CDN+"img/Charas/DevilHunter.png","DevilHunter");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Tassadar.png","Tassadar");
+ //Building
+ sourceLoader.load("img",Game.CDN+"img/Charas/ZergBuilding.png","ZergBuilding");
+ sourceLoader.load("img",Game.CDN+"img/Charas/TerranBuilding.png","TerranBuilding");
+ sourceLoader.load("img",Game.CDN+"img/Charas/ProtossBuilding.png","ProtossBuilding");
+ /*sourceLoader.load("audio","bgm/PointError.wav","PointError");*/
+ //Map
+ sourceLoader.load("img",Game.CDN+"img/Maps/(2)Switchback.jpg","Map_Switchback");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(2)Volcanis.jpg","Map_Volcanis");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(3)Trench wars.jpg","Map_TrenchWars");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(4)Blood Bath.jpg","Map_BloodBath");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(4)Orbital Relay.jpg","Map_OrbitalRelay");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(4)TowerDefense.jpg","Map_TowerDefense");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(6)Thin Ice.jpg","Map_ThinIce");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(8)BigGameHunters.jpg","Map_BigGameHunters");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(8)TheHunters.jpg","Map_TheHunters");
+ sourceLoader.load("img",Game.CDN+"img/Maps/(8)Turbo.jpg","Map_Turbo");
+ sourceLoader.load("img",Game.CDN+"img/Maps/Map_Grass.jpg","Map_Grass");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Mud.png","Mud");
+ //Extra
+ sourceLoader.load("img",Game.CDN+"img/Charas/Burst.png","Burst");
+ sourceLoader.load("img",Game.CDN+"img/Charas/BuildingBurst.png","BuildingBurst");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Portrait.png","Portrait");
+ sourceLoader.load("img",Game.CDN+"img/Charas/Magic.png","Magic");
+ sourceLoader.load("img",Game.CDN+"img/Menu/ControlPanel.png","ControlPanel");
+ sourceLoader.load("img",Game.CDN+"img/Bg/GameStart.jpg","GameStart");
+ sourceLoader.load("img",Game.CDN+"img/Bg/GameWin.jpg","GameWin");
+ sourceLoader.load("img",Game.CDN+"img/Bg/GameLose.jpg","GameLose");
+
+ sourceLoader.allOnLoad(function(){
+ $('#GameStart').prepend(sourceLoader.sources['GameStart']);
+ $('#GameWin').prepend(sourceLoader.sources['GameWin']);
+ $('#GameLose').prepend(sourceLoader.sources['GameLose']);
+ $('#GamePlay>canvas').attr('width',Game.HBOUND);//Canvas width adjust
+ $('#GamePlay>canvas').attr('height',Game.VBOUND-Game.infoBox.height+5);//Canvas height adjust
+ for (var N=1;N<=9;N++){
+ $('div.panel_Control').append("");
+ }
+ /*//Test image effect
+ AlloyImage(sourceLoader.sources['Wraith']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['Wraith']);
+ AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
+ Game.start();
+ })
+ },
+ start:function(){
+ //Game start
+ Game.layerSwitchTo("GameStart");
+ //Init level selector
+ for (var level=1; level<=Levels.length; level++){
+ $('.levelSelectionBg').append("" +
+ ""+
+ (Levels[level-1].label?(Levels[level-1].label):("Level "+level))
+ +"
");
+ }
+ //Wait for user select level and play game
+ $('input[name="levelSelect"]').click(function(){
+ //Prevent vibration
+ if (Game.level!=null) return;
+ Game.level=parseInt(this.value);
+ Game.play();
+ });
+ },
+ play:function(){
+ //Load level to initial when no error occurs
+ if (!(Levels[Game.level-1].load())){
+ //Need Game.playerNum before expansion
+ Game.expandUnitProps();
+ Resource.init();
+ //Game background
+ Game.layerSwitchTo("GamePlay");
+ Game.resizeWindow();
+ //Collect login user info
+ if (Game.hackMode) Multiplayer.sendUserInfo();
+ //Bind controller
+ mouseController.toControlAll();//Can control all units
+ keyController.start();//Start monitor
+ Game.pauseWhenHide();//Hew H5 feature:Page Visibility
+ Game.initIndexDB();//Hew H5 feature:Indexed DB
+ Game.animation();
+ }
+ },
+ getPropArray:function(prop){
+ var result=[];
+ for (var N=0;N0) Game.changeSelectedTo(inRectUnits[0]);
+ else Game.changeSelectedTo({});
+ Game.addIntoAllSelected(inRectUnits,true);
+ },
+ getSelectedOne:function(clickX,clickY,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
+ var distance=function(chara){
+ return (clickX-chara.posX())*(clickX-chara.posX())+(clickY-chara.posY())*(clickY-chara.posY());//Math.pow2
+ };
+ //Initial
+ var selectedOne={},charas=[];
+ switch (unitBuildingFilter){
+ case true:
+ charas=Unit.allUnits;
+ break;
+ case false:
+ charas=Building.allBuildings;
+ break;
+ default:
+ charas=Unit.allUnits.concat(Building.allBuildings);
+ }
+ switch (isEnemyFilter){
+ case true:case false:
+ charas=charas.filter(function(chara){
+ return chara.isEnemy()==isEnemyFilter;
+ });
+ break;
+ case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:
+ charas=charas.filter(function(chara){
+ return chara.team==isEnemyFilter;
+ });
+ break;
+ case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':
+ charas=charas.filter(function(chara){
+ return chara.team!=isEnemyFilter;
+ });
+ }
+ if (isFlyingFilter!=null) {
+ charas=charas.filter(function(chara){
+ return chara.isFlying==isFlyingFilter;
+ });
+ }
+ //customFilter is filter function
+ if (customFilter!=null){
+ charas=charas.filter(customFilter);
+ }
+ //Find nearest one
+ selectedOne=charas.filter(function(chara){
+ return chara.status!='dead' && chara.includePoint(clickX,clickY);
+ }).sort(function(chara1,chara2){
+ return distance(chara1)-distance(chara2);
+ })[0];
+ if (!selectedOne) selectedOne={};
+ return selectedOne;
+ },
+ getInRangeOnes:function(clickX,clickY,range,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
+ //Initial
+ var selectedOnes=[],charas=[];
+ switch (unitBuildingFilter){
+ case true:
+ charas=Unit.allUnits;
+ break;
+ case false:
+ charas=Building.allBuildings;
+ break;
+ default:
+ charas=Unit.allUnits.concat(Building.allBuildings);
+ }
+ switch (isEnemyFilter){
+ case true:case false:
+ charas=charas.filter(function(chara){
+ return chara.isEnemy()==isEnemyFilter;
+ });
+ break;
+ case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:
+ charas=charas.filter(function(chara){
+ return chara.team==isEnemyFilter;
+ });
+ break;
+ case '0':case '1':case '2':case '3':case '4':case '5':case '6':case '7':
+ charas=charas.filter(function(chara){
+ return chara.team!=isEnemyFilter;
+ });
+ }
+ if (isFlyingFilter!=null) {
+ charas=charas.filter(function(chara){
+ return chara.isFlying==isFlyingFilter;
+ });
+ }
+ //customFilter is filter function
+ if (customFilter!=null){
+ charas=charas.filter(customFilter);
+ }
+ //Find in range ones
+ selectedOnes=charas.filter(function(chara){
+ return chara.status!='dead' && chara.insideSquare({centerX:clickX,centerY:clickY,radius:range});
+ });
+ return selectedOnes;
+ },
+ //For test use
+ getSelected:function(){
+ return Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
+ return chara.selected;
+ });
+ },
+ showInfoFor:function(chara){
+ //Show selected living unit info
+ if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
+ //Display info
+ $('div.panel_Info>div[class*="info"]').show();
+ //Draw selected unit portrait
+ if (chara.portrait) $('div.infoLeft div[name="portrait"]')[0].className=chara.portrait;//Override portrait
+ else {
+ if (Game.selectedUnit instanceof Unit)
+ $('div.infoLeft div[name="portrait"]')[0].className=Game.selectedUnit.name;
+ if (Game.selectedUnit instanceof Building)
+ $('div.infoLeft div[name="portrait"]')[0].className=
+ Game.selectedUnit.attack?Game.selectedUnit.inherited.inherited.name:Game.selectedUnit.inherited.name;
+ }
+ //Show selected unit HP,SP and MP
+ $('div.infoLeft span._Health')[0].style.color=Game.selectedUnit.lifeStatus();
+ $('div.infoLeft span.life')[0].innerHTML=Game.selectedUnit.life>>0;
+ $('div.infoLeft span.HP')[0].innerHTML=Game.selectedUnit.get('HP');
+ if (Game.selectedUnit.SP) {
+ $('div.infoLeft span.shield')[0].innerHTML=Game.selectedUnit.shield>>0;
+ $('div.infoLeft span.SP')[0].innerHTML=Game.selectedUnit.get('SP');
+ $('div.infoLeft span._Shield').show();
+ }
+ else {
+ $('div.infoLeft span._Shield').hide();
+ }
+ if (Game.selectedUnit.MP) {
+ $('div.infoLeft span.magic')[0].innerHTML=Game.selectedUnit.magic>>0;
+ $('div.infoLeft span.MP')[0].innerHTML=Game.selectedUnit.get('MP');
+ $('div.infoLeft span._Magic').show();
+ }
+ else {
+ $('div.infoLeft span._Magic').hide();
+ }
+ //Draw selected unit name,kill,damage,armor and shield
+ $('div.infoCenter h3.name')[0].innerHTML=Game.selectedUnit.name;
+ if (Game.selectedUnit.detector) {
+ $('div.infoCenter p.detector').show();
+ }
+ else {
+ $('div.infoCenter p.detector').hide();
+ }
+ if (Game.selectedUnit.attack){
+ $('div.infoCenter p.kill span')[0].innerHTML=Game.selectedUnit.kill;
+ if (Game.selectedUnit.attackMode) {
+ $('div.infoCenter p.damage span')[0].innerHTML=(Game.selectedUnit.get('attackMode.ground.damage')+'/'+Game.selectedUnit.get('attackMode.flying.damage'));
+ }
+ else {
+ $('div.infoCenter p.damage span')[0].innerHTML=(Game.selectedUnit.get('damage')+(Game.selectedUnit.suicide?' (1)':''));
+ }
+ //Show kill and damage
+ $('div.infoCenter p.kill').show();
+ $('div.infoCenter p.damage').show();
+ }
+ else {
+ //Hide kill and damage
+ $('div.infoCenter p.kill').hide();
+ $('div.infoCenter p.damage').hide();
+ }
+ $('div.infoCenter p.armor span')[0].innerHTML=Game.selectedUnit.get('armor');
+ if (Game.selectedUnit.get('plasma')!=undefined) {
+ $('div.infoCenter p.plasma span')[0].innerHTML=Game.selectedUnit.get('plasma');
+ $('div.infoCenter p.plasma').show();
+ }
+ else {
+ $('div.infoCenter p.plasma').hide();
+ }
+ //Can disable this filter for testing
+ if (Game.selectedUnit.loadedUnits && Game.selectedUnit.team==Game.team) {
+ $('div.infoCenter p.passenger span')[0].innerHTML=Game.selectedUnit.loadedUnits.length;
+ $('div.infoCenter p.passenger').show();
+ //Clear old icons
+ $('div.infoCenter p.icons')[0].innerHTML='';
+ //Show passenger icons
+ Game.selectedUnit.loadedUnits.forEach(function(passenger){
+ $('div.infoCenter p.icons').append($('')
+ .attr('class',passenger.name).css('border-color',passenger.lifeStatus()));
+ });
+ $('div.infoCenter p.icons').show();
+ }
+ else {
+ $('div.infoCenter p.passenger').hide();
+ $('div.infoCenter p.icons').hide();
+ }
+ //Draw upgraded
+ var upgraded=Game.selectedUnit.upgrade;
+ var team=Game.selectedUnit.team;
+ if (upgraded){
+ for (var N=0;N<3;N++){
+ var upgradeIcon=$('div.upgraded div[name="icon"]')[N];
+ upgradeIcon.innerHTML='';
+ upgradeIcon.style.display='none';
+ if (Ndiv').hide();
+ }
+ },
+ refreshInfo:function(){
+ Game.showInfoFor(Game.selectedUnit);
+ },
+ changeSelectedTo:function(chara){
+ Game.selectedUnit=chara;
+ Button.equipButtonsFor(chara);
+ if (chara instanceof Gobj){
+ chara.selected=true;
+ }
+ Game.showInfoFor(chara);
+ },
+ draw:function(chara){
+ //Can draw units and no-rotate bullets
+ if (!(chara instanceof Gobj)) return;//Will only show Gobj
+ if (chara.status=="dead") return;//Will not show dead
+ //Won't draw units outside screen
+ if (!chara.insideScreen()) return;
+ //Choose context
+ var cxt=((chara instanceof Unit) || (chara instanceof Building))?Game.cxt:Game.frontCxt;
+ //Draw shadow
+ cxt.save();
+ //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ cxt.shadowOffsetX=(chara.isFlying)?5:3;
+ cxt.shadowOffsetY=(chara.isFlying)?20:8;
+ cxt.shadowColor="rgba(0,0,0,0.4)";
+ //Close shadow for burrowed
+ if (chara.buffer.Burrow) cxt.shadowOffsetX=cxt.shadowOffsetY=0;
+ //Draw invisible
+ if (chara['isInvisible'+Game.team]!=null){
+ cxt.globalAlpha=(chara.isEnemy() && chara['isInvisible'+Game.team])?0:0.5;
+ if (chara.burrowBuffer){
+ if (chara.isEnemy()){
+ if (!chara['isInvisible'+Game.team]) cxt.globalAlpha=1;
+ }
+ else cxt.globalAlpha=1;
+ }
+ }
+ //Draw unit or building
+ var imgSrc;
+ if (chara instanceof Building){
+ if (chara.source) imgSrc=sourceLoader.sources[chara.source];
+ else {
+ imgSrc=sourceLoader.sources[chara.attack?chara.inherited.inherited.name:chara.inherited.name];
+ }
+ }
+ //Unit, not building
+ else imgSrc=sourceLoader.sources[chara.source?chara.source:chara.name];
+ //Convert position
+ var charaX=(chara.x-Map.offsetX)>>0;
+ var charaY=(chara.y-Map.offsetY)>>0;
+ //Same image in different directions
+ if (chara.direction==undefined){
+ var _left=chara.imgPos[chara.status].left;
+ var _top=chara.imgPos[chara.status].top;
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array){
+ cxt.drawImage(imgSrc,
+ _left[chara.action],_top[chara.action],chara.width,chara.height,
+ charaX,charaY,chara.width,chara.height);
+ }
+ //One action status
+ else{
+ cxt.drawImage(imgSrc,
+ _left,_top,chara.width,chara.height,
+ charaX,charaY,chara.width,chara.height);
+ }
+ }
+ //Different image in different directions
+ else{
+ var _left=chara.imgPos[chara.status].left[chara.direction];
+ var _top=chara.imgPos[chara.status].top[chara.direction];
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array){
+ cxt.drawImage(imgSrc,
+ _left[chara.action],_top[chara.action],chara.width,chara.height,
+ charaX,charaY,chara.width,chara.height);
+ }
+ //One action status
+ else{
+ cxt.drawImage(imgSrc,
+ _left,_top,chara.width,chara.height,
+ charaX,charaY,chara.width,chara.height);
+ }
+ }
+ //Remove shadow
+ cxt.restore();
+ //Draw HP if has selected and is true
+ if (chara.selected==true){
+ cxt=Game.frontCxt;
+ //Draw selected circle
+ cxt.strokeStyle=(chara.isEnemy())?"red":"green";//Distinguish enemy
+ cxt.lineWidth=2;//Cannot see 1px width circle clearly
+ cxt.beginPath();
+ cxt.arc(chara.posX()-Map.offsetX,chara.posY()-Map.offsetY,chara.radius(),0,2*Math.PI);
+ cxt.stroke();
+ //Draw HP bar and SP bar and magic bar
+ cxt.globalAlpha=1;
+ cxt.lineWidth=1;
+ var offsetY=-6-(chara.MP?5:0)-(chara.SP?5:0);
+ var lifeRatio=chara.life/chara.get('HP');
+ cxt.strokeStyle="black";
+ if (chara.SP) {
+ //Draw HP and SP
+ cxt.fillStyle="blue";
+ cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width*chara.shield/chara.get('SP'),5);
+ cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width,5);
+ cxt.fillStyle=(lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red";//Distinguish life
+ cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+5,chara.width*lifeRatio,5);
+ cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+5,chara.width,5);
+ }
+ else {
+ //Only draw HP
+ cxt.fillStyle=(lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red";//Distinguish life
+ cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width*lifeRatio,5);
+ cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY,chara.width,5);
+ }
+ if (chara.MP) {
+ //Draw MP
+ cxt.fillStyle="darkviolet";
+ cxt.fillRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+(chara.SP?10:5),chara.width*chara.magic/chara.get('MP'),5);
+ cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+(chara.SP?10:5),chara.width,5);
+ }
+ }
+ },
+ drawEffect:function(chara){
+ //Can draw units and no-rotate bullets
+ if (!(chara instanceof Burst)) return;//Will only show Burst
+ if (chara.status=="dead") return;//Will not show dead
+ //Won't draw units outside screen
+ if (!chara.insideScreen()) return;
+ //Choose context
+ var cxt=Game.frontCxt;
+ //Draw shadow
+ cxt.save();
+ //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ cxt.shadowOffsetX=(chara.isFlying)?5:3;
+ cxt.shadowOffsetY=(chara.isFlying)?20:8;
+ cxt.shadowColor="rgba(0,0,0,0.4)";
+ var imgSrc=sourceLoader.sources[chara.name];
+ //Convert position
+ var charaX=(chara.x-Map.offsetX)>>0;
+ var charaY=(chara.y-Map.offsetY)>>0;
+ var _left=chara.imgPos[chara.status].left;
+ var _top=chara.imgPos[chara.status].top;
+ //Will stretch effect if scale
+ var times=chara.scale?chara.scale:1;
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array){
+ cxt.drawImage(imgSrc,
+ _left[chara.action],_top[chara.action],chara.width,chara.height,
+ charaX,charaY,chara.width*times>>0,chara.height*times>>0);
+ }
+ //One action status
+ else{
+ cxt.drawImage(imgSrc,
+ _left,_top,chara.width,chara.height,
+ charaX,charaY,chara.width*times>>0,chara.height*times>>0);
+ }
+ //Remove shadow
+ cxt.restore();
+ },
+ drawBullet:function(chara){
+ //Can draw bullets need rotate
+ if (!(chara instanceof Bullets)) return;//Will only show bullet
+ if (chara.status=="dead") return;//Will not show dead
+ //Won't draw bullets outside screen
+ if (!chara.insideScreen()) return;
+ //Draw unit
+ var imgSrc=sourceLoader.sources[chara.name];
+ var _left=chara.imgPos[chara.status].left;
+ var _top=chara.imgPos[chara.status].top;
+ //Convert position
+ var centerX=(chara.posX()-Map.offsetX)>>0;
+ var centerY=(chara.posY()-Map.offsetY)>>0;
+ //Rotate canvas
+ Game.frontCxt.save();
+ //Rotate to draw bullet
+ Game.frontCxt.translate(centerX,centerY);
+ Game.frontCxt.rotate(-chara.angle);
+ //Draw shadow
+ //Game.frontCxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ Game.frontCxt.shadowOffsetX=(chara.owner.isFlying)?5:3;
+ Game.frontCxt.shadowOffsetY=(chara.owner.isFlying)?20:5;
+ Game.frontCxt.shadowColor="rgba(0,0,0,0.4)";
+ //Game.frontCxt.shadowColor="rgba(255,0,0,1)";
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array){
+ Game.frontCxt.drawImage(imgSrc,
+ _left[chara.action],_top[chara.action],chara.width,chara.height,
+ -chara.width/2>>0,-chara.height/2>>0,chara.width,chara.height);
+ }
+ //One action status
+ else{
+ Game.frontCxt.drawImage(imgSrc,
+ _left,_top,chara.width,chara.height,
+ -chara.width/2>>0,-chara.height/2>>0,chara.width,chara.height);
+ }
+ //Rotate canvas back and remove shadow
+ Game.frontCxt.restore();
+ //Below 2 separated steps might cause mess
+ //Game.frontCxt.translate(-centerX,-centerY);
+ //Game.frontCxt.rotate(chara.angle);
+ },
+ drawInfoBox:function(){
+ //Update selected unit active info which need refresh
+ if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
+ //Update selected unit life,shield and magic
+ var lifeRatio=Game.selectedUnit.life/Game.selectedUnit.get('HP');
+ $('div.infoLeft span._Health')[0].style.color=((lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red");
+ $('div.infoLeft span.life')[0].innerHTML=Game.selectedUnit.life>>0;
+ if (Game.selectedUnit.SP) {
+ $('div.infoLeft span.shield')[0].innerHTML=Game.selectedUnit.shield>>0;
+ }
+ if (Game.selectedUnit.MP) {
+ $('div.infoLeft span.magic')[0].innerHTML=Game.selectedUnit.magic>>0;
+ }
+ //Update selected unit kill
+ if (Game.selectedUnit.kill!=null){
+ $('div.infoCenter p.kill span')[0].innerHTML=Game.selectedUnit.kill;
+ }
+ }
+ },
+ drawSourceBox:function(){
+ //Update min, gas, curMan and totalMan
+ $('div.resource_Box span.mineNum')[0].innerHTML=Resource[Game.team].mine;
+ $('div.resource_Box span.gasNum')[0].innerHTML=Resource[Game.team].gas;
+ $('div.resource_Box span.manNum>span')[0].innerHTML=Resource[Game.team].curMan;
+ $('div.resource_Box span.manNum>span')[1].innerHTML=Resource[Game.team].totalMan;
+ //Check if man overflow
+ $('div.resource_Box span.manNum')[0].style.color=(Resource[Game.team].curMan>Resource[Game.team].totalMan)?"red":"#00ff00";
+ },
+ drawProcessingBox:function(){
+ //Show processing box if it's processing
+ var processing=Game.selectedUnit.processing;
+ //Can disable this filter for testing
+ if (processing && Game.selectedUnit.team==Game.team){
+ $('div.upgrading div[name="icon"]')[0].className=processing.name;
+ //var percent=((new Date().getTime()-processing.startTime)/(processing.time)+0.5)>>0;
+ var percent=((Game.mainTick-processing.startTime)*100/(processing.time)+0.5)>>0;
+ $('div.upgrading div[name="processing"] span')[0].innerHTML=percent;
+ $('div.upgrading div[name="processing"] div.processedBar')[0].style.width=percent+'%';
+ $('div.upgrading').attr('title',processing.name).show();
+ }
+ else {
+ //Select nothing, show replay progress
+ if (Game.replayFlag && Game.endTick>0){
+ $('div.upgrading div[name="icon"]')[0].className='Replay';
+ var percent=(Game.mainTick*100/(Game.endTick)+0.5)>>0;
+ $('div.upgrading div[name="processing"] span')[0].innerHTML=percent;
+ $('div.upgrading div[name="processing"] div.processedBar')[0].style.width=percent+'%';
+ $('div.upgrading').attr('title','Replay Progress').show();
+ if (!(Game.selectedUnit instanceof Gobj)){
+ $('div.infoRight').show();
+ $('div.upgraded').hide();
+ }
+ }
+ else $('div.upgrading').removeAttr('title').hide();
+ }
+ },
+ refreshMultiSelectBox:function(){
+ var divs=$('div.override div.multiSelection div');
+ //Only refresh border color on current multiSelect box
+ for (var n=0;n12?Math.ceil(iconNum/2)*55:330)+'px');
+ //Adjust background position after added into DOM, nth starts from 1st(no 0th)
+ for (var n=1;n<=iconNum;n++){
+ var bgPosition=$('div.override div.multiSelection div:nth-child('+n+')').css('background-position');
+ bgPosition=bgPosition.split(' ').map(function(pos){
+ return parseInt(pos)*0.75+'px';
+ }).join(' ');
+ $('div.override div.multiSelection div:nth-child('+n+')').css('background-position',bgPosition);
+ }
+ },
+ animation:function(){
+ Game.animation.loop=function(){
+ //Process due commands for current frame before drawing
+ var commands=Game.commands[Game.mainTick];
+ if (commands instanceof Array){
+ for (var N=0;N(Game.HBOUND-Map.triggerMargin)) Map.needRefresh="RIGHT";
+ if (mouseController.mouseY(Game.VBOUND-Map.triggerMargin)) Map.needRefresh="BOTTOM";
+ if (Map.needRefresh) {
+ Map.refresh(Map.needRefresh);
+ Map.needRefresh=false;
+ }
+ //DrawLayer1: Show all buildings
+ for (var N=0;N0) {
+ //MainTick++ just before this code piece
+ Game.replay[Game.mainTick]=$.extend([],Multiplayer.cmds);
+ //Execute command
+ Multiplayer.parseTickCmd({
+ tick:Game.mainTick,
+ cmds:Multiplayer.cmds
+ });
+ }
+ }
+ //Clear commands
+ if (Multiplayer.cmds.length>0){
+ Multiplayer.cmds=[];
+ }
+ //Postpone play frames and AI after drawing (consume time)
+ Building.allBuildings.concat(Unit.allUnits).concat(Bullets.allBullets).concat(Burst.allEffects).forEach(function(chara){
+ //Add this makes chara intelligent for attack
+ if (chara.AI) chara.AI();
+ //Judge reach destination
+ if (chara instanceof Unit) Referee.judgeReachDestination(chara);
+ //Join timers together
+ chara.playFrames();
+ });
+ //Will invite Mr.Referee to make some judgments
+ Referee.tasks.forEach(function(task){
+ Referee[task]();
+ });
+ //Release selected unit when unit died or is invisible enemy
+ if (Game.selectedUnit instanceof Gobj){
+ if (Game.selectedUnit.status=="dead" || (Game.selectedUnit['isInvisible'+Game.team] && Game.selectedUnit.isEnemy())) {
+ Game.selectedUnit.selected=false;
+ Game.changeSelectedTo({});
+ }
+ }
+ };
+ if (Multiplayer.ON){
+ Game._timer=setInterval(function(){
+ if (Game.mainTick'+msg+'
').show();
+ //Can show multiple lines together
+ if (_timer) clearTimeout(_timer);
+ //Hide message after a period
+ _timer=setTimeout(function(){
+ $('div.message_Box').html('').hide();
+ },interval);
+ };
+ }(),
+ //Return from 0 to 0.99
+ getNextRandom:(function(){
+ //Clossure variable and function
+ var rands=[];
+ var getRands=function(){
+ //Use current tick as seed
+ var seed=Game.mainTick+Game.randomSeed;
+ var rands=[];
+ for (var N=0;N<100;N++){
+ //Seed grows up in range 100
+ seed=(seed*21+3)%100;
+ rands.push(seed);
+ }
+ return rands;
+ };
+ return function(){
+ //If all rands used, generate new ones
+ if (rands.length==0) rands=getRands();
+ return rands.shift()/100;
+ };
+ })(),
+ resizeWindow:function(){
+ //Update parameters
+ Game.HBOUND=innerWidth;//$('body')[0].scrollWidth
+ Game.VBOUND=innerHeight;//$('body')[0].scrollHeight
+ Game.infoBox.width=Game.HBOUND-295;
+ Game.infoBox.y=Game.VBOUND-110;
+ //Resize canvas
+ $('#GamePlay>canvas').attr('width',Game.HBOUND);//Canvas width adjust
+ $('#GamePlay>canvas').attr('height',Game.VBOUND-Game.infoBox.height+5);//Canvas height adjust
+ //Resize panel_Info
+ $('div.panel_Info')[0].style.width=((Game.HBOUND-295)+'px');
+ if (Map.ready){
+ //Update map inside-stroke size
+ Map.insideStroke.width=(130*Game.HBOUND/Map.getCurrentMap().width)>>0;
+ Map.insideStroke.height=(130*Game.VBOUND/Map.getCurrentMap().height)>>0;
+ //Redraw background
+ Map.drawBg();
+ //Need re-calculate fog immediately
+ Map.drawFogAndMinimap();
+ }
+ },
+ getCurrentTs:function(){
+ var now=new Date();
+ var formatNum=function(num){
+ if (num<10) return ('0'+num);
+ else return num.toString();
+ };
+ var timestamp=now.getFullYear()+'-'+formatNum(now.getMonth()+1)+'-'+formatNum(now.getDate())+' '
+ +formatNum(now.getHours())+':'+formatNum(now.getMinutes())+':'+formatNum(now.getSeconds());
+ return timestamp;
+ },
+ //New H5 features demo
+ pauseWhenHide:function(){
+ //Add pause when hide window
+ $(document).on('visibilitychange',function(){
+ if ($(document).attr('hidden')!=null){
+ if ($(document).attr('hidden')){
+ Button.pauseHandler();
+ $('title').html('Paused...');
+ }
+ else {
+ Button.playHandler();
+ $('title').html('StarCraft');
+ }
+ }
+ });
+ },
+ initIndexDB:function(){
+ window.indexedDB=(indexedDB || webkitIndexedDB || mozIndexedDB || msIndexedDB);
+ var connect=indexedDB.open('StarCraftHTML5',1);
+ connect.onupgradeneeded=function(evt){
+ var db=evt.target.result;
+ var objStore=db.createObjectStore('Replays',{keyPath:'id',autoIncrement:true});
+ objStore.createIndex('levelIndex','level',{unique:false});
+ objStore.createIndex('teamIndex','team',{unique:false});
+ objStore.createIndex('endIndex','end',{unique:false});
+ objStore.createIndex('msIndex','millisec',{unique:false});
+ objStore.createIndex('tsIndex','timestamp',{unique:false});
+ objStore.createIndex('offlineIndex','offline',{unique:false});
+ db.close();
+ }
+ },
+ saveReplayIntoDB:function(){
+ var connect=indexedDB.open('StarCraftHTML5',1);
+ connect.onsuccess=function(evt){
+ var db=evt.target.result;
+ var objStore=db.transaction(['Replays'],'readwrite').objectStore('Replays');
+ objStore.add({
+ level:Game.level,
+ team:Game.team,
+ cmds:Game.replay,
+ end:Game.mainTick,
+ millisec:new Date().getTime(),
+ timestamp:Game.getCurrentTs(),
+ offline:Boolean(Game.offline).toString()
+ });
+ db.close();
+ }
+ }
+};
diff --git a/GameRule/Levels.js b/GameRule/Levels.js
index b550ea7..7dcc2ff 100644
--- a/GameRule/Levels.js
+++ b/GameRule/Levels.js
@@ -1,109 +1,110 @@
-var Levels=[
+var Levels = [
{
- level:1,
- load:function(){
+ level: 1,
+ load: function () {
//Load map
Map.setCurrentMap('Switchback');
//Choose side and apply race style
- var races=['Terran','Zerg'];
- var startPoint=[{x:50,y:50},{x:200,y:50}];
- if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ var races = ['Terran', 'Zerg'];
+ var startPoint = [{ x: 50, y: 50 }, { x: 200, y: 50 }];
+ if (!Game.replayFlag)
+ Game.team = Math.random() * 2 >> 0;
Game.race.choose(races[Game.team]);
- Map.offsetX=startPoint[Game.team].x;
- Map.offsetY=startPoint[Game.team].y;
+ Map.offsetX = startPoint[Game.team].x;
+ Map.offsetY = startPoint[Game.team].y;
//Load units
- new Terran.BattleCruiser({x:100,y:100});
- new Terran.Wraith({x:200,y:100});
- new Terran.BattleCruiser({x:100,y:200});
- new Terran.Wraith({x:200,y:200});
- new Terran.BattleCruiser({x:100,y:300});
- new Terran.Wraith({x:200,y:300});
- new Terran.SCV({x:100,y:400});
- new Building.TerranBuilding.MissileTurret({x:100,y:150});
- new Building.ProtossBuilding.PhotonCannon({x:100,y:250});
+ new Terran.BattleCruiser({ x: 100, y: 100 });
+ new Terran.Wraith({ x: 200, y: 100 });
+ new Terran.BattleCruiser({ x: 100, y: 200 });
+ new Terran.Wraith({ x: 200, y: 200 });
+ new Terran.BattleCruiser({ x: 100, y: 300 });
+ new Terran.Wraith({ x: 200, y: 300 });
+ new Terran.SCV({ x: 100, y: 400 });
+ new Building.TerranBuilding.MissileTurret({ x: 100, y: 150 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 100, y: 250 });
//Add enemy
- new Zerg.Drone({x:600,y:400,team:1});
- new Zerg.Mutalisk({x:700,y:100,team:1});
- new Zerg.Devourer({x:800,y:100,team:1});
- new Zerg.Guardian({x:900,y:100,team:1});
- new Zerg.Mutalisk({x:700,y:200,team:1});
- new Zerg.Devourer({x:800,y:200,team:1});
- new Zerg.Guardian({x:900,y:200,team:1});
- new Zerg.Mutalisk({x:700,y:300,team:1});
- new Zerg.Devourer({x:800,y:300,team:1});
- new Zerg.Guardian({x:900,y:300,team:1});
+ new Zerg.Drone({ x: 600, y: 400, team: 1 });
+ new Zerg.Mutalisk({ x: 700, y: 100, team: 1 });
+ new Zerg.Devourer({ x: 800, y: 100, team: 1 });
+ new Zerg.Guardian({ x: 900, y: 100, team: 1 });
+ new Zerg.Mutalisk({ x: 700, y: 200, team: 1 });
+ new Zerg.Devourer({ x: 800, y: 200, team: 1 });
+ new Zerg.Guardian({ x: 900, y: 200, team: 1 });
+ new Zerg.Mutalisk({ x: 700, y: 300, team: 1 });
+ new Zerg.Devourer({ x: 800, y: 300, team: 1 });
+ new Zerg.Guardian({ x: 900, y: 300, team: 1 });
//Apply cheat for testing
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Cheat.execute('show me the money');
- },0);
+ }, 0);
}
},
{
- level:2,
- load:function(){
+ level: 2,
+ load: function () {
//Test multiplayer
- if (!Game.replayFlag && confirm('Want enter multiplayer mode?')){
+ if (!Game.replayFlag && confirm('Want enter multiplayer mode?')) {
//Enable multiplayer
- Multiplayer.enable();//Has fog for level2
+ Multiplayer.enable(); //Has fog for level2
}
//Load map
Map.setCurrentMap('Volcanis');
- Map.offsetX=120;
- Map.offsetY=50;
+ Map.offsetX = 120;
+ Map.offsetY = 50;
//Apply race style
Game.race.choose('Zerg');
//Load units
- new Zerg.Overlord({x:100,y:100});
- new Zerg.Guardian({x:100,y:200});
- new Zerg.Devourer({x:100,y:300});
- new Zerg.Mutalisk({x:200,y:100});
- new Zerg.Devourer({x:200,y:200});
- new Zerg.Guardian({x:200,y:300});
- new Zerg.Mutalisk({x:300,y:100});
- new Zerg.Devourer({x:300,y:200});
- new Zerg.Guardian({x:300,y:300});
- new Building.ZergBuilding.SporeColony({x:100,y:200});
+ new Zerg.Overlord({ x: 100, y: 100 });
+ new Zerg.Guardian({ x: 100, y: 200 });
+ new Zerg.Devourer({ x: 100, y: 300 });
+ new Zerg.Mutalisk({ x: 200, y: 100 });
+ new Zerg.Devourer({ x: 200, y: 200 });
+ new Zerg.Guardian({ x: 200, y: 300 });
+ new Zerg.Mutalisk({ x: 300, y: 100 });
+ new Zerg.Devourer({ x: 300, y: 200 });
+ new Zerg.Guardian({ x: 300, y: 300 });
+ new Building.ZergBuilding.SporeColony({ x: 100, y: 200 });
//Add enemy
- new Terran.Wraith({x:700,y:100,team:1});
- new Terran.Wraith({x:800,y:100,team:1});
- new Terran.Wraith({x:900,y:100,team:1});
- new Terran.Civilian({x:700,y:200,team:1});
- new Terran.Civilian({x:800,y:200,team:1});
- new Terran.Civilian({x:900,y:200,team:1});
- new Terran.BattleCruiser({x:700,y:300,team:1});
- new Terran.BattleCruiser({x:800,y:300,team:1});
- new Terran.BattleCruiser({x:900,y:300,team:1});
+ new Terran.Wraith({ x: 700, y: 100, team: 1 });
+ new Terran.Wraith({ x: 800, y: 100, team: 1 });
+ new Terran.Wraith({ x: 900, y: 100, team: 1 });
+ new Terran.Civilian({ x: 700, y: 200, team: 1 });
+ new Terran.Civilian({ x: 800, y: 200, team: 1 });
+ new Terran.Civilian({ x: 900, y: 200, team: 1 });
+ new Terran.BattleCruiser({ x: 700, y: 300, team: 1 });
+ new Terran.BattleCruiser({ x: 800, y: 300, team: 1 });
+ new Terran.BattleCruiser({ x: 900, y: 300, team: 1 });
}
},
{
- level:3,
- load:function(){
+ level: 3,
+ load: function () {
//Load map
Map.setCurrentMap('TrenchWars');
//Apply race style
Game.race.choose('Zerg');
//Load units
- new Neutral.Ragnasaur({x:100,y:100});
- new Neutral.Rhynsdon({x:200,y:100});
- new Neutral.Ursadon({x:100,y:200});
- new Neutral.Bengalaas({x:200,y:200});
- new Neutral.Scantid({x:100,y:300});
- new Neutral.Kakaru({x:200,y:300});
- new Zerg.Hydralisk({x:150,y:100});
- new Zerg.Lurker({x:150,y:200});
- new Zerg.Ultralisk({x:150,y:300});
+ new Neutral.Ragnasaur({ x: 100, y: 100 });
+ new Neutral.Rhynsdon({ x: 200, y: 100 });
+ new Neutral.Ursadon({ x: 100, y: 200 });
+ new Neutral.Bengalaas({ x: 200, y: 200 });
+ new Neutral.Scantid({ x: 100, y: 300 });
+ new Neutral.Kakaru({ x: 200, y: 300 });
+ new Zerg.Hydralisk({ x: 150, y: 100 });
+ new Zerg.Lurker({ x: 150, y: 200 });
+ new Zerg.Ultralisk({ x: 150, y: 300 });
//Add enemy
- new Neutral.Ragnasaur({x:700,y:100,team:1});
- new Neutral.Rhynsdon({x:700,y:200,team:1});
- new Neutral.Ursadon({x:700,y:300,team:1});
- new Neutral.Bengalaas({x:800,y:100,team:1});
- new Neutral.Scantid({x:800,y:200,team:1});
- new Neutral.Kakaru({x:800,y:300,team:1});
+ new Neutral.Ragnasaur({ x: 700, y: 100, team: 1 });
+ new Neutral.Rhynsdon({ x: 700, y: 200, team: 1 });
+ new Neutral.Ursadon({ x: 700, y: 300, team: 1 });
+ new Neutral.Bengalaas({ x: 800, y: 100, team: 1 });
+ new Neutral.Scantid({ x: 800, y: 200, team: 1 });
+ new Neutral.Kakaru({ x: 800, y: 300, team: 1 });
}
},
{
- level:4,
- load:function(){
+ level: 4,
+ load: function () {
//Test multiplayer
/*if (!Game.replayFlag && confirm('Want enter multiplayer mode?')){
//Enable multiplayer
@@ -123,462 +124,466 @@ var Levels=[
//Load map
Map.setCurrentMap('BloodBath');
//Choose side and apply race style
- var races=['Zerg','Terran'];
- var startPoint=[{x:0,y:50},{x:200,y:50}];
- if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ var races = ['Zerg', 'Terran'];
+ var startPoint = [{ x: 0, y: 50 }, { x: 200, y: 50 }];
+ if (!Game.replayFlag)
+ Game.team = Math.random() * 2 >> 0;
Game.race.choose(races[Game.team]);
- Map.offsetX=startPoint[Game.team].x;
- Map.offsetY=startPoint[Game.team].y;
+ Map.offsetX = startPoint[Game.team].x;
+ Map.offsetY = startPoint[Game.team].y;
//Load units
- new Zerg.Drone({x:100,y:100});
- new Zerg.Zergling({x:200,y:100});
- new Zerg.Hydralisk({x:100,y:200});
- new Zerg.Scourge({x:200,y:200});
- new Zerg.Lurker({x:100,y:300});
- new Zerg.Ultralisk({x:200,y:300});
- new Zerg.Broodling({x:100,y:400});
- new Zerg.InfestedTerran({x:200,y:400});
- new Zerg.Queen({x:100,y:50});
- new Zerg.Defiler({x:200,y:50});
- new Hero.Sarah({x:100,y:150});
- new Zerg.Mutalisk({x:50,y:50});
- new Zerg.Guardian({x:50,y:150});
- new Zerg.Devourer({x:50,y:250});
- new Zerg.Overlord({x:50,y:350});
+ new Zerg.Drone({ x: 100, y: 100 });
+ new Zerg.Zergling({ x: 200, y: 100 });
+ new Zerg.Hydralisk({ x: 100, y: 200 });
+ new Zerg.Scourge({ x: 200, y: 200 });
+ new Zerg.Lurker({ x: 100, y: 300 });
+ new Zerg.Ultralisk({ x: 200, y: 300 });
+ new Zerg.Broodling({ x: 100, y: 400 });
+ new Zerg.InfestedTerran({ x: 200, y: 400 });
+ new Zerg.Queen({ x: 100, y: 50 });
+ new Zerg.Defiler({ x: 200, y: 50 });
+ new Hero.Sarah({ x: 100, y: 150 });
+ new Zerg.Mutalisk({ x: 50, y: 50 });
+ new Zerg.Guardian({ x: 50, y: 150 });
+ new Zerg.Devourer({ x: 50, y: 250 });
+ new Zerg.Overlord({ x: 50, y: 350 });
//Add enemy
- new Terran.Marine({x:700,y:100,team:1});
- new Terran.Firebat({x:700,y:200,team:1});
- new Terran.Vulture({x:700,y:300,team:1});
- new Terran.Tank({x:800,y:100,team:1});
- new Terran.Goliath({x:800,y:200,team:1});
- new Terran.Dropship({x:800,y:300,team:1});
- new Terran.Ghost({x:700,y:50,team:1});
- new Terran.Vessel({x:700,y:150,team:1});
- new Terran.Valkyrie({x:700,y:250,team:1});
- new Terran.Medic({x:750,y:50,team:1});
- new Terran.Wraith({x:750,y:150,team:1});
- new Terran.BattleCruiser({x:750,y:250,team:1});
- new Terran.SCV({x:750,y:300,team:1});
+ new Terran.Marine({ x: 700, y: 100, team: 1 });
+ new Terran.Firebat({ x: 700, y: 200, team: 1 });
+ new Terran.Vulture({ x: 700, y: 300, team: 1 });
+ new Terran.Tank({ x: 800, y: 100, team: 1 });
+ new Terran.Goliath({ x: 800, y: 200, team: 1 });
+ new Terran.Dropship({ x: 800, y: 300, team: 1 });
+ new Terran.Ghost({ x: 700, y: 50, team: 1 });
+ new Terran.Vessel({ x: 700, y: 150, team: 1 });
+ new Terran.Valkyrie({ x: 700, y: 250, team: 1 });
+ new Terran.Medic({ x: 750, y: 50, team: 1 });
+ new Terran.Wraith({ x: 750, y: 150, team: 1 });
+ new Terran.BattleCruiser({ x: 750, y: 250, team: 1 });
+ new Terran.SCV({ x: 750, y: 300, team: 1 });
//Apply cheat for testing
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Cheat.execute('show me the money');
Cheat.execute('something for nothing');
Cheat.execute('full recovery');
- },0);
+ }, 0);
}
},
{
- level:5,
- load:function(){
+ level: 5,
+ load: function () {
//Load map
Map.setCurrentMap('OrbitalRelay');
//Choose side and apply race style
- var races=['Terran','Protoss'];
- var startPoint=[{x:0,y:50},{x:200,y:50}];
- if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ var races = ['Terran', 'Protoss'];
+ var startPoint = [{ x: 0, y: 50 }, { x: 200, y: 50 }];
+ if (!Game.replayFlag)
+ Game.team = Math.random() * 2 >> 0;
Game.race.choose(races[Game.team]);
- Map.offsetX=startPoint[Game.team].x;
- Map.offsetY=startPoint[Game.team].y;
+ Map.offsetX = startPoint[Game.team].x;
+ Map.offsetY = startPoint[Game.team].y;
//Load units
- new Terran.Marine({x:100,y:100});
- new Terran.Firebat({x:200,y:100});
- new Terran.Ghost({x:100,y:200});
- new Terran.Vulture({x:200,y:200});
- new Terran.Tank({x:100,y:300});
- new Terran.Goliath({x:200,y:300});
- new Terran.Medic({x:100,y:400});
- new Terran.Dropship({x:200,y:400});
- new Terran.Vessel({x:100,y:50});
- new Terran.Valkyrie({x:200,y:50});
- new Hero.Kerrigan({x:100,y:150});
- new Terran.Wraith({x:200,y:150});
- new Terran.SCV({x:50,y:250});
- new Terran.BattleCruiser({x:150,y:250});
+ new Terran.Marine({ x: 100, y: 100 });
+ new Terran.Firebat({ x: 200, y: 100 });
+ new Terran.Ghost({ x: 100, y: 200 });
+ new Terran.Vulture({ x: 200, y: 200 });
+ new Terran.Tank({ x: 100, y: 300 });
+ new Terran.Goliath({ x: 200, y: 300 });
+ new Terran.Medic({ x: 100, y: 400 });
+ new Terran.Dropship({ x: 200, y: 400 });
+ new Terran.Vessel({ x: 100, y: 50 });
+ new Terran.Valkyrie({ x: 200, y: 50 });
+ new Hero.Kerrigan({ x: 100, y: 150 });
+ new Terran.Wraith({ x: 200, y: 150 });
+ new Terran.SCV({ x: 50, y: 250 });
+ new Terran.BattleCruiser({ x: 150, y: 250 });
//Add enemy
- new Protoss.Probe({x:700,y:100,team:1});
- new Protoss.Zealot({x:700,y:200,team:1});
- new Protoss.Dragoon({x:700,y:300,team:1});
- new Protoss.Templar({x:800,y:100,team:1});
- new Protoss.DarkTemplar({x:800,y:200,team:1});
- new Protoss.Observer({x:800,y:300,team:1});
- new Protoss.Reaver({x:800,y:300,team:1});
- new Protoss.Arbiter({x:700,y:250,team:1});
- new Protoss.Scout({x:750,y:250,team:1});
- new Protoss.Carrier({x:700,y:150,team:1});
- new Protoss.Corsair({x:700,y:200,team:1});
- new Protoss.Archon({x:750,y:50,team:1});
- new Protoss.DarkArchon({x:750,y:150,team:1});
- new Protoss.Shuttle({x:850,y:150,team:1});
- new Protoss.Observer({x:850,y:250,team:1});
+ new Protoss.Probe({ x: 700, y: 100, team: 1 });
+ new Protoss.Zealot({ x: 700, y: 200, team: 1 });
+ new Protoss.Dragoon({ x: 700, y: 300, team: 1 });
+ new Protoss.Templar({ x: 800, y: 100, team: 1 });
+ new Protoss.DarkTemplar({ x: 800, y: 200, team: 1 });
+ new Protoss.Observer({ x: 800, y: 300, team: 1 });
+ new Protoss.Reaver({ x: 800, y: 300, team: 1 });
+ new Protoss.Arbiter({ x: 700, y: 250, team: 1 });
+ new Protoss.Scout({ x: 750, y: 250, team: 1 });
+ new Protoss.Carrier({ x: 700, y: 150, team: 1 });
+ new Protoss.Corsair({ x: 700, y: 200, team: 1 });
+ new Protoss.Archon({ x: 750, y: 50, team: 1 });
+ new Protoss.DarkArchon({ x: 750, y: 150, team: 1 });
+ new Protoss.Shuttle({ x: 850, y: 150, team: 1 });
+ new Protoss.Observer({ x: 850, y: 250, team: 1 });
//Apply cheat for testing magic
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Cheat.execute('show me the money');
Cheat.execute('something for nothing');
Cheat.execute('full recovery');
- },0);
+ }, 0);
}
},
{
- level:6,
- load:function(){
+ level: 6,
+ load: function () {
//Load map
Map.setCurrentMap('ThinIce');
//Choose side and apply race style
- var races=['Protoss','Zerg'];
- var startPoint=[{x:0,y:50},{x:200,y:50}];
- if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ var races = ['Protoss', 'Zerg'];
+ var startPoint = [{ x: 0, y: 50 }, { x: 200, y: 50 }];
+ if (!Game.replayFlag)
+ Game.team = Math.random() * 2 >> 0;
Game.race.choose(races[Game.team]);
- Map.offsetX=startPoint[Game.team].x;
- Map.offsetY=startPoint[Game.team].y;
+ Map.offsetX = startPoint[Game.team].x;
+ Map.offsetY = startPoint[Game.team].y;
//Load units
- new Protoss.Probe({x:100,y:100});
- new Protoss.Zealot({x:200,y:100});
- new Protoss.Dragoon({x:100,y:200});
- new Protoss.Templar({x:200,y:200});
- new Protoss.DarkTemplar({x:100,y:300});
- new Protoss.Reaver({x:200,y:300});
- new Protoss.Archon({x:100,y:400});
- new Protoss.DarkArchon({x:200,y:400});
- new Protoss.Shuttle({x:100,y:50});
- new Protoss.Observer({x:200,y:50});
- new Protoss.Observer({x:200,y:100});
- new Protoss.Arbiter({x:100,y:150});
- new Protoss.Scout({x:200,y:150});
- new Protoss.Carrier({x:100,y:250});
- new Protoss.Corsair({x:200,y:250});
+ new Protoss.Probe({ x: 100, y: 100 });
+ new Protoss.Zealot({ x: 200, y: 100 });
+ new Protoss.Dragoon({ x: 100, y: 200 });
+ new Protoss.Templar({ x: 200, y: 200 });
+ new Protoss.DarkTemplar({ x: 100, y: 300 });
+ new Protoss.Reaver({ x: 200, y: 300 });
+ new Protoss.Archon({ x: 100, y: 400 });
+ new Protoss.DarkArchon({ x: 200, y: 400 });
+ new Protoss.Shuttle({ x: 100, y: 50 });
+ new Protoss.Observer({ x: 200, y: 50 });
+ new Protoss.Observer({ x: 200, y: 100 });
+ new Protoss.Arbiter({ x: 100, y: 150 });
+ new Protoss.Scout({ x: 200, y: 150 });
+ new Protoss.Carrier({ x: 100, y: 250 });
+ new Protoss.Corsair({ x: 200, y: 250 });
//Add enemy
- new Zerg.Drone({x:700,y:100,team:1});
- new Zerg.Zergling({x:700,y:200,team:1});
- new Zerg.Hydralisk({x:700,y:300,team:1});
- new Zerg.Scourge({x:800,y:100,team:1});
- new Zerg.Lurker({x:800,y:200,team:1});
- new Zerg.Ultralisk({x:800,y:300,team:1});
- new Zerg.Broodling({x:700,y:150,team:1});
- new Zerg.InfestedTerran({x:700,y:250,team:1});
- new Zerg.Queen({x:800,y:150,team:1});
- new Zerg.Defiler({x:800,y:250,team:1});
- new Zerg.Mutalisk({x:750,y:50,team:1});
- new Zerg.Guardian({x:750,y:150,team:1});
- new Zerg.Devourer({x:750,y:250,team:1});
- new Zerg.Overlord({x:850,y:150,team:1});
+ new Zerg.Drone({ x: 700, y: 100, team: 1 });
+ new Zerg.Zergling({ x: 700, y: 200, team: 1 });
+ new Zerg.Hydralisk({ x: 700, y: 300, team: 1 });
+ new Zerg.Scourge({ x: 800, y: 100, team: 1 });
+ new Zerg.Lurker({ x: 800, y: 200, team: 1 });
+ new Zerg.Ultralisk({ x: 800, y: 300, team: 1 });
+ new Zerg.Broodling({ x: 700, y: 150, team: 1 });
+ new Zerg.InfestedTerran({ x: 700, y: 250, team: 1 });
+ new Zerg.Queen({ x: 800, y: 150, team: 1 });
+ new Zerg.Defiler({ x: 800, y: 250, team: 1 });
+ new Zerg.Mutalisk({ x: 750, y: 50, team: 1 });
+ new Zerg.Guardian({ x: 750, y: 150, team: 1 });
+ new Zerg.Devourer({ x: 750, y: 250, team: 1 });
+ new Zerg.Overlord({ x: 850, y: 150, team: 1 });
//Apply cheat for testing magic
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Cheat.execute('show me the money');
Cheat.execute('something for nothing');
Cheat.execute('full recovery');
- },0);
+ }, 0);
}
},
{
- level:7,
- load:function(){
+ level: 7,
+ load: function () {
//Load map
Map.setCurrentMap('BigGameHunters');
//Apply race style
Game.race.choose('Protoss');
//Add buildings
//Zerg buildings
- new Building.ZergBuilding.Hatchery({x:0,y:520});
- new Building.ZergBuilding.Lair({x:0,y:670}).life=150;
- new Building.ZergBuilding.Hive({x:0,y:820});
- new Building.ZergBuilding.CreepColony({x:150,y:520});
- new Building.ZergBuilding.SunkenColony({x:150,y:670});
- new Building.ZergBuilding.SporeColony({x:150,y:820,team:1});
- new Building.ZergBuilding.Extractor({x:300,y:520});
- new Building.ZergBuilding.SpawningPool({x:300,y:670});
- new Building.ZergBuilding.EvolutionChamber({x:300,y:820});
- new Building.ZergBuilding.HydraliskDen({x:450,y:520});
- new Building.ZergBuilding.Spire({x:450,y:670});
- new Building.ZergBuilding.GreaterSpire({x:450,y:820});
- new Building.ZergBuilding.QueenNest({x:600,y:520});
- new Building.ZergBuilding.NydusCanal({x:600,y:670});
- new Building.ZergBuilding.UltraliskCavern({x:600,y:820});
- new Building.ZergBuilding.DefilerMound({x:750,y:520});
- new Building.ZergBuilding.InfestedBase({x:750,y:670});
- new Building.ZergBuilding.OvermindI({x:750,y:820});
- new Building.ZergBuilding.OvermindII({x:900,y:520});
+ new Building.ZergBuilding.Hatchery({ x: 0, y: 520 });
+ new Building.ZergBuilding.Lair({ x: 0, y: 670 }).life = 150;
+ new Building.ZergBuilding.Hive({ x: 0, y: 820 });
+ new Building.ZergBuilding.CreepColony({ x: 150, y: 520 });
+ new Building.ZergBuilding.SunkenColony({ x: 150, y: 670 });
+ new Building.ZergBuilding.SporeColony({ x: 150, y: 820, team: 1 });
+ new Building.ZergBuilding.Extractor({ x: 300, y: 520 });
+ new Building.ZergBuilding.SpawningPool({ x: 300, y: 670 });
+ new Building.ZergBuilding.EvolutionChamber({ x: 300, y: 820 });
+ new Building.ZergBuilding.HydraliskDen({ x: 450, y: 520 });
+ new Building.ZergBuilding.Spire({ x: 450, y: 670 });
+ new Building.ZergBuilding.GreaterSpire({ x: 450, y: 820 });
+ new Building.ZergBuilding.QueenNest({ x: 600, y: 520 });
+ new Building.ZergBuilding.NydusCanal({ x: 600, y: 670 });
+ new Building.ZergBuilding.UltraliskCavern({ x: 600, y: 820 });
+ new Building.ZergBuilding.DefilerMound({ x: 750, y: 520 });
+ new Building.ZergBuilding.InfestedBase({ x: 750, y: 670 });
+ new Building.ZergBuilding.OvermindI({ x: 750, y: 820 });
+ new Building.ZergBuilding.OvermindII({ x: 900, y: 520 });
//Terran buildings
- new Building.TerranBuilding.CommandCenter({x:0,y:1020,team:1}).life=375;
- new Building.TerranBuilding.SupplyDepot({x:0,y:1170,team:1});
- new Building.TerranBuilding.Refinery({x:0,y:1320});
- new Building.TerranBuilding.Barracks({x:150,y:1020});
- new Building.TerranBuilding.EngineeringBay({x:150,y:1170});
- new Building.TerranBuilding.MissileTurret({x:150,y:1320});
- new Building.TerranBuilding.Academy({x:300,y:1020});
- new Building.TerranBuilding.Bunker({x:300,y:1170});
- new Building.TerranBuilding.Factory({x:300,y:1320});
- new Building.TerranBuilding.Starport({x:450,y:1020});
- new Building.TerranBuilding.ScienceFacility({x:450,y:1170});
- new Building.TerranBuilding.Armory({x:450,y:1320});
- new Building.TerranBuilding.ComstatStation({x:600,y:1020});
- new Building.TerranBuilding.NuclearSilo({x:600,y:1170});
- new Building.TerranBuilding.MachineShop({x:600,y:1320});
- new Building.TerranBuilding.ControlTower({x:750,y:1020});
- new Building.TerranBuilding.PhysicsLab({x:750,y:1170});
- new Building.TerranBuilding.ConvertOps({x:750,y:1320});
- new Building.TerranBuilding.CrashCruiser({x:900,y:1020});
- new Building.TerranBuilding.BigCannon({x:900,y:1170});
+ new Building.TerranBuilding.CommandCenter({ x: 0, y: 1020, team: 1 }).life = 375;
+ new Building.TerranBuilding.SupplyDepot({ x: 0, y: 1170, team: 1 });
+ new Building.TerranBuilding.Refinery({ x: 0, y: 1320 });
+ new Building.TerranBuilding.Barracks({ x: 150, y: 1020 });
+ new Building.TerranBuilding.EngineeringBay({ x: 150, y: 1170 });
+ new Building.TerranBuilding.MissileTurret({ x: 150, y: 1320 });
+ new Building.TerranBuilding.Academy({ x: 300, y: 1020 });
+ new Building.TerranBuilding.Bunker({ x: 300, y: 1170 });
+ new Building.TerranBuilding.Factory({ x: 300, y: 1320 });
+ new Building.TerranBuilding.Starport({ x: 450, y: 1020 });
+ new Building.TerranBuilding.ScienceFacility({ x: 450, y: 1170 });
+ new Building.TerranBuilding.Armory({ x: 450, y: 1320 });
+ new Building.TerranBuilding.ComstatStation({ x: 600, y: 1020 });
+ new Building.TerranBuilding.NuclearSilo({ x: 600, y: 1170 });
+ new Building.TerranBuilding.MachineShop({ x: 600, y: 1320 });
+ new Building.TerranBuilding.ControlTower({ x: 750, y: 1020 });
+ new Building.TerranBuilding.PhysicsLab({ x: 750, y: 1170 });
+ new Building.TerranBuilding.ConvertOps({ x: 750, y: 1320 });
+ new Building.TerranBuilding.CrashCruiser({ x: 900, y: 1020 });
+ new Building.TerranBuilding.BigCannon({ x: 900, y: 1170 });
//Protoss buildings
- new Building.ProtossBuilding.Nexus({x:0,y:20}).life=150;
- new Building.ProtossBuilding.Pylon({x:0,y:170,team:1});
- new Building.ProtossBuilding.Assimilator({x:0,y:320});
- new Building.ProtossBuilding.Gateway({x:150,y:20});
- new Building.ProtossBuilding.Forge({x:150,y:170});
- new Building.ProtossBuilding.PhotonCannon({x:150,y:320});
- new Building.ProtossBuilding.CyberneticsCore({x:300,y:20});
- new Building.ProtossBuilding.ShieldBattery({x:300,y:170});
- new Building.ProtossBuilding.RoboticsFacility({x:300,y:320});
- new Building.ProtossBuilding.StarGate({x:450,y:20});
- new Building.ProtossBuilding.CitadelOfAdun({x:450,y:170});
- new Building.ProtossBuilding.RoboticsSupportBay({x:450,y:320});
- new Building.ProtossBuilding.FleetBeacon({x:600,y:20});
- new Building.ProtossBuilding.TemplarArchives({x:600,y:170});
- new Building.ProtossBuilding.Observatory({x:600,y:320});
- new Building.ProtossBuilding.ArbiterTribunal({x:750,y:20});
- new Building.ProtossBuilding.TeleportGate({x:750,y:170});
- new Building.ProtossBuilding.Pyramid({x:750,y:320});
- new Building.ProtossBuilding.TeleportPoint({x:900,y:20});
+ new Building.ProtossBuilding.Nexus({ x: 0, y: 20 }).life = 150;
+ new Building.ProtossBuilding.Pylon({ x: 0, y: 170, team: 1 });
+ new Building.ProtossBuilding.Assimilator({ x: 0, y: 320 });
+ new Building.ProtossBuilding.Gateway({ x: 150, y: 20 });
+ new Building.ProtossBuilding.Forge({ x: 150, y: 170 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 150, y: 320 });
+ new Building.ProtossBuilding.CyberneticsCore({ x: 300, y: 20 });
+ new Building.ProtossBuilding.ShieldBattery({ x: 300, y: 170 });
+ new Building.ProtossBuilding.RoboticsFacility({ x: 300, y: 320 });
+ new Building.ProtossBuilding.StarGate({ x: 450, y: 20 });
+ new Building.ProtossBuilding.CitadelOfAdun({ x: 450, y: 170 });
+ new Building.ProtossBuilding.RoboticsSupportBay({ x: 450, y: 320 });
+ new Building.ProtossBuilding.FleetBeacon({ x: 600, y: 20 });
+ new Building.ProtossBuilding.TemplarArchives({ x: 600, y: 170 });
+ new Building.ProtossBuilding.Observatory({ x: 600, y: 320 });
+ new Building.ProtossBuilding.ArbiterTribunal({ x: 750, y: 20 });
+ new Building.ProtossBuilding.TeleportGate({ x: 750, y: 170 });
+ new Building.ProtossBuilding.Pyramid({ x: 750, y: 320 });
+ new Building.ProtossBuilding.TeleportPoint({ x: 900, y: 20 });
//Apply cheat for testing magic
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Cheat.execute('show me the money');
- },0);
+ }, 0);
}
},
{
- level:8,
- label:'Campaign',
- load:function(){
+ level: 8,
+ label: 'Campaign',
+ load: function () {
//Load map
Map.setCurrentMap('TheHunters');
- Map.offsetX=0;
- Map.offsetY=3424;
+ Map.offsetX = 0;
+ Map.offsetY = 3424;
//Multiplayer
- Game.playerNum=4;
+ Game.playerNum = 4;
//Choose side and apply race style
- var races=['Terran','Zerg','Terran','Protoss'];
- var startPoint=[{x:100,y:4000-innerHeight},{x:4000-innerWidth,y:4000-innerHeight},{x:100,y:100},{x:4000-innerWidth,y:100}];
- if (!Game.replayFlag) Game.team=Math.random()*4>>0;
+ var races = ['Terran', 'Zerg', 'Terran', 'Protoss'];
+ var startPoint = [{ x: 100, y: 4000 - innerHeight }, { x: 4000 - innerWidth, y: 4000 - innerHeight }, { x: 100, y: 100 }, { x: 4000 - innerWidth, y: 100 }];
+ if (!Game.replayFlag)
+ Game.team = Math.random() * 4 >> 0;
Game.race.choose(races[Game.team]);
- Map.offsetX=startPoint[Game.team].x;
- Map.offsetY=startPoint[Game.team].y;
+ Map.offsetX = startPoint[Game.team].x;
+ Map.offsetY = startPoint[Game.team].y;
//Apply cheat
Cheat.execute('black sheep wall');
//Our buildings and units
- new Building.ZergBuilding.OvermindI({x:662,y:3828});
- new Building.ZergBuilding.OvermindII({x:300,y:3694});
- new Building.TerranBuilding.CrashCruiser({x:820,y:3600});
- new Building.TerranBuilding.BigCannon({x:260,y:3560});
- new Building.ProtossBuilding.Pyramid({x:560,y:3690});
- new Building.ProtossBuilding.TeleportGate({x:560,y:3558});
- new Building.ProtossBuilding.TeleportPoint({x:534,y:3884});
- new Hero.HeroCruiser({x:300,y:3455});
- new Hero.HeroCruiser({x:690,y:3500});
- new Hero.HeroCruiser({x:866,y:3744});
- new Hero.Sarah({x:434,y:3600});
- new Hero.Sarah({x:700,y:3730});
- new Hero.Kerrigan({x:464,y:3568});
- new Hero.Kerrigan({x:694,y:3690});
- new Protoss.Observer({x:484,y:3824});
- new Protoss.Observer({x:524,y:3824});
+ new Building.ZergBuilding.OvermindI({ x: 662, y: 3828 });
+ new Building.ZergBuilding.OvermindII({ x: 300, y: 3694 });
+ new Building.TerranBuilding.CrashCruiser({ x: 820, y: 3600 });
+ new Building.TerranBuilding.BigCannon({ x: 260, y: 3560 });
+ new Building.ProtossBuilding.Pyramid({ x: 560, y: 3690 });
+ new Building.ProtossBuilding.TeleportGate({ x: 560, y: 3558 });
+ new Building.ProtossBuilding.TeleportPoint({ x: 534, y: 3884 });
+ new Hero.HeroCruiser({ x: 300, y: 3455 });
+ new Hero.HeroCruiser({ x: 690, y: 3500 });
+ new Hero.HeroCruiser({ x: 866, y: 3744 });
+ new Hero.Sarah({ x: 434, y: 3600 });
+ new Hero.Sarah({ x: 700, y: 3730 });
+ new Hero.Kerrigan({ x: 464, y: 3568 });
+ new Hero.Kerrigan({ x: 694, y: 3690 });
+ new Protoss.Observer({ x: 484, y: 3824 });
+ new Protoss.Observer({ x: 524, y: 3824 });
//Zerg
- new Building.ZergBuilding.Hatchery({x:3470,y:3720,team:1});
- new Building.ZergBuilding.Lair({x:3265,y:3795,team:1});
- new Building.ZergBuilding.Hive({x:3650,y:3700,team:1});
- new Building.ZergBuilding.CreepColony({x:3488,y:3552,team:1});
- new Building.ZergBuilding.CreepColony({x:3264,y:3552,team:1});
- new Building.ZergBuilding.SunkenColony({x:3328,y:3552,team:1});
- new Building.ZergBuilding.SunkenColony({x:3392,y:3552,team:1});
- new Building.ZergBuilding.SporeColony({x:3136,y:3552,team:1});
- new Building.ZergBuilding.Extractor({x:3420,y:3800,team:1});
- new Building.ZergBuilding.SpawningPool({x:3440,y:3616,team:1});
- new Building.ZergBuilding.EvolutionChamber({x:3248,y:3616,team:1});
- new Building.ZergBuilding.HydraliskDen({x:3344,y:3616,team:1});
- new Building.ZergBuilding.Spire({x:3744,y:3552,team:1});
- new Building.ZergBuilding.GreaterSpire({x:3808,y:3616,team:1});
- new Building.ZergBuilding.QueenNest({x:3728,y:3616,team:1});
- new Building.ZergBuilding.NydusCanal({x:3200,y:3552,team:1});
- new Building.ZergBuilding.UltraliskCavern({x:3824,y:3520,team:1});
- new Building.ZergBuilding.DefilerMound({x:3104,y:3776,team:1});
- new Building.ZergBuilding.InfestedBase({x:3264,y:3920,team:1});
- new Zerg.Drone({x:3828,y:3724,team:1});
- new Zerg.Drone({x:3832,y:3826,team:1});
- new Zerg.Drone({x:3700,y:3850,team:1});
- new Zerg.Zergling({x:3473,y:3500,team:1});
- new Zerg.Zergling({x:3541,y:3535,team:1});
- new Zerg.Hydralisk({x:3314,y:3500,team:1});
- new Zerg.Hydralisk({x:3353,y:3500,team:1});
- new Zerg.Overlord({x:3044,y:3632,team:1});
- new Zerg.Overlord({x:3522,y:3438,team:1});
- new Zerg.Mutalisk({x:3135,y:3615,team:1});
- new Zerg.Mutalisk({x:3870,y:3596,team:1});
- new Zerg.Devourer({x:3292,y:3675,team:1});
- new Zerg.Devourer({x:3644,y:3535,team:1});
- new Zerg.Guardian({x:3138,y:3675,team:1});
- new Zerg.Guardian({x:3580,y:3585,team:1});
- new Zerg.Scourge({x:3154,y:3490,team:1});
- new Zerg.Scourge({x:3213,y:3668,team:1});
- new Zerg.Lurker({x:3260,y:3500,team:1});
- new Zerg.Lurker({x:3408,y:3500,team:1});
- new Zerg.Ultralisk({x:3638,y:3463,team:1});
- new Zerg.Broodling({x:3602,y:3666,team:1});
- new Zerg.InfestedTerran({x:3184,y:3950,team:1});
- new Zerg.Queen({x:3647,y:3610,team:1});
- new Zerg.Defiler({x:3047,y:3710,team:1});
+ new Building.ZergBuilding.Hatchery({ x: 3470, y: 3720, team: 1 });
+ new Building.ZergBuilding.Lair({ x: 3265, y: 3795, team: 1 });
+ new Building.ZergBuilding.Hive({ x: 3650, y: 3700, team: 1 });
+ new Building.ZergBuilding.CreepColony({ x: 3488, y: 3552, team: 1 });
+ new Building.ZergBuilding.CreepColony({ x: 3264, y: 3552, team: 1 });
+ new Building.ZergBuilding.SunkenColony({ x: 3328, y: 3552, team: 1 });
+ new Building.ZergBuilding.SunkenColony({ x: 3392, y: 3552, team: 1 });
+ new Building.ZergBuilding.SporeColony({ x: 3136, y: 3552, team: 1 });
+ new Building.ZergBuilding.Extractor({ x: 3420, y: 3800, team: 1 });
+ new Building.ZergBuilding.SpawningPool({ x: 3440, y: 3616, team: 1 });
+ new Building.ZergBuilding.EvolutionChamber({ x: 3248, y: 3616, team: 1 });
+ new Building.ZergBuilding.HydraliskDen({ x: 3344, y: 3616, team: 1 });
+ new Building.ZergBuilding.Spire({ x: 3744, y: 3552, team: 1 });
+ new Building.ZergBuilding.GreaterSpire({ x: 3808, y: 3616, team: 1 });
+ new Building.ZergBuilding.QueenNest({ x: 3728, y: 3616, team: 1 });
+ new Building.ZergBuilding.NydusCanal({ x: 3200, y: 3552, team: 1 });
+ new Building.ZergBuilding.UltraliskCavern({ x: 3824, y: 3520, team: 1 });
+ new Building.ZergBuilding.DefilerMound({ x: 3104, y: 3776, team: 1 });
+ new Building.ZergBuilding.InfestedBase({ x: 3264, y: 3920, team: 1 });
+ new Zerg.Drone({ x: 3828, y: 3724, team: 1 });
+ new Zerg.Drone({ x: 3832, y: 3826, team: 1 });
+ new Zerg.Drone({ x: 3700, y: 3850, team: 1 });
+ new Zerg.Zergling({ x: 3473, y: 3500, team: 1 });
+ new Zerg.Zergling({ x: 3541, y: 3535, team: 1 });
+ new Zerg.Hydralisk({ x: 3314, y: 3500, team: 1 });
+ new Zerg.Hydralisk({ x: 3353, y: 3500, team: 1 });
+ new Zerg.Overlord({ x: 3044, y: 3632, team: 1 });
+ new Zerg.Overlord({ x: 3522, y: 3438, team: 1 });
+ new Zerg.Mutalisk({ x: 3135, y: 3615, team: 1 });
+ new Zerg.Mutalisk({ x: 3870, y: 3596, team: 1 });
+ new Zerg.Devourer({ x: 3292, y: 3675, team: 1 });
+ new Zerg.Devourer({ x: 3644, y: 3535, team: 1 });
+ new Zerg.Guardian({ x: 3138, y: 3675, team: 1 });
+ new Zerg.Guardian({ x: 3580, y: 3585, team: 1 });
+ new Zerg.Scourge({ x: 3154, y: 3490, team: 1 });
+ new Zerg.Scourge({ x: 3213, y: 3668, team: 1 });
+ new Zerg.Lurker({ x: 3260, y: 3500, team: 1 });
+ new Zerg.Lurker({ x: 3408, y: 3500, team: 1 });
+ new Zerg.Ultralisk({ x: 3638, y: 3463, team: 1 });
+ new Zerg.Broodling({ x: 3602, y: 3666, team: 1 });
+ new Zerg.InfestedTerran({ x: 3184, y: 3950, team: 1 });
+ new Zerg.Queen({ x: 3647, y: 3610, team: 1 });
+ new Zerg.Defiler({ x: 3047, y: 3710, team: 1 });
//Terran
- new Building.TerranBuilding.CommandCenter({x:320,y:180,team:2});
- new Building.TerranBuilding.ComstatStation({x:434,y:220,team:2});
- new Building.TerranBuilding.SupplyDepot({x:368,y:416,team:2});
- new Building.TerranBuilding.SupplyDepot({x:464,y:416,team:2});
- new Building.TerranBuilding.SupplyDepot({x:368,y:480,team:2});
- new Building.TerranBuilding.SupplyDepot({x:464,y:480,team:2});
- new Building.TerranBuilding.Refinery({x:96,y:246,team:2});
- new Building.TerranBuilding.Barracks({x:576,y:432,team:2});
- new Building.TerranBuilding.EngineeringBay({x:576,y:336,team:2});
- new Building.TerranBuilding.MissileTurret({x:384,y:576,team:2});
- new Building.TerranBuilding.MissileTurret({x:544,y:576,team:2});
- new Building.TerranBuilding.Academy({x:272,y:416,team:2});
- new Building.TerranBuilding.Bunker({x:636,y:556,team:2});
- new Building.TerranBuilding.Bunker({x:764,y:460,team:2});
- new Building.TerranBuilding.Factory({x:732,y:220,team:2});
- new Building.TerranBuilding.MachineShop({x:832,y:256,team:2});
- new Building.TerranBuilding.Starport({x:732,y:316,team:2});
- new Building.TerranBuilding.ControlTower({x:832,y:352,team:2});
- new Building.TerranBuilding.ScienceFacility({x:60,y:390,team:2});
- new Building.TerranBuilding.PhysicsLab({x:160,y:416,team:2});
- new Building.TerranBuilding.Armory({x:272,y:480,team:2});
- new Terran.SCV({x:246,y:116,team:2});
- new Terran.SCV({x:400,y:114,team:2});
- new Terran.SCV({x:222,y:220,team:2});
- new Terran.Marine({x:816,y:528,team:2});
- new Terran.Marine({x:726,y:590,team:2});
- new Terran.Firebat({x:692,y:618,team:2});
- new Terran.Firebat({x:846,y:526,team:2});
- new Terran.Ghost({x:690,y:530,team:2});
- new Terran.Medic({x:725,y:528,team:2});
- new Terran.Vulture({x:918,y:373,team:2});
- new Terran.Vulture({x:920,y:512,team:2});
- new Terran.Tank({x:922,y:325,team:2});
- new Terran.Tank({x:920,y:468,team:2});
- new Terran.Goliath({x:918,y:270,team:2});
- new Terran.Goliath({x:940,y:420,team:2});
- new Terran.Wraith({x:672,y:400,team:2});
- new Terran.Wraith({x:728,y:400,team:2});
- new Terran.Dropship({x:475,y:548,team:2});
- new Terran.Vessel({x:692,y:472,team:2});
- new Terran.BattleCruiser({x:500,y:326,team:2});
- new Terran.BattleCruiser({x:580,y:510,team:2});
- new Terran.Valkyrie({x:790,y:400,team:2});
- new Terran.Valkyrie({x:854,y:400,team:2});
- new Terran.Civilian({x:400,y:350,team:2});
- new Terran.Civilian({x:580,y:250,team:2});
+ new Building.TerranBuilding.CommandCenter({ x: 320, y: 180, team: 2 });
+ new Building.TerranBuilding.ComstatStation({ x: 434, y: 220, team: 2 });
+ new Building.TerranBuilding.SupplyDepot({ x: 368, y: 416, team: 2 });
+ new Building.TerranBuilding.SupplyDepot({ x: 464, y: 416, team: 2 });
+ new Building.TerranBuilding.SupplyDepot({ x: 368, y: 480, team: 2 });
+ new Building.TerranBuilding.SupplyDepot({ x: 464, y: 480, team: 2 });
+ new Building.TerranBuilding.Refinery({ x: 96, y: 246, team: 2 });
+ new Building.TerranBuilding.Barracks({ x: 576, y: 432, team: 2 });
+ new Building.TerranBuilding.EngineeringBay({ x: 576, y: 336, team: 2 });
+ new Building.TerranBuilding.MissileTurret({ x: 384, y: 576, team: 2 });
+ new Building.TerranBuilding.MissileTurret({ x: 544, y: 576, team: 2 });
+ new Building.TerranBuilding.Academy({ x: 272, y: 416, team: 2 });
+ new Building.TerranBuilding.Bunker({ x: 636, y: 556, team: 2 });
+ new Building.TerranBuilding.Bunker({ x: 764, y: 460, team: 2 });
+ new Building.TerranBuilding.Factory({ x: 732, y: 220, team: 2 });
+ new Building.TerranBuilding.MachineShop({ x: 832, y: 256, team: 2 });
+ new Building.TerranBuilding.Starport({ x: 732, y: 316, team: 2 });
+ new Building.TerranBuilding.ControlTower({ x: 832, y: 352, team: 2 });
+ new Building.TerranBuilding.ScienceFacility({ x: 60, y: 390, team: 2 });
+ new Building.TerranBuilding.PhysicsLab({ x: 160, y: 416, team: 2 });
+ new Building.TerranBuilding.Armory({ x: 272, y: 480, team: 2 });
+ new Terran.SCV({ x: 246, y: 116, team: 2 });
+ new Terran.SCV({ x: 400, y: 114, team: 2 });
+ new Terran.SCV({ x: 222, y: 220, team: 2 });
+ new Terran.Marine({ x: 816, y: 528, team: 2 });
+ new Terran.Marine({ x: 726, y: 590, team: 2 });
+ new Terran.Firebat({ x: 692, y: 618, team: 2 });
+ new Terran.Firebat({ x: 846, y: 526, team: 2 });
+ new Terran.Ghost({ x: 690, y: 530, team: 2 });
+ new Terran.Medic({ x: 725, y: 528, team: 2 });
+ new Terran.Vulture({ x: 918, y: 373, team: 2 });
+ new Terran.Vulture({ x: 920, y: 512, team: 2 });
+ new Terran.Tank({ x: 922, y: 325, team: 2 });
+ new Terran.Tank({ x: 920, y: 468, team: 2 });
+ new Terran.Goliath({ x: 918, y: 270, team: 2 });
+ new Terran.Goliath({ x: 940, y: 420, team: 2 });
+ new Terran.Wraith({ x: 672, y: 400, team: 2 });
+ new Terran.Wraith({ x: 728, y: 400, team: 2 });
+ new Terran.Dropship({ x: 475, y: 548, team: 2 });
+ new Terran.Vessel({ x: 692, y: 472, team: 2 });
+ new Terran.BattleCruiser({ x: 500, y: 326, team: 2 });
+ new Terran.BattleCruiser({ x: 580, y: 510, team: 2 });
+ new Terran.Valkyrie({ x: 790, y: 400, team: 2 });
+ new Terran.Valkyrie({ x: 854, y: 400, team: 2 });
+ new Terran.Civilian({ x: 400, y: 350, team: 2 });
+ new Terran.Civilian({ x: 580, y: 250, team: 2 });
//Protoss
- new Building.ProtossBuilding.Nexus({x:3614,y:222,team:3});
- new Building.ProtossBuilding.Pylon({x:3296,y:512,team:3});
- new Building.ProtossBuilding.Pylon({x:3424,y:288,team:3});
- new Building.ProtossBuilding.Pylon({x:3648,y:512,team:3});
- new Building.ProtossBuilding.Assimilator({x:3582,y:86,team:3});
- new Building.ProtossBuilding.Gateway({x:3648,y:624,team:3});
- new Building.ProtossBuilding.Forge({x:3504,y:448,team:3});
- new Building.ProtossBuilding.PhotonCannon({x:3200,y:448,team:3});
- new Building.ProtossBuilding.PhotonCannon({x:3200,y:608,team:3});
- new Building.ProtossBuilding.PhotonCannon({x:3392,y:608,team:3});
- new Building.ProtossBuilding.CyberneticsCore({x:3760,y:448,team:3});
- new Building.ProtossBuilding.ShieldBattery({x:3728,y:544,team:3});
- new Building.ProtossBuilding.RoboticsFacility({x:3344,y:224,team:3});
- new Building.ProtossBuilding.StarGate({x:3232,y:304,team:3});
- new Building.ProtossBuilding.CitadelOfAdun({x:3632,y:408,team:3});
- new Building.ProtossBuilding.RoboticsSupportBay({x:3344,y:384,team:3});
- new Building.ProtossBuilding.FleetBeacon({x:3438,y:182,team:3});
- new Building.ProtossBuilding.TemplarArchives({x:3504,y:544,team:3});
- new Building.ProtossBuilding.Observatory({x:3504,y:320,team:3});
- new Building.ProtossBuilding.ArbiterTribunal({x:3216,y:192,team:3});
- new Protoss.Probe({x:3668,y:202,team:3});
- new Protoss.Probe({x:3794,y:244,team:3});
- new Protoss.Probe({x:3796,y:338,team:3});
- new Protoss.Zealot({x:3535,y:640,team:3});
- new Protoss.Zealot({x:3635,y:736,team:3});
- new Protoss.Dragoon({x:3536,y:688,team:3});
- new Protoss.Dragoon({x:3585,y:720,team:3});
- new Protoss.Templar({x:3472,y:655,team:3});
- new Protoss.DarkTemplar({x:3730,y:712,team:3});
- new Protoss.Reaver({x:3358,y:475,team:3});
- new Protoss.Archon({x:3478,y:722,team:3});
- new Protoss.DarkArchon({x:3780,y:636,team:3});
- new Protoss.Shuttle({x:3296,y:612,team:3});
- new Protoss.Observer({x:3250,y:398,team:3});
- new Protoss.Observer({x:3378,y:692,team:3});
- new Protoss.Arbiter({x:3350,y:296,team:3});
- new Protoss.Scout({x:3132,y:390,team:3});
- new Protoss.Scout({x:3100,y:636,team:3});
- new Protoss.Carrier({x:3102,y:470,team:3});
- new Protoss.Corsair({x:3106,y:580,team:3});
- new Protoss.Corsair({x:3838,y:544,team:3});
+ new Building.ProtossBuilding.Nexus({ x: 3614, y: 222, team: 3 });
+ new Building.ProtossBuilding.Pylon({ x: 3296, y: 512, team: 3 });
+ new Building.ProtossBuilding.Pylon({ x: 3424, y: 288, team: 3 });
+ new Building.ProtossBuilding.Pylon({ x: 3648, y: 512, team: 3 });
+ new Building.ProtossBuilding.Assimilator({ x: 3582, y: 86, team: 3 });
+ new Building.ProtossBuilding.Gateway({ x: 3648, y: 624, team: 3 });
+ new Building.ProtossBuilding.Forge({ x: 3504, y: 448, team: 3 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 3200, y: 448, team: 3 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 3200, y: 608, team: 3 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 3392, y: 608, team: 3 });
+ new Building.ProtossBuilding.CyberneticsCore({ x: 3760, y: 448, team: 3 });
+ new Building.ProtossBuilding.ShieldBattery({ x: 3728, y: 544, team: 3 });
+ new Building.ProtossBuilding.RoboticsFacility({ x: 3344, y: 224, team: 3 });
+ new Building.ProtossBuilding.StarGate({ x: 3232, y: 304, team: 3 });
+ new Building.ProtossBuilding.CitadelOfAdun({ x: 3632, y: 408, team: 3 });
+ new Building.ProtossBuilding.RoboticsSupportBay({ x: 3344, y: 384, team: 3 });
+ new Building.ProtossBuilding.FleetBeacon({ x: 3438, y: 182, team: 3 });
+ new Building.ProtossBuilding.TemplarArchives({ x: 3504, y: 544, team: 3 });
+ new Building.ProtossBuilding.Observatory({ x: 3504, y: 320, team: 3 });
+ new Building.ProtossBuilding.ArbiterTribunal({ x: 3216, y: 192, team: 3 });
+ new Protoss.Probe({ x: 3668, y: 202, team: 3 });
+ new Protoss.Probe({ x: 3794, y: 244, team: 3 });
+ new Protoss.Probe({ x: 3796, y: 338, team: 3 });
+ new Protoss.Zealot({ x: 3535, y: 640, team: 3 });
+ new Protoss.Zealot({ x: 3635, y: 736, team: 3 });
+ new Protoss.Dragoon({ x: 3536, y: 688, team: 3 });
+ new Protoss.Dragoon({ x: 3585, y: 720, team: 3 });
+ new Protoss.Templar({ x: 3472, y: 655, team: 3 });
+ new Protoss.DarkTemplar({ x: 3730, y: 712, team: 3 });
+ new Protoss.Reaver({ x: 3358, y: 475, team: 3 });
+ new Protoss.Archon({ x: 3478, y: 722, team: 3 });
+ new Protoss.DarkArchon({ x: 3780, y: 636, team: 3 });
+ new Protoss.Shuttle({ x: 3296, y: 612, team: 3 });
+ new Protoss.Observer({ x: 3250, y: 398, team: 3 });
+ new Protoss.Observer({ x: 3378, y: 692, team: 3 });
+ new Protoss.Arbiter({ x: 3350, y: 296, team: 3 });
+ new Protoss.Scout({ x: 3132, y: 390, team: 3 });
+ new Protoss.Scout({ x: 3100, y: 636, team: 3 });
+ new Protoss.Carrier({ x: 3102, y: 470, team: 3 });
+ new Protoss.Corsair({ x: 3106, y: 580, team: 3 });
+ new Protoss.Corsair({ x: 3838, y: 544, team: 3 });
//Apply cheat for testing magic
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Cheat.execute('show me the money');
- },0);
+ }, 0);
}
},
{
- level:9,
- label:'ProtectAthena',
- load:function(){
+ level: 9,
+ label: 'ProtectAthena',
+ load: function () {
//Load map
Map.setCurrentMap('OrbitalRelay');
- Map.offsetX=(1536-Game.HBOUND/2)>>0;
- Map.offsetY=(1536-Game.VBOUND/2)>>0;
- Map.fogFlag=false;
+ Map.offsetX = (1536 - Game.HBOUND / 2) >> 0;
+ Map.offsetY = (1536 - Game.VBOUND / 2) >> 0;
+ Map.fogFlag = false;
//Apply race style
Game.race.choose('Protoss');
//Single player
- Multiplayer.ON=false;
+ Multiplayer.ON = false;
//Add our buildings and units
//Override
- Building.ProtossBuilding.Pyramid.prototype.HP=3000;
- Building.ProtossBuilding.Pyramid.prototype.SP=3000;
- Building.ProtossBuilding.Pyramid.prototype.detector=Gobj.detectorBuffer;
+ Building.ProtossBuilding.Pyramid.prototype.HP = 3000;
+ Building.ProtossBuilding.Pyramid.prototype.SP = 3000;
+ Building.ProtossBuilding.Pyramid.prototype.detector = Gobj.detectorBuffer;
//Patch: Overlord speed up
- Game.commandTimeout(function() {
+ Game.commandTimeout(function () {
Upgrade.EvolvePneumatizedCarapace.effect(1);
Upgrade.IncreaseCarrierCapacity.effect(1);
- },0);
+ }, 0);
//Patch: Larva can move
- Zerg.Larva.prototype.moveTo=Unit.prototype.moveTo;
- Zerg.Larva.prototype.moveToward=Unit.prototype.moveToward;
- var Pyramid=new Building.ProtossBuilding.Pyramid({x:1450,y:1480});
- for (var N=0;N<6;N++){
- new Hero.HeroCruiser({x:1470,y:1500});
+ Zerg.Larva.prototype.moveTo = Unit.prototype.moveTo;
+ Zerg.Larva.prototype.moveToward = Unit.prototype.moveToward;
+ var Pyramid = new Building.ProtossBuilding.Pyramid({ x: 1450, y: 1480 });
+ for (var N = 0; N < 6; N++) {
+ new Hero.HeroCruiser({ x: 1470, y: 1500 });
}
//Override win and lose condition
- Referee.winCondition=function(){
+ Referee.winCondition = function () {
return false;
};
- Referee.loseCondition=function(){
- return Pyramid.status=='dead';//Closure
+ Referee.loseCondition = function () {
+ return Pyramid.status == 'dead'; //Closure
};
//Enemy coming
- var offsets=[{x:1536,y:36},{x:1536,y:3036},{x:36,y:1536},{x:3036,y:1536},
- {x:486,y:486},{x:486,y:2586},{x:2586,y:486},{x:2586,y:2586}];
- var num=0, wave=1;
- var interval=20000;//20 seconds per wave
- _$.traverse([Neutral,Zerg,Terran,Protoss],function(enemyType){
- Game.commandTimeout(function(){
- offsets.forEach(function(offset){
- offset.team=1;
- new enemyType(offset).attackGround({x:1536,y:1536});
+ var offsets = [{ x: 1536, y: 36 }, { x: 1536, y: 3036 }, { x: 36, y: 1536 }, { x: 3036, y: 1536 },
+ { x: 486, y: 486 }, { x: 486, y: 2586 }, { x: 2586, y: 486 }, { x: 2586, y: 2586 }];
+ var num = 0, wave = 1;
+ var interval = 20000; //20 seconds per wave
+ _$.traverse([Neutral, Zerg, Terran, Protoss], function (enemyType) {
+ Game.commandTimeout(function () {
+ offsets.forEach(function (offset) {
+ offset.team = 1;
+ new enemyType(offset).attackGround({ x: 1536, y: 1536 });
});
- Game.showWarning('Wave '+ wave++ +': '+enemyType.prototype.name);
- },interval*num++);
+ Game.showWarning('Wave ' + wave++ + ': ' + enemyType.prototype.name);
+ }, interval * num++);
});
//Game win when time reach
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Game.win();
- },interval*num+interval);
+ }, interval * num + interval);
}
},
{
- level:10,
- label:'HUNTERxHUNTER',
+ level: 10,
+ label: 'HUNTERxHUNTER',
/*Once upon a time there was a young hunter lost in strange jungle, and was warmly welcome by forest friends.
# About 200 units in the map, designed for stress test
# You have 6 random kinds of magic, and will refresh when you killed each 50 units
@@ -586,7 +591,7 @@ var Levels=[
# Kill 10 units will upgrade, enemies will upgrade every 1 minute
# Infinite enemy number and unlimited upgrade level
# Two different modes: easy and nightmare*/
- load:function(){
+ load: function () {
/*var isNightmare=confirm('Want challenge nightmare mode?');
if (!isNightmare){
//Make it easy
@@ -596,52 +601,52 @@ var Levels=[
Hero.DevilHunter.prototype.damage=50;
Hero.DevilHunter.prototype.isInvisible=true;
}*/
- var isNightmare=true;
+ var isNightmare = true;
//Load map
Map.setCurrentMap('Grass');
- var mapSize=Map.getCurrentMap();
- Map.offsetX=(mapSize.width-Game.HBOUND)/2>>0;
- Map.offsetY=(mapSize.height-Game.VBOUND)/2>>0;
+ var mapSize = Map.getCurrentMap();
+ Map.offsetX = (mapSize.width - Game.HBOUND) / 2 >> 0;
+ Map.offsetY = (mapSize.height - Game.VBOUND) / 2 >> 0;
//Apply race style
Game.race.choose('Zerg');
//Single player
- Multiplayer.ON=false;
+ Multiplayer.ON = false;
//Show me the money
- Game.commandTimeout(function(){
- Resource[0].mine=Resource[0].gas=9999;
- },0);
+ Game.commandTimeout(function () {
+ Resource[0].mine = Resource[0].gas = 9999;
+ }, 0);
//Fulfill nuclear bombs
- Magic.NuclearStrike.enabled=999;
+ Magic.NuclearStrike.enabled = 999;
//Change kill to EXP:
$('p.kill').html('EXP:');
//Magic infinite
Cheat.execute('the gathering');
//Patch: Overlord speed up
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Upgrade.EvolvePneumatizedCarapace.effect(1);
Upgrade.IncreaseCarrierCapacity.effect(1);
- },0);
+ }, 0);
//Override win and lose condition
- Referee.winCondition=function(){
+ Referee.winCondition = function () {
//Infinite enemies
- if (Unit.allUnits.length<150) {
+ if (Unit.allUnits.length < 150) {
Game.showWarning('Refreshing...');
Levels.enemyWave();
Levels.refreshMagic();
}
//Upgrade your hunter
- var curLevel=Levels.DevilHunter.kill/10>>0;
- if (curLevel>Levels.DevilHunter.level){
- for (var N=0;N> 0;
+ if (curLevel > Levels.DevilHunter.level) {
+ for (var N = 0; N < curLevel - Levels.DevilHunter.level; N++) {
//Upgraded
- if (isNightmare){
- Hero.DevilHunter.prototype.HP[0]+=100;
- Hero.DevilHunter.prototype.SP[0]+=100;
- Hero.DevilHunter.prototype.MP[0]+=10;
+ if (isNightmare) {
+ Hero.DevilHunter.prototype.HP[0] += 100;
+ Hero.DevilHunter.prototype.SP[0] += 100;
+ Hero.DevilHunter.prototype.MP[0] += 10;
}
Cheat.execute("something for nothing");
Cheat.execute("full recovery");
- Levels.DevilHunter.level=curLevel;
+ Levels.DevilHunter.level = curLevel;
Game.refreshInfo();
Referee.voice('upgrade')[Game.race.selected].play();
Game.showMessage('Upgrade complete');
@@ -650,52 +655,52 @@ var Levels=[
return false;
};
//Random magics for hunter
- Levels.refreshMagic=function(){
- var magics=["Parasite","SpawnBroodlings","Ensnare","DarkSwarm","Plague","StimPacks","Lockdown","NuclearStrike",
- "Restoration","OpticalFlare","DefensiveMatrix","EMPShockwave","Irradiate","Yamato","ScannerSweep","PsionicStorm",
- "Hallucination","Feedback","MindControl","MaelStorm","Recall","StasisField","DisruptionWeb","RechargeShields"];
- var items={};
- for (var N=4;N<=9;N++){
+ Levels.refreshMagic = function () {
+ var magics = ["Parasite", "SpawnBroodlings", "Ensnare", "DarkSwarm", "Plague", "StimPacks", "Lockdown", "NuclearStrike",
+ "Restoration", "OpticalFlare", "DefensiveMatrix", "EMPShockwave", "Irradiate", "Yamato", "ScannerSweep", "PsionicStorm",
+ "Hallucination", "Feedback", "MindControl", "MaelStorm", "Recall", "StasisField", "DisruptionWeb", "RechargeShields"];
+ var items = {};
+ for (var N = 4; N <= 9; N++) {
//Doesn't affect replay here
- var index=Math.random()*magics.length>>0;
- items[N]={name:magics[index]};
- magics.splice(index,1);
+ var index = Math.random() * magics.length >> 0;
+ items[N] = { name: magics[index] };
+ magics.splice(index, 1);
}
- Hero.DevilHunter.prototype.items=items;
+ Hero.DevilHunter.prototype.items = items;
Button.refreshButtons();
};
Levels.refreshMagic();
//Add units on map
- Levels.DevilHunter=new Hero.DevilHunter({x:mapSize.width/2,y:mapSize.height/2});
- Levels.DevilHunter.level=0;
- Game.commandTimeout(function(){
+ Levels.DevilHunter = new Hero.DevilHunter({ x: mapSize.width / 2, y: mapSize.height / 2 });
+ Levels.DevilHunter.level = 0;
+ Game.commandTimeout(function () {
Game.changeSelectedTo(Levels.DevilHunter);
- },0);
+ }, 0);
//Enemy coming
- Levels.enemyWave=function(){
- var pos={team:1};
- _$.traverse([Neutral,Zerg,Terran,Protoss],function(enemyType){
- pos.x=(Game.getNextRandom()*mapSize.width)>>0;
- pos.y=(Game.getNextRandom()*mapSize.height)>>0;
- var enemy=new enemyType(pos);
- if (enemy.attack){
- enemy.attackLimit=null;
+ Levels.enemyWave = function () {
+ var pos = { team: 1 };
+ _$.traverse([Neutral, Zerg, Terran, Protoss], function (enemyType) {
+ pos.x = (Game.getNextRandom() * mapSize.width) >> 0;
+ pos.y = (Game.getNextRandom() * mapSize.height) >> 0;
+ var enemy = new enemyType(pos);
+ if (enemy.attack) {
+ enemy.attackLimit = null;
}
});
};
- for(var N=0;N<4;N++){
+ for (var N = 0; N < 4; N++) {
Levels.enemyWave();
}
//Enemies will becomes stronger and stronger
- Game.commandInterval(function(){
+ Game.commandInterval(function () {
Game.showWarning('Enemies become stronger!');
//Upgrade all grades for enemy
- for (var grade in Upgrade){
+ for (var grade in Upgrade) {
Upgrade[grade].effect(1);
}
- },isNightmare?90000:60000);
+ }, isNightmare ? 90000 : 60000);
//Baby hunter will talk every 30s
- var speech=[
+ var speech = [
"What the hell is going on? Where am I?",
"This world is weird! There must be some mistake!",
"Hey, gloomyson, you sent me to the wrong game!",
@@ -709,229 +714,232 @@ var Levels=[
"Help me, Killua, Kurapika!",
"(T_T) cry~~~"
];
- for (var N=0;NMath.abs(bullet.speed.y)){
- if (bullet.speed.x>0) {
- bullet.x+=(20*num);
- bullet.y+=(20*num*bullet.speed.y/bullet.speed.x)>>0;
+ if (Math.abs(bullet.speed.x) > Math.abs(bullet.speed.y)) {
+ if (bullet.speed.x > 0) {
+ bullet.x += (20 * num);
+ bullet.y += (20 * num * bullet.speed.y / bullet.speed.x) >> 0;
}
else {
- bullet.x-=(20*num);
- bullet.y-=(20*num*bullet.speed.y/bullet.speed.x)>>0;
+ bullet.x -= (20 * num);
+ bullet.y -= (20 * num * bullet.speed.y / bullet.speed.x) >> 0;
}
}
else {
- if (bullet.speed.y>0) {
- bullet.y+=(20*num);
- bullet.x+=(20*num*bullet.speed.x/bullet.speed.y)>>0;
+ if (bullet.speed.y > 0) {
+ bullet.y += (20 * num);
+ bullet.x += (20 * num * bullet.speed.x / bullet.speed.y) >> 0;
}
else {
- bullet.y-=(20*num);
- bullet.x-=(20*num*bullet.speed.x/bullet.speed.y)>>0;
+ bullet.y -= (20 * num);
+ bullet.x -= (20 * num * bullet.speed.x / bullet.speed.y) >> 0;
}
}
}
};
//Add our buildings
- Building.ZergBuilding.SunkenColony.prototype.attackLimit=null;
- Building.ZergBuilding.SunkenColony.prototype.attackRange=700;
- Building.ZergBuilding.SunkenColony.prototype.HP=9999;
- new Building.ZergBuilding.SunkenColony({x:2524,y:452});
- new Building.ZergBuilding.SunkenColony({x:60,y:1500});
- new Building.ZergBuilding.SunkenColony({x:2438,y:2320});
- Building.ZergBuilding.SporeColony.prototype.attackLimit=null;
- Building.ZergBuilding.SporeColony.prototype.attackRange=700;
- Building.ZergBuilding.SporeColony.prototype.HP=9999;
- new Building.ZergBuilding.SporeColony({x:3980,y:1500});
- new Building.ZergBuilding.SporeColony({x:1476,y:452});
- new Building.ZergBuilding.SporeColony({x:1240,y:2956});
- Building.TerranBuilding.MissileTurret.prototype.attackLimit=null;
- Building.TerranBuilding.MissileTurret.prototype.attackRange=700;
- Building.TerranBuilding.MissileTurret.prototype.HP=9999;
- new Building.TerranBuilding.MissileTurret({x:3228,y:2632});
- new Building.TerranBuilding.MissileTurret({x:2000,y:80});
- new Building.TerranBuilding.MissileTurret({x:784,y:2320});
- Building.ProtossBuilding.PhotonCannon.prototype.attackLimit=null;
- Building.ProtossBuilding.PhotonCannon.prototype.attackRange=700;
- Building.ProtossBuilding.PhotonCannon.prototype.SP=9999;
- new Building.ProtossBuilding.PhotonCannon({x:3228,y:1054});
- new Building.ProtossBuilding.PhotonCannon({x:784,y:1054});
- new Building.ProtossBuilding.PhotonCannon({x:1684,y:2320});
- Building.ProtossBuilding.TeleportPoint.prototype.SP=9999;
- new Building.ProtossBuilding.TeleportPoint({x:2060,y:1586});
+ Building.ZergBuilding.SunkenColony.prototype.attackLimit = null;
+ Building.ZergBuilding.SunkenColony.prototype.attackRange = 700;
+ Building.ZergBuilding.SunkenColony.prototype.HP = 9999;
+ new Building.ZergBuilding.SunkenColony({ x: 2524, y: 452 });
+ new Building.ZergBuilding.SunkenColony({ x: 60, y: 1500 });
+ new Building.ZergBuilding.SunkenColony({ x: 2438, y: 2320 });
+ Building.ZergBuilding.SporeColony.prototype.attackLimit = null;
+ Building.ZergBuilding.SporeColony.prototype.attackRange = 700;
+ Building.ZergBuilding.SporeColony.prototype.HP = 9999;
+ new Building.ZergBuilding.SporeColony({ x: 3980, y: 1500 });
+ new Building.ZergBuilding.SporeColony({ x: 1476, y: 452 });
+ new Building.ZergBuilding.SporeColony({ x: 1240, y: 2956 });
+ Building.TerranBuilding.MissileTurret.prototype.attackLimit = null;
+ Building.TerranBuilding.MissileTurret.prototype.attackRange = 700;
+ Building.TerranBuilding.MissileTurret.prototype.HP = 9999;
+ new Building.TerranBuilding.MissileTurret({ x: 3228, y: 2632 });
+ new Building.TerranBuilding.MissileTurret({ x: 2000, y: 80 });
+ new Building.TerranBuilding.MissileTurret({ x: 784, y: 2320 });
+ Building.ProtossBuilding.PhotonCannon.prototype.attackLimit = null;
+ Building.ProtossBuilding.PhotonCannon.prototype.attackRange = 700;
+ Building.ProtossBuilding.PhotonCannon.prototype.SP = 9999;
+ new Building.ProtossBuilding.PhotonCannon({ x: 3228, y: 1054 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 784, y: 1054 });
+ new Building.ProtossBuilding.PhotonCannon({ x: 1684, y: 2320 });
+ Building.ProtossBuilding.TeleportPoint.prototype.SP = 9999;
+ new Building.ProtossBuilding.TeleportPoint({ x: 2060, y: 1586 });
//Add our unit
- new Hero.Tassadar({x:3200,y:3072-Game.VBOUND/2}).magic=999;
+ new Hero.Tassadar({ x: 3200, y: 3072 - Game.VBOUND / 2 }).magic = 999;
//Override win and lose condition
- var killCount=0;//Closure
- Referee.winCondition=function(){
- var kills=0;
- Building.ourBuildings().forEach(function(build){
- if (build.kill) kills+=build.kill;
+ var killCount = 0; //Closure
+ Referee.winCondition = function () {
+ var kills = 0;
+ Building.ourBuildings().forEach(function (build) {
+ if (build.kill)
+ kills += build.kill;
});
- if (kills>killCount){
- Resource[0].mine+=(kills-killCount);
- killCount=kills;
+ if (kills > killCount) {
+ Resource[0].mine += (kills - killCount);
+ killCount = kills;
}
- return (wave>num && Unit.allEnemyUnits().length==0);
+ return (wave > num && Unit.allEnemyUnits().length == 0);
};
- var LIFE=20;
- Referee.loseCondition=function(){
+ var LIFE = 20;
+ Referee.loseCondition = function () {
//Closure LIFE
- Unit.allEnemyUnits().forEach(function(chara){
- if (chara.inside({centerX:2048,centerY:1536,radius:200})){
+ Unit.allEnemyUnits().forEach(function (chara) {
+ if (chara.inside({ centerX: 2048, centerY: 1536, radius: 200 })) {
LIFE--;
- Game.showMessage('Remaining life: '+LIFE);
+ Game.showMessage('Remaining life: ' + LIFE);
chara.die();
}
});
- return (LIFE<=0);
+ return (LIFE <= 0);
};
//Enemy coming
- var num=0, wave=1;
- var interval=30000;//30 seconds per wave
- _$.traverse([Neutral,Zerg,Terran,Protoss],function(enemyType){
- Game.commandTimeout(function(){
- for (var N=0;N<15;N++){
- (function(n){
- Game.commandTimeout(function(){
- var enemy=new enemyType({x:3622,y:2916,team:1});
+ var num = 0, wave = 1;
+ var interval = 30000; //30 seconds per wave
+ _$.traverse([Neutral, Zerg, Terran, Protoss], function (enemyType) {
+ Game.commandTimeout(function () {
+ for (var N = 0; N < 15; N++) {
+ (function (n) {
+ Game.commandTimeout(function () {
+ var enemy = new enemyType({ x: 3622, y: 2916, team: 1 });
//Focus on routing
- if (enemy.attack) enemy.attack=function(){
- this.targetLock=true;
- };
+ if (enemy.attack)
+ enemy.attack = function () {
+ this.targetLock = true;
+ };
//Enemies route
- Game.commandTimeout(function(){
- enemy.targetLock=true;
- enemy.destination={x:3622,y:280};
- enemy.destination.next={x:422,y:280};
- enemy.destination.next.next={x:422,y:2800};
- enemy.destination.next.next.next={x:2100,y:2800};
- enemy.destination.next.next.next.next={x:2100,y:1500};
- },0);
- },n*1000);
+ Game.commandTimeout(function () {
+ enemy.targetLock = true;
+ enemy.destination = { x: 3622, y: 280 };
+ enemy.destination.next = { x: 422, y: 280 };
+ enemy.destination.next.next = { x: 422, y: 2800 };
+ enemy.destination.next.next.next = { x: 2100, y: 2800 };
+ enemy.destination.next.next.next.next = { x: 2100, y: 1500 };
+ }, 0);
+ }, n * 1000);
})(N);
}
- Game.showWarning('Wave '+ wave++ +': '+enemyType.prototype.name);
- },interval*num++);
+ Game.showWarning('Wave ' + wave++ + ': ' + enemyType.prototype.name);
+ }, interval * num++);
});
//Game win when time reach
- Game.commandTimeout(function(){
+ Game.commandTimeout(function () {
Game.win();
- },interval*num+60000);
+ }, interval * num + 60000);
}
},
{
- level:12,
- label:'Replay',
- load:function(){
+ level: 12,
+ label: 'Replay',
+ load: function () {
//Load replay
- var lastReplay=localStorage.getItem('lastReplay');
- if (lastReplay!=null){
- Game.replayFlag=true;
+ var lastReplay = localStorage.getItem('lastReplay');
+ if (lastReplay != null) {
+ Game.replayFlag = true;
//Map.fogFlag=false;
// Should not click buttons or trigger key control during replay
- Button.equipButtonsFor=function(){};
+ Button.equipButtonsFor = function () { };
//Equip with replay buttons
Button.equipButtonsForReplay();
//Parse last replay data
- lastReplay=JSON.parse(lastReplay);
+ lastReplay = JSON.parse(lastReplay);
//Select same team
- if (lastReplay.hasOwnProperty('team')) Game.team=lastReplay.team;
- Levels[lastReplay.level-1].load();
- Game.replayLevel=lastReplay.level;
+ if (lastReplay.hasOwnProperty('team'))
+ Game.team = lastReplay.team;
+ Levels[lastReplay.level - 1].load();
+ Game.replayLevel = lastReplay.level;
//Parse user moves
- var recordCmds=lastReplay.cmds;
- for (var tick in recordCmds){
- Multiplayer.parseTickCmd({tick:parseInt(tick),cmds:recordCmds[tick]});
+ var recordCmds = lastReplay.cmds;
+ for (var tick in recordCmds) {
+ Multiplayer.parseTickCmd({ tick: parseInt(tick), cmds: recordCmds[tick] });
}
//Replay ends
- Game.endTick=lastReplay.end;
- Game.commandTimeout(function(){
+ Game.endTick = lastReplay.end;
+ Game.commandTimeout(function () {
Game.stopAnimation();
- $('div.panel_Control button').attr('disabled',true);
- Game.showMessage('Replay ended...',10000);
- },100*Game.endTick);
+ $('div.panel_Control button').attr('disabled', true);
+ Game.showMessage('Replay ended...', 10000);
+ }, 100 * Game.endTick);
}
else {
alert('Cannot find any replay!');
@@ -941,4 +949,5 @@ var Levels=[
}
}
}
-];
\ No newline at end of file
+];
+//# sourceMappingURL=Levels.js.map
\ No newline at end of file
diff --git a/GameRule/Levels.ts b/GameRule/Levels.ts
new file mode 100644
index 0000000..b550ea7
--- /dev/null
+++ b/GameRule/Levels.ts
@@ -0,0 +1,944 @@
+var Levels=[
+ {
+ level:1,
+ load:function(){
+ //Load map
+ Map.setCurrentMap('Switchback');
+ //Choose side and apply race style
+ var races=['Terran','Zerg'];
+ var startPoint=[{x:50,y:50},{x:200,y:50}];
+ if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ Game.race.choose(races[Game.team]);
+ Map.offsetX=startPoint[Game.team].x;
+ Map.offsetY=startPoint[Game.team].y;
+ //Load units
+ new Terran.BattleCruiser({x:100,y:100});
+ new Terran.Wraith({x:200,y:100});
+ new Terran.BattleCruiser({x:100,y:200});
+ new Terran.Wraith({x:200,y:200});
+ new Terran.BattleCruiser({x:100,y:300});
+ new Terran.Wraith({x:200,y:300});
+ new Terran.SCV({x:100,y:400});
+ new Building.TerranBuilding.MissileTurret({x:100,y:150});
+ new Building.ProtossBuilding.PhotonCannon({x:100,y:250});
+ //Add enemy
+ new Zerg.Drone({x:600,y:400,team:1});
+ new Zerg.Mutalisk({x:700,y:100,team:1});
+ new Zerg.Devourer({x:800,y:100,team:1});
+ new Zerg.Guardian({x:900,y:100,team:1});
+ new Zerg.Mutalisk({x:700,y:200,team:1});
+ new Zerg.Devourer({x:800,y:200,team:1});
+ new Zerg.Guardian({x:900,y:200,team:1});
+ new Zerg.Mutalisk({x:700,y:300,team:1});
+ new Zerg.Devourer({x:800,y:300,team:1});
+ new Zerg.Guardian({x:900,y:300,team:1});
+ //Apply cheat for testing
+ Game.commandTimeout(function(){
+ Cheat.execute('show me the money');
+ },0);
+ }
+ },
+ {
+ level:2,
+ load:function(){
+ //Test multiplayer
+ if (!Game.replayFlag && confirm('Want enter multiplayer mode?')){
+ //Enable multiplayer
+ Multiplayer.enable();//Has fog for level2
+ }
+ //Load map
+ Map.setCurrentMap('Volcanis');
+ Map.offsetX=120;
+ Map.offsetY=50;
+ //Apply race style
+ Game.race.choose('Zerg');
+ //Load units
+ new Zerg.Overlord({x:100,y:100});
+ new Zerg.Guardian({x:100,y:200});
+ new Zerg.Devourer({x:100,y:300});
+ new Zerg.Mutalisk({x:200,y:100});
+ new Zerg.Devourer({x:200,y:200});
+ new Zerg.Guardian({x:200,y:300});
+ new Zerg.Mutalisk({x:300,y:100});
+ new Zerg.Devourer({x:300,y:200});
+ new Zerg.Guardian({x:300,y:300});
+ new Building.ZergBuilding.SporeColony({x:100,y:200});
+ //Add enemy
+ new Terran.Wraith({x:700,y:100,team:1});
+ new Terran.Wraith({x:800,y:100,team:1});
+ new Terran.Wraith({x:900,y:100,team:1});
+ new Terran.Civilian({x:700,y:200,team:1});
+ new Terran.Civilian({x:800,y:200,team:1});
+ new Terran.Civilian({x:900,y:200,team:1});
+ new Terran.BattleCruiser({x:700,y:300,team:1});
+ new Terran.BattleCruiser({x:800,y:300,team:1});
+ new Terran.BattleCruiser({x:900,y:300,team:1});
+ }
+ },
+ {
+ level:3,
+ load:function(){
+ //Load map
+ Map.setCurrentMap('TrenchWars');
+ //Apply race style
+ Game.race.choose('Zerg');
+ //Load units
+ new Neutral.Ragnasaur({x:100,y:100});
+ new Neutral.Rhynsdon({x:200,y:100});
+ new Neutral.Ursadon({x:100,y:200});
+ new Neutral.Bengalaas({x:200,y:200});
+ new Neutral.Scantid({x:100,y:300});
+ new Neutral.Kakaru({x:200,y:300});
+ new Zerg.Hydralisk({x:150,y:100});
+ new Zerg.Lurker({x:150,y:200});
+ new Zerg.Ultralisk({x:150,y:300});
+ //Add enemy
+ new Neutral.Ragnasaur({x:700,y:100,team:1});
+ new Neutral.Rhynsdon({x:700,y:200,team:1});
+ new Neutral.Ursadon({x:700,y:300,team:1});
+ new Neutral.Bengalaas({x:800,y:100,team:1});
+ new Neutral.Scantid({x:800,y:200,team:1});
+ new Neutral.Kakaru({x:800,y:300,team:1});
+ }
+ },
+ {
+ level:4,
+ load:function(){
+ //Test multiplayer
+ /*if (!Game.replayFlag && confirm('Want enter multiplayer mode?')){
+ //Enable multiplayer
+ Multiplayer.enable();
+ Game.commandTimeout(function(){
+ //Upgrade all grades
+ for (var grade in Upgrade){
+ Upgrade[grade].effect(0);
+ Upgrade[grade].effect(1);
+ }
+ Resource[0].mine=Resource[1].mine=10000;
+ Resource[0].gas=Resource[1].gas=10000;
+ },0);
+ Cheat.manUnlimited=true;
+ Map.fogFlag=false;
+ }*/
+ //Load map
+ Map.setCurrentMap('BloodBath');
+ //Choose side and apply race style
+ var races=['Zerg','Terran'];
+ var startPoint=[{x:0,y:50},{x:200,y:50}];
+ if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ Game.race.choose(races[Game.team]);
+ Map.offsetX=startPoint[Game.team].x;
+ Map.offsetY=startPoint[Game.team].y;
+ //Load units
+ new Zerg.Drone({x:100,y:100});
+ new Zerg.Zergling({x:200,y:100});
+ new Zerg.Hydralisk({x:100,y:200});
+ new Zerg.Scourge({x:200,y:200});
+ new Zerg.Lurker({x:100,y:300});
+ new Zerg.Ultralisk({x:200,y:300});
+ new Zerg.Broodling({x:100,y:400});
+ new Zerg.InfestedTerran({x:200,y:400});
+ new Zerg.Queen({x:100,y:50});
+ new Zerg.Defiler({x:200,y:50});
+ new Hero.Sarah({x:100,y:150});
+ new Zerg.Mutalisk({x:50,y:50});
+ new Zerg.Guardian({x:50,y:150});
+ new Zerg.Devourer({x:50,y:250});
+ new Zerg.Overlord({x:50,y:350});
+ //Add enemy
+ new Terran.Marine({x:700,y:100,team:1});
+ new Terran.Firebat({x:700,y:200,team:1});
+ new Terran.Vulture({x:700,y:300,team:1});
+ new Terran.Tank({x:800,y:100,team:1});
+ new Terran.Goliath({x:800,y:200,team:1});
+ new Terran.Dropship({x:800,y:300,team:1});
+ new Terran.Ghost({x:700,y:50,team:1});
+ new Terran.Vessel({x:700,y:150,team:1});
+ new Terran.Valkyrie({x:700,y:250,team:1});
+ new Terran.Medic({x:750,y:50,team:1});
+ new Terran.Wraith({x:750,y:150,team:1});
+ new Terran.BattleCruiser({x:750,y:250,team:1});
+ new Terran.SCV({x:750,y:300,team:1});
+ //Apply cheat for testing
+ Game.commandTimeout(function(){
+ Cheat.execute('show me the money');
+ Cheat.execute('something for nothing');
+ Cheat.execute('full recovery');
+ },0);
+ }
+ },
+ {
+ level:5,
+ load:function(){
+ //Load map
+ Map.setCurrentMap('OrbitalRelay');
+ //Choose side and apply race style
+ var races=['Terran','Protoss'];
+ var startPoint=[{x:0,y:50},{x:200,y:50}];
+ if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ Game.race.choose(races[Game.team]);
+ Map.offsetX=startPoint[Game.team].x;
+ Map.offsetY=startPoint[Game.team].y;
+ //Load units
+ new Terran.Marine({x:100,y:100});
+ new Terran.Firebat({x:200,y:100});
+ new Terran.Ghost({x:100,y:200});
+ new Terran.Vulture({x:200,y:200});
+ new Terran.Tank({x:100,y:300});
+ new Terran.Goliath({x:200,y:300});
+ new Terran.Medic({x:100,y:400});
+ new Terran.Dropship({x:200,y:400});
+ new Terran.Vessel({x:100,y:50});
+ new Terran.Valkyrie({x:200,y:50});
+ new Hero.Kerrigan({x:100,y:150});
+ new Terran.Wraith({x:200,y:150});
+ new Terran.SCV({x:50,y:250});
+ new Terran.BattleCruiser({x:150,y:250});
+ //Add enemy
+ new Protoss.Probe({x:700,y:100,team:1});
+ new Protoss.Zealot({x:700,y:200,team:1});
+ new Protoss.Dragoon({x:700,y:300,team:1});
+ new Protoss.Templar({x:800,y:100,team:1});
+ new Protoss.DarkTemplar({x:800,y:200,team:1});
+ new Protoss.Observer({x:800,y:300,team:1});
+ new Protoss.Reaver({x:800,y:300,team:1});
+ new Protoss.Arbiter({x:700,y:250,team:1});
+ new Protoss.Scout({x:750,y:250,team:1});
+ new Protoss.Carrier({x:700,y:150,team:1});
+ new Protoss.Corsair({x:700,y:200,team:1});
+ new Protoss.Archon({x:750,y:50,team:1});
+ new Protoss.DarkArchon({x:750,y:150,team:1});
+ new Protoss.Shuttle({x:850,y:150,team:1});
+ new Protoss.Observer({x:850,y:250,team:1});
+ //Apply cheat for testing magic
+ Game.commandTimeout(function(){
+ Cheat.execute('show me the money');
+ Cheat.execute('something for nothing');
+ Cheat.execute('full recovery');
+ },0);
+ }
+ },
+ {
+ level:6,
+ load:function(){
+ //Load map
+ Map.setCurrentMap('ThinIce');
+ //Choose side and apply race style
+ var races=['Protoss','Zerg'];
+ var startPoint=[{x:0,y:50},{x:200,y:50}];
+ if (!Game.replayFlag) Game.team=Math.random()*2>>0;
+ Game.race.choose(races[Game.team]);
+ Map.offsetX=startPoint[Game.team].x;
+ Map.offsetY=startPoint[Game.team].y;
+ //Load units
+ new Protoss.Probe({x:100,y:100});
+ new Protoss.Zealot({x:200,y:100});
+ new Protoss.Dragoon({x:100,y:200});
+ new Protoss.Templar({x:200,y:200});
+ new Protoss.DarkTemplar({x:100,y:300});
+ new Protoss.Reaver({x:200,y:300});
+ new Protoss.Archon({x:100,y:400});
+ new Protoss.DarkArchon({x:200,y:400});
+ new Protoss.Shuttle({x:100,y:50});
+ new Protoss.Observer({x:200,y:50});
+ new Protoss.Observer({x:200,y:100});
+ new Protoss.Arbiter({x:100,y:150});
+ new Protoss.Scout({x:200,y:150});
+ new Protoss.Carrier({x:100,y:250});
+ new Protoss.Corsair({x:200,y:250});
+ //Add enemy
+ new Zerg.Drone({x:700,y:100,team:1});
+ new Zerg.Zergling({x:700,y:200,team:1});
+ new Zerg.Hydralisk({x:700,y:300,team:1});
+ new Zerg.Scourge({x:800,y:100,team:1});
+ new Zerg.Lurker({x:800,y:200,team:1});
+ new Zerg.Ultralisk({x:800,y:300,team:1});
+ new Zerg.Broodling({x:700,y:150,team:1});
+ new Zerg.InfestedTerran({x:700,y:250,team:1});
+ new Zerg.Queen({x:800,y:150,team:1});
+ new Zerg.Defiler({x:800,y:250,team:1});
+ new Zerg.Mutalisk({x:750,y:50,team:1});
+ new Zerg.Guardian({x:750,y:150,team:1});
+ new Zerg.Devourer({x:750,y:250,team:1});
+ new Zerg.Overlord({x:850,y:150,team:1});
+ //Apply cheat for testing magic
+ Game.commandTimeout(function(){
+ Cheat.execute('show me the money');
+ Cheat.execute('something for nothing');
+ Cheat.execute('full recovery');
+ },0);
+ }
+ },
+ {
+ level:7,
+ load:function(){
+ //Load map
+ Map.setCurrentMap('BigGameHunters');
+ //Apply race style
+ Game.race.choose('Protoss');
+ //Add buildings
+ //Zerg buildings
+ new Building.ZergBuilding.Hatchery({x:0,y:520});
+ new Building.ZergBuilding.Lair({x:0,y:670}).life=150;
+ new Building.ZergBuilding.Hive({x:0,y:820});
+ new Building.ZergBuilding.CreepColony({x:150,y:520});
+ new Building.ZergBuilding.SunkenColony({x:150,y:670});
+ new Building.ZergBuilding.SporeColony({x:150,y:820,team:1});
+ new Building.ZergBuilding.Extractor({x:300,y:520});
+ new Building.ZergBuilding.SpawningPool({x:300,y:670});
+ new Building.ZergBuilding.EvolutionChamber({x:300,y:820});
+ new Building.ZergBuilding.HydraliskDen({x:450,y:520});
+ new Building.ZergBuilding.Spire({x:450,y:670});
+ new Building.ZergBuilding.GreaterSpire({x:450,y:820});
+ new Building.ZergBuilding.QueenNest({x:600,y:520});
+ new Building.ZergBuilding.NydusCanal({x:600,y:670});
+ new Building.ZergBuilding.UltraliskCavern({x:600,y:820});
+ new Building.ZergBuilding.DefilerMound({x:750,y:520});
+ new Building.ZergBuilding.InfestedBase({x:750,y:670});
+ new Building.ZergBuilding.OvermindI({x:750,y:820});
+ new Building.ZergBuilding.OvermindII({x:900,y:520});
+ //Terran buildings
+ new Building.TerranBuilding.CommandCenter({x:0,y:1020,team:1}).life=375;
+ new Building.TerranBuilding.SupplyDepot({x:0,y:1170,team:1});
+ new Building.TerranBuilding.Refinery({x:0,y:1320});
+ new Building.TerranBuilding.Barracks({x:150,y:1020});
+ new Building.TerranBuilding.EngineeringBay({x:150,y:1170});
+ new Building.TerranBuilding.MissileTurret({x:150,y:1320});
+ new Building.TerranBuilding.Academy({x:300,y:1020});
+ new Building.TerranBuilding.Bunker({x:300,y:1170});
+ new Building.TerranBuilding.Factory({x:300,y:1320});
+ new Building.TerranBuilding.Starport({x:450,y:1020});
+ new Building.TerranBuilding.ScienceFacility({x:450,y:1170});
+ new Building.TerranBuilding.Armory({x:450,y:1320});
+ new Building.TerranBuilding.ComstatStation({x:600,y:1020});
+ new Building.TerranBuilding.NuclearSilo({x:600,y:1170});
+ new Building.TerranBuilding.MachineShop({x:600,y:1320});
+ new Building.TerranBuilding.ControlTower({x:750,y:1020});
+ new Building.TerranBuilding.PhysicsLab({x:750,y:1170});
+ new Building.TerranBuilding.ConvertOps({x:750,y:1320});
+ new Building.TerranBuilding.CrashCruiser({x:900,y:1020});
+ new Building.TerranBuilding.BigCannon({x:900,y:1170});
+ //Protoss buildings
+ new Building.ProtossBuilding.Nexus({x:0,y:20}).life=150;
+ new Building.ProtossBuilding.Pylon({x:0,y:170,team:1});
+ new Building.ProtossBuilding.Assimilator({x:0,y:320});
+ new Building.ProtossBuilding.Gateway({x:150,y:20});
+ new Building.ProtossBuilding.Forge({x:150,y:170});
+ new Building.ProtossBuilding.PhotonCannon({x:150,y:320});
+ new Building.ProtossBuilding.CyberneticsCore({x:300,y:20});
+ new Building.ProtossBuilding.ShieldBattery({x:300,y:170});
+ new Building.ProtossBuilding.RoboticsFacility({x:300,y:320});
+ new Building.ProtossBuilding.StarGate({x:450,y:20});
+ new Building.ProtossBuilding.CitadelOfAdun({x:450,y:170});
+ new Building.ProtossBuilding.RoboticsSupportBay({x:450,y:320});
+ new Building.ProtossBuilding.FleetBeacon({x:600,y:20});
+ new Building.ProtossBuilding.TemplarArchives({x:600,y:170});
+ new Building.ProtossBuilding.Observatory({x:600,y:320});
+ new Building.ProtossBuilding.ArbiterTribunal({x:750,y:20});
+ new Building.ProtossBuilding.TeleportGate({x:750,y:170});
+ new Building.ProtossBuilding.Pyramid({x:750,y:320});
+ new Building.ProtossBuilding.TeleportPoint({x:900,y:20});
+ //Apply cheat for testing magic
+ Game.commandTimeout(function(){
+ Cheat.execute('show me the money');
+ },0);
+ }
+ },
+ {
+ level:8,
+ label:'Campaign',
+ load:function(){
+ //Load map
+ Map.setCurrentMap('TheHunters');
+ Map.offsetX=0;
+ Map.offsetY=3424;
+ //Multiplayer
+ Game.playerNum=4;
+ //Choose side and apply race style
+ var races=['Terran','Zerg','Terran','Protoss'];
+ var startPoint=[{x:100,y:4000-innerHeight},{x:4000-innerWidth,y:4000-innerHeight},{x:100,y:100},{x:4000-innerWidth,y:100}];
+ if (!Game.replayFlag) Game.team=Math.random()*4>>0;
+ Game.race.choose(races[Game.team]);
+ Map.offsetX=startPoint[Game.team].x;
+ Map.offsetY=startPoint[Game.team].y;
+ //Apply cheat
+ Cheat.execute('black sheep wall');
+ //Our buildings and units
+ new Building.ZergBuilding.OvermindI({x:662,y:3828});
+ new Building.ZergBuilding.OvermindII({x:300,y:3694});
+ new Building.TerranBuilding.CrashCruiser({x:820,y:3600});
+ new Building.TerranBuilding.BigCannon({x:260,y:3560});
+ new Building.ProtossBuilding.Pyramid({x:560,y:3690});
+ new Building.ProtossBuilding.TeleportGate({x:560,y:3558});
+ new Building.ProtossBuilding.TeleportPoint({x:534,y:3884});
+ new Hero.HeroCruiser({x:300,y:3455});
+ new Hero.HeroCruiser({x:690,y:3500});
+ new Hero.HeroCruiser({x:866,y:3744});
+ new Hero.Sarah({x:434,y:3600});
+ new Hero.Sarah({x:700,y:3730});
+ new Hero.Kerrigan({x:464,y:3568});
+ new Hero.Kerrigan({x:694,y:3690});
+ new Protoss.Observer({x:484,y:3824});
+ new Protoss.Observer({x:524,y:3824});
+ //Zerg
+ new Building.ZergBuilding.Hatchery({x:3470,y:3720,team:1});
+ new Building.ZergBuilding.Lair({x:3265,y:3795,team:1});
+ new Building.ZergBuilding.Hive({x:3650,y:3700,team:1});
+ new Building.ZergBuilding.CreepColony({x:3488,y:3552,team:1});
+ new Building.ZergBuilding.CreepColony({x:3264,y:3552,team:1});
+ new Building.ZergBuilding.SunkenColony({x:3328,y:3552,team:1});
+ new Building.ZergBuilding.SunkenColony({x:3392,y:3552,team:1});
+ new Building.ZergBuilding.SporeColony({x:3136,y:3552,team:1});
+ new Building.ZergBuilding.Extractor({x:3420,y:3800,team:1});
+ new Building.ZergBuilding.SpawningPool({x:3440,y:3616,team:1});
+ new Building.ZergBuilding.EvolutionChamber({x:3248,y:3616,team:1});
+ new Building.ZergBuilding.HydraliskDen({x:3344,y:3616,team:1});
+ new Building.ZergBuilding.Spire({x:3744,y:3552,team:1});
+ new Building.ZergBuilding.GreaterSpire({x:3808,y:3616,team:1});
+ new Building.ZergBuilding.QueenNest({x:3728,y:3616,team:1});
+ new Building.ZergBuilding.NydusCanal({x:3200,y:3552,team:1});
+ new Building.ZergBuilding.UltraliskCavern({x:3824,y:3520,team:1});
+ new Building.ZergBuilding.DefilerMound({x:3104,y:3776,team:1});
+ new Building.ZergBuilding.InfestedBase({x:3264,y:3920,team:1});
+ new Zerg.Drone({x:3828,y:3724,team:1});
+ new Zerg.Drone({x:3832,y:3826,team:1});
+ new Zerg.Drone({x:3700,y:3850,team:1});
+ new Zerg.Zergling({x:3473,y:3500,team:1});
+ new Zerg.Zergling({x:3541,y:3535,team:1});
+ new Zerg.Hydralisk({x:3314,y:3500,team:1});
+ new Zerg.Hydralisk({x:3353,y:3500,team:1});
+ new Zerg.Overlord({x:3044,y:3632,team:1});
+ new Zerg.Overlord({x:3522,y:3438,team:1});
+ new Zerg.Mutalisk({x:3135,y:3615,team:1});
+ new Zerg.Mutalisk({x:3870,y:3596,team:1});
+ new Zerg.Devourer({x:3292,y:3675,team:1});
+ new Zerg.Devourer({x:3644,y:3535,team:1});
+ new Zerg.Guardian({x:3138,y:3675,team:1});
+ new Zerg.Guardian({x:3580,y:3585,team:1});
+ new Zerg.Scourge({x:3154,y:3490,team:1});
+ new Zerg.Scourge({x:3213,y:3668,team:1});
+ new Zerg.Lurker({x:3260,y:3500,team:1});
+ new Zerg.Lurker({x:3408,y:3500,team:1});
+ new Zerg.Ultralisk({x:3638,y:3463,team:1});
+ new Zerg.Broodling({x:3602,y:3666,team:1});
+ new Zerg.InfestedTerran({x:3184,y:3950,team:1});
+ new Zerg.Queen({x:3647,y:3610,team:1});
+ new Zerg.Defiler({x:3047,y:3710,team:1});
+ //Terran
+ new Building.TerranBuilding.CommandCenter({x:320,y:180,team:2});
+ new Building.TerranBuilding.ComstatStation({x:434,y:220,team:2});
+ new Building.TerranBuilding.SupplyDepot({x:368,y:416,team:2});
+ new Building.TerranBuilding.SupplyDepot({x:464,y:416,team:2});
+ new Building.TerranBuilding.SupplyDepot({x:368,y:480,team:2});
+ new Building.TerranBuilding.SupplyDepot({x:464,y:480,team:2});
+ new Building.TerranBuilding.Refinery({x:96,y:246,team:2});
+ new Building.TerranBuilding.Barracks({x:576,y:432,team:2});
+ new Building.TerranBuilding.EngineeringBay({x:576,y:336,team:2});
+ new Building.TerranBuilding.MissileTurret({x:384,y:576,team:2});
+ new Building.TerranBuilding.MissileTurret({x:544,y:576,team:2});
+ new Building.TerranBuilding.Academy({x:272,y:416,team:2});
+ new Building.TerranBuilding.Bunker({x:636,y:556,team:2});
+ new Building.TerranBuilding.Bunker({x:764,y:460,team:2});
+ new Building.TerranBuilding.Factory({x:732,y:220,team:2});
+ new Building.TerranBuilding.MachineShop({x:832,y:256,team:2});
+ new Building.TerranBuilding.Starport({x:732,y:316,team:2});
+ new Building.TerranBuilding.ControlTower({x:832,y:352,team:2});
+ new Building.TerranBuilding.ScienceFacility({x:60,y:390,team:2});
+ new Building.TerranBuilding.PhysicsLab({x:160,y:416,team:2});
+ new Building.TerranBuilding.Armory({x:272,y:480,team:2});
+ new Terran.SCV({x:246,y:116,team:2});
+ new Terran.SCV({x:400,y:114,team:2});
+ new Terran.SCV({x:222,y:220,team:2});
+ new Terran.Marine({x:816,y:528,team:2});
+ new Terran.Marine({x:726,y:590,team:2});
+ new Terran.Firebat({x:692,y:618,team:2});
+ new Terran.Firebat({x:846,y:526,team:2});
+ new Terran.Ghost({x:690,y:530,team:2});
+ new Terran.Medic({x:725,y:528,team:2});
+ new Terran.Vulture({x:918,y:373,team:2});
+ new Terran.Vulture({x:920,y:512,team:2});
+ new Terran.Tank({x:922,y:325,team:2});
+ new Terran.Tank({x:920,y:468,team:2});
+ new Terran.Goliath({x:918,y:270,team:2});
+ new Terran.Goliath({x:940,y:420,team:2});
+ new Terran.Wraith({x:672,y:400,team:2});
+ new Terran.Wraith({x:728,y:400,team:2});
+ new Terran.Dropship({x:475,y:548,team:2});
+ new Terran.Vessel({x:692,y:472,team:2});
+ new Terran.BattleCruiser({x:500,y:326,team:2});
+ new Terran.BattleCruiser({x:580,y:510,team:2});
+ new Terran.Valkyrie({x:790,y:400,team:2});
+ new Terran.Valkyrie({x:854,y:400,team:2});
+ new Terran.Civilian({x:400,y:350,team:2});
+ new Terran.Civilian({x:580,y:250,team:2});
+ //Protoss
+ new Building.ProtossBuilding.Nexus({x:3614,y:222,team:3});
+ new Building.ProtossBuilding.Pylon({x:3296,y:512,team:3});
+ new Building.ProtossBuilding.Pylon({x:3424,y:288,team:3});
+ new Building.ProtossBuilding.Pylon({x:3648,y:512,team:3});
+ new Building.ProtossBuilding.Assimilator({x:3582,y:86,team:3});
+ new Building.ProtossBuilding.Gateway({x:3648,y:624,team:3});
+ new Building.ProtossBuilding.Forge({x:3504,y:448,team:3});
+ new Building.ProtossBuilding.PhotonCannon({x:3200,y:448,team:3});
+ new Building.ProtossBuilding.PhotonCannon({x:3200,y:608,team:3});
+ new Building.ProtossBuilding.PhotonCannon({x:3392,y:608,team:3});
+ new Building.ProtossBuilding.CyberneticsCore({x:3760,y:448,team:3});
+ new Building.ProtossBuilding.ShieldBattery({x:3728,y:544,team:3});
+ new Building.ProtossBuilding.RoboticsFacility({x:3344,y:224,team:3});
+ new Building.ProtossBuilding.StarGate({x:3232,y:304,team:3});
+ new Building.ProtossBuilding.CitadelOfAdun({x:3632,y:408,team:3});
+ new Building.ProtossBuilding.RoboticsSupportBay({x:3344,y:384,team:3});
+ new Building.ProtossBuilding.FleetBeacon({x:3438,y:182,team:3});
+ new Building.ProtossBuilding.TemplarArchives({x:3504,y:544,team:3});
+ new Building.ProtossBuilding.Observatory({x:3504,y:320,team:3});
+ new Building.ProtossBuilding.ArbiterTribunal({x:3216,y:192,team:3});
+ new Protoss.Probe({x:3668,y:202,team:3});
+ new Protoss.Probe({x:3794,y:244,team:3});
+ new Protoss.Probe({x:3796,y:338,team:3});
+ new Protoss.Zealot({x:3535,y:640,team:3});
+ new Protoss.Zealot({x:3635,y:736,team:3});
+ new Protoss.Dragoon({x:3536,y:688,team:3});
+ new Protoss.Dragoon({x:3585,y:720,team:3});
+ new Protoss.Templar({x:3472,y:655,team:3});
+ new Protoss.DarkTemplar({x:3730,y:712,team:3});
+ new Protoss.Reaver({x:3358,y:475,team:3});
+ new Protoss.Archon({x:3478,y:722,team:3});
+ new Protoss.DarkArchon({x:3780,y:636,team:3});
+ new Protoss.Shuttle({x:3296,y:612,team:3});
+ new Protoss.Observer({x:3250,y:398,team:3});
+ new Protoss.Observer({x:3378,y:692,team:3});
+ new Protoss.Arbiter({x:3350,y:296,team:3});
+ new Protoss.Scout({x:3132,y:390,team:3});
+ new Protoss.Scout({x:3100,y:636,team:3});
+ new Protoss.Carrier({x:3102,y:470,team:3});
+ new Protoss.Corsair({x:3106,y:580,team:3});
+ new Protoss.Corsair({x:3838,y:544,team:3});
+ //Apply cheat for testing magic
+ Game.commandTimeout(function(){
+ Cheat.execute('show me the money');
+ },0);
+ }
+ },
+ {
+ level:9,
+ label:'ProtectAthena',
+ load:function(){
+ //Load map
+ Map.setCurrentMap('OrbitalRelay');
+ Map.offsetX=(1536-Game.HBOUND/2)>>0;
+ Map.offsetY=(1536-Game.VBOUND/2)>>0;
+ Map.fogFlag=false;
+ //Apply race style
+ Game.race.choose('Protoss');
+ //Single player
+ Multiplayer.ON=false;
+ //Add our buildings and units
+ //Override
+ Building.ProtossBuilding.Pyramid.prototype.HP=3000;
+ Building.ProtossBuilding.Pyramid.prototype.SP=3000;
+ Building.ProtossBuilding.Pyramid.prototype.detector=Gobj.detectorBuffer;
+ //Patch: Overlord speed up
+ Game.commandTimeout(function() {
+ Upgrade.EvolvePneumatizedCarapace.effect(1);
+ Upgrade.IncreaseCarrierCapacity.effect(1);
+ },0);
+ //Patch: Larva can move
+ Zerg.Larva.prototype.moveTo=Unit.prototype.moveTo;
+ Zerg.Larva.prototype.moveToward=Unit.prototype.moveToward;
+ var Pyramid=new Building.ProtossBuilding.Pyramid({x:1450,y:1480});
+ for (var N=0;N<6;N++){
+ new Hero.HeroCruiser({x:1470,y:1500});
+ }
+ //Override win and lose condition
+ Referee.winCondition=function(){
+ return false;
+ };
+ Referee.loseCondition=function(){
+ return Pyramid.status=='dead';//Closure
+ };
+ //Enemy coming
+ var offsets=[{x:1536,y:36},{x:1536,y:3036},{x:36,y:1536},{x:3036,y:1536},
+ {x:486,y:486},{x:486,y:2586},{x:2586,y:486},{x:2586,y:2586}];
+ var num=0, wave=1;
+ var interval=20000;//20 seconds per wave
+ _$.traverse([Neutral,Zerg,Terran,Protoss],function(enemyType){
+ Game.commandTimeout(function(){
+ offsets.forEach(function(offset){
+ offset.team=1;
+ new enemyType(offset).attackGround({x:1536,y:1536});
+ });
+ Game.showWarning('Wave '+ wave++ +': '+enemyType.prototype.name);
+ },interval*num++);
+ });
+ //Game win when time reach
+ Game.commandTimeout(function(){
+ Game.win();
+ },interval*num+interval);
+ }
+ },
+ {
+ level:10,
+ label:'HUNTERxHUNTER',
+ /*Once upon a time there was a young hunter lost in strange jungle, and was warmly welcome by forest friends.
+ # About 200 units in the map, designed for stress test
+ # You have 6 random kinds of magic, and will refresh when you killed each 50 units
+ # You can use magic freely without MP consumption
+ # Kill 10 units will upgrade, enemies will upgrade every 1 minute
+ # Infinite enemy number and unlimited upgrade level
+ # Two different modes: easy and nightmare*/
+ load:function(){
+ /*var isNightmare=confirm('Want challenge nightmare mode?');
+ if (!isNightmare){
+ //Make it easy
+ Hero.DevilHunter.prototype.HP=9999;
+ Hero.DevilHunter.prototype.SP=9999;
+ Hero.DevilHunter.prototype.MP=999;
+ Hero.DevilHunter.prototype.damage=50;
+ Hero.DevilHunter.prototype.isInvisible=true;
+ }*/
+ var isNightmare=true;
+ //Load map
+ Map.setCurrentMap('Grass');
+ var mapSize=Map.getCurrentMap();
+ Map.offsetX=(mapSize.width-Game.HBOUND)/2>>0;
+ Map.offsetY=(mapSize.height-Game.VBOUND)/2>>0;
+ //Apply race style
+ Game.race.choose('Zerg');
+ //Single player
+ Multiplayer.ON=false;
+ //Show me the money
+ Game.commandTimeout(function(){
+ Resource[0].mine=Resource[0].gas=9999;
+ },0);
+ //Fulfill nuclear bombs
+ Magic.NuclearStrike.enabled=999;
+ //Change kill to EXP:
+ $('p.kill').html('EXP:');
+ //Magic infinite
+ Cheat.execute('the gathering');
+ //Patch: Overlord speed up
+ Game.commandTimeout(function(){
+ Upgrade.EvolvePneumatizedCarapace.effect(1);
+ Upgrade.IncreaseCarrierCapacity.effect(1);
+ },0);
+ //Override win and lose condition
+ Referee.winCondition=function(){
+ //Infinite enemies
+ if (Unit.allUnits.length<150) {
+ Game.showWarning('Refreshing...');
+ Levels.enemyWave();
+ Levels.refreshMagic();
+ }
+ //Upgrade your hunter
+ var curLevel=Levels.DevilHunter.kill/10>>0;
+ if (curLevel>Levels.DevilHunter.level){
+ for (var N=0;N>0;
+ items[N]={name:magics[index]};
+ magics.splice(index,1);
+ }
+ Hero.DevilHunter.prototype.items=items;
+ Button.refreshButtons();
+ };
+ Levels.refreshMagic();
+ //Add units on map
+ Levels.DevilHunter=new Hero.DevilHunter({x:mapSize.width/2,y:mapSize.height/2});
+ Levels.DevilHunter.level=0;
+ Game.commandTimeout(function(){
+ Game.changeSelectedTo(Levels.DevilHunter);
+ },0);
+ //Enemy coming
+ Levels.enemyWave=function(){
+ var pos={team:1};
+ _$.traverse([Neutral,Zerg,Terran,Protoss],function(enemyType){
+ pos.x=(Game.getNextRandom()*mapSize.width)>>0;
+ pos.y=(Game.getNextRandom()*mapSize.height)>>0;
+ var enemy=new enemyType(pos);
+ if (enemy.attack){
+ enemy.attackLimit=null;
+ }
+ });
+ };
+ for(var N=0;N<4;N++){
+ Levels.enemyWave();
+ }
+ //Enemies will becomes stronger and stronger
+ Game.commandInterval(function(){
+ Game.showWarning('Enemies become stronger!');
+ //Upgrade all grades for enemy
+ for (var grade in Upgrade){
+ Upgrade[grade].effect(1);
+ }
+ },isNightmare?90000:60000);
+ //Baby hunter will talk every 30s
+ var speech=[
+ "What the hell is going on? Where am I?",
+ "This world is weird! There must be some mistake!",
+ "Hey, gloomyson, you sent me to the wrong game!",
+ "I'm so scared! I want my mummy!",
+ "Let me out! I wanna go home! Plz!",
+ "You dare fool me? I'm blind not deaf!",
+ "Do you know who I am? My papa is GinBliz!",
+ "Let me out of here! Or I'll tell papa to sue you!",
+ "At least let me pass hunter exam and get license first!",
+ "Nen power, release!",
+ "Help me, Killua, Kurapika!",
+ "(T_T) cry~~~"
+ ];
+ for (var N=0;NMath.abs(bullet.speed.y)){
+ if (bullet.speed.x>0) {
+ bullet.x+=(20*num);
+ bullet.y+=(20*num*bullet.speed.y/bullet.speed.x)>>0;
+ }
+ else {
+ bullet.x-=(20*num);
+ bullet.y-=(20*num*bullet.speed.y/bullet.speed.x)>>0;
+ }
+ }
+ else {
+ if (bullet.speed.y>0) {
+ bullet.y+=(20*num);
+ bullet.x+=(20*num*bullet.speed.x/bullet.speed.y)>>0;
+ }
+ else {
+ bullet.y-=(20*num);
+ bullet.x-=(20*num*bullet.speed.x/bullet.speed.y)>>0;
+ }
+ }
+ }
+ };
+ //Add our buildings
+ Building.ZergBuilding.SunkenColony.prototype.attackLimit=null;
+ Building.ZergBuilding.SunkenColony.prototype.attackRange=700;
+ Building.ZergBuilding.SunkenColony.prototype.HP=9999;
+ new Building.ZergBuilding.SunkenColony({x:2524,y:452});
+ new Building.ZergBuilding.SunkenColony({x:60,y:1500});
+ new Building.ZergBuilding.SunkenColony({x:2438,y:2320});
+ Building.ZergBuilding.SporeColony.prototype.attackLimit=null;
+ Building.ZergBuilding.SporeColony.prototype.attackRange=700;
+ Building.ZergBuilding.SporeColony.prototype.HP=9999;
+ new Building.ZergBuilding.SporeColony({x:3980,y:1500});
+ new Building.ZergBuilding.SporeColony({x:1476,y:452});
+ new Building.ZergBuilding.SporeColony({x:1240,y:2956});
+ Building.TerranBuilding.MissileTurret.prototype.attackLimit=null;
+ Building.TerranBuilding.MissileTurret.prototype.attackRange=700;
+ Building.TerranBuilding.MissileTurret.prototype.HP=9999;
+ new Building.TerranBuilding.MissileTurret({x:3228,y:2632});
+ new Building.TerranBuilding.MissileTurret({x:2000,y:80});
+ new Building.TerranBuilding.MissileTurret({x:784,y:2320});
+ Building.ProtossBuilding.PhotonCannon.prototype.attackLimit=null;
+ Building.ProtossBuilding.PhotonCannon.prototype.attackRange=700;
+ Building.ProtossBuilding.PhotonCannon.prototype.SP=9999;
+ new Building.ProtossBuilding.PhotonCannon({x:3228,y:1054});
+ new Building.ProtossBuilding.PhotonCannon({x:784,y:1054});
+ new Building.ProtossBuilding.PhotonCannon({x:1684,y:2320});
+ Building.ProtossBuilding.TeleportPoint.prototype.SP=9999;
+ new Building.ProtossBuilding.TeleportPoint({x:2060,y:1586});
+ //Add our unit
+ new Hero.Tassadar({x:3200,y:3072-Game.VBOUND/2}).magic=999;
+ //Override win and lose condition
+ var killCount=0;//Closure
+ Referee.winCondition=function(){
+ var kills=0;
+ Building.ourBuildings().forEach(function(build){
+ if (build.kill) kills+=build.kill;
+ });
+ if (kills>killCount){
+ Resource[0].mine+=(kills-killCount);
+ killCount=kills;
+ }
+ return (wave>num && Unit.allEnemyUnits().length==0);
+ };
+ var LIFE=20;
+ Referee.loseCondition=function(){
+ //Closure LIFE
+ Unit.allEnemyUnits().forEach(function(chara){
+ if (chara.inside({centerX:2048,centerY:1536,radius:200})){
+ LIFE--;
+ Game.showMessage('Remaining life: '+LIFE);
+ chara.die();
+ }
+ });
+ return (LIFE<=0);
+ };
+ //Enemy coming
+ var num=0, wave=1;
+ var interval=30000;//30 seconds per wave
+ _$.traverse([Neutral,Zerg,Terran,Protoss],function(enemyType){
+ Game.commandTimeout(function(){
+ for (var N=0;N<15;N++){
+ (function(n){
+ Game.commandTimeout(function(){
+ var enemy=new enemyType({x:3622,y:2916,team:1});
+ //Focus on routing
+ if (enemy.attack) enemy.attack=function(){
+ this.targetLock=true;
+ };
+ //Enemies route
+ Game.commandTimeout(function(){
+ enemy.targetLock=true;
+ enemy.destination={x:3622,y:280};
+ enemy.destination.next={x:422,y:280};
+ enemy.destination.next.next={x:422,y:2800};
+ enemy.destination.next.next.next={x:2100,y:2800};
+ enemy.destination.next.next.next.next={x:2100,y:1500};
+ },0);
+ },n*1000);
+ })(N);
+ }
+ Game.showWarning('Wave '+ wave++ +': '+enemyType.prototype.name);
+ },interval*num++);
+ });
+ //Game win when time reach
+ Game.commandTimeout(function(){
+ Game.win();
+ },interval*num+60000);
+ }
+ },
+ {
+ level:12,
+ label:'Replay',
+ load:function(){
+ //Load replay
+ var lastReplay=localStorage.getItem('lastReplay');
+ if (lastReplay!=null){
+ Game.replayFlag=true;
+ //Map.fogFlag=false;
+ // Should not click buttons or trigger key control during replay
+ Button.equipButtonsFor=function(){};
+ //Equip with replay buttons
+ Button.equipButtonsForReplay();
+ //Parse last replay data
+ lastReplay=JSON.parse(lastReplay);
+ //Select same team
+ if (lastReplay.hasOwnProperty('team')) Game.team=lastReplay.team;
+ Levels[lastReplay.level-1].load();
+ Game.replayLevel=lastReplay.level;
+ //Parse user moves
+ var recordCmds=lastReplay.cmds;
+ for (var tick in recordCmds){
+ Multiplayer.parseTickCmd({tick:parseInt(tick),cmds:recordCmds[tick]});
+ }
+ //Replay ends
+ Game.endTick=lastReplay.end;
+ Game.commandTimeout(function(){
+ Game.stopAnimation();
+ $('div.panel_Control button').attr('disabled',true);
+ Game.showMessage('Replay ended...',10000);
+ },100*Game.endTick);
+ }
+ else {
+ alert('Cannot find any replay!');
+ //Error occurs
+ delete Game.level;
+ return true;
+ }
+ }
+ }
+];
\ No newline at end of file
diff --git a/GameRule/Multiplayer.js b/GameRule/Multiplayer.js
index 2819bfe..b1641fe 100644
--- a/GameRule/Multiplayer.js
+++ b/GameRule/Multiplayer.js
@@ -1,402 +1,418 @@
-var Multiplayer={
- ON:false,//by default
- webSocket:null,
- cmds:[],
- snapshotFlag:false,
- replaySnapshotFlag:true,
- getSocket:function(){
- if (window.WebSocket) {
- //ServerList: (1)HongKong:nvhae.com (3)Canada:104.128.82.12
- var webSocket=Multiplayer.webSocket=new WebSocket('ws://nvhae.com:28082');
- webSocket.onerror=function(){
- //Offline flag for Store&Forward
- Game.offline=true;
- };
- return webSocket;
- }
- else return null;
- },
- sendUserInfo:function(){
- var webSocket=Multiplayer.getSocket();
- if (webSocket) {
- webSocket.onopen=function(){
- webSocket.send(JSON.stringify({type:'login',level:Game.level,team:Game.team,version:navigator.userAgent,
- platform:navigator.platform,language:navigator.language,size:{x:innerWidth,y:innerHeight}}));
- Multiplayer.statistic={left:0,right:0};
- //Test parse info
- var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_='+Math.random();
- $.getJSON(url, function(data){
- webSocket.send(JSON.stringify({
- type:'log',log:"Isp("+data.Isp+"), Browser("+data.Browser+"), OS("+data.OS+")"}));
- });
- //Test snapshot
- if (Multiplayer.snapshotFlag){
- var N=1;
- setInterval(function(){
- webSocket.send(JSON.stringify({
- type:'snapshot',
- units:Unit.allUnits.sort(function(u1,u2){
- if (u1.team==u2.team) return u1.name.localeCompare(u2.name);
- else return u1.team-u2.team;
- }).map(function(chara){
- var result=(chara.name+' HP'+chara.life+' T'+chara.team+' ['+(chara.x>>0)+','+(chara.y>>0)+']');
- if (chara.magic!=null) result+=' M'+chara.magic;
- return result;
- }),
- buildings:Building.allBuildings.sort(function(b1,b2){
- if (b1.team==b2.team) return b1.name.localeCompare(b2.name);
- else return b1.team-b2.team;
- }).map(function(chara){
- return chara.name+' HP'+chara.life+' T'+chara.team+' ['+(chara.x>>0)+','+(chara.y>>0)+']';
- }),
- click:{left:Multiplayer.statistic.left,right:Multiplayer.statistic.right},
- count:{ourUnits:Unit.allOurUnits().length,enemyUnits:Unit.allEnemyUnits().length,
- ourBuildings:Building.ourBuildings().length,enemyBuildings:Building.enemyBuildings().length},
- num:N
- }));
- //Reset click statistic
- Multiplayer.statistic={left:0,right:0};
- N++;
- },60000);
- }
- //Test replay record every 10 seconds
- if (Multiplayer.replaySnapshotFlag) {
- setInterval(function(){
+var Multiplayer = (function () {
+ function Multiplayer() {
+ this.getSocket = function () {
+ if (window.WebSocket) {
+ //ServerList: (1)HongKong:nvhae.com (3)Canada:104.128.82.12
+ var webSocket = Multiplayer.webSocket = new WebSocket('ws://nvhae.com:28082');
+ webSocket.onerror = function () {
+ //Offline flag for Store&Forward
+ Game.offline = true;
+ };
+ return webSocket;
+ }
+ else
+ return null;
+ };
+ this.sendUserInfo = function () {
+ var webSocket = Multiplayer.getSocket();
+ if (webSocket) {
+ webSocket.onopen = function () {
+ webSocket.send(JSON.stringify({ type: 'login', level: Game.level, team: Game.team, version: navigator.userAgent,
+ platform: navigator.platform, language: navigator.language, size: { x: innerWidth, y: innerHeight } }));
+ Multiplayer.statistic = { left: 0, right: 0 };
+ //Test parse info
+ var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_=' + Math.random();
+ $.getJSON(url, function (data) {
webSocket.send(JSON.stringify({
- type:'replaySnapshot',
- replaySnapshot:{
- team:Game.team,
- level:Game.level,
- cmds:Game.replay,
- end:Game.mainTick
- }
+ type: 'log', log: "Isp(" + data.Isp + "), Browser(" + data.Browser + "), OS(" + data.OS + ")"
}));
- },10000);
- }
- };
- }
- },
- enable:function(){
- var webSocket=Multiplayer.getSocket();
- if (webSocket) {
- webSocket.onopen=function(){
- Game.showMessage("Already connected to server!");
- };
- webSocket.onclose=function(){
- Game.showMessage("You've disconnected from server!");
- };
- webSocket.onerror=function(){
- Game.showMessage("Cannot connect to server...");
- };
- webSocket.onmessage=function(message){
- var msgObj=JSON.parse(message.data);
- switch(msgObj.type){
- case "ping":
- Multiplayer.webSocket.send(JSON.stringify({type:'pong'}));
- console.log('Receive ping');
- break;
- case "notice":
- Game.showMessage(msgObj.msg);
- break;
- case "start":
- //Choose team
- Game.team=msgObj.team;
- //Bind controller
- mouseController.toControlAll();//Can control all units
- keyController.start();//Start monitor
- Game.animation();
- break;
- case "replay":
- Game.saveReplay(msgObj.replay);
- break;
- case "tick":
- Game.serverTick=msgObj.tick;
- Multiplayer.parseTickCmd(msgObj);
- break;
- }
- };
- Multiplayer.ON=true;
- }
- else {
- Game.showMessage("Your browser doesn't support WebSocket...");
- }
- },
- parseTickCmd:function(msgObj){
- if (msgObj.cmds){
- if (!Game.commands[msgObj.tick]) Game.commands[msgObj.tick]=[];
- msgObj.cmds.forEach(function(cmdStr){
- var cmd=JSON.parse(cmdStr);
- switch (cmd.type){
- case 'rightClick':
- Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- var pos=cmd.pos;
- var unlock=cmd.unlock;
- var btn=cmd.btn;
- return function(){
- var charas=Multiplayer.getUnitsByUIDs(uids);
- mouseController.rightClickHandler(charas,pos,unlock,btn);
- };
- }());
- break;
- case 'stop':
- Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- return function(){
- var charas=Multiplayer.getUnitsByUIDs(uids);
- Button.stopHandler(charas);
- };
- }());
- break;
- case 'hold':
- Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- return function(){
- var charas=Multiplayer.getUnitsByUIDs(uids);
- Button.holdHandler(charas);
- };
- }());
- break;
- case 'magic':
- //Scarab and Interceptor
- if (cmd.duration){
- Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- var name=cmd.name;
- var duration=cmd.duration;
- return function(){
- var owner=Multiplayer.getUnitsByUIDs(uids)[0];
- if (owner && Resource.paypal.call(owner,Resource.getCost(name))){
- //Cheat: Operation cwal
- if (Cheat.cwal) duration=0;
- Game.commandTimeout(function(){
- Magic[name].spell.call(owner);
- delete owner.processing;
- },duration*100);
- //Occupy flag
- owner.processing={
- name:name,
- startTime:Game.mainTick,
- time:duration
- };
- }
- };
- }());
- }
- //Normal magic
- else {
- Game.commands[msgObj.tick].push(function(){
+ });
+ //Test snapshot
+ if (Multiplayer.snapshotFlag) {
+ var N = 1;
+ setInterval(function () {
+ webSocket.send(JSON.stringify({
+ type: 'snapshot',
+ units: Unit.allUnits.sort(function (u1, u2) {
+ if (u1.team == u2.team)
+ return u1.name.localeCompare(u2.name);
+ else
+ return u1.team - u2.team;
+ }).map(function (chara) {
+ var result = (chara.name + ' HP' + chara.life + ' T' + chara.team + ' [' + (chara.x >> 0) + ',' + (chara.y >> 0) + ']');
+ if (chara.magic != null)
+ result += ' M' + chara.magic;
+ return result;
+ }),
+ buildings: Building.allBuildings.sort(function (b1, b2) {
+ if (b1.team == b2.team)
+ return b1.name.localeCompare(b2.name);
+ else
+ return b1.team - b2.team;
+ }).map(function (chara) {
+ return chara.name + ' HP' + chara.life + ' T' + chara.team + ' [' + (chara.x >> 0) + ',' + (chara.y >> 0) + ']';
+ }),
+ click: { left: Multiplayer.statistic.left, right: Multiplayer.statistic.right },
+ count: { ourUnits: Unit.allOurUnits().length, enemyUnits: Unit.allEnemyUnits().length,
+ ourBuildings: Building.ourBuildings().length, enemyBuildings: Building.enemyBuildings().length },
+ num: N
+ }));
+ //Reset click statistic
+ Multiplayer.statistic = { left: 0, right: 0 };
+ N++;
+ }, 60000);
+ }
+ //Test replay record every 10 seconds
+ if (Multiplayer.replaySnapshotFlag) {
+ setInterval(function () {
+ webSocket.send(JSON.stringify({
+ type: 'replaySnapshot',
+ replaySnapshot: {
+ team: Game.team,
+ level: Game.level,
+ cmds: Game.replay,
+ end: Game.mainTick
+ }
+ }));
+ }, 10000);
+ }
+ };
+ }
+ };
+ this.enable = function () {
+ var webSocket = Multiplayer.getSocket();
+ if (webSocket) {
+ webSocket.onopen = function () {
+ Game.showMessage("Already connected to server!");
+ };
+ webSocket.onclose = function () {
+ Game.showMessage("You've disconnected from server!");
+ };
+ webSocket.onerror = function () {
+ Game.showMessage("Cannot connect to server...");
+ };
+ webSocket.onmessage = function (message) {
+ var msgObj = JSON.parse(message.data);
+ switch (msgObj.type) {
+ case "ping":
+ Multiplayer.webSocket.send(JSON.stringify({ type: 'pong' }));
+ console.log('Receive ping');
+ break;
+ case "notice":
+ Game.showMessage(msgObj.msg);
+ break;
+ case "start":
+ //Choose team
+ Game.team = msgObj.team;
+ //Bind controller
+ mouseController.toControlAll(); //Can control all units
+ keyController.start(); //Start monitor
+ Game.animation();
+ break;
+ case "replay":
+ Game.saveReplay(msgObj.replay);
+ break;
+ case "tick":
+ Game.serverTick = msgObj.tick;
+ Multiplayer.parseTickCmd(msgObj);
+ break;
+ }
+ };
+ Multiplayer.ON = true;
+ }
+ else {
+ Game.showMessage("Your browser doesn't support WebSocket...");
+ }
+ };
+ this.parseTickCmd = function (msgObj) {
+ if (msgObj.cmds) {
+ if (!Game.commands[msgObj.tick])
+ Game.commands[msgObj.tick] = [];
+ msgObj.cmds.forEach(function (cmdStr) {
+ var cmd = JSON.parse(cmdStr);
+ switch (cmd.type) {
+ case 'rightClick':
+ Game.commands[msgObj.tick].push(function () {
//Closures
- var uids=cmd.uids;
- var name=cmd.name;
- var pos=cmd.pos;
- var creditBill=cmd.creditBill;
- return function(){
- var owner=Multiplayer.getUnitsByUIDs(uids)[0];
- if (owner){
- //Need callback with location
- if (pos) {
- //Spell magic with location in multiplayer mode
- if (creditBill) owner.creditBill=creditBill;
- Magic[name].spell.call(owner,pos);
- }
- //Execute magic immediately
- else {
- if (Resource.paypal.call(owner,Resource.getCost(name))){
- Magic[name].spell.call(owner);
- }
- }
- }
+ var uids = cmd.uids;
+ var pos = cmd.pos;
+ var unlock = cmd.unlock;
+ var btn = cmd.btn;
+ return function () {
+ var charas = Multiplayer.getUnitsByUIDs(uids);
+ mouseController.rightClickHandler(charas, pos, unlock, btn);
};
}());
- }
- break;
- case 'upgrade':
- if (cmd.duration){
- Game.commands[msgObj.tick].push(function(){
+ break;
+ case 'stop':
+ Game.commands[msgObj.tick].push(function () {
//Closures
- var uids=cmd.uids;
- var name=cmd.name;
- var duration=cmd.duration;
- var team=cmd.team;
- return function(){
- var owner=Multiplayer.getUnitsByUIDs(uids)[0];
- //Still owner alive and can afford payment
- if (owner && Resource.paypal.call(owner,Resource.getCost(name))){
- //Cheat: Operation cwal
- if (Cheat.cwal) duration=0;
- Game.commandTimeout(function(){
- Upgrade[name].effect(team);
- delete owner.processing;
- if (team==Game.team){
- Referee.voice('upgrade')[Game.race.selected].play();
- Game.refreshInfo();
- Game.showMessage('Upgrade complete');
- }
- },duration*100);
- //Occupy flag
- owner.processing={
- name:name,
- startTime:Game.mainTick,
- time:duration
- };
- }
+ var uids = cmd.uids;
+ return function () {
+ var charas = Multiplayer.getUnitsByUIDs(uids);
+ Button.stopHandler(charas);
};
}());
- }
- else {
- Game.commands[msgObj.tick].push(function(){
+ break;
+ case 'hold':
+ Game.commands[msgObj.tick].push(function () {
//Closures
- var team=cmd.team;
- var name=cmd.name;
- return function(){
- //Will effect immediately
- Upgrade[name].effect(team);
+ var uids = cmd.uids;
+ return function () {
+ var charas = Multiplayer.getUnitsByUIDs(uids);
+ Button.holdHandler(charas);
};
}());
- }
- break;
- case 'unit':
- if (cmd.evolve){
- Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- var unitType=cmd.name;
- var duration=cmd.duration;
- switch (cmd.evolve){
- case 'archon':
- return function(){
- var chara=Multiplayer.getUnitsByUIDs(uids)[0];
- if (chara && Resource.paypal.call(chara,Resource.getCost(unitType))){
- //Evolve as Archon or DarkArchon
- var evolve=chara.evolveTo({type:Building.ProtossBuilding[unitType+'Evolve']});
- Game.commandTimeout(function(){
- if (evolve.status!='dead'){
- evolve.evolveTo({type:Protoss[unitType],burstArr:[unitType+'Birth']});
- }
- },duration*100);
- //Processing flag
- evolve.processing={
- name:unitType,
- startTime:Game.mainTick,
- time:duration
- };
+ break;
+ case 'magic':
+ //Scarab and Interceptor
+ if (cmd.duration) {
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var uids = cmd.uids;
+ var name = cmd.name;
+ var duration = cmd.duration;
+ return function () {
+ var owner = Multiplayer.getUnitsByUIDs(uids)[0];
+ if (owner && Resource.paypal.call(owner, Resource.getCost(name))) {
+ //Cheat: Operation cwal
+ if (Cheat.cwal)
+ duration = 0;
+ Game.commandTimeout(function () {
+ Magic[name].spell.call(owner);
+ delete owner.processing;
+ }, duration * 100);
+ //Occupy flag
+ owner.processing = {
+ name: name,
+ startTime: Game.mainTick,
+ time: duration
+ };
+ }
+ };
+ }());
+ }
+ else {
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var uids = cmd.uids;
+ var name = cmd.name;
+ var pos = cmd.pos;
+ var creditBill = cmd.creditBill;
+ return function () {
+ var owner = Multiplayer.getUnitsByUIDs(uids)[0];
+ if (owner) {
+ //Need callback with location
+ if (pos) {
+ //Spell magic with location in multiplayer mode
+ if (creditBill)
+ owner.creditBill = creditBill;
+ Magic[name].spell.call(owner, pos);
}
- };
- case 'zerg':
- var exceptions=['Guardian','Devourer'];//Closure
- return function(){
- var chara=Multiplayer.getUnitsByUIDs(uids)[0];
- if (chara && Resource.paypal.call(chara,Resource.getCost(unitType))){
- //Evolve as egg
- var egg;
- //Clossure: which base larvas belong to
- var base=chara.owner;
- //Evolve as cocoon
- if (exceptions.indexOf(unitType)!=-1){
- egg=chara.evolveTo({type:Building.ZergBuilding.Cocoon});
+ else {
+ if (Resource.paypal.call(owner, Resource.getCost(name))) {
+ Magic[name].spell.call(owner);
}
- else {
- egg=chara.evolveTo({type:Building.ZergBuilding.Egg});
- if (unitType=='Lurker') egg.action=18;
+ }
+ }
+ };
+ }());
+ }
+ break;
+ case 'upgrade':
+ if (cmd.duration) {
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var uids = cmd.uids;
+ var name = cmd.name;
+ var duration = cmd.duration;
+ var team = cmd.team;
+ return function () {
+ var owner = Multiplayer.getUnitsByUIDs(uids)[0];
+ //Still owner alive and can afford payment
+ if (owner && Resource.paypal.call(owner, Resource.getCost(name))) {
+ //Cheat: Operation cwal
+ if (Cheat.cwal)
+ duration = 0;
+ Game.commandTimeout(function () {
+ Upgrade[name].effect(team);
+ delete owner.processing;
+ if (team == Game.team) {
+ Referee.voice('upgrade')[Game.race.selected].play();
+ Game.refreshInfo();
+ Game.showMessage('Upgrade complete');
}
- //Cheat: Operation cwal
- if (Cheat.cwal) duration=0;
- Game.commandTimeout(function(){
- if (egg.status!='dead'){
- //Evolve
- if (exceptions.indexOf(unitType)!=-1){
- //Cocoon
- egg.evolveTo({type:Zerg[unitType],burstArr:[unitType+'Birth']});
- }
- else {
- //Egg
- egg.evolveTo({type:Zerg[unitType],burstArr:['EggBirth',unitType+'Birth'],rallyPoint:base?base.rallyPoint:null});
+ }, duration * 100);
+ //Occupy flag
+ owner.processing = {
+ name: name,
+ startTime: Game.mainTick,
+ time: duration
+ };
+ }
+ };
+ }());
+ }
+ else {
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var team = cmd.team;
+ var name = cmd.name;
+ return function () {
+ //Will effect immediately
+ Upgrade[name].effect(team);
+ };
+ }());
+ }
+ break;
+ case 'unit':
+ if (cmd.evolve) {
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var uids = cmd.uids;
+ var unitType = cmd.name;
+ var duration = cmd.duration;
+ switch (cmd.evolve) {
+ case 'archon':
+ return function () {
+ var chara = Multiplayer.getUnitsByUIDs(uids)[0];
+ if (chara && Resource.paypal.call(chara, Resource.getCost(unitType))) {
+ //Evolve as Archon or DarkArchon
+ var evolve = chara.evolveTo({ type: Building.ProtossBuilding[unitType + 'Evolve'] });
+ Game.commandTimeout(function () {
+ if (evolve.status != 'dead') {
+ evolve.evolveTo({ type: Protoss[unitType], burstArr: [unitType + 'Birth'] });
}
+ }, duration * 100);
+ //Processing flag
+ evolve.processing = {
+ name: unitType,
+ startTime: Game.mainTick,
+ time: duration
+ };
+ }
+ };
+ case 'zerg':
+ var exceptions = ['Guardian', 'Devourer']; //Closure
+ return function () {
+ var chara = Multiplayer.getUnitsByUIDs(uids)[0];
+ if (chara && Resource.paypal.call(chara, Resource.getCost(unitType))) {
+ //Evolve as egg
+ var egg;
+ //Clossure: which base larvas belong to
+ var base = chara.owner;
+ //Evolve as cocoon
+ if (exceptions.indexOf(unitType) != -1) {
+ egg = chara.evolveTo({ type: Building.ZergBuilding.Cocoon });
}
- },duration*100);
- //Processing flag on egg
- egg.processing={
- name:unitType,
- startTime:Game.mainTick,//new Date().getTime()
- time:duration
- };
- }
- };
- }
- }());
- }
- else Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- var unitType=cmd.name;
- var duration=cmd.duration;
- //Find unit name from which race
- var Race;
- [Zerg,Terran,Protoss,Hero].forEach(function(race){
- if (race[unitType]!=null) Race=race;
- });
- return function(){
- var owner=Multiplayer.getUnitsByUIDs(uids)[0];
- if (owner && Resource.paypal.call(owner,Resource.getCost(unitType))){
- //Cheat: Operation cwal
- if (Cheat.cwal) duration=0;
- Game.commandTimeout(function(){
- var trainedUnit;
- if (Race[unitType].prototype.isFlying)
- trainedUnit=new Race[unitType]({x:owner.x,y:owner.y,team:owner.team});
- else
- trainedUnit=new Race[unitType]({x:owner.x,y:owner.y+owner.height,team:owner.team});
- delete owner.processing;
- if (owner.rallyPoint) trainedUnit.destination=owner.rallyPoint;
- },duration*100);
- //Occupy flag
- owner.processing={
- name:unitType,
- startTime:Game.mainTick,
- time:duration
+ else {
+ egg = chara.evolveTo({ type: Building.ZergBuilding.Egg });
+ if (unitType == 'Lurker')
+ egg.action = 18;
+ }
+ //Cheat: Operation cwal
+ if (Cheat.cwal)
+ duration = 0;
+ Game.commandTimeout(function () {
+ if (egg.status != 'dead') {
+ //Evolve
+ if (exceptions.indexOf(unitType) != -1) {
+ //Cocoon
+ egg.evolveTo({ type: Zerg[unitType], burstArr: [unitType + 'Birth'] });
+ }
+ else {
+ //Egg
+ egg.evolveTo({ type: Zerg[unitType], burstArr: ['EggBirth', unitType + 'Birth'], rallyPoint: base ? base.rallyPoint : null });
+ }
+ }
+ }, duration * 100);
+ //Processing flag on egg
+ egg.processing = {
+ name: unitType,
+ startTime: Game.mainTick,
+ time: duration
+ };
+ }
+ };
+ }
+ }());
+ }
+ else
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var uids = cmd.uids;
+ var unitType = cmd.name;
+ var duration = cmd.duration;
+ //Find unit name from which race
+ var Race;
+ [Zerg, Terran, Protoss, Hero].forEach(function (race) {
+ if (race[unitType] != null)
+ Race = race;
+ });
+ return function () {
+ var owner = Multiplayer.getUnitsByUIDs(uids)[0];
+ if (owner && Resource.paypal.call(owner, Resource.getCost(unitType))) {
+ //Cheat: Operation cwal
+ if (Cheat.cwal)
+ duration = 0;
+ Game.commandTimeout(function () {
+ var trainedUnit;
+ if (Race[unitType].prototype.isFlying)
+ trainedUnit = new Race[unitType]({ x: owner.x, y: owner.y, team: owner.team });
+ else
+ trainedUnit = new Race[unitType]({ x: owner.x, y: owner.y + owner.height, team: owner.team });
+ delete owner.processing;
+ if (owner.rallyPoint)
+ trainedUnit.destination = owner.rallyPoint;
+ }, duration * 100);
+ //Occupy flag
+ owner.processing = {
+ name: unitType,
+ startTime: Game.mainTick,
+ time: duration
+ };
+ }
};
- }
- };
- }());
- break;
- case 'build':
- Game.commands[msgObj.tick].push(function(){
- //Closures
- var uids=cmd.uids;
- var buildName=cmd.name;
- var BuildType=cmd.buildType;
- var pos=cmd.pos;
- return function(){
- var farmer=Multiplayer.getUnitsByUIDs(uids)[0];
- if (farmer && Resource.paypal.call(farmer,Resource.getCost(buildName))){
- //Destination building name
- farmer.buildName=buildName;
- //Farmer build with location
- if (pos) farmer['build'+BuildType](pos);
- //Evolve to another building
- else farmer['build'+BuildType]();
- }
- };
- }());
- break;
- }
+ }());
+ break;
+ case 'build':
+ Game.commands[msgObj.tick].push(function () {
+ //Closures
+ var uids = cmd.uids;
+ var buildName = cmd.name;
+ var BuildType = cmd.buildType;
+ var pos = cmd.pos;
+ return function () {
+ var farmer = Multiplayer.getUnitsByUIDs(uids)[0];
+ if (farmer && Resource.paypal.call(farmer, Resource.getCost(buildName))) {
+ //Destination building name
+ farmer.buildName = buildName;
+ //Farmer build with location
+ if (pos)
+ farmer['build' + BuildType](pos);
+ else
+ farmer['build' + BuildType]();
+ }
+ };
+ }());
+ break;
+ }
+ });
+ }
+ };
+ this.getUIDs = function (charas) {
+ return charas.map(function (chara) {
+ return chara.id;
+ });
+ };
+ this.getUnitsByUIDs = function (uids) {
+ return Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
+ //Need filter out dead units to execute commands
+ return uids.indexOf(chara.id) != -1 && chara.status != 'dead';
});
- }
- },
- getUIDs:function(charas){
- return charas.map(function(chara){
- return chara.id;
- });
- },
- getUnitsByUIDs:function(uids){
- return Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
- //Need filter out dead units to execute commands
- return uids.indexOf(chara.id)!=-1 && chara.status!='dead';
- });
+ };
}
-};
\ No newline at end of file
+ return Multiplayer;
+}());
+;
+//# sourceMappingURL=Multiplayer.js.map
\ No newline at end of file
diff --git a/GameRule/Multiplayer.ts b/GameRule/Multiplayer.ts
new file mode 100644
index 0000000..87d4ce9
--- /dev/null
+++ b/GameRule/Multiplayer.ts
@@ -0,0 +1,402 @@
+class Multiplayer {
+ ON:false,//by default
+ webSocket:null,
+ cmds:[],
+ snapshotFlag:false,
+ replaySnapshotFlag:true,
+ getSocket:function(){
+ if (window.WebSocket) {
+ //ServerList: (1)HongKong:nvhae.com (3)Canada:104.128.82.12
+ var webSocket=Multiplayer.webSocket=new WebSocket('ws://nvhae.com:28082');
+ webSocket.onerror=function(){
+ //Offline flag for Store&Forward
+ Game.offline=true;
+ };
+ return webSocket;
+ }
+ else return null;
+ },
+ sendUserInfo:function(){
+ var webSocket=Multiplayer.getSocket();
+ if (webSocket) {
+ webSocket.onopen=function(){
+ webSocket.send(JSON.stringify({type:'login',level:Game.level,team:Game.team,version:navigator.userAgent,
+ platform:navigator.platform,language:navigator.language,size:{x:innerWidth,y:innerHeight}}));
+ Multiplayer.statistic={left:0,right:0};
+ //Test parse info
+ var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_='+Math.random();
+ $.getJSON(url, function(data){
+ webSocket.send(JSON.stringify({
+ type:'log',log:"Isp("+data.Isp+"), Browser("+data.Browser+"), OS("+data.OS+")"}));
+ });
+ //Test snapshot
+ if (Multiplayer.snapshotFlag){
+ var N=1;
+ setInterval(function(){
+ webSocket.send(JSON.stringify({
+ type:'snapshot',
+ units:Unit.allUnits.sort(function(u1,u2){
+ if (u1.team==u2.team) return u1.name.localeCompare(u2.name);
+ else return u1.team-u2.team;
+ }).map(function(chara){
+ var result=(chara.name+' HP'+chara.life+' T'+chara.team+' ['+(chara.x>>0)+','+(chara.y>>0)+']');
+ if (chara.magic!=null) result+=' M'+chara.magic;
+ return result;
+ }),
+ buildings:Building.allBuildings.sort(function(b1,b2){
+ if (b1.team==b2.team) return b1.name.localeCompare(b2.name);
+ else return b1.team-b2.team;
+ }).map(function(chara){
+ return chara.name+' HP'+chara.life+' T'+chara.team+' ['+(chara.x>>0)+','+(chara.y>>0)+']';
+ }),
+ click:{left:Multiplayer.statistic.left,right:Multiplayer.statistic.right},
+ count:{ourUnits:Unit.allOurUnits().length,enemyUnits:Unit.allEnemyUnits().length,
+ ourBuildings:Building.ourBuildings().length,enemyBuildings:Building.enemyBuildings().length},
+ num:N
+ }));
+ //Reset click statistic
+ Multiplayer.statistic={left:0,right:0};
+ N++;
+ },60000);
+ }
+ //Test replay record every 10 seconds
+ if (Multiplayer.replaySnapshotFlag) {
+ setInterval(function(){
+ webSocket.send(JSON.stringify({
+ type:'replaySnapshot',
+ replaySnapshot:{
+ team:Game.team,
+ level:Game.level,
+ cmds:Game.replay,
+ end:Game.mainTick
+ }
+ }));
+ },10000);
+ }
+ };
+ }
+ },
+ enable:function(){
+ var webSocket=Multiplayer.getSocket();
+ if (webSocket) {
+ webSocket.onopen=function(){
+ Game.showMessage("Already connected to server!");
+ };
+ webSocket.onclose=function(){
+ Game.showMessage("You've disconnected from server!");
+ };
+ webSocket.onerror=function(){
+ Game.showMessage("Cannot connect to server...");
+ };
+ webSocket.onmessage=function(message){
+ var msgObj=JSON.parse(message.data);
+ switch(msgObj.type){
+ case "ping":
+ Multiplayer.webSocket.send(JSON.stringify({type:'pong'}));
+ console.log('Receive ping');
+ break;
+ case "notice":
+ Game.showMessage(msgObj.msg);
+ break;
+ case "start":
+ //Choose team
+ Game.team=msgObj.team;
+ //Bind controller
+ mouseController.toControlAll();//Can control all units
+ keyController.start();//Start monitor
+ Game.animation();
+ break;
+ case "replay":
+ Game.saveReplay(msgObj.replay);
+ break;
+ case "tick":
+ Game.serverTick=msgObj.tick;
+ Multiplayer.parseTickCmd(msgObj);
+ break;
+ }
+ };
+ Multiplayer.ON=true;
+ }
+ else {
+ Game.showMessage("Your browser doesn't support WebSocket...");
+ }
+ },
+ parseTickCmd:function(msgObj){
+ if (msgObj.cmds){
+ if (!Game.commands[msgObj.tick]) Game.commands[msgObj.tick]=[];
+ msgObj.cmds.forEach(function(cmdStr){
+ var cmd=JSON.parse(cmdStr);
+ switch (cmd.type){
+ case 'rightClick':
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var pos=cmd.pos;
+ var unlock=cmd.unlock;
+ var btn=cmd.btn;
+ return function(){
+ var charas=Multiplayer.getUnitsByUIDs(uids);
+ mouseController.rightClickHandler(charas,pos,unlock,btn);
+ };
+ }());
+ break;
+ case 'stop':
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ return function(){
+ var charas=Multiplayer.getUnitsByUIDs(uids);
+ Button.stopHandler(charas);
+ };
+ }());
+ break;
+ case 'hold':
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ return function(){
+ var charas=Multiplayer.getUnitsByUIDs(uids);
+ Button.holdHandler(charas);
+ };
+ }());
+ break;
+ case 'magic':
+ //Scarab and Interceptor
+ if (cmd.duration){
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var name=cmd.name;
+ var duration=cmd.duration;
+ return function(){
+ var owner=Multiplayer.getUnitsByUIDs(uids)[0];
+ if (owner && Resource.paypal.call(owner,Resource.getCost(name))){
+ //Cheat: Operation cwal
+ if (Cheat.cwal) duration=0;
+ Game.commandTimeout(function(){
+ Magic[name].spell.call(owner);
+ delete owner.processing;
+ },duration*100);
+ //Occupy flag
+ owner.processing={
+ name:name,
+ startTime:Game.mainTick,
+ time:duration
+ };
+ }
+ };
+ }());
+ }
+ //Normal magic
+ else {
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var name=cmd.name;
+ var pos=cmd.pos;
+ var creditBill=cmd.creditBill;
+ return function(){
+ var owner=Multiplayer.getUnitsByUIDs(uids)[0];
+ if (owner){
+ //Need callback with location
+ if (pos) {
+ //Spell magic with location in multiplayer mode
+ if (creditBill) owner.creditBill=creditBill;
+ Magic[name].spell.call(owner,pos);
+ }
+ //Execute magic immediately
+ else {
+ if (Resource.paypal.call(owner,Resource.getCost(name))){
+ Magic[name].spell.call(owner);
+ }
+ }
+ }
+ };
+ }());
+ }
+ break;
+ case 'upgrade':
+ if (cmd.duration){
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var name=cmd.name;
+ var duration=cmd.duration;
+ var team=cmd.team;
+ return function(){
+ var owner=Multiplayer.getUnitsByUIDs(uids)[0];
+ //Still owner alive and can afford payment
+ if (owner && Resource.paypal.call(owner,Resource.getCost(name))){
+ //Cheat: Operation cwal
+ if (Cheat.cwal) duration=0;
+ Game.commandTimeout(function(){
+ Upgrade[name].effect(team);
+ delete owner.processing;
+ if (team==Game.team){
+ Referee.voice('upgrade')[Game.race.selected].play();
+ Game.refreshInfo();
+ Game.showMessage('Upgrade complete');
+ }
+ },duration*100);
+ //Occupy flag
+ owner.processing={
+ name:name,
+ startTime:Game.mainTick,
+ time:duration
+ };
+ }
+ };
+ }());
+ }
+ else {
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var team=cmd.team;
+ var name=cmd.name;
+ return function(){
+ //Will effect immediately
+ Upgrade[name].effect(team);
+ };
+ }());
+ }
+ break;
+ case 'unit':
+ if (cmd.evolve){
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var unitType=cmd.name;
+ var duration=cmd.duration;
+ switch (cmd.evolve){
+ case 'archon':
+ return function(){
+ var chara=Multiplayer.getUnitsByUIDs(uids)[0];
+ if (chara && Resource.paypal.call(chara,Resource.getCost(unitType))){
+ //Evolve as Archon or DarkArchon
+ var evolve=chara.evolveTo({type:Building.ProtossBuilding[unitType+'Evolve']});
+ Game.commandTimeout(function(){
+ if (evolve.status!='dead'){
+ evolve.evolveTo({type:Protoss[unitType],burstArr:[unitType+'Birth']});
+ }
+ },duration*100);
+ //Processing flag
+ evolve.processing={
+ name:unitType,
+ startTime:Game.mainTick,
+ time:duration
+ };
+ }
+ };
+ case 'zerg':
+ var exceptions=['Guardian','Devourer'];//Closure
+ return function(){
+ var chara=Multiplayer.getUnitsByUIDs(uids)[0];
+ if (chara && Resource.paypal.call(chara,Resource.getCost(unitType))){
+ //Evolve as egg
+ var egg;
+ //Clossure: which base larvas belong to
+ var base=chara.owner;
+ //Evolve as cocoon
+ if (exceptions.indexOf(unitType)!=-1){
+ egg=chara.evolveTo({type:Building.ZergBuilding.Cocoon});
+ }
+ else {
+ egg=chara.evolveTo({type:Building.ZergBuilding.Egg});
+ if (unitType=='Lurker') egg.action=18;
+ }
+ //Cheat: Operation cwal
+ if (Cheat.cwal) duration=0;
+ Game.commandTimeout(function(){
+ if (egg.status!='dead'){
+ //Evolve
+ if (exceptions.indexOf(unitType)!=-1){
+ //Cocoon
+ egg.evolveTo({type:Zerg[unitType],burstArr:[unitType+'Birth']});
+ }
+ else {
+ //Egg
+ egg.evolveTo({type:Zerg[unitType],burstArr:['EggBirth',unitType+'Birth'],rallyPoint:base?base.rallyPoint:null});
+ }
+ }
+ },duration*100);
+ //Processing flag on egg
+ egg.processing={
+ name:unitType,
+ startTime:Game.mainTick,//new Date().getTime()
+ time:duration
+ };
+ }
+ };
+ }
+ }());
+ }
+ else Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var unitType=cmd.name;
+ var duration=cmd.duration;
+ //Find unit name from which race
+ var Race;
+ [Zerg,Terran,Protoss,Hero].forEach(function(race){
+ if (race[unitType]!=null) Race=race;
+ });
+ return function(){
+ var owner=Multiplayer.getUnitsByUIDs(uids)[0];
+ if (owner && Resource.paypal.call(owner,Resource.getCost(unitType))){
+ //Cheat: Operation cwal
+ if (Cheat.cwal) duration=0;
+ Game.commandTimeout(function(){
+ var trainedUnit;
+ if (Race[unitType].prototype.isFlying)
+ trainedUnit=new Race[unitType]({x:owner.x,y:owner.y,team:owner.team});
+ else
+ trainedUnit=new Race[unitType]({x:owner.x,y:owner.y+owner.height,team:owner.team});
+ delete owner.processing;
+ if (owner.rallyPoint) trainedUnit.destination=owner.rallyPoint;
+ },duration*100);
+ //Occupy flag
+ owner.processing={
+ name:unitType,
+ startTime:Game.mainTick,
+ time:duration
+ };
+ }
+ };
+ }());
+ break;
+ case 'build':
+ Game.commands[msgObj.tick].push(function(){
+ //Closures
+ var uids=cmd.uids;
+ var buildName=cmd.name;
+ var BuildType=cmd.buildType;
+ var pos=cmd.pos;
+ return function(){
+ var farmer=Multiplayer.getUnitsByUIDs(uids)[0];
+ if (farmer && Resource.paypal.call(farmer,Resource.getCost(buildName))){
+ //Destination building name
+ farmer.buildName=buildName;
+ //Farmer build with location
+ if (pos) farmer['build'+BuildType](pos);
+ //Evolve to another building
+ else farmer['build'+BuildType]();
+ }
+ };
+ }());
+ break;
+ }
+ });
+ }
+ },
+ getUIDs:function(charas){
+ return charas.map(function(chara){
+ return chara.id;
+ });
+ },
+ getUnitsByUIDs:function(uids){
+ return Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
+ //Need filter out dead units to execute commands
+ return uids.indexOf(chara.id)!=-1 && chara.status!='dead';
+ });
+ }
+};
\ No newline at end of file
diff --git a/GameRule/Referee.js b/GameRule/Referee.js
index 243ca5d..6d318ea 100644
--- a/GameRule/Referee.js
+++ b/GameRule/Referee.js
@@ -1,417 +1,426 @@
-var Referee={
- ourDetectedUnits:[],//Detected enemies
- enemyDetectedUnits:[],//Detected ours
- _pos:[[-1,0],[1,0],[0,-1],[0,1]],//Collision avoid
- tasks:['judgeArbiter','judgeDetect','judgeCollision','judgeRecover','judgeDying','judgeMan',
- 'addLarva','coverFog','alterSelectionMode','judgeBuildingInjury','judgeWinLose','saveReplaySnapshot'],
- voice:(function(){
- var voice;
- return function(name){
- //Single instance pattern
- if (!voice) voice={
- pError:new Audio(Game.CDN+'bgm/PointError.wav'),
- button:new Audio(Game.CDN+'bgm/Button.wav'),
- resource:{
- Zerg:{
- mine:new Audio(Game.CDN+'bgm/mine.Zerg.wav'),
- gas:new Audio(Game.CDN+'bgm/gas.Zerg.wav'),
- man:new Audio(Game.CDN+'bgm/man.Zerg.wav'),
- magic:new Audio(Game.CDN+'bgm/magic.Zerg.wav')
- },
- Terran:{
- mine:new Audio(Game.CDN+'bgm/mine.Terran.wav'),
- gas:new Audio(Game.CDN+'bgm/gas.Terran.wav'),
- man:new Audio(Game.CDN+'bgm/man.Terran.wav'),
- magic:new Audio(Game.CDN+'bgm/magic.Terran.wav')
- },
- Protoss:{
- mine:new Audio(Game.CDN+'bgm/mine.Protoss.wav'),
- gas:new Audio(Game.CDN+'bgm/gas.Protoss.wav'),
- man:new Audio(Game.CDN+'bgm/man.Protoss.wav'),
- magic:new Audio(Game.CDN+'bgm/magic.Protoss.wav')
- }
- },
- upgrade:{
- Zerg:new Audio(Game.CDN+'bgm/upgrade.Zerg.wav'),
- Terran:new Audio(Game.CDN+'bgm/upgrade.Terran.wav'),
- Protoss:new Audio(Game.CDN+'bgm/upgrade.Protoss.wav')
- }
+var Referee = (function () {
+ function Referee() {
+ this.voice = function () {
+ var voice;
+ return function (name) {
+ //Single instance pattern
+ if (!voice)
+ voice = {
+ pError: new Audio(Game.CDN + 'bgm/PointError.wav'),
+ button: new Audio(Game.CDN + 'bgm/Button.wav'),
+ resource: {
+ Zerg: {
+ mine: new Audio(Game.CDN + 'bgm/mine.Zerg.wav'),
+ gas: new Audio(Game.CDN + 'bgm/gas.Zerg.wav'),
+ man: new Audio(Game.CDN + 'bgm/man.Zerg.wav'),
+ magic: new Audio(Game.CDN + 'bgm/magic.Zerg.wav')
+ },
+ Terran: {
+ mine: new Audio(Game.CDN + 'bgm/mine.Terran.wav'),
+ gas: new Audio(Game.CDN + 'bgm/gas.Terran.wav'),
+ man: new Audio(Game.CDN + 'bgm/man.Terran.wav'),
+ magic: new Audio(Game.CDN + 'bgm/magic.Terran.wav')
+ },
+ Protoss: {
+ mine: new Audio(Game.CDN + 'bgm/mine.Protoss.wav'),
+ gas: new Audio(Game.CDN + 'bgm/gas.Protoss.wav'),
+ man: new Audio(Game.CDN + 'bgm/man.Protoss.wav'),
+ magic: new Audio(Game.CDN + 'bgm/magic.Protoss.wav')
+ }
+ },
+ upgrade: {
+ Zerg: new Audio(Game.CDN + 'bgm/upgrade.Zerg.wav'),
+ Terran: new Audio(Game.CDN + 'bgm/upgrade.Terran.wav'),
+ Protoss: new Audio(Game.CDN + 'bgm/upgrade.Protoss.wav')
+ }
+ };
+ return voice[name];
};
- return voice[name];
- }
- })(),
- winCondition:function(){
- //By default: All our units and buildings are killed
- return (Unit.allEnemyUnits().length==0 && Building.enemyBuildings().length==0);
- },
- loseCondition:function(){
- //By default: All enemies and buildings are killed
- return (Unit.allOurUnits().length==0 && Building.ourBuildings().length==0);
- },
- judgeArbiter:function(){
- //Every 0.4 sec
- if (Game.mainTick%4==0){
- //Special skill: make nearby units invisible
- var arbiterBuffer=Protoss.Arbiter.prototype.bufferObj;
- var allArbiters=Game.getPropArray([]);
- Unit.allUnits.forEach(function(chara){
- if (chara.name=='Arbiter') allArbiters[chara.team].push(chara);
- });
- //Clear old units' Arbiter buffer
- Referee.underArbiterUnits.forEach(function(charas){
- charas.forEach(function(chara){
- chara.removeBuffer(arbiterBuffer);
- });
- });
- Referee.underArbiterUnits=Game.getPropArray([]);
- allArbiters.forEach(function(arbiters,N){
- //Find new under arbiter units
- arbiters.forEach(function(arbiter){
- //Find targets: same team units inside Arbiter sight, exclude Arbiter
- var targets=Game.getInRangeOnes(arbiter.posX(),arbiter.posY(),arbiter.get('sight'),N,true,null,function(chara){
- return arbiters.indexOf(chara)==-1;
- });
- Referee.underArbiterUnits[N]=Referee.underArbiterUnits[N].concat(targets);
- });
- $.unique(Referee.underArbiterUnits[N]);
+ };
+ }
+ return Referee;
+}());
+(),
+ winCondition;
+function () {
+ //By default: All our units and buildings are killed
+ return (Unit.allEnemyUnits().length == 0 && Building.enemyBuildings().length == 0);
+}
+loseCondition: function () {
+ //By default: All enemies and buildings are killed
+ return (Unit.allOurUnits().length == 0 && Building.ourBuildings().length == 0);
+}
+judgeArbiter: function () {
+ //Every 0.4 sec
+ if (Game.mainTick % 4 == 0) {
+ //Special skill: make nearby units invisible
+ var arbiterBuffer = Protoss.Arbiter.prototype.bufferObj;
+ var allArbiters = Game.getPropArray([]);
+ Unit.allUnits.forEach(function (chara) {
+ if (chara.name == 'Arbiter')
+ allArbiters[chara.team].push(chara);
+ });
+ //Clear old units' Arbiter buffer
+ Referee.underArbiterUnits.forEach(function (charas) {
+ charas.forEach(function (chara) {
+ chara.removeBuffer(arbiterBuffer);
});
- //Arbiter buffer effect on these units
- Referee.underArbiterUnits.forEach(function(charas){
- charas.forEach(function(chara){
- chara.addBuffer(arbiterBuffer);
+ });
+ Referee.underArbiterUnits = Game.getPropArray([]);
+ allArbiters.forEach(function (arbiters, N) {
+ //Find new under arbiter units
+ arbiters.forEach(function (arbiter) {
+ //Find targets: same team units inside Arbiter sight, exclude Arbiter
+ var targets = Game.getInRangeOnes(arbiter.posX(), arbiter.posY(), arbiter.get('sight'), N, true, null, function (chara) {
+ return arbiters.indexOf(chara) == -1;
});
+ Referee.underArbiterUnits[N] = Referee.underArbiterUnits[N].concat(targets);
});
- }
- },
- //detectorBuffer are reverse of arbiterBuffer
- judgeDetect:function(){
- //Every 0.4 sec
- if (Game.mainTick%4==0){
- //Same detector buffer reference
- var detectorBuffer=Gobj.detectorBuffer;
- var allDetectors=Game.getPropArray([]);
- Unit.allUnits.forEach(function(chara){
- if (chara.detector) allDetectors[chara.team].push(chara);
- });
- //Clear old units detected buffer
- Referee.detectedUnits.forEach(function(charas,team){
- //For each team
- charas.forEach(function(chara){
- chara.removeBuffer(detectorBuffer[team]);
- });
+ $.unique(Referee.underArbiterUnits[N]);
+ });
+ //Arbiter buffer effect on these units
+ Referee.underArbiterUnits.forEach(function (charas) {
+ charas.forEach(function (chara) {
+ chara.addBuffer(arbiterBuffer);
});
- Referee.detectedUnits=Game.getPropArray([]);
- allDetectors.forEach(function(detectors,N){
- //Find new under detector units
- detectors.forEach(function(detector){
- //Find targets: enemy invisible units inside detector sight
- var targets=Game.getInRangeOnes(detector.posX(),detector.posY(),detector.get('sight'),N+'',true,null,function(chara){
- return chara['isInvisible'+Game.team];
- });
- Referee.detectedUnits[N]=Referee.detectedUnits[N].concat(targets);
- });
- $.unique(Referee.detectedUnits[N]);
+ });
+ }
+}
+//detectorBuffer are reverse of arbiterBuffer
+judgeDetect: function () {
+ //Every 0.4 sec
+ if (Game.mainTick % 4 == 0) {
+ //Same detector buffer reference
+ var detectorBuffer = Gobj.detectorBuffer;
+ var allDetectors = Game.getPropArray([]);
+ Unit.allUnits.forEach(function (chara) {
+ if (chara.detector)
+ allDetectors[chara.team].push(chara);
+ });
+ //Clear old units detected buffer
+ Referee.detectedUnits.forEach(function (charas, team) {
+ //For each team
+ charas.forEach(function (chara) {
+ chara.removeBuffer(detectorBuffer[team]);
});
- //Detector buffer effect on these units
- Referee.detectedUnits.forEach(function(charas,team){
- //For each team
- charas.forEach(function(chara){
- chara.addBuffer(detectorBuffer[team]);
+ });
+ Referee.detectedUnits = Game.getPropArray([]);
+ allDetectors.forEach(function (detectors, N) {
+ //Find new under detector units
+ detectors.forEach(function (detector) {
+ //Find targets: enemy invisible units inside detector sight
+ var targets = Game.getInRangeOnes(detector.posX(), detector.posY(), detector.get('sight'), N + '', true, null, function (chara) {
+ return chara['isInvisible' + Game.team];
});
+ Referee.detectedUnits[N] = Referee.detectedUnits[N].concat(targets);
});
- //PurpleEffect, RedEffect and GreenEffect are also detector, override invisible
- Animation.allEffects.filter(function(effect){
- return (effect instanceof Animation.PurpleEffect) ||
- (effect instanceof Animation.RedEffect) ||
- (effect instanceof Animation.GreenEffect)
- }).forEach(function(effect){
- var target=effect.target;
- for (var team=0;teamN
- var units=Unit.allGroundUnits().concat(Building.allBuildings);
- for(var N=0;NN
+ var units = Unit.allGroundUnits().concat(Building.allBuildings);
+ for (var N = 0; N < units.length; N++) {
+ var chara1 = units[N];
+ for (var M = N + 1; M < units.length; M++) {
+ var chara2 = units[M];
+ var dist = chara1.distanceFrom(chara2);
+ //Ground unit collision limit
+ var distLimit;
+ if (chara2 instanceof Unit) {
+ distLimit = (chara1.radius() + chara2.radius()) * 0.5;
+ if (distLimit < Unit.meleeRange)
+ distLimit = Unit.meleeRange; //Math.max
+ }
+ else {
+ distLimit = (chara1.radius() + chara2.radius()) * 0.8;
+ }
+ //Separate override ones
+ if (dist == 0) {
+ var colPos = Referee._pos[Game.getNextRandom() * 4 >> 0];
+ if (chara1 instanceof Unit) {
+ chara1.x += colPos[0];
+ chara1.y += colPos[1];
+ dist = 1;
}
- //Separate override ones
- if (dist==0) {
- var colPos=Referee._pos[Game.getNextRandom()*4>>0];
- if (chara1 instanceof Unit){
- chara1.x+=colPos[0];
- chara1.y+=colPos[1];
- dist=1;
- }
- else {
- if (chara2 instanceof Unit){
- chara2.x+=colPos[0];
- chara2.y+=colPos[1];
- dist=1;
- }
+ else {
+ if (chara2 instanceof Unit) {
+ chara2.x += colPos[0];
+ chara2.y += colPos[1];
+ dist = 1;
}
}
- if (dist>0;
- var adjustY=K*(chara1.y-chara2.y)>>0;
- //Adjust location
- var interactRatio1=0;
- var interactRatio2=0;
- if (chara1 instanceof Building){
- interactRatio1=0;
- //Building VS Unit
- if (chara2 instanceof Unit) interactRatio2=2;
- //Building VS Building
- else interactRatio2=0;
- }
- else {
- //Unit VS Unit
- if (chara2 instanceof Unit) {
- if (chara1.status=="moving"){
- //Move VS Move
- if (chara2.status=="moving"){
- interactRatio1=1;
- interactRatio2=1;
- }
- //Move VS Dock
- else {
- interactRatio1=2;
- interactRatio2=0;
- }
+ }
+ if (dist < distLimit) {
+ //Collision flag
+ chara1.collision = chara2;
+ chara2.collision = chara1;
+ //Adjust ratio
+ var K = (distLimit - dist) / dist / 2;
+ var adjustX = K * (chara1.x - chara2.x) >> 0;
+ var adjustY = K * (chara1.y - chara2.y) >> 0;
+ //Adjust location
+ var interactRatio1 = 0;
+ var interactRatio2 = 0;
+ if (chara1 instanceof Building) {
+ interactRatio1 = 0;
+ //Building VS Unit
+ if (chara2 instanceof Unit)
+ interactRatio2 = 2;
+ else
+ interactRatio2 = 0;
+ }
+ else {
+ //Unit VS Unit
+ if (chara2 instanceof Unit) {
+ if (chara1.status == "moving") {
+ //Move VS Move
+ if (chara2.status == "moving") {
+ interactRatio1 = 1;
+ interactRatio2 = 1;
}
else {
- //Dock VS Move
- if (chara2.status=="moving"){
- interactRatio1=0;
- interactRatio2=2;
- }
- //Dock VS Dock
- else {
- interactRatio1=1;
- interactRatio2=1;
- }
+ interactRatio1 = 2;
+ interactRatio2 = 0;
}
}
- //Unit VS Building
else {
- interactRatio1=2;
- interactRatio2=0;
+ //Dock VS Move
+ if (chara2.status == "moving") {
+ interactRatio1 = 0;
+ interactRatio2 = 2;
+ }
+ else {
+ interactRatio1 = 1;
+ interactRatio2 = 1;
+ }
}
}
- chara1.x+=interactRatio1*adjustX;
- chara1.y+=interactRatio1*adjustY;
- chara2.x-=interactRatio2*adjustX;
- chara2.y-=interactRatio2*adjustY;
- }
- }
- }
- units=Unit.allFlyingUnits();
- for(var N=0;N>0];
- chara1.x+=colPos[0];
- chara1.y+=colPos[1];
- dist=1;
- }
- if (dist>0;
- var adjustY=K*(chara1.y-chara2.y)>>0;
- //Adjust location
- chara1.x+=adjustX;
- chara1.y+=adjustY;
- chara2.x-=adjustX;
- chara2.y-=adjustY;
+ else {
+ interactRatio1 = 2;
+ interactRatio2 = 0;
+ }
}
+ chara1.x += interactRatio1 * adjustX;
+ chara1.y += interactRatio1 * adjustY;
+ chara2.x -= interactRatio2 * adjustX;
+ chara2.y -= interactRatio2 * adjustY;
}
}
- },
- coverFog:function(){
- //No need to set interval as 1sec
- if (Game.mainTick%10==0) Map.drawFogAndMinimap();
- },
- alterSelectionMode:function(){
- //GC after some user changes
- $.extend([],Game.allSelected).forEach(function(chara){
- if (chara.status=='dead' || (chara['isInvisible'+Game.team] && chara.isEnemy()))
- Game.allSelected.splice(Game.allSelected.indexOf(chara),1);
- });
- //Alter info UI: Multi selection mode
- if (Game.allSelected.length>1){
- //Need minor refresh or big move
- if (_$.arrayEqual(Game.allSelected,Game._oldAllSelected)){
- //Only refresh
- Game.refreshMultiSelectBox();
+ }
+ units = Unit.allFlyingUnits();
+ for (var N = 0; N < units.length; N++) {
+ var chara1 = units[N];
+ for (var M = N + 1; M < units.length; M++) {
+ var chara2 = units[M];
+ var dist = chara1.distanceFrom(chara2);
+ //Flying unit collision limit
+ var distLimit = Unit.meleeRange;
+ //Separate override ones
+ if (dist == 0) {
+ var colPos = Referee._pos[Game.getNextRandom() * 4 >> 0];
+ chara1.x += colPos[0];
+ chara1.y += colPos[1];
+ dist = 1;
}
- else {
- //Redraw multiSelection div
- Game.drawMultiSelectBox();
- //Record this operation
- Game._oldAllSelected=_$.mixin([],Game.allSelected);
+ if (dist < distLimit) {
+ //Adjust ratio
+ var K = (distLimit - dist) / dist / 2;
+ var adjustX = K * (chara1.x - chara2.x) >> 0;
+ var adjustY = K * (chara1.y - chara2.y) >> 0;
+ //Adjust location
+ chara1.x += adjustX;
+ chara1.y += adjustY;
+ chara2.x -= adjustX;
+ chara2.y -= adjustY;
}
- //Show multiSelection box
- $('div.override').show();
- $('div.override div.multiSelection').show();
}
- //Alter info UI: Single selection mode
+ }
+}
+coverFog: function () {
+ //No need to set interval as 1sec
+ if (Game.mainTick % 10 == 0)
+ Map.drawFogAndMinimap();
+}
+alterSelectionMode: function () {
+ //GC after some user changes
+ $.extend([], Game.allSelected).forEach(function (chara) {
+ if (chara.status == 'dead' || (chara['isInvisible' + Game.team] && chara.isEnemy()))
+ Game.allSelected.splice(Game.allSelected.indexOf(chara), 1);
+ });
+ //Alter info UI: Multi selection mode
+ if (Game.allSelected.length > 1) {
+ //Need minor refresh or big move
+ if (_$.arrayEqual(Game.allSelected, Game._oldAllSelected)) {
+ //Only refresh
+ Game.refreshMultiSelectBox();
+ }
else {
- $('div.override').hide();
- $('div.override div.multiSelection').hide();
+ //Redraw multiSelection div
+ Game.drawMultiSelectBox();
+ //Record this operation
+ Game._oldAllSelected = _$.mixin([], Game.allSelected);
}
- },
- addLarva:function(){
- //Every 20 sec
- if (Game.mainTick%200==0){
- Building.allBuildings.filter(function(build){
- return build.produceLarva;
- }).forEach(function(build){
- //Can give birth to 3 larvas
- for(var N=0;N<3;N++){
- if (build.larvas[N]==null || build.larvas[N].status=="dead"){
- build.larvas[N]=new Zerg.Larva({x:(build.x+N*48),y:(build.y+build.height+4),team:build.team});
- //Which base larva belongs to
- build.larvas[N].owner=build;
- break;
- }
+ //Show multiSelection box
+ $('div.override').show();
+ $('div.override div.multiSelection').show();
+ }
+ else {
+ $('div.override').hide();
+ $('div.override div.multiSelection').hide();
+ }
+}
+addLarva: function () {
+ //Every 20 sec
+ if (Game.mainTick % 200 == 0) {
+ Building.allBuildings.filter(function (build) {
+ return build.produceLarva;
+ }).forEach(function (build) {
+ //Can give birth to 3 larvas
+ for (var N = 0; N < 3; N++) {
+ if (build.larvas[N] == null || build.larvas[N].status == "dead") {
+ build.larvas[N] = new Zerg.Larva({ x: (build.x + N * 48), y: (build.y + build.height + 4), team: build.team });
+ //Which base larva belongs to
+ build.larvas[N].owner = build;
+ break;
}
- });
- }
- },
- judgeBuildingInjury:function(){
- //Every 1 sec
- if (Game.mainTick%10==0){
- Building.allBuildings.filter(function(build){
- return build.injuryOffsets;
- }).forEach(function(build){
- var injuryLevel=(1-build.life/build.HP)/0.25>>0;
- if (injuryLevel>3) injuryLevel=3;
- var curLevel=build.injuryAnimations.length;
- if (injuryLevel>curLevel){
- var offsets=build.injuryOffsets;
- var scale=build.injuryScale?build.injuryScale:1;
- for (var N=curLevel;N1) build.sound.selected=build.sound.onfire;
- }
+ }
+ });
+ }
+}
+judgeBuildingInjury: function () {
+ //Every 1 sec
+ if (Game.mainTick % 10 == 0) {
+ Building.allBuildings.filter(function (build) {
+ return build.injuryOffsets;
+ }).forEach(function (build) {
+ var injuryLevel = (1 - build.life / build.HP) / 0.25 >> 0;
+ if (injuryLevel > 3)
+ injuryLevel = 3;
+ var curLevel = build.injuryAnimations.length;
+ if (injuryLevel > curLevel) {
+ var offsets = build.injuryOffsets;
+ var scale = build.injuryScale ? build.injuryScale : 1;
+ for (var N = curLevel; N < injuryLevel; N++) {
+ //Add injury animations
+ build.injuryAnimations.push(new Animation[build.injuryNames[N]]({ target: build, offset: offsets[N], scale: scale }));
}
- if (injuryLevelinjuryLevel;N--){
- //Clear injury animations
- build.injuryAnimations.pop().die();
- }
- if ((build instanceof Building.TerranBuilding) || (build instanceof Building.ProtossBuilding)){
- if (injuryLevel<=1) build.sound.selected=build.sound.normal;
- }
+ if ((build instanceof Building.TerranBuilding) || (build instanceof Building.ProtossBuilding)) {
+ if (injuryLevel > 1)
+ build.sound.selected = build.sound.onfire;
+ }
+ }
+ if (injuryLevel < curLevel) {
+ for (var N = curLevel; N > injuryLevel; N--) {
+ //Clear injury animations
+ build.injuryAnimations.pop().die();
+ }
+ if ((build instanceof Building.TerranBuilding) || (build instanceof Building.ProtossBuilding)) {
+ if (injuryLevel <= 1)
+ build.sound.selected = build.sound.normal;
}
- });
- }
- },
- judgeMan:function(){
- //Update current man and total man for all teams
- //?We may only need to judge our team's man for client consume use
- var curMan=Game.getPropArray(0),totalMan=Game.getPropArray(0);
- Unit.allUnits.concat(Building.allBuildings).forEach(function(chara){
- if (chara.cost && chara.cost.man) (curMan[chara.team])+=chara.cost.man;
- if (chara.manPlus) (totalMan[chara.team])+=chara.manPlus;
- //Transport
- if (chara.loadedUnits) {
- chara.loadedUnits.forEach(function(passenger){
- if (passenger.cost && passenger.cost.man) (curMan[passenger.team])+=passenger.cost.man;
- });
}
});
- for (var N=0;NN
+ var units=Unit.allGroundUnits().concat(Building.allBuildings);
+ for(var N=0;N>0];
+ if (chara1 instanceof Unit){
+ chara1.x+=colPos[0];
+ chara1.y+=colPos[1];
+ dist=1;
+ }
+ else {
+ if (chara2 instanceof Unit){
+ chara2.x+=colPos[0];
+ chara2.y+=colPos[1];
+ dist=1;
+ }
+ }
+ }
+ if (dist>0;
+ var adjustY=K*(chara1.y-chara2.y)>>0;
+ //Adjust location
+ var interactRatio1=0;
+ var interactRatio2=0;
+ if (chara1 instanceof Building){
+ interactRatio1=0;
+ //Building VS Unit
+ if (chara2 instanceof Unit) interactRatio2=2;
+ //Building VS Building
+ else interactRatio2=0;
+ }
+ else {
+ //Unit VS Unit
+ if (chara2 instanceof Unit) {
+ if (chara1.status=="moving"){
+ //Move VS Move
+ if (chara2.status=="moving"){
+ interactRatio1=1;
+ interactRatio2=1;
+ }
+ //Move VS Dock
+ else {
+ interactRatio1=2;
+ interactRatio2=0;
+ }
+ }
+ else {
+ //Dock VS Move
+ if (chara2.status=="moving"){
+ interactRatio1=0;
+ interactRatio2=2;
+ }
+ //Dock VS Dock
+ else {
+ interactRatio1=1;
+ interactRatio2=1;
+ }
+ }
+ }
+ //Unit VS Building
+ else {
+ interactRatio1=2;
+ interactRatio2=0;
+ }
+ }
+ chara1.x+=interactRatio1*adjustX;
+ chara1.y+=interactRatio1*adjustY;
+ chara2.x-=interactRatio2*adjustX;
+ chara2.y-=interactRatio2*adjustY;
+ }
+ }
+ }
+ units=Unit.allFlyingUnits();
+ for(var N=0;N>0];
+ chara1.x+=colPos[0];
+ chara1.y+=colPos[1];
+ dist=1;
+ }
+ if (dist>0;
+ var adjustY=K*(chara1.y-chara2.y)>>0;
+ //Adjust location
+ chara1.x+=adjustX;
+ chara1.y+=adjustY;
+ chara2.x-=adjustX;
+ chara2.y-=adjustY;
+ }
+ }
+ }
+ },
+ coverFog:function(){
+ //No need to set interval as 1sec
+ if (Game.mainTick%10==0) Map.drawFogAndMinimap();
+ },
+ alterSelectionMode:function(){
+ //GC after some user changes
+ $.extend([],Game.allSelected).forEach(function(chara){
+ if (chara.status=='dead' || (chara['isInvisible'+Game.team] && chara.isEnemy()))
+ Game.allSelected.splice(Game.allSelected.indexOf(chara),1);
+ });
+ //Alter info UI: Multi selection mode
+ if (Game.allSelected.length>1){
+ //Need minor refresh or big move
+ if (_$.arrayEqual(Game.allSelected,Game._oldAllSelected)){
+ //Only refresh
+ Game.refreshMultiSelectBox();
+ }
+ else {
+ //Redraw multiSelection div
+ Game.drawMultiSelectBox();
+ //Record this operation
+ Game._oldAllSelected=_$.mixin([],Game.allSelected);
+ }
+ //Show multiSelection box
+ $('div.override').show();
+ $('div.override div.multiSelection').show();
+ }
+ //Alter info UI: Single selection mode
+ else {
+ $('div.override').hide();
+ $('div.override div.multiSelection').hide();
+ }
+ },
+ addLarva:function(){
+ //Every 20 sec
+ if (Game.mainTick%200==0){
+ Building.allBuildings.filter(function(build){
+ return build.produceLarva;
+ }).forEach(function(build){
+ //Can give birth to 3 larvas
+ for(var N=0;N<3;N++){
+ if (build.larvas[N]==null || build.larvas[N].status=="dead"){
+ build.larvas[N]=new Zerg.Larva({x:(build.x+N*48),y:(build.y+build.height+4),team:build.team});
+ //Which base larva belongs to
+ build.larvas[N].owner=build;
+ break;
+ }
+ }
+ });
+ }
+ },
+ judgeBuildingInjury:function(){
+ //Every 1 sec
+ if (Game.mainTick%10==0){
+ Building.allBuildings.filter(function(build){
+ return build.injuryOffsets;
+ }).forEach(function(build){
+ var injuryLevel=(1-build.life/build.HP)/0.25>>0;
+ if (injuryLevel>3) injuryLevel=3;
+ var curLevel=build.injuryAnimations.length;
+ if (injuryLevel>curLevel){
+ var offsets=build.injuryOffsets;
+ var scale=build.injuryScale?build.injuryScale:1;
+ for (var N=curLevel;N1) build.sound.selected=build.sound.onfire;
+ }
+ }
+ if (injuryLevelinjuryLevel;N--){
+ //Clear injury animations
+ build.injuryAnimations.pop().die();
+ }
+ if ((build instanceof Building.TerranBuilding) || (build instanceof Building.ProtossBuilding)){
+ if (injuryLevel<=1) build.sound.selected=build.sound.normal;
+ }
+ }
+ });
+ }
+ },
+ judgeMan:function(){
+ //Update current man and total man for all teams
+ //?We may only need to judge our team's man for client consume use
+ var curMan=Game.getPropArray(0),totalMan=Game.getPropArray(0);
+ Unit.allUnits.concat(Building.allBuildings).forEach(function(chara){
+ if (chara.cost && chara.cost.man) (curMan[chara.team])+=chara.cost.man;
+ if (chara.manPlus) (totalMan[chara.team])+=chara.manPlus;
+ //Transport
+ if (chara.loadedUnits) {
+ chara.loadedUnits.forEach(function(passenger){
+ if (passenger.cost && passenger.cost.man) (curMan[passenger.team])+=passenger.cost.man;
+ });
+ }
+ });
+ for (var N=0;NResource[team].mine){
- oweFlag=true;
- Game.showMessage('Not enough minerals...mine more minerals');
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].mine.play();
- }
- if(cost['gas'] && cost['gas']>Resource[team].gas){
- oweFlag=true;
- Game.showMessage('Not enough Vespene gases...harvest more gas');
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].gas.play();
- }
- if(cost['man'] && cost['man']>(Resource[team].totalMan-Resource[team].curMan) && !Cheat.manUnlimited){
- oweFlag=true;
- switch(Game.race.selected){
- case 'Zerg':
- Game.showMessage('Too many underlings...create more Overlords');
- break;
- case 'Terran':
- Game.showMessage('Not enough supplies...build more Supply Depots');
- break;
- case 'Protoss':
- Game.showMessage('Not enough psi...build more Pylons');
- break;
+ });
+ return cost;
+ };
+ //Check if paid successfully
+ this.paypal = function (cost) {
+ if (cost) {
+ var oweFlag = false;
+ if (Cheat.gathering)
+ cost.magic = 0;
+ var team = (this.team != null) ? this.team : Game.team;
+ if (cost['mine'] && cost['mine'] > Resource[team].mine) {
+ oweFlag = true;
+ Game.showMessage('Not enough minerals...mine more minerals');
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].mine.play();
}
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].man.play();
- }
- if(cost['magic'] && cost['magic']>this.magic){
- oweFlag=true;
- Game.showMessage('Not enough energy');
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].magic.play();
- }
- if (oweFlag){
- //Payment failed
- return false;
- }
- else {
- if (!this.creditBill){
- //Pay immediately
- if(cost['mine']){
- Resource[team].mine-=cost['mine'];
- }
- if(cost['gas']){
- Resource[team].gas-=cost['gas'];
+ if (cost['gas'] && cost['gas'] > Resource[team].gas) {
+ oweFlag = true;
+ Game.showMessage('Not enough Vespene gases...harvest more gas');
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].gas.play();
+ }
+ if (cost['man'] && cost['man'] > (Resource[team].totalMan - Resource[team].curMan) && !Cheat.manUnlimited) {
+ oweFlag = true;
+ switch (Game.race.selected) {
+ case 'Zerg':
+ Game.showMessage('Too many underlings...create more Overlords');
+ break;
+ case 'Terran':
+ Game.showMessage('Not enough supplies...build more Supply Depots');
+ break;
+ case 'Protoss':
+ Game.showMessage('Not enough psi...build more Pylons');
+ break;
}
- if(cost['magic']){
- this.magic-=cost['magic'];
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].man.play();
+ }
+ if (cost['magic'] && cost['magic'] > this.magic) {
+ oweFlag = true;
+ Game.showMessage('Not enough energy');
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].magic.play();
+ }
+ if (oweFlag) {
+ //Payment failed
+ return false;
+ }
+ else {
+ if (!this.creditBill) {
+ //Pay immediately
+ if (cost['mine']) {
+ Resource[team].mine -= cost['mine'];
+ }
+ if (cost['gas']) {
+ Resource[team].gas -= cost['gas'];
+ }
+ if (cost['magic']) {
+ this.magic -= cost['magic'];
+ }
}
+ //Already paid
+ return true;
}
- //Already paid
- return true;
}
- }
- //No bill
- else return true;
- },
- //Pay credit card bill
- payCreditBill:function(){
- var cost=this.creditBill;
- //Paid credit bill, no longer owe money this time
- delete this.creditBill;
- return Resource.paypal.call(this,cost);
+ else
+ return true;
+ };
+ //Pay credit card bill
+ this.payCreditBill = function () {
+ var cost = this.creditBill;
+ //Paid credit bill, no longer owe money this time
+ delete this.creditBill;
+ return Resource.paypal.call(this, cost);
+ };
}
-};
\ No newline at end of file
+ return Resource;
+}());
+;
+//# sourceMappingURL=Resource.js.map
\ No newline at end of file
diff --git a/GameRule/Resource.ts b/GameRule/Resource.ts
new file mode 100644
index 0000000..1df18e5
--- /dev/null
+++ b/GameRule/Resource.ts
@@ -0,0 +1,121 @@
+class Resource {
+
+ init:function(){
+ for (var N=0;NResource[team].mine){
+ oweFlag=true;
+ Game.showMessage('Not enough minerals...mine more minerals');
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].mine.play();
+ }
+ if(cost['gas'] && cost['gas']>Resource[team].gas){
+ oweFlag=true;
+ Game.showMessage('Not enough Vespene gases...harvest more gas');
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].gas.play();
+ }
+ if(cost['man'] && cost['man']>(Resource[team].totalMan-Resource[team].curMan) && !Cheat.manUnlimited){
+ oweFlag=true;
+ switch(Game.race.selected){
+ case 'Zerg':
+ Game.showMessage('Too many underlings...create more Overlords');
+ break;
+ case 'Terran':
+ Game.showMessage('Not enough supplies...build more Supply Depots');
+ break;
+ case 'Protoss':
+ Game.showMessage('Not enough psi...build more Pylons');
+ break;
+ }
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].man.play();
+ }
+ if(cost['magic'] && cost['magic']>this.magic){
+ oweFlag=true;
+ Game.showMessage('Not enough energy');
+ //Advisor voice
+ Referee.voice('resource')[Game.race.selected].magic.play();
+ }
+ if (oweFlag){
+ //Payment failed
+ return false;
+ }
+ else {
+ if (!this.creditBill){
+ //Pay immediately
+ if(cost['mine']){
+ Resource[team].mine-=cost['mine'];
+ }
+ if(cost['gas']){
+ Resource[team].gas-=cost['gas'];
+ }
+ if(cost['magic']){
+ this.magic-=cost['magic'];
+ }
+ }
+ //Already paid
+ return true;
+ }
+ }
+ //No bill
+ else return true;
+ },
+ //Pay credit card bill
+ payCreditBill:function(){
+ var cost=this.creditBill;
+ //Paid credit bill, no longer owe money this time
+ delete this.creditBill;
+ return Resource.paypal.call(this,cost);
+ }
+};
\ No newline at end of file
diff --git a/GameRule/SC_server.js b/GameRule/SC_server.js
index 9b79e5a..96bd613 100644
--- a/GameRule/SC_server.js
+++ b/GameRule/SC_server.js
@@ -1,166 +1,171 @@
-var http=require('http');
-var httpServer=http.createServer(function(request,response){
- console.log('Receive request from '+request.url);
+var http = require('http');
+var httpServer = http.createServer(function (request, response) {
+ console.log('Receive request from ' + request.url);
response.end('');
});
httpServer.listen(28082);
console.log('HTTP server starts listening port 28082...');
-var wsServer=new (require('websocket').server)({
- httpServer:httpServer
-});//Closure
-wsServer.rooms=[];
-var multiPlayerNum=2;//Closure
-var webSockets=[];//Closure
-var getServerTime=function(){
- var now=new Date();
- var timestamp=now.getFullYear()+'-'+(now.getMonth()+1)+'-'+now.getDate()+' '
- +now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
+var wsServer = new (require('websocket').server)({
+ httpServer: httpServer
+}); //Closure
+wsServer.rooms = [];
+var multiPlayerNum = 2; //Closure
+var webSockets = []; //Closure
+var getServerTime = function () {
+ var now = new Date();
+ var timestamp = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' '
+ + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
return timestamp;
};
-wsServer.on('request',function(request){
- var socket=request.accept();//Closure
- var latencyMeasures=[{start:new Date()}];//Closure
- var IP=request.remoteAddress;//Closure
- webSockets.push(socket);
- console.log(getServerTime()+' '+IP+' is connected...');
- socket.send(JSON.stringify({type:'ping'}));
- socket.on('message',function(message){
- var data=message.utf8Data;
- data=JSON.parse(data);
- switch(data.type){
+wsServer.on('request', function (request) {
+ var socket = request.accept(); //Closure
+ var latencyMeasures = [{ start: new Date() }]; //Closure
+ var IP = request.remoteAddress; //Closure
+ webSockets.push(socket);
+ console.log(getServerTime() + ' ' + IP + ' is connected...');
+ socket.send(JSON.stringify({ type: 'ping' }));
+ socket.on('message', function (message) {
+ var data = message.utf8Data;
+ data = JSON.parse(data);
+ switch (data.type) {
case 'pong':
- var times=latencyMeasures.length;
- latencyMeasures[times-1].end=new Date();
+ var times = latencyMeasures.length;
+ latencyMeasures[times - 1].end = new Date();
//console.log('Receive pong '+times);
- if (times==5) {
- var latency=0;
- latencyMeasures.forEach(function(latencyMeasure){
- latency+=(latencyMeasure.end-latencyMeasure.start);
+ if (times == 5) {
+ var latency = 0;
+ latencyMeasures.forEach(function (latencyMeasure) {
+ latency += (latencyMeasure.end - latencyMeasure.start);
});
- latency=(latency/times)>>0;
- socket.tickLag=Math.ceil(latency*2/100);//Can adjust it here
- console.log(IP+' average latency is '+latency);
- console.log(IP+' tick lag is '+socket.tickLag);
- if (webSockets.length==multiPlayerNum){
+ latency = (latency / times) >> 0;
+ socket.tickLag = Math.ceil(latency * 2 / 100); //Can adjust it here
+ console.log(IP + ' average latency is ' + latency);
+ console.log(IP + ' tick lag is ' + socket.tickLag);
+ if (webSockets.length == multiPlayerNum) {
//Game start: Init new room
- var room={id:wsServer.rooms.length,webSockets:webSockets};//Closure
- webSockets=[];
- console.log('Open room '+room.id);//test
- room.tick=0;
- room.clientTicks=[];
- for (var N=0;N>0;
- socket.name=names[index];
- socket.color=colors[index];
- names.splice(index,1);
- colors.splice(index,1);
- socket.send(JSON.stringify({type:'start',team:N}));
+ var index = Math.random() * names.length >> 0;
+ socket.name = names[index];
+ socket.color = colors[index];
+ names.splice(index, 1);
+ colors.splice(index, 1);
+ socket.send(JSON.stringify({ type: 'start', team: N }));
//Start server ticking, trigger clients
- socket.send(JSON.stringify({type:'tick',tick:(room.tick+room.roomLag)}));
+ socket.send(JSON.stringify({ type: 'tick', tick: (room.tick + room.roomLag) }));
});
wsServer.rooms.push(room);
//Start server ticking
- setInterval(function(){
- var minTick=Math.min.apply({},room.clientTicks);
+ setInterval(function () {
+ var minTick = Math.min.apply({}, room.clientTicks);
//console.log('minTick:'+minTick);
- if (room.tick'+socket.name+': '+data.msg+''}));
+ if (socket.room) {
+ socket.room.webSockets.forEach(function (webSocket) {
+ webSocket.send(JSON.stringify({ type: 'notice', msg: '' + socket.name + ': ' + data.msg + '' }));
});
}
break;
case 'getReplay':
- socket.send(JSON.stringify({type:'replay',replay:socket.room.replay}));
+ socket.send(JSON.stringify({ type: 'replay', replay: socket.room.replay }));
break;
case 'login':
- console.log(getServerTime()+' '+IP+' login to level '+data.level+' in team '+data.team);
- console.log(IP+' Version: '+data.version);
- console.log(IP+' Browser: size={x:'+data.size.x+',y:'+data.size.y+'} lang='+data.language+' OS='+data.platform);
+ console.log(getServerTime() + ' ' + IP + ' login to level ' + data.level + ' in team ' + data.team);
+ console.log(IP + ' Version: ' + data.version);
+ console.log(IP + ' Browser: size={x:' + data.size.x + ',y:' + data.size.y + '} lang=' + data.language + ' OS=' + data.platform);
break;
case 'snapshot':
- console.log('\n####### '+getServerTime()+' '+IP+' snapshot No.'+data.num+' #######');
- console.log('Click statistics: left='+data.click.left+' right='+data.click.right);
- console.log('Unit statistics: ours='+data.count.ourUnits+' enemies='+data.count.enemyUnits);
- if (data.count.ourUnits+data.count.enemyUnits<20) console.log(data.units);
- console.log('Building statistics: ours='+data.count.ourBuildings+' enemies='+data.count.enemyBuildings);
- if (data.count.ourBuildings+data.count.enemyBuildings<20) console.log(data.buildings);
+ console.log('\n####### ' + getServerTime() + ' ' + IP + ' snapshot No.' + data.num + ' #######');
+ console.log('Click statistics: left=' + data.click.left + ' right=' + data.click.right);
+ console.log('Unit statistics: ours=' + data.count.ourUnits + ' enemies=' + data.count.enemyUnits);
+ if (data.count.ourUnits + data.count.enemyUnits < 20)
+ console.log(data.units);
+ console.log('Building statistics: ours=' + data.count.ourBuildings + ' enemies=' + data.count.enemyBuildings);
+ if (data.count.ourBuildings + data.count.enemyBuildings < 20)
+ console.log(data.buildings);
console.log('##########################################\n');
break;
case 'replaySnapshot':
- socket.replaySnapshot=JSON.stringify(data.replaySnapshot);
+ socket.replaySnapshot = JSON.stringify(data.replaySnapshot);
break;
case 'log':
//Just print out
console.log(data.log);
- }
+ }
});
- socket.on('close',function(message){
+ socket.on('close', function (message) {
//Broadcast disconnect info
- var msg=(getServerTime()+' '+(socket.name?socket.name:IP)+' has left from game...');
+ var msg = (getServerTime() + ' ' + (socket.name ? socket.name : IP) + ' has left from game...');
console.log(msg);
//Print replay
if (socket.replaySnapshot) {
- console.log('################ '+IP+' replay: ################');
+ console.log('################ ' + IP + ' replay: ################');
console.log(socket.replaySnapshot);
console.log('################################################################');
}
//Kick off losing connection user
- if (socket.room){
- var webSockets=socket.room.webSockets;
- webSockets.splice(webSockets.indexOf(socket),1);
+ if (socket.room) {
+ var webSockets = socket.room.webSockets;
+ webSockets.splice(webSockets.indexOf(socket), 1);
//Make game to continue without player control
- socket.room.clientTicks[socket.team]=Number.MAX_VALUE;
- webSockets.forEach(function(webSocket){
- webSocket.send(JSON.stringify({type:'notice',msg:msg}));
+ socket.room.clientTicks[socket.team] = Number.MAX_VALUE;
+ webSockets.forEach(function (webSocket) {
+ webSocket.send(JSON.stringify({ type: 'notice', msg: msg }));
});
}
});
});
+//# sourceMappingURL=SC_server.js.map
\ No newline at end of file
diff --git a/GameRule/SC_server.ts b/GameRule/SC_server.ts
new file mode 100644
index 0000000..9b79e5a
--- /dev/null
+++ b/GameRule/SC_server.ts
@@ -0,0 +1,166 @@
+var http=require('http');
+var httpServer=http.createServer(function(request,response){
+ console.log('Receive request from '+request.url);
+ response.end('');
+});
+httpServer.listen(28082);
+console.log('HTTP server starts listening port 28082...');
+var wsServer=new (require('websocket').server)({
+ httpServer:httpServer
+});//Closure
+wsServer.rooms=[];
+var multiPlayerNum=2;//Closure
+var webSockets=[];//Closure
+var getServerTime=function(){
+ var now=new Date();
+ var timestamp=now.getFullYear()+'-'+(now.getMonth()+1)+'-'+now.getDate()+' '
+ +now.getHours()+':'+now.getMinutes()+':'+now.getSeconds();
+ return timestamp;
+};
+wsServer.on('request',function(request){
+ var socket=request.accept();//Closure
+ var latencyMeasures=[{start:new Date()}];//Closure
+ var IP=request.remoteAddress;//Closure
+ webSockets.push(socket);
+ console.log(getServerTime()+' '+IP+' is connected...');
+ socket.send(JSON.stringify({type:'ping'}));
+ socket.on('message',function(message){
+ var data=message.utf8Data;
+ data=JSON.parse(data);
+ switch(data.type){
+ case 'pong':
+ var times=latencyMeasures.length;
+ latencyMeasures[times-1].end=new Date();
+ //console.log('Receive pong '+times);
+ if (times==5) {
+ var latency=0;
+ latencyMeasures.forEach(function(latencyMeasure){
+ latency+=(latencyMeasure.end-latencyMeasure.start);
+ });
+ latency=(latency/times)>>0;
+ socket.tickLag=Math.ceil(latency*2/100);//Can adjust it here
+ console.log(IP+' average latency is '+latency);
+ console.log(IP+' tick lag is '+socket.tickLag);
+ if (webSockets.length==multiPlayerNum){
+ //Game start: Init new room
+ var room={id:wsServer.rooms.length,webSockets:webSockets};//Closure
+ webSockets=[];
+ console.log('Open room '+room.id);//test
+ room.tick=0;
+ room.clientTicks=[];
+ for (var N=0;N>0;
+ socket.name=names[index];
+ socket.color=colors[index];
+ names.splice(index,1);
+ colors.splice(index,1);
+ socket.send(JSON.stringify({type:'start',team:N}));
+ //Start server ticking, trigger clients
+ socket.send(JSON.stringify({type:'tick',tick:(room.tick+room.roomLag)}));
+ });
+ wsServer.rooms.push(room);
+ //Start server ticking
+ setInterval(function(){
+ var minTick=Math.min.apply({},room.clientTicks);
+ //console.log('minTick:'+minTick);
+ if (room.tick'+socket.name+': '+data.msg+''}));
+ });
+ }
+ break;
+ case 'getReplay':
+ socket.send(JSON.stringify({type:'replay',replay:socket.room.replay}));
+ break;
+ case 'login':
+ console.log(getServerTime()+' '+IP+' login to level '+data.level+' in team '+data.team);
+ console.log(IP+' Version: '+data.version);
+ console.log(IP+' Browser: size={x:'+data.size.x+',y:'+data.size.y+'} lang='+data.language+' OS='+data.platform);
+ break;
+ case 'snapshot':
+ console.log('\n####### '+getServerTime()+' '+IP+' snapshot No.'+data.num+' #######');
+ console.log('Click statistics: left='+data.click.left+' right='+data.click.right);
+ console.log('Unit statistics: ours='+data.count.ourUnits+' enemies='+data.count.enemyUnits);
+ if (data.count.ourUnits+data.count.enemyUnits<20) console.log(data.units);
+ console.log('Building statistics: ours='+data.count.ourBuildings+' enemies='+data.count.enemyBuildings);
+ if (data.count.ourBuildings+data.count.enemyBuildings<20) console.log(data.buildings);
+ console.log('##########################################\n');
+ break;
+ case 'replaySnapshot':
+ socket.replaySnapshot=JSON.stringify(data.replaySnapshot);
+ break;
+ case 'log':
+ //Just print out
+ console.log(data.log);
+ }
+ });
+ socket.on('close',function(message){
+ //Broadcast disconnect info
+ var msg=(getServerTime()+' '+(socket.name?socket.name:IP)+' has left from game...');
+ console.log(msg);
+ //Print replay
+ if (socket.replaySnapshot) {
+ console.log('################ '+IP+' replay: ################');
+ console.log(socket.replaySnapshot);
+ console.log('################################################################');
+ }
+ //Kick off losing connection user
+ if (socket.room){
+ var webSockets=socket.room.webSockets;
+ webSockets.splice(webSockets.indexOf(socket),1);
+ //Make game to continue without player control
+ socket.room.clientTicks[socket.team]=Number.MAX_VALUE;
+ webSockets.forEach(function(webSocket){
+ webSocket.send(JSON.stringify({type:'notice',msg:msg}));
+ });
+ }
+ });
+});
diff --git a/Utils/sourceLoader.js b/Utils/sourceLoader.js
index e3ee30f..3c923b1 100644
--- a/Utils/sourceLoader.js
+++ b/Utils/sourceLoader.js
@@ -1,54 +1,55 @@
-var sourceLoader={
- sources:{},
- sourceNum:0,
- loadedNum:0,
- allLoaded:true,
- load:function(type,src,id){
+var sourceLoader = {
+ sources: {},
+ sourceNum: 0,
+ loadedNum: 0,
+ allLoaded: true,
+ load: function (type, src, id) {
sourceLoader.sourceNum++;
- sourceLoader.allLoaded=false;
+ sourceLoader.allLoaded = false;
var source;
- var loaded=function(){
+ var loaded = function () {
sourceLoader.loadedNum++;
- if(sourceLoader.loadedNum==sourceLoader.sourceNum){
- sourceLoader.allLoaded=true;
+ if (sourceLoader.loadedNum == sourceLoader.sourceNum) {
+ sourceLoader.allLoaded = true;
}
- };//Code copy
- if (type=='img'){
- source=new Image();
- source.src=src;
- source.onload=loaded;
- sourceLoader.sources[id]=source;
+ }; //Code copy
+ if (type == 'img') {
+ source = new Image();
+ source.src = src;
+ source.onload = loaded;
+ sourceLoader.sources[id] = source;
}
- if (type=='audio'){
- source=new Audio();
- source.addEventListener('canplaythrough',loaded,false);
+ if (type == 'audio') {
+ source = new Audio();
+ source.addEventListener('canplaythrough', loaded, false);
//source.oncanplaythrough=loaded;
- source.src=src;//Pose after listener to prevent fired early
- sourceLoader.sources[id]=source;
+ source.src = src; //Pose after listener to prevent fired early
+ sourceLoader.sources[id] = source;
}
//For my Dojo: src==pathName
- if (type=='js'){
- var node=document.createElement('script');
- node.onload=function(){
+ if (type == 'js') {
+ var node = document.createElement('script');
+ node.onload = function () {
//Load builder
- _$.modules[src]=_$.define.loadedBuilders.shift();
+ _$.modules[src] = _$.define.loadedBuilders.shift();
loaded();
};
- node.src=src+'.js';
+ node.src = src + '.js';
document.getElementsByTagName('head')[0].appendChild(node);
}
},
- allOnLoad:function(callback){
+ allOnLoad: function (callback) {
if (sourceLoader.allLoaded) {
callback();
}
else {
//Show Load Process
- $('div.LoadedBlock').css('width',(Math.round(100*sourceLoader.loadedNum/sourceLoader.sourceNum)+"%"));
+ $('div.LoadedBlock').css('width', (Math.round(100 * sourceLoader.loadedNum / sourceLoader.sourceNum) + "%"));
//Recursion
- setTimeout(function(){
+ setTimeout(function () {
sourceLoader.allOnLoad(callback);
- },100);
+ }, 100);
}
}
};
+//# sourceMappingURL=sourceLoader.js.map
\ No newline at end of file
diff --git a/Utils/sourceLoader.ts b/Utils/sourceLoader.ts
new file mode 100644
index 0000000..e3ee30f
--- /dev/null
+++ b/Utils/sourceLoader.ts
@@ -0,0 +1,54 @@
+var sourceLoader={
+ sources:{},
+ sourceNum:0,
+ loadedNum:0,
+ allLoaded:true,
+ load:function(type,src,id){
+ sourceLoader.sourceNum++;
+ sourceLoader.allLoaded=false;
+ var source;
+ var loaded=function(){
+ sourceLoader.loadedNum++;
+ if(sourceLoader.loadedNum==sourceLoader.sourceNum){
+ sourceLoader.allLoaded=true;
+ }
+ };//Code copy
+ if (type=='img'){
+ source=new Image();
+ source.src=src;
+ source.onload=loaded;
+ sourceLoader.sources[id]=source;
+ }
+ if (type=='audio'){
+ source=new Audio();
+ source.addEventListener('canplaythrough',loaded,false);
+ //source.oncanplaythrough=loaded;
+ source.src=src;//Pose after listener to prevent fired early
+ sourceLoader.sources[id]=source;
+ }
+ //For my Dojo: src==pathName
+ if (type=='js'){
+ var node=document.createElement('script');
+ node.onload=function(){
+ //Load builder
+ _$.modules[src]=_$.define.loadedBuilders.shift();
+ loaded();
+ };
+ node.src=src+'.js';
+ document.getElementsByTagName('head')[0].appendChild(node);
+ }
+ },
+ allOnLoad:function(callback){
+ if (sourceLoader.allLoaded) {
+ callback();
+ }
+ else {
+ //Show Load Process
+ $('div.LoadedBlock').css('width',(Math.round(100*sourceLoader.loadedNum/sourceLoader.sourceNum)+"%"));
+ //Recursion
+ setTimeout(function(){
+ sourceLoader.allOnLoad(callback);
+ },100);
+ }
+ }
+};
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..e6a6eac
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "module": "commonjs",
+ "moduleResolution": "node",
+ "sourceMap": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "removeComments": false,
+ "noImplicitAny": false
+ }
+}
diff --git a/typings.json b/typings.json
new file mode 100644
index 0000000..74fa2f8
--- /dev/null
+++ b/typings.json
@@ -0,0 +1,5 @@
+{
+ "globalDependencies": {
+
+ }
+}
From ba806061999bcab576293135b33b681dcad95259 Mon Sep 17 00:00:00 2001
From: Mario Meltzow
Date: Sun, 5 Mar 2017 09:07:23 +0100
Subject: [PATCH 02/15] add yeoman foundation build + more typescripting
---
Characters/Animation.js | 1064 ------
Characters/Building.js | 3130 -----------------
Characters/Bullets.js | 813 -----
Characters/Burst.js | 1545 --------
Characters/Button.js | 770 ----
Characters/Gobj.js | 284 --
Characters/Gobj.ts | 264 --
Characters/Hero.js | 459 ---
Characters/Magic.js | 1747 ---------
Characters/Map.js | 229 --
Characters/Neutral.js | 327 --
Characters/Protoss.js | 1217 -------
Characters/Terran.js | 1096 ------
Characters/Units.js | 1051 ------
Characters/Upgrade.js | 1153 ------
Characters/Zerg.js | 1646 ---------
Controller/keyController.js | 122 -
Controller/mouseController.js | 303 --
GameRule/Cheat.js | 153 -
GameRule/Game.js | 1271 -------
GameRule/Levels.js | 953 -----
GameRule/Multiplayer.js | 418 ---
GameRule/Referee.js | 426 ---
GameRule/Resource.js | 129 -
GameRule/SC_server.js | 171 -
SVN.log | 2050 -----------
conf/browsersync-dist.conf.js | 12 +
conf/browsersync.conf.js | 13 +
conf/gulp.conf.js | 52 +
conf/karma-auto.conf.js | 46 +
conf/karma.conf.js | 46 +
conf/webpack-dist.conf.js | 93 +
conf/webpack-test.conf.js | 60 +
conf/webpack.conf.js | 87 +
gulp_tasks/browsersync.js | 21 +
gulp_tasks/karma.js | 27 +
gulp_tasks/misc.js | 25 +
gulp_tasks/webpack.js | 49 +
gulpfile.js | 29 +
package.json | 76 +
{Characters => src/Characters}/Animation.ts | 0
{Characters => src/Characters}/Building.ts | 2 +-
{Characters => src/Characters}/Bullets.ts | 0
{Characters => src/Characters}/Burst.ts | 0
{Characters => src/Characters}/Button.ts | 0
src/Characters/Gobj.ts | 270 ++
{Characters => src/Characters}/Hero.ts | 0
{Characters => src/Characters}/Magic.ts | 0
{Characters => src/Characters}/Map.ts | 76 +-
{Characters => src/Characters}/Neutral.ts | 0
{Characters => src/Characters}/Protoss.ts | 0
{Characters => src/Characters}/Terran.ts | 0
{Characters => src/Characters}/Units.ts | 0
{Characters => src/Characters}/Upgrade.ts | 0
{Characters => src/Characters}/Zerg.ts | 0
.../Controller}/keyController.ts | 0
.../Controller}/mouseController.ts | 0
{GameRule => src/GameRule}/Cheat.ts | 0
{GameRule => src/GameRule}/Game.ts | 195 +-
{GameRule => src/GameRule}/Levels.ts | 0
{GameRule => src/GameRule}/Multiplayer.ts | 0
{GameRule => src/GameRule}/Referee.ts | 44 +-
{GameRule => src/GameRule}/Resource.ts | 0
{GameRule => src/GameRule}/SC_server.ts | 0
{Utils => src/Utils}/gFrame.js | 0
{Utils => src/Utils}/jquery.min.js | 0
{Utils => src/Utils}/sourceLoader.js | 0
{Utils => src/Utils}/sourceLoader.ts | 0
src/app/hello.html | 1 +
src/app/hello.js | 27 +
src/app/hello.spec.js | 21 +
src/app/hello.spec.ts | 20 +
src/app/hello.ts | 13 +
src/app/index.js | 32 +
src/app/index.ts | 18 +
src/app/routes.js | 31 +
src/app/routes.ts | 18 +
{css => src/css}/buttonStyle.css | 0
{css => src/css}/mapStyle.css | 0
{css => src/css}/portraitStyle.css | 0
{css => src/css}/style.css | 0
{img => src/img}/Bg/Deleted | 0
{img => src/img}/Charas/Deleted | 0
{img => src/img}/Demo/Demo.jpg | Bin
{img => src/img}/Demo/Demo.png | Bin
{img => src/img}/Maps/Deleted | 0
{img => src/img}/Menu/Deleted | 0
index.html => src/index.html | 2 +-
src/index.js | 19 +
src/index.scss | 3 +
src/index.spec.js | 20 +
src/index.ts | 21 +
src/index1.html | 15 +
tsconfig.json | 19 +-
tslint.json | 79 +
95 files changed, 1425 insertions(+), 22948 deletions(-)
delete mode 100644 Characters/Animation.js
delete mode 100644 Characters/Building.js
delete mode 100644 Characters/Bullets.js
delete mode 100644 Characters/Burst.js
delete mode 100644 Characters/Button.js
delete mode 100644 Characters/Gobj.js
delete mode 100644 Characters/Gobj.ts
delete mode 100644 Characters/Hero.js
delete mode 100644 Characters/Magic.js
delete mode 100644 Characters/Map.js
delete mode 100644 Characters/Neutral.js
delete mode 100644 Characters/Protoss.js
delete mode 100644 Characters/Terran.js
delete mode 100644 Characters/Units.js
delete mode 100644 Characters/Upgrade.js
delete mode 100644 Characters/Zerg.js
delete mode 100644 Controller/keyController.js
delete mode 100644 Controller/mouseController.js
delete mode 100644 GameRule/Cheat.js
delete mode 100644 GameRule/Game.js
delete mode 100644 GameRule/Levels.js
delete mode 100644 GameRule/Multiplayer.js
delete mode 100644 GameRule/Referee.js
delete mode 100644 GameRule/Resource.js
delete mode 100644 GameRule/SC_server.js
delete mode 100644 SVN.log
create mode 100644 conf/browsersync-dist.conf.js
create mode 100644 conf/browsersync.conf.js
create mode 100644 conf/gulp.conf.js
create mode 100644 conf/karma-auto.conf.js
create mode 100644 conf/karma.conf.js
create mode 100644 conf/webpack-dist.conf.js
create mode 100644 conf/webpack-test.conf.js
create mode 100644 conf/webpack.conf.js
create mode 100644 gulp_tasks/browsersync.js
create mode 100644 gulp_tasks/karma.js
create mode 100644 gulp_tasks/misc.js
create mode 100644 gulp_tasks/webpack.js
create mode 100644 gulpfile.js
create mode 100644 package.json
rename {Characters => src/Characters}/Animation.ts (100%)
rename {Characters => src/Characters}/Building.ts (99%)
rename {Characters => src/Characters}/Bullets.ts (100%)
rename {Characters => src/Characters}/Burst.ts (100%)
rename {Characters => src/Characters}/Button.ts (100%)
create mode 100644 src/Characters/Gobj.ts
rename {Characters => src/Characters}/Hero.ts (100%)
rename {Characters => src/Characters}/Magic.ts (100%)
rename {Characters => src/Characters}/Map.ts (89%)
rename {Characters => src/Characters}/Neutral.ts (100%)
rename {Characters => src/Characters}/Protoss.ts (100%)
rename {Characters => src/Characters}/Terran.ts (100%)
rename {Characters => src/Characters}/Units.ts (100%)
rename {Characters => src/Characters}/Upgrade.ts (100%)
rename {Characters => src/Characters}/Zerg.ts (100%)
rename {Controller => src/Controller}/keyController.ts (100%)
rename {Controller => src/Controller}/mouseController.ts (100%)
rename {GameRule => src/GameRule}/Cheat.ts (100%)
rename {GameRule => src/GameRule}/Game.ts (94%)
rename {GameRule => src/GameRule}/Levels.ts (100%)
rename {GameRule => src/GameRule}/Multiplayer.ts (100%)
rename {GameRule => src/GameRule}/Referee.ts (96%)
rename {GameRule => src/GameRule}/Resource.ts (100%)
rename {GameRule => src/GameRule}/SC_server.ts (100%)
rename {Utils => src/Utils}/gFrame.js (100%)
rename {Utils => src/Utils}/jquery.min.js (100%)
rename {Utils => src/Utils}/sourceLoader.js (100%)
rename {Utils => src/Utils}/sourceLoader.ts (100%)
create mode 100644 src/app/hello.html
create mode 100644 src/app/hello.js
create mode 100644 src/app/hello.spec.js
create mode 100644 src/app/hello.spec.ts
create mode 100644 src/app/hello.ts
create mode 100644 src/app/index.js
create mode 100644 src/app/index.ts
create mode 100644 src/app/routes.js
create mode 100644 src/app/routes.ts
rename {css => src/css}/buttonStyle.css (100%)
rename {css => src/css}/mapStyle.css (100%)
rename {css => src/css}/portraitStyle.css (100%)
rename {css => src/css}/style.css (100%)
rename {img => src/img}/Bg/Deleted (100%)
rename {img => src/img}/Charas/Deleted (100%)
rename {img => src/img}/Demo/Demo.jpg (100%)
rename {img => src/img}/Demo/Demo.png (100%)
rename {img => src/img}/Maps/Deleted (100%)
rename {img => src/img}/Menu/Deleted (100%)
rename index.html => src/index.html (99%)
create mode 100644 src/index.js
create mode 100644 src/index.scss
create mode 100644 src/index.spec.js
create mode 100644 src/index.ts
create mode 100644 src/index1.html
create mode 100644 tslint.json
diff --git a/Characters/Animation.js b/Characters/Animation.js
deleted file mode 100644
index b5f3179..0000000
--- a/Characters/Animation.js
+++ /dev/null
@@ -1,1064 +0,0 @@
-//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,
- 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,
- 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,
- 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,
- 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,
- 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,
- 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,
- 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,
- 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
- }
- }
-});
-//# sourceMappingURL=Animation.js.map
\ No newline at end of file
diff --git a/Characters/Building.js b/Characters/Building.js
deleted file mode 100644
index 0f8ec0b..0000000
--- a/Characters/Building.js
+++ /dev/null
@@ -1,3130 +0,0 @@
-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 = [];
- // Finish below after fully constructed, postpone
- var myself = this;
- Game.commandTimeout(function () {
- //Add this unit into Game
- Building.allBuildings.push(myself);
- //Show unit
- myself.dock();
- }, 0);
- },
- prototypePlus: {
- name: "Building",
- armor: 0,
- sight: 385,
- //Override to support multiple hidden frames
- 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;
- //Multiple hidden frames support
- if (this.imgPos[this.status].left[this.action] == -1)
- this.action = 0;
- },
- //Dock means stop moving but keep animation
- dock: function () {
- //Clear old timer
- this.stop();
- //Launch new dock timer
- this.status = "dock";
- var myself = this;
- var animateFrame = function () {
- //Only play animation, will not move
- myself.animeFrame();
- };
- this.allFrames['animate'] = animateFrame;
- },
- //Cannot move
- moving: function () {
- //Nothing
- },
- //Override for sound effect
- die: function () {
- //Old behavior
- Gobj.prototype.die.call(this);
- this.life = 0;
- //Clear all injury animations
- this.injuryAnimations.forEach(function (anime) {
- anime.die();
- });
- //If has sound effect
- if (this.sound.death && this.insideScreen()) {
- this.sound.death.play();
- }
- },
- 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 multiple target, only die once and give reward
- if (this.status != "dead") {
- //Killed by enemy
- this.die();
- //Give enemy reward
- enemy.kill++;
- }
- }
- },
- //Fix bug, for consistent, cause 100% damage on building
- 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;
- //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) {
- //Inherit damage
- 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;
- }
- },
- //Life status
- 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) {
- return !(chara.isEnemy());
- });
-};
-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')
- };
- //Need draw mud for it
- Map.needRefresh = "MAP";
- },
- prototypePlus: {
- //Add basic unit info
- name: "ZergBuilding",
- dieEffect: Burst.ZergBuildingBurst,
- injuryNames: ['bloodA', 'bloodB', 'bloodC'],
- recover: function () {
- if (this.life < this.get('HP'))
- this.life += 0.5;
- if (this.magic != null && this.magic < this.get('MP'))
- this.magic += 0.5;
- }
- }
-});
-//Terran buildings
-Building.TerranBuilding = Building.extends({
- constructorPlus: function (props) {
- this.sound = {
- normal: new Audio(Game.CDN + 'bgm/TerranBuilding.selected.wav'),
- onfire: new Audio(Game.CDN + 'bgm/Building.onfire.wav'),
- death: new Audio(Game.CDN + 'bgm/TerranBuilding.death.wav')
- };
- this.sound.selected = this.sound.normal;
- },
- prototypePlus: {
- //Add basic unit info
- name: "TerranBuilding",
- dieEffect: Burst.TerranBuildingBurst,
- injuryNames: ['redFireL', 'redFireM', 'redFireR'],
- recover: function () {
- if (this.life < (this.get('HP') / 4) && (this instanceof Building))
- this.life--;
- if (this.magic != null && this.magic < this.get('MP'))
- this.magic += 0.5;
- }
- }
-});
-//Protoss buildings
-Building.ProtossBuilding = Building.extends({
- constructorPlus: function (props) {
- this.sound = {
- normal: new Audio(Game.CDN + 'bgm/ProtossBuilding.selected.wav'),
- onfire: new Audio(Game.CDN + 'bgm/Building.onfire.wav'),
- death: new Audio(Game.CDN + 'bgm/ProtossBuilding.death.wav')
- };
- this.sound.selected = this.sound.normal;
- },
- prototypePlus: {
- //Add basic unit info
- name: "ProtossBuilding",
- plasma: 0,
- dieEffect: Burst.ProtossBuildingBurst,
- injuryNames: ['blueFireL', 'blueFireM', 'blueFireR'],
- recover: function () {
- if (this.shield < this.get('SP'))
- this.shield += 0.5;
- if (this.magic != null && this.magic < this.get('MP'))
- this.magic += 0.5;
- }
- }
-});
-//Attackable interface
-Building.Attackable = {
- constructorPlus: function (props) {
- this.bullet = {};
- this.kill = 0;
- this.target = {};
- //Idle by default
- this.targetLock = false;
- //Can fire by default
- this.coolDown = true;
- },
- prototypePlus: {
- //Add basic unit info
- name: "AttackableBuilding",
- isInAttackRange: AttackableUnit.prototype.isInAttackRange,
- matchAttackLimit: AttackableUnit.prototype.matchAttackLimit,
- attack: function (enemy) {
- //Cannot attack invisible unit or unit who mismatch your attack type
- if (enemy['isInvisible' + this.team] || !(this.matchAttackLimit(enemy))) {
- Referee.voice('pError').play();
- this.stopAttack();
- return;
- }
- if (enemy instanceof Gobj && enemy.status != "dead") {
- //Stop old attack and moving
- this.stopAttack();
- this.dock();
- //New attack
- this.target = enemy;
- var myself = this;
- var attackFrame = function () {
- //If enemy already dead or becomes invisible or we just miss enemy
- if (enemy.status == "dead" || enemy['isInvisible' + myself.team] || (myself.isMissingTarget && myself.isMissingTarget())) {
- myself.stopAttack();
- myself.dock();
- }
- else {
- //Cannot come in until reload cool down, only dock down can finish attack animation
- if (myself.isReloaded && myself.isReloaded()) {
- //Load bullet
- myself.coolDown = false;
- //Cool down after attack interval
- Game.commandTimeout(function () {
- myself.coolDown = true;
- }, myself.get('attackInterval'));
- //If AOE, init enemies
- var enemies;
- if (myself.AOE) {
- //Get possible targets
- switch (myself.attackLimit) {
- case "flying":
- enemies = Unit.allUnits.filter(function (chara) {
- return chara.team != myself.team && chara.isFlying;
- });
- break;
- case "ground":
- var enemyUnits = Unit.allUnits.filter(function (chara) {
- return chara.team != myself.team && !(chara.isFlying);
- });
- var enemyBuildings = Building.allBuildings.filter(function (chara) {
- return chara.team != myself.team;
- });
- enemies = enemyUnits.concat(enemyBuildings);
- break;
- default:
- enemies = (Unit.allUnits.concat(Building.allBuildings)).filter(function (chara) {
- return chara.team != myself.team;
- });
- break;
- }
- //Range filter
- switch (myself.AOE.type) {
- case "LINE":
- //Calculate inter-points between enemy
- 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;
- }
- }
- return false;
- });
- break;
- case "MULTIPLE":
- 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];
- });
- }
- }
- //Show attack animation if has
- if (myself.imgPos.attack) {
- myself.action = 0;
- //Change status to show attack frame
- myself.status = "attack";
- //Will return to dock after attack
- Game.commandTimeout(function () {
- //If still show attack
- if (myself.status == "attack") {
- myself.status = "dock";
- myself.action = 0;
- }
- }, myself.frame.attack * 100); //attackAnimation < attackInterval
- }
- //If has bullet
- if (myself.Bullet) {
- var fireBullet = function () {
- //Will shoot multiple bullets in one time
- if (myself.continuousAttack) {
- myself.bullet = [];
- for (var N = 0; N < myself.continuousAttack.count; N++) {
- var bullet = new myself.Bullet({
- from: myself,
- to: enemy
- });
- //Reassign bullets location
- 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 < Math.min(myself.AOE.count, enemies.length); N++) {
- new myself.Bullet({
- from: myself,
- to: enemies[N]
- }).fire();
- }
- }
- else {
- //Reload one new bullet
- myself.bullet = new myself.Bullet({
- from: myself,
- to: enemy
- });
- myself.bullet.fire();
- }
- }
- };
- if (myself.fireDelay)
- Game.commandTimeout(function () {
- fireBullet();
- }, myself.fireDelay);
- else
- fireBullet();
- }
- else {
- //Cause damage when burst appear, after finish whole melee attack action
- if (myself.AOE) {
- enemies.forEach(function (chara) {
- chara.getDamageBy(myself);
- chara.reactionWhenAttackedBy(myself);
- });
- }
- else {
- //Cause damage after finish whole melee attack action
- Game.commandTimeout(function () {
- enemy.getDamageBy(myself);
- enemy.reactionWhenAttackedBy(myself);
- }, myself.frame.attack * 100);
- }
- }
- //If has attack effect (burst)
- if (myself.attackEffect) {
- if (myself.AOE && myself.AOE.hasEffect) {
- enemies.forEach(function (chara) {
- new myself.attackEffect({ x: chara.posX(), y: chara.posY() });
- });
- }
- else {
- new myself.attackEffect({ x: enemy.posX(), y: enemy.posY() });
- }
- }
- //Sound effect, missile attack unit will play sound when bullet fire
- if (!myself.Bullet && myself.insideScreen())
- myself.sound.attack.play();
- }
- }
- };
- this.allFrames['attack'] = attackFrame;
- }
- },
- stopAttack: AttackableUnit.prototype.stopAttack,
- findNearbyTargets: function () {
- //Initial
- var myself = this;
- var units = Unit.allUnits.filter(function (chara) {
- return chara.team != myself.team;
- });
- var buildings = Building.allBuildings.filter(function (chara) {
- return chara.team != myself.team;
- });
- var results = [];
- var myX = myself.posX();
- var myY = myself.posY();
- [units, buildings].forEach(function (charas) {
- charas = charas.filter(function (chara) {
- return !chara['isInvisible' + myself.team] && myself.isInAttackRange(chara) && myself.matchAttackLimit(chara);
- }).sort(function (chara1, chara2) {
- var X1 = chara1.posX(), Y1 = chara1.posY(), X2 = chara2.posX(), Y2 = chara1.posY();
- return (X1 - myX) * (X1 - myX) + (Y1 - myY) * (Y1 - myY) - (X2 - myX) * (X2 - myX) - (Y2 - myY) * (Y2 - myY);
- });
- results = results.concat(charas);
- });
- //Only attack nearest one, unit prior to building
- return results;
- },
- highestPriorityTarget: AttackableUnit.prototype.highestPriorityTarget,
- AI: function () {
- //Dead unit doesn't have following AI
- if (this.status == 'dead')
- return;
- //AI:Attack insight enemy automatically when alive
- if (this.isAttacking()) {
- // target ran out of attack range
- if (this.cannotReachTarget()) {
- //Forgive target and find other target
- this.stopAttack();
- this.targetLock = false;
- }
- }
- else {
- //Find another in-range enemy
- var enemy = this.highestPriorityTarget();
- //Change target if has one
- if (enemy)
- this.attack(enemy);
- }
- },
- isAttacking: AttackableUnit.prototype.isAttacking,
- cannotReachTarget: function () {
- return !(this.isInAttackRange(this.target));
- },
- isMissingTarget: AttackableUnit.prototype.isMissingTarget,
- isReloaded: AttackableUnit.prototype.isReloaded,
- //Override for attackable unit
- die: function () {
- //Old behavior
- Building.prototype.die.call(this);
- //Clear new timer for unit
- this.stopAttack();
- this.selected = false;
- }
- }
-};
-//Define all buildings
-Building.ZergBuilding.Hatchery = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- this.larvas = [];
- },
- prototypePlus: {
- //Add basic unit info
- name: "Hatchery",
- imgPos: {
- dock: {
- left: 20,
- top: 44
- }
- },
- width: 128,
- height: 94,
- frame: {
- dock: 1
- },
- HP: 1250,
- manPlus: 10,
- produceLarva: true,
- cost: {
- mine: 300,
- time: 1200
- },
- items: {
- '1': { name: 'SelectLarva' },
- '2': { name: 'SetRallyPoint' },
- '3': { name: 'EvolveBurrow' },
- '7': { name: 'Lair', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'SpawningPool';
- });
- } }
- },
- injuryOffsets: [{ x: -18, y: 12 }, { x: -12, y: -22 }, { x: 18, y: 12 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ],
- buildZergBuilding: function () {
- var target = Building.ZergBuilding[this.buildName];
- var mutation = this.evolveTo({
- type: eval('Building.' + target.prototype.evolves[0].step),
- chain: true
- });
- mutation.buildName = this.buildName;
- //Calculate duration
- var duration = Resource.getCost(this.buildName).time;
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 40;
- //Processing flag on transfer
- mutation.processing = {
- name: mutation.buildName,
- startTime: Game.mainTick,
- time: duration
- };
- //Evolve chain
- for (var N = 1; N < target.prototype.evolves.length; N++) {
- (function (n) {
- var evolveInfo = target.prototype.evolves[n];
- Game.commandTimeout(function () {
- if (mutation.status != 'dead') {
- //Evolve
- var evolveTarget = (eval('Building.' + evolveInfo.step));
- //Step is constructor function
- if (evolveTarget) {
- var old = mutation;
- mutation = mutation.evolveTo({
- type: evolveTarget,
- chain: true
- });
- mutation.processing = old.processing;
- mutation.buildName = old.buildName;
- }
- else {
- mutation.status = evolveInfo.step;
- }
- }
- }, duration * 100 * evolveInfo.percent);
- })(N);
- }
- //Final evolve
- Game.commandTimeout(function () {
- if (mutation.status != 'dead') {
- //Evolve
- mutation.evolveTo({
- type: Building.ZergBuilding[mutation.buildName],
- burstArr: mutation.evolveEffect
- });
- }
- }, duration * 100);
- }
- }
-});
-Building.ZergBuilding.Lair = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- this.larvas = [];
- },
- prototypePlus: {
- //Add basic unit info
- name: "Lair",
- imgPos: {
- dock: {
- left: 22,
- top: 172
- }
- },
- width: 136,
- height: 114,
- frame: {
- dock: 1
- },
- HP: 1800,
- manPlus: 10,
- produceLarva: true,
- cost: {
- mine: 150,
- gas: 100,
- time: 1000
- },
- items: {
- '1': { name: 'SelectLarva' },
- '2': { name: 'SetRallyPoint' },
- '3': { name: 'EvolveBurrow' },
- '4': { name: 'EvolveVentralSacs' },
- '5': { name: 'EvolveAntennas' },
- '6': { name: 'EvolvePneumatizedCarapace' },
- '7': { name: 'Hive', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'QueenNest';
- });
- } }
- },
- injuryOffsets: [{ x: -22, y: 14 }, { x: -12, y: -22 }, { x: 22, y: 14 }],
- evolves: [
- { step: 'ZergBuilding.MutationM', percent: 0 }
- ],
- buildZergBuilding: function () {
- Building.ZergBuilding.Hatchery.prototype.buildZergBuilding.call(this);
- }
- }
-});
-Building.ZergBuilding.Hive = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- this.larvas = [];
- },
- prototypePlus: {
- //Add basic unit info
- name: "Hive",
- imgPos: {
- dock: {
- left: 26,
- top: 300
- }
- },
- width: 130,
- height: 132,
- frame: {
- dock: 1
- },
- HP: 2500,
- manPlus: 10,
- produceLarva: true,
- cost: {
- mine: 200,
- gas: 150,
- time: 1200
- },
- items: {
- '1': { name: 'SelectLarva' },
- '2': { name: 'SetRallyPoint' },
- '3': { name: 'EvolveBurrow' },
- '4': { name: 'EvolveVentralSacs' },
- '5': { name: 'EvolveAntennas' },
- '6': { name: 'EvolvePneumatizedCarapace' }
- },
- injuryOffsets: [{ x: -26, y: 16 }, { x: 2, y: -32 }, { x: 26, y: 16 }],
- evolves: [
- { step: 'ZergBuilding.MutationM', percent: 0 },
- { step: 'ZergBuilding.MutationL', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.CreepColony = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "CreepColony",
- imgPos: {
- dock: {
- left: 924,
- top: 544
- }
- },
- width: 72,
- height: 66,
- frame: {
- dock: 1
- },
- HP: 400,
- cost: {
- mine: 75,
- time: 200
- },
- items: {
- '7': { name: 'SporeColony', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'EvolutionChamber';
- });
- } },
- '8': { name: 'SunkenColony', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'SpawningPool';
- });
- } }
- },
- injuryOffsets: [{ x: -14, y: 8 }, { x: -4, y: -16 }, { x: 20, y: 8 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 }
- ],
- buildZergBuilding: function () {
- Building.ZergBuilding.Hatchery.prototype.buildZergBuilding.call(this);
- }
- }
-});
-Building.ZergBuilding.SunkenColony = Building.ZergBuilding.extends(Building.Attackable).extends({
- constructorPlus: function (props) {
- this.sound.attack = new Audio(Game.CDN + 'bgm/Colony.attack.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "SunkenColony",
- imgPos: {
- dock: {
- left: 916,
- top: 714
- },
- attack: {
- left: [20, 116, 212, 308, 404, 500, 596, 692, 788, 884],
- top: [802, 802, 802, 802, 802, 802, 802, 802, 802, 802]
- }
- },
- width: 84,
- height: 66,
- frame: {
- dock: 1,
- attack: 10
- },
- HP: 300,
- cost: {
- mine: 50,
- time: 200
- },
- //Attackable
- damage: 40,
- attackRange: 245,
- attackInterval: 2200,
- attackLimit: "ground",
- attackEffect: Burst.Sunken,
- attackType: AttackableUnit.BURST_ATTACK,
- injuryOffsets: [{ x: -14, y: 8 }, { x: -4, y: -12 }, { x: 20, y: 8 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 }
- ]
- }
-});
-Building.ZergBuilding.SporeColony = Building.ZergBuilding.extends(Building.Attackable).extends({
- constructorPlus: function (props) {
- this.imgPos.attack = this.imgPos.dock;
- this.frame.attack = this.frame.dock;
- this.sound.attack = new Audio(Game.CDN + 'bgm/Colony.attack.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "SporeColony",
- imgPos: {
- dock: {
- left: 924,
- top: 618
- }
- },
- width: 70,
- height: 80,
- frame: {
- dock: 1
- },
- HP: 400,
- detector: Gobj.detectorBuffer,
- cost: {
- mine: 50,
- time: 200
- },
- //Attackable
- damage: 15,
- attackRange: 245,
- attackInterval: 1500,
- attackLimit: "flying",
- attackType: AttackableUnit.NORMAL_ATTACK,
- injuryOffsets: [{ x: -14, y: 8 }, { x: -12, y: -16 }, { x: 14, y: 8 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 }
- ]
- }
-});
-Building.ZergBuilding.Extractor = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Extractor",
- imgPos: {
- dock: {
- left: 768,
- top: 26
- }
- },
- width: 128,
- height: 116,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 50,
- time: 400
- },
- injuryOffsets: [{ x: -24, y: 14 }, { x: -18, y: -16 }, { x: 24, y: 14 }],
- evolves: [
- { step: 'ZergBuilding.MutationL', percent: 0 }
- ]
- }
-});
-Building.ZergBuilding.SpawningPool = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "SpawningPool",
- imgPos: {
- dock: {
- left: 784,
- top: 210
- }
- },
- width: 100,
- height: 78,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 150,
- time: 800
- },
- items: {
- '1': { name: 'EvolveMetabolicBoost' },
- '2': { name: 'EvolveAdrenalGlands' }
- },
- injuryOffsets: [{ x: -15, y: 10 }, { x: 0, y: -18 }, { x: 15, y: 10 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.EvolutionChamber = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "EvolutionChamber",
- imgPos: {
- dock: {
- left: 1468,
- top: 684
- }
- },
- width: 100,
- height: 94,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 75,
- time: 400
- },
- items: {
- '1': { name: 'UpgradeMeleeAttacks' },
- '2': { name: 'UpgradeMissileAttacks' },
- '3': { name: 'EvolveCarapace' }
- },
- injuryOffsets: [{ x: -18, y: 12 }, { x: 0, y: -22 }, { x: 18, y: 12 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.HydraliskDen = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "HydraliskDen",
- imgPos: {
- dock: {
- left: 1472,
- top: 8
- }
- },
- width: 96,
- height: 104,
- frame: {
- dock: 1
- },
- HP: 850,
- cost: {
- mine: 100,
- gas: 50,
- time: 400
- },
- items: {
- '1': { name: 'EvolveMuscularAugments' },
- '2': { name: 'EvolveGroovedSpines' },
- '4': { name: 'EvolveLurkerAspect' }
- },
- injuryOffsets: [{ x: -20, y: 12 }, { x: 0, y: -24 }, { x: 20, y: 12 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.Spire = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Spire",
- imgPos: {
- dock: {
- left: 1486,
- top: 444
- }
- },
- width: 68,
- height: 102,
- frame: {
- dock: 1
- },
- HP: 600,
- cost: {
- mine: 200,
- gas: 150,
- time: 1200
- },
- items: {
- '1': { name: 'UpgradeFlyerAttacks' },
- '2': { name: 'UpgradeFlyerCarapace' },
- '7': { name: 'GreaterSpire', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Hive';
- });
- } }
- },
- injuryOffsets: [{ x: -20, y: 18 }, { x: -12, y: -16 }, { x: 20, y: 18 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ],
- buildZergBuilding: function () {
- Building.ZergBuilding.Hatchery.prototype.buildZergBuilding.call(this);
- }
- }
-});
-Building.ZergBuilding.GreaterSpire = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "GreaterSpire",
- imgPos: {
- dock: {
- left: 1484,
- top: 558
- }
- },
- width: 78,
- height: 102,
- frame: {
- dock: 1
- },
- HP: 1000,
- cost: {
- mine: 100,
- gas: 150,
- time: 1200
- },
- items: {
- '1': { name: 'UpgradeFlyerAttacks' },
- '2': { name: 'UpgradeFlyerCarapace' }
- },
- injuryOffsets: [{ x: -20, y: 22 }, { x: -12, y: -16 }, { x: 20, y: 22 }],
- evolves: [
- { step: 'ZergBuilding.MutationM', percent: 0 }
- ]
- }
-});
-Building.ZergBuilding.QueenNest = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "QueenNest",
- imgPos: {
- dock: {
- left: 1462,
- top: 236
- }
- },
- width: 84,
- height: 90,
- frame: {
- dock: 1
- },
- HP: 850,
- cost: {
- mine: 150,
- gas: 100,
- time: 600
- },
- items: {
- '1': { name: 'EvolveSpawnBroodling' },
- '2': { name: 'EvolveEnsnare' },
- '3': { name: 'EvolveGameteMeiosis' }
- },
- injuryOffsets: [{ x: -16, y: 10 }, { x: -12, y: -20 }, { x: 16, y: 10 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.NydusCanal = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "NydusCanal",
- imgPos: {
- dock: {
- left: 908,
- top: 444
- }
- },
- width: 72,
- height: 76,
- frame: {
- dock: 1
- },
- HP: 250,
- cost: {
- mine: 150,
- time: 400
- },
- items: {
- '1': { name: 'NydusCanal' }
- },
- injuryOffsets: [{ x: -14, y: 14 }, { x: -18, y: -18 }, { x: 14, y: 14 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.UltraliskCavern = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "UltraliskCavern",
- imgPos: {
- dock: {
- left: 1468,
- top: 122
- }
- },
- width: 102,
- height: 98,
- frame: {
- dock: 1
- },
- HP: 600,
- cost: {
- mine: 150,
- gas: 200,
- time: 800
- },
- items: {
- '1': { name: 'EvolveAnabolicSynthesis' },
- '2': { name: 'EvolveChitinousPlating' }
- },
- injuryOffsets: [{ x: -20, y: 12 }, { x: -12, y: -24 }, { x: 20, y: 12 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.DefilerMound = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "DefilerMound",
- imgPos: {
- dock: {
- left: 1458,
- top: 344
- }
- },
- width: 118,
- height: 90,
- frame: {
- dock: 1
- },
- HP: 850,
- cost: {
- mine: 100,
- gas: 100,
- time: 600
- },
- items: {
- '1': { name: 'EvolvePlague' },
- '2': { name: 'EvolveConsume' },
- '3': { name: 'EvolveMetasynapticNode' }
- },
- injuryOffsets: [{ x: -18, y: 12 }, { x: -12, y: -22 }, { x: 18, y: 12 }],
- evolves: [
- { step: 'ZergBuilding.MutationS', percent: 0 },
- { step: 'ZergBuilding.MutationM', percent: 0.5 }
- ]
- }
-});
-Building.ZergBuilding.InfestedBase = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "InfestedBase",
- noMud: true,
- imgPos: {
- dock: {
- left: 1160,
- top: 328
- }
- },
- width: 134,
- height: 108,
- frame: {
- dock: 1
- },
- HP: 1500,
- items: {
- '1': { name: 'InfestedTerran' },
- '6': { name: 'SetRallyPoint' }
- },
- injuryOffsets: [{ x: -22, y: 14 }, { x: -6, y: -26 }, { x: 22, y: 14 }]
- }
-});
-Building.ZergBuilding.OvermindI = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "OvermindI",
- imgPos: {
- dock: {
- left: 6,
- top: 476
- }
- },
- width: 208,
- height: 122,
- frame: {
- dock: 1
- },
- HP: 3000,
- injuryOffsets: [{ x: -24, y: 15 }, { x: -6, y: -30 }, { x: 24, y: 15 }]
- }
-});
-Building.ZergBuilding.OvermindII = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "OvermindII",
- imgPos: {
- dock: {
- left: 6,
- top: 626
- }
- },
- width: 208,
- height: 136,
- frame: {
- dock: 1
- },
- HP: 3000,
- injuryOffsets: [{ x: -28, y: 18 }, { x: -6, y: -34 }, { x: 28, y: 18 }]
- }
-});
-Building.TerranBuilding.CommandCenter = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "CommandCenter",
- imgPos: {
- dock: {
- left: 0,
- top: 6
- }
- },
- width: 129,
- height: 106,
- frame: {
- dock: 1
- },
- HP: 1500,
- manPlus: 10,
- cost: {
- mine: 400,
- time: 1200
- },
- items: {
- '1': { name: 'SCV' },
- '6': { name: 'SetRallyPoint' },
- '7': { name: 'ComstatStation', condition: function () {
- return (!Game.selectedUnit.attachment || Game.selectedUnit.attachment.status == 'dead') && Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Academy';
- });
- } },
- '8': { name: 'NuclearSilo', condition: function () {
- return (!Game.selectedUnit.attachment || Game.selectedUnit.attachment.status == 'dead') && Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'ConvertOps';
- });
- } },
- '9': { name: 'LiftOff' }
- },
- injuryOffsets: [{ x: -35, y: -30 }, { x: -2, y: -15 }, { x: 35, y: -15 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionL', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ],
- buildTerranBuilding: function () {
- var target = Building.TerranBuilding[this.buildName];
- var construction = new (eval('Building.' + target.prototype.evolves[0].step))({ x: this.x + this.width, y: this.y + this.height - target.prototype.height, team: this.team });
- construction.buildName = this.buildName;
- this.attachment = construction;
- Button.reset();
- //Calculate duration
- var duration = Resource.getCost(this.buildName).time;
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 40;
- //Processing flag on transfer
- construction.processing = {
- name: construction.buildName,
- startTime: Game.mainTick,
- time: duration
- };
- var myself = this;
- //Evolve chain
- for (var N = 1; N < target.prototype.evolves.length; N++) {
- (function (n) {
- var evolveInfo = target.prototype.evolves[n];
- Game.commandTimeout(function () {
- if (construction.status != 'dead') {
- //Evolve
- var evolveTarget = (eval('Building.' + evolveInfo.step));
- //Step is constructor function
- if (evolveTarget) {
- var old = construction;
- construction = construction.evolveTo({
- type: evolveTarget,
- mixin: (evolveTarget.prototype.name == 'ConstructionSkeleton') ? { type: construction.buildName } : null,
- chain: true
- });
- construction.processing = old.processing;
- construction.buildName = old.buildName;
- myself.attachment = construction;
- }
- else {
- construction.status = evolveInfo.step;
- }
- }
- }, duration * 100 * evolveInfo.percent);
- })(N);
- }
- //Final evolve
- Game.commandTimeout(function () {
- if (construction.status != 'dead') {
- //Evolve
- myself.attachment = construction.evolveTo({
- type: Building.TerranBuilding[construction.buildName]
- });
- }
- }, duration * 100);
- }
- }
-});
-Building.TerranBuilding.SupplyDepot = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "SupplyDepot",
- imgPos: {
- dock: {
- left: [0, 95, 190, 285, 380],
- top: [292, 292, 292, 292, 292]
- }
- },
- width: 96,
- height: 76,
- frame: {
- dock: 5
- },
- HP: 500,
- manPlus: 8,
- cost: {
- mine: 100,
- time: 400
- },
- injuryOffsets: [{ x: -20, y: -25 }, { x: 0, y: -10 }, { x: 25, y: -10 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.Refinery = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Refinery",
- imgPos: {
- dock: {
- left: 256,
- top: 16
- }
- },
- width: 124,
- height: 96,
- frame: {
- dock: 1
- },
- HP: 500,
- cost: {
- mine: 100,
- time: 400
- },
- injuryOffsets: [{ x: -26, y: -36 }, { x: 0, y: 10 }, { x: 38, y: 5 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionR', percent: 0 },
- { step: 'step2', percent: 0.3 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.7 }
- ]
- }
-});
-Building.TerranBuilding.Barracks = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Barracks",
- imgPos: {
- dock: {
- left: 128,
- top: 0
- }
- },
- width: 126,
- height: 110,
- frame: {
- dock: 1
- },
- HP: 1000,
- cost: {
- mine: 150,
- time: 800
- },
- items: {
- '1': { name: 'Marine' },
- '2': { name: 'Firebat', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Academy';
- });
- } },
- '3': { name: 'Ghost', condition: function () {
- //Has ScienceFacility with attachment ConvertOps
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'ScienceFacility'
- && (chara.attachment && chara.attachment.status != 'dead' && chara.attachment.name == 'ConvertOps');
- });
- } },
- '4': { name: 'Medic', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Academy';
- });
- } },
- '6': { name: 'SetRallyPoint' },
- '9': { name: 'LiftOff' }
- },
- injuryOffsets: [{ x: -25, y: -40 }, { x: 35, y: 0 }, { x: 5, y: -5 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionL', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.EngineeringBay = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "EngineeringBay",
- imgPos: {
- dock: {
- left: 380,
- top: 14
- }
- },
- width: 144,
- height: 98,
- frame: {
- dock: 1
- },
- HP: 850,
- cost: {
- mine: 125,
- time: 600
- },
- items: {
- '1': { name: 'UpgradeInfantryWeapons' },
- '2': { name: 'UpgradeInfantryArmors' }
- },
- injuryOffsets: [{ x: -25, y: -40 }, { x: 25, y: -10 }, { x: 15, y: -50 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.MissileTurret = Building.TerranBuilding.extends(Building.Attackable).extends({
- constructorPlus: function (props) {
- this.imgPos.attack = this.imgPos.dock;
- this.frame.attack = this.frame.dock;
- this.sound.attack = new Audio(Game.CDN + 'bgm/Wraith.attackF.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "MissileTurret",
- imgPos: {
- dock: {
- left: [0, 44, 88, 132, 176, 220, 264, 308, 352, 396,
- 440, 484, 528, 572, 616, 660, 704, 748, 792],
- top: [368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
- 368, 368, 368, 368, 368, 368, 368, 368, 368]
- }
- },
- width: 44,
- height: 56,
- frame: {
- dock: 19
- },
- HP: 200,
- detector: Gobj.detectorBuffer,
- cost: {
- mine: 100,
- time: 300
- },
- //Attackable
- damage: 20,
- attackRange: 245,
- attackInterval: 1500,
- attackLimit: "flying",
- attackType: AttackableUnit.BURST_ATTACK,
- injuryOffsets: [{ x: -10, y: -15 }, { x: 10, y: -10 }, { x: 0, y: 12 }],
- injuryScale: 0.6,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.5 }
- ]
- }
-});
-Building.TerranBuilding.Academy = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Academy",
- imgPos: {
- dock: {
- left: 526,
- top: 16
- }
- },
- width: 92,
- height: 96,
- frame: {
- dock: 1
- },
- HP: 600,
- cost: {
- mine: 150,
- time: 800
- },
- items: {
- '1': { name: 'ResearchU238Shells' },
- '2': { name: 'ResearchStimPackTech' },
- '4': { name: 'ResearchRestoration' },
- '5': { name: 'ResearchOpticalFlare' },
- '6': { name: 'ResearchCaduceusReactor' }
- },
- injuryOffsets: [{ x: -20, y: -28 }, { x: 26, y: -46 }, { x: 16, y: 12 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.Bunker = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Bunker",
- imgPos: {
- dock: {
- left: 620,
- top: 50
- }
- },
- width: 96,
- height: 62,
- frame: {
- dock: 1
- },
- HP: 350,
- cost: {
- mine: 100,
- time: 300
- },
- items: {
- '8': { name: 'Load' }
- },
- injuryOffsets: [{ x: 4, y: -24 }, { x: -26, y: -18 }, { x: 20, y: -2 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.Factory = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Factory",
- imgPos: {
- dock: {
- left: 716,
- top: 0
- }
- },
- width: 114,
- height: 112,
- frame: {
- dock: 1
- },
- HP: 1250,
- cost: {
- mine: 200,
- gas: 100,
- time: 800
- },
- items: {
- '1': { name: 'Vulture' },
- '2': { name: 'Tank', condition: function () {
- var attach = Game.selectedUnit.attachment;
- return (attach && attach.status != 'dead' && attach.name == 'MachineShop');
- } },
- '3': { name: 'Goliath', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Armory';
- });
- } },
- '6': { name: 'SetRallyPoint' },
- '7': { name: 'MachineShop', condition: function () {
- return (!Game.selectedUnit.attachment || Game.selectedUnit.attachment.status == 'dead');
- } },
- '9': { name: 'LiftOff' }
- },
- injuryOffsets: [{ x: -32, y: -38 }, { x: 45, y: -26 }, { x: 10, y: -32 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ],
- buildTerranBuilding: function () {
- Building.TerranBuilding.CommandCenter.prototype.buildTerranBuilding.call(this);
- }
- }
-});
-Building.TerranBuilding.Starport = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Starport",
- imgPos: {
- dock: {
- left: 830,
- top: 4
- }
- },
- width: 108,
- height: 108,
- frame: {
- dock: 1
- },
- HP: 1300,
- cost: {
- mine: 150,
- gas: 100,
- time: 700
- },
- items: {
- '1': { name: 'Wraith' },
- '2': { name: 'Dropship', condition: function () {
- var attach = Game.selectedUnit.attachment;
- return (attach && attach.status != 'dead' && attach.name == 'ControlTower');
- } },
- '3': { name: 'Vessel', condition: function () {
- var attach = Game.selectedUnit.attachment;
- //Has attachment ControlTower, and has ScienceFacility
- return (attach && attach.status != 'dead' && attach.name == 'ControlTower')
- && Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'ScienceFacility';
- });
- } },
- '4': { name: 'BattleCruiser', condition: function () {
- var attach = Game.selectedUnit.attachment;
- //Has attachment ControlTower, and has ScienceFacility with attachment PhysicsLab
- return (attach && attach.status != 'dead' && attach.name == 'ControlTower')
- && Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'ScienceFacility'
- && (chara.attachment && chara.attachment.status != 'dead' && chara.attachment.name == 'PhysicsLab');
- });
- } },
- '5': { name: 'Valkyrie', condition: function () {
- var attach = Game.selectedUnit.attachment;
- //Has attachment ControlTower, and has Armory
- return (attach && attach.status != 'dead' && attach.name == 'ControlTower')
- && Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Armory';
- });
- } },
- '6': { name: 'SetRallyPoint' },
- '7': { name: 'ControlTower', condition: function () {
- return (!Game.selectedUnit.attachment || Game.selectedUnit.attachment.status == 'dead');
- } },
- '9': { name: 'LiftOff' }
- },
- injuryOffsets: [{ x: -32, y: -10 }, { x: 0, y: -10 }, { x: 24, y: -35 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionL', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ],
- buildTerranBuilding: function () {
- Building.TerranBuilding.CommandCenter.prototype.buildTerranBuilding.call(this);
- }
- }
-});
-Building.TerranBuilding.ScienceFacility = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "ScienceFacility",
- imgPos: {
- dock: {
- left: 1042,
- top: 20
- }
- },
- width: 108,
- height: 92,
- frame: {
- dock: 1
- },
- HP: 850,
- cost: {
- mine: 100,
- gas: 150,
- time: 600
- },
- items: {
- '1': { name: 'ResearchEMPShockwaves' },
- '2': { name: 'ResearchIrradiate' },
- '3': { name: 'ResearchTitanReactor' },
- '7': { name: 'ConvertOps', condition: function () {
- return (!Game.selectedUnit.attachment || Game.selectedUnit.attachment.status == 'dead');
- } },
- '8': { name: 'PhysicsLab', condition: function () {
- return (!Game.selectedUnit.attachment || Game.selectedUnit.attachment.status == 'dead');
- } },
- '9': { name: 'LiftOff' }
- },
- injuryOffsets: [{ x: -28, y: -40 }, { x: 28, y: -32 }, { x: -20, y: 5 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ],
- buildTerranBuilding: function () {
- Building.TerranBuilding.CommandCenter.prototype.buildTerranBuilding.call(this);
- }
- }
-});
-Building.TerranBuilding.Armory = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Armory",
- imgPos: {
- dock: {
- left: 938,
- top: 14
- }
- },
- width: 102,
- height: 98,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 100,
- gas: 50,
- time: 800
- },
- items: {
- '1': { name: 'UpgradeVehicleWeapons' },
- '2': { name: 'UpgradeShipWeapons' },
- '4': { name: 'UpgradeVehicleArmors' },
- '5': { name: 'UpgradeShipArmors' }
- },
- injuryOffsets: [{ x: -30, y: 12 }, { x: -8, y: -22 }, { x: 20, y: -12 }],
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.ComstatStation = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "ComstatStation",
- imgPos: {
- dock: {
- left: 0,
- top: 122
- }
- },
- width: 68,
- height: 62,
- frame: {
- dock: 1
- },
- HP: 750,
- MP: 200,
- cost: {
- mine: 50,
- gas: 50,
- time: 400
- },
- items: {
- '1': { name: 'ScannerSweep' }
- },
- injuryOffsets: [{ x: -12, y: -26 }, { x: 16, y: 0 }, { x: 16, y: -20 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.NuclearSilo = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "NuclearSilo",
- imgPos: {
- dock: {
- left: 282,
- top: 124
- }
- },
- width: 64,
- height: 60,
- frame: {
- dock: 1
- },
- HP: 600,
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- items: {
- '1': { name: 'ArmNuclearSilo' }
- },
- injuryOffsets: [{ x: -12, y: -26 }, { x: 16, y: 0 }, { x: 16, y: -20 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.MachineShop = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "MachineShop",
- imgPos: {
- dock: {
- left: 208,
- top: 112
- }
- },
- width: 74,
- height: 72,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 50,
- gas: 50,
- time: 400
- },
- items: {
- '1': { name: 'ResearchIonThrusters' },
- '2': { name: 'ResearchSpiderMines' },
- '3': { name: 'ResearchSiegeTech' },
- '4': { name: 'ResearchCharonBoosters' }
- },
- injuryOffsets: [{ x: -12, y: -26 }, { x: 16, y: 0 }, { x: 16, y: -20 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.ControlTower = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "ControlTower",
- imgPos: {
- dock: {
- left: 68,
- top: 120
- }
- },
- width: 72,
- height: 64,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 50,
- gas: 50,
- time: 400
- },
- items: {
- '1': { name: 'ResearchCloakingField' },
- '2': { name: 'ResearchApolloReactor' }
- },
- injuryOffsets: [{ x: -12, y: -26 }, { x: 16, y: 0 }, { x: 16, y: -20 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionM', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.PhysicsLab = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "PhysicsLab",
- imgPos: {
- dock: {
- left: 348,
- top: 120
- }
- },
- width: 66,
- height: 64,
- frame: {
- dock: 1
- },
- HP: 600,
- cost: {
- mine: 50,
- gas: 50,
- time: 400
- },
- items: {
- '1': { name: 'ResearchYamatoGun' },
- '2': { name: 'ResearchColossusReactor' }
- },
- injuryOffsets: [{ x: -12, y: -26 }, { x: 16, y: 0 }, { x: 16, y: -20 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.ConvertOps = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "ConvertOps",
- imgPos: {
- dock: {
- left: 140,
- top: 132
- }
- },
- width: 68,
- height: 52,
- frame: {
- dock: 1
- },
- HP: 750,
- cost: {
- mine: 50,
- gas: 50,
- time: 400
- },
- items: {
- '1': { name: 'ResearchLockdown' },
- '2': { name: 'ResearchPersonalCloaking' },
- '4': { name: 'ResearchOcularImplants' },
- '5': { name: 'ResearchMoebiusReactor' }
- },
- injuryOffsets: [{ x: -12, y: -26 }, { x: 16, y: 0 }, { x: 16, y: -20 }],
- injuryScale: 0.8,
- evolves: [
- { step: 'TerranBuilding.ConstructionS', percent: 0 },
- { step: 'step2', percent: 0.25 },
- { step: 'step3', percent: 0.5 },
- { step: 'TerranBuilding.ConstructionF', percent: 0.75 }
- ]
- }
-});
-Building.TerranBuilding.CrashCruiser = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "CrashCruiser",
- imgPos: {
- dock: {
- left: 154,
- top: 440
- }
- },
- width: 106,
- height: 108,
- frame: {
- dock: 1
- },
- HP: 250,
- injuryOffsets: [{ x: -8, y: -38 }, { x: 24, y: -20 }, { x: -22, y: 6 }]
- }
-});
-Building.TerranBuilding.BigCannon = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BigCannon",
- imgPos: {
- dock: {
- left: 0,
- top: 423
- }
- },
- width: 152,
- height: 110,
- frame: {
- dock: 1
- },
- HP: 500,
- injuryOffsets: [{ x: -10, y: -40 }, { x: 42, y: -30 }, { x: 8, y: 26 }]
- }
-});
-Building.ProtossBuilding.Nexus = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Nexus",
- imgPos: {
- dock: {
- left: 24,
- top: 12
- }
- },
- width: 146,
- height: 136,
- frame: {
- dock: 1
- },
- HP: 750,
- SP: 750,
- manPlus: 10,
- cost: {
- mine: 400,
- time: 1200
- },
- items: {
- '1': { name: 'Probe' },
- '6': { name: 'SetRallyPoint' }
- },
- injuryOffsets: [{ x: -10, y: -30 }, { x: 0, y: 36 }, { x: 38, y: 30 }]
- }
-});
-Building.ProtossBuilding.Pylon = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Pylon",
- imgPos: {
- dock: {
- left: 454,
- top: 314
- }
- },
- width: 60,
- height: 68,
- frame: {
- dock: 1
- },
- HP: 300,
- SP: 300,
- manPlus: 8,
- cost: {
- mine: 100,
- time: 300
- },
- injuryOffsets: [{ x: 8, y: 6 }, { x: 0, y: -16 }, { x: 0, y: 0 }],
- injuryScale: 0.8
- }
-});
-Building.ProtossBuilding.Assimilator = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Assimilator",
- imgPos: {
- dock: {
- left: 300,
- top: 36
- }
- },
- width: 126,
- height: 100,
- frame: {
- dock: 1
- },
- HP: 450,
- SP: 450,
- cost: {
- mine: 100,
- time: 400
- },
- injuryOffsets: [{ x: -18, y: -38 }, { x: 40, y: -26 }, { x: 20, y: -38 }]
- }
-});
-Building.ProtossBuilding.Gateway = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Gateway",
- imgPos: {
- dock: {
- left: 580,
- top: 20
- }
- },
- width: 128,
- height: 110,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- cost: {
- mine: 150,
- time: 600
- },
- items: {
- '1': { name: 'Zealot' },
- '2': { name: 'Dragoon', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'CyberneticsCore';
- });
- } },
- '3': { name: 'Templar', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'TemplarArchives';
- });
- } },
- '4': { name: 'DarkTemplar', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'TemplarArchives';
- });
- } },
- '6': { name: 'SetRallyPoint' }
- },
- injuryOffsets: [{ x: 0, y: -54 }, { x: -42, y: -24 }, { x: 36, y: 16 }]
- }
-});
-Building.ProtossBuilding.Forge = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Forge",
- imgPos: {
- dock: {
- left: 210,
- top: 178
- }
- },
- width: 102,
- height: 80,
- frame: {
- dock: 1
- },
- HP: 550,
- SP: 550,
- cost: {
- mine: 150,
- time: 400
- },
- items: {
- '1': { name: 'UpgradeGroundWeapons' },
- '2': { name: 'UpgradeGroundArmor' },
- '3': { name: 'UpgradePlasmaShields' }
- },
- injuryOffsets: [{ x: 23, y: -47 }, { x: -23, y: -4 }, { x: 25, y: 1 }]
- }
-});
-Building.ProtossBuilding.PhotonCannon = Building.ProtossBuilding.extends(Building.Attackable).extends({
- constructorPlus: function (props) {
- this.imgPos.attack = this.imgPos.dock;
- this.sound.attack = new Audio(Game.CDN + 'bgm/Dragoon.attack.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "PhotonCannon",
- imgPos: {
- dock: {
- left: [98, 162, 226, 290, 290, 290, 290, 290, 290],
- top: [320, 320, 320, 320, 320, 320, 320, 320, 320]
- }
- },
- width: 62,
- height: 54,
- frame: {
- dock: 1,
- attack: 9
- },
- HP: 100,
- SP: 100,
- detector: Gobj.detectorBuffer,
- cost: {
- mine: 150,
- time: 500
- },
- //Attackable
- damage: 20,
- attackRange: 245,
- attackInterval: 2200,
- attackType: AttackableUnit.NORMAL_ATTACK,
- fireDelay: 400,
- injuryOffsets: [{ x: -12, y: -18 }, { x: 12, y: 0 }, { x: 12, y: -20 }],
- injuryScale: 0.8
- }
-});
-Building.ProtossBuilding.CyberneticsCore = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "CyberneticsCore",
- imgPos: {
- dock: {
- left: 314,
- top: 168
- }
- },
- width: 90,
- height: 88,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- cost: {
- mine: 200,
- time: 600
- },
- items: {
- '1': { name: 'UpgradeAirWeapons' },
- '2': { name: 'UpgradeAirArmor' },
- '3': { name: 'DevelopSingularityCharge' }
- },
- injuryOffsets: [{ x: -8, y: -36 }, { x: 28, y: 10 }, { x: -18, y: 4 }]
- }
-});
-Building.ProtossBuilding.ShieldBattery = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "ShieldBattery",
- imgPos: {
- dock: {
- left: 360,
- top: 318
- }
- },
- width: 90,
- height: 64,
- frame: {
- dock: 1
- },
- HP: 200,
- SP: 200,
- MP: 200,
- cost: {
- mine: 100,
- time: 300
- },
- items: {
- '1': { name: 'RechargeShields' }
- },
- injuryOffsets: [{ x: -12, y: -32 }, { x: 0, y: -20 }, { x: 12, y: -8 }],
- injuryScale: 0.8
- }
-});
-Building.ProtossBuilding.RoboticsFacility = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "RoboticsFacility",
- imgPos: {
- dock: {
- left: 504,
- top: 166
- }
- },
- width: 96,
- height: 92,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- cost: {
- mine: 200,
- gas: 200,
- time: 800
- },
- items: {
- '1': { name: 'Shuttle' },
- '2': { name: 'Reaver', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'RoboticsSupportBay';
- });
- } },
- '3': { name: 'Observer', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'Observatory';
- });
- } },
- '6': { name: 'SetRallyPoint' }
- },
- injuryOffsets: [{ x: -18, y: -25 }, { x: 12, y: 10 }, { x: 18, y: -15 }]
- }
-});
-Building.ProtossBuilding.StarGate = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "StarGate",
- imgPos: {
- dock: {
- left: 708,
- top: 10
- }
- },
- width: 124,
- height: 116,
- frame: {
- dock: 1
- },
- HP: 600,
- SP: 600,
- cost: {
- mine: 150,
- gas: 150,
- time: 700
- },
- items: {
- '1': { name: 'Scout' },
- '2': { name: 'Carrier', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'FleetBeacon';
- });
- } },
- '3': { name: 'Arbiter', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'ArbiterTribunal';
- });
- } },
- '4': { name: 'Corsair' },
- '6': { name: 'SetRallyPoint' }
- },
- injuryOffsets: [{ x: 10, y: -65 }, { x: 35, y: 12 }, { x: -20, y: -42 }]
- }
-});
-Building.ProtossBuilding.CitadelOfAdun = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "CitadelOfAdun",
- imgPos: {
- dock: {
- left: 114,
- top: 172
- }
- },
- width: 98,
- height: 86,
- frame: {
- dock: 1
- },
- HP: 450,
- SP: 450,
- cost: {
- mine: 150,
- gas: 100,
- time: 600
- },
- items: {
- '1': { name: 'DevelopLegEnhancements' }
- },
- injuryOffsets: [{ x: -20, y: -30 }, { x: 28, y: -40 }, { x: 25, y: -8 }]
- }
-});
-Building.ProtossBuilding.RoboticsSupportBay = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "RoboticsSupportBay",
- imgPos: {
- dock: {
- left: 6,
- top: 168
- }
- },
- width: 100,
- height: 88,
- frame: {
- dock: 1
- },
- HP: 450,
- SP: 450,
- cost: {
- mine: 150,
- gas: 100,
- time: 300
- },
- items: {
- '1': { name: 'UpgradeScarabDamage' },
- '2': { name: 'IncreaseReaverCapacity' },
- '3': { name: 'DevelopGraviticDrive' }
- },
- injuryOffsets: [{ x: -20, y: -5 }, { x: 5, y: 10 }, { x: 25, y: -5 }],
- injuryScale: 0.8
- }
-});
-Building.ProtossBuilding.FleetBeacon = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "FleetBeacon",
- imgPos: {
- dock: {
- left: 440,
- top: 26
- }
- },
- width: 136,
- height: 100,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- cost: {
- mine: 300,
- gas: 200,
- time: 600
- },
- items: {
- '1': { name: 'DevelopApialSensors' },
- '2': { name: 'DevelopGraviticThrusters' },
- '3': { name: 'IncreaseCarrierCapacity' },
- '4': { name: 'DevelopDistruptionWeb' },
- '5': { name: 'DevelopArgusJewel' }
- },
- injuryOffsets: [{ x: 0, y: -55 }, { x: 38, y: -42 }, { x: -26, y: -4 }]
- }
-});
-Building.ProtossBuilding.TemplarArchives = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "TemplarArchives",
- imgPos: {
- dock: {
- left: 180,
- top: 24
- }
- },
- width: 114,
- height: 104,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- cost: {
- mine: 150,
- gas: 200,
- time: 600
- },
- items: {
- '1': { name: 'DevelopPsionicStorm' },
- '2': { name: 'DevelopHallucination' },
- '3': { name: 'DevelopKhaydarinAmulet' },
- '4': { name: 'DevelopMindControl' },
- '5': { name: 'DevelopMaelStorm' },
- '6': { name: 'DevelopArgusTalisman' }
- },
- injuryOffsets: [{ x: -18, y: -28 }, { x: 42, y: 18 }, { x: 14, y: 10 }]
- }
-});
-Building.ProtossBuilding.Observatory = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Observatory",
- imgPos: {
- dock: {
- left: 0,
- top: 302
- }
- },
- width: 96,
- height: 82,
- frame: {
- dock: 1
- },
- HP: 250,
- SP: 250,
- cost: {
- mine: 50,
- gas: 100,
- time: 300
- },
- items: {
- '1': { name: 'DevelopGraviticBooster' },
- '2': { name: 'DevelopSensorArray' }
- },
- injuryOffsets: [{ x: 32, y: -33 }, { x: -12, y: -26 }, { x: -16, y: 10 }]
- }
-});
-Building.ProtossBuilding.ArbiterTribunal = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "ArbiterTribunal",
- imgPos: {
- dock: {
- left: 408,
- top: 176
- }
- },
- width: 94,
- height: 80,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- cost: {
- mine: 200,
- gas: 150,
- time: 600
- },
- items: {
- '1': { name: 'DevelopRecall' },
- '2': { name: 'DevelopStasisField' },
- '3': { name: 'DevelopKhaydarinCore' }
- },
- injuryOffsets: [{ x: -20, y: 0 }, { x: 5, y: -20 }, { x: 28, y: 8 }],
- injuryScale: 0.8
- }
-});
-Building.ProtossBuilding.TeleportGate = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "TeleportGate",
- imgPos: {
- dock: {
- left: 602,
- top: 132
- }
- },
- width: 126,
- height: 148,
- frame: {
- dock: 1
- },
- HP: 500,
- SP: 500,
- injuryOffsets: [{ x: -14, y: 30 }, { x: 5, y: -16 }, { x: 30, y: 30 }]
- }
-});
-Building.ProtossBuilding.Pyramid = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Pyramid",
- imgPos: {
- dock: {
- left: 620,
- top: 284
- }
- },
- width: 128,
- height: 120,
- frame: {
- dock: 1
- },
- HP: 1500,
- SP: 1500,
- injuryOffsets: [{ x: -20, y: 15 }, { x: 5, y: -5 }, { x: 28, y: 23 }]
- }
-});
-Building.ProtossBuilding.TeleportPoint = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "TeleportPoint",
- imgPos: {
- dock: {
- left: 516,
- top: 320
- }
- },
- width: 100,
- height: 64,
- frame: {
- dock: 1
- },
- HP: 100,
- SP: 100,
- injuryOffsets: [{ x: -20, y: -10 }, { x: 5, y: -30 }, { x: 28, y: -2 }],
- injuryScale: 0.8
- }
-});
-//Evolve related
-Building.ZergBuilding.Egg = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- this.sound = {
- selected: new Audio(Game.CDN + 'bgm/Egg.selected.wav'),
- death: new Audio(Game.CDN + 'bgm/Egg.death.wav')
- };
- //Hidden frames
- this.action = 13;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Egg",
- source: "Larva",
- portrait: "Egg",
- noMud: true,
- imgPos: {
- dock: {
- left: [2, 38, 74, 110, 146, 182, 218, 254, 290, 326, 362, 398, -1, 2, 38, 74, 110, -1, 291, 329, 367, 405, 442, 480],
- top: [213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, 213, -1, 173, 173, 173, 173, -1, 372, 372, 372, 372, 372, 372]
- }
- },
- width: 36,
- height: 40,
- frame: {
- dock: 12
- },
- HP: 200,
- armor: 10,
- sight: 35,
- dieEffect: Burst.EggDeath
- }
-});
-Building.ZergBuilding.Cocoon = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- this.sound = {
- selected: new Audio(Game.CDN + 'bgm/Cocoon.selected.wav'),
- death: new Audio(Game.CDN + 'bgm/Mutalisk.death.wav')
- };
- //Override default flyingFlag for building
- this.isFlying = true;
- //Hidden frames
- this.action = 10;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Cocoon",
- source: "Larva",
- portrait: "Cocoon",
- noMud: true,
- imgPos: {
- dock: {
- left: [0, 63, 126, 189, 252, 315, 378, 441, 504, -1, 0, 63, 126, 189, 252, 315],
- top: [1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, 1105, -1, 1060, 1060, 1060, 1060, 1060, 1060]
- }
- },
- width: 62,
- height: 45,
- frame: {
- dock: 9
- },
- HP: 200,
- armor: 10,
- sight: 35,
- dieEffect: Burst.SmallZergFlyingDeath
- }
-});
-Building.ZergBuilding.MutationS = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Hidden frames
- this.action = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutation",
- imgPos: {
- dock: {
- left: [356, 516, 676, 836, 996, 1156, -1, 36, 36, 196, 196],
- top: [962, 962, 962, 962, 962, 962, -1, 962, 962, 962, 962]
- }
- },
- width: 88,
- height: 84,
- frame: {
- dock: 6
- },
- HP: 200,
- armor: 0,
- sight: 350,
- evolveEffect: ['SmallMutationComplete']
- }
-});
-Building.ZergBuilding.MutationM = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutation",
- imgPos: {
- dock: {
- left: [20, 180, 340, 500, 660, 820],
- top: [1048, 1048, 1048, 1048, 1048, 1048]
- }
- },
- width: 120,
- height: 112,
- frame: {
- dock: 6
- },
- HP: 400,
- armor: 0,
- sight: 350,
- evolveEffect: ['MiddleMutationComplete']
- }
-});
-Building.ZergBuilding.MutationL = Building.ZergBuilding.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutation",
- imgPos: {
- dock: {
- left: [0, 160, 320, 480, 640, 800],
- top: [1160, 1160, 1160, 1160, 1160, 1160]
- }
- },
- width: 160,
- height: 150,
- frame: {
- dock: 6
- },
- HP: 600,
- armor: 0,
- sight: 350,
- evolveEffect: ['LargeMutationComplete']
- }
-});
-Building.TerranBuilding.ConstructionS = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- this.imgPos.dock = this.imgPos.step1;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Construction",
- imgPos: {
- step1: {
- left: 798,
- top: 296
- },
- step2: {
- left: 894,
- top: 296
- },
- step3: {
- left: 990,
- top: 296
- }
- },
- width: 72,
- height: 70,
- frame: {
- step1: 1,
- step2: 1,
- step3: 1,
- dock: 1
- },
- HP: 400,
- armor: 0,
- sight: 350
- }
-});
-Building.TerranBuilding.ConstructionM = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- this.imgPos.dock = this.imgPos.step1;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Construction",
- imgPos: {
- step1: {
- left: 498,
- top: 296
- },
- step2: {
- left: 594,
- top: 296
- },
- step3: {
- left: 690,
- top: 296
- }
- },
- width: 96,
- height: 70,
- frame: {
- step1: 1,
- step2: 1,
- step3: 1,
- dock: 1
- },
- HP: 400,
- armor: 0,
- sight: 350
- }
-});
-Building.TerranBuilding.ConstructionL = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- this.imgPos.dock = this.imgPos.step1;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Construction",
- imgPos: {
- step1: {
- left: 276,
- top: 442
- },
- step2: {
- left: 404,
- top: 442
- },
- step3: {
- left: 540,
- top: 442
- }
- },
- width: 124,
- height: 86,
- frame: {
- step1: 1,
- step2: 1,
- step3: 1,
- dock: 1
- },
- HP: 400,
- armor: 0,
- sight: 350
- }
-});
-Building.TerranBuilding.ConstructionR = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- this.imgPos.dock = this.imgPos.step1;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Construction",
- imgPos: {
- step1: {
- left: 848,
- top: 366
- },
- step2: {
- left: 956,
- top: 366
- }
- },
- width: 108,
- height: 70,
- frame: {
- step1: 1,
- step2: 1,
- dock: 1
- },
- HP: 400,
- armor: 0,
- sight: 350
- }
-});
-Building.TerranBuilding.ConstructionF = Building.TerranBuilding.extends({
- constructorPlus: function (props) {
- this.type = props.type;
- //Override imgPos
- this.imgPos = _$.clone(this.imgPos);
- this.imgPos.dock = this.imgPos[this.type];
- this.width = Building.TerranBuilding[this.type].prototype.width;
- this.height = Building.TerranBuilding[this.type].prototype.height;
- //Continue adjusting position after initialize
- if (props.target instanceof Gobj) {
- this.x -= (this.width / 2);
- this.y -= (this.height / 2);
- }
- },
- prototypePlus: {
- //Add basic unit info
- name: "ConstructionSkeleton",
- imgPos: {
- CommandCenter: {
- left: 674,
- top: 440
- },
- SupplyDepot: {
- left: 1034,
- top: 118
- },
- Refinery: {
- left: 950,
- top: 434
- },
- Barracks: {
- left: 812,
- top: 432
- },
- EngineeringBay: {
- left: 772,
- top: 542
- },
- MissileTurret: {
- left: 877,
- top: 118
- },
- Academy: {
- left: 1042,
- top: 536
- },
- Bunker: {
- left: 930,
- top: 123
- },
- Factory: {
- left: 917,
- top: 530
- },
- Starport: {
- left: 782,
- top: 635
- },
- ScienceFacility: {
- left: 907,
- top: 641
- },
- Armory: {
- left: 1027,
- top: 634
- },
- ComstatStation: {
- left: 426,
- top: 122
- },
- NuclearSilo: {
- left: 576,
- top: 120
- },
- MachineShop: {
- left: 724,
- top: 114
- },
- ControlTower: {
- left: 648,
- top: 118
- },
- PhysicsLab: {
- left: 504,
- top: 116
- },
- ConvertOps: {
- left: 797,
- top: 122
- }
- },
- width: 0,
- height: 0,
- frame: {
- dock: 1
- },
- HP: 400,
- armor: 0,
- sight: 350
- }
-});
-Building.ProtossBuilding.ArchonEvolve = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Hidden frames
- this.action = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Archon",
- source: "Archon",
- portrait: "Archon",
- imgPos: {
- dock: {
- left: [1340, 1460, 1580, 1700, 1820, 1940, -1, 1100, 1220],
- top: [1700, 1700, 1700, 1700, 1700, 1700, -1, 1700, 1700]
- }
- },
- width: 80,
- height: 80,
- frame: {
- dock: 6
- },
- HP: 10,
- SP: 350,
- armor: 0,
- plasma: 0,
- sight: 280,
- dieEffect: Burst.BigBlueExplode
- }
-});
-Building.ProtossBuilding.DarkArchonEvolve = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Hidden frames
- this.action = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "DarkArchon",
- source: "DarkArchon",
- portrait: "DarkArchon",
- imgPos: {
- dock: {
- left: [1340, 1460, 1580, 1700, 1820, 1940, -1, 1100, 1220],
- top: [1220, 1220, 1220, 1220, 1220, 1220, -1, 1220, 1220]
- }
- },
- width: 80,
- height: 80,
- frame: {
- dock: 6
- },
- HP: 25,
- SP: 200,
- armor: 1,
- plasma: 0,
- sight: 350,
- dieEffect: Burst.BigBlueExplode
- }
-});
-Building.ProtossBuilding.WrapRift = Building.ProtossBuilding.extends({
- constructorPlus: function (props) {
- //Hidden frames
- this.action = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "WrapRift",
- imgPos: {
- dock: {
- left: [10, 74, 150, 234, 328, 418, -1, 10, 74, 150, 234, 328, 418],
- top: [722, 722, 722, 722, 722, 722, -1, 658, 658, 658, 658, 658, 658]
- }
- },
- width: 64,
- height: 64,
- frame: {
- dock: 6
- },
- HP: 200,
- SP: 200,
- armor: 0,
- plasma: 0,
- sight: 350
- }
-});
-//# sourceMappingURL=Building.js.map
\ No newline at end of file
diff --git a/Characters/Bullets.js b/Characters/Bullets.js
deleted file mode 100644
index 1b8a0c6..0000000
--- a/Characters/Bullets.js
+++ /dev/null
@@ -1,813 +0,0 @@
-var Bullets = Gobj.extends({
- constructorPlus: function (props) {
- this.owner = props.from;
- this.target = props.to;
- //Makes below initial steps before fire
- var ownerX = (this.owner instanceof Gobj) ? (this.owner.posX()) : (this.owner.x);
- var ownerY = (this.owner instanceof Gobj) ? (this.owner.posY()) : (this.owner.y);
- var targetX = (this.target instanceof Gobj) ? (this.target.posX()) : (this.target.x);
- var targetY = (this.target instanceof Gobj) ? (this.target.posY()) : (this.target.y);
- //Convert from center point to left-top
- this.x = ownerX - this.width / 2;
- this.y = ownerY - this.height / 2;
- if (this.forbidRotate)
- this.angle = 0;
- else {
- //Below angle represents direction toward target
- this.angle = Math.atan((ownerY - targetY) / (targetX - ownerX));
- if (targetX < ownerX)
- this.angle += Math.PI;
- }
- //Initial by fixed speed
- if (this.speedVal) {
- //Calculate speed
- var K = this.speedVal / Math.pow((targetX - ownerX) * (targetX - ownerX) + (targetY - ownerY) * (targetY - ownerY), 0.5);
- this.speed = {
- x: K * (targetX - ownerX) >> 0,
- y: K * (targetY - ownerY) >> 0
- };
- //For Lurker thron
- if (this.duration == null)
- this.duration = (1 / K >> 0) * 100;
- }
- else {
- this.speed = {
- x: (targetX - ownerX) / (this.duration / 100 + 1),
- y: (targetY - ownerY) / (this.duration / 100 + 1)
- };
- }
- //By default it's not shown
- this.status = "dead";
- //Fixed damage if be set
- if (props.damage != null)
- this.damage = props.damage;
- //Will show after constructed
- Bullets.allBullets.push(this);
- },
- prototypePlus: {
- //Override to use 8 directions speed
- updateLocation: function () {
- //No direction speed
- this.x += this.speed.x;
- this.y += this.speed.y;
- },
- burst: function () {
- var owner = this.owner;
- var target = this.target;
- //Bullet over, now burst turn to show
- this.die();
- //Filter out magic bullet with fixed destination
- if (!(target instanceof Gobj))
- return;
- //Init targets if AOE
- var targets;
- if (owner.AOE) {
- //Get possible targets
- switch (owner.attackLimit) {
- case "flying":
- targets = Unit.allUnits.filter(function (chara) {
- return chara.team != owner.team && chara.isFlying;
- });
- break;
- case "ground":
- var enemyUnits = Unit.allUnits.filter(function (chara) {
- return chara.team != owner.team && !(chara.isFlying);
- });
- var enemyBuildings = Building.allBuildings.filter(function (chara) {
- return chara.team != owner.team;
- });
- targets = enemyUnits.concat(enemyBuildings);
- break;
- default:
- targets = (Unit.allUnits.concat(Building.allBuildings)).filter(function (chara) {
- return chara.team != owner.team;
- });
- break;
- }
- //Range filter
- switch (owner.AOE.type) {
- case "LINE":
- //Calculate inter-points between enemy
- var N = Math.ceil(owner.distanceFrom(target) / (owner.AOE.radius));
- targets = targets.filter(function (chara) {
- for (var n = 1; n <= N; n++) {
- var X = owner.posX() + n * (target.posX() - owner.posX()) / N;
- var Y = owner.posY() + n * (target.posY() - owner.posY()) / N;
- if (chara.insideCircle({ centerX: X >> 0, centerY: Y >> 0, radius: owner.AOE.radius })
- && !chara['isInvisible' + owner.team]) {
- return true;
- }
- }
- return false;
- });
- break;
- //Default type is CIRCLE
- case "CIRCLE":
- default:
- targets = targets.filter(function (chara) {
- return chara.insideCircle({ centerX: target.posX(), centerY: target.posY(), radius: owner.AOE.radius })
- && !chara['isInvisible' + owner.team];
- });
- }
- }
- if (this.burstEffect) {
- //Show burst effect on target
- if (owner.AOE && owner.AOE.hasEffect) {
- var burstEffect = this.burstEffect;
- targets.forEach(function (chara) {
- new burstEffect({ target: chara, above: true, team: owner.team });
- });
- }
- else {
- new this.burstEffect({ target: target, above: true, team: owner.team });
- }
- }
- //Real bullet
- if (!this.noDamage) {
- //Cause damage when burst appear
- if (owner.AOE) {
- var myself = this;
- targets.forEach(function (chara) {
- if (myself.damage != null)
- chara.getDamageBy(myself.damage);
- else
- chara.getDamageBy(owner);
- chara.reactionWhenAttackedBy(owner);
- });
- }
- else {
- if (this.damage != null)
- target.getDamageBy(this.damage);
- else
- target.getDamageBy(owner);
- target.reactionWhenAttackedBy(owner);
- }
- }
- //Fired flag
- this.used = true;
- },
- //Upgrade Gobj moving, replace run as fire
- fire: function (callback) {
- //Start firing
- this.moving();
- //Layout bullet in front by add one frame
- this.updateLocation();
- this.detectOutOfBound();
- //Sound effect
- if (this.insideScreen() && this.owner.sound && this.owner.sound.attack)
- this.owner.sound.attack.play();
- //Will burst and stop moving after time limit arrive
- var myself = this;
- Game.commandTimeout(function () {
- myself.burst();
- //Something happens after bullet burst
- if (callback)
- callback();
- }, this.duration);
- }
- }
-});
-//All bullets here for show
-Bullets.allBullets = [];
-Bullets.Spooge = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Hydralisk",
- duration: 400,
- imgPos: {
- moving: {
- left: [14, 72, 136, 204],
- top: [758, 758, 758, 758]
- }
- },
- width: 56,
- height: 28,
- frame: {
- moving: 4
- },
- burstEffect: Burst.HydraSpark
- }
-});
-Bullets.Thorn = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Lurker",
- speedVal: 25,
- duration: 600,
- imgPos: {
- moving: {
- left: [61, 88, 117, 144, 117, 88],
- top: [711, 711, 711, 711, 711, 711]
- }
- },
- width: 28,
- height: 35,
- frame: {
- moving: 6
- },
- forbidRotate: true
- }
-});
-Bullets.Darts = Bullets.extends({
- constructorPlus: function (props) {
- this.life = this.traceTimes;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- duration: 400,
- imgPos: {
- moving: {
- left: [0, 36, 72, 108, 144, 180, 216, 252, 288, 324],
- top: [1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051, 1051]
- }
- },
- width: 36,
- height: 36,
- frame: {
- moving: 10
- },
- burstEffect: Burst.GreenFog,
- //Chain tracing attack
- traceTimes: 3,
- traceRadius: 100,
- //Override
- noDamage: true,
- die: function () {
- var target = this.target;
- var owner = this.owner;
- //Interrupt tracing if target is dead first
- if (target.status == "dead") {
- //Former behavior before override
- this.inherited.die.call(this);
- }
- //Override damage, damage reduce
- target.getDamageBy(owner, this.life / this.traceTimes);
- target.reactionWhenAttackedBy(owner);
- //Bullet reduce
- this.life--;
- var myself = this;
- var traceEnemies;
- //Get all possible enemies
- switch (owner.attackLimit) {
- case "flying":
- traceEnemies = Unit.allUnits.filter(function (chara) {
- return chara.team != owner.team && chara.isFlying;
- });
- break;
- case "ground":
- traceEnemies = Unit.allUnits.filter(function (chara) {
- return chara.team != owner.team && !(chara.isFlying);
- });
- break;
- default:
- traceEnemies = Unit.allUnits.filter(function (chara) {
- return chara.team != owner.team;
- });
- break;
- }
- //Filter out trace-able enemies
- traceEnemies = traceEnemies.filter(function (chara) {
- return (chara != myself.target) &&
- chara.insideCircle({ centerX: myself.posX(), centerY: myself.posY(), radius: myself.traceRadius });
- });
- //Attack trace enemy
- if (traceEnemies.length > 0 && this.life > 0) {
- //Initial position again before jumping
- this.x = target.posX() - this.width / 2;
- this.y = target.posY() - this.height / 2;
- this.target = traceEnemies[0];
- var targetX = this.target.posX();
- var targetY = this.target.posY();
- var myX = this.posX();
- var myY = this.posY();
- //Update bullet speed
- this.speed = {
- x: (targetX - myX) / (this.duration / 100),
- y: (targetY - myY) / (this.duration / 100)
- };
- //Update bullet angle
- if (this.forbidRotate)
- this.angle = 0;
- else {
- //Below angle represents direction toward target
- this.angle = Math.atan((myY - targetY) / (targetX - myX));
- if (targetX < myX)
- this.angle += Math.PI;
- }
- //Fire bullet
- Game.commandTimeout(function () {
- myself.burst();
- }, this.duration);
- }
- else {
- //Former behavior before override
- this.inherited.die.call(this);
- }
- }
- }
-});
-Bullets.Parasite = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 152,
- top: 0
- }
- },
- width: 10,
- height: 34,
- frame: {
- moving: 1
- },
- burstEffect: Burst.Parasite
- }
-});
-Bullets.GreenBall = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Guardian",
- speedVal: 35,
- imgPos: {
- moving: {
- left: 32,
- top: 520
- }
- },
- width: 20,
- height: 20,
- frame: {
- moving: 1
- },
- forbidRotate: true,
- burstEffect: Burst.GreenBallBroken
- }
-});
-Bullets.PurpleCloud = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Devourer",
- speedVal: 20,
- imgPos: {
- moving: {
- left: 8,
- top: 973
- }
- },
- width: 70,
- height: 32,
- frame: {
- moving: 1
- },
- burstEffect: Burst.PurpleCloudSpread
- }
-});
-Bullets.Spore = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 40,
- imgPos: {
- moving: {
- left: 522,
- top: 6
- }
- },
- width: 20,
- height: 20,
- frame: {
- moving: 1
- },
- burstEffect: Burst.Spore
- }
-});
-Bullets.Flame = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- duration: 300,
- imgPos: {
- moving: {
- left: [15, 15, 80, 80, 170, 170],
- top: [86, 86, 86, 86, 86, 86]
- }
- },
- width: 76,
- height: 40,
- frame: {
- moving: 6
- }
- }
-});
-Bullets.VultureBall = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 152,
- top: 0
- }
- },
- width: 10,
- height: 34,
- frame: {
- moving: 1
- },
- burstEffect: Burst.VultureSpark
- }
-});
-Bullets.Missile = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Wraith",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 8,
- top: 132
- }
- },
- width: 16,
- height: 32,
- frame: {
- moving: 1
- },
- burstEffect: Burst.FireSparkSound
- }
-});
-Bullets.LongMissile = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 35,
- imgPos: {
- moving: {
- left: 0,
- top: 0
- }
- },
- width: 35,
- height: 30,
- frame: {
- moving: 1
- },
- burstEffect: Burst.FireSparkSound
- }
-});
-Bullets.SingleMissile = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 35,
- imgPos: {
- moving: {
- left: 0,
- top: 0
- }
- },
- width: 35,
- height: 15,
- frame: {
- moving: 1
- },
- burstEffect: Burst.FireSparkSound
- }
-});
-Bullets.MultipleMissile = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 304,
- top: 56
- }
- },
- width: 94,
- height: 50,
- frame: {
- moving: 1
- },
- burstEffect: Burst.FireSparkSound
- }
-});
-Bullets.Laser = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "BattleCruiser",
- speedVal: 50,
- imgPos: {
- moving: {
- left: 16,
- top: 248
- }
- },
- width: 68,
- height: 12,
- frame: {
- moving: 1
- },
- burstEffect: Burst.LaserSpark
- }
-});
-Bullets.SmallLaser = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "BattleCruiser",
- speedVal: 40,
- imgPos: {
- moving: {
- left: 20,
- top: 248
- }
- },
- width: 22,
- height: 12,
- frame: {
- moving: 1
- },
- burstEffect: Burst.LaserSpark
- }
-});
-/*Bullets.HeatLaser=Bullets.extends({
- constructorPlus:function(props){},
- prototypePlus:{
- //Add basic unit info
- name:"HeroCruiser",
- duration:300,
- imgPos:{
- moving:{
- left:16,
- top:170
- }
- },
- width:68,
- height:12,
- frame:{
- moving:1
- },
- burstEffect:Burst.SmallExplode
- }
-});*/
-Bullets.Yamato = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- duration: 400,
- imgPos: {
- moving: {
- left: [288, 192, 96, 0],
- top: [1195, 1195, 1195, 1195]
- }
- },
- width: 96,
- height: 96,
- frame: {
- moving: 4
- },
- burstEffect: Burst.MiddleExplode
- }
-});
-Bullets.NuclearBomb = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- duration: 1000,
- imgPos: {
- moving: {
- left: 428,
- top: 66
- }
- },
- width: 74,
- height: 32,
- frame: {
- moving: 1
- }
- }
-});
-Bullets.DragoonBall = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 30,
- imgPos: {
- moving: {
- left: [5, 36, 70, 101, 133],
- top: [862, 862, 862, 862, 862]
- }
- },
- width: 23,
- height: 21,
- frame: {
- moving: 5
- },
- forbidRotate: true,
- burstEffect: Burst.DragoonBallBroken
- }
-});
-Bullets.ArchonLightening = Bullets.extends({
- constructorPlus: function (props) {
- //Override position to hands
- this.x += this.speed.x * 6; //N/8==40/70 (ArchonRadius/AttackRange)
- this.y += this.speed.y * 6;
- //Override speed, will not move
- this.speed = { x: 0, y: 0 };
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- duration: 800,
- imgPos: {
- moving: {
- left: [4, 192, 388, 580],
- top: [704, 704, 704, 704]
- }
- },
- width: 90,
- height: 75,
- frame: {
- moving: 4
- }
- }
-});
-Bullets.ScoutMissile = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 53,
- top: 0
- }
- },
- width: 30,
- height: 34,
- frame: {
- moving: 1
- },
- burstEffect: Burst.DragoonBallBroken
- }
-});
-Bullets.ReaverBomb = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 350,
- top: 0
- }
- },
- width: 70,
- height: 34,
- frame: {
- moving: 1
- },
- burstEffect: Burst.ReaverBurst,
- //Override
- fire: function () {
- Bullets.prototype.fire.call(this);
- //Consume scarab
- if (this.owner.scarabNum > 0) {
- this.owner.scarabNum--;
- Button.refreshButtons();
- }
- }
- }
-});
-Bullets.ReaverBombII = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- speedVal: 25,
- imgPos: {
- moving: {
- left: 300,
- top: 0
- }
- },
- width: 40,
- height: 30,
- frame: {
- moving: 1
- },
- forbidRotate: true,
- burstEffect: Burst.ReaverBurst
- }
-});
-Bullets.Interceptor = Bullets.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- duration: 1000,
- imgPos: {
- moving: {
- left: [120, 170, 220, 272, 272, 120, 120, 120, 120, 120],
- top: [582, 582, 582, 582, 582, 582, 582, 582, 582, 582]
- }
- },
- width: 44,
- height: 28,
- frame: {
- moving: 10
- },
- //Override cause damage timing
- noDamage: true,
- fire: function () {
- this.inherited.fire.call(this);
- var target = this.target;
- var owner = this.owner;
- Game.commandTimeout(function () {
- target.getDamageBy(owner);
- target.reactionWhenAttackedBy(owner);
- }, 500);
- }
- }
-});
-Bullets.DevilBall = Bullets.extends({
- constructorPlus: function (props) {
- this.life = this.traceTimes;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- duration: 300,
- imgPos: {
- moving: {
- left: 352,
- top: 442
- }
- },
- width: 20,
- height: 20,
- frame: {
- moving: 1
- },
- burstEffect: Burst.PurpleFog,
- //Delay fire for Dragoon and PhotonCannon
- fire: Bullets.DragoonBall.prototype.fire,
- //Chain tracing attack
- traceTimes: 4,
- traceRadius: 200,
- //Override
- noDamage: true,
- //Chain attack type
- die: Bullets.Darts.prototype.die
- }
-});
-//Mapping for apply, need to move it into Units.js
-Zerg.Drone.prototype.Bullet = Bullets.Spooge;
-Zerg.Hydralisk.prototype.Bullet = Bullets.Spooge;
-Zerg.Lurker.prototype.Bullet = Bullets.Thorn;
-Zerg.Mutalisk.prototype.Bullet = Bullets.Darts;
-Zerg.Guardian.prototype.Bullet = Bullets.GreenBall;
-Zerg.Devourer.prototype.Bullet = Bullets.PurpleCloud;
-Terran.Wraith.prototype.attackMode.flying.Bullet = Bullets.Missile;
-Terran.Wraith.prototype.attackMode.ground.Bullet = Bullets.SmallLaser;
-Terran.BattleCruiser.prototype.Bullet = Bullets.Laser;
-Terran.Firebat.prototype.Bullet = Bullets.Flame;
-Terran.Vulture.prototype.Bullet = Bullets.VultureBall;
-Terran.Goliath.prototype.attackMode.flying.Bullet = Bullets.LongMissile;
-Terran.Valkyrie.prototype.Bullet = Bullets.MultipleMissile;
-Protoss.Dragoon.prototype.Bullet = Bullets.DragoonBall;
-Protoss.Archon.prototype.Bullet = Bullets.ArchonLightening;
-Protoss.Reaver.prototype.Bullet = Bullets.ReaverBomb;
-Protoss.Scout.prototype.attackMode.flying.Bullet = Bullets.ScoutMissile;
-Protoss.Arbiter.prototype.Bullet = Bullets.DragoonBall;
-Protoss.Carrier.prototype.Bullet = Bullets.Interceptor;
-Hero.HeroCruiser.prototype.Bullet = Bullets.Yamato;
-Hero.DevilHunter.prototype.Bullet = Bullets.DevilBall;
-Building.ZergBuilding.SporeColony.prototype.Bullet = Bullets.Spore;
-Building.TerranBuilding.MissileTurret.prototype.Bullet = Bullets.SingleMissile;
-Building.ProtossBuilding.PhotonCannon.prototype.Bullet = Bullets.DragoonBall;
-//# sourceMappingURL=Bullets.js.map
\ No newline at end of file
diff --git a/Characters/Burst.js b/Characters/Burst.js
deleted file mode 100644
index 5f8b20c..0000000
--- a/Characters/Burst.js
+++ /dev/null
@@ -1,1545 +0,0 @@
-//One animation period which only play for a while and die
-var Burst = Gobj.extends({
- constructorPlus: function (props) {
- //Override if has props.scale
- if (props.scale)
- this.scale = props.scale;
- //Resize drawing by scale
- var times = this.scale ? (this.scale) : 1;
- //Behavior like effect on target
- if (props.target) {
- this.target = props.target;
- //Ahead of owner
- if (props.above)
- this.above = true;
- //Animation duration
- //Match owner size
- if (props.autoSize)
- this.autoSize = true;
- if (this.autoSize != null) {
- //Can mix autoSize with scale
- switch (this.autoSize) {
- case 'MAX':
- this.scale = Math.max(this.target.width, this.target.height) * 2 * times / (this.width + this.height);
- break;
- case 'MIN':
- this.scale = Math.min(this.target.width, this.target.height) * 2 * times / (this.width + this.height);
- break;
- default:
- this.scale = (this.target.width + this.target.height) * times / (this.width + this.height);
- }
- times = this.scale;
- }
- //Location
- this.x = (this.target.posX() - this.width * times / 2) >> 0;
- this.y = (this.target.posY() - this.height * times / 2) >> 0;
- //Onfire or bleed will have offset
- if (props.offset) {
- this.x += props.offset.x;
- this.y += props.offset.y;
- }
- }
- else {
- //Target location, from centerP to top-left
- this.x = props.x - this.width * times / 2;
- this.y = props.y - this.height * times / 2;
- }
- //Play duration
- if (this.forever)
- this.duration = -1; //Keep playing until killed
- if (props.duration != null)
- this.duration = props.duration; //Override duration
- //Restore callback after burst finish
- if (props.callback)
- this.callback = props.callback;
- //By default it will burst
- this.burst();
- //Will show after constructed
- Burst.allEffects.push(this);
- },
- prototypePlus: {
- //Override Gobj method
- animeFrame: function () {
- //Animation play
- this.action++;
- //Override Gobj here, can have hidden frames
- 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;
- }
- //Update location here
- if (this.above && this.target) {
- //Update location: copied from constructor
- var times = this.scale ? (this.scale) : 1;
- this.x = (this.target.posX() - this.width * times / 2) >> 0;
- this.y = (this.target.posY() - this.height * times / 2) >> 0;
- }
- },
- burst: function () {
- this.status = "burst";
- //Start play burst animation
- var myself = this;
- var animateFrame = function () {
- //Only play animation, will not move
- myself.animeFrame();
- };
- this.allFrames['animate'] = animateFrame;
- //Will die(stop playing) after time limit arrive
- var duration = this.duration ? this.duration : (this.frame['burst'] * 100);
- //Last forever if duration<0 (-1)
- if (duration > 0) {
- Game.commandTimeout(function () {
- myself.die();
- }, duration);
- }
- },
- die: function () {
- //Run callback when burst die
- if (this.callback)
- this.callback();
- Gobj.prototype.die.call(this);
- }
- }
-});
-//All burst effects here for show
-Burst.allEffects = [];
-//Define different bursts
-Burst.GreenFog = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/GreenFog.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- imgPos: {
- burst: {
- left: [8, 68, 134, 198, 263, 8, 68, 134, 198, 263],
- top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
- }
- },
- width: 52,
- height: 57,
- frame: {
- burst: 10
- }
- }
-});
-Burst.Parasite = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Parasite.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- imgPos: {
- burst: {
- left: [8, 68, 134, 198, 263, 8, 68, 134, 198, 263],
- top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
- }
- },
- width: 52,
- height: 57,
- frame: {
- burst: 10
- }
- }
-});
-Burst.Spore = Burst.extends({
- constructorPlus: function (props) {
- //No sound
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- imgPos: {
- burst: {
- left: [8, 68, 134, 198, 263, 8, 68, 134, 198, 263],
- top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
- }
- },
- width: 52,
- height: 57,
- frame: {
- burst: 10
- }
- }
-});
-Burst.GreenBallBroken = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/Greenball.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Guardian",
- imgPos: {
- burst: {
- left: [0, 56, 119, 182, 252, 322, 396, 470],
- top: [556, 556, 556, 556, 556, 556, 556, 556]
- }
- },
- width: 60,
- height: 60,
- frame: {
- burst: 8
- }
- }
-});
-Burst.PurpleCloudSpread = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/PurpleCloud.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Devourer",
- imgPos: {
- burst: {
- left: [17, 70, 122, 174, 230, 280, 335, 390, 452],
- top: [1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022]
- }
- },
- width: 50,
- height: 60,
- callback: function () {
- var chara = this.target;
- //Fix all spored issue
- if (chara.status == 'dead' || chara.status == null)
- return;
- //Effect:PurpleBuffer when cloud spread on target chara
- //Buffer flag, can add up
- if (chara.buffer.PurpleCloud == 9)
- return; //9 at max
- if (chara.buffer.PurpleCloud > 0)
- chara.buffer.PurpleCloud++;
- else
- chara.buffer.PurpleCloud = 1;
- //Decrease defense and slow down attack rate
- var bufferObj = {
- armor: chara.get('armor') - 1
- };
- if (chara.plasma != null)
- bufferObj.plasma = chara.get('plasma') - 1;
- if (chara.attackInterval)
- bufferObj.attackInterval = Math.round(chara.get('attackInterval') * 1.1);
- //Apply buffer
- chara.addBuffer(bufferObj);
- if (!chara.purpleBuffer)
- chara.purpleBuffer = [];
- chara.purpleBuffer.push(bufferObj);
- //Purple effect
- new Animation.PurpleEffect({ team: this.team, target: chara, callback: function () {
- //Restore in 30 seconds, Last In First Out
- if (chara.purpleBuffer && chara.removeBuffer(chara.purpleBuffer.pop())) {
- chara.buffer.PurpleCloud--;
- }
- //Full restore
- if (chara.buffer.PurpleCloud == 0) {
- delete chara.buffer.PurpleCloud;
- delete chara.purpleBuffer;
- }
- } });
- },
- frame: {
- burst: 9
- }
- }
-});
-Burst.Sunken = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/Sunken.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [46, 174, 302, 432, 560, 688],
- top: [626, 626, 626, 626, 626, 626]
- }
- },
- width: 28,
- height: 40,
- frame: {
- burst: 6
- }
- }
-});
-Burst.SmallFireSpark = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/FireSpark.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Wraith",
- imgPos: {
- burst: {
- left: [64, 106, 64],
- top: [132, 132, 132]
- }
- },
- width: 32,
- height: 30,
- frame: {
- burst: 3
- }
- }
-});
-Burst.FireSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ghost",
- imgPos: {
- burst: {
- left: [0, 38, 76, 114, 152, 190, 228, 266, 304, 342],
- top: [596, 596, 596, 596, 596, 596, 596, 596, 596, 596]
- }
- },
- width: 38,
- height: 36,
- frame: {
- burst: 10
- }
- }
-});
-Burst.FireSparkSound = Burst.FireSpark.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/FireSpark.burst.wav').play();
- },
- prototypePlus: {}
-});
-Burst.LaserSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [18, 70, 128, 182],
- top: [50, 50, 50, 50]
- }
- },
- width: 30,
- height: 30,
- frame: {
- burst: 4
- }
- }
-});
-Burst.VultureSpark = Burst.LaserSpark.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/VultureSpark.burst.wav').play();
- },
- prototypePlus: {}
-});
-Burst.HydraSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Hydralisk",
- imgPos: {
- burst: {
- left: [0, 34, 68, 102, 136, 170, 204, 238],
- top: [801, 801, 801, 801, 801, 801, 801, 801]
- }
- },
- width: 34,
- height: 35,
- frame: {
- burst: 8
- }
- }
-});
-Burst.CorsairCloud = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [5, 57],
- top: [576, 576]
- }
- },
- width: 40,
- height: 44,
- frame: {
- burst: 2
- }
- }
-});
-Burst.ArchonBurst = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [0, 80, 160, 240, 320, 400],
- top: [779, 779, 779, 779, 779, 779]
- }
- },
- width: 80,
- height: 80,
- frame: {
- burst: 6
- }
- }
-});
-Burst.DragoonBallBroken = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/DragoonBall.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [0, 40, 80, 120, 160, 200, 240, 280, 320, 360, 400, 440, 480, 520],
- top: [891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891, 891]
- }
- },
- width: 38,
- height: 40,
- frame: {
- burst: 14
- }
- }
-});
-Burst.ShootSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [0, 40, 80, 120, 160, 200, 240, 280, 320, 360],
- top: [1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011, 1011]
- }
- },
- width: 40,
- height: 40,
- frame: {
- burst: 10
- }
- }
-});
-Burst.BlueShootSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [32, 64, 96, 128, 160, 192, 224, 256],
- top: [1115, 1115, 1115, 1115, 1115, 1115, 1115, 1115]
- }
- },
- width: 32,
- height: 32,
- frame: {
- burst: 8
- }
- }
-});
-Burst.SCVSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [0, 48, 96, 144, 192, 240, 288, 336, 384, 432],
- top: [1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147, 1147]
- }
- },
- width: 48,
- height: 48,
- frame: {
- burst: 10
- }
- }
-});
-Burst.ProbeSpark = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [0, 48, 96, 144, 192, 240, 288],
- top: [672, 672, 672, 672, 672, 672, 672]
- }
- },
- width: 48,
- height: 32,
- frame: {
- burst: 7
- }
- }
-});
-Burst.ReaverBurst = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/ReaverBomb.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Burst",
- imgPos: {
- burst: {
- left: [0, 80, 160, 240, 320, 400, 480, 560, 640, 720],
- top: [931, 931, 931, 931, 931, 931, 931, 931, 931, 931]
- }
- },
- width: 78,
- height: 64,
- frame: {
- burst: 10
- }
- }
-});
-Burst.PurpleFog = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/ReaverBomb.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- imgPos: {
- burst: {
- left: [338, 398, 464, 528, 593, 338, 398, 464, 528, 593],
- top: [468, 468, 468, 468, 468, 532, 532, 532, 532, 532]
- }
- },
- width: 52,
- height: 57,
- frame: {
- burst: 10
- }
- }
-});
-Burst.InfestedBomb = Burst.extends({
- constructorPlus: function (props) {
- //Has burst sound effect
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/ReaverBomb.burst.wav').play();
- },
- prototypePlus: {
- //Add basic unit info
- name: "InfestedTerran",
- imgPos: {
- burst: {
- left: [0, 78, 156, 234, 312, 0, 78, 156, 234, 312],
- top: [432, 432, 432, 432, 432, 496, 496, 496, 496, 496]
- }
- },
- width: 78,
- height: 64,
- frame: {
- burst: 10
- }
- }
-});
-Burst.ScourgeBomb = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Scourge",
- imgPos: {
- burst: {
- left: [0, 52, 104, 156, 208, 260, 312, 364, 416],
- top: [218, 218, 218, 218, 218, 218, 218, 218, 218]
- }
- },
- width: 52,
- height: 46,
- frame: {
- burst: 9
- }
- }
-});
-Burst.SmallExplode = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [56, 156, 256, 360],
- top: [1686, 1686, 1686, 1686]
- }
- },
- width: 80,
- height: 60,
- frame: {
- burst: 4
- }
- }
-});
-Burst.MiddleExplode = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [44, 192, 342, 498],
- top: [1754, 1754, 1754, 1754]
- }
- },
- width: 120,
- height: 90,
- frame: {
- burst: 4
- }
- }
-});
-Burst.BigExplode = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [26, 226, 424, 632],
- top: [1846, 1846, 1846, 1846]
- }
- },
- width: 160,
- height: 120,
- frame: {
- burst: 4
- }
- }
-});
-Burst.SmallBlueExplode = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [50, 150, 250, 356],
- top: [1424, 1424, 1424, 1424]
- }
- },
- width: 80,
- height: 60,
- frame: {
- burst: 4
- }
- }
-});
-Burst.MiddleBlueExplode = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [36, 184, 338, 494],
- top: [1484, 1484, 1484, 1484]
- }
- },
- width: 120,
- height: 90,
- frame: {
- burst: 4
- }
- }
-});
-Burst.BigBlueExplode = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [22, 222, 420, 632],
- top: [1566, 1566, 1566, 1566]
- }
- },
- width: 160,
- height: 120,
- frame: {
- burst: 4
- }
- }
-});
-Burst.ZergBuildingBurst = Burst.extends({
- constructorPlus: function (props) {
- //Need clear mud when ZergBuildingBurst finished
- this.callback = function () {
- Map.needRefresh = "MAP";
- };
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [0, 200, 400, 600, 800, 0, 200, 400, 600, 800, 0, 200, 400, 400, 600, 600, 800, 800],
- top: [0, 0, 0, 0, 0, 200, 200, 200, 200, 200, 400, 400, 400, 400, 400, 400, 400, 400]
- }
- },
- width: 200,
- height: 200,
- frame: {
- burst: 18
- }
- }
-});
-Burst.TerranBuildingBurst = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [0, 0, 200, 200, 400, 400, 600, 600, 800, 800, 0, 0, 200, 200, 400, 400, 600, 600],
- top: [600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 800, 800, 800, 800, 800, 800, 800, 800]
- }
- },
- width: 200,
- height: 200,
- frame: {
- burst: 18
- }
- }
-});
-Burst.ProtossBuildingBurst = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "BuildingBurst",
- imgPos: {
- burst: {
- left: [0, 0, 200, 200, 400, 400, 600, 600, 800, 800, 0, 0, 200, 200, 400, 400, 600, 600],
- top: [1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1200, 1200, 1200, 1200, 1200, 1200, 1200, 1200]
- }
- },
- width: 200,
- height: 200,
- frame: {
- burst: 18
- }
- }
-});
-Burst.HumanDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Civilian",
- imgPos: {
- burst: {
- left: [6, 58, 106, 158, 6, 54, 102, 152],
- top: [286, 286, 286, 286, 320, 320, 320, 320]
- }
- },
- width: 42,
- height: 30,
- frame: {
- burst: 8
- }
- }
-});
-Burst.MedicDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Medic",
- imgPos: {
- burst: {
- left: [0, 64, 128, 192, 256, 320, 384, 448],
- top: [832, 832, 832, 832, 832, 832, 832, 832]
- }
- },
- width: 64,
- height: 64,
- frame: {
- burst: 8
- }
- }
-});
-Burst.SmallZergFlyingDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- imgPos: {
- burst: {
- left: [71, 143, 215, 283, 355, 432, 502],
- top: [372, 372, 372, 372, 372, 372, 372]
- }
- },
- width: 64,
- height: 62,
- frame: {
- burst: 7
- }
- }
-});
-Burst.BigZergFlyingDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Devourer",
- imgPos: {
- burst: {
- left: [0, 114, 228, 342, 456, 570, 684, 798],
- top: [860, 860, 860, 860, 860, 860, 860, 860]
- }
- },
- width: 114,
- height: 102,
- frame: {
- burst: 8
- }
- }
-});
-Burst.DroneDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Drone",
- imgPos: {
- burst: {
- left: [0, 128, 256, 384, 512, 640, 768, 896],
- top: [1280, 1280, 1280, 1280, 1280, 1280, 1280, 1280]
- }
- },
- width: 128,
- height: 128,
- frame: {
- burst: 8
- }
- }
-});
-Burst.ZerglingDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Zergling",
- imgPos: {
- burst: {
- left: [0, 68, 136, 204, 272, 340, 408],
- top: [506, 506, 506, 506, 506, 506, 506]
- }
- },
- width: 68,
- height: 55,
- frame: {
- burst: 7
- }
- }
-});
-Burst.HydraliskDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Hydralisk",
- imgPos: {
- burst: {
- left: [0, 66, 132, 198, 264, 330, 396, 462, 528, 594, 660, 726],
- top: [704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704, 704]
- }
- },
- width: 66,
- height: 50,
- frame: {
- burst: 12
- }
- }
-});
-Burst.LurkerDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Lurker",
- imgPos: {
- burst: {
- left: [85, 170, 255, 340, 0, 85, 170, 255, 340],
- top: [582, 582, 582, 582, 646, 646, 646, 646, 646]
- }
- },
- width: 85,
- height: 64,
- frame: {
- burst: 9
- }
- }
-});
-Burst.UltraliskDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ultralisk",
- imgPos: {
- burst: {
- left: [0, 101, 202, 303, 404, 505, 606, 707, 808, 909],
- top: [1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620, 1620]
- }
- },
- width: 101,
- height: 108,
- frame: {
- burst: 10
- }
- }
-});
-Burst.DefilerDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Defiler",
- imgPos: {
- burst: {
- left: [0, 70, 140, 210, 280, 350, 420, 490, 560, 630],
- top: [558, 558, 558, 558, 558, 558, 558, 558, 558, 558]
- }
- },
- width: 70,
- height: 46,
- frame: {
- burst: 10
- }
- }
-});
-Burst.BroodlingDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Queen",
- imgPos: {
- burst: {
- left: [0, 40, 80, 120, 160],
- top: [782, 782, 782, 782, 782]
- }
- },
- width: 40,
- height: 22,
- frame: {
- burst: 5
- }
- }
-});
-Burst.LarvaDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 50, 100, 150, 200, 250, 300, 350, 400],
- top: [146, 146, 146, 146, 146, 146, 146, 146, 146]
- }
- },
- width: 50,
- height: 26,
- frame: {
- burst: 9
- }
- }
-});
-Burst.EggDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 70, 140, 210, 280, 350, 0, 70, 140, 210, 280, 350],
- top: [254, 254, 254, 254, 254, 254, 312, 312, 312, 312, 312, 312]
- }
- },
- width: 70,
- height: 59,
- frame: {
- burst: 12
- }
- }
-});
-Burst.EggBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [2, 38, 74, 110, 146, 182, 218, 254],
- top: [372, 372, 372, 372, 372, 372, 372, 372]
- }
- },
- width: 36,
- height: 40,
- frame: {
- burst: 8
- }
- }
-});
-Burst.DroneBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [1, 68, 135, 202, 269, 336, 403],
- top: [442, 442, 442, 442, 442, 442, 442]
- }
- },
- width: 67,
- height: 44,
- frame: {
- burst: 7
- }
- }
-});
-Burst.OverlordBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 63, 126, 189, 252, 315, 378],
- top: [486, 486, 486, 486, 486, 486, 486]
- }
- },
- width: 63,
- height: 95,
- frame: {
- burst: 7
- }
- }
-});
-Burst.ZerglingBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 59, 118, 177, 236, 295, 354],
- top: [582, 582, 582, 582, 582, 582, 582]
- }
- },
- width: 59,
- height: 45,
- frame: {
- burst: 7
- }
- }
-});
-Burst.HydraliskBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 63, 126, 189, 252, 315, 378],
- top: [666, 666, 666, 666, 666, 666, 666]
- }
- },
- width: 63,
- height: 45,
- frame: {
- burst: 7
- }
- }
-});
-Burst.MutaliskBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 66, 132, 198, 264, 330, 396],
- top: [712, 712, 712, 712, 712, 712, 712]
- }
- },
- width: 66,
- height: 88,
- frame: {
- burst: 7
- }
- }
-});
-Burst.ScourgeBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 62, 124, 186, 248, 310, 372],
- top: [798, 798, 798, 798, 798, 798, 798]
- }
- },
- width: 62,
- height: 70,
- frame: {
- burst: 7
- }
- }
-});
-Burst.QueenBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 62, 124, 186, 248, 310, 372],
- top: [867, 867, 867, 867, 867, 867, 867]
- }
- },
- width: 62,
- height: 84,
- frame: {
- burst: 7
- }
- }
-});
-Burst.UltraliskBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 72, 144, 216, 288, 360, 432],
- top: [950, 950, 950, 950, 950, 950, 950]
- }
- },
- width: 72,
- height: 60,
- frame: {
- burst: 7
- }
- }
-});
-Burst.DefilerBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- burst: {
- left: [0, 64, 128, 192, 256, 320, 384],
- top: [1011, 1011, 1011, 1011, 1011, 1011, 1011]
- }
- },
- width: 64,
- height: 48,
- frame: {
- burst: 7
- }
- }
-});
-Burst.LurkerBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Lurker",
- imgPos: {
- burst: {
- left: [650, 722, 794, 866, 938, 1010, 1082],
- top: [480, 480, 480, 480, 480, 480, 480]
- }
- },
- width: 72,
- height: 67,
- frame: {
- burst: 7
- }
- }
-});
-Burst.GuardianBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Guardian",
- imgPos: {
- burst: {
- left: [656, 737, 818, 899, 980, 1061],
- top: [538, 538, 538, 538, 538, 538]
- }
- },
- width: 81,
- height: 74,
- frame: {
- burst: 6
- }
- }
-});
-Burst.DevourerBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Devourer",
- imgPos: {
- burst: {
- left: [666, 764, 862, 960, 1058, 1156],
- top: [998, 998, 998, 998, 998, 998]
- }
- },
- width: 73,
- height: 86,
- frame: {
- burst: 6
- }
- }
-});
-Burst.SmallProtossDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Zealot",
- imgPos: {
- burst: {
- left: [0, 57, 114, 171, 228, 285, 342],
- top: [575, 575, 575, 575, 575, 575, 575]
- }
- },
- width: 57,
- height: 84,
- frame: {
- burst: 7
- }
- }
-});
-Burst.DragoonDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Dragoon",
- imgPos: {
- burst: {
- left: [15, 111, 207, 303, 399, 495, 591],
- top: [591, 591, 591, 591, 591, 591, 591]
- }
- },
- width: 57,
- height: 84,
- frame: {
- burst: 7
- }
- }
-});
-Burst.TemplarDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Templar",
- imgPos: {
- burst: {
- left: [30, 158, 286, 414, 542, 670],
- top: [2078, 2078, 2078, 2078, 2078, 2078]
- }
- },
- width: 57,
- height: 84,
- frame: {
- burst: 6
- }
- }
-});
-Burst.HallucinationDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Magic",
- imgPos: {
- burst: {
- left: [514, 593, 672, 514, 593, 672, 514, 593, 672, 514, 593, 672],
- top: [460, 460, 460, 526, 526, 526, 592, 592, 592, 658, 658, 658]
- }
- },
- width: 79,
- height: 66,
- frame: {
- burst: 12
- }
- }
-});
-Burst.ArchonBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "Archon",
- imgPos: {
- burst: {
- left: [20, 140, 260, 380, 500, 620, 740, 860, 980],
- top: [1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700]
- }
- },
- width: 80,
- height: 80,
- frame: {
- burst: 9
- }
- }
-});
-Burst.DarkArchonBirth = Burst.extends({
- constructorPlus: function (props) {
- //Mixin
- },
- prototypePlus: {
- //Add basic unit info
- name: "DarkArchon",
- imgPos: {
- burst: {
- left: [20, 140, 260, 380, 500, 620, 740, 860, 980],
- top: [1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220]
- }
- },
- width: 80,
- height: 80,
- frame: {
- burst: 9
- }
- }
-});
-Burst.RagnasaurDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ragnasaur",
- imgPos: {
- burst: {
- left: [0, 104, 208, 312, 416, 520, 624, 728],
- top: [936, 936, 936, 936, 936, 936, 936, 936]
- }
- },
- width: 128,
- height: 128,
- frame: {
- burst: 8
- }
- }
-});
-Burst.RhynsdonDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Rhynsdon",
- imgPos: {
- burst: {
- left: [0, 104, 208, 312, 416, 520, 624, 728],
- top: [1144, 1144, 1144, 1144, 1144, 1144, 1144, 1144]
- }
- },
- width: 104,
- height: 128,
- frame: {
- burst: 8
- }
- }
-});
-Burst.UrsadonDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ursadon",
- imgPos: {
- burst: {
- left: [0, 92, 184, 276, 368, 460, 552, 644],
- top: [736, 736, 736, 736, 736, 736, 736, 736]
- }
- },
- width: 92,
- height: 92,
- frame: {
- burst: 8
- }
- }
-});
-Burst.BengalaasDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Bengalaas",
- imgPos: {
- burst: {
- left: [0, 128, 256, 384, 512, 640, 768, 896],
- top: [1536, 1536, 1536, 1536, 1536, 1536, 1536, 1536]
- }
- },
- width: 128,
- height: 128,
- frame: {
- burst: 8
- }
- }
-});
-Burst.ScantidDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Scantid",
- imgPos: {
- burst: {
- left: [0, 92, 184, 276, 368, 460, 552, 644],
- top: [1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104]
- }
- },
- width: 92,
- height: 92,
- frame: {
- burst: 8
- }
- }
-});
-Burst.KakaruDeath = Burst.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Kakaru",
- imgPos: {
- burst: {
- left: [0, 92, 184, 276, 368, 460, 552, 644],
- top: [1104, 1104, 1104, 1104, 1104, 1104, 1104, 1104]
- }
- },
- width: 92,
- height: 92,
- frame: {
- burst: 8
- }
- }
-});
-//# sourceMappingURL=Burst.js.map
\ No newline at end of file
diff --git a/Characters/Button.js b/Characters/Button.js
deleted file mode 100644
index b35deda..0000000
--- a/Characters/Button.js
+++ /dev/null
@@ -1,770 +0,0 @@
-var Button = {
- callback: null,
- /***************Functions***************/
- reset: function () {
- Game.changeSelectedTo(Game.selectedUnit);
- },
- refreshButtons: function () {
- Button.equipButtonsFor(Game.selectedUnit);
- },
- //Equip all buttons for unit
- equipButtonsFor: function (chara) {
- //Clear all buttons
- $('div.panel_Control button').removeAttr('class').removeAttr('disabled').removeAttr('style').off('click').off('mouseover').off('mouseout').html('').hide();
- //Filter out enemy
- if (chara == {} || (chara.isEnemy && chara.isEnemy()))
- return;
- //Add button press sound
- $('div.panel_Control button').on('click', function () {
- Referee.voice('button').play();
- });
- //Show buttons
- if (chara instanceof Unit) {
- $('button[num="1"]').attr('class', 'move').show();
- $('button[num="2"]').attr('class', 'stop').show();
- $('button[num="4"]').attr('class', 'patrol').show();
- $('button[num="5"]').attr('class', 'hold').show();
- if (Game.selectedUnit.hold)
- $('button.hold').css('border-color', 'red'); //Add for hold tag
- //Bind callbacks
- $('button.move').on('click', Button.moveHandler);
- $('button.patrol').on('click', Button.patrolHandler);
- $('button.stop').on('click', function () {
- Button.stopHandler();
- });
- $('button.hold').on('click', function () {
- Button.holdHandler();
- });
- }
- if (chara.attack) {
- $('button[num="3"]').attr('class', 'attack').show();
- $('button.attack').on('click', Button.attackHandler);
- }
- //Add items
- if (chara.items) {
- for (var N in chara.items) {
- if (chara.items[N] != null) {
- $('button[num="' + N + '"]').off('click').attr('class', chara.items[N].name).show();
- if (chara.items[N].condition && !(chara.items[N].condition()))
- $('button[num="' + N + '"]').attr('disabled', true);
- else
- $('button[num="' + N + '"]').removeAttr('disabled');
- //Exceptions: need mark numbers on button
- switch (chara.items[N].name) {
- case 'SpiderMines':
- $('button[num="' + N + '"]')[0].innerHTML = chara.spiderMines;
- break;
- case 'Scarab':
- $('button[num="' + N + '"]')[0].innerHTML = chara.scarabNum;
- break;
- case 'Interceptor':
- $('button[num="' + N + '"]')[0].innerHTML = chara.continuousAttack.count;
- break;
- }
- }
- else {
- $('button[num="' + N + '"]').removeAttr('class').hide();
- }
- }
- //Bind basic callbacks
- $('button.Cancel').on('click', function () {
- //Reset menu
- Button.refreshButtons();
- });
- $('button.SelectLarva').on('click', function () {
- var larvas = Game.selectedUnit.larvas;
- if (larvas) {
- larvas = larvas.filter(function (chara) {
- return chara.status != 'dead';
- });
- //If found alive larva
- if (larvas.length) {
- Game.unselectAll();
- Game.addIntoAllSelected(larvas, true);
- if (larvas[0] instanceof Gobj) {
- Game.changeSelectedTo(larvas[0]);
- //Sound effect
- larvas[0].sound.selected.play();
- }
- }
- }
- });
- $('button.BasicMutation').on('click', function () {
- Button.equipButtonsFor(Button.basicZergMutations);
- });
- $('button.AdvancedMutation').on('click', function () {
- Button.equipButtonsFor(Button.advancedZergMutations);
- });
- $('button.BasicBuilding').on('click', function () {
- Button.equipButtonsFor(Button.basicTerranBuildings);
- });
- $('button.AdvancedBuilding').on('click', function () {
- Button.equipButtonsFor(Button.advancedTerranBuildings);
- });
- $('button.BasicStructure').on('click', function () {
- Button.equipButtonsFor(Button.basicProtossStructures);
- });
- $('button.AdvancedStructure').on('click', function () {
- Button.equipButtonsFor(Button.advancedProtossStructures);
- });
- //Upgrade callbacks
- var upgrades = [];
- for (var grade in Upgrade) {
- upgrades.push(grade);
- } //Cannot use for-in bind together
- upgrades.forEach(function (grade) {
- $('button.' + grade).on('click', function () {
- //Filter out when occupied
- if (Game.selectedUnit.processing)
- return;
- //Need time
- if (Resource.getCost(grade) && Resource.getCost(grade).time) {
- var owner = Game.selectedUnit;
- var duration = Resource.getCost(grade).time;
- //User move record
- Multiplayer.cmds.push(JSON.stringify({
- uids: [owner.id],
- type: 'upgrade',
- name: grade,
- duration: duration,
- team: Game.team
- }));
- }
- else {
- Multiplayer.cmds.push(JSON.stringify({
- team: Game.team,
- type: 'upgrade',
- name: grade
- }));
- }
- });
- });
- //Magic callbacks
- var magics = [];
- for (var magic in Magic) {
- magics.push(magic);
- } //Cannot use for-in bind together
- var hasMagic = function (chara, magic) {
- if (chara.items) {
- for (var attr in chara.items) {
- if (chara.items[attr] && chara.items[attr].name == magic) {
- if (chara.items[attr].condition) {
- if (chara.items[attr].condition())
- return true;
- }
- else
- return true;
- }
- }
- }
- return false;
- };
- magics.forEach(function (magic) {
- $('button.' + magic).on('click', function () {
- var duration = Resource.getCost(magic) ? (Resource.getCost(magic).time) : 0;
- Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
- return (chara.team == Game.team && chara.selected && hasMagic(chara, magic));
- }).forEach(function (chara) {
- //For Scarab and Interceptor
- if (duration) {
- //Filter out when occupied
- if (chara.processing)
- return;
- Multiplayer.cmds.push(JSON.stringify({
- uids: [chara.id],
- type: 'magic',
- name: magic,
- duration: duration
- }));
- }
- else {
- //Pay by credit card
- if (Magic[magic].credit)
- chara.creditBill = Resource.getCost(magic);
- //Execute magic immediately
- if (!(Magic[magic].credit || Magic[magic].needLocation)) {
- Multiplayer.cmds.push(JSON.stringify({
- uids: [chara.id],
- type: 'magic',
- name: magic
- }));
- }
- else {
- //Payment: chara paypal cost
- if (Resource.paypal.call(chara, Resource.getCost(magic))) {
- Magic[magic].spell.call(chara);
- }
- }
- }
- });
- });
- });
- //Unit callbacks:
- //For Zerg units
- var unitTypes = [];
- for (var unitType in Zerg) {
- unitTypes.push(unitType);
- }
- var exceptions = ['Guardian', 'Devourer'];
- unitTypes.forEach(function (unitType) {
- $('button.' + unitType).on('click', function () {
- //Calculate duration
- var duration = Resource.getCost(unitType).time;
- Unit.allUnits.filter(function (chara) {
- return (chara.team == Game.team && chara.selected && chara.name == Game.selectedUnit.name);
- }).forEach(function (chara) {
- Multiplayer.cmds.push(JSON.stringify({
- uids: [chara.id],
- type: 'unit',
- name: unitType,
- duration: duration,
- evolve: 'zerg'
- }));
- });
- });
- });
- //For Terran and Protoss units, add InfestedTerran
- [Terran, Protoss, { InfestedTerran: Zerg.InfestedTerran }].forEach(function (Race) {
- var unitTypes = [];
- for (var unitType in Race) {
- unitTypes.push(unitType);
- } //Cannot use for-in bind together
- var exceptions = ['Archon', 'DarkArchon'];
- unitTypes.forEach(function (unitType) {
- //Unit type isn't in exceptions
- if (exceptions.indexOf(unitType) == -1) {
- $('button.' + unitType).on('click', function () {
- //Filter out when occupied
- if (Game.selectedUnit.processing)
- return;
- //Need time
- if (Resource.getCost(unitType) && Resource.getCost(unitType).time) {
- var owner = Game.selectedUnit;
- var duration = Resource.getCost(unitType).time;
- Multiplayer.cmds.push(JSON.stringify({
- uids: [owner.id],
- type: 'unit',
- name: unitType,
- duration: duration
- }));
- }
- });
- }
- else {
- $('button.' + unitType).on('click', function () {
- //Calculate duration
- var duration = Resource.getCost(unitType).time;
- Unit.allUnits.filter(function (chara) {
- return (chara.team == Game.team && chara.selected && chara.name == Game.selectedUnit.name);
- }).forEach(function (chara) {
- //Filter out when occupied
- if (chara.processing)
- return;
- Multiplayer.cmds.push(JSON.stringify({
- uids: [chara.id],
- type: 'unit',
- name: unitType,
- duration: duration,
- evolve: 'archon'
- }));
- });
- });
- }
- });
- });
- //Building callbacks
- var evolvedBuildings = ['Lair', 'Hive', 'SunkenColony', 'SporeColony', 'GreaterSpire',
- 'ComstatStation', 'NuclearSilo', 'MachineShop', 'ControlTower', 'PhysicsLab', 'ConvertOps'];
- ['ZergBuilding', 'TerranBuilding', 'ProtossBuilding'].forEach(function (BuildType) {
- var Build = Building[BuildType];
- var buildNames = [];
- for (var buildName in Build) {
- //Filter out noise
- if (buildName != 'inherited' && buildName != 'super' && buildName != 'extends') {
- buildNames.push(buildName);
- }
- }
- buildNames.forEach(function (buildName) {
- $('button.' + buildName).on('click', function () {
- //Pay by credit card if not evolved building
- if (evolvedBuildings.indexOf(buildName) == -1) {
- Game.selectedUnit.creditBill = Resource.getCost(buildName);
- //Payment: chara paypal cost
- if (Resource.paypal.call(Game.selectedUnit, Resource.getCost(buildName))) {
- Game.selectedUnit.buildName = buildName;
- Game.selectedUnit['build' + BuildType]();
- }
- }
- else {
- Multiplayer.cmds.push(JSON.stringify({
- uids: [Game.selectedUnit.id],
- type: 'build',
- name: buildName,
- buildType: BuildType
- }));
- }
- });
- });
- });
- }
- //Bind tooltip callbacks
- $('div.panel_Control button').on('mouseover', function (event) {
- var _name = this.className;
- $('div.tooltip_Box').css('right', innerWidth - event.clientX).css('bottom', innerHeight - event.clientY).show();
- $('div.tooltip_Box div.itemName')[0].innerHTML = _name;
- var cost = Resource.getCost(_name);
- if (cost) {
- $('div.cost').show();
- ['mine', 'gas', 'man', 'magic'].forEach(function (res) {
- if (cost[res]) {
- $('div.cost *[class*=' + res + ']').show();
- $('div.cost span.' + res + 'Num')[0].innerHTML = cost[res];
- }
- else
- $('div.cost *[class*=' + res + ']').hide();
- });
- }
- });
- $('div.panel_Control button').on('mouseout', function () {
- $('div.tooltip_Box').hide();
- $('div.tooltip_Box div.cost').hide();
- $('div.tooltip_Box div.itemName')[0].innerHTML = '';
- ['mine', 'gas', 'man', 'magic'].forEach(function (res) {
- $('div.cost span.' + res + 'Num')[0].innerHTML = '';
- });
- });
- },
- equipButtonsForReplay: function () {
- $('button[num="1"]').attr('class', 'Play').attr('disabled', true).show();
- $('button[num="2"]').attr('class', 'Pause').show();
- $('button[num="4"]').attr('class', 'SpeedUp').show();
- $('button[num="5"]').attr('class', 'SlowDown').show();
- //Bind callback for replay buttons
- $('button.Play').on('click', Button.playHandler);
- $('button.Pause').on('click', Button.pauseHandler);
- $('button.SpeedUp').on('click', Button.speedUpHandler);
- $('button.SlowDown').on('click', Button.slowDownHandler);
- //Bind tooltip callbacks
- $('div.panel_Control button').on('mouseover', function (event) {
- $('div.tooltip_Box').css('right', innerWidth - event.clientX).css('bottom', innerHeight - event.clientY).show();
- $('div.tooltip_Box div.itemName')[0].innerHTML = this.className;
- });
- $('div.panel_Control button').on('mouseout', function () {
- $('div.tooltip_Box').hide();
- $('div.tooltip_Box div.itemName')[0].innerHTML = '';
- });
- },
- /***************Buttons***************/
- basicZergMutations: {
- items: {
- '1': { name: 'Hatchery' },
- '2': { name: 'CreepColony', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
- });
- } },
- '3': { name: 'Extractor', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
- });
- } },
- '4': { name: 'SpawningPool', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
- });
- } },
- '5': { name: 'EvolutionChamber', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Hatchery' || chara.name == 'Lair' || chara.name == 'Hive');
- });
- } },
- '7': { name: 'HydraliskDen', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'SpawningPool';
- });
- } },
- '9': { name: 'Cancel' }
- }
- },
- advancedZergMutations: {
- items: {
- '1': { name: 'Spire', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Lair' || chara.name == 'Hive');
- });
- } },
- '2': { name: 'QueenNest', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Lair' || chara.name == 'Hive');
- });
- } },
- '3': { name: 'NydusCanal', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && (chara.name == 'Hive');
- });
- } },
- '4': { name: 'UltraliskCavern', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Hive';
- });
- } },
- '5': { name: 'DefilerMound', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Hive';
- });
- } },
- '9': { name: 'Cancel' }
- }
- },
- basicTerranBuildings: {
- items: {
- '1': { name: 'CommandCenter' },
- '2': { name: 'SupplyDepot', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CommandCenter';
- });
- } },
- '3': { name: 'Refinery', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CommandCenter';
- });
- } },
- '4': { name: 'Barracks', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CommandCenter';
- });
- } },
- '5': { name: 'EngineeringBay', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CommandCenter';
- });
- } },
- '6': { name: 'MissileTurret', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'EngineeringBay';
- });
- } },
- '7': { name: 'Academy', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Barracks';
- });
- } },
- '8': { name: 'Bunker', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Barracks';
- });
- } },
- '9': { name: 'Cancel' }
- }
- },
- advancedTerranBuildings: {
- items: {
- '1': { name: 'Factory', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Barracks';
- });
- } },
- '2': { name: 'Starport', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Factory';
- });
- } },
- '3': { name: 'ScienceFacility', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Starport';
- });
- } },
- '4': { name: 'Armory', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Factory';
- });
- } },
- '9': { name: 'Cancel' }
- }
- },
- basicProtossStructures: {
- items: {
- '1': { name: 'Nexus' },
- '2': { name: 'Pylon', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Nexus';
- });
- } },
- '3': { name: 'Assimilator', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Nexus';
- });
- } },
- '4': { name: 'Gateway', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Nexus';
- });
- } },
- '5': { name: 'Forge', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Nexus';
- });
- } },
- '6': { name: 'PhotonCannon', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Forge';
- });
- } },
- '7': { name: 'CyberneticsCore', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Gateway';
- });
- } },
- '8': { name: 'ShieldBattery', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'Gateway';
- });
- } },
- '9': { name: 'Cancel' }
- }
- },
- advancedProtossStructures: {
- items: {
- '1': { name: 'RoboticsFacility', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CyberneticsCore';
- });
- } },
- '2': { name: 'StarGate', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CyberneticsCore';
- });
- } },
- '3': { name: 'CitadelOfAdun', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CyberneticsCore';
- });
- } },
- '4': { name: 'RoboticsSupportBay', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'RoboticsFacility';
- });
- } },
- '5': { name: 'FleetBeacon', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'StarGate';
- });
- } },
- '6': { name: 'TemplarArchives', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'CitadelOfAdun';
- });
- } },
- '7': { name: 'Observatory', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'RoboticsFacility';
- });
- } },
- '8': { name: 'ArbiterTribunal', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'StarGate';
- }) && Building.allBuildings.some(function (chara) {
- return chara.team == Game.team && chara.name == 'TemplarArchives';
- });
- } },
- '9': { name: 'Cancel' }
- }
- },
- /***************Handlers***************/
- //Move button
- moveHandler: function () {
- if (Button.callback == null) {
- Button.callback = 'move';
- $('div.GameLayer').attr('status', 'button');
- }
- else {
- //Cancel handler
- $('div.GameLayer').removeAttr('status');
- Button.callback = null;
- }
- },
- //Stop button
- stopHandler: function (charas) {
- if (charas == null) {
- var charas = Unit.allUnits.filter(function (chara) {
- return chara.selected && chara.team == Game.team;
- });
- //Buffer pool
- Multiplayer.cmds.push(JSON.stringify({
- uids: Multiplayer.getUIDs(charas),
- type: 'stop'
- }));
- }
- else {
- charas.forEach(function (chara) {
- if (chara.attack)
- chara.stopAttack();
- chara.dock();
- //Interrupt old destination routing
- if (chara.destination) {
- //Break possible dead lock
- if (chara.destination.next)
- chara.destination.next = undefined;
- delete chara.destination;
- }
- });
- }
- },
- //Attack button
- attackHandler: function () {
- if (Button.callback == null) {
- Button.callback = 'attack';
- $('div.GameLayer').attr('status', 'button');
- }
- else {
- //Cancel handler
- $('div.GameLayer').removeAttr('status');
- Button.callback = null;
- }
- },
- //Patrol button
- patrolHandler: function () {
- if (Button.callback == null) {
- Button.callback = 'patrol';
- $('div.GameLayer').attr('status', 'button');
- }
- else {
- //Cancel handler
- $('div.GameLayer').removeAttr('status');
- Button.callback = null;
- }
- },
- //Hold button
- holdHandler: function (charas) {
- //Part A: Before get charas
- if (charas == null) {
- var charas = Unit.allUnits.filter(function (chara) {
- return chara.selected && chara.team == Game.team;
- });
- //Buffer pool
- Multiplayer.cmds.push(JSON.stringify({
- uids: Multiplayer.getUIDs(charas),
- type: 'hold'
- }));
- }
- else {
- Button.stopHandler(charas);
- //Freeze all units
- charas.forEach(function (chara) {
- if (chara.hold) {
- delete chara.AI;
- delete chara.findNearbyTargets;
- delete chara.hold;
- Button.refreshButtons();
- }
- else {
- if (chara.attack) {
- //Use the same AI as attackable building
- chara.AI = Building.Attackable.prototypePlus.AI;
- //Can only find target inside attack range instead of in sight
- chara.findNearbyTargets = Building.Attackable.prototypePlus.findNearbyTargets;
- }
- chara.dock();
- chara.hold = true;
- Button.refreshButtons();
- }
- });
- }
- },
- //Replay relative
- playHandler: function () {
- Game.startAnimation();
- $('button.Play').attr('disabled', true);
- $('button.Pause').attr('disabled', false);
- },
- pauseHandler: function () {
- Game.stopAnimation();
- $('button.Pause').attr('disabled', true);
- $('button.Play').attr('disabled', false);
- },
- speedUpHandler: function () {
- if (Game.replayFlag) {
- //Can speed up
- if (Game._frameInterval > 25) {
- Game._frameInterval /= 2;
- //Cannot speed up any more
- if (Game._frameInterval <= 25)
- $('button.SpeedUp').attr('disabled', true);
- //Need play speed refresh after speed up
- Game.stopAnimation();
- Button.playHandler();
- }
- //Enable SlowDown button
- $('button.SlowDown').attr('disabled', false);
- }
- },
- slowDownHandler: function () {
- if (Game.replayFlag) {
- //Can slow down
- if (Game._frameInterval < 400) {
- Game._frameInterval *= 2;
- //Cannot slow down any more
- if (Game._frameInterval >= 400)
- $('button.SlowDown').attr('disabled', true);
- //Need play speed refresh after slow down
- Game.stopAnimation();
- Button.playHandler();
- }
- //Enable SpeedUp button
- $('button.SpeedUp').attr('disabled', false);
- }
- },
- //Execute callback
- execute: function (event) {
- //Finish part II
- switch (Button.callback) {
- case 'move':
- mouseController.rightClick(event);
- break;
- case 'attack':
- mouseController.rightClick(event, true, 'attack');
- break;
- case 'patrol':
- mouseController.rightClick(event, true, 'patrol');
- break;
- default:
- if (typeof (Button.callback) == 'function') {
- //Mouse at (clickX,clickY)
- var offset = $('#fogCanvas').offset();
- var clickX = event.pageX - offset.left;
- var clickY = event.pageY - offset.top;
- var location = { x: clickX + Map.offsetX, y: clickY + Map.offsetY };
- //Show right click cursor
- new Burst.RightClickCursor(location);
- //Call back with location info
- //Farmer build buildings
- if (Button.callback.farmer) {
- Multiplayer.cmds.push(JSON.stringify({
- uids: [Button.callback.farmer.id],
- type: 'build',
- name: Button.callback.farmer.buildName,
- buildType: Button.callback.buildType,
- pos: location
- }));
- }
- else {
- var magicName = '';
- for (var magic in Magic) {
- if (Magic[magic].spell == Button.callback)
- magicName = magic;
- }
- Multiplayer.cmds.push(JSON.stringify({
- uids: [Button.callback.owner.id],
- type: 'magic',
- name: magicName,
- pos: location,
- creditBill: Button.callback.owner.creditBill
- }));
- }
- }
- }
- $('div.GameLayer').removeAttr('status');
- Button.callback = null;
- }
-};
-//# sourceMappingURL=Button.js.map
\ No newline at end of file
diff --git a/Characters/Gobj.js b/Characters/Gobj.js
deleted file mode 100644
index af797be..0000000
--- a/Characters/Gobj.js
+++ /dev/null
@@ -1,284 +0,0 @@
-//Gobj is original object used in StarCraft
-var Gobj = function (props) {
- this.x = props.x;
- this.y = props.y;
- if (props.target instanceof Gobj) {
- this.x = (props.target.posX() - this.width / 2) >> 0;
- this.y = (props.target.posY() - this.height / 2) >> 0;
- }
- this.action = 0; //Only for moving
- this.status = "";
- this.buffer = {}; //Buffer names
- this.override = {}; //Buffer effects
- this.bufferObjs = [];
- this.allFrames = {};
- this.team = props.team ? props.team : 0; //team 0 by default
-};
-//Default value used if not initialize properly
-Gobj.prototype.name = "Gobj";
-Gobj.prototype.width = 0;
-Gobj.prototype.height = 0;
-Gobj.prototype.isEnemy = function () {
- return this.team != Game.team;
-};
-Gobj.prototype.posX = function () {
- return this.x + this.width / 2;
-};
-Gobj.prototype.posY = function () {
- return this.y + this.height / 2;
-};
-Gobj.prototype.imgPos = {
- moving: {
- left: [0, 0, 0, 0, 0, 0, 0, 0],
- top: [0, 0, 0, 0, 0, 0, 0, 0]
- }
-};
-//Only for moving
-Gobj.prototype.frame = {
- moving: 1
-};
-//Better only for moving
-Gobj.prototype.speed = { x: 0, y: 0 };
-//Basic behaviors
-Gobj.prototype.detectOutOfBound = function () {
- //Do nothing here
-};
-//Only for moving
-Gobj.prototype.updateLocation = function () {
- //Override here
-};
-Gobj.prototype.animeFrame = function () {
- //Animation play
- this.action++;
- if (this.action >= this.frame[this.status]) {
- this.action = 0;
- }
-};
-Gobj.prototype.moving = function () {
- //Clear old timer
- this.stop();
- //Launch new moving timer
- this.status = "moving";
- var myself = this;
- var movingFrame = function () {
- myself.animeFrame();
- //Relocate character
- myself.updateLocation();
- //Detect OutOfBound
- myself.detectOutOfBound();
- };
- this.allFrames['moving'] = movingFrame;
- var animateFrame = function () {
- //Only play animation, will not move
- myself.animeFrame();
- };
- this.allFrames['animate'] = animateFrame;
-};
-Gobj.prototype.stop = function () {
- //Clear both kinds of timer
- delete this.allFrames['moving'];
- delete this.allFrames['dock'];
- delete this.allFrames['animate'];
-};
-Gobj.prototype.playFrames = function () {
- var frames = this.allFrames;
- for (var type in frames) {
- frames[type]();
- }
-};
-Gobj.prototype.die = function () {
- //Clear old timer
- this.stop();
- this.status = "dead";
- this.action = 0;
- //If has die animation
- if (this.dieEffect) {
- new this.dieEffect({ x: this.posX(), y: this.posY() });
- }
-};
-Gobj.prototype.include = function (obj) {
- return (obj.posY() > this.y) && (obj.posY() < this.y + this.height) && (obj.posX() > this.x) && (obj.posX() < this.x + this.width);
-};
-Gobj.prototype.includePoint = function (x, y) {
- return (y > this.y) && (y < this.y + this.height) && (x > this.x) && (x < this.x + this.width);
-};
-//rect={centerX:?,centerY:?,radius:?} or {centerX:?,centerY:?,radius:[?,?]}
-Gobj.prototype.insideSquare = function (rect) {
- if (rect.radius instanceof Array)
- return Math.abs(rect.centerX - this.posX()) < rect.radius[0] && Math.abs(rect.centerY - this.posY()) < rect.radius[1];
- else
- return Math.abs(rect.centerX - this.posX()) < rect.radius && Math.abs(rect.centerY - this.posY()) < rect.radius;
-};
-//rect={start:{x:?,y:?},end:{x:?,y:?}}
-Gobj.prototype.insideRect = function (rect) {
- return (this.posX() > rect.start.x) && (this.posX() < rect.end.x) &&
- (this.posY() > rect.start.y) && (this.posY() < rect.end.y);
-};
-//circle={centerX:?,centerY:?,radius:?}
-Gobj.prototype.insideCircle = function (circle) {
- return Math.pow(circle.centerX - this.posX(), 2) + Math.pow(circle.centerY - this.posY(), 2) < Math.pow(circle.radius, 2);
-};
-//Default is circle mode
-Gobj.prototype.inside = Gobj.prototype.insideCircle;
-//Radius
-Gobj.prototype.radius = function () {
- return (this.width < this.height) ? (this.width / 2) : (this.height / 2); //Math.min
-};
-//Distance
-Gobj.prototype.distanceFrom = function (obj) {
- if (obj instanceof Gobj) {
- return Math.pow((this.posX() - obj.posX()) * (this.posX() - obj.posX()) +
- (this.posY() - obj.posY()) * (this.posY() - obj.posY()), 0.5);
- }
- else {
- return Math.pow((this.posX() - obj.x) * (this.posX() - obj.x) +
- (this.posY() - obj.y) * (this.posY() - obj.y), 0.5);
- }
-};
-Gobj.prototype.insideScreen = function () {
- return ((this.x + this.width) > Map.offsetX) && (this.x < (Map.offsetX + Game.HBOUND))
- && ((this.y + this.height) > Map.offsetY) && (this.y < (Map.offsetY + Game.VBOUND));
-};
-Gobj.prototype.sightInsideScreen = function () {
- return ((this.x + this.width) > (Map.offsetX - this.get('sight'))) && (this.x < (Map.offsetX + Game.HBOUND + this.get('sight')))
- && ((this.y + this.height) > (Map.offsetY - this.get('sight'))) && (this.y < (Map.offsetY + Game.VBOUND + this.get('sight')));
-};
-Gobj.prototype.softCollideWith = function (chara, N) {
- if (N == null)
- N = 1;
- //Twice radius of hard collision
- return chara.insideSquare({ centerX: this.posX(), centerY: this.posY(), radius: [this.width * N, this.height * N] });
-};
-Gobj.prototype.collideWith = function (chara) {
- //Bounding box: right-left-down-up
- return !((this.x > (chara.x + chara.width)) || (chara.x > (this.x + this.width))
- || (this.y > (chara.y + chara.height)) || (chara.y > (this.y + this.height)));
-};
-Gobj.prototype.isIdle = function () {
- return this.status == "dock";
-};
-Gobj.prototype.canSee = function (enemy) {
- return enemy.inside({ centerX: this.posX(), centerY: this.posY(), radius: this.get('sight') });
-};
-Gobj.prototype.get = function (prop) {
- //Currently only support upgrade for unit properties, no buildings
- var result = eval('this.' + prop); //Can get A.B.C
- //ShareFlag is symbol for team sharing array, not speed matrix array
- if (result instanceof Array)
- return result[this.team];
- else
- return result;
-};
-Gobj.prototype.addBuffer = function (bufferObj, onAll) {
- for (var prop in bufferObj) {
- //Register in override if not exist
- if (!this.override[prop])
- this.override[prop] = [];
- var buffer = bufferObj[prop];
- //Add buffer into override list
- this.override[prop].unshift(buffer);
- //Override unit property by time sequence if has
- if (this[prop] != null || prop.indexOf('isInvisible') != -1 || onAll)
- this[prop] = buffer;
- }
- this.bufferObjs.push(bufferObj);
- //Refresh
- if (this == Game.selectedUnit)
- Game.refreshInfo();
-};
-Gobj.prototype.removeBuffer = function (bufferObj) {
- var bufferObjIndex = this.bufferObjs.indexOf(bufferObj);
- //Buffer obj still exist, prevent remove twice
- if (bufferObjIndex != -1) {
- for (var prop in bufferObj) {
- var buffer = bufferObj[prop];
- var overrideList = this.override[prop];
- //Remove buffer from override list
- var index = overrideList.indexOf(buffer);
- if (index != -1)
- overrideList.splice(index, 1);
- //Have other buffer, apply it by time sequence
- if (overrideList.length > 0)
- this[prop] = overrideList[0];
- else
- delete this[prop];
- }
- //Remove from bufferObjs
- this.bufferObjs.splice(bufferObjIndex, 1);
- //Refresh
- if (this == Game.selectedUnit)
- Game.refreshInfo();
- //Remove successfully
- return true;
- }
- else
- return false;
-};
-Gobj.prototype.cannotMove = function () {
- return (this instanceof Building) || Boolean(this.burrowBuffer);
-};
-Gobj.prototype.evolveTo = function (props) {
- //Init
- var charaType = props.type, burstArr = props.burstArr, mixin = props.mixin, rallyPoint = props.rallyPoint;
- var newTypeChara = null, selectedStatus = [this.selected, (this == Game.selectedUnit)], team = this.team;
- //Hide die burst and sound for old unit, then die
- this.dieEffect = this.sound.death = null;
- this.die();
- if (this.processing && !props.chain)
- delete this.processing;
- //Birth function
- var bornAt = function (chara) {
- var prop = { target: chara, team: team };
- if (mixin)
- _$.mixin(prop, mixin);
- newTypeChara = new charaType(prop);
- if (rallyPoint)
- newTypeChara.destination = rallyPoint;
- //Fix cannot select egg issue
- Game.commandTimeout(function () {
- if (selectedStatus[0])
- Game.addIntoAllSelected(newTypeChara);
- if (selectedStatus[1])
- Game.changeSelectedTo(newTypeChara);
- }, 0);
- };
- //Burst chain
- if (burstArr) {
- var pos = { x: this.posX(), y: this.posY() };
- var birth = new Burst[burstArr[0]](pos);
- var evolveChain = function (N) {
- return function () {
- birth = new Burst[burstArr[N]](pos);
- if ((N + 1) < burstArr.length)
- birth.callback = evolveChain(N + 1);
- else
- birth.callback = function () {
- var times = charaType.prototype.birthCount;
- if (times == null)
- times = 1;
- for (var N = 0; N < times; N++) {
- bornAt(birth);
- }
- };
- };
- };
- //Start evolve chain
- if (burstArr.length > 1)
- birth.callback = evolveChain(1);
- else
- birth.callback = function () {
- var times = charaType.prototype.birthCount;
- if (times == null)
- times = 1;
- for (var N = 0; N < times; N++) {
- bornAt(birth);
- }
- };
- }
- else
- bornAt(this);
- return newTypeChara;
-};
-//This buffer makes invisible units visible
-Gobj.detectorBuffer = [];
-//# sourceMappingURL=Gobj.js.map
\ No newline at end of file
diff --git a/Characters/Gobj.ts b/Characters/Gobj.ts
deleted file mode 100644
index a257951..0000000
--- a/Characters/Gobj.ts
+++ /dev/null
@@ -1,264 +0,0 @@
-//Gobj is original object used in StarCraft
-var Gobj=function(props){
- this.x=props.x;
- this.y=props.y;
- if (props.target instanceof Gobj){
- this.x=(props.target.posX()-this.width/2)>>0;
- this.y=(props.target.posY()-this.height/2)>>0;
- }
- this.action=0;//Only for moving
- this.status="";
- this.buffer={};//Buffer names
- this.override={};//Buffer effects
- this.bufferObjs=[];
- this.allFrames={};
- this.team=props.team?props.team:0;//team 0 by default
-};
-
-//Default value used if not initialize properly
-Gobj.prototype.name="Gobj";
-Gobj.prototype.width=0;
-Gobj.prototype.height=0;
-Gobj.prototype.isEnemy=function(){
- return this.team!=Game.team;
-};
-Gobj.prototype.posX=function(){
- return this.x+this.width/2;
-};
-Gobj.prototype.posY=function(){
- return this.y+this.height/2;
-};
-Gobj.prototype.imgPos={
- moving:{
- left:[0,0,0,0,0,0,0,0],
- top:[0,0,0,0,0,0,0,0]
- }
-};
-//Only for moving
-Gobj.prototype.frame={
- moving:1
-};
-//Better only for moving
-Gobj.prototype.speed={x:0,y:0};
-
-//Basic behaviors
-Gobj.prototype.detectOutOfBound=function(){
- //Do nothing here
-};
-//Only for moving
-Gobj.prototype.updateLocation=function(){
- //Override here
-};
-Gobj.prototype.animeFrame=function(){
- //Animation play
- this.action++;
- if (this.action>=this.frame[this.status]) {
- this.action=0;
- }
-};
-Gobj.prototype.moving=function(){
- //Clear old timer
- this.stop();
- //Launch new moving timer
- this.status="moving";
- var myself=this;
- var movingFrame=function(){
- myself.animeFrame();
- //Relocate character
- myself.updateLocation();
- //Detect OutOfBound
- myself.detectOutOfBound();
- };
- this.allFrames['moving']=movingFrame;
- var animateFrame=function(){
- //Only play animation, will not move
- myself.animeFrame();
- };
- this.allFrames['animate']=animateFrame;
-};
-Gobj.prototype.stop=function(){
- //Clear both kinds of timer
- delete this.allFrames['moving'];
- delete this.allFrames['dock'];
- delete this.allFrames['animate'];
-};
-Gobj.prototype.playFrames=function(){
- var frames=this.allFrames;
- for (var type in frames){
- frames[type]();
- }
-};
-Gobj.prototype.die=function(){
- //Clear old timer
- this.stop();
- this.status="dead";
- this.action=0;
- //If has die animation
- if (this.dieEffect) {
- new this.dieEffect({x:this.posX(),y:this.posY()});
- }
-};
-Gobj.prototype.include=function(obj){
- return (obj.posY()>this.y)&&(obj.posY()this.x)&&(obj.posX()this.y)&&(ythis.x)&&(xrect.start.x) && (this.posX()rect.start.y) && (this.posY()Map.offsetX) && (this.x<(Map.offsetX+Game.HBOUND))
- && ((this.y+this.height)>Map.offsetY) && (this.y<(Map.offsetY+Game.VBOUND));
-};
-Gobj.prototype.sightInsideScreen=function(){
- return ((this.x+this.width)>(Map.offsetX-this.get('sight'))) && (this.x<(Map.offsetX+Game.HBOUND+this.get('sight')))
- && ((this.y+this.height)>(Map.offsetY-this.get('sight'))) && (this.y<(Map.offsetY+Game.VBOUND+this.get('sight')));
-};
-Gobj.prototype.softCollideWith=function(chara,N){
- if (N==null) N=1;
- //Twice radius of hard collision
- return chara.insideSquare({centerX:this.posX(),centerY:this.posY(),radius:[this.width*N,this.height*N]});
-};
-Gobj.prototype.collideWith=function(chara){
- //Bounding box: right-left-down-up
- return !((this.x>(chara.x+chara.width)) || (chara.x>(this.x+this.width))
- || (this.y>(chara.y+chara.height)) || (chara.y>(this.y+this.height)));
-};
-Gobj.prototype.isIdle=function(){
- return this.status=="dock";
-};
-Gobj.prototype.canSee=function(enemy){
- return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('sight')});
-};
-Gobj.prototype.get=function(prop){
- //Currently only support upgrade for unit properties, no buildings
- var result=eval('this.'+prop);//Can get A.B.C
- //ShareFlag is symbol for team sharing array, not speed matrix array
- if (result instanceof Array) return result[this.team];
- else return result;
-};
-Gobj.prototype.addBuffer=function(bufferObj,onAll){
- for (var prop in bufferObj){
- //Register in override if not exist
- if (!this.override[prop]) this.override[prop]=[];
- var buffer=bufferObj[prop];
- //Add buffer into override list
- this.override[prop].unshift(buffer);
- //Override unit property by time sequence if has
- if (this[prop]!=null || prop.indexOf('isInvisible')!=-1 || onAll) this[prop]=buffer;
- }
- this.bufferObjs.push(bufferObj);
- //Refresh
- if (this==Game.selectedUnit) Game.refreshInfo();
-};
-Gobj.prototype.removeBuffer=function(bufferObj){
- var bufferObjIndex=this.bufferObjs.indexOf(bufferObj);
- //Buffer obj still exist, prevent remove twice
- if (bufferObjIndex!=-1){
- for (var prop in bufferObj){
- var buffer=bufferObj[prop];
- var overrideList=this.override[prop];
- //Remove buffer from override list
- var index=overrideList.indexOf(buffer);
- if (index!=-1) overrideList.splice(index,1);
- //Have other buffer, apply it by time sequence
- if (overrideList.length>0) this[prop]=overrideList[0];
- else delete this[prop];
- }
- //Remove from bufferObjs
- this.bufferObjs.splice(bufferObjIndex,1);
- //Refresh
- if (this==Game.selectedUnit) Game.refreshInfo();
- //Remove successfully
- return true;
- }
- //Remove failure
- else return false;
-};
-Gobj.prototype.cannotMove=function(){
- return (this instanceof Building) || Boolean(this.burrowBuffer);
-};
-Gobj.prototype.evolveTo=function(props){
- //Init
- var charaType=props.type,burstArr=props.burstArr,mixin=props.mixin,rallyPoint=props.rallyPoint;
- var newTypeChara=null,selectedStatus=[this.selected,(this==Game.selectedUnit)],team=this.team;
- //Hide die burst and sound for old unit, then die
- this.dieEffect=this.sound.death=null;
- this.die();
- if (this.processing && !props.chain) delete this.processing;
- //Birth function
- var bornAt=function(chara){
- var prop={target:chara,team:team};
- if (mixin) _$.mixin(prop,mixin);
- newTypeChara=new charaType(prop);
- if (rallyPoint) newTypeChara.destination=rallyPoint;
- //Fix cannot select egg issue
- Game.commandTimeout(function(){
- if (selectedStatus[0]) Game.addIntoAllSelected(newTypeChara);
- if (selectedStatus[1]) Game.changeSelectedTo(newTypeChara);
- },0);
- };
- //Burst chain
- if (burstArr){
- var pos={x:this.posX(),y:this.posY()};
- var birth=new Burst[burstArr[0]](pos);
- var evolveChain=function(N){
- return function(){
- birth=new Burst[burstArr[N]](pos);
- if ((N+1)1) birth.callback=evolveChain(1);
- //Finish evolve chain
- else birth.callback=function(){
- var times=charaType.prototype.birthCount;
- if (times==null) times=1;
- for (var N=0;N this.get('MP'))
- this.magic = this.get('MP');
- }
- },
- items: {
- '6': { name: 'Yamato' },
- '7': { name: 'DefensiveMatrix' },
- '8': { name: 'EMPShockwave' },
- '9': { name: 'Irradiate' }
- },
- cost: {
- man: 8
- },
- //Override
- dock: function () {
- //Use the same behavior
- Zerg.Devourer.prototype.dock.call(this);
- }
- }
-});
-Hero.Tassadar = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- //Override
- this.magic = this.get('MP');
- },
- prototypePlus: {
- //Add basic unit info
- name: "Tassadar",
- imgPos: {
- moving: {
- left: [0, 95, 190, 285, 380, 475, 570, 665, 0, 95, 190, 285, 380, 475, 570, 665],
- top: [90, 90, 90, 90, 90, 90, 90, 90, 0, 0, 0, 0, 0, 0, 0, 0]
- }
- },
- width: 95,
- height: 90,
- frame: {
- moving: 1,
- stop: 1
- },
- //Only for moving status, override
- speed: 15,
- HP: 999,
- SP: 999,
- armor: 3,
- MP: 999,
- sight: 385,
- detector: Gobj.detectorBuffer,
- dieEffect: Burst.BigBlueExplode,
- isFlying: true,
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: function () {
- if (this.life < this.get('HP')) {
- this.life += 3;
- if (this.life > this.get('HP'))
- this.life = this.get('HP');
- }
- if (this.shield < this.get('SP')) {
- this.shield += 3;
- if (this.shield > this.get('SP'))
- this.shield = this.get('SP');
- }
- if (this.magic < this.get('MP')) {
- this.magic += 3;
- if (this.magic > this.get('MP'))
- this.magic = this.get('MP');
- }
- },
- items: {
- '2': { name: 'Ensnare' },
- '3': { name: 'Plague' },
- '4': { name: 'Lockdown' },
- '5': { name: 'EMPShockwave' },
- '6': { name: 'Irradiate' },
- '7': { name: 'PsionicStorm' },
- '8': { name: 'MaelStorm' },
- '9': { name: 'StasisField' }
- },
- cost: {
- man: 8
- },
- //Override
- dock: function () {
- //Use the same behavior
- Zerg.Devourer.prototype.dock.call(this);
- }
- }
-});
-Hero.Kerrigan = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Override
- this.magic = this.get('MP');
- },
- prototypePlus: {
- //Add basic unit info
- name: "Kerrigan",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0, 0], [36, 36, 36, 36, 36, 36, 36, 36, 36],
- [73, 73, 73, 73, 73, 73, 73, 73, 73], [109, 109, 109, 109, 109, 109, 109, 109, 109],
- [146, 146, 146, 146, 146, 146, 146, 146, 146], [182, 182, 182, 182, 182, 182, 182, 182, 182],
- [219, 219, 219, 219, 219, 219, 219, 219, 219], [255, 255, 255, 255, 255, 255, 255, 255, 255],
- [292, 292, 292, 292, 292, 292, 292, 292, 292], [365, 365, 365, 365, 365, 365, 365, 365, 365],
- [401, 401, 401, 401, 401, 401, 401, 401, 401], [438, 438, 438, 438, 438, 438, 438, 438, 438],
- [474, 474, 474, 474, 474, 474, 474, 474, 474], [511, 511, 511, 511, 511, 511, 511, 511, 511],
- [547, 547, 547, 547, 547, 547, 547, 547, 547], [584, 584, 584, 584, 584, 584, 584, 584, 584]
- ],
- top: [
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344],
- [0, 43, 86, 129, 172, 215, 258, 301, 344], [0, 43, 86, 129, 172, 215, 258, 301, 344]
- ]
- },
- attack: {
- left: [
- [0, 0, 0, 0], [36, 36, 36, 36],
- [73, 73, 73, 73], [109, 109, 109, 109],
- [146, 146, 146, 146], [182, 182, 182, 182],
- [219, 219, 219, 219], [255, 255, 255, 255],
- [292, 292, 292, 292], [365, 365, 365, 365],
- [401, 401, 401, 401], [438, 438, 438, 438],
- [474, 474, 474, 474], [511, 511, 511, 511],
- [547, 547, 547, 547], [584, 584, 584, 584]
- ],
- top: [
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516],
- [387, 430, 473, 516], [387, 430, 473, 516]
- ]
- },
- dock: {
- left: [0, 36, 73, 109, 146, 182, 219, 255, 292, 365, 401, 438, 474, 511, 547, 584],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- }
- },
- width: 36,
- height: 43,
- frame: {
- moving: 9,
- dock: 1,
- attack: 4
- },
- //Only for moving status, override
- speed: 10,
- HP: 300,
- damage: 20,
- armor: 1,
- MP: 300,
- sight: 315,
- attackRange: 210,
- attackInterval: 2200,
- dieEffect: Burst.HumanDeath,
- attackEffect: Burst.FireSpark,
- isFlying: false,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.WAVE_ATTACK,
- recover: function () {
- if (this.magic < this.get('MP')) {
- this.magic += 2;
- if (this.magic > this.get('MP'))
- this.magic = this.get('MP');
- }
- },
- cost: {
- man: 1
- },
- items: {
- '6': { name: 'StimPacks' },
- '7': { name: 'Cloak' },
- '8': { name: 'Lockdown' }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Hero.Sarah = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Override
- this.magic = this.get('MP');
- },
- prototypePlus: {
- //Add basic unit info
- name: "Sarah",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
- [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
- [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
- [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
- [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
- [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
- [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
- [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
- ],
- top: [
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406]
- ]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
- [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
- [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
- [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
- [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
- [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
- [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
- [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
- ],
- top: [
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870]
- ]
- },
- dock: {
- left: [0, 62, 124, 186, 248, 310, 372, 434, 496, 620, 682, 744, 806, 868, 930, 992],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- }
- },
- width: 62,
- height: 58,
- frame: {
- moving: 8,
- dock: 1,
- attack: 8
- },
- //Only for moving status, override
- speed: 10,
- HP: 500,
- SP: 500,
- damage: 40,
- armor: 2,
- plasma: 0,
- MP: 500,
- sight: 315,
- attackRange: 70,
- attackInterval: 2000,
- dieEffect: Burst.HumanDeath,
- attackEffect: Burst.FireSpark,
- isFlying: false,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: function () {
- if (this.life < this.get('HP')) {
- this.life += 3;
- if (this.life > this.get('HP'))
- this.life = this.get('HP');
- }
- if (this.shield < this.get('SP')) {
- this.shield += 3;
- if (this.shield > this.get('SP'))
- this.shield = this.get('SP');
- }
- if (this.magic < this.get('MP')) {
- this.magic += 3;
- if (this.magic > this.get('MP'))
- this.magic = this.get('MP');
- }
- },
- cost: {
- man: 2
- },
- items: {
- '6': { name: 'Cloak' },
- '7': { name: 'PsionicStorm' },
- '8': { name: 'Plague' },
- '9': { name: 'Ensnare' }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Hero.DevilHunter = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Override
- this.magic = this.get('MP');
- },
- prototypePlus: {
- //Add basic unit info
- name: "DevilHunter",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
- [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
- [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
- [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
- [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
- [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
- [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
- [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
- ],
- top: [
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406],
- [0, 58, 116, 174, 232, 290, 348, 406], [0, 58, 116, 174, 232, 290, 348, 406]
- ]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [62, 62, 62, 62, 62, 62, 62, 62],
- [124, 124, 124, 124, 124, 124, 124, 124], [186, 186, 186, 186, 186, 186, 186, 186],
- [248, 248, 248, 248, 248, 248, 248, 248], [310, 310, 310, 310, 310, 310, 310, 310],
- [372, 372, 372, 372, 372, 372, 372, 372], [434, 434, 434, 434, 434, 434, 434, 434],
- [496, 496, 496, 496, 496, 496, 496, 496], [620, 620, 620, 620, 620, 620, 620, 620],
- [682, 682, 682, 682, 682, 682, 682, 682], [744, 744, 744, 744, 744, 744, 744, 744],
- [806, 806, 806, 806, 806, 806, 806, 806], [868, 868, 868, 868, 868, 868, 868, 868],
- [930, 930, 930, 930, 930, 930, 930, 930], [992, 992, 992, 992, 992, 992, 992, 992]
- ],
- top: [
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870],
- [464, 522, 580, 638, 696, 754, 812, 870], [464, 522, 580, 638, 696, 754, 812, 870]
- ]
- },
- dock: {
- left: [0, 62, 124, 186, 248, 310, 372, 434, 496, 620, 682, 744, 806, 868, 930, 992],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- }
- },
- width: 62,
- height: 58,
- frame: {
- moving: 8,
- dock: 1,
- attack: 8
- },
- //Only for moving status, override
- speed: 10,
- HP: 2000,
- SP: 2000,
- MP: 200,
- damage: 30,
- armor: 0,
- plasma: 0,
- sight: 315,
- detector: Gobj.detectorBuffer,
- attackRange: 210,
- attackInterval: 1500,
- fireDelay: 600,
- dieEffect: Burst.SmallZergFlyingDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: function () {
- if (this.life < this.get('HP')) {
- this.life += 5;
- if (this.life > this.get('HP'))
- this.life = this.get('HP');
- }
- if (this.shield < this.get('SP')) {
- this.shield += 5;
- if (this.shield > this.get('SP'))
- this.shield = this.get('SP');
- }
- if (this.magic < this.get('MP')) {
- this.magic += 5;
- if (this.magic > this.get('MP'))
- this.magic = this.get('MP');
- }
- },
- cost: {
- man: 8
- },
- upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-//# sourceMappingURL=Hero.js.map
\ No newline at end of file
diff --git a/Characters/Magic.js b/Characters/Magic.js
deleted file mode 100644
index 2d68b31..0000000
--- a/Characters/Magic.js
+++ /dev/null
@@ -1,1747 +0,0 @@
-var Magic = {
- //Zerg
- Burrow: {
- name: "Burrow",
- enabled: false,
- spell: function () {
- this.dock();
- if (this.stopAttack)
- this.stopAttack();
- this.status = "burrow";
- this.action = 2;
- var myself = this;
- //Effect:Freeze target
- var bufferObj = {
- moveTo: function () { },
- moveToward: function () { },
- dock: function () { },
- items: { '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined,
- '6': undefined, '7': undefined, '8': undefined, '9': { name: 'Unburrow' } }
- };
- if (this.attack)
- bufferObj.attack = function () { };
- //Lurker has same behavior as attackable building
- if (this.name == "Lurker") {
- var mixin = $.extend({}, Building.Attackable.prototypePlus);
- delete mixin.name;
- mixin.die = AttackableUnit.prototype.die; //Override
- $.extend(bufferObj, mixin);
- delete bufferObj.items[3]; //Enable attack icon
- }
- //Freeze immediately
- this.addBuffer(bufferObj, (this.name == "Lurker")); //onAll for Lurker
- this.burrowBuffer = [bufferObj];
- //Sound effect
- if (this.insideScreen())
- this.sound.burrow.play();
- //Forbid actions when burrowing
- var itemsBackup = this.items;
- this.items = { '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined,
- '6': undefined, '7': undefined, '8': undefined, '9': undefined };
- if (Game.selectedUnit == this)
- Button.refreshButtons();
- //Finish burrow
- Game.commandTimeout(function () {
- //Invisible when finish burrow
- var bufferObjII = {};
- for (var N = 0; N < Game.playerNum; N++) {
- bufferObjII['isInvisible' + N] = true;
- }
- myself.addBuffer(bufferObjII);
- myself.burrowBuffer.push(bufferObjII);
- myself.buffer.Burrow = true;
- //Change icon when finish burrow
- myself.items = itemsBackup;
- //Apply callback
- if (Game.selectedUnit == myself)
- Button.refreshButtons();
- }, this.imgPos.burrow.left[0].length * 100 - 200);
- }
- },
- Unburrow: {
- name: "Unburrow",
- enabled: false,
- spell: function () {
- this.status = "unburrow";
- this.action = 0;
- //Show unit immediately
- this.removeBuffer(this.burrowBuffer.pop());
- //Sound effect
- if (this.insideScreen())
- this.sound.unburrow.play();
- //Forbid actions
- this.items = { '1': undefined, '2': undefined, '3': undefined, '4': undefined, '5': undefined,
- '6': undefined, '7': undefined, '8': undefined, '9': undefined };
- if (Game.selectedUnit == this)
- Button.refreshButtons();
- //Finish unburrow
- var myself = this;
- delete myself.buffer.Burrow; //Restore shadow immediately
- Game.commandTimeout(function () {
- if (myself.burrowBuffer) {
- //Release freeze
- if (myself.removeBuffer(myself.burrowBuffer.pop())) {
- delete myself.burrowBuffer;
- if (Game.selectedUnit == myself)
- Button.refreshButtons();
- }
- }
- myself.dock();
- myself.direction = (myself.name == "Hydralisk" || myself.name == "Lurker") ? 5 : 6;
- }, this.frame.unburrow * 100 - 200); //margin
- }
- },
- Load: {
- name: "Load",
- enabled: false,
- needLocation: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Load our unit on ground
- var target = Game.getSelectedOne(location.x, location.y, this.team, true, false);
- var loadedMan = this.loadedUnits.reduce(function (man, chara) {
- if (chara.cost && chara.cost.man)
- man += (chara.cost.man);
- return man;
- }, 0);
- if (target instanceof Gobj) {
- var targetMan = (target.cost && target.cost.man) ? target.cost.man : 0;
- //Load limit
- if ((loadedMan + targetMan) <= 12) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to load it
- this.moveToward(target, Unit.meleeRange, function () {
- if (target.status != 'dead') {
- //Order ours not to attack it anymore
- Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
- if (chara.target == target)
- chara.stopAttack();
- });
- //Freeze target
- if (target.stopAttack)
- target.stopAttack();
- target.dock();
- //Load target
- myself.loadedUnits.push(target);
- //Erase target from map
- Unit.allUnits.splice(Unit.allUnits.indexOf(target), 1);
- //Kick to other space, no die voice
- target.x = target.y = -100;
- //Reset all teams: replace passenger with transport
- for (var N in Game.teams) {
- var team = Game.teams[N];
- team.forEach(function (chara, n) {
- if (chara == target)
- team[n] = myself; //team.splice(n,1)
- });
- $.unique(team);
- }
- //Refresh passenger number
- if (Game.selectedUnit == myself)
- Game.refreshInfo();
- //Sound effect
- if (myself.insideScreen()) {
- switch (myself.name) {
- case 'Overlord':
- new Audio(Game.CDN + 'bgm/Magic.Load.Zerg.wav').play();
- break;
- case 'Dropship':
- new Audio(Game.CDN + 'bgm/Magic.Load.Terran.wav').play();
- break;
- case 'Shuttle':
- new Audio(Game.CDN + 'bgm/Magic.Load.Protoss.wav').play();
- break;
- }
- }
- }
- });
- }
- }
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- UnloadAll: {
- name: "UnloadAll",
- enabled: false,
- spell: function () {
- var myself = this;
- this.loadedUnits.forEach(function (chara) {
- //Transport here
- chara.x = myself.x;
- chara.y = myself.y;
- //Add this unit into Game
- Unit.allUnits.push(chara);
- });
- //Flying units show above ground units
- Unit.sortAllUnits();
- //Clear loaded units
- this.loadedUnits = [];
- //Refresh passenger number
- if (Game.selectedUnit == this)
- Game.refreshInfo();
- //Sound effect
- if (myself.insideScreen()) {
- switch (myself.name) {
- case 'Overlord':
- new Audio(Game.CDN + 'bgm/Magic.Unload.Zerg.wav').play();
- break;
- case 'Dropship':
- new Audio(Game.CDN + 'bgm/Magic.Unload.Terran.wav').play();
- break;
- case 'Shuttle':
- new Audio(Game.CDN + 'bgm/Magic.Unload.Protoss.wav').play();
- break;
- }
- }
- }
- },
- SetRallyPoint: {
- name: "SetRallyPoint",
- enabled: true,
- //Exception for those without credit
- needLocation: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Record rally point for buildings
- this.rallyPoint = location;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Lurker: {
- name: "Lurker",
- enabled: false,
- cost: {
- mine: 50,
- gas: 100,
- man: 2,
- time: 400
- },
- spell: function () { }
- },
- InfestTerranCommandCenter: {
- name: "InfestTerranCommandCenter",
- enabled: true,
- needLocation: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Target enemy building: Injured Command Center
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), false, null, function (chara) {
- return chara.name == 'CommandCenter' && chara.life / chara.get('HP') < 0.5;
- });
- if (target instanceof Gobj) {
- this.targetLock = true;
- //Move toward target to infest command center
- var myself = this;
- this.moveToward(target, Unit.meleeRange, function () {
- if (target.status != 'dead' && target.life / target.get('HP') < 0.5) {
- //Change side
- target.team = myself.team;
- //Order ours not to attack it anymore
- Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function (chara) {
- if (chara.target == target)
- chara.stopAttack();
- });
- target.evolveTo({
- type: Building.ZergBuilding.InfestedBase
- });
- }
- });
- }
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Parasite: {
- name: "Parasite",
- cost: { magic: 75 },
- credit: true,
- enabled: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Target enemy unit
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true);
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to fire parasite
- this.moveToward(target, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire parasite
- var bullet = new Bullets.Parasite({
- from: myself,
- to: target,
- damage: 0
- });
- bullet.fire(function () {
- //Effect:should steal target sight
- target.buffer.Parasite = myself.team;
- });
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- SpawnBroodlings: {
- name: "SpawnBroodlings",
- cost: { magic: 150 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Kill enemy unit ground
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true, false);
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to fire SpawnBroodlings
- this.moveToward(target, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire SpawnBroodlings to kill that enemy immediately
- var bullet = new Bullets.Parasite({
- from: myself,
- to: target,
- damage: 99999
- });
- //Effect
- bullet.fire(function () {
- for (var n = 0; n < 2; n++) {
- new Zerg.Broodling({ x: target.posX(), y: target.posY(), team: myself.team });
- }
- });
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Ensnare: {
- name: "Ensnare",
- cost: { magic: 75 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Ensnare
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire Ensnare
- var bullet = new Bullets.Parasite({
- from: myself,
- to: { x: location.x, y: location.y }
- });
- //Fire Ensnare bullet with callback
- bullet.fire(function () {
- //Ensnare animation and sound
- var anime = new Animation.Ensnare({ x: location.x, y: location.y });
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Ensnare.wav').play();
- //Get in range enemy units
- var targets = Game.getInRangeOnes(location.x, location.y, [76 * 1.2 >> 0, 62 * 1.2 >> 0], myself.team.toString(), true);
- //Slow moving speed
- var bufferObj = {
- speed: 2
- };
- //Effect
- targets.forEach(function (chara) {
- //Buffer flag
- if (chara.buffer.Ensnare)
- return; //Not again
- chara.buffer.Ensnare = true;
- chara.addBuffer(bufferObj);
- //Green effect
- new Animation.GreenEffect({ team: myself.team, target: chara, callback: function () {
- if (chara.status != 'dead' && chara.buffer.Ensnare) {
- //Restore
- if (chara.removeBuffer(bufferObj))
- delete chara.buffer.Ensnare;
- }
- } });
- });
- });
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Consume: {
- name: "Consume",
- enabled: false,
- needLocation: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Kill our unit ground
- var target = Game.getSelectedOne(location.x, location.y, this.team, true, false);
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to consume
- this.moveToward(target, 70, function () {
- //Effect
- var anime = new Animation.Consume({ target: target, callback: function () {
- //Consume sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Consume.wav').play();
- //Consume animation missing
- target.die();
- myself.magic += 50;
- if (myself.magic > myself.get('MP'))
- myself.magic = myself.get('MP');
- } });
- });
- }
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- DarkSwarm: {
- name: "DarkSwarm",
- cost: { magic: 100 },
- credit: true,
- _timer: false,
- enabled: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire DarkSwarm
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //DarkSwarm animation, play hidden frames at first
- new Animation.DarkSwarm({ x: location.x, y: location.y }).action = 6;
- //Dynamic update targets every 1 second
- var targets = [];
- //Full guard from distance
- var bufferObj = {
- //Full guard from distance
- calculateDamageBy: function (enemyObj, percent) {
- if (enemyObj.meleeAttack) {
- var enemyAttackType = enemyObj.attackType;
- if (!enemyAttackType && enemyObj.attackMode) {
- enemyAttackType = (this.isFlying) ? enemyObj.attackMode.flying.attackType : enemyObj.attackMode.ground.attackType;
- }
- return enemyObj.get('damage') * Unit.attackMatrix[enemyAttackType][this.unitType];
- }
- else
- return 0;
- }
- };
- //Dark swarm wave
- var darkSwarm = function () {
- //Clear old units buffer
- targets.forEach(function (chara) {
- chara.removeBuffer(bufferObj);
- });
- targets = [];
- var darkSwarms = Burst.allEffects.filter(function (effect) {
- return effect instanceof Animation.DarkSwarm;
- });
- //Check if any swarm effect exist
- if (darkSwarms.length) {
- //Get targets inside all of swarms
- darkSwarms.forEach(function (swarm) {
- //Update buffer on our ground units inside swarm
- targets = targets.concat(Game.getInRangeOnes(swarm.posX(), swarm.posY(), [126 * 1.2 >> 0, 94 * 1.2 >> 0], null, true, false));
- });
- $.unique(targets);
- //Effect
- targets.forEach(function (chara) {
- //Guard from range-attack enemy
- chara.addBuffer(bufferObj);
- });
- Game.commandTimeout(darkSwarm, 1000);
- Magic.DarkSwarm._timer = true;
- }
- else
- Magic.DarkSwarm._timer = false;
- };
- //If not calculating, execute
- if (!Magic.DarkSwarm._timer)
- darkSwarm();
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Plague: {
- name: "Plague",
- cost: { magic: 150 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Plague
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Plague animation and sound
- var anime = new Animation.Plague({ x: location.x, y: location.y });
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Ensnare.wav').play();
- //Get in range enemy units
- var targets = Game.getInRangeOnes(location.x, location.y, [64 * 1.2 >> 0, 64 * 1.2 >> 0], myself.team.toString(), true);
- //Effect:HP losing every seconds
- var bufferObj = {
- recover: function () {
- if (this.life > 0)
- this.life -= 25; //Refresh every 1 seconds
- if (this.life <= 0)
- this.life = 1;
- }
- };
- targets.forEach(function (chara) {
- //Buffer flag
- if (chara.buffer.Plague)
- return; //Not again
- chara.buffer.Plague = true;
- //HP losing every seconds
- chara.addBuffer(bufferObj);
- //Green effect
- new Animation.RedEffect({ team: myself.team, target: chara, callback: function () {
- if (chara.status != 'dead' && chara.buffer.Plague) {
- //Restore
- if (chara.removeBuffer(bufferObj))
- delete chara.buffer.Plague;
- }
- } });
- });
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- //Terran
- StimPacks: {
- name: "StimPacks",
- enabled: false,
- spell: function () {
- //Rage flag for units to decide stim or not
- if (!this.buffer.Stim) {
- //Cause damage
- this.life -= 10;
- if (this.life < 1)
- this.life = 1;
- //Stim sound
- if (this.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.StimPacks.wav').play();
- //Effect
- var bufferObj = {
- attackInterval: 800,
- speed: 14
- };
- this.addBuffer(bufferObj);
- this.buffer.Stim = true;
- //Will only be stim for 15sec
- var myself = this;
- Game.commandTimeout(function () {
- if (myself.status != 'dead' && myself.buffer.Stim) {
- //Special effect is over
- if (myself.removeBuffer(bufferObj))
- delete myself.buffer.Stim;
- }
- }, 15000);
- }
- }
- },
- PersonalCloak: {
- name: "PersonalCloak",
- cost: { magic: 25 },
- enabled: false,
- spell: function () {
- //Will only be invisible when having magic
- if (!this.cloakBuffer) {
- var bufferObj = {
- //Magic losing every seconds
- recover: function () {
- //Should not forbid old recover
- this.constructor.prototype.recover.call(this);
- //Losing magic
- if (this.magic > 0 && !Cheat.gathering)
- this.magic--;
- if (this.magic <= 0) {
- //Might be negative float
- this.magic = 0;
- //Special effect is over
- if (this.removeBuffer(bufferObj)) {
- delete this.buffer.Cloak;
- delete this.cloakBuffer;
- //Recover icons and apply callbacks
- delete this.items;
- if (Game.selectedUnit == this)
- Button.reset();
- }
- }
- }
- };
- for (var N = 0; N < Game.playerNum; N++) {
- bufferObj['isInvisible' + N] = true;
- }
- //Effect
- this.buffer.Cloak = true;
- this.addBuffer(bufferObj);
- this.cloakBuffer = bufferObj;
- }
- //Change icon
- var items = _$.clone(this.items);
- for (var N in items) {
- if (items[N].name == "Cloak")
- items[N].name = "Decloak";
- }
- this.items = items;
- //Apply callback
- if (Game.selectedUnit == this)
- Button.reset();
- }
- },
- Decloak: {
- name: "Decloak",
- enabled: true,
- spell: function () {
- if (this.cloakBuffer) {
- //Special effect is over
- if (this.removeBuffer(this.cloakBuffer)) {
- delete this.buffer.Cloak;
- delete this.cloakBuffer;
- }
- }
- //Recover icons and apply callbacks
- delete this.items;
- if (Game.selectedUnit == this)
- Button.reset();
- }
- },
- Lockdown: {
- name: "Lockdown",
- cost: { magic: 100 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Target enemy unit, machine unit
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true, null, function (chara) {
- return chara.isMachine() && !chara.buffer.Lockdown;
- });
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to fire lockdown
- this.moveToward(target, 300, function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire lockdown missile
- var bullet = new Bullets.SingleMissile({
- from: myself,
- to: target,
- damage: 0
- });
- bullet.fire(function () {
- //Lockdown effect
- if (target.status != 'dead') {
- //Stop target
- if (target.stopAttack)
- target.stopAttack();
- target.dock();
- var bufferObj = {
- moveTo: function () { },
- moveToward: function () { },
- attack: function () { }
- };
- //Freeze status
- target.addBuffer(bufferObj);
- target.stop();
- //Flag
- target.buffer.Lockdown = true;
- //Lockdown animation, show hidden frames first
- var anime = new Animation.Lockdown({ target: target, callback: function () {
- //Restore after 60 seconds
- if (target.status != 'dead' && target.buffer.Lockdown) {
- if (target.removeBuffer(bufferObj))
- delete target.buffer.Lockdown;
- target.dock();
- }
- } });
- anime.action = 7;
- //Lockdown sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Lockdown.wav').play();
- }
- });
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- NuclearStrike: {
- name: "NuclearStrike",
- enabled: 1,
- needLocation: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Nuclear bomb
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- //Fire Nuclear bomb
- var bullet = new Bullets.NuclearBomb({
- from: { x: location.x, y: location.y - 250 },
- to: { x: location.x, y: location.y }
- });
- //Fire Nuclear bomb with callback
- bullet.fire(function () {
- //Nuclear bomb effect, should earlier than bomb animation draw
- //Get in range charas, no matter ours or enemies
- var targets = Game.getInRangeOnes(location.x, location.y, 175);
- targets.forEach(function (chara) {
- //Cause 500 damage
- chara.life -= 500;
- if (chara.life <= 0)
- chara.die();
- });
- //Nuclear animation
- var anime = new Animation.NuclearStrike({ x: location.x, y: location.y });
- //Nuclear sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.NuclearStrike.wav').play();
- //Use one our bomb
- if (Magic.NuclearStrike.enabled > 0 && myself.team == Game.team) {
- Magic.NuclearStrike.enabled--;
- if (Game.selectedUnit == myself)
- Button.refreshButtons();
- }
- });
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Heal: {
- name: "Heal",
- cost: { magic: 1 },
- credit: true,
- enabled: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- var myself = this;
- //Heal our units on ground, animal unit
- var target = Game.getSelectedOne(location.x, location.y, this.team, true, false, function (chara) {
- return !(chara.isMachine());
- });
- if (target instanceof Gobj) {
- this.targetLock = true;
- //Move toward target to heal him
- this.moveToward(target, target.radius() + 10, function () {
- //Consume magic to heal injured target
- if (myself.magic && target.life < target.get('HP')) {
- //Heal target
- target.life += 10;
- if (target.life > target.get('HP'))
- target.life = target.get('HP');
- myself.magic--;
- //Heal action and sound
- if (myself.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Heal.wav').play();
- }
- //# Need heal target automatically until it becomes healthy
- });
- }
- delete this.creditBill; //else
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Restoration: {
- name: "Restoration",
- cost: { magic: 50 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Restore all units
- var target = Game.getSelectedOne(location.x, location.y, null, true);
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to restore unit
- this.moveToward(target, 140, function () {
- if (Resource.payCreditBill.call(myself)) {
- //Restore effect
- var anime = new Animation.Restoration({ target: target });
- //Restore sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Restoration.wav').play();
- //Remove all bufferObjs
- $.extend([], target.bufferObjs).forEach(function (bufferObj) {
- target.removeBuffer(bufferObj);
- });
- //Remove remaining buffer
- if (target.cloakBuffer)
- delete target.cloakBuffer;
- if (target.purpleBuffer)
- delete target.purpleBuffer;
- //Delete all buffer animations on target
- var bufferAnimations = ['StasisField', 'Lockdown', 'Plague', 'Ensnare', 'PurpleEffect', 'RedEffect', 'GreenEffect', 'DefensiveMatrix', 'MaelStorm', 'Irradiate'];
- $.extend([], Burst.allEffects).forEach(function (effect) {
- if (effect.target == target && bufferAnimations.some(function (name) { return (effect instanceof Animation[name]); }))
- Burst.allEffects.splice(Burst.allEffects.indexOf(effect), 1);
- });
- //Delete all buffers, some cannot delete
- if (target.buffer.Hallucination)
- target.buffer = { Hallucination: true };
- else
- target.buffer = {};
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- OpticalFlare: {
- name: "OpticalFlare",
- cost: { magic: 75 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Shoot enemy unit
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true);
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to fire optical flare
- this.moveToward(target, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire optical flare
- var bullet = new Bullets.VultureBall({
- from: myself,
- to: target,
- damage: 0
- });
- bullet.fire(function () {
- //Effect
- var bufferObj = {
- sight: target.radius()
- };
- if (target.status != 'dead')
- target.addBuffer(bufferObj);
- //Buffer flag
- target.buffer.Blind = true;
- });
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- SpiderMines: {
- name: "SpiderMines",
- enabled: false,
- spell: function (location) { }
- },
- SeigeMode: {
- name: "SeigeMode",
- enabled: false,
- spell: function () { }
- },
- Cloak: {
- name: "Cloak",
- cost: { magic: 25 },
- enabled: false,
- spell: function () {
- Magic.PersonalCloak.spell.call(this);
- }
- },
- DefensiveMatrix: {
- name: "DefensiveMatrix",
- cost: { magic: 100 },
- credit: true,
- enabled: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Restore our units
- var target = Game.getSelectedOne(location.x, location.y, this.team, true, null, function (chara) {
- return !chara.buffer.DefensiveMatrix; //Not again
- });
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to activate defensive matrix
- this.moveToward(target, 250, function () {
- if (Resource.payCreditBill.call(myself)) {
- //Defensive matrix animation
- var anime = new Animation.DefensiveMatrix({ target: target, callback: function () {
- //Restore after 60 seconds, if no restoration executed, or interrupted by enemy attack
- if (target.status != 'dead' && anime.status != 'dead' && target.buffer.DefensiveMatrix) {
- if (target.removeBuffer(bufferObj))
- delete target.buffer.DefensiveMatrix;
- }
- } });
- //DefensiveMatrix sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.DefensiveMatrix.wav').play();
- //Defensive matrix effect: absorb 250 damage
- var matrixHP = 250;
- var bufferObj = {
- calculateDamageBy: function (enemyObj) {
- var damage;
- if (enemyObj instanceof Gobj) {
- var enemyAttackType = enemyObj.attackType;
- if (!enemyAttackType && enemyObj.attackMode) {
- enemyAttackType = (this.isFlying) ? enemyObj.attackMode.flying.attackType : enemyObj.attackMode.ground.attackType;
- }
- damage = enemyObj.get('damage') * Unit.attackMatrix[enemyAttackType][this.unitType];
- }
- else
- damage = enemyObj;
- //Consume matrixHP
- matrixHP -= damage;
- //Fully absorb damage if matrixHP still remain
- if (matrixHP > 0)
- return 0;
- else {
- anime.die();
- //Release remaining damage
- return -matrixHP;
- }
- }
- };
- //Apply effect
- target.addBuffer(bufferObj);
- //Buffer flag
- target.buffer.DefensiveMatrix = true;
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- EMPShockwave: {
- name: "EMPShockwave",
- cost: { magic: 100 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Plague
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire EMPShockwave
- var bullet = new Bullets.SingleMissile({
- from: myself,
- to: { x: location.x, y: location.y }
- });
- //Fire EMPShockwave bullet with callback
- bullet.fire(function () {
- //EMP shockwave animation
- var anime = new Animation.EMPShockwave({ x: location.x, y: location.y });
- //EMPShockwave sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.EMPShockwave.wav').play();
- //Get in range enemies
- var targets = Game.getInRangeOnes(location.x, location.y, [90 * 1.2 >> 0, 74 * 1.2 >> 0], myself.team.toString());
- //Effect
- targets.forEach(function (chara) {
- //Losing all shield and magic
- if (chara.shield)
- chara.shield = 0;
- if (chara.magic)
- chara.magic = 0;
- });
- });
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Irradiate: {
- name: "Irradiate",
- cost: { magic: 75 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Target enemy unit, animal unit
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true, null, function (chara) {
- return !(chara.isMachine()) && !chara.buffer.Irradiate;
- });
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- var irradiate = function (chara) {
- //Irradiate effect
- var anime = new Animation.Irradiate({ target: chara, callback: function () {
- //Restore after 25 seconds, dealing 250 damage
- if (chara.status != 'dead' && chara.buffer.Irradiate) {
- if (chara.removeBuffer(bufferObj))
- delete chara.buffer.Irradiate;
- delete chara.allFrames['dock'];
- chara.dock();
- }
- } });
- //Irradiate sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Irradiate.wav').play();
- //Losing life over time and walk around
- chara.buffer.Irradiate = true; //Flag
- var bufferObj = {
- recover: function () {
- //Get in range enemies and infect
- Game.getInRangeOnes(chara.posX(), chara.posY(), 50, myself.team.toString(), true, null, function (chara) {
- return !(chara.isMachine()) && !chara.buffer.Irradiate;
- }).forEach(function (chara) {
- irradiate(chara);
- });
- if (this.life > 0)
- this.life -= 10; //Refresh every 1 seconds
- if (this.life <= 0) {
- this.die();
- }
- },
- dock: Neutral.Bengalaas.prototype.dock
- };
- chara.addBuffer(bufferObj);
- chara.dock();
- };
- //Move toward target to spell Irradiate
- this.moveToward(target, 300, function () {
- if (Resource.payCreditBill.call(myself)) {
- irradiate(target);
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Yamato: {
- name: "Yamato",
- cost: { magic: 150 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Shoot all enemy
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString());
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to fire yamato
- this.moveToward(target, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Fire yamato
- var bullet = new Bullets.Yamato({
- from: myself,
- to: target,
- damage: 250
- });
- bullet.fire();
- if (myself.insideScreen())
- new Audio(Game.CDN + 'bgm/HeroCruiser.attack.wav').play();
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- ScannerSweep: {
- name: "ScannerSweep",
- cost: { magic: 50 },
- credit: true,
- enabled: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- if (Resource.payCreditBill.call(this)) {
- //ScannerSweep animation
- var anime = new Animation.ScannerSweep({ x: location.x, y: location.y, team: this.team });
- //ScannerSweep sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.ScannerSweep.wav').play();
- }
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- ArmNuclearSilo: {
- name: "ArmNuclearSilo",
- cost: {
- mine: 200,
- gas: 200,
- man: 8,
- time: 600
- },
- enabled: true,
- spell: function () {
- Magic.NuclearStrike.enabled++;
- }
- },
- LiftOff: {
- name: "LiftOff",
- enabled: false,
- spell: function () { }
- },
- Land: {
- name: "Land",
- enabled: false,
- spell: function (location) { }
- },
- //Protoss
- PsionicStorm: {
- name: "PsionicStorm",
- cost: { magic: 75 },
- credit: true,
- _timer: false,
- speller: {},
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire PsionicStorm
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //PsionicStorm animation
- var anime = new Animation.PsionicStorm({ x: location.x, y: location.y });
- //PsionicStorm sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.PsionicStorm.wav').play();
- //PsionicStorm effect
- var targets = [];
- Magic.PsionicStorm.speller = this;
- //Psionic storm wave
- var stormWave = function () {
- targets = [];
- //Check if any psionic storm exist
- var psionicStorms = Burst.allEffects.filter(function (effect) {
- return effect instanceof Animation.PsionicStorm;
- });
- if (psionicStorms.length) {
- //Get targets inside all of swarms
- psionicStorms.forEach(function (storm) {
- //Update buffer on enemy units inside storm
- targets = targets.concat(Game.getInRangeOnes(storm.posX(), storm.posY(), [94 * 1.2 >> 0, 76 * 1.2 >> 0], null, true));
- });
- $.unique(targets);
- //Effect
- targets.forEach(function (chara) {
- //Deal damage
- chara.getDamageBy(16);
- //Don't move, but will die if no life
- chara.reactionWhenAttackedBy(Magic.PsionicStorm.speller, true);
- });
- Game.commandTimeout(stormWave, 1000);
- Magic.PsionicStorm._timer = true;
- }
- else
- Magic.PsionicStorm._timer = false;
- };
- //If not calculating, execute
- if (!Magic.PsionicStorm._timer)
- stormWave();
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Hallucination: {
- name: "Hallucination",
- cost: { magic: 100 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Target all units
- var target = Game.getSelectedOne(location.x, location.y, null, true);
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to create 2 hallucinations
- this.moveToward(target, 245, function () {
- if (Resource.payCreditBill.call(myself)) {
- //Hallucination effect
- var anime = new Animation.Hallucination({ target: target });
- //Hallucination sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Hallucination.wav').play();
- //Initial
- var halluDamage, halluAttackMode, Hallucinations = [];
- if (target.attack != null) {
- if (target.attackMode) {
- halluAttackMode = _$.clone(target.attackMode);
- halluAttackMode.flying.damage = 0;
- halluAttackMode.ground.damage = 0;
- }
- else
- halluDamage = 0;
- }
- //Combine temp constructor for hallucination
- var halluConstructor = target.constructor.extends({
- constructorPlus: function (props) { },
- prototypePlus: {
- //Override
- damage: halluDamage,
- attackMode: halluAttackMode,
- cost: { man: 0 },
- items: null,
- dieEffect: Burst.HallucinationDeath
- }
- });
- for (var n = 0; n < 2; n++) {
- var hallucination = new halluConstructor({ x: target.posX(), y: target.posY(), team: myself.team });
- Hallucinations.push(hallucination);
- }
- //Will disappear after 180 seconds
- Game.commandTimeout(function () {
- Hallucinations.forEach(function (chara) {
- chara.die();
- });
- }, 180000);
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Feedback: {
- name: "Feedback",
- cost: { magic: 50 },
- credit: true,
- enabled: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Target enemy unit, magician
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString(), true, null, function (chara) {
- return chara.MP;
- });
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to spell Feedback
- this.moveToward(target, 300, function () {
- if (Resource.payCreditBill.call(myself)) {
- //Feedback effect
- var anime = new Animation.Feedback({ target: target });
- //Feedback sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Feedback.wav').play();
- //Deal damage same as its magic, lose all magic
- target.getDamageBy(target.magic);
- target.reactionWhenAttackedBy(myself);
- target.magic = 0;
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- MindControl: {
- name: "MindControl",
- cost: { magic: 150 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Can control all enemy
- var target = Game.getSelectedOne(location.x, location.y, this.team.toString());
- if (target instanceof Gobj) {
- var myself = this;
- this.targetLock = true;
- //Move toward target to mind control it
- this.moveToward(target, 280, function () {
- if (Resource.payCreditBill.call(myself)) {
- //Mind control animation
- var anime = new Animation.MindControl({ target: target });
- //MindControl sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.MindControl.wav').play();
- //Control and tame enemy
- target.team = myself.team;
- //Order ours not to attack it anymore
- Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
- if (chara.target == target)
- chara.stopAttack();
- });
- //Freeze target
- if (target.stopAttack)
- target.stopAttack();
- target.dock();
- }
- });
- }
- else
- delete this.creditBill;
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- MaelStorm: {
- name: "MaelStorm",
- cost: { magic: 100 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire MaelStorm
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //MaelStorm spell animation
- var anime = new Animation.MaelStormSpell({ x: location.x, y: location.y, callback: function () {
- //Get in range enemy units, animal
- var targets = Game.getInRangeOnes(location.x, location.y, [64 * 1.2 >> 0, 64 * 1.2 >> 0], myself.team.toString(), true, null, function (chara) {
- return !(chara.isMachine()) && !chara.buffer.MaelStorm;
- });
- //Freeze target
- var bufferObj = {
- moveTo: function () { },
- moveToward: function () { },
- attack: function () { }
- };
- //Effect
- targets.forEach(function (target) {
- target.dock();
- if (target.stopAttack)
- target.stopAttack();
- target.addBuffer(bufferObj);
- //Buffer flag
- target.buffer.MaelStorm = true;
- //Mael storm effect
- new Animation.MaelStorm({ target: target, callback: function () {
- //Restore in 18 seconds
- if (target.status != 'dead' && target.buffer.MaelStorm) {
- if (target.removeBuffer(bufferObj))
- delete target.buffer.MaelStorm;
- }
- } });
- });
- //MaelStorm sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.MaelStorm.wav').play();
- } });
- //MaelStormSpell sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.StasisField.wav').play();
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- Scarab: {
- name: "Scarab",
- enabled: true,
- cost: {
- mine: 15,
- time: 70
- },
- spell: function () {
- this.scarabNum++;
- //Refresh to disabled
- if (Game.selectedUnit == this)
- Button.refreshButtons();
- }
- },
- Interceptor: {
- name: "Interceptor",
- enabled: true,
- cost: {
- mine: 25,
- time: 200
- },
- spell: function () {
- //Build interceptor
- this.continuousAttack.count++;
- //Refresh to disabled
- if (Game.selectedUnit == this)
- Button.refreshButtons();
- }
- },
- Recall: {
- name: "Recall",
- cost: { magic: 150 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- var myself = this;
- if (Resource.payCreditBill.call(myself)) {
- //Recall animation
- var anime = new Animation.Recall({ x: location.x, y: location.y, callback: function () {
- //Get in range our units
- var targets = Game.getInRangeOnes(location.x, location.y, 50 * 1.2 >> 0, myself.team, true);
- //Recall animation again
- var animeII = new Animation.Recall({ x: myself.posX(), y: myself.posY() });
- //Recall sound
- if (animeII.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Recall.wav').play();
- //Effect
- targets.forEach(function (chara) {
- //Relocate targets
- chara.x = myself.x;
- chara.y = myself.y;
- });
- } });
- //Recall sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.Recall.wav').play();
- }
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- StasisField: {
- name: "StasisField",
- cost: { magic: 100 },
- credit: true,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire StasisField
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //Spell StasisField animation
- var anime = new Animation.StasisFieldSpell({ x: location.x, y: location.y, callback: function () {
- //Get in range units
- var targets = Game.getInRangeOnes(location.x, location.y, 64 * 1.2 >> 0, null, true);
- //Effect:Freeze target
- var bufferObj = {
- moveTo: function () { },
- moveToward: function () { },
- attack: function () { },
- getDamageBy: function () { }
- };
- targets.forEach(function (target) {
- if (target.status != 'dead') {
- //Buffer flag
- if (target.buffer.StasisField)
- return; //Not again
- target.buffer.StasisField = true;
- //Effect
- target.dock();
- if (target.stopAttack)
- target.stopAttack();
- //Freeze target
- target.addBuffer(bufferObj);
- //Stasis status
- target.stop();
- //Stasis field animation
- new Animation.StasisField({ target: target, callback: function () {
- //Restore in 30 seconds
- if (target.status != 'dead' && target.buffer.StasisField) {
- if (target.removeBuffer(bufferObj)) {
- delete target.buffer.StasisField;
- target.dock();
- }
- }
- } });
- }
- });
- } });
- //StasisField sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.StasisField.wav').play();
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- DisruptionWeb: {
- name: "DisruptionWeb",
- cost: { magic: 125 },
- credit: true,
- _timer: false,
- enabled: false,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire DisruptionWeb
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, this.get('sight'), function () {
- if (Resource.payCreditBill.call(myself)) {
- //DisruptionWeb animation
- var anime = new Animation.DisruptionWeb({ x: location.x, y: location.y });
- //DisruptionWeb sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.DisruptionWeb.wav').play();
- //Dynamic update targets every 1 second
- var targets = [];
- //Effect:Disable target attack
- var bufferObj = {
- attack: function () { }
- };
- //Disruption web wave
- var disruptionWeb = function () {
- //Clear old units buffer
- targets.forEach(function (chara) {
- chara.removeBuffer(bufferObj);
- });
- targets = [];
- var disruptionWebs = Burst.allEffects.filter(function (effect) {
- return effect instanceof Animation.DisruptionWeb;
- });
- //Check if any disruption web exist
- if (disruptionWebs.length) {
- //Get targets inside all of webs
- disruptionWebs.forEach(function (web) {
- //Update buffer on enemy ground units inside web
- targets = targets.concat(Game.getInRangeOnes(web.posX(), web.posY(), [76 * 1.2 >> 0, 56 * 1.2 >> 0], null, true, false));
- });
- $.unique(targets);
- //Effect
- targets.forEach(function (chara) {
- //Cannot attack
- if (chara.attack) {
- chara.stopAttack();
- chara.addBuffer(bufferObj);
- }
- });
- Game.commandTimeout(disruptionWeb, 1000);
- Magic.DisruptionWeb._timer = true;
- }
- else
- Magic.DisruptionWeb._timer = false;
- };
- //If not calculating, execute
- if (!Magic.DisruptionWeb._timer)
- disruptionWeb();
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- RechargeShields: {
- name: "RechargeShields",
- enabled: true,
- needLocation: true,
- spell: function (location) {
- //Has location callback info or nothing
- if (location) {
- var myself = this;
- //Restore our units, have shield and in sight
- var target = Game.getSelectedOne(location.x, location.y, this.team, true, null, function (chara) {
- return chara.SP && myself.canSee(chara);
- });
- if (target instanceof Gobj) {
- //Recharge shield animation
- var anime = new Animation.RechargeShields({ target: target });
- //Recharge shield sound
- if (anime.insideScreen())
- new Audio(Game.CDN + 'bgm/Magic.RechargeShields.wav').play();
- var hurt = target.get('SP') - target.shield;
- var needMagic = (hurt / 2 + 0.5) >> 0;
- //Remaining magic is sufficient
- if (this.magic > needMagic) {
- //Full recover
- target.shield = target.get('SP');
- this.magic -= needMagic;
- }
- else {
- //Use all remaining magic
- target.shield += (this.magic * 2);
- this.magic = 0;
- }
- }
- else {
- //Cannot reach target, pError
- }
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.owner = this;
- $('div.GameLayer').attr('status', 'button');
- }
- }
- },
- /********RPG level: Tower Defense********/
- CleanScreen: {
- name: "CleanScreen",
- cost: {
- mine: 200
- },
- spell: function () {
- //Kill all enemies
- Cheat.execute('fuck your mother');
- }
- }
-};
-//# sourceMappingURL=Magic.js.map
\ No newline at end of file
diff --git a/Characters/Map.js b/Characters/Map.js
deleted file mode 100644
index a9db0d2..0000000
--- a/Characters/Map.js
+++ /dev/null
@@ -1,229 +0,0 @@
-var Map = (function () {
- function Map() {
- this.miniCxt = ('canvas[name="mini_map"]')[0].getContext('2d');
- this.fogCanvas = ('canvas');
- this.shadowCanvas = ('canvas');
- //Init map
- this.setCurrentMap = function (name) {
- Map.currentMap = name;
- $('canvas[name="mini_map"]').attr('class', name);
- //Init inside stroke size
- Map.insideStroke.width = (130 * Game.HBOUND / Map.getCurrentMap().width) >> 0;
- Map.insideStroke.height = (130 * Game.VBOUND / Map.getCurrentMap().height) >> 0;
- //Init fog relative
- Map.fogCxt = Map.fogCanvas.getContext('2d');
- Map.fogCanvas.width = 130;
- Map.fogCanvas.height = Math.round(130 * Map.getCurrentMap().height / Map.getCurrentMap().width);
- Map.fogCanvas.ratio = 130 / Map.getCurrentMap().width;
- Map.shadowCanvas.width = Map.shadowCanvas.height = 100;
- Map.shadowCxt = Map.shadowCanvas.getContext('2d');
- //Prepared fog shadow for quick render
- var radial = Map.shadowCxt.createRadialGradient(50, 50, 25, 50, 50, 50);
- radial.addColorStop(0, 'rgba(0,0,0,1)');
- radial.addColorStop(1, 'rgba(0,0,0,0)');
- Map.shadowCxt.fillStyle = radial;
- Map.shadowCxt.beginPath();
- Map.shadowCxt.arc(50, 50, 50, 0, Math.PI * 2);
- Map.shadowCxt.fill();
- //Map is ready after current map set
- Map.ready = true;
- };
- this.getCurrentMap = function () {
- return sourceLoader.sources['Map_' + Map.currentMap];
- };
- //Draw interface call
- this.drawFogAndMinimap = function () {
- if (Map.fogFlag) {
- Map.refreshFog();
- //Draw fog on main map
- var ratio = Map.fogCanvas.ratio;
- Game.fogCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
- Game.fogCxt.drawImage(Map.fogCanvas, Math.round(Map.offsetX * ratio), Math.round(Map.offsetY * ratio), Math.round(Game.HBOUND * ratio), Math.round(Game.VBOUND * ratio), 0, 0, Game.HBOUND, Game.VBOUND);
- }
- //Draw mini-map
- Map.drawMiniMap();
- };
- //Used by drawFogAndMinimap
- this.refreshFog = function () {
- //Reset composite operation
- Map.fogCxt.globalCompositeOperation = 'source-over';
- //Brush black fog to clean old fog
- Map.fogCxt.fillStyle = 'rgba(0,0,0,1)';
- Map.fogCxt.fillRect(0, 0, Map.fogCanvas.width, Map.fogCanvas.height);
- //Other things have sight
- var parasitedEnemies = Unit.allEnemyUnits().filter(function (chara) {
- return chara.buffer.Parasite == Game.team;
- });
- var scannerSweeps = Burst.allEffects.filter(function (anime) {
- return anime.constructor.name == "ScannerSweep" && anime.team == Game.team;
- });
- var addInObjs = parasitedEnemies.concat(scannerSweeps);
- //Clear fog
- Map.fogCxt.globalCompositeOperation = 'destination-out';
- //Initial
- Map.allUnits = Unit.allOurUnits().concat(Building.ourBuildings()).concat(addInObjs);
- //Draw fog
- Map.fogCxt.fillStyle = 'rgba(0,0,0,1)';
- var ratio = Map.fogCanvas.ratio;
- Map.allUnits.forEach(function (chara) {
- //Clear fog on screen for our units inside screen
- var centerX = Math.round(chara.posX() * ratio);
- var centerY = Math.round(chara.posY() * ratio);
- var radius = Math.round(chara.get('sight') * ratio << 1);
- Map.fogCxt.drawImage(Map.shadowCanvas, 0, 0, 100, 100, centerX - radius, centerY - radius, radius << 1, radius << 1);
- });
- };
- //Used by drawFogAndMinimap: draw red&green block and white stroke
- this.drawMiniMap = function () {
- //Selected map size
- var mapWidth = Map.getCurrentMap().width;
- var mapHeight = Map.getCurrentMap().height;
- //Clear mini-map
- Map.miniCxt.clearRect(0, 0, 130, 130);
- //Re-draw mini-map points
- var miniX, miniY, rectSize;
- Building.allBuildings.concat(Unit.allUnits).forEach(function (chara) {
- //Filter out invisible enemy
- if (chara['isInvisible' + Game.team] && chara.isEnemy())
- return;
- miniX = (130 * chara.x / mapWidth) >> 0;
- miniY = (130 * chara.y / mapHeight) >> 0;
- Map.miniCxt.fillStyle = (chara.isEnemy()) ? 'red' : 'lime';
- rectSize = (chara instanceof Building) ? 4 : 3;
- Map.miniCxt.fillRect(miniX, miniY, rectSize, rectSize);
- });
- //Draw fog on mini-map
- if (Map.fogFlag)
- Map.miniCxt.drawImage(Map.fogCanvas, 0, 0, Map.fogCanvas.width, Map.fogCanvas.height, 0, 0, 130, 130);
- //Re-draw inside stroke
- Map.miniCxt.strokeStyle = 'white';
- Map.miniCxt.lineWidth = 2;
- Map.miniCxt.strokeRect((130 * Map.offsetX / mapWidth) >> 0, (130 * Map.offsetY / mapHeight) >> 0, Map.insideStroke.width, Map.insideStroke.height);
- };
- this.drawMud = function () {
- var _increments = [[0, 1], [-1, 0], [0, -1], [1, 0]];
- var mudRadius = 120;
- var mudIncrements = _$.mapTraverse(_increments, function (x) {
- return x * mudRadius / 2;
- });
- Game.backCxt.save();
- Game.backCxt.beginPath();
- //Create fill style for mud
- var mudPattern = Game.backCxt.createPattern(sourceLoader.sources['Mud'], "repeat");
- Game.backCxt.fillStyle = mudPattern;
- Building.allBuildings.filter(function (chara) {
- return (chara instanceof Building.ZergBuilding) && !chara.noMud && chara.insideScreen();
- }).forEach(function (chara) {
- var centerX = chara.posX() - Map.offsetX;
- var centerY = chara.posY() - Map.offsetY;
- var pos = [centerX + mudRadius, centerY - mudRadius];
- Game.backCxt.moveTo(pos[0], pos[1]);
- for (var M = 0, angle = -Math.PI / 4; M < 4; M++, angle += Math.PI / 2) {
- for (var N = 0; N < 5; N++) {
- Game.backCxt.arc(pos[0], pos[1], mudRadius / 4, angle, angle + Math.PI / 2);
- if (N < 4) {
- pos[0] += mudIncrements[M][0];
- pos[1] += mudIncrements[M][1];
- }
- }
- }
- });
- //Stroke edge clearly
- Game.backCxt.strokeStyle = "#212";
- Game.backCxt.lineWidth = 3;
- Game.backCxt.stroke();
- //Fill mud
- Game.backCxt.fill();
- Game.backCxt.restore();
- };
- this.drawBg = function () {
- //Clear background
- Game.backCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
- //Draw map as background
- Game.backCxt.drawImage(Map.getCurrentMap(), Map.offsetX, Map.offsetY, Game.HBOUND, Game.VBOUND - Game.infoBox.height + 5, 0, 0, Game.HBOUND, Game.VBOUND - Game.infoBox.height + 5);
- //Draw mud for ZergBuildings
- Map.drawMud();
- };
- this.refresh = function (direction) {
- var edgeX = Map.getCurrentMap().width - Game.HBOUND;
- var edgeY = Map.getCurrentMap().height - Game.VBOUND + Game.infoBox.height - 5;
- var onlyMap;
- switch (direction) {
- case "LEFT":
- Map.offsetX -= Map.speed;
- if (Map.offsetX < 0)
- Map.offsetX = 0;
- break;
- case "RIGHT":
- Map.offsetX += Map.speed;
- if (Map.offsetX > edgeX)
- Map.offsetX = edgeX;
- break;
- case "TOP":
- Map.offsetY -= Map.speed;
- if (Map.offsetY < 0)
- Map.offsetY = 0;
- break;
- case "BOTTOM":
- Map.offsetY += Map.speed;
- if (Map.offsetY > edgeY)
- Map.offsetY = edgeY;
- break;
- case "MAP":
- onlyMap = true;
- break;
- }
- Map.drawBg();
- //Need re-calculate fog when screen moves
- if (!onlyMap)
- Map.drawFogAndMinimap();
- };
- this.clickHandler = function (event) {
- //Mouse at (clickX,clickY)
- var clickX = event.pageX - $('canvas[name="mini_map"]').offset().left;
- var clickY = event.pageY - $('canvas[name="mini_map"]').offset().top;
- //Relocate map center
- Map.relocateAt(Map.getCurrentMap().width * clickX / 130, Map.getCurrentMap().height * clickY / 130);
- };
- this.dblClickHandler = function (event) {
- //Mouse at (clickX,clickY)
- var clickX = event.pageX - $('canvas[name="mini_map"]').offset().left;
- var clickY = event.pageY - $('canvas[name="mini_map"]').offset().top;
- //Map (clickX,clickY) to position (mapX,mapY) on map
- var mapX = Map.getCurrentMap().width * clickX / 130;
- var mapY = Map.getCurrentMap().height * clickY / 130;
- //Move selected units to (mapX,mapY)
- Unit.allUnits.filter(function (chara) {
- return (chara.team == Game.team) && chara.selected;
- }).forEach(function (chara) {
- if (chara.attack)
- chara.stopAttack();
- chara.targetLock = true;
- chara.moveTo(mapX, mapY);
- });
- };
- this.relocateAt = function (centerX, centerY) {
- //Get map edge
- var edgeX = Map.getCurrentMap().width - Game.HBOUND;
- var edgeY = Map.getCurrentMap().height - Game.VBOUND + Game.infoBox.height - 5;
- //Map (centerX,centerY) to position (offsetX,offsetY) on top-left in map
- var offsetX = (centerX - Game.HBOUND / 2) >> 0;
- if (offsetX < 0)
- offsetX = 0;
- if (offsetX > edgeX)
- offsetX = edgeX;
- var offsetY = (centerY - (Game.VBOUND - Game.infoBox.height + 5) / 2) >> 0;
- if (offsetY < 0)
- offsetY = 0;
- if (offsetY > edgeY)
- offsetY = edgeY;
- //Relocate map
- Map.offsetX = offsetX;
- Map.offsetY = offsetY;
- Map.needRefresh = true; //For synchronize
- };
- }
- return Map;
-}());
-;
-//# sourceMappingURL=Map.js.map
\ No newline at end of file
diff --git a/Characters/Neutral.js b/Characters/Neutral.js
deleted file mode 100644
index e3279b7..0000000
--- a/Characters/Neutral.js
+++ /dev/null
@@ -1,327 +0,0 @@
-/******* Define Neutral units *******/
-var Neutral = {};
-Neutral.Ragnasaur = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ragnasaur",
- imgPos: {
- moving: {
- left: [
- [26, 26, 26, 26, 26, 26, 26, 26, 26], [130, 130, 130, 130, 130, 130, 130, 130, 130],
- [234, 234, 234, 234, 234, 234, 234, 234, 234], [338, 338, 338, 338, 338, 338, 338, 338, 338],
- [442, 442, 442, 442, 442, 442, 442, 442, 442], [546, 546, 546, 546, 546, 546, 546, 546, 546],
- [650, 650, 650, 650, 650, 650, 650, 650, 650], [754, 754, 754, 754, 754, 754, 754, 754, 754],
- [858, 858, 858, 858, 858, 858, 858, 858, 858], [1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066],
- [1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170], [1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274],
- [1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378], [1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482],
- [1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586], [1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690]
- ],
- top: [
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858],
- [26, 130, 234, 338, 442, 546, 650, 754, 858], [26, 130, 234, 338, 442, 546, 650, 754, 858]
- ]
- }
- },
- width: 52,
- height: 52,
- frame: {
- moving: 9,
- dock: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 175,
- dieEffect: Burst.RagnasaurDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- //Override
- dock: function () {
- //Use the same behavior
- Unit.walkAround.call(this);
- }
- }
-});
-Neutral.Rhynsdon = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Rhynsdon",
- imgPos: {
- moving: {
- left: [
- [26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26], [130, 130, 130, 130, 130, 130, 130, 130, 130, 130, 130],
- [234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234], [338, 338, 338, 338, 338, 338, 338, 338, 338, 338, 338],
- [442, 442, 442, 442, 442, 442, 442, 442, 442, 442, 442], [546, 546, 546, 546, 546, 546, 546, 546, 546, 546, 546],
- [650, 650, 650, 650, 650, 650, 650, 650, 650, 650, 650], [754, 754, 754, 754, 754, 754, 754, 754, 754, 754, 754],
- [858, 858, 858, 858, 858, 858, 858, 858, 858, 858, 858], [1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066, 1066],
- [1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170, 1170], [1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274],
- [1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378, 1378], [1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482, 1482],
- [1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586, 1586], [1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690, 1690]
- ],
- top: [
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066],
- [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066], [26, 130, 234, 338, 442, 546, 650, 754, 858, 962, 1066]
- ]
- }
- },
- width: 52,
- height: 52,
- frame: {
- moving: 11,
- dock: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 175,
- dieEffect: Burst.RhynsdonDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- //Override
- dock: function () {
- //Use the same behavior
- Unit.walkAround.call(this);
- }
- }
-});
-Neutral.Ursadon = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ursadon",
- imgPos: {
- moving: {
- left: [
- [15, 15, 15, 15, 15, 15, 15, 15], [107, 107, 107, 107, 107, 107, 107, 107],
- [199, 199, 199, 199, 199, 199, 199, 199], [291, 291, 291, 291, 291, 291, 291, 291],
- [383, 383, 383, 383, 383, 383, 383, 383], [475, 475, 475, 475, 475, 475, 475, 475],
- [567, 567, 567, 567, 567, 567, 567, 567], [659, 659, 659, 659, 659, 659, 659, 659],
- [751, 751, 751, 751, 751, 751, 751, 751], [935, 935, 935, 935, 935, 935, 935, 935],
- [1027, 1027, 1027, 1027, 1027, 1027, 1027, 1027], [1119, 1119, 1119, 1119, 1119, 1119, 1119, 1119],
- [1211, 1211, 1211, 1211, 1211, 1211, 1211, 1211], [1303, 1303, 1303, 1303, 1303, 1303, 1303, 1303],
- [1395, 1395, 1395, 1395, 1395, 1395, 1395, 1395], [1487, 1487, 1487, 1487, 1487, 1487, 1487, 1487]
- ],
- top: [
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659],
- [15, 107, 199, 291, 383, 475, 567, 659], [15, 107, 199, 291, 383, 475, 567, 659]
- ]
- }
- },
- width: 62,
- height: 62,
- frame: {
- moving: 8,
- dock: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 175,
- dieEffect: Burst.UrsadonDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- //Override
- dock: function () {
- //Use the same behavior
- Unit.walkAround.call(this);
- }
- }
-});
-Neutral.Bengalaas = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Bengalaas",
- imgPos: {
- moving: {
- left: [
- [38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38], [166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166, 166],
- [294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294, 294], [422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422, 422],
- [550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550, 550], [678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678, 678],
- [806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806, 806], [934, 934, 934, 934, 934, 934, 934, 934, 934, 934, 934, 934],
- [1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062], [1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318, 1318],
- [1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446, 1446], [1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574, 1574],
- [1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702, 1702], [1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830, 1830],
- [1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958], [2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086, 2086]
- ],
- top: [
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446],
- [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446], [38, 166, 294, 422, 550, 678, 806, 934, 1062, 1190, 1318, 1446]
- ]
- }
- },
- width: 52,
- height: 52,
- frame: {
- moving: 12,
- dock: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 175,
- dieEffect: Burst.BengalaasDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- //Override
- dock: function () {
- //Use the same behavior
- Unit.walkAround.call(this);
- }
- }
-});
-Neutral.Scantid = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Scantid",
- imgPos: {
- moving: {
- left: [
- [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104],
- [196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196], [288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288],
- [380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380], [472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472],
- [564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564], [656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656],
- [748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748], [932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932],
- [1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024], [1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116],
- [1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208], [1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300],
- [1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392], [1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484]
- ],
- top: [
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024]
- ]
- }
- },
- width: 68,
- height: 68,
- frame: {
- moving: 12,
- dock: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 175,
- dieEffect: Burst.ScantidDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- //Override
- dock: function () {
- //Use the same behavior
- Unit.walkAround.call(this);
- }
- }
-});
-Neutral.Kakaru = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Kakaru",
- imgPos: {
- moving: {
- left: [
- [12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12], [104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104],
- [196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, 196], [288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288, 288],
- [380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, 380], [472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472, 472],
- [564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564, 564], [656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656],
- [748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748, 748], [932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932, 932],
- [1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024, 1024], [1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116, 1116],
- [1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208, 1208], [1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300, 1300],
- [1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392, 1392], [1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484, 1484]
- ],
- top: [
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024],
- [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024], [12, 104, 196, 288, 380, 472, 564, 656, 748, 840, 932, 1024]
- ]
- }
- },
- width: 68,
- height: 68,
- frame: {
- moving: 12
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 210,
- dieEffect: Burst.KakaruDeath,
- isFlying: true,
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- //Override
- dock: function () {
- //Use the same behavior
- Unit.walkAround.call(this);
- }
- }
-});
-//# sourceMappingURL=Neutral.js.map
\ No newline at end of file
diff --git a/Characters/Protoss.js b/Characters/Protoss.js
deleted file mode 100644
index 1198ce9..0000000
--- a/Characters/Protoss.js
+++ /dev/null
@@ -1,1217 +0,0 @@
-/******* Define Protoss units *******/
-var Protoss = {};
-Protoss.Probe = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Probe",
- imgPos: {
- moving: {
- left: [0, 32, 64, 96, 128, 160, 192, 224, 256, 32, 64, 96, 128, 160, 192, 224],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, 32]
- },
- attack: {
- left: [0, 32, 64, 96, 128, 160, 192, 224, 256, 32, 64, 96, 128, 160, 192, 224],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32, 32, 32, 32, 32]
- }
- },
- width: 32,
- height: 32,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 12,
- HP: 20,
- SP: 20,
- damage: 5,
- armor: 0,
- plasma: 0,
- sight: 280,
- meleeAttack: true,
- attackInterval: 2200,
- dieEffect: Burst.SmallBlueExplode,
- attackEffect: Burst.ProbeSpark,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 50,
- man: 1,
- time: 200
- },
- upgrade: ['UpgradeGroundArmor', 'UpgradePlasmaShields'],
- items: { '4': undefined,
- '5': { name: 'gather' },
- '7': { name: 'BasicStructure' },
- '8': { name: 'AdvancedStructure' }
- },
- buildProtossBuilding: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Ensnare
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, 40, function () {
- if (Resource.payCreditBill.call(myself)) {
- var transfer = new Building.ProtossBuilding.WrapRift({ x: location.x - 32, y: location.y - 32, team: myself.team });
- transfer.buildName = myself.buildName;
- //Calculate duration
- var duration = Resource.getCost(myself.buildName).time;
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 20;
- Game.commandTimeout(function () {
- if (transfer.status != 'dead') {
- //Evolve
- transfer.evolveTo({
- type: Building.ProtossBuilding[transfer.buildName],
- burstArr: ['ProtossBuildingComplete']
- });
- }
- }, duration * 100);
- //Processing flag on transfer
- transfer.processing = {
- name: transfer.buildName,
- startTime: Game.mainTick,
- time: duration
- };
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.farmer = this;
- Button.callback.buildType = 'ProtossBuilding';
- $('div.GameLayer').attr('status', 'button');
- }
- }
- }
-});
-Protoss.Zealot = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Zealot",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [42, 42, 42, 42, 42, 42, 42, 42],
- [84, 84, 84, 84, 84, 84, 84, 84], [126, 126, 126, 126, 126, 126, 126, 126],
- [168, 168, 168, 168, 168, 168, 168, 168], [210, 210, 210, 210, 210, 210, 210, 210],
- [252, 252, 252, 252, 252, 252, 252, 252], [294, 294, 294, 294, 294, 294, 294, 294],
- [336, 336, 336, 336, 336, 336, 336, 336], [420, 420, 420, 420, 420, 420, 420, 420],
- [462, 462, 462, 462, 462, 462, 462, 462], [504, 504, 504, 504, 504, 504, 504, 504],
- [546, 546, 546, 546, 546, 546, 546, 546], [588, 588, 588, 588, 588, 588, 588, 588],
- [630, 630, 630, 630, 630, 630, 630, 630], [672, 672, 672, 672, 672, 672, 672, 672]
- ],
- top: [
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308],
- [0, 44, 88, 132, 176, 220, 264, 308], [0, 44, 88, 132, 176, 220, 264, 308]
- ]
- },
- dock: {
- left: [0, 42, 84, 126, 168, 210, 252, 294, 336, 420, 462, 504, 546, 588, 630, 672],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0], [42, 42, 42, 42, 42],
- [84, 84, 84, 84, 84], [126, 126, 126, 126, 126],
- [168, 168, 168, 168, 168], [210, 210, 210, 210, 210],
- [252, 252, 252, 252, 252], [294, 294, 294, 294, 294],
- [336, 336, 336, 336, 336], [420, 420, 420, 420, 420],
- [462, 462, 462, 462, 462], [504, 504, 504, 504, 504],
- [546, 546, 546, 546, 546], [588, 588, 588, 588, 588],
- [630, 630, 630, 630, 630], [672, 672, 672, 672, 672]
- ],
- top: [
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528],
- [352, 396, 440, 484, 528], [352, 396, 440, 484, 528]
- ]
- }
- },
- width: 42,
- height: 44,
- frame: {
- moving: 8,
- dock: 1,
- attack: 5
- },
- //Only for moving status, override
- speed: 10,
- HP: 80,
- SP: 80,
- damage: 16,
- armor: 1,
- plasma: 0,
- sight: 245,
- meleeAttack: true,
- attackInterval: 2200,
- dieEffect: Burst.SmallProtossDeath,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 100,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields']
- }
-});
-Protoss.Dragoon = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Dragoon",
- imgPos: {
- moving: {
- left: [
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [687, 591, 495, 399, 303, 207, 111, 15],
- [687, 591, 495, 399, 303, 207, 111, 15], [687, 591, 495, 399, 303, 207, 111, 15],
- [687, 591, 495, 399, 303, 207, 111, 15], [687, 591, 495, 399, 303, 207, 111, 15],
- [687, 591, 495, 399, 303, 207, 111, 15], [687, 591, 495, 399, 303, 207, 111, 15]
- ],
- top: [
- [111, 111, 111, 111, 111, 111, 111, 111], [111, 111, 111, 111, 111, 111, 111, 111],
- [207, 207, 207, 207, 207, 207, 207, 207], [207, 207, 207, 207, 207, 207, 207, 207],
- [207, 207, 207, 207, 207, 207, 207, 207], [207, 207, 207, 207, 207, 207, 207, 207],
- [207, 207, 207, 207, 207, 207, 207, 207], [399, 399, 399, 399, 399, 399, 399, 399],
- [399, 399, 399, 399, 399, 399, 399, 399], [399, 399, 399, 399, 399, 399, 399, 399],
- [303, 303, 303, 303, 303, 303, 303, 303], [303, 303, 303, 303, 303, 303, 303, 303],
- [303, 303, 303, 303, 303, 303, 303, 303], [303, 303, 303, 303, 303, 303, 303, 303],
- [303, 303, 303, 303, 303, 303, 303, 303], [111, 111, 111, 111, 111, 111, 111, 111]
- ]
- },
- dock: {
- left: [
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687],
- [15, 111, 207, 303, 399, 495, 591, 687], [15, 111, 207, 303, 399, 495, 591, 687]
- ],
- top: [
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15],
- [15, 15, 15, 15, 15, 15, 15, 15], [15, 15, 15, 15, 15, 15, 15, 15]
- ]
- },
- attack: {
- left: [
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495],
- [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495], [15, 111, 207, 303, 399, 495, 591, 687, 495, 495, 495, 495]
- ],
- top: [
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495],
- [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495], [495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495, 495]
- ]
- }
- },
- width: 66,
- height: 66,
- frame: {
- moving: 8,
- dock: 8,
- attack: 12
- },
- //Only for moving status, override
- speed: 12,
- HP: 100,
- SP: 80,
- damage: 20,
- armor: 1,
- plasma: 0,
- sight: 280,
- attackRange: 140,
- attackInterval: 3000,
- fireDelay: 800,
- dieEffect: Burst.DragoonDeath,
- isFlying: false,
- unitType: Unit.BIG,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 125,
- gas: 50,
- man: 2,
- time: 500
- },
- upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields']
- }
-});
-Protoss.Templar = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Templar",
- imgPos: {
- moving: {
- left: [
- [30, 30, 30, 30], [158, 158, 158, 158],
- [286, 286, 286, 286], [414, 414, 414, 414],
- [542, 542, 542, 542], [670, 670, 670, 670],
- [798, 798, 798, 798], [926, 926, 926, 926],
- [1054, 1054, 1054, 1054], [1310, 1310, 1310, 1310],
- [1438, 1438, 1438, 1438], [1566, 1566, 1566, 1566],
- [1694, 1694, 1694, 1694], [1822, 1822, 1822, 1822],
- [1950, 1950, 1950, 1950], [2078, 2078, 2078, 2078]
- ],
- top: [
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670],
- [1694, 1822, 1950, 670], [1694, 1822, 1950, 670]
- ]
- },
- dock: {
- left: [
- [30, 30, 30, 30, 30, 30, 30], [158, 158, 158, 158, 158, 158, 158],
- [286, 286, 286, 286, 286, 286, 286], [414, 414, 414, 414, 414, 414, 414],
- [542, 542, 542, 542, 542, 542, 542], [670, 670, 670, 670, 670, 670, 670],
- [798, 798, 798, 798, 798, 798, 798], [926, 926, 926, 926, 926, 926, 926],
- [1054, 1054, 1054, 1054, 1054, 1054, 1054], [1310, 1310, 1310, 1310, 1310, 1310, 1310],
- [1438, 1438, 1438, 1438, 1438, 1438, 1438], [1566, 1566, 1566, 1566, 1566, 1566, 1566],
- [1694, 1694, 1694, 1694, 1694, 1694, 1694], [1822, 1822, 1822, 1822, 1822, 1822, 1822],
- [1950, 1950, 1950, 1950, 1950, 1950, 1950], [2078, 2078, 2078, 2078, 2078, 2078, 2078]
- ],
- top: [
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566],
- [798, 926, 1054, 1182, 1310, 1438, 1566], [798, 926, 1054, 1182, 1310, 1438, 1566]
- ]
- },
- attack: {
- left: [
- [30, 30, 30, 30, 30], [158, 158, 158, 158, 158],
- [286, 286, 286, 286, 286], [414, 414, 414, 414, 414],
- [542, 542, 542, 542, 542], [670, 670, 670, 670, 670],
- [798, 798, 798, 798, 798], [926, 926, 926, 926, 926],
- [1054, 1054, 1054, 1054, 1054], [1310, 1310, 1310, 1310, 1310],
- [1438, 1438, 1438, 1438, 1438], [1566, 1566, 1566, 1566, 1566],
- [1694, 1694, 1694, 1694, 1694], [1822, 1822, 1822, 1822, 1822],
- [1950, 1950, 1950, 1950, 1950], [2078, 2078, 2078, 2078, 2078]
- ],
- top: [
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542],
- [30, 158, 286, 414, 542], [30, 158, 286, 414, 542]
- ]
- }
- },
- width: 68,
- height: 68,
- frame: {
- moving: 4,
- dock: 7,
- attack: 5
- },
- //Only for moving status, override
- speed: 8,
- HP: 40,
- SP: 40,
- damage: 10,
- armor: 0,
- plasma: 0,
- MP: 200,
- sight: 245,
- attackRange: 100,
- attackInterval: 2000,
- dieEffect: Burst.TemplarDeath,
- attackEffect: Burst.FireSpark,
- isFlying: false,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.WAVE_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 50,
- gas: 150,
- man: 2,
- time: 500
- },
- upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
- items: {
- '7': { name: 'PsionicStorm', condition: function () {
- return Magic.PsionicStorm.enabled;
- } },
- '8': { name: 'Hallucination', condition: function () {
- return Magic.Hallucination.enabled;
- } },
- '9': { name: 'Archon' }
- }
- }
-});
-Protoss.DarkTemplar = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "DarkTemplar",
- imgPos: {
- moving: {
- left: [
- [3, 3, 3, 3, 3, 3, 3, 3, 3], [60, 60, 60, 60, 60, 60, 60, 60, 60],
- [117, 117, 117, 117, 117, 117, 117, 117, 117], [174, 174, 174, 174, 174, 174, 174, 174, 174],
- [231, 231, 231, 231, 231, 231, 231, 231, 231], [288, 288, 288, 288, 288, 288, 288, 288, 288],
- [345, 345, 345, 345, 345, 345, 345, 345, 345], [402, 402, 402, 402, 402, 402, 402, 402, 402],
- [459, 459, 459, 459, 459, 459, 459, 459, 459], [573, 573, 573, 573, 573, 573, 573, 573, 573],
- [630, 630, 630, 630, 630, 630, 630, 630, 630], [687, 687, 687, 687, 687, 687, 687, 687, 687],
- [744, 744, 744, 744, 744, 744, 744, 744, 744], [801, 801, 801, 801, 801, 801, 801, 801, 801],
- [858, 858, 858, 858, 858, 858, 858, 858, 858], [915, 915, 915, 915, 915, 915, 915, 915, 915]
- ],
- top: [
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496],
- [0, 62, 124, 186, 248, 310, 372, 434, 496], [0, 62, 124, 186, 248, 310, 372, 434, 496]
- ]
- },
- dock: {
- left: [3, 60, 117, 174, 231, 288, 345, 402, 459, 573, 630, 687, 744, 801, 858, 915],
- top: [248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248]
- },
- attack: {
- left: [
- [3, 3, 3, 3, 3, 3, 3, 3, 3], [60, 60, 60, 60, 60, 60, 60, 60, 60],
- [117, 117, 117, 117, 117, 117, 117, 117, 117], [174, 174, 174, 174, 174, 174, 174, 174, 174],
- [231, 231, 231, 231, 231, 231, 231, 231, 231], [288, 288, 288, 288, 288, 288, 288, 288, 288],
- [345, 345, 345, 345, 345, 345, 345, 345, 345], [402, 402, 402, 402, 402, 402, 402, 402, 402],
- [459, 459, 459, 459, 459, 459, 459, 459, 459], [573, 573, 573, 573, 573, 573, 573, 573, 573],
- [630, 630, 630, 630, 630, 630, 630, 630, 630], [687, 687, 687, 687, 687, 687, 687, 687, 687],
- [744, 744, 744, 744, 744, 744, 744, 744, 744], [801, 801, 801, 801, 801, 801, 801, 801, 801],
- [858, 858, 858, 858, 858, 858, 858, 858, 858], [915, 915, 915, 915, 915, 915, 915, 915, 915]
- ],
- top: [
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054],
- [558, 620, 682, 744, 806, 868, 930, 992, 1054], [558, 620, 682, 744, 806, 868, 930, 992, 1054]
- ]
- }
- },
- width: 57,
- height: 62,
- frame: {
- moving: 9,
- dock: 1,
- attack: 9
- },
- //Only for moving status, override
- speed: 12,
- HP: 80,
- SP: 40,
- damage: 40,
- armor: 1,
- plasma: 0,
- sight: 245,
- meleeAttack: true,
- attackInterval: 3000,
- dieEffect: Burst.SmallProtossDeath,
- isFlying: false,
- isInvisible: true,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 125,
- gas: 100,
- man: 2,
- time: 500
- },
- upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
- items: {
- '9': { name: 'DarkArchon' }
- }
- }
-});
-Protoss.Archon = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.direction = 6;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Archon",
- imgPos: {
- moving: {
- left: [
- [2060, 2060, 2060, 2060], [140, 140, 140, 140],
- [260, 260, 260, 260], [380, 380, 380, 380],
- [500, 500, 500, 500], [620, 620, 620, 620],
- [740, 740, 740, 740], [860, 860, 860, 860],
- [980, 980, 980, 980], [1220, 1220, 1220, 1220],
- [1340, 1340, 1340, 1340], [1460, 1460, 1460, 1460],
- [1580, 1580, 1580, 1580], [1700, 1700, 1700, 1700],
- [1820, 1820, 1820, 1820], [1940, 1940, 1940, 1940]
- ],
- top: [
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580],
- [1220, 1340, 1460, 1580], [1220, 1340, 1460, 1580]
- ]
- },
- attack: {
- left: [
- [2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060, 2060], [140, 140, 140, 140, 140, 140, 140, 140, 140, 140],
- [260, 260, 260, 260, 260, 260, 260, 260, 260, 260], [380, 380, 380, 380, 380, 380, 380, 380, 380, 380],
- [500, 500, 500, 500, 500, 500, 500, 500, 500, 500], [620, 620, 620, 620, 620, 620, 620, 620, 620, 620],
- [740, 740, 740, 740, 740, 740, 740, 740, 740, 740], [860, 860, 860, 860, 860, 860, 860, 860, 860, 860],
- [980, 980, 980, 980, 980, 980, 980, 980, 980, 980], [1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220],
- [1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340], [1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460],
- [1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580], [1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700],
- [1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820], [1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940]
- ],
- top: [
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100]
- ]
- }
- },
- width: 80,
- height: 80,
- frame: {
- moving: 4,
- attack: 10
- },
- //Only for moving status, override
- speed: 12,
- HP: 10,
- SP: 350,
- damage: 30,
- armor: 0,
- plasma: 0,
- sight: 280,
- attackRange: 70,
- attackInterval: 1000,
- attackEffect: Burst.ArchonBurst,
- dieEffect: Burst.BigBlueExplode,
- isFlying: false,
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 50,
- gas: 150,
- man: 4,
- time: 200
- },
- upgrade: ['UpgradeGroundWeapons', 'UpgradeGroundArmor', 'UpgradePlasmaShields'],
- AOE: {
- hasEffect: false,
- radius: 20
- }
- }
-});
-Protoss.DarkArchon = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.direction = 3;
- },
- prototypePlus: {
- //Add basic unit info
- name: "DarkArchon",
- imgPos: {
- moving: {
- left: [
- [20, 20, 20, 20, 20, 20, 20, 20, 20, 20], [140, 140, 140, 140, 140, 140, 140, 140, 140, 140],
- [260, 260, 260, 260, 260, 260, 260, 260, 260, 260], [380, 380, 380, 380, 380, 380, 380, 380, 380, 380],
- [500, 500, 500, 500, 500, 500, 500, 500, 500, 500], [620, 620, 620, 620, 620, 620, 620, 620, 620, 620],
- [740, 740, 740, 740, 740, 740, 740, 740, 740, 740], [860, 860, 860, 860, 860, 860, 860, 860, 860, 860],
- [980, 980, 980, 980, 980, 980, 980, 980, 980, 980], [1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220, 1220],
- [1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340, 1340], [1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460, 1460],
- [1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580, 1580], [1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700, 1700],
- [1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820, 1820], [1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940, 1940]
- ],
- top: [
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100],
- [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100], [20, 140, 260, 380, 500, 620, 740, 860, 980, 1100]
- ]
- }
- },
- width: 80,
- height: 80,
- frame: {
- moving: 10
- },
- //Only for moving status, override
- speed: 12,
- HP: 25,
- SP: 200,
- armor: 1,
- plasma: 0,
- MP: 200,
- sight: 350,
- dieEffect: Burst.BigBlueExplode,
- isFlying: false,
- unitType: Unit.BIG,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 125,
- gas: 100,
- man: 4,
- time: 200
- },
- upgrade: ['UpgradeGroundArmor', 'UpgradePlasmaShields'],
- items: {
- '7': { name: 'Feedback' },
- '8': { name: 'MindControl', condition: function () {
- return Magic.MindControl.enabled;
- } },
- '9': { name: 'MaelStorm', condition: function () {
- return Magic.MaelStorm.enabled;
- } }
- }
- }
-});
-Protoss.Shuttle = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- //Transport
- this.loadedUnits = [];
- },
- prototypePlus: {
- //Add basic unit info
- name: "Shuttle",
- imgPos: {
- moving: {
- left: [5, 65, 125, 185, 245, 305, 365, 425, 485, 65, 125, 185, 245, 305, 365, 425],
- top: [5, 5, 5, 5, 5, 5, 5, 5, 5, 65, 65, 65, 65, 65, 65, 65]
- }
- },
- width: 50,
- height: 50,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 11,
- HP: 80,
- SP: 60,
- armor: 1,
- plasma: 0,
- sight: 280,
- dieEffect: Burst.MiddleBlueExplode,
- isFlying: true,
- unitType: Unit.BIG,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 200,
- man: 2,
- time: 600
- },
- upgrade: ['UpgradeAirArmor', 'UpgradePlasmaShields'],
- items: {
- '8': { name: 'Load' },
- '9': { name: 'UnloadAll' }
- },
- //Override
- dock: function () {
- //Use the same behavior
- Unit.hover.call(this);
- },
- die: Zerg.Overlord.prototype.die
- }
-});
-Protoss.Reaver = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.imgPos.attack = this.imgPos.dock;
- this.frame.attack = this.frame.dock;
- if (Multiplayer.ON)
- this.scarabNum = 0;
- else
- this.scarabNum = (props.team != Game.team) ? 999 : 0;
- //Override
- this.isReloaded = function () {
- return this.coolDown && this.scarabNum > 0;
- };
- },
- prototypePlus: {
- //Add basic unit info
- name: "Reaver",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0, 0], [84, 84, 84, 84, 84, 84, 84, 84, 84],
- [168, 168, 168, 168, 168, 168, 168, 168, 168], [252, 252, 252, 252, 252, 252, 252, 252, 252],
- [336, 336, 336, 336, 336, 336, 336, 336, 336], [420, 420, 420, 420, 420, 420, 420, 420, 420],
- [504, 504, 504, 504, 504, 504, 504, 504, 504], [588, 588, 588, 588, 588, 588, 588, 588, 588],
- [672, 672, 672, 672, 672, 672, 672, 672, 672], [840, 840, 840, 840, 840, 840, 840, 840, 840],
- [924, 924, 924, 924, 924, 924, 924, 924, 924], [1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008],
- [1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092, 1092], [1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176, 1176],
- [1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260, 1260], [1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344, 1344]
- ],
- top: [
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672],
- [0, 84, 168, 252, 336, 420, 504, 588, 672], [0, 84, 168, 252, 336, 420, 504, 588, 672]
- ]
- },
- dock: {
- left: [0, 84, 168, 252, 336, 420, 504, 588, 672, 840, 924, 1008, 1092, 1176, 1260, 1344],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- }
- },
- width: 84,
- height: 84,
- frame: {
- moving: 9,
- dock: 1
- },
- //Only for moving status, override
- speed: 4,
- HP: 100,
- SP: 80,
- damage: 100,
- armor: 0,
- plasma: 0,
- sight: 350,
- attackRange: 280,
- attackInterval: 6000,
- dieEffect: Burst.BigBlueExplode,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- scarabCapacity: 5,
- cost: {
- mine: 200,
- gas: 100,
- man: 4,
- time: 700
- },
- upgrade: ['UpgradeGroundArmor', 'UpgradePlasmaShields'],
- items: {
- '7': { name: 'Scarab', condition: function () {
- if (!Game.selectedUnit.scarabNum)
- $('button.attack').attr('disabled', true);
- else
- $('button.attack').removeAttr('disabled');
- return Game.selectedUnit.scarabNum < Game.selectedUnit.get('scarabCapacity');
- } }
- },
- AOE: {
- hasEffect: false,
- radius: 80
- }
- }
-});
-Protoss.Observer = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Observer",
- imgPos: {
- moving: {
- left: [0, 40, 80, 120, 160, 200, 240, 280, 320, 40, 80, 120, 160, 200, 240, 280],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 40, 40, 40, 40, 40, 40]
- }
- },
- width: 40,
- height: 40,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 8,
- HP: 40,
- SP: 20,
- armor: 0,
- plasma: 0,
- sight: 315,
- dieEffect: Burst.SmallBlueExplode,
- isFlying: true,
- isInvisible: true,
- unitType: Unit.SMALL,
- recover: Building.ProtossBuilding.prototype.recover,
- detector: Gobj.detectorBuffer,
- cost: {
- mine: 25,
- gas: 75,
- man: 1,
- time: 400
- },
- upgrade: ['UpgradeAirArmor', 'UpgradePlasmaShields'],
- //Override
- dock: function () {
- //Use the same behavior
- Unit.hover.call(this);
- }
- }
-});
-Protoss.Scout = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- //Bind bgm
- this.sound.attackG = new Audio(Game.CDN + 'bgm/' + this.name + '.attack.wav');
- this.sound.attackF = new Audio(Game.CDN + 'bgm/' + this.name + '.attackF.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "Scout",
- imgPos: {
- moving: {
- left: [8, 80, 152, 224, 296, 368, 440, 512, 584, 80, 152, 224, 296, 368, 440, 512],
- top: [8, 8, 8, 8, 8, 8, 8, 8, 8, 152, 152, 152, 152, 152, 152, 152]
- },
- attack: {
- left: [
- [8, 8], [80, 80],
- [152, 152], [224, 224],
- [296, 296], [368, 368],
- [440, 440], [512, 512],
- [584, 584], [80, 80],
- [152, 152], [224, 224],
- [296, 296], [368, 368],
- [440, 440], [512, 512]
- ],
- top: [
- [8, 80], [8, 80],
- [8, 80], [8, 80],
- [8, 80], [8, 80],
- [8, 80], [8, 80],
- [8, 80], [152, 224],
- [152, 224], [152, 224],
- [152, 224], [152, 224],
- [152, 224], [152, 224]
- ]
- }
- },
- width: 56,
- height: 56,
- frame: {
- moving: 1,
- attack: 2
- },
- //Only for moving status, override
- speed: 12,
- HP: 150,
- SP: 100,
- attackMode: {
- flying: {
- attackRange: 210,
- attackInterval: 2200,
- damage: 28,
- attackType: AttackableUnit.BURST_ATTACK
- },
- ground: {
- attackRange: 105,
- attackEffect: Burst.BlueShootSpark,
- attackInterval: 2200,
- damage: 8,
- attackType: AttackableUnit.NORMAL_ATTACK
- },
- status: false
- },
- //Default
- damage: 8,
- armor: 0,
- plasma: 0,
- sight: 280,
- attackRange: 105,
- dieEffect: Burst.MiddleBlueExplode,
- isFlying: true,
- unitType: Unit.BIG,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 300,
- gas: 150,
- man: 3,
- time: 800
- },
- upgrade: ['UpgradeAirWeapons', 'UpgradeAirArmor', 'UpgradePlasmaShields'],
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Protoss.Carrier = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.attack = this.imgPos.dock = this.imgPos.moving;
- this.frame.attack = this.frame.dock = this.frame.moving;
- //Override
- this.continuousAttack = {
- count: (Multiplayer.ON) ? 0 : ((props.team != Game.team) ? (this.get('interceptorCapacity')) : 0),
- layout: this.continuousAttack.layout
- };
- this.isReloaded = function () {
- return this.coolDown && this.continuousAttack.count > 0;
- };
- },
- prototypePlus: {
- //Add basic unit info
- name: "Carrier",
- imgPos: {
- moving: {
- left: [0, 256, 512, 768, 1024, 1408, 1664, 1920, 0, 256, 512, 768, 1024, 1408, 1664, 1920],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128]
- }
- },
- width: 128,
- height: 128,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 8,
- HP: 300,
- SP: 150,
- damage: 6,
- armor: 4,
- plasma: 0,
- sight: 385,
- attackRange: 280,
- attackInterval: 1000,
- recover: Building.ProtossBuilding.prototype.recover,
- interceptorCapacity: 4,
- continuousAttack: {
- count: 4,
- layout: function (bullet, num) {
- //Reassign location, surround target
- var centerX = bullet.target.posX();
- var centerY = bullet.target.posY();
- var radius = 120;
- switch (num) {
- //Left
- case 0:
- bullet.x = centerX - radius - bullet.width / 2;
- bullet.y = centerY - bullet.height / 2;
- bullet.speed = { x: radius / 4, y: 0 };
- bullet.angle = 0;
- break;
- //Right
- case 1:
- bullet.x = centerX + radius - bullet.width / 2;
- bullet.y = centerY - bullet.height / 2;
- bullet.speed = { x: -radius / 4, y: 0 };
- bullet.angle = Math.PI;
- break;
- //Top
- case 2:
- bullet.x = centerX - bullet.width / 2;
- bullet.y = centerY - radius - bullet.height / 2;
- bullet.speed = { x: 0, y: radius / 4 };
- bullet.angle = -Math.PI / 2;
- break;
- //Bottom
- case 3:
- bullet.x = centerX - bullet.width / 2;
- bullet.y = centerY + radius - bullet.height / 2;
- bullet.speed = { x: 0, y: -radius / 4 };
- bullet.angle = Math.PI / 2;
- break;
- //Top-left
- case 4:
- bullet.x = centerX - radius * 0.7 - bullet.width / 2;
- bullet.y = centerY - radius * 0.7 - bullet.height / 2;
- bullet.speed = { x: 0.7 * radius / 4, y: 0.7 * radius / 4 };
- bullet.angle = -Math.PI / 4;
- break;
- //Top-right
- case 5:
- bullet.x = centerX + radius * 0.7 - bullet.width / 2;
- bullet.y = centerY - radius * 0.7 - bullet.height / 2;
- bullet.speed = { x: -0.7 * radius / 4, y: 0.7 * radius / 4 };
- bullet.angle = -Math.PI * 3 / 4;
- break;
- //Bottom-left
- case 6:
- bullet.x = centerX - radius * 0.7 - bullet.width / 2;
- bullet.y = centerY + radius * 0.7 - bullet.height / 2;
- bullet.speed = { x: 0.7 * radius / 4, y: -0.7 * radius / 4 };
- bullet.angle = Math.PI / 4;
- break;
- //Bottom-right
- case 7:
- bullet.x = centerX + radius * 0.7 - bullet.width / 2;
- bullet.y = centerY + radius * 0.7 - bullet.height / 2;
- bullet.speed = { x: -0.7 * radius / 4, y: -0.7 * radius / 4 };
- bullet.angle = Math.PI * 3 / 4;
- break;
- }
- }
- },
- dieEffect: Burst.BigBlueExplode,
- isFlying: true,
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- cost: {
- mine: 350,
- gas: 250,
- man: 8,
- time: 1400
- },
- upgrade: ['UpgradeAirWeapons', 'UpgradeAirArmor', 'UpgradePlasmaShields'],
- items: {
- '7': { name: 'Interceptor', condition: function () {
- if (!Game.selectedUnit.continuousAttack.count)
- $('button.attack').attr('disabled', true);
- else
- $('button.attack').removeAttr('disabled');
- return Game.selectedUnit.continuousAttack.count < Game.selectedUnit.get('interceptorCapacity');
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Protoss.Arbiter = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Arbiter",
- imgPos: {
- moving: {
- left: [0, 76, 152, 228, 304, 380, 456, 532, 608, 76, 152, 228, 304, 380, 456, 532],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 76, 76, 76, 76, 76]
- }
- },
- width: 76,
- height: 76,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 12,
- HP: 200,
- SP: 150,
- damage: 10,
- armor: 1,
- plasma: 0,
- MP: 200,
- sight: 315,
- attackRange: 175,
- attackInterval: 4500,
- dieEffect: Burst.MiddleBlueExplode,
- isFlying: true,
- unitType: Unit.BIG,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 100,
- gas: 350,
- man: 4,
- time: 1600
- },
- upgrade: ['UpgradeAirWeapons', 'UpgradeAirArmor', 'UpgradePlasmaShields'],
- items: {
- '7': { name: 'Recall', condition: function () {
- return Magic.Recall.enabled;
- } },
- '8': { name: 'StasisField', condition: function () {
- return Magic.StasisField.enabled;
- } }
- },
- //Special skill: make nearby units invisible, need initial
- bufferObj: {},
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Protoss.Corsair = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Corsair",
- imgPos: {
- moving: {
- left: [0, 60, 120, 180, 240, 300, 360, 420, 480, 600, 660, 720, 780, 840, 900, 960],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0], [60, 60, 60, 60, 60],
- [120, 120, 120, 120, 120], [180, 180, 180, 180, 180],
- [240, 240, 240, 240, 240], [300, 300, 300, 300, 300],
- [360, 360, 360, 360, 360], [420, 420, 420, 420, 420],
- [480, 480, 480, 480, 480], [600, 600, 600, 600, 600],
- [660, 660, 660, 660, 660], [720, 720, 720, 720, 720],
- [780, 780, 780, 780, 780], [840, 840, 840, 840, 840],
- [900, 900, 900, 900, 900], [960, 960, 960, 960, 960]
- ],
- top: [
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240],
- [0, 60, 120, 180, 240], [0, 60, 120, 180, 240]
- ]
- }
- },
- width: 60,
- height: 60,
- frame: {
- moving: 1,
- attack: 5
- },
- //Only for moving status, override
- speed: 16,
- HP: 100,
- SP: 80,
- damage: 5,
- armor: 1,
- plasma: 0,
- MP: 200,
- sight: 315,
- attackRange: 175,
- attackInterval: 800,
- dieEffect: Burst.MiddleBlueExplode,
- attackEffect: Burst.CorsairCloud,
- isFlying: true,
- attackLimit: "flying",
- unitType: Unit.MIDDLE,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.ProtossBuilding.prototype.recover,
- cost: {
- mine: 150,
- gas: 100,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeAirWeapons', 'UpgradeAirArmor', 'UpgradePlasmaShields'],
- items: {
- '7': { name: 'DisruptionWeb', condition: function () {
- return Magic.DisruptionWeb.enabled;
- } }
- },
- AOE: {
- hasEffect: true,
- radius: 100
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-//# sourceMappingURL=Protoss.js.map
\ No newline at end of file
diff --git a/Characters/Terran.js b/Characters/Terran.js
deleted file mode 100644
index 0e4a24f..0000000
--- a/Characters/Terran.js
+++ /dev/null
@@ -1,1096 +0,0 @@
-/******* Define Terran units *******/
-var Terran = {};
-Terran.SCV = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "SCV",
- imgPos: {
- moving: {
- left: [5, 77, 149, 221, 293, 365, 437, 509, 581, 725, 797, 869, 941, 1013, 1085, 1157],
- top: [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
- },
- attack: {
- left: [
- [5, 5, 5, 5, 5], [77, 77, 77, 77, 77],
- [149, 149, 149, 149, 149], [221, 221, 221, 221, 221],
- [293, 293, 293, 293, 293], [365, 365, 365, 365, 365],
- [437, 437, 437, 437, 437], [509, 509, 509, 509, 509],
- [581, 581, 581, 581, 581], [725, 725, 725, 725, 725],
- [797, 797, 797, 797, 797], [869, 869, 869, 869, 869],
- [941, 941, 941, 941, 941], [1013, 1013, 1013, 1013, 1013],
- [1085, 1085, 1085, 1085, 1085], [1157, 1157, 1157, 1157, 1157]
- ],
- top: [
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149],
- [77, 77, 149, 149, 149], [77, 77, 149, 149, 149]
- ]
- }
- },
- width: 62,
- height: 62,
- frame: {
- moving: 1,
- attack: 5
- },
- //Only for moving status, override
- speed: 12,
- HP: 60,
- damage: 5,
- armor: 0,
- sight: 245,
- meleeAttack: true,
- attackInterval: 1500,
- dieEffect: Burst.SmallExplode,
- attackEffect: Burst.SCVSpark,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 50,
- man: 1,
- time: 200
- },
- upgrade: ['UpgradeInfantryArmors'],
- items: {
- '4': { name: 'repair' },
- '5': { name: 'gather' },
- '7': { name: 'BasicBuilding' },
- '8': { name: 'AdvancedBuilding' }
- },
- buildTerranBuilding: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Ensnare
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, 40, function () {
- if (Resource.payCreditBill.call(myself)) {
- var target = Building.TerranBuilding[myself.buildName];
- var construction = new (eval('Building.' + target.prototype.evolves[0].step))({ x: location.x - target.prototype.width / 2, y: location.y - target.prototype.height / 2, team: myself.team });
- construction.buildName = myself.buildName;
- //Calculate duration
- var duration = Resource.getCost(myself.buildName).time;
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 40;
- //Processing flag on transfer
- construction.processing = {
- name: construction.buildName,
- startTime: Game.mainTick,
- time: duration
- };
- //Evolve chain
- for (var N = 1; N < target.prototype.evolves.length; N++) {
- (function (n) {
- var evolveInfo = target.prototype.evolves[n];
- Game.commandTimeout(function () {
- if (construction.status != 'dead') {
- //Evolve
- var evolveTarget = (eval('Building.' + evolveInfo.step));
- //Step is constructor function
- if (evolveTarget) {
- var old = construction;
- construction = construction.evolveTo({
- type: evolveTarget,
- mixin: (evolveTarget.prototype.name == 'ConstructionSkeleton') ? { type: construction.buildName } : null,
- chain: true
- });
- construction.processing = old.processing;
- construction.buildName = old.buildName;
- }
- else {
- construction.status = evolveInfo.step;
- }
- }
- }, duration * 100 * evolveInfo.percent);
- })(N);
- }
- //Final evolve
- Game.commandTimeout(function () {
- if (construction.status != 'dead') {
- //Evolve
- construction.evolveTo({ type: Building.TerranBuilding[construction.buildName] });
- }
- }, duration * 100);
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.farmer = this;
- Button.callback.buildType = 'TerranBuilding';
- $('div.GameLayer').attr('status', 'button');
- }
- }
- }
-});
-Terran.Marine = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Marine",
- imgPos: {
- moving: {
- left: [
- [10, 10, 10, 10, 10, 10, 10, 10, 10], [74, 74, 74, 74, 74, 74, 74, 74, 74],
- [138, 138, 138, 138, 138, 138, 138, 138, 138], [202, 202, 202, 202, 202, 202, 202, 202, 202],
- [266, 266, 266, 266, 266, 266, 266, 266, 266], [330, 330, 330, 330, 330, 330, 330, 330, 330],
- [394, 394, 394, 394, 394, 394, 394, 394, 394], [458, 458, 458, 458, 458, 458, 458, 458, 458],
- [522, 522, 522, 522, 522, 522, 522, 522, 522], [650, 650, 650, 650, 650, 650, 650, 650, 650],
- [714, 714, 714, 714, 714, 714, 714, 714, 714], [778, 778, 778, 778, 778, 778, 778, 778, 778],
- [842, 842, 842, 842, 842, 842, 842, 842, 842], [906, 906, 906, 906, 906, 906, 906, 906, 906],
- [970, 970, 970, 970, 970, 970, 970, 970, 970], [1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034, 1034]
- ],
- top: [
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778],
- [266, 330, 394, 458, 522, 586, 650, 714, 778], [266, 330, 394, 458, 522, 586, 650, 714, 778]
- ]
- },
- attack: {
- left: [
- [10, 10, 10, 10, 10, 10, 10], [74, 74, 74, 74, 74, 74, 74],
- [138, 138, 138, 138, 138, 138, 138], [202, 202, 202, 202, 202, 202, 202],
- [266, 266, 266, 266, 266, 266, 266], [330, 330, 330, 330, 330, 330, 330],
- [394, 394, 394, 394, 394, 394, 394], [458, 458, 458, 458, 458, 458, 458],
- [522, 522, 522, 522, 522, 522, 522], [650, 650, 650, 650, 650, 650, 650],
- [714, 714, 714, 714, 714, 714, 714], [778, 778, 778, 778, 778, 778, 778],
- [842, 842, 842, 842, 842, 842, 842], [906, 906, 906, 906, 906, 906, 906],
- [970, 970, 970, 970, 970, 970, 970], [1034, 1034, 1034, 1034, 1034, 1034, 1034]
- ],
- top: [
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202],
- [74, 138, 202, 138, 202, 138, 202], [74, 138, 202, 138, 202, 138, 202]
- ]
- },
- dock: {
- left: [10, 74, 138, 202, 266, 330, 394, 458, 522, 650, 714, 778, 842, 906, 970, 1034],
- top: [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
- }
- },
- width: 44,
- height: 44,
- frame: {
- moving: 9,
- dock: 1,
- attack: 7
- },
- //Only for moving status, override
- speed: 10,
- HP: 40,
- damage: 6,
- armor: 0,
- sight: 245,
- attackRange: 140,
- attackInterval: 1500,
- dieEffect: Burst.HumanDeath,
- attackEffect: Burst.ShootSpark,
- isFlying: false,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 50,
- man: 1,
- time: 240
- },
- upgrade: ['UpgradeInfantryWeapons', 'UpgradeInfantryArmors'],
- items: {
- '7': { name: 'StimPacks', condition: function () {
- return Magic.StimPacks.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Terran.Firebat = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Firebat",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [32, 32, 32, 32, 32, 32, 32, 32],
- [64, 64, 64, 64, 64, 64, 64, 64], [96, 96, 96, 96, 96, 96, 96, 96],
- [128, 128, 128, 128, 128, 128, 128, 128], [160, 160, 160, 160, 160, 160, 160, 160],
- [192, 192, 192, 192, 192, 192, 192, 192], [224, 224, 224, 224, 224, 224, 224, 224],
- [256, 256, 256, 256, 256, 256, 256, 256], [320, 320, 320, 320, 320, 320, 320, 320],
- [352, 352, 352, 352, 352, 352, 352, 352], [384, 384, 384, 384, 384, 384, 384, 384],
- [416, 416, 416, 416, 416, 416, 416, 416], [448, 448, 448, 448, 448, 448, 448, 448],
- [480, 480, 480, 480, 480, 480, 480, 480], [512, 512, 512, 512, 512, 512, 512, 512]
- ],
- top: [
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288],
- [64, 96, 128, 160, 192, 224, 256, 288], [64, 96, 128, 160, 192, 224, 256, 288]
- ]
- },
- dock: {
- left: [0, 32, 64, 96, 128, 160, 192, 224, 256, 320, 352, 384, 416, 448, 480, 512],
- top: [64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0, 0], [32, 32, 32, 32, 32, 32],
- [64, 64, 64, 64, 64, 64], [96, 96, 96, 96, 96, 96],
- [128, 128, 128, 128, 128, 128], [160, 160, 160, 160, 160, 160],
- [192, 192, 192, 192, 192, 192], [224, 224, 224, 224, 224, 224],
- [256, 256, 256, 256, 256, 256], [320, 320, 320, 320, 320, 320],
- [352, 352, 352, 352, 352, 352], [384, 384, 384, 384, 384, 384],
- [416, 416, 416, 416, 416, 416], [448, 448, 448, 448, 448, 448],
- [480, 480, 480, 480, 480, 480], [512, 512, 512, 512, 512, 512]
- ],
- top: [
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32],
- [0, 32, 32, 32, 32, 32], [0, 32, 32, 32, 32, 32]
- ]
- }
- },
- width: 32,
- height: 32,
- frame: {
- moving: 8,
- dock: 1,
- attack: 6
- },
- //Only for moving status, override
- speed: 10,
- HP: 50,
- damage: 16,
- armor: 1,
- sight: 245,
- attackRange: 70,
- attackInterval: 2200,
- dieEffect: Burst.SmallExplode,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.WAVE_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- AOE: {
- type: "LINE",
- hasEffect: false,
- radius: 35
- },
- cost: {
- mine: 50,
- gas: 25,
- man: 1,
- time: 240
- },
- upgrade: ['UpgradeInfantryWeapons', 'UpgradeInfantryArmors'],
- items: {
- '7': { name: 'StimPacks', condition: function () {
- return Magic.StimPacks.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Terran.Ghost = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ghost",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0, 0], [43, 43, 43, 43, 43, 43, 43, 43, 43],
- [86, 86, 86, 86, 86, 86, 86, 86, 86], [129, 129, 129, 129, 129, 129, 129, 129, 129],
- [172, 172, 172, 172, 172, 172, 172, 172, 172], [215, 215, 215, 215, 215, 215, 215, 215, 215],
- [258, 258, 258, 258, 258, 258, 258, 258, 258], [301, 301, 301, 301, 301, 301, 301, 301, 301],
- [344, 344, 344, 344, 344, 344, 344, 344, 344], [430, 430, 430, 430, 430, 430, 430, 430, 430],
- [473, 473, 473, 473, 473, 473, 473, 473, 473], [516, 516, 516, 516, 516, 516, 516, 516, 516],
- [559, 559, 559, 559, 559, 559, 559, 559, 559], [602, 602, 602, 602, 602, 602, 602, 602, 602],
- [645, 645, 645, 645, 645, 645, 645, 645, 645], [688, 688, 688, 688, 688, 688, 688, 688, 688]
- ],
- top: [
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312],
- [0, 39, 78, 117, 156, 195, 234, 273, 312], [0, 39, 78, 117, 156, 195, 234, 273, 312]
- ]
- },
- attack: {
- left: [
- [0, 0, 0, 0], [43, 43, 43, 43],
- [86, 86, 86, 86], [129, 129, 129, 129],
- [172, 172, 172, 172], [215, 215, 215, 215],
- [258, 258, 258, 258], [301, 301, 301, 301],
- [344, 344, 344, 344], [430, 430, 430, 430],
- [473, 473, 473, 473], [516, 516, 516, 516],
- [559, 559, 559, 559], [602, 602, 602, 602],
- [645, 645, 645, 645], [688, 688, 688, 688]
- ],
- top: [
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468],
- [351, 390, 429, 468], [351, 390, 429, 468]
- ]
- },
- dock: {
- left: [0, 43, 86, 129, 172, 215, 258, 301, 344, 430, 473, 516, 559, 602, 645, 688],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- }
- },
- width: 43,
- height: 39,
- frame: {
- moving: 9,
- dock: 1,
- attack: 4
- },
- //Only for moving status, override
- speed: 10,
- HP: 45,
- damage: 10,
- armor: 0,
- MP: 200,
- sight: 315,
- attackRange: 210,
- attackInterval: 2200,
- dieEffect: Burst.HumanDeath,
- attackEffect: Burst.FireSpark,
- isFlying: false,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.WAVE_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 25,
- gas: 75,
- man: 1,
- time: 500
- },
- upgrade: ['UpgradeInfantryWeapons', 'UpgradeInfantryArmors'],
- items: {
- '7': { name: 'Cloak', condition: function () {
- return Magic.PersonalCloak.enabled;
- } },
- '8': { name: 'Lockdown', condition: function () {
- return Magic.Lockdown.enabled;
- } },
- '9': { name: 'NuclearStrike', condition: function () {
- return Magic.NuclearStrike.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Terran.Medic = Unit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Medic",
- imgPos: {
- moving: {
- left: [
- [16, 16, 16, 16, 16, 16, 16], [80, 80, 80, 80, 80, 80, 80],
- [144, 144, 144, 144, 144, 144, 144], [208, 208, 208, 208, 208, 208, 208],
- [272, 272, 272, 272, 272, 272, 272], [336, 336, 336, 336, 336, 336, 336],
- [400, 400, 400, 400, 400, 400, 400], [464, 464, 464, 464, 464, 464, 464],
- [528, 528, 528, 528, 528, 528, 528], [656, 656, 656, 656, 656, 656, 656],
- [720, 720, 720, 720, 720, 720, 720], [784, 784, 784, 784, 784, 784, 784],
- [848, 848, 848, 848, 848, 848, 848], [912, 912, 912, 912, 912, 912, 912],
- [976, 976, 976, 976, 976, 976, 976], [1040, 1040, 1040, 1040, 1040, 1040, 1040]
- ],
- top: [
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784],
- [400, 464, 528, 592, 656, 720, 784], [400, 464, 528, 592, 656, 720, 784]
- ]
- },
- dock: {
- left: [16, 80, 144, 208, 272, 336, 400, 464, 528, 656, 720, 784, 848, 912, 976, 1040],
- top: [400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400, 400]
- },
- attack: {
- left: [
- [16, 16, 16, 16, 16, 16], [80, 80, 80, 80, 80, 80],
- [144, 144, 144, 144, 144, 144], [208, 208, 208, 208, 208, 208],
- [272, 272, 272, 272, 272, 272], [336, 336, 336, 336, 336, 336],
- [400, 400, 400, 400, 400, 400], [464, 464, 464, 464, 464, 464],
- [528, 528, 528, 528, 528, 528], [656, 656, 656, 656, 656, 656],
- [720, 720, 720, 720, 720, 720], [784, 784, 784, 784, 784, 784],
- [848, 848, 848, 848, 848, 848], [912, 912, 912, 912, 912, 912],
- [976, 976, 976, 976, 976, 976], [1040, 1040, 1040, 1040, 1040, 1040]
- ],
- top: [
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336],
- [16, 80, 144, 208, 272, 336], [16, 80, 144, 208, 272, 336]
- ]
- }
- },
- width: 32,
- height: 32,
- frame: {
- moving: 7,
- dock: 1,
- attack: 6 //Reserved
- },
- //Only for moving status, override
- speed: 10,
- HP: 60,
- armor: 1,
- MP: 200,
- sight: 315,
- dieEffect: Burst.MedicDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 50,
- gas: 25,
- man: 1,
- time: 300
- },
- upgrade: ['UpgradeInfantryArmors'],
- items: {
- '7': { name: 'Heal' },
- '8': { name: 'Restoration', condition: function () {
- return Magic.Restoration.enabled;
- } },
- '9': { name: 'OpticalFlare', condition: function () {
- return Magic.OpticalFlare.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- Unit.turnAround.call(this);
- }
- }
-});
-Terran.Vulture = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.attack = this.imgPos.dock = this.imgPos.moving;
- this.frame.attack = this.frame.dock = this.frame.moving;
- this.spiderMines = 3;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Vulture",
- imgPos: {
- moving: {
- left: [10, 110, 210, 310, 410, 510, 610, 710, 810, 110, 210, 310, 410, 510, 610, 710],
- top: [10, 10, 10, 10, 10, 10, 10, 10, 10, 110, 110, 110, 110, 110, 110, 110]
- }
- },
- width: 80,
- height: 80,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 16,
- HP: 80,
- damage: 20,
- armor: 0,
- sight: 280,
- attackRange: 175,
- attackInterval: 3000,
- dieEffect: Burst.MiddleExplode,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.MIDDLE,
- attackType: AttackableUnit.WAVE_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 75,
- man: 2,
- time: 300
- },
- upgrade: ['UpgradeVehicleWeapons', 'UpgradeVehicleArmors'],
- items: {
- '7': { name: 'SpiderMines', condition: function () {
- return Magic.SpiderMines.enabled;
- } }
- }
- }
-});
-Terran.Tank = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.imgPos.attack = this.imgPos.dock;
- this.frame.attack = this.frame.dock;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Tank",
- imgPos: {
- moving: {
- left: [
- [24, 24, 24], [152, 152, 152],
- [280, 280, 280], [408, 408, 408],
- [536, 536, 536], [664, 664, 664],
- [792, 792, 792], [920, 920, 920],
- [1048, 1048, 1048], [1304, 1304, 1304],
- [1432, 1432, 1432], [1560, 1560, 1560],
- [1688, 1688, 1688], [1816, 1816, 1816],
- [1944, 1944, 1944], [2072, 2072, 2072]
- ],
- top: [
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280],
- [24, 152, 280], [24, 152, 280]
- ]
- },
- dock: {
- left: [24, 152, 280, 408, 536, 664, 792, 920, 1048, 1304, 1432, 1560, 1688, 1816, 1944, 2072],
- top: [24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]
- }
- },
- width: 80,
- height: 80,
- frame: {
- moving: 3,
- dock: 1
- },
- //Only for moving status, override
- speed: 10,
- HP: 150,
- damage: 30,
- armor: 1,
- sight: 350,
- attackRange: 210,
- attackInterval: 3700,
- dieEffect: Burst.BigExplode,
- attackEffect: Burst.FireSpark,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.BIG,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 150,
- gas: 100,
- man: 2,
- time: 500
- },
- upgrade: ['UpgradeVehicleWeapons', 'UpgradeVehicleArmors'],
- items: {
- '7': { name: 'SeigeMode', condition: function () {
- return Magic.SeigeMode.enabled;
- } }
- }
- }
-});
-Terran.Goliath = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Bind bgm
- this.sound.attackG = new Audio(Game.CDN + 'bgm/' + this.name + '.attack.wav');
- this.sound.attackF = new Audio(Game.CDN + 'bgm/' + this.name + '.attackF.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "Goliath",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [76, 76, 76, 76, 76, 76, 76, 76, 76, 76],
- [152, 152, 152, 152, 152, 152, 152, 152, 152, 152], [228, 228, 228, 228, 228, 228, 228, 228, 228, 228],
- [304, 304, 304, 304, 304, 304, 304, 304, 304, 304], [380, 380, 380, 380, 380, 380, 380, 380, 380, 380],
- [456, 456, 456, 456, 456, 456, 456, 456, 456, 456], [532, 532, 532, 532, 532, 532, 532, 532, 532, 532],
- [608, 608, 608, 608, 608, 608, 608, 608, 608, 608], [760, 760, 760, 760, 760, 760, 760, 760, 760, 760],
- [836, 836, 836, 836, 836, 836, 836, 836, 836, 836], [912, 912, 912, 912, 912, 912, 912, 912, 912, 912],
- [988, 988, 988, 988, 988, 988, 988, 988, 988, 988], [1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064, 1064],
- [1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140, 1140], [1216, 1216, 1216, 1216, 1216, 1216, 1216, 1216, 1216, 1216]
- ],
- top: [
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684],
- [0, 76, 152, 228, 304, 380, 456, 532, 608, 684], [0, 76, 152, 228, 304, 380, 456, 532, 608, 684]
- ]
- },
- attack: {
- left: [
- [0, 0], [76, 76],
- [152, 152], [228, 228],
- [304, 304], [380, 380],
- [456, 456], [532, 532],
- [608, 608], [760, 760],
- [836, 836], [912, 912],
- [988, 988], [1064, 1064],
- [1140, 1140], [1216, 1216]
- ],
- top: [
- [608, 760], [608, 760],
- [608, 760], [608, 760],
- [608, 760], [608, 760],
- [608, 760], [608, 760],
- [608, 760], [608, 760],
- [608, 760], [608, 760],
- [608, 760], [608, 760],
- [608, 760], [608, 760]
- ]
- },
- dock: {
- left: [0, 76, 152, 228, 304, 380, 456, 532, 608, 760, 836, 912, 988, 1064, 1140, 1216],
- top: [608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608, 608]
- }
- },
- width: 76,
- height: 76,
- frame: {
- moving: 10,
- dock: 1,
- attack: 2
- },
- //Only for moving status, override
- speed: 11,
- HP: 125,
- attackMode: {
- flying: {
- attackRange: 175,
- attackInterval: 2200,
- damage: 20,
- attackType: AttackableUnit.BURST_ATTACK
- },
- ground: {
- attackRange: 175,
- attackEffect: Burst.ShootSpark,
- attackInterval: 2200,
- damage: 12,
- attackType: AttackableUnit.NORMAL_ATTACK
- },
- status: false
- },
- //Default
- damage: 12,
- armor: 1,
- sight: 280,
- attackRange: 175,
- dieEffect: Burst.MiddleExplode,
- isFlying: false,
- unitType: Unit.BIG,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 100,
- gas: 50,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeVehicleWeapons', 'UpgradeVehicleArmors']
- }
-});
-Terran.Wraith = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- //Bind bgm
- this.sound.attackG = new Audio(Game.CDN + 'bgm/' + this.name + '.attack.wav');
- this.sound.attackF = new Audio(Game.CDN + 'bgm/' + this.name + '.attackF.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "Wraith",
- imgPos: {
- moving: {
- left: [5, 69, 133, 197, 261, 325, 389, 453, 517, 69, 133, 197, 261, 325, 389, 453],
- top: [5, 5, 5, 5, 5, 5, 5, 5, 5, 69, 69, 69, 69, 69, 69, 69]
- }
- },
- width: 54,
- height: 54,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 16,
- HP: 120,
- armor: 0,
- MP: 200,
- sight: 245,
- attackMode: {
- flying: {
- attackRange: 175,
- attackInterval: 2200,
- damage: 20,
- attackType: AttackableUnit.BURST_ATTACK
- },
- ground: {
- attackRange: 105,
- attackInterval: 2200,
- damage: 8,
- attackType: AttackableUnit.NORMAL_ATTACK
- },
- status: false
- },
- //Default
- damage: 8,
- attackRange: 105,
- dieEffect: Burst.MiddleExplode,
- isFlying: true,
- unitType: Unit.BIG,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 150,
- gas: 100,
- man: 2,
- time: 600
- },
- upgrade: ['UpgradeShipWeapons', 'UpgradeShipArmors'],
- items: {
- '7': { name: 'Cloak', condition: function () {
- return Magic.Cloak.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Terran.Dropship = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- //Transport
- this.loadedUnits = [];
- },
- prototypePlus: {
- //Add basic unit info
- name: "Dropship",
- imgPos: {
- moving: {
- left: [0, 60, 120, 180, 240, 300, 360, 420, 480, 60, 120, 180, 240, 300, 360, 420],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 60, 60, 60, 60, 60, 60]
- }
- },
- width: 60,
- height: 60,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 13,
- HP: 150,
- armor: 1,
- sight: 280,
- dieEffect: Burst.MiddleExplode,
- isFlying: true,
- unitType: Unit.BIG,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 100,
- gas: 100,
- man: 2,
- time: 500
- },
- upgrade: ['UpgradeShipArmors'],
- items: {
- '8': { name: 'Load' },
- '9': { name: 'UnloadAll' }
- },
- //Override
- dock: function () {
- //Use the same behavior
- Unit.hover.call(this);
- },
- die: Zerg.Overlord.prototype.die
- }
-});
-Terran.Vessel = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Vessel",
- imgPos: {
- moving: {
- left: [14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14],
- top: [24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24]
- }
- },
- width: 70,
- height: 55,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 12,
- HP: 200,
- armor: 1,
- MP: 200,
- sight: 350,
- dieEffect: Burst.BigExplode,
- isFlying: true,
- unitType: Unit.BIG,
- detector: Gobj.detectorBuffer,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 100,
- gas: 225,
- man: 2,
- time: 800
- },
- upgrade: ['UpgradeShipArmors'],
- items: {
- '7': { name: 'DefensiveMatrix' },
- '8': { name: 'EMPShockwave', condition: function () {
- return Magic.EMPShockwave.enabled;
- } },
- '9': { name: 'Irradiate', condition: function () {
- return Magic.Irradiate.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- Unit.hover.call(this);
- }
- }
-});
-Terran.BattleCruiser = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "BattleCruiser",
- imgPos: {
- moving: {
- left: [13, 133, 253, 373, 493, 613, 733, 853, 973, 133, 253, 373, 493, 613, 733, 853],
- top: [13, 13, 13, 13, 13, 13, 13, 13, 13, 133, 133, 133, 133, 133, 133, 133]
- }
- },
- width: 94,
- height: 94,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 500,
- damage: 25,
- armor: 3,
- MP: 200,
- sight: 385,
- attackRange: 210,
- attackInterval: 3000,
- dieEffect: Burst.BigExplode,
- isFlying: true,
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- cost: {
- mine: 400,
- gas: 300,
- man: 8,
- time: 1330
- },
- upgrade: ['UpgradeShipWeapons', 'UpgradeShipArmors'],
- items: {
- '7': { name: 'Yamato', condition: function () {
- return Magic.Yamato.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Terran.Valkyrie = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.attack = this.imgPos.dock = this.imgPos.moving;
- this.frame.attack = this.frame.dock = this.frame.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Valkyrie",
- imgPos: {
- moving: {
- left: [35, 163, 291, 419, 547, 675, 803, 931, 1059, 163, 291, 419, 547, 675, 803, 931],
- top: [35, 35, 35, 35, 35, 35, 35, 35, 35, 163, 163, 163, 163, 163, 163, 163]
- }
- },
- width: 58,
- height: 58,
- frame: {
- moving: 1
- },
- //Only for moving status, override
- speed: 16,
- HP: 200,
- damage: 6,
- armor: 2,
- sight: 280,
- attackRange: 210,
- attackInterval: 600,
- dieEffect: Burst.MiddleExplode,
- isFlying: true,
- attackLimit: "flying",
- unitType: Unit.BIG,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.TerranBuilding.prototype.recover,
- AOE: {
- type: "LINE",
- hasEffect: true,
- radius: 50
- },
- cost: {
- mine: 250,
- gas: 125,
- man: 3,
- time: 500
- },
- upgrade: ['UpgradeShipWeapons', 'UpgradeShipArmors'],
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Terran.Civilian = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Civilian",
- imgPos: {
- moving: {
- left: [
- [11, 11, 11, 11, 11, 11, 11, 11], [35, 35, 35, 35, 35, 35, 35, 35],
- [60, 60, 60, 60, 60, 60, 60, 60], [84, 84, 84, 84, 84, 84, 84, 84],
- [108, 108, 108, 108, 108, 108, 108, 108], [131, 131, 131, 131, 131, 131, 131, 131],
- [154, 154, 154, 154, 154, 154, 154, 154], [177, 177, 177, 177, 177, 177, 177, 177],
- [200, 200, 200, 200, 200, 200, 200, 200], [224, 224, 224, 224, 224, 224, 224, 224],
- [248, 248, 248, 248, 248, 248, 248, 248], [272, 272, 272, 272, 272, 272, 272, 272],
- [293, 293, 293, 293, 293, 293, 293, 293], [317, 317, 317, 317, 317, 317, 317, 317],
- [342, 342, 342, 342, 342, 342, 342, 342], [366, 366, 366, 366, 366, 366, 366, 366]
- ],
- top: [
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211],
- [246, 0, 37, 70, 105, 142, 176, 211], [246, 0, 37, 70, 105, 142, 176, 211]
- ]
- }
- },
- width: 21,
- height: 31,
- frame: {
- moving: 8,
- dock: 1
- },
- //Only for moving status, override
- speed: 6,
- HP: 60,
- armor: 0,
- sight: 245,
- dieEffect: Burst.HumanDeath,
- isFlying: false,
- unitType: Unit.SMALL,
- recover: Building.TerranBuilding.prototype.recover,
- upgrade: ['UpgradeInfantryArmors'],
- //Override
- dock: function () {
- //Use the same behavior
- Unit.turnAround.call(this);
- }
- }
-});
-//# sourceMappingURL=Terran.js.map
\ No newline at end of file
diff --git a/Characters/Units.js b/Characters/Units.js
deleted file mode 100644
index 87dfd66..0000000
--- a/Characters/Units.js
+++ /dev/null
@@ -1,1051 +0,0 @@
-//Define unit which has HP/direction and be selectable, unattackable unit
-var Unit = Gobj.extends({
- constructorPlus: function (props) {
- //Add id for unit
- this.id = Unit.currentID++;
- this.direction = Unit.randomDirection();
- this.angle = 0;
- this.life = this.get('HP');
- if (this.SP)
- this.shield = this.get('SP');
- if (this.MP)
- this.magic = 50;
- this.selected = false;
- //Each unit instance has its own sound
- this.sound = {
- selected: new Audio(Game.CDN + 'bgm/' + this.name + '.selected.wav'),
- moving: new Audio(Game.CDN + 'bgm/' + this.name + '.moving.wav'),
- death: new Audio(Game.CDN + 'bgm/' + this.name + '.death.wav')
- };
- //Execute below after inherited class fully constructed, postpone
- var myself = this;
- Game.commandTimeout(function () {
- //Add this unit into Game
- Unit.allUnits.push(myself);
- //Flying units show above ground units
- Unit.sortAllUnits();
- //Show unit
- myself.dock();
- }, 0);
- },
- prototypePlus: {
- name: "Unit",
- isFlying: true,
- //Override Gobj method
- animeFrame: function () {
- //Animation play
- this.action++;
- //Override Gobj here, support hidden frames
- var arrLimit = (this.imgPos[this.status].left[0] instanceof Array) ? (this.imgPos[this.status].left[0].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[0][this.action] == -1)
- this.action = 0;
- },
- detectOutOfBound: function () {
- var boundX = Map.getCurrentMap().width - this.width;
- var boundY = Map.getCurrentMap().height - this.height;
- //Right Bound
- if (this.x > boundX) {
- this.x = boundX;
- }
- //Left Bound
- if (this.x < 0) {
- this.x = 0;
- }
- //Bottom Bound
- if (this.y > boundY) {
- this.y = boundY;
- }
- //Top Bound
- if (this.y < 0) {
- this.y = 0;
- }
- },
- //Can move in any direction
- updateLocation: function () {
- this.x = Math.round(this.x + this.get('speed') * Math.cos(this.angle));
- this.y = Math.round(this.y + this.get('speed') * Math.sin(this.angle));
- },
- //Add new functions to prototype
- turnTo: function (direction) {
- //Change direction
- this.direction = direction;
- },
- //Dock means stop moving but keep animation
- dock: function () {
- //Clear old timer
- this.stop();
- //Launch new dock timer
- this.status = "dock";
- this.action = 0;
- //Stop routing
- delete this.allFrames['routing'];
- var myself = this;
- var animateFrame = function () {
- //Only play animation, will not move
- myself.animeFrame();
- };
- this.allFrames['animate'] = animateFrame;
- },
- stand: function () {
- this.dock();
- },
- stopMoving: function () {
- this.dock();
- },
- run: function () {
- this.moving();
- },
- navigateTo: function (clickX, clickY, range) {
- if (!range)
- range = Unit.moveRange; //Smallest limit by default
- //Center position
- var charaX = this.posX();
- var charaY = this.posY();
- //Already at check point
- if (this.insideCircle({ centerX: clickX, centerY: clickY, radius: range })) {
- this.dock();
- //Stop routing
- delete this.allFrames['routing'];
- //Reach destination flag
- return true;
- }
- else {
- var vector = [clickX - this.posX(), clickY - this.posY()];
- vector = vector.map(function (n) {
- return n / _$.hypot(vector);
- });
- //Only unit on ground will collide with others
- var FORCE_1 = 0.4;
- if (!this.isFlying) {
- var myself_1 = this;
- //Soft collision
- var softCollisions = Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
- if (chara == myself_1)
- return false;
- else
- return !(chara.isFlying) && chara.softCollideWith(myself_1);
- });
- softCollisions.forEach(function (chara) {
- var softResist = [myself_1.posX() - chara.posX(), myself_1.posY() - chara.posY()];
- softResist = softResist.map(function (n) {
- return n * FORCE_1 / _$.hypot(softResist);
- });
- vector[0] += softResist[0];
- vector[1] += softResist[1];
- });
- //Hard collision
- softCollisions.filter(function (chara) {
- return chara.collideWith(myself_1);
- }).forEach(function (chara) {
- var hardResist = [myself_1.posX() - chara.posX(), myself_1.posY() - chara.posY()];
- hardResist = hardResist.map(function (n) {
- return n * FORCE_1 / _$.hypot(hardResist);
- });
- vector[0] += hardResist[0];
- vector[1] += hardResist[1];
- });
- }
- this.turnTo(Unit.wrapDirection(vector));
- vector.reverse(); //y,x
- this.angle = Math.atan2(vector[0], vector[1]);
- }
- },
- faceTo: function (target, preventAction) {
- var direction;
- //Unit or Building
- if (target instanceof Gobj) {
- direction = Unit.wrapDirection([target.posX() - this.posX(), target.posY() - this.posY()]);
- }
- else {
- //Location={x:1,y:2}
- direction = Unit.wrapDirection([target.x - this.posX(), target.y - this.posY()]);
- }
- if (!preventAction)
- this.turnTo(direction);
- return direction;
- },
- escapeFrom: function (enemy) {
- //Add to fix holding issue
- if (this.hold)
- return;
- //From enemy to myself
- var escapeVector = [this.posX() - enemy.posX(), this.posY() - enemy.posY()];
- //Move by 100px
- escapeVector = escapeVector.map(function (n) {
- return n * 100 / _$.hypot(escapeVector);
- });
- //Escape along vector
- this.moveTo(this.posX() + escapeVector[0], this.posY() + escapeVector[1]);
- },
- moveTo: function (clickX, clickY, range, callback) {
- if (!range)
- range = Unit.moveRange; //Smallest limit by default
- //Start new routing
- var myself = this;
- var routingFrame = function () {
- if (myself.navigateTo(clickX, clickY, range)) {
- //Run callback when reach target
- if (typeof (callback) == 'function')
- callback();
- return true;
- }
- };
- this.allFrames['routing'] = routingFrame;
- //Start moving
- this.run();
- },
- moveToward: function (target, range, callback) {
- if (!range)
- range = Unit.moveRange; //Smallest limit by default
- //Start new routing
- var myself = this;
- var routingFrame = function () {
- if (target.status != 'dead') {
- if (myself.navigateTo(target.posX(), target.posY(), range)) {
- //Run callback when reach target
- if (typeof (callback) == 'function')
- callback();
- //Reach destination flag, fix twice callback issue
- return true;
- }
- }
- else {
- delete myself.allFrames['routing'];
- myself.dock();
- }
- };
- this.allFrames['routing'] = routingFrame;
- //Start moving
- this.run();
- },
- //Override for sound effect
- die: function () {
- //Old behavior
- Gobj.prototype.die.call(this);
- this.life = 0;
- //Stop routing
- delete this.allFrames['routing'];
- //If has sound effect
- if (this.sound.death && this.insideScreen()) {
- this.sound.death.play();
- }
- },
- //AI when attacked by enemy
- reactionWhenAttackedBy: function (enemy, onlyDamage) {
- //Resign and give reward to enemy if has no life before dead
- if (this.life <= 0) {
- //If multiple target, only die once and give reward
- if (this.status != "dead") {
- //Killed by enemy
- this.die();
- //Give enemy reward
- enemy.kill++;
- }
- //Already dead, cannot take following actions
- return;
- }
- //Run away toward bullet direction
- if (this.status == "dock" && !onlyDamage) {
- this.escapeFrom(enemy);
- }
- },
- //Calculate damage, if enemy is damage itself, return that damage directly
- calculateDamageBy: function (enemyObj) {
- var damage = 0;
- if (enemyObj instanceof Gobj) {
- var enemyAttackType = enemyObj.attackType;
- if (!enemyAttackType && enemyObj.attackMode) {
- enemyAttackType = (this.isFlying) ? enemyObj.attackMode.flying.attackType : enemyObj.attackMode.ground.attackType;
- }
- damage = enemyObj.get('damage') * Unit.attackMatrix[enemyAttackType][this.unitType];
- }
- else
- damage = enemyObj;
- return damage;
- },
- 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 = 0.5;
- this.shield -= damage;
- if (this.shield < 0) {
- //Inherit damage
- this.life += (this.shield);
- this.shield = 0;
- }
- }
- else {
- damage = ((this.calculateDamageBy(enemy) - this.get('armor')) * percent) >> 0;
- if (damage < 1)
- damage = 0.5;
- this.life -= damage;
- }
- },
- //Attack ground action
- attackGround: function (position, loop) {
- //Convert to array
- var positions = [].concat(position);
- if (this.attack)
- this.stopAttack();
- //Move to first position
- this.moveTo(positions[0].x, positions[0].y);
- this.targetLock = false;
- var checkpoint = this.destination = positions[0];
- //Join destination chain from next
- positions.slice(1).forEach(function (pos) {
- checkpoint.next = pos;
- checkpoint = checkpoint.next;
- });
- //Patrol loop, dead lock
- if (loop)
- checkpoint.next = this.destination;
- },
- //Patrol action
- patrol: function (position, addHere) {
- //Convert to array
- var positions = [].concat(position);
- if (addHere)
- positions.push({ x: this.posX(), y: this.posY() });
- this.attackGround(positions, true);
- },
- isMachine: function () {
- return ["SCV", "Vulture", "Tank", "Goliath", "Wraith", "Dropship", "Vessel", "BattleCruiser", "Valkyrie",
- "Probe", "Dragoon", "Shuttle", "Reaver", "Observer", "Scout", "Carrier", "Arbiter", "Corsair", "HeroCruiser"]
- .indexOf(this.name) != -1;
- },
- //Life status
- lifeStatus: function () {
- var lifeRatio = this.life / this.get('HP');
- return ((lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red");
- }
- }
-});
-//Assign current ID to each newly born unit
-Unit.currentID = 0;
-//Smallest range for move precision
-Unit.moveRange = 20;
-//Range for mouse select
-Unit.selectRange = 20;
-//Range for melee attack
-Unit.meleeRange = 25; //50
-//Speed matrix, 2^0.5=>0.7
-Unit.speedMatrix = [
- { x: 0, y: -1 }, { x: 0.4, y: -0.9 },
- { x: 0.7, y: -0.7 }, { x: 0.9, y: -0.4 },
- { x: 1, y: 0 }, { x: 0.9, y: 0.4 },
- { x: 0.7, y: 0.7 }, { x: 0.4, y: 0.9 },
- { x: 0, y: 1 }, { x: -0.4, y: 0.9 },
- { x: -0.7, y: 0.7 }, { x: -0.9, y: 0.4 },
- { x: -1, y: 0 }, { x: -0.9, y: -0.4 },
- { x: -0.7, y: -0.7 }, { x: -0.4, y: -0.9 }
-];
-//Get speed matrix by unit speed
-Unit.getSpeedMatrixBy = function (speed) {
- var speedMatrix = _$.clone(Unit.speedMatrix);
- _$.matrixOperation(speedMatrix, function (N) {
- return N * speed;
- });
- return speedMatrix;
-};
-//All units' sight
-Unit.sight = 300;
-//Attack type matrix
-Unit.attackMatrix = [
- [1, 1, 1],
- [0.5, 0.75, 1],
- [1, 0.5, 0.25]
-];
-//Unit type
-Unit.SMALL = 0;
-Unit.MIDDLE = 1;
-Unit.BIG = 2;
-//All existed units, class property
-Unit.allUnits = [];
-Unit.allOurUnits = function () {
- return Unit.allUnits.filter(function (chara) {
- return !(chara.isEnemy());
- });
-};
-Unit.allEnemyUnits = function () {
- return Unit.allUnits.filter(function (chara) {
- return chara.isEnemy();
- });
-};
-Unit.allFlyingUnits = function () {
- return Unit.allUnits.filter(function (chara) {
- return chara.isFlying;
- });
-};
-Unit.allGroundUnits = function () {
- return Unit.allUnits.filter(function (chara) {
- return !(chara.isFlying);
- });
-};
-//Get all units count
-Unit.count = function () {
- return Unit.allUnits.reduce(function (counts, chara) {
- counts[chara.team]++;
- return counts;
- }, Game.getPropArray(0));
-};
-//Sort all units to show flying unit above/after ground unit
-Unit.sortAllUnits = function () {
- Unit.allUnits.sort(function (unit1, unit2) {
- return (unit1.isFlying ? 1 : 0) - (unit2.isFlying ? 1 : 0);
- });
-};
-//Sort units
-Unit.sortUnits = function (units) {
- units.sort(function (unit1, unit2) {
- return (unit1.isFlying ? 1 : 0) - (unit2.isFlying ? 1 : 0);
- });
-};
-//Random direction but can keep all clients same
-Unit.randomDirection = function () {
- //Clossure variable and function
- var rands = [];
- var getRands = function () {
- //Use current tick X randomSeed as seed
- var seed = Game.mainTick + Game.randomSeed;
- var rands = [];
- for (var N = 0; N < 16; N++) {
- //Seed grows up
- seed = (seed * 5 + 3) % 16; //range=16
- rands.push(seed);
- }
- return rands;
- };
- return function () {
- //If all rands used, generate new ones
- if (rands.length == 0)
- rands = getRands();
- return rands.shift();
- };
-}();
-//Convert from vector to 16 directions
-Unit.wrapDirection = function (vector) {
- //Atan2 can distinguish from -PI~PI, Y-axis is reverse
- var angle = Math.atan2(vector[1], vector[0]);
- var piece = Math.PI / 16;
- if (angle > (piece * 15))
- return 12;
- if (angle > (piece * 13))
- return 11;
- if (angle > (piece * 11))
- return 10;
- if (angle > (piece * 9))
- return 9;
- if (angle > (piece * 7))
- return 8;
- if (angle > (piece * 5))
- return 7;
- if (angle > (piece * 3))
- return 6;
- if (angle > piece)
- return 5;
- if (angle > (-piece))
- return 4;
- if (angle > (-piece * 3))
- return 3;
- if (angle > (-piece * 5))
- return 2;
- if (angle > (-piece * 7))
- return 1;
- if (angle > (-piece * 9))
- return 0;
- if (angle > (-piece * 11))
- return 15;
- if (angle > (-piece * 13))
- return 14;
- if (angle > (-piece * 15))
- return 13;
- else
- return 12;
-};
-//Dock action I
-Unit.turnAround = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var dockFrame = function () {
- //Every 2 sec
- if ((Game.mainTick + myself.id) % 20 == 0) {
- //Look around animation
- if (myself.status == "dock") {
- myself.turnTo((myself.direction + 1) % 16); //For all ground soldier to use
- }
- else
- delete myself.allFrames['dock'];
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-//Dock action II
-Unit.walkAround = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var dockFrame = function () {
- //Every 2 sec
- if ((Game.mainTick + myself.id) % 20 == 0) {
- var direction = Unit.randomDirection();
- //Walk around, for all critters to use
- if (myself.status == "dock") {
- myself.moveTo(myself.posX() + myself.get('speed') * (Unit.speedMatrix[direction].x) * 6, myself.posY() + myself.get('speed') * (Unit.speedMatrix[direction].y) * 6);
- }
- else
- delete myself.allFrames['dock'];
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-//Dock action III
-Unit.hover = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var N = 0;
- var hoverOffset = 1;
- var dockFrame = function () {
- //Every 200 ms
- if (Game.mainTick % 2 == 0) {
- //Hover animation
- if (myself.status == "dock") {
- myself.y += hoverOffset;
- if (N % 4 == 0) {
- //myself.turnTo((myself.direction+1)%16);//For marine to use
- hoverOffset = -hoverOffset; //Hover up and down
- }
- }
- else
- delete myself.allFrames['dock'];
- N++;
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-//Dock action IV
-Unit.walkAroundLarva = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var dockFrame = function () {
- //Every 2 sec
- if (Game.mainTick % 20 == 0) {
- //Walk around, for larva to use
- if (myself.status == "dock") {
- if (myself.moved) {
- //Return to original position, range=larva.speed=4
- Unit.prototype.moveTo.call(myself, myself.originX, myself.originY, 4);
- myself.moved = false;
- }
- else {
- //Left from original position, range=larva.speed=4
- myself.direction = Unit.randomDirection();
- Unit.prototype.moveTo.call(myself, myself.posX() + myself.get('speed') * (Unit.speedMatrix[myself.direction].x) * 2, myself.posY() + myself.get('speed') * (Unit.speedMatrix[myself.direction].y) * 2, 4);
- myself.moved = true;
- }
- }
- else
- delete myself.allFrames['dock'];
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-var AttackableUnit = Unit.extends({
- constructorPlus: function (props) {
- this.bullet = {};
- this.kill = 0;
- this.target = {};
- //Idle by default
- this.targetLock = false;
- //Can fire by default
- this.coolDown = true;
- //Init attack range
- if (this.meleeAttack)
- this.attackRange = Math.max(this.radius(), 35);
- //Add attack sound for AttackableUnit
- this.sound.attack = new Audio(Game.CDN + 'bgm/' + this.name + '.attack.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "AttackableUnit",
- isInAttackRange: function (enemy) {
- return enemy.inside({ centerX: this.posX(), centerY: this.posY(), radius: this.get('attackRange') });
- },
- matchAttackLimit: function (enemy) {
- //Has attack limit
- if (this.attackLimit) {
- //Doesn't match attack limit
- if ((this.attackLimit == "flying" && !(enemy.isFlying)) ||
- (this.attackLimit == "ground" && enemy.isFlying))
- return false;
- }
- //No attack limit or match attack limit
- return true;
- },
- attack: function (enemy) {
- //Cannot attack invisible unit or unit who mismatch your attack type
- if (enemy['isInvisible' + this.team] || !(this.matchAttackLimit(enemy))) {
- Referee.voice('pError').play();
- this.stopAttack();
- return;
- }
- //Don't attack same target again unless miss target or tracing target
- if (this.target == enemy) {
- if (this.cannotReachTarget()) {
- if (this.status == 'moving')
- return; //tracing
- }
- else
- return;
- }
- else
- delete this.tracing;
- if (enemy instanceof Gobj && enemy.status != "dead") {
- //Stop old attack and moving
- this.stopAttack();
- this.dock();
- //New attack
- this.target = enemy;
- //Get melee attack range if melee attack unit
- if (this.meleeAttack) {
- //Override
- this.attackRange = this.radius() + enemy.radius();
- }
- //If separate attack mode, override
- if (this.attackMode) {
- this.Bullet = (enemy.isFlying) ? this.attackMode.flying.Bullet : this.attackMode.ground.Bullet;
- this.attackRange = (enemy.isFlying) ? this.get('attackMode.flying.attackRange') : this.get('attackMode.ground.attackRange');
- this.attackEffect = (enemy.isFlying) ? this.attackMode.flying.attackEffect : this.attackMode.ground.attackEffect;
- this.attackInterval = (enemy.isFlying) ? this.get('attackMode.flying.attackInterval') : this.get('attackMode.ground.attackInterval');
- //Change attack bgm
- this.sound.attack = (enemy.isFlying) ? this.sound.attackF : this.sound.attackG;
- this.damage = (enemy.isFlying) ? this.get('attackMode.flying.damage') : this.get('attackMode.ground.damage');
- this.attackType = (enemy.isFlying) ? this.attackMode.flying.attackType : this.attackMode.ground.attackType;
- this.attackMode.status = enemy.isFlying;
- }
- //Move in attack range, no need to move melee
- var range = this.get('attackRange');
- if (this.tracing) {
- //Adjust attack range for tracing
- range = Math.max(this.get('attackRange') * 0.7, (this.radius() + enemy.radius()) * 0.6);
- delete this.tracing;
- }
- //Add to fix holding issue
- if (!this.hold)
- this.moveToward(enemy, range);
- var myself = this;
- var attackFrame = function () {
- //If enemy already dead or becomes invisible or we just miss enemy
- if (enemy.status == "dead" || enemy['isInvisible' + myself.team] || myself.isMissingTarget()) {
- myself.stopAttack();
- myself.dock();
- }
- else {
- //Cannot come in until reload cool down, only dock down can finish attack animation
- if (myself.isReloaded && myself.isReloaded() && myself.isInAttackRange(enemy) && myself.status == "dock") {
- //Load bullet
- myself.coolDown = false;
- //Cool down after attack interval
- Game.commandTimeout(function () {
- myself.coolDown = true;
- }, myself.get('attackInterval'));
- //If AOE, init enemies
- var enemies;
- if (myself.AOE) {
- //Get possible targets
- switch (myself.attackLimit) {
- case "flying":
- enemies = Unit.allUnits.filter(function (chara) {
- return chara.team != myself.team && chara.isFlying;
- });
- break;
- case "ground":
- var enemyUnits = Unit.allUnits.filter(function (chara) {
- return chara.team != myself.team && !(chara.isFlying);
- });
- var enemyBuildings = Building.allBuildings.filter(function (chara) {
- return chara.team != myself.team;
- });
- enemies = enemyUnits.concat(enemyBuildings);
- break;
- default:
- enemies = (Unit.allUnits.concat(Building.allBuildings)).filter(function (chara) {
- return chara.team != myself.team;
- });
- break;
- }
- //Range filter
- switch (myself.AOE.type) {
- case "LINE":
- //Calculate inter-points between enemy
- 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;
- }
- }
- return false;
- });
- break;
- case "MULTIPLE":
- 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];
- });
- }
- }
- //First facing to enemy
- myself.faceTo(enemy);
- //Show attack animation if has
- if (myself.imgPos.attack) {
- myself.action = 0;
- //Change status to show attack frame
- myself.status = "attack";
- //Will return to dock after attack
- Game.commandTimeout(function () {
- //If still show attack
- if (myself.status == "attack") {
- myself.status = "dock";
- myself.action = 0;
- }
- }, myself.frame.attack * 100); //attackAnimation < attackInterval
- }
- //If has bullet
- if (myself.Bullet) {
- var fireBullet = function () {
- //Will shoot multiple bullets in one time
- if (myself.continuousAttack) {
- myself.bullet = [];
- for (var N = 0; N < myself.continuousAttack.count; N++) {
- var bullet = new myself.Bullet({
- from: myself,
- to: enemy
- });
- //Reassign bullets location
- 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 < Math.min(myself.AOE.count, enemies.length); N++) {
- new myself.Bullet({
- from: myself,
- to: enemies[N]
- }).fire();
- }
- }
- else {
- //Reload one new bullet
- myself.bullet = new myself.Bullet({
- from: myself,
- to: enemy
- });
- myself.bullet.fire();
- }
- }
- };
- if (myself.fireDelay)
- Game.commandTimeout(function () {
- fireBullet();
- }, myself.fireDelay);
- else
- fireBullet();
- }
- else {
- //Cause damage when burst appear
- //If AOE, only enemy unit has AOE
- if (myself.AOE) {
- enemies.forEach(function (chara) {
- chara.getDamageBy(myself);
- chara.reactionWhenAttackedBy(myself);
- });
- }
- else {
- //Cause damage after finish whole melee attack action
- Game.commandTimeout(function () {
- enemy.getDamageBy(myself);
- enemy.reactionWhenAttackedBy(myself);
- }, myself.frame.attack * 100);
- }
- //Will die if suicide attack unit
- if (myself.suicide)
- myself.die();
- }
- //If has attack effect (burst)
- if (myself.attackEffect) {
- if (myself.AOE && myself.AOE.hasEffect) {
- enemies.forEach(function (chara) {
- new myself.attackEffect({ x: chara.posX(), y: chara.posY() });
- });
- }
- else {
- new myself.attackEffect({ x: enemy.posX(), y: enemy.posY() });
- }
- }
- //Sound effect, missile attack unit will play sound when bullet fire
- if (!myself.Bullet && myself.insideScreen())
- myself.sound.attack.play();
- }
- }
- };
- this.allFrames['attack'] = attackFrame;
- }
- },
- stopAttack: function () {
- //Stop attacking animation
- delete this.allFrames['attack'];
- //Clear target
- this.target = {};
- },
- findNearbyTargets: function () {
- //Initial
- var myself = this;
- var units = Unit.allUnits.filter(function (chara) {
- return chara.team != myself.team;
- });
- var buildings = Building.allBuildings.filter(function (chara) {
- return chara.team != myself.team;
- });
- var results = [];
- var targets = [
- units.filter(function (chara) {
- return chara.attack;
- }),
- buildings.filter(function (chara) {
- return chara.attack;
- }),
- units.filter(function (chara) {
- return !chara.attack;
- }),
- buildings.filter(function (chara) {
- return !chara.attack;
- })
- ];
- targets.forEach(function (charas) {
- var myX = myself.posX();
- var myY = myself.posY();
- charas = charas.filter(function (chara) {
- return !chara['isInvisible' + myself.team] && myself.canSee(chara) && myself.matchAttackLimit(chara);
- }).sort(function (chara1, chara2) {
- var X1 = chara1.posX(), Y1 = chara1.posY(), X2 = chara2.posX(), Y2 = chara2.posY();
- return (X1 - myX) * (X1 - myX) + (Y1 - myY) * (Y1 - myY) - (X2 - myX) * (X2 - myX) - (Y2 - myY) * (Y2 - myY);
- });
- results = results.concat(charas);
- });
- //Take attackable>>unattackable,unit>>building,near>>far as priority, will attracted if be attacked
- return results;
- },
- highestPriorityTarget: function () {
- return this.findNearbyTargets()[0];
- },
- AI: function () {
- //Dead unit doesn't have following AI
- if (this.status == 'dead')
- return;
- //If no mission, return it to scout status
- if (this.isIdle())
- this.targetLock = false;
- //AI:Attack insight enemy automatically when alive
- //If locking target
- if (this.targetLock) {
- // target ran out of attack range
- if (this.cannotReachTarget()) {
- this.followEnemy();
- }
- }
- else {
- //Find in-range enemy by attack priority
- var enemy = this.highestPriorityTarget();
- //If not attacking but find in-range enemy
- if (!this.isAttacking() && enemy) {
- this.attack(enemy);
- }
- //If target ran outside attack range
- if (this.cannotReachTarget()) {
- //but find insight other enemy
- if (enemy && this.target != enemy) {
- this.attack(enemy);
- }
- else {
- this.followEnemy();
- }
- }
- }
- },
- //Override
- reactionWhenAttackedBy: function (enemy, onlyDamage) {
- //Resign and give reward to enemy if has no life before dead
- if (this.life <= 0) {
- //If multiple target, only die once and give reward
- if (this.status != "dead") {
- //Killed by enemy
- this.die();
- //Give enemy reward
- enemy.kill++;
- }
- //Already dead, cannot take following actions
- return;
- }
- //AI when attacked by enemy
- if (!onlyDamage) {
- if (this.attack && this.matchAttackLimit(enemy) && !enemy['isInvisible' + this.team]) {
- if (this.isIdle()) {
- //Will hatred toward enemy
- this.attack(enemy);
- }
- else if (!this.targetLock && this.target.target !== this) {
- //Will be attracted by higher hatred enemy
- this.attack(enemy);
- }
- }
- else {
- if (this.isIdle())
- this.escapeFrom(enemy);
- }
- }
- },
- isAttacking: function () {
- //Has target
- return (this.target instanceof Gobj);
- },
- followEnemy: function () {
- //Remind to attack again
- this.attack(this.target);
- //Filter out building target
- if (this.target instanceof Unit)
- this.tracing = true;
- },
- isTracing: function () {
- return this.isAttacking() && this.status == "moving";
- },
- isFiring: function () {
- //May out of range and cannot fire, don't follow when attack status
- return this.isAttacking() && this.status == "dock";
- },
- //Override
- isIdle: function () {
- //Not moving or attacking
- return !this.isAttacking() && this.status == "dock";
- },
- cannotReachTarget: function () {
- //Found target outside attack range after once firing, need follow once
- return this.isFiring() && !(this.isInAttackRange(this.target));
- },
- isMissingTarget: function () {
- //Lock on target has global sight, lock off (attackGround) use its own sight
- return !this.targetLock && this.isAttacking() && !(this.canSee(this.target));
- },
- isReloaded: function () {
- //Add for newly reloaded yamato, two kinds of bullet conflict, ignore bullet array
- if ((this.bullet instanceof Gobj) && this.bullet.status != 'dead')
- return false;
- return this.coolDown;
- },
- //Override for attackable unit
- die: function () {
- //Old behavior
- Unit.prototype.die.call(this);
- //Clear new timer for unit
- this.stopAttack();
- this.selected = false;
- }
- }
-});
-//Attack type
-AttackableUnit.NORMAL_ATTACK = 0;
-AttackableUnit.BURST_ATTACK = 1;
-AttackableUnit.WAVE_ATTACK = 2;
-//Dock action I, override
-AttackableUnit.turnAround = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var dockFrame = function () {
- //Every 2 sec
- if ((Game.mainTick + myself.id) % 20 == 0) {
- //Look around animation
- if (myself.isIdle()) {
- myself.turnTo((myself.direction + 1) % 16); //For all ground soldier to use
- }
- else
- delete myself.allFrames['dock'];
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-//Dock action II, override
-AttackableUnit.walkAround = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var dockFrame = function () {
- //Every 2 sec
- if ((Game.mainTick + myself.id) % 20 == 0) {
- var direction = Unit.randomDirection();
- //Walk around, for all critters to use
- if (myself.isIdle()) {
- myself.moveTo(myself.posX() + myself.get('speed') * (Unit.speedMatrix[direction].x) * 6, myself.posY() + myself.get('speed') * (Unit.speedMatrix[direction].y) * 6);
- }
- else
- delete myself.allFrames['dock'];
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-//Dock action III, override
-AttackableUnit.hover = function () {
- //Inherited dock from Unit.js
- Unit.prototype.dock.call(this);
- //Add in new things
- var myself = this;
- var N = 0;
- var hoverOffset = 1;
- var dockFrame = function () {
- //Every 200 ms
- if (Game.mainTick % 2 == 0) {
- //Hover animation
- if (myself.isIdle()) {
- myself.y += hoverOffset;
- if (N % 4 == 0) {
- //myself.turnTo((myself.direction+1)%8);//For marine to use
- hoverOffset = -hoverOffset; //Hover up and down
- }
- }
- else
- delete myself.allFrames['dock'];
- N++;
- }
- };
- this.allFrames['dock'] = dockFrame;
-};
-//# sourceMappingURL=Units.js.map
\ No newline at end of file
diff --git a/Characters/Upgrade.js b/Characters/Upgrade.js
deleted file mode 100644
index a17dc74..0000000
--- a/Characters/Upgrade.js
+++ /dev/null
@@ -1,1153 +0,0 @@
-var Upgrade = {
- //Terran
- UpgradeInfantryWeapons: {
- name: "UpgradeInfantryWeapons",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Terran.Marine.prototype.damage[team] += 1;
- Terran.Firebat.prototype.damage[team] += 2;
- Terran.Ghost.prototype.damage[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.TerranBuilding.EngineeringBay.prototype.items[1];
- }
- },
- UpgradeInfantryArmors: {
- name: "UpgradeInfantryArmors",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Terran.SCV.prototype.armor[team] += 1;
- Terran.Marine.prototype.armor[team] += 1;
- Terran.Firebat.prototype.armor[team] += 1;
- Terran.Ghost.prototype.armor[team] += 1;
- Terran.Medic.prototype.armor[team] += 1;
- Terran.Civilian.prototype.armor[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.TerranBuilding.EngineeringBay.prototype.items[2];
- }
- },
- ResearchU238Shells: {
- name: "ResearchU238Shells",
- cost: {
- mine: 150,
- gas: 150,
- time: 1000
- },
- effect: function (team) {
- Terran.Marine.prototype.attackRange[team] = 175;
- delete Building.TerranBuilding.Academy.prototype.items[1];
- }
- },
- ResearchStimPackTech: {
- name: "ResearchStimPackTech",
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- effect: function () {
- Magic.StimPacks.enabled = true;
- delete Building.TerranBuilding.Academy.prototype.items[2];
- }
- },
- ResearchRestoration: {
- name: "ResearchRestoration",
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- effect: function () {
- Magic.Restoration.enabled = true;
- delete Building.TerranBuilding.Academy.prototype.items[4];
- }
- },
- ResearchOpticalFlare: {
- name: "ResearchOpticalFlare",
- cost: {
- mine: 100,
- gas: 100,
- time: 1200
- },
- effect: function () {
- Magic.OpticalFlare.enabled = true;
- delete Building.TerranBuilding.Academy.prototype.items[5];
- }
- },
- ResearchCaduceusReactor: {
- name: "ResearchCaduceusReactor",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Terran.Medic.prototype.MP[team] = 250;
- delete Building.TerranBuilding.Academy.prototype.items[6];
- }
- },
- ResearchIonThrusters: {
- name: "ResearchIonThrusters",
- cost: {
- mine: 100,
- gas: 100,
- time: 1000
- },
- effect: function (team) {
- Terran.Vulture.prototype.speed[team] = 20;
- delete Building.TerranBuilding.MachineShop.prototype.items[1];
- }
- },
- ResearchSpiderMines: {
- name: "ResearchSpiderMines",
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- effect: function () {
- Magic.SpiderMines.enabled = true;
- delete Building.TerranBuilding.MachineShop.prototype.items[2];
- }
- },
- ResearchSiegeTech: {
- name: "ResearchSiegeTech",
- cost: {
- mine: 150,
- gas: 150,
- time: 800
- },
- effect: function () {
- Magic.SeigeMode.enabled = true;
- delete Building.TerranBuilding.MachineShop.prototype.items[3];
- }
- },
- ResearchCharonBoosters: {
- name: "ResearchCharonBoosters",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Terran.Goliath.prototype.attackMode.flying.attackRange[team] = 300;
- delete Building.TerranBuilding.MachineShop.prototype.items[4];
- }
- },
- ResearchCloakingField: {
- name: "ResearchCloakingField",
- cost: {
- mine: 150,
- gas: 150,
- time: 1000
- },
- effect: function () {
- Magic.Cloak.enabled = true;
- delete Building.TerranBuilding.ControlTower.prototype.items[1];
- }
- },
- ResearchApolloReactor: {
- name: "ResearchApolloReactor",
- cost: {
- mine: 200,
- gas: 200,
- time: 1660
- },
- effect: function (team) {
- Terran.Wraith.prototype.MP[team] = 250;
- delete Building.TerranBuilding.ControlTower.prototype.items[2];
- }
- },
- ResearchEMPShockwaves: {
- name: "ResearchEMPShockwaves",
- cost: {
- mine: 200,
- gas: 200,
- time: 1200
- },
- effect: function () {
- Magic.EMPShockwave.enabled = true;
- delete Building.TerranBuilding.ScienceFacility.prototype.items[1];
- }
- },
- ResearchIrradiate: {
- name: "ResearchIrradiate",
- cost: {
- mine: 150,
- gas: 150,
- time: 800
- },
- effect: function () {
- Magic.Irradiate.enabled = true;
- delete Building.TerranBuilding.ScienceFacility.prototype.items[2];
- }
- },
- ResearchTitanReactor: {
- name: "ResearchTitanReactor",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Terran.Vessel.prototype.MP[team] = 250;
- delete Building.TerranBuilding.ScienceFacility.prototype.items[3];
- }
- },
- ResearchLockdown: {
- name: "ResearchLockdown",
- cost: {
- mine: 200,
- gas: 200,
- time: 1000
- },
- effect: function () {
- Magic.Lockdown.enabled = true;
- delete Building.TerranBuilding.ConvertOps.prototype.items[1];
- }
- },
- ResearchPersonalCloaking: {
- name: "ResearchPersonalCloaking",
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- effect: function () {
- Magic.PersonalCloak.enabled = true;
- delete Building.TerranBuilding.ConvertOps.prototype.items[2];
- }
- },
- ResearchOcularImplants: {
- name: "ResearchOcularImplants",
- cost: {
- mine: 100,
- gas: 100,
- time: 1660
- },
- effect: function (team) {
- Terran.Ghost.prototype.sight[team] = 385;
- delete Building.TerranBuilding.ConvertOps.prototype.items[4];
- }
- },
- ResearchMoebiusReactor: {
- name: "ResearchMoebiusReactor",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Terran.Ghost.prototype.MP[team] = 250;
- delete Building.TerranBuilding.ConvertOps.prototype.items[5];
- }
- },
- ResearchYamatoGun: {
- name: "ResearchYamatoGun",
- cost: {
- mine: 200,
- gas: 200,
- time: 1200
- },
- effect: function () {
- Magic.Yamato.enabled = true;
- delete Building.TerranBuilding.PhysicsLab.prototype.items[1];
- }
- },
- ResearchColossusReactor: {
- name: "ResearchColossusReactor",
- cost: {
- mine: 150,
- gas: 150,
- time: 1600
- },
- effect: function (team) {
- Terran.BattleCruiser.prototype.MP[team] = 250;
- delete Building.TerranBuilding.PhysicsLab.prototype.items[2];
- }
- },
- UpgradeVehicleWeapons: {
- name: "UpgradeVehicleWeapons",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Terran.Vulture.prototype.damage[team] += 2;
- Terran.Tank.prototype.damage[team] += 3;
- Terran.Goliath.prototype.attackMode.ground.damage[team] += 2;
- Terran.Goliath.prototype.attackMode.flying.damage[team] += 4;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.TerranBuilding.Armory.prototype.items[1];
- }
- },
- UpgradeShipWeapons: {
- name: "UpgradeShipWeapons",
- cost: {
- mine: [100, 150, 200],
- gas: [100, 150, 200],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Terran.Wraith.prototype.attackMode.ground.damage[team] += 1;
- Terran.Wraith.prototype.attackMode.flying.damage[team] += 2;
- Terran.BattleCruiser.prototype.damage[team] += 3;
- Terran.Valkyrie.prototype.damage[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.TerranBuilding.Armory.prototype.items[2];
- }
- },
- UpgradeVehicleArmors: {
- name: "UpgradeVehicleArmors",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Terran.Vulture.prototype.armor[team] += 1;
- Terran.Tank.prototype.armor[team] += 1;
- Terran.Goliath.prototype.armor[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.TerranBuilding.Armory.prototype.items[4];
- }
- },
- UpgradeShipArmors: {
- name: "UpgradeShipArmors",
- cost: {
- mine: [150, 225, 300],
- gas: [150, 225, 300],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Terran.Wraith.prototype.armor[team] += 1;
- Terran.Dropship.prototype.armor[team] += 1;
- Terran.BattleCruiser.prototype.armor[team] += 1;
- Terran.Vessel.prototype.armor[team] += 1;
- Terran.Valkyrie.prototype.armor[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.TerranBuilding.Armory.prototype.items[5];
- }
- },
- //Zerg
- EvolveBurrow: {
- name: "EvolveBurrow",
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- effect: function () {
- Magic.Burrow.enabled = Magic.Unburrow.enabled = true;
- delete Building.ZergBuilding.Hatchery.prototype.items[3];
- delete Building.ZergBuilding.Lair.prototype.items[3];
- delete Building.ZergBuilding.Hive.prototype.items[3];
- }
- },
- EvolveVentralSacs: {
- name: "EvolveVentralSacs",
- cost: {
- mine: 200,
- gas: 200,
- time: 1600
- },
- effect: function () {
- Magic.Load.enabled = Magic.UnloadAll.enabled = true;
- delete Building.ZergBuilding.Lair.prototype.items[4];
- delete Building.ZergBuilding.Hive.prototype.items[4];
- }
- },
- EvolveAntennas: {
- name: "EvolveAntennas",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Zerg.Overlord.prototype.sight[team] = 385;
- delete Building.ZergBuilding.Lair.prototype.items[5];
- delete Building.ZergBuilding.Hive.prototype.items[5];
- }
- },
- EvolvePneumatizedCarapace: {
- name: "EvolvePneumatizedCarapace",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Zerg.Overlord.prototype.speed[team] = 8;
- delete Building.ZergBuilding.Lair.prototype.items[6];
- delete Building.ZergBuilding.Hive.prototype.items[6];
- }
- },
- EvolveMetabolicBoost: {
- name: "EvolveMetabolicBoost",
- cost: {
- mine: 100,
- gas: 100,
- time: 1000
- },
- effect: function (team) {
- Zerg.Zergling.prototype.speed[team] = 18;
- delete Building.ZergBuilding.SpawningPool.prototype.items[1];
- }
- },
- EvolveAdrenalGlands: {
- name: "EvolveAdrenalGlands",
- cost: {
- mine: 200,
- gas: 200,
- time: 1000
- },
- effect: function (team) {
- Zerg.Zergling.prototype.attackInterval[team] = 600;
- delete Building.ZergBuilding.SpawningPool.prototype.items[2];
- }
- },
- UpgradeMeleeAttacks: {
- name: "UpgradeMeleeAttacks",
- cost: {
- mine: [100, 150, 200],
- gas: [100, 150, 200],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Zerg.Zergling.prototype.damage[team] += 1;
- Zerg.Ultralisk.prototype.damage[team] += 3;
- Zerg.Broodling.prototype.damage[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ZergBuilding.EvolutionChamber.prototype.items[1];
- }
- },
- UpgradeMissileAttacks: {
- name: "UpgradeMissileAttacks",
- cost: {
- mine: [100, 150, 200],
- gas: [100, 150, 200],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Zerg.Hydralisk.prototype.damage[team] += 1;
- Zerg.Lurker.prototype.damage[team] += 2;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ZergBuilding.EvolutionChamber.prototype.items[2];
- }
- },
- EvolveCarapace: {
- name: "EvolveCarapace",
- cost: {
- mine: [150, 225, 300],
- gas: [150, 225, 300],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Zerg.Drone.prototype.armor[team] += 1;
- Zerg.Zergling.prototype.armor[team] += 1;
- Zerg.Hydralisk.prototype.armor[team] += 1;
- Zerg.Lurker.prototype.armor[team] += 1;
- Zerg.Ultralisk.prototype.armor[team] += 1;
- Zerg.Defiler.prototype.armor[team] += 1;
- Zerg.Broodling.prototype.armor[team] += 1;
- Zerg.InfestedTerran.prototype.armor[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ZergBuilding.EvolutionChamber.prototype.items[3];
- }
- },
- EvolveMuscularAugments: {
- name: "EvolveMuscularAugments",
- cost: {
- mine: 100,
- gas: 100,
- time: 1000
- },
- effect: function (team) {
- Zerg.Hydralisk.prototype.speed[team] = 13;
- delete Building.ZergBuilding.HydraliskDen.prototype.items[1];
- }
- },
- EvolveGroovedSpines: {
- name: "EvolveGroovedSpines",
- cost: {
- mine: 150,
- gas: 150,
- time: 1000
- },
- effect: function (team) {
- Zerg.Hydralisk.prototype.attackRange[team] = 175;
- delete Building.ZergBuilding.HydraliskDen.prototype.items[2];
- }
- },
- EvolveLurkerAspect: {
- name: "EvolveLurkerAspect",
- cost: {
- mine: 125,
- gas: 125,
- time: 1200
- },
- effect: function () {
- Magic.Lurker.enabled = true;
- delete Building.ZergBuilding.HydraliskDen.prototype.items[4];
- }
- },
- UpgradeFlyerAttacks: {
- name: "UpgradeFlyerAttacks",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Zerg.Mutalisk.prototype.damage[team] += 1;
- Zerg.Guardian.prototype.damage[team] += 2;
- Zerg.Devourer.prototype.damage[team] += 2;
- this.level[team]++;
- if (this.level[Game.team] >= 3) {
- delete Building.ZergBuilding.Spire.prototype.items[1];
- delete Building.ZergBuilding.GreaterSpire.prototype.items[1];
- }
- }
- },
- UpgradeFlyerCarapace: {
- name: "UpgradeFlyerCarapace",
- cost: {
- mine: [150, 225, 300],
- gas: [150, 225, 300],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Zerg.Overlord.prototype.armor[team] += 1;
- Zerg.Mutalisk.prototype.armor[team] += 1;
- Zerg.Guardian.prototype.armor[team] += 1;
- Zerg.Devourer.prototype.armor[team] += 1;
- Zerg.Scourge.prototype.armor[team] += 1;
- Zerg.Queen.prototype.armor[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3) {
- delete Building.ZergBuilding.Spire.prototype.items[2];
- delete Building.ZergBuilding.GreaterSpire.prototype.items[2];
- }
- }
- },
- EvolveSpawnBroodling: {
- name: "EvolveSpawnBroodling",
- cost: {
- mine: 200,
- gas: 200,
- time: 800
- },
- effect: function () {
- Magic.SpawnBroodlings.enabled = true;
- delete Building.ZergBuilding.QueenNest.prototype.items[1];
- }
- },
- EvolveEnsnare: {
- name: "EvolveEnsnare",
- cost: {
- mine: 100,
- gas: 100,
- time: 800
- },
- effect: function () {
- Magic.Ensnare.enabled = true;
- delete Building.ZergBuilding.QueenNest.prototype.items[2];
- }
- },
- EvolveGameteMeiosis: {
- name: "EvolveGameteMeiosis",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Zerg.Queen.prototype.MP[team] = 250;
- delete Building.ZergBuilding.QueenNest.prototype.items[3];
- }
- },
- EvolveAnabolicSynthesis: {
- name: "EvolveAnabolicSynthesis",
- cost: {
- mine: 200,
- gas: 200,
- time: 1330
- },
- effect: function (team) {
- Zerg.Ultralisk.prototype.speed[team] = 18;
- delete Building.ZergBuilding.UltraliskCavern.prototype.items[1];
- }
- },
- EvolveChitinousPlating: {
- name: "EvolveChitinousPlating",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Zerg.Ultralisk.prototype.armor[team] += 2;
- delete Building.ZergBuilding.UltraliskCavern.prototype.items[2];
- }
- },
- EvolvePlague: {
- name: "EvolvePlague",
- cost: {
- mine: 200,
- gas: 200,
- time: 1000
- },
- effect: function () {
- Magic.Plague.enabled = true;
- delete Building.ZergBuilding.DefilerMound.prototype.items[1];
- }
- },
- EvolveConsume: {
- name: "EvolveConsume",
- cost: {
- mine: 100,
- gas: 100,
- time: 1000
- },
- effect: function () {
- Magic.Consume.enabled = true;
- delete Building.ZergBuilding.DefilerMound.prototype.items[2];
- }
- },
- EvolveMetasynapticNode: {
- name: "EvolveMetasynapticNode",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Zerg.Defiler.prototype.MP[team] = 250;
- delete Building.ZergBuilding.DefilerMound.prototype.items[3];
- }
- },
- //Protoss
- UpgradeGroundWeapons: {
- name: "UpgradeGroundWeapons",
- cost: {
- mine: [100, 150, 200],
- gas: [100, 150, 200],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Protoss.Zealot.prototype.damage[team] += 2;
- Protoss.Dragoon.prototype.damage[team] += 2;
- Protoss.Templar.prototype.damage[team] += 1;
- Protoss.DarkTemplar.prototype.damage[team] += 3;
- Protoss.Archon.prototype.damage[team] += 3;
- //New RPG level
- Hero.DevilHunter.prototype.damage[team] += 2;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ProtossBuilding.Forge.prototype.items[1];
- }
- },
- UpgradeGroundArmor: {
- name: "UpgradeGroundArmor",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Protoss.Probe.prototype.armor[team] += 1;
- Protoss.Zealot.prototype.armor[team] += 1;
- Protoss.Dragoon.prototype.armor[team] += 1;
- Protoss.Templar.prototype.armor[team] += 1;
- Protoss.DarkTemplar.prototype.armor[team] += 1;
- Protoss.Archon.prototype.armor[team] += 1;
- Protoss.DarkArchon.prototype.armor[team] += 1;
- Protoss.Reaver.prototype.armor[team] += 1;
- //New RPG level
- Hero.DevilHunter.prototype.armor[team] += 2;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ProtossBuilding.Forge.prototype.items[2];
- }
- },
- UpgradePlasmaShields: {
- name: "UpgradePlasmaShields",
- cost: {
- mine: [200, 300, 400],
- gas: [200, 300, 400],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- for (var unitType in Protoss) {
- Protoss[unitType].prototype.plasma[team] += 1;
- }
- //New RPG level
- Hero.DevilHunter.prototype.plasma[team] += 2;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ProtossBuilding.Forge.prototype.items[3];
- }
- },
- UpgradeAirWeapons: {
- name: "UpgradeAirWeapons",
- cost: {
- mine: [100, 175, 250],
- gas: [100, 175, 250],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Protoss.Scout.prototype.attackMode.ground.damage[team] += 1;
- Protoss.Scout.prototype.attackMode.flying.damage[team] += 2;
- Protoss.Carrier.prototype.damage[team] += 1;
- Protoss.Arbiter.prototype.damage[team] += 1;
- Protoss.Corsair.prototype.damage[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ProtossBuilding.CyberneticsCore.prototype.items[1];
- }
- },
- UpgradeAirArmor: {
- name: "UpgradeAirArmor",
- cost: {
- mine: [150, 225, 300],
- gas: [150, 225, 300],
- time: [2660, 2980, 3300]
- },
- level: 0,
- effect: function (team) {
- Protoss.Scout.prototype.armor[team] += 1;
- Protoss.Carrier.prototype.armor[team] += 1;
- Protoss.Arbiter.prototype.armor[team] += 1;
- Protoss.Corsair.prototype.armor[team] += 1;
- this.level[team]++;
- if (this.level[Game.team] >= 3)
- delete Building.ProtossBuilding.CyberneticsCore.prototype.items[2];
- }
- },
- DevelopSingularityCharge: {
- name: "DevelopSingularityCharge",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Protoss.Dragoon.prototype.attackRange[team] = 210;
- delete Building.ProtossBuilding.CyberneticsCore.prototype.items[3];
- }
- },
- DevelopLegEnhancements: {
- name: "DevelopLegEnhancements",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Protoss.Zealot.prototype.speed[team] = 14;
- delete Building.ProtossBuilding.CitadelOfAdun.prototype.items[1];
- }
- },
- UpgradeScarabDamage: {
- name: "UpgradeScarabDamage",
- cost: {
- mine: 200,
- gas: 200,
- time: 1660
- },
- effect: function (team) {
- Protoss.Reaver.prototype.damage[team] = 125;
- delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[1];
- }
- },
- IncreaseReaverCapacity: {
- name: "IncreaseReaverCapacity",
- cost: {
- mine: 200,
- gas: 200,
- time: 1660
- },
- effect: function (team) {
- Protoss.Reaver.prototype.scarabCapacity[team] = 10;
- delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[2];
- }
- },
- DevelopGraviticDrive: {
- name: "DevelopGraviticDrive",
- cost: {
- mine: 200,
- gas: 200,
- time: 1660
- },
- effect: function (team) {
- Protoss.Shuttle.prototype.speed[team] = 16;
- delete Building.ProtossBuilding.RoboticsSupportBay.prototype.items[3];
- }
- },
- DevelopApialSensors: {
- name: "DevelopApialSensors",
- cost: {
- mine: 100,
- gas: 100,
- time: 1660
- },
- effect: function (team) {
- Protoss.Scout.prototype.sight[team] = 350;
- delete Building.ProtossBuilding.FleetBeacon.prototype.items[1];
- }
- },
- DevelopGraviticThrusters: {
- name: "DevelopGraviticThrusters",
- cost: {
- mine: 200,
- gas: 200,
- time: 1660
- },
- effect: function (team) {
- Protoss.Scout.prototype.speed[team] = 16;
- delete Building.ProtossBuilding.FleetBeacon.prototype.items[2];
- }
- },
- IncreaseCarrierCapacity: {
- name: "IncreaseCarrierCapacity",
- cost: {
- mine: 100,
- gas: 100,
- time: 1000
- },
- effect: function (team) {
- //Protoss.Carrier.prototype.continuousAttack.count[team]=8;
- Protoss.Carrier.prototype.interceptorCapacity[team] = 8;
- delete Building.ProtossBuilding.FleetBeacon.prototype.items[3];
- }
- },
- DevelopDistruptionWeb: {
- name: "DevelopDistruptionWeb",
- cost: {
- mine: 200,
- gas: 200,
- time: 800
- },
- effect: function () {
- Magic.DisruptionWeb.enabled = true;
- delete Building.ProtossBuilding.FleetBeacon.prototype.items[4];
- }
- },
- DevelopArgusJewel: {
- name: "DevelopArgusJewel",
- cost: {
- mine: 100,
- gas: 100,
- time: 1660
- },
- effect: function (team) {
- Protoss.Corsair.prototype.MP[team] = 250;
- delete Building.ProtossBuilding.FleetBeacon.prototype.items[5];
- }
- },
- DevelopPsionicStorm: {
- name: "DevelopPsionicStorm",
- cost: {
- mine: 200,
- gas: 200,
- time: 1200
- },
- effect: function () {
- Magic.PsionicStorm.enabled = true;
- delete Building.ProtossBuilding.TemplarArchives.prototype.items[1];
- }
- },
- DevelopHallucination: {
- name: "DevelopHallucination",
- cost: {
- mine: 150,
- gas: 150,
- time: 800
- },
- effect: function () {
- Magic.Hallucination.enabled = true;
- delete Building.ProtossBuilding.TemplarArchives.prototype.items[2];
- }
- },
- DevelopKhaydarinAmulet: {
- name: "DevelopKhaydarinAmulet",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Protoss.Templar.prototype.MP[team] = 250;
- delete Building.ProtossBuilding.TemplarArchives.prototype.items[3];
- }
- },
- DevelopMindControl: {
- name: "DevelopMindControl",
- cost: {
- mine: 200,
- gas: 200,
- time: 1200
- },
- effect: function () {
- Magic.MindControl.enabled = true;
- delete Building.ProtossBuilding.TemplarArchives.prototype.items[4];
- }
- },
- DevelopMaelStorm: {
- name: "DevelopMaelStorm",
- cost: {
- mine: 100,
- gas: 100,
- time: 1000
- },
- effect: function () {
- Magic.MaelStorm.enabled = true;
- delete Building.ProtossBuilding.TemplarArchives.prototype.items[5];
- }
- },
- DevelopArgusTalisman: {
- name: "DevelopArgusTalisman",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Protoss.DarkArchon.prototype.MP[team] = 250;
- delete Building.ProtossBuilding.TemplarArchives.prototype.items[6];
- }
- },
- DevelopGraviticBooster: {
- name: "DevelopGraviticBooster",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Protoss.Observer.prototype.speed[team] = 12;
- delete Building.ProtossBuilding.Observatory.prototype.items[1];
- }
- },
- DevelopSensorArray: {
- name: "DevelopSensorArray",
- cost: {
- mine: 150,
- gas: 150,
- time: 1330
- },
- effect: function (team) {
- Protoss.Observer.prototype.sight[team] = 385;
- delete Building.ProtossBuilding.Observatory.prototype.items[2];
- }
- },
- DevelopRecall: {
- name: "DevelopRecall",
- cost: {
- mine: 150,
- gas: 150,
- time: 1200
- },
- effect: function () {
- Magic.Recall.enabled = true;
- delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[1];
- }
- },
- DevelopStasisField: {
- name: "DevelopStasisField",
- cost: {
- mine: 150,
- gas: 150,
- time: 1000
- },
- effect: function () {
- Magic.StasisField.enabled = true;
- delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[2];
- }
- },
- DevelopKhaydarinCore: {
- name: "DevelopKhaydarinCore",
- cost: {
- mine: 150,
- gas: 150,
- time: 1660
- },
- effect: function (team) {
- Protoss.Arbiter.prototype.MP[team] = 250;
- delete Building.ProtossBuilding.ArbiterTribunal.prototype.items[3];
- }
- },
- /********RPG level: Tower Defense********/
- UpgradeSunkenDamage: {
- name: "UpgradeSunkenDamage",
- cost: {
- mine: [50, 75, 100, 125, 150],
- time: [300, 300, 300, 300, 300]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.ZergBuilding.SunkenColony.prototype.damage += 5;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[1];
- }
- }
- },
- EnlargeSunkenArea: {
- name: "UpgradeSunkenArea",
- cost: {
- mine: [100, 125, 150, 175, 200],
- time: [300, 400, 500, 600, 700]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.ZergBuilding.SunkenColony.prototype.AOE.radius += 50;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[2];
- }
- }
- },
- UpgradeSporeDamage: {
- name: "UpgradeSporeDamage",
- cost: {
- mine: [50, 60, 70, 80, 90],
- time: [300, 300, 300, 300, 300]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.ZergBuilding.SporeColony.prototype.damage += 3;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[3];
- }
- }
- },
- EnlargeSporeChain: {
- name: "EnlargeSporeChain",
- cost: {
- mine: [80, 90, 100, 110, 120],
- time: [300, 400, 500, 600, 700]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Bullets.Spore.prototype.traceTimes += 1;
- Bullets.Spore.prototype.traceRadius += 50;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[4];
- }
- }
- },
- UpgradeMissileDamage: {
- name: "UpgradeMissileDamage",
- cost: {
- mine: [50, 65, 80, 95, 110],
- time: [300, 300, 300, 300, 300]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.TerranBuilding.MissileTurret.prototype.damage += 4;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[5];
- }
- }
- },
- IncreaseMissileCount: {
- name: "IncreaseMissileCount",
- cost: {
- mine: [80, 95, 110, 125, 140],
- time: [300, 300, 300, 300, 300]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.TerranBuilding.MissileTurret.prototype.AOE.radius += 30;
- Building.TerranBuilding.MissileTurret.prototype.AOE.count++;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[6];
- }
- }
- },
- UpgradePhotonCannonDamage: {
- name: "UpgradePhotonCannonDamage",
- cost: {
- mine: [50, 70, 90, 110, 130],
- time: [300, 300, 300, 300, 300]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.ProtossBuilding.PhotonCannon.prototype.damage += 4;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[7];
- }
- }
- },
- IncreasePhotonCannonCount: {
- name: "IncreasePhotonCannonCount",
- cost: {
- mine: [80, 95, 110, 125, 140],
- time: [300, 300, 300, 300, 300]
- },
- level: 0,
- effect: function (team) {
- //RPG level lock
- if (Game.level == 11 || Game.replayLevel == 11) {
- Building.ProtossBuilding.PhotonCannon.prototype.continuousAttack.count++;
- this.level[team]++;
- if (this.level[Game.team] >= 5)
- delete Building.ProtossBuilding.TeleportPoint.prototype.items[8];
- }
- }
- }
-};
-//# sourceMappingURL=Upgrade.js.map
\ No newline at end of file
diff --git a/Characters/Zerg.js b/Characters/Zerg.js
deleted file mode 100644
index c990c47..0000000
--- a/Characters/Zerg.js
+++ /dev/null
@@ -1,1646 +0,0 @@
-/******* Define Zerg units *******/
-var Zerg = {};
-Zerg.Drone = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.sound.burrow = new Audio(Game.CDN + 'bgm/Zerg.burrow.wav');
- this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
- this.direction = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Drone",
- imgPos: {
- moving: {
- left: [
- [36, 36, 36], [164, 164, 164],
- [292, 292, 292], [420, 420, 420],
- [548, 548, 548], [676, 676, 676],
- [804, 804, 804], [932, 932, 932],
- [1060, 1060, 1060], [1316, 1316, 1316],
- [1444, 1444, 1444], [1572, 1572, 1572],
- [1700, 1700, 1700], [1828, 1828, 1828],
- [1956, 1956, 1956], [2084, 2084, 2084]
- ],
- top: [
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292],
- [36, 164, 292], [36, 164, 292]
- ]
- },
- attack: {
- left: [
- [36, 36, 36, 36, 36, 36, 36], [164, 164, 164, 164, 164, 164, 164],
- [292, 292, 292, 292, 292, 292, 292], [420, 420, 420, 420, 420, 420, 420],
- [548, 548, 548, 548, 548, 548, 548], [676, 676, 676, 676, 676, 676, 676],
- [804, 804, 804, 804, 804, 804, 804], [932, 932, 932, 932, 932, 932, 932],
- [1060, 1060, 1060, 1060, 1060, 1060, 1060], [1316, 1316, 1316, 1316, 1316, 1316, 1316],
- [1444, 1444, 1444, 1444, 1444, 1444, 1444], [1572, 1572, 1572, 1572, 1572, 1572, 1572],
- [1700, 1700, 1700, 1700, 1700, 1700, 1700], [1828, 1828, 1828, 1828, 1828, 1828, 1828],
- [1956, 1956, 1956, 1956, 1956, 1956, 1956], [2084, 2084, 2084, 2084, 2084, 2084, 2084]
- ],
- top: [
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188],
- [420, 548, 676, 804, 932, 1060, 1188], [420, 548, 676, 804, 932, 1060, 1188]
- ]
- },
- dock: {
- left: [36, 164, 292, 420, 548, 676, 804, 932, 1060, 1316, 1444, 1572, 1700, 1828, 1956, 2084],
- top: [36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36]
- },
- burrow: {
- left: [
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572],
- [1700, -1, 1188, 1316, 1444, 1572], [1700, -1, 1188, 1316, 1444, 1572]
- ],
- top: [
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316],
- [1316, -1, 1316, 1316, 1316, 1316], [1316, -1, 1316, 1316, 1316, 1316]
- ]
- },
- unburrow: {
- left: [
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188],
- [1572, 1444, 1316, 1188, 1188, 1188], [1572, 1444, 1316, 1188, 1188, 1188]
- ],
- top: [
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316],
- [1316, 1316, 1316, 1316, 1316, 1316], [1316, 1316, 1316, 1316, 1316, 1316]
- ]
- }
- },
- width: 56,
- height: 56,
- frame: {
- moving: 3,
- dock: 1,
- attack: 7,
- burrow: 1,
- unburrow: 6
- },
- //Only for moving status, override
- speed: 12,
- HP: 40,
- damage: 5,
- armor: 0,
- sight: 245,
- meleeAttack: true,
- attackInterval: 2200,
- dieEffect: Burst.DroneDeath,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 50,
- man: 1,
- time: 200
- },
- upgrade: ['EvolveCarapace'],
- items: { '4': undefined,
- '5': { name: 'gather' },
- '7': { name: 'BasicMutation' },
- '8': { name: 'AdvancedMutation' },
- '9': { name: 'Burrow', condition: function () {
- return Magic.Burrow.enabled;
- } }
- },
- buildZergBuilding: function (location) {
- //Has location callback info or nothing
- if (location) {
- //Move toward target to fire Ensnare
- this.targetLock = true;
- var myself = this;
- this.moveTo(location.x, location.y, 20, function () {
- if (Resource.payCreditBill.call(myself)) {
- var target = Building.ZergBuilding[myself.buildName];
- //Adjust location
- myself.x = (location.x - myself.width / 2) >> 0;
- myself.y = (location.y - myself.height / 2) >> 0;
- var mutation = myself.evolveTo({
- type: eval('Building.' + target.prototype.evolves[0].step),
- chain: true
- });
- mutation.buildName = myself.buildName;
- //Calculate duration
- var duration = Resource.getCost(myself.buildName).time;
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 40;
- //Processing flag on transfer
- mutation.processing = {
- name: mutation.buildName,
- startTime: Game.mainTick,
- time: duration
- };
- //Evolve chain
- for (var N = 1; N < target.prototype.evolves.length; N++) {
- (function (n) {
- var evolveInfo = target.prototype.evolves[n];
- Game.commandTimeout(function () {
- if (mutation.status != 'dead') {
- //Evolve
- var evolveTarget = (eval('Building.' + evolveInfo.step));
- //Step is constructor function
- if (evolveTarget) {
- var old = mutation;
- mutation = mutation.evolveTo({
- type: evolveTarget,
- chain: true
- });
- mutation.processing = old.processing;
- mutation.buildName = old.buildName;
- }
- else {
- mutation.status = evolveInfo.step;
- }
- }
- }, duration * 100 * evolveInfo.percent);
- })(N);
- }
- //Final evolve
- Game.commandTimeout(function () {
- if (mutation.status != 'dead') {
- //Evolve
- mutation.evolveTo({
- type: Building.ZergBuilding[mutation.buildName],
- burstArr: mutation.evolveEffect
- });
- }
- }, duration * 100);
- }
- });
- }
- else {
- Button.callback = arguments.callee;
- Button.callback.farmer = this;
- Button.callback.buildType = 'ZergBuilding';
- $('div.GameLayer').attr('status', 'button');
- }
- }
- }
-});
-Zerg.Zergling = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.sound.burrow = new Audio(Game.CDN + 'bgm/Zerg.burrow.wav');
- this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
- this.direction = 5;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Zergling",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0], [43, 43, 43, 43, 43, 43, 43],
- [86, 86, 86, 86, 86, 86, 86], [129, 129, 129, 129, 129, 129, 129],
- [172, 172, 172, 172, 172, 172, 172], [215, 215, 215, 215, 215, 215, 215],
- [258, 258, 258, 258, 258, 258, 258], [301, 301, 301, 301, 301, 301, 301],
- [344, 344, 344, 344, 344, 344, 344], [430, 430, 430, 430, 430, 430, 430],
- [473, 473, 473, 473, 473, 473, 473], [516, 516, 516, 516, 516, 516, 516],
- [559, 559, 559, 559, 559, 559, 559], [602, 602, 602, 602, 602, 602, 602],
- [645, 645, 645, 645, 645, 645, 645], [688, 688, 688, 688, 688, 688, 688]
- ],
- top: [
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252],
- [0, 42, 84, 126, 168, 210, 252], [0, 42, 84, 126, 168, 210, 252]
- ]
- },
- dock: {
- left: [0, 43, 86, 129, 172, 215, 258, 301, 344, 430, 473, 516, 559, 602, 645, 688],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0], [43, 43, 43, 43, 43],
- [86, 86, 86, 86, 86], [129, 129, 129, 129, 129],
- [172, 172, 172, 172, 172], [215, 215, 215, 215, 215],
- [258, 258, 258, 258, 258], [301, 301, 301, 301, 301],
- [344, 344, 344, 344, 344], [430, 430, 430, 430, 430],
- [473, 473, 473, 473, 473], [516, 516, 516, 516, 516],
- [559, 559, 559, 559, 559], [602, 602, 602, 602, 602],
- [645, 645, 645, 645, 645], [688, 688, 688, 688, 688]
- ],
- top: [
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462],
- [294, 336, 378, 420, 462], [294, 336, 378, 420, 462]
- ]
- },
- burrow: {
- left: [
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636],
- [678, -1, 504, 546, 592, 636], [678, -1, 504, 546, 592, 636]
- ],
- top: [
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512],
- [512, -1, 512, 512, 512, 512], [512, -1, 512, 512, 512, 512]
- ]
- },
- unburrow: {
- left: [
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504],
- [636, 592, 546, 504, 504, 504], [636, 592, 546, 504, 504, 504]
- ],
- top: [
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512],
- [512, 512, 512, 512, 512, 512], [512, 512, 512, 512, 512, 512]
- ]
- }
- },
- width: 43,
- height: 42,
- frame: {
- moving: 7,
- dock: 1,
- attack: 5,
- burrow: 1,
- unburrow: 6
- },
- //Only for moving status, override
- speed: 13,
- HP: 35,
- damage: 5,
- armor: 0,
- sight: 175,
- meleeAttack: true,
- attackInterval: 800,
- dieEffect: Burst.ZerglingDeath,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 25,
- man: 0.5,
- time: 140
- },
- birthCount: 2,
- upgrade: ['UpgradeMeleeAttacks', 'EvolveCarapace'],
- items: {
- '9': { name: 'Burrow', condition: function () {
- return Magic.Burrow.enabled;
- } }
- }
- }
-});
-Zerg.Overlord = Unit.extends({
- constructorPlus: function (props) {
- this.direction = 6;
- this.y -= 12; //(OverlordBirth.height-Overlord.height)/2
- //Transport
- this.loadedUnits = [];
- },
- prototypePlus: {
- //Add basic unit info
- name: "Overlord",
- imgPos: {
- moving: {
- left: [
- [0, 0, 84, 84, 168, 168, 252, 252], [0, 0, 84, 84, 168, 168, 252, 252],
- [0, 0, 84, 84, 168, 168, 252, 252], [0, 0, 84, 84, 168, 168, 252, 252],
- [0, 0, 84, 84, 168, 168, 252, 252], [0, 0, 84, 84, 168, 168, 252, 252],
- [0, 0, 84, 84, 168, 168, 252, 252], [0, 0, 84, 84, 168, 168, 252, 252],
- [0, 0, 84, 84, 168, 168, 252, 252], [588, 588, 504, 504, 420, 420, 336, 336],
- [588, 588, 504, 504, 420, 420, 336, 336], [588, 588, 504, 504, 420, 420, 336, 336],
- [588, 588, 504, 504, 420, 420, 336, 336], [588, 588, 504, 504, 420, 420, 336, 336],
- [588, 588, 504, 504, 420, 420, 336, 336], [588, 588, 504, 504, 420, 420, 336, 336]
- ],
- top: [
- [0, 0, 0, 0, 0, 0, 0, 0], [84, 84, 84, 84, 84, 84, 84, 84],
- [168, 168, 168, 168, 168, 168, 168, 168], [252, 252, 252, 252, 252, 252, 252, 252],
- [336, 336, 336, 336, 336, 336, 336, 336], [420, 420, 420, 420, 420, 420, 420, 420],
- [504, 504, 504, 504, 504, 504, 504, 504], [588, 588, 588, 588, 588, 588, 588, 588],
- [672, 672, 672, 672, 672, 672, 672, 672], [588, 588, 588, 588, 588, 588, 588, 588],
- [504, 504, 504, 504, 504, 504, 504, 504], [420, 420, 420, 420, 420, 420, 420, 420],
- [336, 336, 336, 336, 336, 336, 336, 336], [252, 252, 252, 252, 252, 252, 252, 252],
- [168, 168, 168, 168, 168, 168, 168, 168], [84, 84, 84, 84, 84, 84, 84, 84]
- ]
- },
- dock: {
- left: [0, 0, 0, 0, 0, 0, 0, 0, 0, 588, 588, 588, 588, 588, 588, 588],
- top: [0, 84, 168, 252, 336, 420, 504, 588, 672, 84, 168, 252, 336, 420, 504, 588]
- }
- },
- width: 84,
- height: 84,
- frame: {
- moving: 8,
- dock: 1
- },
- //Only for moving status, override
- speed: 2,
- HP: 200,
- armor: 0,
- sight: 315,
- dieEffect: Burst.BigZergFlyingDeath,
- isFlying: true,
- unitType: Unit.BIG,
- detector: Gobj.detectorBuffer,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 100,
- time: 400
- },
- upgrade: ['UpgradeFlyerCarapace'],
- manPlus: 8,
- items: {
- '8': { name: 'Load', condition: function () {
- return Magic.Load.enabled;
- } },
- '9': { name: 'UnloadAll', condition: function () {
- return Magic.UnloadAll.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- Unit.hover.call(this);
- },
- die: function () {
- //Use the same behavior
- Unit.prototype.die.call(this);
- //All passenger will die too
- this.loadedUnits.forEach(function (chara) {
- chara.die();
- });
- }
- }
-});
-Zerg.Hydralisk = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.sound.burrow = new Audio(Game.CDN + 'bgm/Zerg.burrow.wav');
- this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
- this.direction = 6;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Hydralisk",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0], [45, 45, 45, 45, 45, 45, 45],
- [90, 90, 90, 90, 90, 90, 90], [135, 135, 135, 135, 135, 135, 135],
- [180, 180, 180, 180, 180, 180, 180], [225, 225, 225, 225, 225, 225, 225],
- [270, 270, 270, 270, 270, 270, 270], [315, 315, 315, 315, 315, 315, 315],
- [360, 360, 360, 360, 360, 360, 360], [450, 450, 450, 450, 450, 450, 450],
- [495, 495, 495, 495, 495, 495, 495], [540, 540, 540, 540, 540, 540, 540],
- [585, 585, 585, 585, 585, 585, 585], [630, 630, 630, 630, 630, 630, 630],
- [675, 675, 675, 675, 675, 675, 675], [720, 720, 720, 720, 720, 720, 720]
- ],
- top: [
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348],
- [0, 58, 116, 174, 232, 290, 348], [0, 58, 116, 174, 232, 290, 348]
- ]
- },
- dock: {
- left: [0, 45, 90, 135, 180, 225, 270, 315, 360, 450, 495, 540, 585, 630, 675, 720],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0], [45, 45, 45, 45, 45],
- [90, 90, 90, 90, 90], [135, 135, 135, 135, 135],
- [180, 180, 180, 180, 180], [225, 225, 225, 225, 225],
- [270, 270, 270, 270, 270], [315, 315, 315, 315, 315],
- [360, 360, 360, 360, 360], [450, 450, 450, 450, 450],
- [495, 495, 495, 495, 495], [540, 540, 540, 540, 540],
- [585, 585, 585, 585, 585], [630, 630, 630, 630, 630],
- [675, 675, 675, 675, 675], [720, 720, 720, 720, 720]
- ],
- top: [
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638],
- [406, 464, 522, 580, 638], [406, 464, 522, 580, 638]
- ]
- },
- burrow: {
- left: [
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418],
- [464, -1, 280, 326, 374, 418], [464, -1, 280, 326, 374, 418]
- ],
- top: [
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758],
- [758, -1, 758, 758, 758, 758], [758, -1, 758, 758, 758, 758]
- ]
- },
- unburrow: {
- left: [
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280],
- [418, 374, 326, 280, 280, 280], [418, 374, 326, 280, 280, 280]
- ],
- top: [
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758],
- [758, 758, 758, 758, 758, 758], [758, 758, 758, 758, 758, 758]
- ]
- }
- },
- width: 45,
- height: 58,
- frame: {
- moving: 7,
- dock: 1,
- attack: 5,
- burrow: 1,
- unburrow: 6
- },
- //Only for moving status, override
- speed: 9,
- HP: 80,
- damage: 10,
- armor: 0,
- sight: 210,
- attackRange: 140,
- attackInterval: 1500,
- dieEffect: Burst.HydraliskDeath,
- isFlying: false,
- unitType: Unit.MIDDLE,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 75,
- gas: 25,
- man: 1,
- time: 280
- },
- upgrade: ['UpgradeMissileAttacks', 'EvolveCarapace'],
- items: {
- '7': { name: 'Lurker', condition: function () {
- return Magic.Lurker.enabled;
- } },
- '9': { name: 'Burrow', condition: function () {
- return Magic.Burrow.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Zerg.Lurker = Unit.extends({
- constructorPlus: function (props) {
- //Same as attackable unit
- this.bullet = {};
- this.kill = 0;
- this.target = {};
- //Idle by default
- this.targetLock = false;
- //Can fire by default
- this.coolDown = true;
- //Add attack sound for AttackableUnit
- this.sound.attack = new Audio(Game.CDN + 'bgm/Lurker.attack.wav');
- this.sound.burrow = new Audio(Game.CDN + 'bgm/Lurker.burrow.wav');
- this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
- this.direction = 6;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Lurker",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0], [72, 72, 72, 72, 72, 72, 72],
- [144, 144, 144, 144, 144, 144, 144], [216, 216, 216, 216, 216, 216, 216],
- [288, 288, 288, 288, 288, 288, 288], [360, 360, 360, 360, 360, 360, 360],
- [432, 432, 432, 432, 432, 432, 432], [504, 504, 504, 504, 504, 504, 504],
- [576, 576, 576, 576, 576, 576, 576], [720, 720, 720, 720, 720, 720, 720],
- [792, 792, 792, 792, 792, 792, 792], [864, 864, 864, 864, 864, 864, 864],
- [936, 936, 936, 936, 936, 936, 936], [1008, 1008, 1008, 1008, 1008, 1008, 1008],
- [1080, 1080, 1080, 1080, 1080, 1080, 1080], [1152, 1152, 1152, 1152, 1152, 1152, 1152]
- ],
- top: [
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403],
- [1, 68, 135, 202, 269, 336, 403], [1, 68, 135, 202, 269, 336, 403]
- ]
- },
- dock: {
- left: [0, 72, 144, 216, 288, 360, 432, 504, 576, 720, 792, 864, 936, 1008, 1080, 1152],
- top: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
- },
- burrow: {
- left: [
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444],
- [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444], [502, -1, 2, 66, 130, 192, 256, 2, 66, 130, 192, 256, 318, 380, 444]
- ],
- top: [
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482],
- [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482], [482, -1, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482, 482]
- ]
- },
- unburrow: {
- left: [
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764],
- [450, 510, 570, 632, 700, 764, 764, 764], [450, 510, 570, 632, 700, 764, 764, 764]
- ],
- top: [
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570],
- [570, 570, 570, 570, 570, 570, 570, 570], [570, 570, 570, 570, 570, 570, 570, 570]
- ]
- }
- },
- width: 72,
- height: 67,
- frame: {
- moving: 7,
- dock: 1,
- burrow: 1,
- unburrow: 8
- },
- //Only for moving status, override
- speed: 14,
- HP: 125,
- damage: 20,
- armor: 0,
- sight: 280,
- attackRange: 210,
- attackInterval: 3700,
- continuousAttack: {
- count: 5,
- layout: function (bullet, num) {
- //Reassign location
- bullet.x += bullet.speed.x * (num);
- bullet.y += bullet.speed.y * (num);
- //Reassign each action
- bullet.action = (bullet.action + num) % (bullet.frame.moving);
- //Fix action
- bullet.animeFrame = function () { };
- },
- onlyOnce: true
- },
- dieEffect: Burst.LurkerDeath,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.MIDDLE,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- AOE: {
- type: "LINE",
- hasEffect: false,
- radius: 35
- },
- cost: {
- mine: 50,
- gas: 100,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeMissileAttacks', 'EvolveCarapace'],
- items: {
- '9': { name: 'Burrow' }
- },
- //New type AI for enemy Lurker
- reactionWhenAttackedBy: function () {
- //Will burrow and attack
- if (!Multiplayer.ON && !this.burrowBuffer && this.isEnemy())
- Magic.Burrow.spell.call(this);
- Unit.prototype.reactionWhenAttackedBy.apply(this, arguments);
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Zerg.Mutalisk = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.direction = 7;
- //Adjust for multi frames
- this.y -= 12;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Mutalisk",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0], [67, 67, 67, 67, 67],
- [134, 134, 134, 134, 134], [201, 201, 201, 201, 201],
- [268, 268, 268, 268, 268], [335, 335, 335, 335, 335],
- [401, 401, 401, 401, 401], [468, 468, 468, 468, 468],
- [535, 535, 535, 535, 535], [602, 602, 602, 602, 602],
- [669, 669, 669, 669, 669], [736, 736, 736, 736, 736],
- [802, 802, 802, 802, 802], [869, 869, 869, 869, 869],
- [936, 936, 936, 936, 936], [1003, 1003, 1003, 1003, 1003]
- ],
- top: [
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300],
- [0, 75, 150, 225, 300], [0, 75, 150, 225, 300]
- ]
- }
- },
- width: 66,
- height: 75,
- frame: {
- moving: 5
- },
- //Only for moving status, override
- speed: 16,
- HP: 120,
- damage: 9,
- armor: 0,
- sight: 245,
- attackRange: 105,
- attackInterval: 2200,
- dieEffect: Burst.SmallZergFlyingDeath,
- isFlying: true,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 100,
- gas: 100,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeFlyerAttacks', 'UpgradeFlyerCarapace'],
- items: {
- '7': { name: 'Guardian', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'GreaterSpire';
- });
- } },
- '8': { name: 'Devourer', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'GreaterSpire';
- });
- } }
- }
- }
-});
-Zerg.Guardian = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.direction = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Guardian",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0], [81, 81, 81, 81, 81, 81, 81],
- [162, 162, 162, 162, 162, 162, 162], [243, 243, 243, 243, 243, 243, 243],
- [324, 324, 324, 324, 324, 324, 324], [405, 405, 405, 405, 405, 405, 405],
- [486, 486, 486, 486, 486, 486, 486], [567, 567, 567, 567, 567, 567, 567],
- [648, 648, 648, 648, 648, 648, 648], [810, 810, 810, 810, 810, 810, 810],
- [891, 891, 891, 891, 891, 891, 891], [972, 972, 972, 972, 972, 972, 972],
- [1053, 1053, 1053, 1053, 1053, 1053, 1053], [1134, 1134, 1134, 1134, 1134, 1134, 1134],
- [1215, 1215, 1215, 1215, 1215, 1215, 1215], [1296, 1296, 1296, 1296, 1296, 1296, 1296]
- ],
- top: [
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444],
- [0, 74, 148, 222, 296, 370, 444], [0, 74, 148, 222, 296, 370, 444]
- ]
- }
- },
- width: 81,
- height: 74,
- frame: {
- moving: 7
- },
- //Only for moving status, override
- speed: 6,
- HP: 150,
- damage: 20,
- armor: 2,
- sight: 385,
- attackRange: 280,
- attackInterval: 3000,
- dieEffect: Burst.BigZergFlyingDeath,
- isFlying: true,
- attackLimit: "ground",
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 50,
- gas: 100,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeFlyerAttacks', 'UpgradeFlyerCarapace'],
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Zerg.Devourer = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.direction = 6;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Devourer",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0], [73, 73, 73, 73, 73, 73],
- [146, 146, 146, 146, 146, 146], [219, 219, 219, 219, 219, 219],
- [292, 292, 292, 292, 292, 292], [365, 365, 365, 365, 365, 365],
- [438, 438, 438, 438, 438, 438], [511, 511, 511, 511, 511, 511],
- [584, 584, 584, 584, 584, 584], [730, 730, 730, 730, 730, 730],
- [803, 803, 803, 803, 803, 803], [876, 876, 876, 876, 876, 876],
- [949, 949, 949, 949, 949, 949], [1022, 1022, 1022, 1022, 1022, 1022],
- [1095, 1095, 1095, 1095, 1095, 1095], [1168, 1168, 1168, 1168, 1168, 1168]
- ],
- top: [
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430],
- [0, 86, 172, 258, 344, 430], [0, 86, 172, 258, 344, 430]
- ]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [73, 73, 73, 73, 73, 73, 73, 73],
- [146, 146, 146, 146, 146, 146, 146, 146], [219, 219, 219, 219, 219, 219, 219, 219],
- [292, 292, 292, 292, 292, 292, 292, 292], [365, 365, 365, 365, 365, 365, 365, 365],
- [438, 438, 438, 438, 438, 438, 438, 438], [511, 511, 511, 511, 511, 511, 511, 511],
- [584, 584, 584, 584, 584, 584, 584, 584], [730, 730, 730, 730, 730, 730, 730, 730],
- [803, 803, 803, 803, 803, 803, 803, 803], [876, 876, 876, 876, 876, 876, 876, 876],
- [949, 949, 949, 949, 949, 949, 949, 949], [1022, 1022, 1022, 1022, 1022, 1022, 1022, 1022],
- [1095, 1095, 1095, 1095, 1095, 1095, 1095, 1095], [1168, 1168, 1168, 1168, 1168, 1168, 1168, 1168]
- ],
- top: [
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774],
- [516, 516, 602, 602, 688, 688, 774, 774], [516, 516, 602, 602, 688, 688, 774, 774]
- ]
- }
- },
- width: 73,
- height: 86,
- frame: {
- moving: 6,
- attack: 8
- },
- //Only for moving status, override
- speed: 12,
- HP: 250,
- damage: 25,
- armor: 2,
- sight: 350,
- attackRange: 175,
- attackInterval: 5000,
- dieEffect: Burst.BigZergFlyingDeath,
- isFlying: true,
- attackLimit: "flying",
- unitType: Unit.BIG,
- attackType: AttackableUnit.BURST_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- AOE: {
- hasEffect: true,
- radius: 60
- },
- cost: {
- mine: 150,
- gas: 50,
- man: 2,
- time: 400
- },
- upgrade: ['UpgradeFlyerAttacks', 'UpgradeFlyerCarapace'],
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Zerg.Scourge = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.attack = this.imgPos.dock = this.imgPos.moving;
- this.frame.attack = this.frame.dock = this.frame.moving;
- this.direction = 0;
- //Adjust for multi frames
- this.y -= 20;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Scourge",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0], [34, 34, 34, 34, 34],
- [68, 68, 68, 68, 68], [102, 102, 102, 102, 102],
- [136, 136, 136, 136, 136], [170, 170, 170, 170, 170],
- [204, 204, 204, 204, 204], [238, 238, 238, 238, 238],
- [272, 272, 272, 272, 272], [340, 340, 340, 340, 340],
- [374, 374, 374, 374, 374], [408, 408, 408, 408, 408],
- [442, 442, 442, 442, 442], [476, 476, 476, 476, 476],
- [510, 510, 510, 510, 510], [544, 544, 544, 544, 544]
- ],
- top: [
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120],
- [0, 30, 60, 90, 120], [0, 30, 60, 90, 120]
- ]
- }
- },
- width: 34,
- height: 30,
- frame: {
- moving: 5
- },
- //Only for moving status, override
- speed: 16,
- HP: 25,
- damage: 110,
- armor: 0,
- sight: 175,
- meleeAttack: true,
- attackRange: 35,
- attackInterval: 1000,
- dieEffect: Burst.SmallZergFlyingDeath,
- attackEffect: Burst.ScourgeBomb,
- isFlying: true,
- attackLimit: "flying",
- suicide: true,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 12.5,
- gas: 37.5,
- man: 0.5,
- time: 150
- },
- birthCount: 2,
- upgrade: ['UpgradeFlyerCarapace'],
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.hover.call(this);
- }
- }
-});
-Zerg.Queen = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.direction = 7;
- //Adjust for multi frames
- this.y -= 16;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Queen",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0], [78, 78, 78, 78, 78],
- [156, 156, 156, 156, 156], [234, 234, 234, 234, 234],
- [312, 312, 312, 312, 312], [390, 390, 390, 390, 390],
- [468, 468, 468, 468, 468], [546, 546, 546, 546, 546],
- [624, 624, 624, 624, 624], [780, 780, 780, 780, 780],
- [858, 858, 858, 858, 858], [936, 936, 936, 936, 936],
- [1014, 1014, 1014, 1014, 1014], [1092, 1092, 1092, 1092, 1092],
- [1170, 1170, 1170, 1170, 1170], [1248, 1248, 1248, 1248, 1248]
- ],
- top: [
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284],
- [0, 71, 142, 213, 284], [0, 71, 142, 213, 284]
- ]
- }
- },
- width: 78,
- height: 71,
- frame: {
- moving: 5
- //attack: 6//Reserved
- },
- //Only for moving status, override
- speed: 16,
- HP: 120,
- armor: 0,
- MP: 200,
- sight: 350,
- dieEffect: Burst.BigZergFlyingDeath,
- isFlying: true,
- unitType: Unit.MIDDLE,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 100,
- gas: 150,
- man: 2,
- time: 500
- },
- upgrade: ['UpgradeFlyerCarapace'],
- items: {
- '6': { name: 'InfestTerranCommandCenter' },
- '7': { name: 'Parasite' },
- '8': { name: 'SpawnBroodlings', condition: function () {
- return Magic.SpawnBroodlings.enabled;
- } },
- '9': { name: 'Ensnare', condition: function () {
- return Magic.Ensnare.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- Unit.hover.call(this);
- }
- }
-});
-Zerg.Broodling = AttackableUnit.extends({
- constructorPlus: function (props) {
- //Nothing
- },
- prototypePlus: {
- //Add basic unit info
- name: "Broodling",
- imgPos: {
- moving: {
- left: [
- [5, 5, 5, 5, 5, 5, 5], [53, 53, 53, 53, 53, 53, 53],
- [101, 101, 101, 101, 101, 101, 101], [149, 149, 149, 149, 149, 149, 149],
- [197, 197, 197, 197, 197, 197, 197], [245, 245, 245, 245, 245, 245, 245],
- [293, 293, 293, 293, 293, 293, 293], [341, 341, 341, 341, 341, 341, 341],
- [389, 389, 389, 389, 389, 389, 389], [485, 485, 485, 485, 485, 485, 485],
- [533, 533, 533, 533, 533, 533, 533], [581, 581, 581, 581, 581, 581, 581],
- [629, 629, 629, 629, 629, 629, 629], [677, 677, 677, 677, 677, 677, 677],
- [725, 725, 725, 725, 725, 725, 725], [773, 773, 773, 773, 773, 773, 773]
- ],
- top: [
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293],
- [5, 53, 101, 149, 197, 245, 293], [5, 53, 101, 149, 197, 245, 293]
- ]
- },
- dock: {
- left: [5, 53, 101, 149, 197, 245, 293, 341, 389, 485, 533, 581, 629, 677, 725, 773],
- top: [5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]
- },
- attack: {
- left: [
- [5, 5, 5, 5, 5], [53, 53, 53, 53, 53],
- [101, 101, 101, 101, 101], [149, 149, 149, 149, 149],
- [197, 197, 197, 197, 197], [245, 245, 245, 245, 245],
- [293, 293, 293, 293, 293], [341, 341, 341, 341, 341],
- [389, 389, 389, 389, 389], [485, 485, 485, 485, 485],
- [533, 533, 533, 533, 533], [581, 581, 581, 581, 581],
- [629, 629, 629, 629, 629], [677, 677, 677, 677, 677],
- [725, 725, 725, 725, 725], [773, 773, 773, 773, 773]
- ],
- top: [
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533],
- [341, 389, 437, 485, 533], [341, 389, 437, 485, 533]
- ]
- }
- },
- width: 38,
- height: 38,
- frame: {
- moving: 7,
- dock: 1,
- attack: 5
- },
- //Only for moving status, override
- speed: 6,
- HP: 30,
- damage: 4,
- armor: 0,
- sight: 175,
- meleeAttack: true,
- attackInterval: 1500,
- dieEffect: Burst.BroodlingDeath,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.SMALL,
- recover: Building.ZergBuilding.prototype.recover,
- upgrade: ['UpgradeMeleeAttacks', 'EvolveCarapace'],
- attackType: AttackableUnit.NORMAL_ATTACK,
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.walkAround.call(this);
- }
- }
-});
-Zerg.Ultralisk = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.direction = 7;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Ultralisk",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0, 0], [101, 101, 101, 101, 101, 101, 101, 101, 101],
- [202, 202, 202, 202, 202, 202, 202, 202, 202], [303, 303, 303, 303, 303, 303, 303, 303, 303],
- [404, 404, 404, 404, 404, 404, 404, 404, 404], [606, 606, 606, 606, 606, 606, 606, 606, 606],
- [707, 707, 707, 707, 707, 707, 707, 707, 707], [808, 808, 808, 808, 808, 808, 808, 808, 808],
- [909, 909, 909, 909, 909, 909, 909, 909, 909], [1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111],
- [1212, 1212, 1212, 1212, 1212, 1212, 1212, 1212, 1212], [1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313, 1313],
- [1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414, 1414], [1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616, 1616],
- [1717, 1717, 1717, 1717, 1717, 1717, 1717, 1717, 1717], [1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818, 1818]
- ],
- top: [
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864],
- [0, 108, 216, 324, 432, 540, 648, 756, 864], [0, 108, 216, 324, 432, 540, 648, 756, 864]
- ]
- },
- dock: {
- left: [0, 101, 202, 303, 404, 606, 707, 808, 909, 1111, 1212, 1313, 1414, 1616, 1717, 1818],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- },
- attack: {
- left: [
- [0, 0, 0, 0, 0, 0], [101, 101, 101, 101, 101, 101],
- [202, 202, 202, 202, 202, 202], [303, 303, 303, 303, 303, 303],
- [404, 404, 404, 404, 404, 404], [606, 606, 606, 606, 606, 606],
- [707, 707, 707, 707, 707, 707], [808, 808, 808, 808, 808, 808],
- [909, 909, 909, 909, 909, 909], [1111, 1111, 1111, 1111, 1111, 1111],
- [1212, 1212, 1212, 1212, 1212, 1212], [1313, 1313, 1313, 1313, 1313, 1313],
- [1414, 1414, 1414, 1414, 1414, 1414], [1616, 1616, 1616, 1616, 1616, 1616],
- [1717, 1717, 1717, 1717, 1717, 1717], [1818, 1818, 1818, 1818, 1818, 1818]
- ],
- top: [
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512],
- [972, 1080, 1188, 1296, 1404, 1512], [972, 1080, 1188, 1296, 1404, 1512]
- ]
- }
- },
- width: 101,
- height: 108,
- frame: {
- moving: 9,
- dock: 1,
- attack: 6
- },
- //Only for moving status, override
- speed: 12,
- HP: 400,
- damage: 20,
- armor: 1,
- sight: 245,
- meleeAttack: true,
- attackInterval: 1500,
- dieEffect: Burst.UltraliskDeath,
- isFlying: false,
- attackLimit: "ground",
- unitType: Unit.BIG,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 200,
- gas: 200,
- man: 6,
- time: 600
- },
- upgrade: ['UpgradeMeleeAttacks', 'EvolveCarapace']
- }
-});
-Zerg.Defiler = Unit.extends({
- constructorPlus: function (props) {
- //Same action mapping
- this.imgPos.dock = this.imgPos.moving;
- this.frame.dock = this.frame.moving;
- this.sound.burrow = new Audio(Game.CDN + 'bgm/Zerg.burrow.wav');
- this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
- this.direction = 6;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Defiler",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [72, 72, 72, 72, 72, 72, 72, 72],
- [144, 144, 144, 144, 144, 144, 144, 144], [216, 216, 216, 216, 216, 216, 216, 216],
- [288, 288, 288, 288, 288, 288, 288, 288], [360, 360, 360, 360, 360, 360, 360, 360],
- [432, 432, 432, 432, 432, 432, 432, 432], [504, 504, 504, 504, 504, 504, 504, 504],
- [576, 576, 576, 576, 576, 576, 576, 576], [720, 720, 720, 720, 720, 720, 720, 720],
- [792, 792, 792, 792, 792, 792, 792, 792], [864, 864, 864, 864, 864, 864, 864, 864],
- [936, 936, 936, 936, 936, 936, 936, 936], [1008, 1008, 1008, 1008, 1008, 1008, 1008, 1008],
- [1080, 1080, 1080, 1080, 1080, 1080, 1080, 1080], [1152, 1152, 1152, 1152, 1152, 1152, 1152, 1152]
- ],
- top: [
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434],
- [0, 62, 124, 186, 248, 310, 372, 434], [0, 62, 124, 186, 248, 310, 372, 434]
- ]
- },
- burrow: {
- left: [
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216],
- [288, -1, 0, 72, 144, 216], [288, -1, 0, 72, 144, 216]
- ],
- top: [
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496],
- [496, -1, 496, 496, 496, 496], [496, -1, 496, 496, 496, 496]
- ]
- },
- unburrow: {
- left: [
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0],
- [216, 144, 72, 0, 0, 0], [216, 144, 72, 0, 0, 0]
- ],
- top: [
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496],
- [496, 496, 496, 496, 496, 496], [496, 496, 496, 496, 496, 496]
- ]
- }
- },
- width: 72,
- height: 62,
- frame: {
- moving: 8,
- burrow: 1,
- unburrow: 6
- },
- //Only for moving status, override
- speed: 10,
- HP: 80,
- armor: 1,
- MP: 200,
- sight: 350,
- dieEffect: Burst.DefilerDeath,
- isFlying: false,
- unitType: Unit.MIDDLE,
- recover: Building.ZergBuilding.prototype.recover,
- cost: {
- mine: 50,
- gas: 150,
- man: 2,
- time: 500
- },
- upgrade: ['EvolveCarapace'],
- items: {
- '6': { name: 'Consume', condition: function () {
- return Magic.Consume.enabled;
- } },
- '7': { name: 'DarkSwarm' },
- '8': { name: 'Plague', condition: function () {
- return Magic.Plague.enabled;
- } },
- '9': { name: 'Burrow', condition: function () {
- return Magic.Burrow.enabled;
- } }
- }
- }
-});
-Zerg.InfestedTerran = AttackableUnit.extends({
- constructorPlus: function (props) {
- this.sound.burrow = new Audio(Game.CDN + 'bgm/Zerg.burrow.wav');
- this.sound.unburrow = new Audio(Game.CDN + 'bgm/Zerg.unburrow.wav');
- },
- prototypePlus: {
- //Add basic unit info
- name: "InfestedTerran",
- imgPos: {
- moving: {
- left: [
- [0, 0, 0, 0, 0, 0, 0, 0], [41, 41, 41, 41, 41, 41, 41, 41],
- [82, 82, 82, 82, 82, 82, 82, 82], [123, 123, 123, 123, 123, 123, 123, 123],
- [164, 164, 164, 164, 164, 164, 164, 164], [205, 205, 205, 205, 205, 205, 205, 205],
- [246, 246, 246, 246, 246, 246, 246, 246], [287, 287, 287, 287, 287, 287, 287, 287],
- [328, 328, 328, 328, 328, 328, 328, 328], [410, 410, 410, 410, 410, 410, 410, 410],
- [451, 451, 451, 451, 451, 451, 451, 451], [492, 492, 492, 492, 492, 492, 492, 492],
- [533, 533, 533, 533, 533, 533, 533, 533], [574, 574, 574, 574, 574, 574, 574, 574],
- [615, 615, 615, 615, 615, 615, 615, 615], [656, 656, 656, 656, 656, 656, 656, 656]
- ],
- top: [
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378],
- [0, 54, 108, 162, 216, 270, 324, 378], [0, 54, 108, 162, 216, 270, 324, 378]
- ]
- },
- dock: {
- left: [0, 41, 82, 123, 164, 205, 246, 287, 328, 410, 451, 492, 533, 574, 615, 656],
- top: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
- },
- burrow: {
- left: [
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576],
- [616, -1, 410, 452, 494, 535, 576], [616, -1, 410, 452, 494, 535, 576]
- ],
- top: [
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436],
- [436, -1, 436, 436, 436, 436, 436], [436, -1, 436, 436, 436, 436, 436]
- ]
- },
- unburrow: {
- left: [
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410],
- [576, 535, 494, 452, 410, 410, 410], [576, 535, 494, 452, 410, 410, 410]
- ],
- top: [
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436],
- [436, 436, 436, 436, 436, 436, 436], [436, 436, 436, 436, 436, 436, 436]
- ]
- }
- },
- width: 41,
- height: 44,
- frame: {
- moving: 8,
- dock: 1,
- burrow: 1,
- unburrow: 7
- },
- //Only for moving status, override
- speed: 10,
- HP: 60,
- damage: 500,
- armor: 0,
- sight: 175,
- meleeAttack: true,
- attackRange: 35,
- attackInterval: 1000,
- dieEffect: Burst.HumanDeath,
- attackEffect: Burst.InfestedBomb,
- isFlying: false,
- attackLimit: "ground",
- suicide: true,
- unitType: Unit.SMALL,
- attackType: AttackableUnit.NORMAL_ATTACK,
- recover: Building.ZergBuilding.prototype.recover,
- AOE: {
- hasEffect: false,
- radius: 80
- },
- cost: {
- mine: 100,
- gas: 50,
- man: 1,
- time: 400
- },
- upgrade: ['EvolveCarapace'],
- items: {
- '9': { name: 'Burrow', condition: function () {
- return Magic.Burrow.enabled;
- } }
- },
- //Override
- dock: function () {
- //Use the same behavior
- AttackableUnit.turnAround.call(this);
- }
- }
-});
-Zerg.Larva = Unit.extends({
- constructorPlus: function (props) {
- this.imgPos.dock = this.imgPos.moving;
- //Cannot leave from this point
- this.originX = this.posX();
- this.originY = this.posY();
- this.moved = false;
- },
- prototypePlus: {
- //Add basic unit info
- name: "Larva",
- imgPos: {
- moving: {
- left: [
- [1, 1, 1, 1, 1], [34, 34, 34, 34, 34],
- [67, 67, 67, 67, 67], [100, 100, 100, 100, 100],
- [133, 133, 133, 133, 133], [166, 166, 166, 166, 166],
- [199, 199, 199, 199, 199], [232, 232, 232, 232, 232],
- [265, 265, 265, 265, 265], [298, 298, 298, 298, 298],
- [331, 331, 331, 331, 331], [364, 364, 364, 364, 364],
- [397, 397, 397, 397, 397], [430, 430, 430, 430, 430],
- [463, 463, 463, 463, 463], [496, 496, 496, 496, 496]
- ],
- top: [
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117],
- [1, 30, 59, 88, 117], [1, 30, 59, 88, 117]
- ]
- }
- },
- width: 32,
- height: 28,
- frame: {
- moving: 5,
- dock: 1
- },
- //Only for moving status, override
- speed: 4,
- HP: 25,
- armor: 10,
- sight: 70,
- dieEffect: Burst.LarvaDeath,
- unitType: Unit.SMALL,
- isFlying: false,
- recover: Building.ZergBuilding.prototype.recover,
- upgrade: ['EvolveCarapace'],
- items: {
- '1': { name: 'Drone' },
- '2': { name: 'Zergling', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'SpawningPool';
- });
- } },
- '3': { name: 'Overlord' },
- '4': { name: 'Hydralisk', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'HydraliskDen';
- });
- } },
- '5': { name: 'Mutalisk', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && (chara.name == 'Spire' || chara.name == 'GreaterSpire');
- });
- } },
- '6': { name: 'Scourge', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && (chara.name == 'Spire' || chara.name == 'GreaterSpire');
- });
- } },
- '7': { name: 'Queen', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'QueenNest';
- });
- } },
- '8': { name: 'Ultralisk', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'UltraliskCavern';
- });
- } },
- '9': { name: 'Defiler', condition: function () {
- return Building.allBuildings.some(function (chara) {
- return !(chara.isEnemy()) && chara.name == 'DefilerMound';
- });
- } }
- },
- //Prevent user control moving
- moveTo: function () { },
- moveToward: function () { },
- //Override
- dock: function () {
- Unit.walkAroundLarva.call(this);
- }
- }
-});
-//# sourceMappingURL=Zerg.js.map
\ No newline at end of file
diff --git a/Controller/keyController.js b/Controller/keyController.js
deleted file mode 100644
index 05fc476..0000000
--- a/Controller/keyController.js
+++ /dev/null
@@ -1,122 +0,0 @@
-var keyController = {
- shift: false,
- ctrl: false,
- disable: false,
- start: function () {
- //Keyboard settings
- window.onkeydown = function (event) {
- //Will not switch page by Ctrl+N,cannot debug
- //event.preventDefault();
- //Sometimes need to disable shortcut key
- if (keyController.disable && event.keyCode != 13)
- return;
- switch (event.keyCode) {
- //Press SHIFT down
- case 16:
- keyController.shift = true;
- break;
- //Press CTRL down
- case 17:
- keyController.ctrl = true;
- break;
- //Press number
- case 48:
- case 49:
- case 50:
- case 51:
- case 52:
- case 53:
- case 54:
- case 55:
- case 56:
- case 57:
- var teamNum = String.fromCharCode(event.keyCode);
- //Building team
- if (keyController.ctrl) {
- Game.addSelectedIntoTeam(teamNum);
- }
- else {
- Game.callTeam(teamNum);
- }
- break;
- //Move map
- case 37:
- Map.needRefresh = "LEFT";
- break;
- case 38:
- Map.needRefresh = "TOP";
- break;
- case 39:
- Map.needRefresh = "RIGHT";
- break;
- case 40:
- Map.needRefresh = "BOTTOM";
- break;
- //Replay speed control
- case 107:
- case 33:
- //Speed up + or pageUp
- Button.speedUpHandler();
- break;
- case 109:
- case 34:
- //Slow down - or pageDown
- Button.slowDownHandler();
- break;
- //Shortcut keys:
- //Press M
- case 77:
- if ($.makeArray($('div.panel_Control button')).some(function (btn) {
- return btn.className == 'move';
- }))
- Button.moveHandler();
- break;
- //Press S
- case 83:
- if ($.makeArray($('div.panel_Control button')).some(function (btn) {
- return btn.className == 'stop';
- }))
- Button.stopHandler();
- break;
- //Press A
- case 65:
- if ($.makeArray($('div.panel_Control button')).some(function (btn) {
- return btn.className == 'attack';
- }))
- Button.attackHandler();
- break;
- //Press P
- case 80:
- if ($.makeArray($('div.panel_Control button')).some(function (btn) {
- return btn.className == 'patrol';
- }))
- Button.patrolHandler();
- break;
- //Press H
- case 72:
- if ($.makeArray($('div.panel_Control button')).some(function (btn) {
- return btn.className == 'hold';
- }))
- Button.holdHandler();
- break;
- //Press ENTER
- case 13:
- Cheat.handler();
- break;
- }
- };
- window.onkeyup = function (event) {
- switch (event.keyCode) {
- //Press SHIFT up
- case 16:
- keyController.shift = false;
- break;
- //Press CTRL up
- case 17:
- keyController.ctrl = false;
- break;
- }
- };
- }
-};
-//# sourceMappingURL=keyController.js.map
\ No newline at end of file
diff --git a/Controller/mouseController.js b/Controller/mouseController.js
deleted file mode 100644
index a8af361..0000000
--- a/Controller/mouseController.js
+++ /dev/null
@@ -1,303 +0,0 @@
-var mouseController = {
- down: false,
- drag: false,
- startPoint: { x: 0, y: 0 },
- endPoint: { x: 0, y: 0 },
- isMultiSelect: function () {
- return keyController.shift;
- },
- isJoinTeam: function () {
- return keyController.ctrl;
- },
- leftClick: function (event) {
- //Mouse at (clickX,clickY)
- var offset = $('#fogCanvas').offset();
- var clickX = event.pageX - offset.left;
- var clickY = event.pageY - offset.top;
- //Intercept event inside infoBox
- if (clickY > Game.infoBox.y)
- return;
- //Selection mode
- if (Button.callback == null) {
- //Find selected one, convert position
- var selectedOne = Game.getSelectedOne(clickX + Map.offsetX, clickY + Map.offsetY);
- //Cannot select enemy invisible unit
- if ((selectedOne instanceof Gobj) && selectedOne['isInvisible' + Game.team] && selectedOne.isEnemy())
- return;
- //Single select will unselect all units and only choose selected one
- //Multi select will keep selected status and do nothing
- if (!mouseController.isMultiSelect())
- Game.unselectAll();
- //If has selected one
- if (selectedOne instanceof Gobj) {
- //Sound effect
- if (!(selectedOne.isEnemy()))
- selectedOne.sound.selected.play();
- //Cannot multiSelect with enemy
- if (selectedOne.isEnemy() || (Game.selectedUnit.isEnemy && Game.selectedUnit.isEnemy()))
- Game.unselectAll();
- //Only selected one to show portrait
- Game.changeSelectedTo(selectedOne);
- //Add into allSelected if not included
- Game.addIntoAllSelected(selectedOne);
- }
- else {
- //Click null
- Game.changeSelectedTo({});
- Game.unselectAll();
- }
- }
- else {
- //Callback
- Button.execute(event);
- }
- //Hide tooltip when click
- $('div.tooltip_Box').hide();
- //Login user statistic
- if (Multiplayer.statistic != null)
- Multiplayer.statistic.left++;
- },
- rightClick: function (event, unlock, btn) {
- //Mouse at (clickX,clickY)
- var offset = $('#fogCanvas').offset();
- var clickX = event.pageX - offset.left;
- var clickY = event.pageY - offset.top;
- //Intercept event inside infoBox
- if (clickY > Game.infoBox.y)
- return;
- //Show right click cursor
- var pos = { x: (clickX + Map.offsetX), y: (clickY + Map.offsetY) };
- new Burst.RightClickCursor(pos);
- var charas = Game.allSelected.filter(function (chara) {
- //Can only control our alive unit
- return chara.team == Game.team && chara.status != "dead";
- });
- //Handle user right click
- Multiplayer.cmds.push(JSON.stringify({
- uids: Multiplayer.getUIDs(charas),
- type: 'rightClick',
- pos: pos,
- unlock: Boolean(unlock),
- btn: btn
- }));
- //Login user statistic
- if (Multiplayer.statistic != null)
- Multiplayer.statistic.right++;
- },
- rightClickHandler: function (charas, pos, unlock, btn) {
- //Find selected one or nothing
- var selectedEnemy = (charas.length > 0) ? Game.getSelectedOne(pos.x, pos.y, charas[0].team.toString()) : null;
- charas.forEach(function (chara) {
- //Sound effect
- if (!chara.isEnemy() && chara.sound.moving)
- chara.sound.moving.play();
- //Interrupt old destination routing
- if (chara.destination) {
- //Break possible dead lock
- if (chara.destination.next)
- chara.destination.next = null;
- delete chara.destination;
- }
- //Cancel possible hold
- if (chara.hold) {
- delete chara.AI;
- delete chara.findNearbyTargets;
- delete chara.hold;
- Button.refreshButtons();
- }
- //Unit cannot attack will always choose move mode
- var attackOrMove = (chara.attack) ? (selectedEnemy instanceof Gobj) : false;
- //Attack mode
- if (attackOrMove) {
- if (chara.cannotMove() && !(chara.isInAttackRange(selectedEnemy)))
- return;
- //Intercept invisible enemy
- if (selectedEnemy['isInvisible' + Game.team]) {
- if (!chara.isEnemy())
- Referee.voice('pError').play();
- return;
- }
- chara.targetLock = true;
- chara.attack(selectedEnemy);
- }
- else {
- if (chara.cannotMove())
- return;
- //Only attackable units can stop attack
- if (chara.attack)
- chara.stopAttack();
- //Lock destination by default
- chara.targetLock = !unlock;
- chara.moveTo(pos.x, pos.y);
- //Record destination
- if (btn == 'attack') {
- chara.destination = { x: pos.x, y: pos.y };
- }
- if (btn == 'patrol') {
- //Patrol dead lock
- chara.destination = { x: pos.x, y: pos.y };
- chara.destination.next = { x: chara.posX(), y: chara.posY(), next: chara.destination };
- }
- }
- });
- },
- dblClick: function () {
- //Multi select same type units
- if (!(Game.selectedUnit.isEnemy && Game.selectedUnit.isEnemy())) {
- var charas = Unit.allUnits.filter(function (chara) {
- return !(chara.isEnemy()) && chara.insideScreen() && (chara.name == Game.selectedUnit.name);
- });
- Game.addIntoAllSelected(charas);
- }
- },
- //Can control all units
- toControlAll: function () {
- //For desktop
- if (!Game.isApp) {
- //Mouse left click
- $('#fogCanvas')[0].onclick = function (event) {
- event.preventDefault();
- if (mouseController.drag) {
- //End drag, onclick triggered after onmouseup, don't do default left click action
- mouseController.drag = false;
- }
- else {
- mouseController.leftClick(event);
- }
- };
- //Mouse right click
- $('#fogCanvas')[0].oncontextmenu = function (event) {
- //Prevent context menu show
- event.preventDefault();
- //Should not control units during replay
- if (Game.replayFlag)
- return;
- mouseController.rightClick(event);
- //Cancel pointer
- $('div.GameLayer').removeAttr('status');
- //Cancel callback
- Button.callback = null;
- };
- //Double click
- $('#fogCanvas')[0].ondblclick = function (event) {
- //Prevent screen select
- event.preventDefault();
- mouseController.dblClick();
- };
- //Mouse click start
- $('#fogCanvas')[0].onmousedown = function (event) {
- event.preventDefault();
- //Do not allow rectangular-multi-select with right click, only left clicks
- if (event.which === 3) {
- return;
- }
- if (!mouseController.down) {
- //Mouse at (clickX,clickY)
- var clickX = event.pageX - $('#fogCanvas').offset().left;
- var clickY = event.pageY - $('#fogCanvas').offset().top;
- mouseController.startPoint = { x: clickX, y: clickY };
- mouseController.down = true;
- }
- };
- //Mouse drag
- $('#fogCanvas')[0].onmousemove = function (event) {
- event.preventDefault();
- if (mouseController.down) {
- //Mouse at (clickX,clickY)
- var clickX = event.pageX - $('#fogCanvas').offset().left;
- var clickY = event.pageY - $('#fogCanvas').offset().top;
- mouseController.endPoint = { x: clickX, y: clickY };
- if (Math.abs(clickX - mouseController.startPoint.x) > 5 &&
- Math.abs(clickY - mouseController.startPoint.y) > 5) {
- mouseController.drag = true;
- }
- }
- };
- //Global client refresh map
- window.onmousemove = function (event) {
- event.preventDefault();
- //Mouse at (clickX,clickY)
- mouseController.mouseX = event.clientX;
- mouseController.mouseY = event.clientY;
- };
- //Mouse click end
- $('#fogCanvas')[0].onmouseup = function (event) {
- event.preventDefault();
- mouseController.down = false;
- if (mouseController.drag) {
- //Multi select inside rect
- Game.multiSelectInRect();
- }
- };
- }
- else {
- $('#fogCanvas')[0].ontouchstart = function (event) {
- event.preventDefault();
- //Drag rectangle
- if (event.touches.length == 2) {
- var offsetX = $('#fogCanvas').offset().left;
- var offsetY = $('#fogCanvas').offset().top;
- mouseController.drag = true;
- mouseController.startPoint = { x: event.touches[0].pageX - offsetX, y: event.touches[0].pageY - offsetY };
- mouseController.endPoint = { x: event.touches[1].pageX - offsetX, y: event.touches[1].pageY - offsetY };
- }
- };
- $('#fogCanvas')[0].ontouchend = function (event) {
- event.preventDefault();
- if (mouseController.drag) {
- //Multi select inside rect
- Game.multiSelectInRect();
- //End drag
- mouseController.drag = false;
- }
- };
- mouseController.mobileScreen = new Hammer(window);
- mouseController.canvasScreen = new Hammer($('#fogCanvas')[0]);
- mouseController.canvasScreen.on('tap', function (event) {
- event.preventDefault();
- //Callback
- mouseController.leftClick(event.pointers[0]);
- });
- mouseController.canvasScreen.on('doubletap', function (event) {
- event.preventDefault();
- mouseController.dblClick();
- });
- mouseController.canvasScreen.on('press', function (event) {
- //Prevent context menu show
- event.preventDefault();
- //Should not control units during replay
- if (Game.replayFlag)
- return;
- mouseController.rightClick(event.changedPointers[0]);
- //Cancel handler
- $('div.GameLayer').removeAttr('status');
- Button.callback = null;
- });
- mouseController.canvasScreen.on('panleft', function (event) {
- Map.needRefresh = "RIGHT";
- });
- mouseController.canvasScreen.on('panright', function (event) {
- Map.needRefresh = "LEFT";
- });
- mouseController.mobileScreen.on('panup', function (event) {
- Map.needRefresh = "BOTTOM";
- });
- mouseController.mobileScreen.on('pandown', function (event) {
- Map.needRefresh = "TOP";
- });
- }
- //Both sides
- $('div#GamePlay div').on('contextmenu', function (event) {
- event.preventDefault();
- });
- $('canvas[name="mini_map"]').on('click', function (event) {
- event.preventDefault();
- Map.clickHandler(event);
- });
- $('canvas[name="mini_map"]').on('contextmenu', function (event) {
- event.preventDefault();
- Map.dblClickHandler(event);
- });
- }
-};
-//# sourceMappingURL=mouseController.js.map
\ No newline at end of file
diff --git a/GameRule/Cheat.js b/GameRule/Cheat.js
deleted file mode 100644
index 74be824..0000000
--- a/GameRule/Cheat.js
+++ /dev/null
@@ -1,153 +0,0 @@
-var Cheat = {
- isShown: false,
- cwal: false,
- gathering: false,
- manUnlimited: false,
- handler: function () {
- if (Cheat.isShown) {
- if (Multiplayer.ON) {
- Multiplayer.webSocket.send(JSON.stringify({
- type: 'chat',
- from: Game.team,
- msg: $('input#cheatInput').val()
- }));
- }
- else {
- //Forbid cheating during replay
- if (!Game.replayFlag) {
- var cheatFlag = Cheat.execute($('input#cheatInput').val().toLowerCase());
- if (cheatFlag) {
- //Refresh control panel
- Game.changeSelectedTo(Game.selectedUnit);
- Game.showMessage('Cheat enabled');
- }
- }
- }
- $('#cheat_Box').hide();
- $('input#cheatInput').val('');
- Cheat.isShown = false;
- keyController.disable = false;
- }
- else {
- $('#cheat_Box').show();
- $('input#cheatInput').focus();
- Cheat.isShown = true;
- keyController.disable = true;
- }
- },
- execute: function (cheatCode) {
- //Forbid cheating when multiplayer mode
- if (Multiplayer.ON)
- return;
- var cheatFlag = true;
- switch (cheatCode) {
- case "show me the money":
- Resource[Game.team].mine += 10000;
- Resource[Game.team].gas += 10000;
- break;
- case "black sheep wall":
- //Switch between show fog or not show
- Map.fogFlag = !Map.fogFlag;
- if (Map.fogFlag == false) {
- //Clear old fog on screen
- Game.fogCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
- //Redraw mini-map
- Map.drawFogAndMinimap();
- }
- break;
- case "something for nothing":
- //Upgrade all grades
- for (var grade in Upgrade) {
- Upgrade[grade].effect(Game.team);
- }
- break;
- case "full recovery":
- Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function (chara) {
- chara.life = chara.get('HP');
- if (chara.SP)
- chara.shield = chara.get('SP');
- if (chara.MP)
- chara.magic = chara.get('MP');
- });
- break;
- case "staying alive":
- Referee.winCondition = Referee.loseCondition = function () {
- return false;
- };
- break;
- case "operation cwal":
- Cheat.cwal = !(Cheat.cwal);
- break;
- case "the gathering":
- Cheat.gathering = !(Cheat.gathering);
- break;
- case "food for thought":
- Cheat.manUnlimited = !(Cheat.manUnlimited);
- break;
- case "power overwhelming":
- if (Cheat.oldCalculateDamageBy) {
- var tempCalculateDamageBy = $.extend([], Cheat.oldCalculateDamageBy);
- Cheat.oldCalculateDamageBy = [Unit.prototype.calculateDamageBy, Building.prototype.calculateDamageBy];
- Unit.prototype.calculateDamageBy = tempCalculateDamageBy[0];
- Building.prototype.calculateDamageBy = tempCalculateDamageBy[1];
- }
- else {
- Cheat.oldCalculateDamageBy = [Unit.prototype.calculateDamageBy, Building.prototype.calculateDamageBy];
- Unit.prototype.calculateDamageBy = function (enemyObj) {
- if (enemyObj.isEnemy && enemyObj.isEnemy())
- return 0;
- else
- return Cheat.oldCalculateDamageBy[0].call(this, enemyObj);
- };
- Building.prototype.calculateDamageBy = function (enemyObj) {
- if (enemyObj.isEnemy && enemyObj.isEnemy())
- return 0;
- else
- return Cheat.oldCalculateDamageBy[1].call(this, enemyObj);
- };
- }
- break;
- case "big daddy":
- var daddy = new Hero.HeroCruiser({ x: Map.offsetX + Game.HBOUND / 2, y: Map.offsetY + Game.VBOUND / 2 });
- Game.changeSelectedTo(daddy);
- break;
- case "big mommy":
- var mommy = new Hero.Sarah({ x: Map.offsetX + Game.HBOUND / 2, y: Map.offsetY + Game.VBOUND / 2 });
- Game.changeSelectedTo(mommy);
- break;
- case "game over man":
- case "gg":
- Game.lose();
- break;
- case "there is no cow level":
- case "your gg":
- Game.win();
- break;
- case "fuck your mother":
- Unit.allEnemyUnits().concat(Building.enemyBuildings()).forEach(function (chara) {
- chara.die();
- });
- break;
- case "fuck my asshole":
- Unit.allOurUnits().concat(Building.ourBuildings()).forEach(function (chara) {
- chara.die();
- });
- break;
- case "liuda is god":
- Cheat.execute('black sheep wall');
- Referee.winCondition = Referee.loseCondition = function () {
- return false;
- };
- Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
- chara.die();
- });
- break;
- default:
- //Not match any of above cheating code
- cheatFlag = false;
- break;
- }
- return cheatFlag;
- }
-};
-//# sourceMappingURL=Cheat.js.map
\ No newline at end of file
diff --git a/GameRule/Game.js b/GameRule/Game.js
deleted file mode 100644
index 64dd4a5..0000000
--- a/GameRule/Game.js
+++ /dev/null
@@ -1,1271 +0,0 @@
-var Game = (function () {
- function Game() {
- this.infoBox = -110;
- this.width = -295;
- }
- return Game;
-}());
-team: 0,
- playerNum;
-2,
- teams;
-{ }
-multiplayer: false,
- cxt;
-$('#middleCanvas')[0].getContext('2d'),
- frontCxt;
-$('#frontCanvas')[0].getContext('2d'),
- backCxt;
-$('#backCanvas')[0].getContext('2d'),
- fogCxt;
-$('#fogCanvas')[0].getContext('2d'),
- _timer;
--1,
- _frameInterval;
-100,
- mainTick;
-0,
- serverTick;
-0,
- commands;
-{ }
-replay: { }
-randomSeed: 0,
- selectedUnit;
-{ }
-allSelected: [],
- _oldAllSelected;
-[],
- hackMode;
-false,
- isApp;
-false,
- offline;
-false,
- CDN;
-'',
- addIntoAllSelected;
-function (chara, override) {
- if (chara instanceof Gobj) {
- //Add into allSelected if not included
- if (Game.allSelected.indexOf(chara) == -1) {
- if (override)
- Game.allSelected = chara;
- else
- Game.allSelected.push(chara);
- chara.selected = true;
- }
- }
- //Override directly
- if (chara instanceof Array) {
- if (override)
- Game.allSelected = chara;
- else
- chara.forEach(function (char) {
- //Add into allSelected if not included
- if (Game.allSelected.indexOf(char) == -1)
- Game.allSelected.push(char);
- });
- chara.forEach(function (char) {
- char.selected = true;
- });
- }
- //Sort allSelected by its name order
- Game.allSelected.sort(function (chara1, chara2) {
- //Need sort building icon together
- var name1 = (chara1 instanceof Building) ? (chara1.inherited.name + '.' + chara1.name) : chara1.name;
- var name2 = (chara2 instanceof Building) ? (chara2.inherited.name + '.' + chara2.name) : chara2.name;
- return ([name1, name2].sort()[0] != name1) ? 1 : -1;
- });
- //Notify referee to redraw
- Referee.alterSelectionMode();
-}
-//To replace setTimeout
-commandTimeout: function (func, delay) {
- var dueTick = Game.mainTick + (delay / 100 >> 0);
- if (!Game.commands[dueTick])
- Game.commands[dueTick] = [];
- Game.commands[dueTick].push(func);
-}
-//To replace setInterval
-commandInterval: function (func, interval) {
- var funcAdjust = function () {
- func();
- Game.commandTimeout(funcAdjust, interval);
- };
- Game.commandTimeout(funcAdjust, interval);
-}
-race: {
- selected: 'Terran',
- choose;
- function (race) {
- this.selected = race;
- $('div#GamePlay').attr('race', race);
- }
-}
-layerSwitchTo: function (layerName) {
- $('div.GameLayer').hide();
- $('#' + layerName).show(); //show('slow')
-}
-init: function () {
- //Prevent full select
- $('div.GameLayer').on("selectstart", function (event) {
- event.preventDefault();
- });
- //Bind resize canvas handler
- window.onresize = Game.resizeWindow;
- /*window.requestAnimationFrame=requestAnimationFrame || webkitRequestAnimationFrame
- || mozRequestAnimationFrame || msRequestAnimationFrame || oRequestAnimationFrame;//Old browser compatible*/
- //Online mode
- if (!Game.offline) {
- Game.CDN = prompt('Please input CDN location for images and audios:');
- if (Game.CDN) {
- if (!Game.CDN.startsWith('http://'))
- Game.CDN = 'http://' + Game.CDN;
- if (!Game.CDN.endsWith('/'))
- Game.CDN += '/';
- }
- }
- //Start loading
- Game.layerSwitchTo("GameLoading");
- //Zerg
- sourceLoader.load("img", Game.CDN + "img/Charas/Mutalisk.png", "Mutalisk");
- sourceLoader.load("img", Game.CDN + "img/Charas/Devourer.png", "Devourer");
- sourceLoader.load("img", Game.CDN + "img/Charas/Guardian.png", "Guardian");
- sourceLoader.load("img", Game.CDN + "img/Charas/Overlord.png", "Overlord");
- sourceLoader.load("img", Game.CDN + "img/Charas/Drone.png", "Drone");
- sourceLoader.load("img", Game.CDN + "img/Charas/Zergling.png", "Zergling");
- sourceLoader.load("img", Game.CDN + "img/Charas/Hydralisk.png", "Hydralisk");
- sourceLoader.load("img", Game.CDN + "img/Charas/Scourge.png", "Scourge");
- sourceLoader.load("img", Game.CDN + "img/Charas/Lurker.png", "Lurker");
- sourceLoader.load("img", Game.CDN + "img/Charas/Ultralisk.png", "Ultralisk");
- sourceLoader.load("img", Game.CDN + "img/Charas/Broodling.png", "Broodling");
- sourceLoader.load("img", Game.CDN + "img/Charas/InfestedTerran.png", "InfestedTerran");
- sourceLoader.load("img", Game.CDN + "img/Charas/Queen.png", "Queen");
- sourceLoader.load("img", Game.CDN + "img/Charas/Defiler.png", "Defiler");
- sourceLoader.load("img", Game.CDN + "img/Charas/Larva.png", "Larva");
- //Terran
- sourceLoader.load("img", Game.CDN + "img/Charas/BattleCruiser.png", "BattleCruiser");
- sourceLoader.load("img", Game.CDN + "img/Charas/Wraith.png", "Wraith");
- sourceLoader.load("img", Game.CDN + "img/Charas/SCV.png", "SCV");
- sourceLoader.load("img", Game.CDN + "img/Charas/Civilian.png", "Civilian");
- sourceLoader.load("img", Game.CDN + "img/Charas/Marine.png", "Marine");
- sourceLoader.load("img", Game.CDN + "img/Charas/Firebat.png", "Firebat");
- sourceLoader.load("img", Game.CDN + "img/Charas/Ghost.png", "Ghost");
- sourceLoader.load("img", Game.CDN + "img/Charas/Vulture.png", "Vulture");
- sourceLoader.load("img", Game.CDN + "img/Charas/Tank.png", "Tank");
- sourceLoader.load("img", Game.CDN + "img/Charas/Goliath.png", "Goliath");
- sourceLoader.load("img", Game.CDN + "img/Charas/Medic.png", "Medic");
- sourceLoader.load("img", Game.CDN + "img/Charas/Dropship.png", "Dropship");
- sourceLoader.load("img", Game.CDN + "img/Charas/Vessel.png", "Vessel");
- sourceLoader.load("img", Game.CDN + "img/Charas/Valkyrie.png", "Valkyrie");
- //Protoss
- sourceLoader.load("img", Game.CDN + "img/Charas/Probe.png", "Probe");
- sourceLoader.load("img", Game.CDN + "img/Charas/Zealot.png", "Zealot");
- sourceLoader.load("img", Game.CDN + "img/Charas/Dragoon.png", "Dragoon");
- sourceLoader.load("img", Game.CDN + "img/Charas/Templar.png", "Templar");
- sourceLoader.load("img", Game.CDN + "img/Charas/DarkTemplar.png", "DarkTemplar");
- sourceLoader.load("img", Game.CDN + "img/Charas/Reaver.png", "Reaver");
- sourceLoader.load("img", Game.CDN + "img/Charas/Archon.png", "Archon");
- sourceLoader.load("img", Game.CDN + "img/Charas/DarkArchon.png", "DarkArchon");
- sourceLoader.load("img", Game.CDN + "img/Charas/Shuttle.png", "Shuttle");
- sourceLoader.load("img", Game.CDN + "img/Charas/Observer.png", "Observer");
- sourceLoader.load("img", Game.CDN + "img/Charas/Arbiter.png", "Arbiter");
- sourceLoader.load("img", Game.CDN + "img/Charas/Scout.png", "Scout");
- sourceLoader.load("img", Game.CDN + "img/Charas/Carrier.png", "Carrier");
- sourceLoader.load("img", Game.CDN + "img/Charas/Corsair.png", "Corsair");
- //Neuture
- sourceLoader.load("img", Game.CDN + "img/Charas/Ragnasaur.png", "Ragnasaur");
- sourceLoader.load("img", Game.CDN + "img/Charas/Rhynsdon.png", "Rhynsdon");
- sourceLoader.load("img", Game.CDN + "img/Charas/Ursadon.png", "Ursadon");
- sourceLoader.load("img", Game.CDN + "img/Charas/Bengalaas.png", "Bengalaas");
- sourceLoader.load("img", Game.CDN + "img/Charas/Scantid.png", "Scantid");
- sourceLoader.load("img", Game.CDN + "img/Charas/Kakaru.png", "Kakaru");
- //Hero
- sourceLoader.load("img", Game.CDN + "img/Charas/HeroCruiser.png", "HeroCruiser");
- sourceLoader.load("img", Game.CDN + "img/Charas/Sarah.png", "Sarah");
- sourceLoader.load("img", Game.CDN + "img/Charas/Kerrigan.png", "Kerrigan");
- sourceLoader.load("img", Game.CDN + "img/Charas/DevilHunter.png", "DevilHunter");
- sourceLoader.load("img", Game.CDN + "img/Charas/Tassadar.png", "Tassadar");
- //Building
- sourceLoader.load("img", Game.CDN + "img/Charas/ZergBuilding.png", "ZergBuilding");
- sourceLoader.load("img", Game.CDN + "img/Charas/TerranBuilding.png", "TerranBuilding");
- sourceLoader.load("img", Game.CDN + "img/Charas/ProtossBuilding.png", "ProtossBuilding");
- /*sourceLoader.load("audio","bgm/PointError.wav","PointError");*/
- //Map
- sourceLoader.load("img", Game.CDN + "img/Maps/(2)Switchback.jpg", "Map_Switchback");
- sourceLoader.load("img", Game.CDN + "img/Maps/(2)Volcanis.jpg", "Map_Volcanis");
- sourceLoader.load("img", Game.CDN + "img/Maps/(3)Trench wars.jpg", "Map_TrenchWars");
- sourceLoader.load("img", Game.CDN + "img/Maps/(4)Blood Bath.jpg", "Map_BloodBath");
- sourceLoader.load("img", Game.CDN + "img/Maps/(4)Orbital Relay.jpg", "Map_OrbitalRelay");
- sourceLoader.load("img", Game.CDN + "img/Maps/(4)TowerDefense.jpg", "Map_TowerDefense");
- sourceLoader.load("img", Game.CDN + "img/Maps/(6)Thin Ice.jpg", "Map_ThinIce");
- sourceLoader.load("img", Game.CDN + "img/Maps/(8)BigGameHunters.jpg", "Map_BigGameHunters");
- sourceLoader.load("img", Game.CDN + "img/Maps/(8)TheHunters.jpg", "Map_TheHunters");
- sourceLoader.load("img", Game.CDN + "img/Maps/(8)Turbo.jpg", "Map_Turbo");
- sourceLoader.load("img", Game.CDN + "img/Maps/Map_Grass.jpg", "Map_Grass");
- sourceLoader.load("img", Game.CDN + "img/Charas/Mud.png", "Mud");
- //Extra
- sourceLoader.load("img", Game.CDN + "img/Charas/Burst.png", "Burst");
- sourceLoader.load("img", Game.CDN + "img/Charas/BuildingBurst.png", "BuildingBurst");
- sourceLoader.load("img", Game.CDN + "img/Charas/Portrait.png", "Portrait");
- sourceLoader.load("img", Game.CDN + "img/Charas/Magic.png", "Magic");
- sourceLoader.load("img", Game.CDN + "img/Menu/ControlPanel.png", "ControlPanel");
- sourceLoader.load("img", Game.CDN + "img/Bg/GameStart.jpg", "GameStart");
- sourceLoader.load("img", Game.CDN + "img/Bg/GameWin.jpg", "GameWin");
- sourceLoader.load("img", Game.CDN + "img/Bg/GameLose.jpg", "GameLose");
- sourceLoader.allOnLoad(function () {
- $('#GameStart').prepend(sourceLoader.sources['GameStart']);
- $('#GameWin').prepend(sourceLoader.sources['GameWin']);
- $('#GameLose').prepend(sourceLoader.sources['GameLose']);
- $('#GamePlay>canvas').attr('width', Game.HBOUND); //Canvas width adjust
- $('#GamePlay>canvas').attr('height', Game.VBOUND - Game.infoBox.height + 5); //Canvas height adjust
- for (var N = 1; N <= 9; N++) {
- $('div.panel_Control').append("");
- }
- /*//Test image effect
- AlloyImage(sourceLoader.sources['Wraith']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['Wraith']);
- AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
- Game.start();
- });
-}
-start: function () {
- //Game start
- Game.layerSwitchTo("GameStart");
- //Init level selector
- for (var level = 1; level <= Levels.length; level++) {
- $('.levelSelectionBg').append("" +
- "" +
- (Levels[level - 1].label ? (Levels[level - 1].label) : ("Level " + level))
- + "
");
- }
- //Wait for user select level and play game
- $('input[name="levelSelect"]').click(function () {
- //Prevent vibration
- if (Game.level != null)
- return;
- Game.level = parseInt(this.value);
- Game.play();
- });
-}
-play: function () {
- //Load level to initial when no error occurs
- if (!(Levels[Game.level - 1].load())) {
- //Need Game.playerNum before expansion
- Game.expandUnitProps();
- Resource.init();
- //Game background
- Game.layerSwitchTo("GamePlay");
- Game.resizeWindow();
- //Collect login user info
- if (Game.hackMode)
- Multiplayer.sendUserInfo();
- //Bind controller
- mouseController.toControlAll(); //Can control all units
- keyController.start(); //Start monitor
- Game.pauseWhenHide(); //Hew H5 feature:Page Visibility
- Game.initIndexDB(); //Hew H5 feature:Indexed DB
- Game.animation();
- }
-}
-getPropArray: function (prop) {
- var result = [];
- for (var N = 0; N < Game.playerNum; N++) {
- result.push(typeof (prop) == 'object' ? (_$.clone(prop)) : prop);
- }
- return result;
-}
-//Do we need this because we only support Zerg vs Terran vs Protoss?
-expandUnitProps: function () {
- //Post-operation for all unit types, prepare basic properties for different team numbers, init in level.js
- _$.traverse([Zerg, Terran, Protoss, Neutral, Hero], function (unitType) {
- ['HP', 'SP', 'MP', 'damage', 'armor', 'speed', 'attackRange', 'attackInterval', 'plasma', 'sight'].forEach(function (prop) {
- //Prop array, first one for us, second for enemy
- if (unitType.prototype[prop] != undefined) {
- unitType.prototype[prop] = Game.getPropArray(unitType.prototype[prop]);
- }
- });
- if (unitType.prototype.isInvisible) {
- for (var N = 0; N < Game.playerNum; N++) {
- unitType.prototype['isInvisible' + N] = unitType.prototype.isInvisible;
- }
- }
- delete unitType.prototype.isInvisible; //No need anymore
- if (unitType.prototype.attackMode) {
- ['damage', 'attackRange', 'attackInterval'].forEach(function (prop) {
- //Prop array, first one for us, second for enemy
- unitType.prototype.attackMode.flying[prop] = Game.getPropArray(unitType.prototype.attackMode.flying[prop]);
- unitType.prototype.attackMode.ground[prop] = Game.getPropArray(unitType.prototype.attackMode.ground[prop]);
- });
- }
- unitType.upgrade = function (prop, value, team) {
- switch (team) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- eval('unitType.prototype.' + prop)[team] = value;
- break;
- default:
- unitType.prototype[prop] = value;
- break;
- }
- };
- });
- Protoss.Carrier.prototype.interceptorCapacity = Game.getPropArray(Protoss.Carrier.prototype.interceptorCapacity);
- Protoss.Reaver.prototype.scarabCapacity = Game.getPropArray(Protoss.Reaver.prototype.scarabCapacity);
- Referee.underArbiterUnits = Game.getPropArray([]);
- Referee.detectedUnits = Game.getPropArray([]);
- for (var N = 0; N < Game.playerNum; N++) {
- //Initial detector buffer
- var buffer = {};
- buffer['isInvisible' + N] = false;
- Gobj.detectorBuffer.push(buffer);
- //Initial arbiter buffer
- Protoss.Arbiter.prototype.bufferObj['isInvisible' + N] = true;
- }
- for (var grade in Upgrade) {
- if (Upgrade[grade].level != null) {
- Upgrade[grade].level = Game.getPropArray(Upgrade[grade].level);
- }
- }
-}
-addSelectedIntoTeam: function (teamNum) {
- //Build a new team
- Game.teams[teamNum] = _$.mixin([], Game.allSelected);
-}
-callTeam: function (teamNum) {
- var team = _$.mixin([], Game.teams[teamNum]);
- //When team already exist
- if (team instanceof Array) {
- Game.unselectAll();
- //GC
- $.extend([], team).forEach(function (chara) {
- if (chara.status == 'dead')
- team.splice(team.indexOf(chara), 1);
- });
- Game.addIntoAllSelected(team, true);
- if (team[0] instanceof Gobj) {
- Game.changeSelectedTo(team[0]);
- //Sound effect
- team[0].sound.selected.play();
- //Relocate map center
- Map.relocateAt(team[0].posX(), team[0].posY());
- }
- }
-}
-unselectAll: function () {
- //Unselect all
- var units = Unit.allUnits.concat(Building.allBuildings);
- units.forEach(function (chara) { chara.selected = false; });
- Game.addIntoAllSelected([], true);
-}
-multiSelectInRect: function () {
- Game.unselectAll();
- //Multi select in rect
- var startPoint = { x: Map.offsetX + Math.min(mouseController.startPoint.x, mouseController.endPoint.x),
- y: Map.offsetY + Math.min(mouseController.startPoint.y, mouseController.endPoint.y) };
- var endPoint = { x: Map.offsetX + Math.max(mouseController.startPoint.x, mouseController.endPoint.x),
- y: Map.offsetY + Math.max(mouseController.startPoint.y, mouseController.endPoint.y) };
- var inRectUnits = Unit.allOurUnits().filter(function (chara) {
- return chara.insideRect({ start: (startPoint), end: (endPoint) });
- });
- if (inRectUnits.length > 0)
- Game.changeSelectedTo(inRectUnits[0]);
- else
- Game.changeSelectedTo({});
- Game.addIntoAllSelected(inRectUnits, true);
-}
-getSelectedOne: function (clickX, clickY, isEnemyFilter, unitBuildingFilter, isFlyingFilter, customFilter) {
- var distance = function (chara) {
- return (clickX - chara.posX()) * (clickX - chara.posX()) + (clickY - chara.posY()) * (clickY - chara.posY()); //Math.pow2
- };
- //Initial
- var selectedOne = {}, charas = [];
- switch (unitBuildingFilter) {
- case true:
- charas = Unit.allUnits;
- break;
- case false:
- charas = Building.allBuildings;
- break;
- default:
- charas = Unit.allUnits.concat(Building.allBuildings);
- }
- switch (isEnemyFilter) {
- case true:
- case false:
- charas = charas.filter(function (chara) {
- return chara.isEnemy() == isEnemyFilter;
- });
- break;
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- charas = charas.filter(function (chara) {
- return chara.team == isEnemyFilter;
- });
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- charas = charas.filter(function (chara) {
- return chara.team != isEnemyFilter;
- });
- }
- if (isFlyingFilter != null) {
- charas = charas.filter(function (chara) {
- return chara.isFlying == isFlyingFilter;
- });
- }
- //customFilter is filter function
- if (customFilter != null) {
- charas = charas.filter(customFilter);
- }
- //Find nearest one
- selectedOne = charas.filter(function (chara) {
- return chara.status != 'dead' && chara.includePoint(clickX, clickY);
- }).sort(function (chara1, chara2) {
- return distance(chara1) - distance(chara2);
- })[0];
- if (!selectedOne)
- selectedOne = {};
- return selectedOne;
-}
-getInRangeOnes: function (clickX, clickY, range, isEnemyFilter, unitBuildingFilter, isFlyingFilter, customFilter) {
- //Initial
- var selectedOnes = [], charas = [];
- switch (unitBuildingFilter) {
- case true:
- charas = Unit.allUnits;
- break;
- case false:
- charas = Building.allBuildings;
- break;
- default:
- charas = Unit.allUnits.concat(Building.allBuildings);
- }
- switch (isEnemyFilter) {
- case true:
- case false:
- charas = charas.filter(function (chara) {
- return chara.isEnemy() == isEnemyFilter;
- });
- break;
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- charas = charas.filter(function (chara) {
- return chara.team == isEnemyFilter;
- });
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- charas = charas.filter(function (chara) {
- return chara.team != isEnemyFilter;
- });
- }
- if (isFlyingFilter != null) {
- charas = charas.filter(function (chara) {
- return chara.isFlying == isFlyingFilter;
- });
- }
- //customFilter is filter function
- if (customFilter != null) {
- charas = charas.filter(customFilter);
- }
- //Find in range ones
- selectedOnes = charas.filter(function (chara) {
- return chara.status != 'dead' && chara.insideSquare({ centerX: clickX, centerY: clickY, radius: range });
- });
- return selectedOnes;
-}
-//For test use
-getSelected: function () {
- return Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
- return chara.selected;
- });
-}
-showInfoFor: function (chara) {
- //Show selected living unit info
- if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status != "dead") {
- //Display info
- $('div.panel_Info>div[class*="info"]').show();
- //Draw selected unit portrait
- if (chara.portrait)
- $('div.infoLeft div[name="portrait"]')[0].className = chara.portrait; //Override portrait
- else {
- if (Game.selectedUnit instanceof Unit)
- $('div.infoLeft div[name="portrait"]')[0].className = Game.selectedUnit.name;
- if (Game.selectedUnit instanceof Building)
- $('div.infoLeft div[name="portrait"]')[0].className =
- Game.selectedUnit.attack ? Game.selectedUnit.inherited.inherited.name : Game.selectedUnit.inherited.name;
- }
- //Show selected unit HP,SP and MP
- $('div.infoLeft span._Health')[0].style.color = Game.selectedUnit.lifeStatus();
- $('div.infoLeft span.life')[0].innerHTML = Game.selectedUnit.life >> 0;
- $('div.infoLeft span.HP')[0].innerHTML = Game.selectedUnit.get('HP');
- if (Game.selectedUnit.SP) {
- $('div.infoLeft span.shield')[0].innerHTML = Game.selectedUnit.shield >> 0;
- $('div.infoLeft span.SP')[0].innerHTML = Game.selectedUnit.get('SP');
- $('div.infoLeft span._Shield').show();
- }
- else {
- $('div.infoLeft span._Shield').hide();
- }
- if (Game.selectedUnit.MP) {
- $('div.infoLeft span.magic')[0].innerHTML = Game.selectedUnit.magic >> 0;
- $('div.infoLeft span.MP')[0].innerHTML = Game.selectedUnit.get('MP');
- $('div.infoLeft span._Magic').show();
- }
- else {
- $('div.infoLeft span._Magic').hide();
- }
- //Draw selected unit name,kill,damage,armor and shield
- $('div.infoCenter h3.name')[0].innerHTML = Game.selectedUnit.name;
- if (Game.selectedUnit.detector) {
- $('div.infoCenter p.detector').show();
- }
- else {
- $('div.infoCenter p.detector').hide();
- }
- if (Game.selectedUnit.attack) {
- $('div.infoCenter p.kill span')[0].innerHTML = Game.selectedUnit.kill;
- if (Game.selectedUnit.attackMode) {
- $('div.infoCenter p.damage span')[0].innerHTML = (Game.selectedUnit.get('attackMode.ground.damage') + '/' + Game.selectedUnit.get('attackMode.flying.damage'));
- }
- else {
- $('div.infoCenter p.damage span')[0].innerHTML = (Game.selectedUnit.get('damage') + (Game.selectedUnit.suicide ? ' (1)' : ''));
- }
- //Show kill and damage
- $('div.infoCenter p.kill').show();
- $('div.infoCenter p.damage').show();
- }
- else {
- //Hide kill and damage
- $('div.infoCenter p.kill').hide();
- $('div.infoCenter p.damage').hide();
- }
- $('div.infoCenter p.armor span')[0].innerHTML = Game.selectedUnit.get('armor');
- if (Game.selectedUnit.get('plasma') != undefined) {
- $('div.infoCenter p.plasma span')[0].innerHTML = Game.selectedUnit.get('plasma');
- $('div.infoCenter p.plasma').show();
- }
- else {
- $('div.infoCenter p.plasma').hide();
- }
- //Can disable this filter for testing
- if (Game.selectedUnit.loadedUnits && Game.selectedUnit.team == Game.team) {
- $('div.infoCenter p.passenger span')[0].innerHTML = Game.selectedUnit.loadedUnits.length;
- $('div.infoCenter p.passenger').show();
- //Clear old icons
- $('div.infoCenter p.icons')[0].innerHTML = '';
- //Show passenger icons
- Game.selectedUnit.loadedUnits.forEach(function (passenger) {
- $('div.infoCenter p.icons').append($('')
- .attr('class', passenger.name).css('border-color', passenger.lifeStatus()));
- });
- $('div.infoCenter p.icons').show();
- }
- else {
- $('div.infoCenter p.passenger').hide();
- $('div.infoCenter p.icons').hide();
- }
- //Draw upgraded
- var upgraded = Game.selectedUnit.upgrade;
- var team = Game.selectedUnit.team;
- if (upgraded) {
- for (var N = 0; N < 3; N++) {
- var upgradeIcon = $('div.upgraded div[name="icon"]')[N];
- upgradeIcon.innerHTML = '';
- upgradeIcon.style.display = 'none';
- if (N < upgraded.length) {
- upgradeIcon.className = upgradeIcon.title = upgraded[N];
- upgradeIcon.innerHTML = Upgrade[upgraded[N]].level[team];
- if (Upgrade[upgraded[N]].level[team]) {
- upgradeIcon.setAttribute('disabled', 'false');
- upgradeIcon.style.color = 'aqua';
- }
- else {
- upgradeIcon.setAttribute('disabled', 'true');
- upgradeIcon.style.color = 'red';
- }
- upgradeIcon.style.display = 'inline-block';
- }
- }
- $('div.upgraded').show();
- }
- else {
- //$('div.upgraded div[name="icon"]').html('').removeAttr('title').hide();
- $('div.upgraded').hide();
- }
- }
- else {
- //Hide info
- $('div.panel_Info>div').hide();
- }
-}
-refreshInfo: function () {
- Game.showInfoFor(Game.selectedUnit);
-}
-changeSelectedTo: function (chara) {
- Game.selectedUnit = chara;
- Button.equipButtonsFor(chara);
- if (chara instanceof Gobj) {
- chara.selected = true;
- }
- Game.showInfoFor(chara);
-}
-draw: function (chara) {
- //Can draw units and no-rotate bullets
- if (!(chara instanceof Gobj))
- return; //Will only show Gobj
- if (chara.status == "dead")
- return; //Will not show dead
- //Won't draw units outside screen
- if (!chara.insideScreen())
- return;
- //Choose context
- var cxt = ((chara instanceof Unit) || (chara instanceof Building)) ? Game.cxt : Game.frontCxt;
- //Draw shadow
- cxt.save();
- //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
- cxt.shadowOffsetX = (chara.isFlying) ? 5 : 3;
- cxt.shadowOffsetY = (chara.isFlying) ? 20 : 8;
- cxt.shadowColor = "rgba(0,0,0,0.4)";
- //Close shadow for burrowed
- if (chara.buffer.Burrow)
- cxt.shadowOffsetX = cxt.shadowOffsetY = 0;
- //Draw invisible
- if (chara['isInvisible' + Game.team] != null) {
- cxt.globalAlpha = (chara.isEnemy() && chara['isInvisible' + Game.team]) ? 0 : 0.5;
- if (chara.burrowBuffer) {
- if (chara.isEnemy()) {
- if (!chara['isInvisible' + Game.team])
- cxt.globalAlpha = 1;
- }
- else
- cxt.globalAlpha = 1;
- }
- }
- //Draw unit or building
- var imgSrc;
- if (chara instanceof Building) {
- if (chara.source)
- imgSrc = sourceLoader.sources[chara.source];
- else {
- imgSrc = sourceLoader.sources[chara.attack ? chara.inherited.inherited.name : chara.inherited.name];
- }
- }
- else
- imgSrc = sourceLoader.sources[chara.source ? chara.source : chara.name];
- //Convert position
- var charaX = (chara.x - Map.offsetX) >> 0;
- var charaY = (chara.y - Map.offsetY) >> 0;
- //Same image in different directions
- if (chara.direction == undefined) {
- var _left = chara.imgPos[chara.status].left;
- var _top = chara.imgPos[chara.status].top;
- //Multiple actions status
- if (_left instanceof Array || _top instanceof Array) {
- cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width, chara.height);
- }
- else {
- cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width, chara.height);
- }
- }
- else {
- var _left = chara.imgPos[chara.status].left[chara.direction];
- var _top = chara.imgPos[chara.status].top[chara.direction];
- //Multiple actions status
- if (_left instanceof Array || _top instanceof Array) {
- cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width, chara.height);
- }
- else {
- cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width, chara.height);
- }
- }
- //Remove shadow
- cxt.restore();
- //Draw HP if has selected and is true
- if (chara.selected == true) {
- cxt = Game.frontCxt;
- //Draw selected circle
- cxt.strokeStyle = (chara.isEnemy()) ? "red" : "green"; //Distinguish enemy
- cxt.lineWidth = 2; //Cannot see 1px width circle clearly
- cxt.beginPath();
- cxt.arc(chara.posX() - Map.offsetX, chara.posY() - Map.offsetY, chara.radius(), 0, 2 * Math.PI);
- cxt.stroke();
- //Draw HP bar and SP bar and magic bar
- cxt.globalAlpha = 1;
- cxt.lineWidth = 1;
- var offsetY = -6 - (chara.MP ? 5 : 0) - (chara.SP ? 5 : 0);
- var lifeRatio = chara.life / chara.get('HP');
- cxt.strokeStyle = "black";
- if (chara.SP) {
- //Draw HP and SP
- cxt.fillStyle = "blue";
- cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width * chara.shield / chara.get('SP'), 5);
- cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width, 5);
- cxt.fillStyle = (lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"; //Distinguish life
- cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + 5, chara.width * lifeRatio, 5);
- cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + 5, chara.width, 5);
- }
- else {
- //Only draw HP
- cxt.fillStyle = (lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"; //Distinguish life
- cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width * lifeRatio, 5);
- cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width, 5);
- }
- if (chara.MP) {
- //Draw MP
- cxt.fillStyle = "darkviolet";
- cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + (chara.SP ? 10 : 5), chara.width * chara.magic / chara.get('MP'), 5);
- cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + (chara.SP ? 10 : 5), chara.width, 5);
- }
- }
-}
-drawEffect: function (chara) {
- //Can draw units and no-rotate bullets
- if (!(chara instanceof Burst))
- return; //Will only show Burst
- if (chara.status == "dead")
- return; //Will not show dead
- //Won't draw units outside screen
- if (!chara.insideScreen())
- return;
- //Choose context
- var cxt = Game.frontCxt;
- //Draw shadow
- cxt.save();
- //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
- cxt.shadowOffsetX = (chara.isFlying) ? 5 : 3;
- cxt.shadowOffsetY = (chara.isFlying) ? 20 : 8;
- cxt.shadowColor = "rgba(0,0,0,0.4)";
- var imgSrc = sourceLoader.sources[chara.name];
- //Convert position
- var charaX = (chara.x - Map.offsetX) >> 0;
- var charaY = (chara.y - Map.offsetY) >> 0;
- var _left = chara.imgPos[chara.status].left;
- var _top = chara.imgPos[chara.status].top;
- //Will stretch effect if scale
- var times = chara.scale ? chara.scale : 1;
- //Multiple actions status
- if (_left instanceof Array || _top instanceof Array) {
- cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width * times >> 0, chara.height * times >> 0);
- }
- else {
- cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width * times >> 0, chara.height * times >> 0);
- }
- //Remove shadow
- cxt.restore();
-}
-drawBullet: function (chara) {
- //Can draw bullets need rotate
- if (!(chara instanceof Bullets))
- return; //Will only show bullet
- if (chara.status == "dead")
- return; //Will not show dead
- //Won't draw bullets outside screen
- if (!chara.insideScreen())
- return;
- //Draw unit
- var imgSrc = sourceLoader.sources[chara.name];
- var _left = chara.imgPos[chara.status].left;
- var _top = chara.imgPos[chara.status].top;
- //Convert position
- var centerX = (chara.posX() - Map.offsetX) >> 0;
- var centerY = (chara.posY() - Map.offsetY) >> 0;
- //Rotate canvas
- Game.frontCxt.save();
- //Rotate to draw bullet
- Game.frontCxt.translate(centerX, centerY);
- Game.frontCxt.rotate(-chara.angle);
- //Draw shadow
- //Game.frontCxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
- Game.frontCxt.shadowOffsetX = (chara.owner.isFlying) ? 5 : 3;
- Game.frontCxt.shadowOffsetY = (chara.owner.isFlying) ? 20 : 5;
- Game.frontCxt.shadowColor = "rgba(0,0,0,0.4)";
- //Game.frontCxt.shadowColor="rgba(255,0,0,1)";
- //Multiple actions status
- if (_left instanceof Array || _top instanceof Array) {
- Game.frontCxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, -chara.width / 2 >> 0, -chara.height / 2 >> 0, chara.width, chara.height);
- }
- else {
- Game.frontCxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, -chara.width / 2 >> 0, -chara.height / 2 >> 0, chara.width, chara.height);
- }
- //Rotate canvas back and remove shadow
- Game.frontCxt.restore();
- //Below 2 separated steps might cause mess
- //Game.frontCxt.translate(-centerX,-centerY);
- //Game.frontCxt.rotate(chara.angle);
-}
-drawInfoBox: function () {
- //Update selected unit active info which need refresh
- if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status != "dead") {
- //Update selected unit life,shield and magic
- var lifeRatio = Game.selectedUnit.life / Game.selectedUnit.get('HP');
- $('div.infoLeft span._Health')[0].style.color = ((lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red");
- $('div.infoLeft span.life')[0].innerHTML = Game.selectedUnit.life >> 0;
- if (Game.selectedUnit.SP) {
- $('div.infoLeft span.shield')[0].innerHTML = Game.selectedUnit.shield >> 0;
- }
- if (Game.selectedUnit.MP) {
- $('div.infoLeft span.magic')[0].innerHTML = Game.selectedUnit.magic >> 0;
- }
- //Update selected unit kill
- if (Game.selectedUnit.kill != null) {
- $('div.infoCenter p.kill span')[0].innerHTML = Game.selectedUnit.kill;
- }
- }
-}
-drawSourceBox: function () {
- //Update min, gas, curMan and totalMan
- $('div.resource_Box span.mineNum')[0].innerHTML = Resource[Game.team].mine;
- $('div.resource_Box span.gasNum')[0].innerHTML = Resource[Game.team].gas;
- $('div.resource_Box span.manNum>span')[0].innerHTML = Resource[Game.team].curMan;
- $('div.resource_Box span.manNum>span')[1].innerHTML = Resource[Game.team].totalMan;
- //Check if man overflow
- $('div.resource_Box span.manNum')[0].style.color = (Resource[Game.team].curMan > Resource[Game.team].totalMan) ? "red" : "#00ff00";
-}
-drawProcessingBox: function () {
- //Show processing box if it's processing
- var processing = Game.selectedUnit.processing;
- //Can disable this filter for testing
- if (processing && Game.selectedUnit.team == Game.team) {
- $('div.upgrading div[name="icon"]')[0].className = processing.name;
- //var percent=((new Date().getTime()-processing.startTime)/(processing.time)+0.5)>>0;
- var percent = ((Game.mainTick - processing.startTime) * 100 / (processing.time) + 0.5) >> 0;
- $('div.upgrading div[name="processing"] span')[0].innerHTML = percent;
- $('div.upgrading div[name="processing"] div.processedBar')[0].style.width = percent + '%';
- $('div.upgrading').attr('title', processing.name).show();
- }
- else {
- //Select nothing, show replay progress
- if (Game.replayFlag && Game.endTick > 0) {
- $('div.upgrading div[name="icon"]')[0].className = 'Replay';
- var percent = (Game.mainTick * 100 / (Game.endTick) + 0.5) >> 0;
- $('div.upgrading div[name="processing"] span')[0].innerHTML = percent;
- $('div.upgrading div[name="processing"] div.processedBar')[0].style.width = percent + '%';
- $('div.upgrading').attr('title', 'Replay Progress').show();
- if (!(Game.selectedUnit instanceof Gobj)) {
- $('div.infoRight').show();
- $('div.upgraded').hide();
- }
- }
- else
- $('div.upgrading').removeAttr('title').hide();
- }
-}
-refreshMultiSelectBox: function () {
- var divs = $('div.override div.multiSelection div');
- //Only refresh border color on current multiSelect box
- for (var n = 0; n < divs.length; n++) {
- divs[n].style.borderColor = Game.allSelected[n].lifeStatus();
- }
-}
-drawMultiSelectBox: function () {
- //Clear old icons
- $('div.override div.multiSelection')[0].innerHTML = '';
- //Redraw all icons
- Game.allSelected.forEach(function (chara, N) {
- var node = document.createElement('div');
- node.setAttribute('name', 'portrait');
- //Override portrait
- if (chara.portrait)
- node.className = chara.portrait;
- else
- node.className = (chara instanceof Building) ? (chara.attack ? chara.inherited.inherited.name : chara.inherited.name) : chara.name;
- node.title = chara.name;
- node.style.borderColor = chara.lifeStatus();
- node.onclick = function () {
- //Selection execute
- Game.unselectAll();
- Game.changeSelectedTo(chara);
- //Single selection mode
- $('div.override').hide();
- $('div.override div.multiSelection').hide();
- };
- $('div.override div.multiSelection')[0].appendChild(node);
- });
- var iconNum = $('div.override div.multiSelection div').length;
- //Adjust width if unit icon space overflow
- $('div.override div.multiSelection').css('width', (iconNum > 12 ? Math.ceil(iconNum / 2) * 55 : 330) + 'px');
- //Adjust background position after added into DOM, nth starts from 1st(no 0th)
- for (var n = 1; n <= iconNum; n++) {
- var bgPosition = $('div.override div.multiSelection div:nth-child(' + n + ')').css('background-position');
- bgPosition = bgPosition.split(' ').map(function (pos) {
- return parseInt(pos) * 0.75 + 'px';
- }).join(' ');
- $('div.override div.multiSelection div:nth-child(' + n + ')').css('background-position', bgPosition);
- }
-}
-animation: function () {
- Game.animation.loop = function () {
- //Process due commands for current frame before drawing
- var commands = Game.commands[Game.mainTick];
- if (commands instanceof Array) {
- for (var N = 0; N < commands.length; N++) {
- commands[N]();
- }
- delete Game.commands[Game.mainTick];
- }
- /************ Draw part *************/
- //Clear all canvas
- Game.cxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
- Game.frontCxt.clearRect(0, 0, Game.HBOUND, Game.VBOUND);
- //DrawLayer0: Refresh map if needed
- if (mouseController.mouseX < Map.triggerMargin)
- Map.needRefresh = "LEFT";
- if (mouseController.mouseX > (Game.HBOUND - Map.triggerMargin))
- Map.needRefresh = "RIGHT";
- if (mouseController.mouseY < Map.triggerMargin)
- Map.needRefresh = "TOP";
- if (mouseController.mouseY > (Game.VBOUND - Map.triggerMargin))
- Map.needRefresh = "BOTTOM";
- if (Map.needRefresh) {
- Map.refresh(Map.needRefresh);
- Map.needRefresh = false;
- }
- //DrawLayer1: Show all buildings
- for (var N = 0; N < Building.allBuildings.length; N++) {
- var build = Building.allBuildings[N];
- //GC
- if (build.status == "dead") {
- Building.allBuildings.splice(N, 1);
- N--; //Next unit come to this position
- continue;
- }
- //Draw
- Game.draw(build);
- }
- //DrawLayer2: Show all existed units
- for (var N = 0; N < Unit.allUnits.length; N++) {
- var chara = Unit.allUnits[N];
- //GC
- if (chara.status == "dead") {
- Unit.allUnits.splice(N, 1);
- N--;
- continue;
- }
- //Draw
- Game.draw(chara);
- }
- //DrawLayer3: Draw all bullets
- for (var N = 0; N < Bullets.allBullets.length; N++) {
- var bullet = Bullets.allBullets[N];
- //GC
- if (bullet.status == "dead" && bullet.used) {
- Bullets.allBullets.splice(N, 1);
- N--;
- continue;
- }
- Game.drawBullet(bullet);
- }
- //DrawLayer4: Draw effects above units
- for (var N = 0; N < Burst.allEffects.length; N++) {
- var effect = Burst.allEffects[N];
- //GC
- if (effect.status == "dead" || (effect.target && effect.target.status == "dead")) {
- Burst.allEffects.splice(N, 1);
- N--;
- continue;
- }
- Game.drawEffect(effect);
- }
- //DrawLayer5: Draw drag rect
- if (mouseController.drag) {
- Game.cxt.lineWidth = 3;
- Game.cxt.strokeStyle = "green";
- Game.cxt.strokeRect(mouseController.startPoint.x, mouseController.startPoint.y, mouseController.endPoint.x - mouseController.startPoint.x, mouseController.endPoint.y - mouseController.startPoint.y);
- }
- //DrawLayerBottom: Draw info box and resource box
- Game.drawInfoBox();
- Game.drawSourceBox();
- Game.drawProcessingBox();
- /************ Calculate for next frame *************/
- //Clock ticking
- Game.mainTick++;
- //For network mode
- if (Multiplayer.ON) {
- //Send current tick to server
- Multiplayer.webSocket.send(JSON.stringify({
- type: 'tick',
- tick: Game.mainTick,
- cmds: (Multiplayer.cmds.length ? Multiplayer.cmds : null)
- }));
- }
- else {
- //Record user moves and execute if have
- if (Multiplayer.cmds.length > 0) {
- //MainTick++ just before this code piece
- Game.replay[Game.mainTick] = $.extend([], Multiplayer.cmds);
- //Execute command
- Multiplayer.parseTickCmd({
- tick: Game.mainTick,
- cmds: Multiplayer.cmds
- });
- }
- }
- //Clear commands
- if (Multiplayer.cmds.length > 0) {
- Multiplayer.cmds = [];
- }
- //Postpone play frames and AI after drawing (consume time)
- Building.allBuildings.concat(Unit.allUnits).concat(Bullets.allBullets).concat(Burst.allEffects).forEach(function (chara) {
- //Add this makes chara intelligent for attack
- if (chara.AI)
- chara.AI();
- //Judge reach destination
- if (chara instanceof Unit)
- Referee.judgeReachDestination(chara);
- //Join timers together
- chara.playFrames();
- });
- //Will invite Mr.Referee to make some judgments
- Referee.tasks.forEach(function (task) {
- Referee[task]();
- });
- //Release selected unit when unit died or is invisible enemy
- if (Game.selectedUnit instanceof Gobj) {
- if (Game.selectedUnit.status == "dead" || (Game.selectedUnit['isInvisible' + Game.team] && Game.selectedUnit.isEnemy())) {
- Game.selectedUnit.selected = false;
- Game.changeSelectedTo({});
- }
- }
- };
- if (Multiplayer.ON) {
- Game._timer = setInterval(function () {
- if (Game.mainTick < Game.serverTick)
- Game.animation.loop();
- }, Game._frameInterval);
- }
- else
- Game.startAnimation();
-}
-stopAnimation: function () {
- if (Game._timer != -1)
- clearInterval(Game._timer);
- Game._timer = -1;
-}
-startAnimation: function () {
- if (Game._timer == -1)
- Game._timer = setInterval(Game.animation.loop, Game._frameInterval);
-}
-stop: function (charas) {
- charas.forEach(function (chara) {
- chara.stop();
- });
- Game.stopAnimation();
-}
-win: function () {
- if (Multiplayer.ON) {
- Multiplayer.webSocket.send(JSON.stringify({
- type: 'getReplay'
- }));
- }
- else {
- Game.saveReplay();
- Game.saveReplayIntoDB();
- }
- $('div#GamePlay').fadeOut(3000, function () {
- Game.stop(Unit.allUnits);
- //Win poster
- Game.layerSwitchTo("GameWin");
- new Audio(Game.CDN + 'bgm/GameWin.wav').play();
- });
- //Self destruction to prevent duplicate fadeout
- Game.win = function () { };
-}
-lose: function () {
- if (Multiplayer.ON) {
- Multiplayer.webSocket.send(JSON.stringify({
- type: 'getReplay'
- }));
- }
- else {
- Game.saveReplay();
- Game.saveReplayIntoDB();
- }
- $('div#GamePlay').fadeOut(3000, function () {
- Game.stop(Unit.allUnits);
- //Lose poster
- Game.layerSwitchTo("GameLose");
- new Audio(Game.CDN + 'bgm/GameLose.wav').play();
- });
- //Self destruction to prevent duplicate fadeout
- Game.lose = function () { };
-}
-saveReplay: function (replayData) {
- if (!Game.replayFlag) {
- localStorage.setItem('lastReplay', JSON.stringify({
- level: Game.level,
- team: Game.team,
- //Save Game.replay by default
- cmds: (replayData != null) ? replayData : (Game.replay),
- end: Game.mainTick
- }));
- }
-}
-showWarning: function (msg, interval) {
- //Default interval
- if (!interval)
- interval = 3000;
- //Show message for a period
- $('div.warning_Box').html(msg).show();
- //Hide message after a period
- setTimeout(function () {
- $('div.warning_Box').html('').hide();
- }, interval);
-}
-showMessage: function () {
- //Clossure timer
- var _timer = 0;
- return function (msg, interval) {
- //Default interval
- if (!interval)
- interval = 3000;
- //Show message for a period
- $('div.message_Box').append('' + msg + '
').show();
- //Can show multiple lines together
- if (_timer)
- clearTimeout(_timer);
- //Hide message after a period
- _timer = setTimeout(function () {
- $('div.message_Box').html('').hide();
- }, interval);
- };
-}
-(),
- //Return from 0 to 0.99
- getNextRandom;
-(function () {
- //Clossure variable and function
- var rands = [];
- var getRands = function () {
- //Use current tick as seed
- var seed = Game.mainTick + Game.randomSeed;
- var rands = [];
- for (var N = 0; N < 100; N++) {
- //Seed grows up in range 100
- seed = (seed * 21 + 3) % 100;
- rands.push(seed);
- }
- return rands;
- };
- return function () {
- //If all rands used, generate new ones
- if (rands.length == 0)
- rands = getRands();
- return rands.shift() / 100;
- };
-})(),
- resizeWindow;
-function () {
- //Update parameters
- Game.HBOUND = innerWidth; //$('body')[0].scrollWidth
- Game.VBOUND = innerHeight; //$('body')[0].scrollHeight
- Game.infoBox.width = Game.HBOUND - 295;
- Game.infoBox.y = Game.VBOUND - 110;
- //Resize canvas
- $('#GamePlay>canvas').attr('width', Game.HBOUND); //Canvas width adjust
- $('#GamePlay>canvas').attr('height', Game.VBOUND - Game.infoBox.height + 5); //Canvas height adjust
- //Resize panel_Info
- $('div.panel_Info')[0].style.width = ((Game.HBOUND - 295) + 'px');
- if (Map.ready) {
- //Update map inside-stroke size
- Map.insideStroke.width = (130 * Game.HBOUND / Map.getCurrentMap().width) >> 0;
- Map.insideStroke.height = (130 * Game.VBOUND / Map.getCurrentMap().height) >> 0;
- //Redraw background
- Map.drawBg();
- //Need re-calculate fog immediately
- Map.drawFogAndMinimap();
- }
-}
-getCurrentTs: function () {
- var now = new Date();
- var formatNum = function (num) {
- if (num < 10)
- return ('0' + num);
- else
- return num.toString();
- };
- var timestamp = now.getFullYear() + '-' + formatNum(now.getMonth() + 1) + '-' + formatNum(now.getDate()) + ' '
- + formatNum(now.getHours()) + ':' + formatNum(now.getMinutes()) + ':' + formatNum(now.getSeconds());
- return timestamp;
-}
-//New H5 features demo
-pauseWhenHide: function () {
- //Add pause when hide window
- $(document).on('visibilitychange', function () {
- if ($(document).attr('hidden') != null) {
- if ($(document).attr('hidden')) {
- Button.pauseHandler();
- $('title').html('Paused...');
- }
- else {
- Button.playHandler();
- $('title').html('StarCraft');
- }
- }
- });
-}
-initIndexDB: function () {
- window.indexedDB = (indexedDB || webkitIndexedDB || mozIndexedDB || msIndexedDB);
- var connect = indexedDB.open('StarCraftHTML5', 1);
- connect.onupgradeneeded = function (evt) {
- var db = evt.target.result;
- var objStore = db.createObjectStore('Replays', { keyPath: 'id', autoIncrement: true });
- objStore.createIndex('levelIndex', 'level', { unique: false });
- objStore.createIndex('teamIndex', 'team', { unique: false });
- objStore.createIndex('endIndex', 'end', { unique: false });
- objStore.createIndex('msIndex', 'millisec', { unique: false });
- objStore.createIndex('tsIndex', 'timestamp', { unique: false });
- objStore.createIndex('offlineIndex', 'offline', { unique: false });
- db.close();
- };
-}
-saveReplayIntoDB: function () {
- var connect = indexedDB.open('StarCraftHTML5', 1);
- connect.onsuccess = function (evt) {
- var db = evt.target.result;
- var objStore = db.transaction(['Replays'], 'readwrite').objectStore('Replays');
- objStore.add({
- level: Game.level,
- team: Game.team,
- cmds: Game.replay,
- end: Game.mainTick,
- millisec: new Date().getTime(),
- timestamp: Game.getCurrentTs(),
- offline: Boolean(Game.offline).toString()
- });
- db.close();
- };
-}
-;
-//# sourceMappingURL=Game.js.map
\ No newline at end of file
diff --git a/GameRule/Levels.js b/GameRule/Levels.js
deleted file mode 100644
index 7dcc2ff..0000000
--- a/GameRule/Levels.js
+++ /dev/null
@@ -1,953 +0,0 @@
-var Levels = [
- {
- level: 1,
- load: function () {
- //Load map
- Map.setCurrentMap('Switchback');
- //Choose side and apply race style
- var races = ['Terran', 'Zerg'];
- var startPoint = [{ x: 50, y: 50 }, { x: 200, y: 50 }];
- if (!Game.replayFlag)
- Game.team = Math.random() * 2 >> 0;
- Game.race.choose(races[Game.team]);
- Map.offsetX = startPoint[Game.team].x;
- Map.offsetY = startPoint[Game.team].y;
- //Load units
- new Terran.BattleCruiser({ x: 100, y: 100 });
- new Terran.Wraith({ x: 200, y: 100 });
- new Terran.BattleCruiser({ x: 100, y: 200 });
- new Terran.Wraith({ x: 200, y: 200 });
- new Terran.BattleCruiser({ x: 100, y: 300 });
- new Terran.Wraith({ x: 200, y: 300 });
- new Terran.SCV({ x: 100, y: 400 });
- new Building.TerranBuilding.MissileTurret({ x: 100, y: 150 });
- new Building.ProtossBuilding.PhotonCannon({ x: 100, y: 250 });
- //Add enemy
- new Zerg.Drone({ x: 600, y: 400, team: 1 });
- new Zerg.Mutalisk({ x: 700, y: 100, team: 1 });
- new Zerg.Devourer({ x: 800, y: 100, team: 1 });
- new Zerg.Guardian({ x: 900, y: 100, team: 1 });
- new Zerg.Mutalisk({ x: 700, y: 200, team: 1 });
- new Zerg.Devourer({ x: 800, y: 200, team: 1 });
- new Zerg.Guardian({ x: 900, y: 200, team: 1 });
- new Zerg.Mutalisk({ x: 700, y: 300, team: 1 });
- new Zerg.Devourer({ x: 800, y: 300, team: 1 });
- new Zerg.Guardian({ x: 900, y: 300, team: 1 });
- //Apply cheat for testing
- Game.commandTimeout(function () {
- Cheat.execute('show me the money');
- }, 0);
- }
- },
- {
- level: 2,
- load: function () {
- //Test multiplayer
- if (!Game.replayFlag && confirm('Want enter multiplayer mode?')) {
- //Enable multiplayer
- Multiplayer.enable(); //Has fog for level2
- }
- //Load map
- Map.setCurrentMap('Volcanis');
- Map.offsetX = 120;
- Map.offsetY = 50;
- //Apply race style
- Game.race.choose('Zerg');
- //Load units
- new Zerg.Overlord({ x: 100, y: 100 });
- new Zerg.Guardian({ x: 100, y: 200 });
- new Zerg.Devourer({ x: 100, y: 300 });
- new Zerg.Mutalisk({ x: 200, y: 100 });
- new Zerg.Devourer({ x: 200, y: 200 });
- new Zerg.Guardian({ x: 200, y: 300 });
- new Zerg.Mutalisk({ x: 300, y: 100 });
- new Zerg.Devourer({ x: 300, y: 200 });
- new Zerg.Guardian({ x: 300, y: 300 });
- new Building.ZergBuilding.SporeColony({ x: 100, y: 200 });
- //Add enemy
- new Terran.Wraith({ x: 700, y: 100, team: 1 });
- new Terran.Wraith({ x: 800, y: 100, team: 1 });
- new Terran.Wraith({ x: 900, y: 100, team: 1 });
- new Terran.Civilian({ x: 700, y: 200, team: 1 });
- new Terran.Civilian({ x: 800, y: 200, team: 1 });
- new Terran.Civilian({ x: 900, y: 200, team: 1 });
- new Terran.BattleCruiser({ x: 700, y: 300, team: 1 });
- new Terran.BattleCruiser({ x: 800, y: 300, team: 1 });
- new Terran.BattleCruiser({ x: 900, y: 300, team: 1 });
- }
- },
- {
- level: 3,
- load: function () {
- //Load map
- Map.setCurrentMap('TrenchWars');
- //Apply race style
- Game.race.choose('Zerg');
- //Load units
- new Neutral.Ragnasaur({ x: 100, y: 100 });
- new Neutral.Rhynsdon({ x: 200, y: 100 });
- new Neutral.Ursadon({ x: 100, y: 200 });
- new Neutral.Bengalaas({ x: 200, y: 200 });
- new Neutral.Scantid({ x: 100, y: 300 });
- new Neutral.Kakaru({ x: 200, y: 300 });
- new Zerg.Hydralisk({ x: 150, y: 100 });
- new Zerg.Lurker({ x: 150, y: 200 });
- new Zerg.Ultralisk({ x: 150, y: 300 });
- //Add enemy
- new Neutral.Ragnasaur({ x: 700, y: 100, team: 1 });
- new Neutral.Rhynsdon({ x: 700, y: 200, team: 1 });
- new Neutral.Ursadon({ x: 700, y: 300, team: 1 });
- new Neutral.Bengalaas({ x: 800, y: 100, team: 1 });
- new Neutral.Scantid({ x: 800, y: 200, team: 1 });
- new Neutral.Kakaru({ x: 800, y: 300, team: 1 });
- }
- },
- {
- level: 4,
- load: function () {
- //Test multiplayer
- /*if (!Game.replayFlag && confirm('Want enter multiplayer mode?')){
- //Enable multiplayer
- Multiplayer.enable();
- Game.commandTimeout(function(){
- //Upgrade all grades
- for (var grade in Upgrade){
- Upgrade[grade].effect(0);
- Upgrade[grade].effect(1);
- }
- Resource[0].mine=Resource[1].mine=10000;
- Resource[0].gas=Resource[1].gas=10000;
- },0);
- Cheat.manUnlimited=true;
- Map.fogFlag=false;
- }*/
- //Load map
- Map.setCurrentMap('BloodBath');
- //Choose side and apply race style
- var races = ['Zerg', 'Terran'];
- var startPoint = [{ x: 0, y: 50 }, { x: 200, y: 50 }];
- if (!Game.replayFlag)
- Game.team = Math.random() * 2 >> 0;
- Game.race.choose(races[Game.team]);
- Map.offsetX = startPoint[Game.team].x;
- Map.offsetY = startPoint[Game.team].y;
- //Load units
- new Zerg.Drone({ x: 100, y: 100 });
- new Zerg.Zergling({ x: 200, y: 100 });
- new Zerg.Hydralisk({ x: 100, y: 200 });
- new Zerg.Scourge({ x: 200, y: 200 });
- new Zerg.Lurker({ x: 100, y: 300 });
- new Zerg.Ultralisk({ x: 200, y: 300 });
- new Zerg.Broodling({ x: 100, y: 400 });
- new Zerg.InfestedTerran({ x: 200, y: 400 });
- new Zerg.Queen({ x: 100, y: 50 });
- new Zerg.Defiler({ x: 200, y: 50 });
- new Hero.Sarah({ x: 100, y: 150 });
- new Zerg.Mutalisk({ x: 50, y: 50 });
- new Zerg.Guardian({ x: 50, y: 150 });
- new Zerg.Devourer({ x: 50, y: 250 });
- new Zerg.Overlord({ x: 50, y: 350 });
- //Add enemy
- new Terran.Marine({ x: 700, y: 100, team: 1 });
- new Terran.Firebat({ x: 700, y: 200, team: 1 });
- new Terran.Vulture({ x: 700, y: 300, team: 1 });
- new Terran.Tank({ x: 800, y: 100, team: 1 });
- new Terran.Goliath({ x: 800, y: 200, team: 1 });
- new Terran.Dropship({ x: 800, y: 300, team: 1 });
- new Terran.Ghost({ x: 700, y: 50, team: 1 });
- new Terran.Vessel({ x: 700, y: 150, team: 1 });
- new Terran.Valkyrie({ x: 700, y: 250, team: 1 });
- new Terran.Medic({ x: 750, y: 50, team: 1 });
- new Terran.Wraith({ x: 750, y: 150, team: 1 });
- new Terran.BattleCruiser({ x: 750, y: 250, team: 1 });
- new Terran.SCV({ x: 750, y: 300, team: 1 });
- //Apply cheat for testing
- Game.commandTimeout(function () {
- Cheat.execute('show me the money');
- Cheat.execute('something for nothing');
- Cheat.execute('full recovery');
- }, 0);
- }
- },
- {
- level: 5,
- load: function () {
- //Load map
- Map.setCurrentMap('OrbitalRelay');
- //Choose side and apply race style
- var races = ['Terran', 'Protoss'];
- var startPoint = [{ x: 0, y: 50 }, { x: 200, y: 50 }];
- if (!Game.replayFlag)
- Game.team = Math.random() * 2 >> 0;
- Game.race.choose(races[Game.team]);
- Map.offsetX = startPoint[Game.team].x;
- Map.offsetY = startPoint[Game.team].y;
- //Load units
- new Terran.Marine({ x: 100, y: 100 });
- new Terran.Firebat({ x: 200, y: 100 });
- new Terran.Ghost({ x: 100, y: 200 });
- new Terran.Vulture({ x: 200, y: 200 });
- new Terran.Tank({ x: 100, y: 300 });
- new Terran.Goliath({ x: 200, y: 300 });
- new Terran.Medic({ x: 100, y: 400 });
- new Terran.Dropship({ x: 200, y: 400 });
- new Terran.Vessel({ x: 100, y: 50 });
- new Terran.Valkyrie({ x: 200, y: 50 });
- new Hero.Kerrigan({ x: 100, y: 150 });
- new Terran.Wraith({ x: 200, y: 150 });
- new Terran.SCV({ x: 50, y: 250 });
- new Terran.BattleCruiser({ x: 150, y: 250 });
- //Add enemy
- new Protoss.Probe({ x: 700, y: 100, team: 1 });
- new Protoss.Zealot({ x: 700, y: 200, team: 1 });
- new Protoss.Dragoon({ x: 700, y: 300, team: 1 });
- new Protoss.Templar({ x: 800, y: 100, team: 1 });
- new Protoss.DarkTemplar({ x: 800, y: 200, team: 1 });
- new Protoss.Observer({ x: 800, y: 300, team: 1 });
- new Protoss.Reaver({ x: 800, y: 300, team: 1 });
- new Protoss.Arbiter({ x: 700, y: 250, team: 1 });
- new Protoss.Scout({ x: 750, y: 250, team: 1 });
- new Protoss.Carrier({ x: 700, y: 150, team: 1 });
- new Protoss.Corsair({ x: 700, y: 200, team: 1 });
- new Protoss.Archon({ x: 750, y: 50, team: 1 });
- new Protoss.DarkArchon({ x: 750, y: 150, team: 1 });
- new Protoss.Shuttle({ x: 850, y: 150, team: 1 });
- new Protoss.Observer({ x: 850, y: 250, team: 1 });
- //Apply cheat for testing magic
- Game.commandTimeout(function () {
- Cheat.execute('show me the money');
- Cheat.execute('something for nothing');
- Cheat.execute('full recovery');
- }, 0);
- }
- },
- {
- level: 6,
- load: function () {
- //Load map
- Map.setCurrentMap('ThinIce');
- //Choose side and apply race style
- var races = ['Protoss', 'Zerg'];
- var startPoint = [{ x: 0, y: 50 }, { x: 200, y: 50 }];
- if (!Game.replayFlag)
- Game.team = Math.random() * 2 >> 0;
- Game.race.choose(races[Game.team]);
- Map.offsetX = startPoint[Game.team].x;
- Map.offsetY = startPoint[Game.team].y;
- //Load units
- new Protoss.Probe({ x: 100, y: 100 });
- new Protoss.Zealot({ x: 200, y: 100 });
- new Protoss.Dragoon({ x: 100, y: 200 });
- new Protoss.Templar({ x: 200, y: 200 });
- new Protoss.DarkTemplar({ x: 100, y: 300 });
- new Protoss.Reaver({ x: 200, y: 300 });
- new Protoss.Archon({ x: 100, y: 400 });
- new Protoss.DarkArchon({ x: 200, y: 400 });
- new Protoss.Shuttle({ x: 100, y: 50 });
- new Protoss.Observer({ x: 200, y: 50 });
- new Protoss.Observer({ x: 200, y: 100 });
- new Protoss.Arbiter({ x: 100, y: 150 });
- new Protoss.Scout({ x: 200, y: 150 });
- new Protoss.Carrier({ x: 100, y: 250 });
- new Protoss.Corsair({ x: 200, y: 250 });
- //Add enemy
- new Zerg.Drone({ x: 700, y: 100, team: 1 });
- new Zerg.Zergling({ x: 700, y: 200, team: 1 });
- new Zerg.Hydralisk({ x: 700, y: 300, team: 1 });
- new Zerg.Scourge({ x: 800, y: 100, team: 1 });
- new Zerg.Lurker({ x: 800, y: 200, team: 1 });
- new Zerg.Ultralisk({ x: 800, y: 300, team: 1 });
- new Zerg.Broodling({ x: 700, y: 150, team: 1 });
- new Zerg.InfestedTerran({ x: 700, y: 250, team: 1 });
- new Zerg.Queen({ x: 800, y: 150, team: 1 });
- new Zerg.Defiler({ x: 800, y: 250, team: 1 });
- new Zerg.Mutalisk({ x: 750, y: 50, team: 1 });
- new Zerg.Guardian({ x: 750, y: 150, team: 1 });
- new Zerg.Devourer({ x: 750, y: 250, team: 1 });
- new Zerg.Overlord({ x: 850, y: 150, team: 1 });
- //Apply cheat for testing magic
- Game.commandTimeout(function () {
- Cheat.execute('show me the money');
- Cheat.execute('something for nothing');
- Cheat.execute('full recovery');
- }, 0);
- }
- },
- {
- level: 7,
- load: function () {
- //Load map
- Map.setCurrentMap('BigGameHunters');
- //Apply race style
- Game.race.choose('Protoss');
- //Add buildings
- //Zerg buildings
- new Building.ZergBuilding.Hatchery({ x: 0, y: 520 });
- new Building.ZergBuilding.Lair({ x: 0, y: 670 }).life = 150;
- new Building.ZergBuilding.Hive({ x: 0, y: 820 });
- new Building.ZergBuilding.CreepColony({ x: 150, y: 520 });
- new Building.ZergBuilding.SunkenColony({ x: 150, y: 670 });
- new Building.ZergBuilding.SporeColony({ x: 150, y: 820, team: 1 });
- new Building.ZergBuilding.Extractor({ x: 300, y: 520 });
- new Building.ZergBuilding.SpawningPool({ x: 300, y: 670 });
- new Building.ZergBuilding.EvolutionChamber({ x: 300, y: 820 });
- new Building.ZergBuilding.HydraliskDen({ x: 450, y: 520 });
- new Building.ZergBuilding.Spire({ x: 450, y: 670 });
- new Building.ZergBuilding.GreaterSpire({ x: 450, y: 820 });
- new Building.ZergBuilding.QueenNest({ x: 600, y: 520 });
- new Building.ZergBuilding.NydusCanal({ x: 600, y: 670 });
- new Building.ZergBuilding.UltraliskCavern({ x: 600, y: 820 });
- new Building.ZergBuilding.DefilerMound({ x: 750, y: 520 });
- new Building.ZergBuilding.InfestedBase({ x: 750, y: 670 });
- new Building.ZergBuilding.OvermindI({ x: 750, y: 820 });
- new Building.ZergBuilding.OvermindII({ x: 900, y: 520 });
- //Terran buildings
- new Building.TerranBuilding.CommandCenter({ x: 0, y: 1020, team: 1 }).life = 375;
- new Building.TerranBuilding.SupplyDepot({ x: 0, y: 1170, team: 1 });
- new Building.TerranBuilding.Refinery({ x: 0, y: 1320 });
- new Building.TerranBuilding.Barracks({ x: 150, y: 1020 });
- new Building.TerranBuilding.EngineeringBay({ x: 150, y: 1170 });
- new Building.TerranBuilding.MissileTurret({ x: 150, y: 1320 });
- new Building.TerranBuilding.Academy({ x: 300, y: 1020 });
- new Building.TerranBuilding.Bunker({ x: 300, y: 1170 });
- new Building.TerranBuilding.Factory({ x: 300, y: 1320 });
- new Building.TerranBuilding.Starport({ x: 450, y: 1020 });
- new Building.TerranBuilding.ScienceFacility({ x: 450, y: 1170 });
- new Building.TerranBuilding.Armory({ x: 450, y: 1320 });
- new Building.TerranBuilding.ComstatStation({ x: 600, y: 1020 });
- new Building.TerranBuilding.NuclearSilo({ x: 600, y: 1170 });
- new Building.TerranBuilding.MachineShop({ x: 600, y: 1320 });
- new Building.TerranBuilding.ControlTower({ x: 750, y: 1020 });
- new Building.TerranBuilding.PhysicsLab({ x: 750, y: 1170 });
- new Building.TerranBuilding.ConvertOps({ x: 750, y: 1320 });
- new Building.TerranBuilding.CrashCruiser({ x: 900, y: 1020 });
- new Building.TerranBuilding.BigCannon({ x: 900, y: 1170 });
- //Protoss buildings
- new Building.ProtossBuilding.Nexus({ x: 0, y: 20 }).life = 150;
- new Building.ProtossBuilding.Pylon({ x: 0, y: 170, team: 1 });
- new Building.ProtossBuilding.Assimilator({ x: 0, y: 320 });
- new Building.ProtossBuilding.Gateway({ x: 150, y: 20 });
- new Building.ProtossBuilding.Forge({ x: 150, y: 170 });
- new Building.ProtossBuilding.PhotonCannon({ x: 150, y: 320 });
- new Building.ProtossBuilding.CyberneticsCore({ x: 300, y: 20 });
- new Building.ProtossBuilding.ShieldBattery({ x: 300, y: 170 });
- new Building.ProtossBuilding.RoboticsFacility({ x: 300, y: 320 });
- new Building.ProtossBuilding.StarGate({ x: 450, y: 20 });
- new Building.ProtossBuilding.CitadelOfAdun({ x: 450, y: 170 });
- new Building.ProtossBuilding.RoboticsSupportBay({ x: 450, y: 320 });
- new Building.ProtossBuilding.FleetBeacon({ x: 600, y: 20 });
- new Building.ProtossBuilding.TemplarArchives({ x: 600, y: 170 });
- new Building.ProtossBuilding.Observatory({ x: 600, y: 320 });
- new Building.ProtossBuilding.ArbiterTribunal({ x: 750, y: 20 });
- new Building.ProtossBuilding.TeleportGate({ x: 750, y: 170 });
- new Building.ProtossBuilding.Pyramid({ x: 750, y: 320 });
- new Building.ProtossBuilding.TeleportPoint({ x: 900, y: 20 });
- //Apply cheat for testing magic
- Game.commandTimeout(function () {
- Cheat.execute('show me the money');
- }, 0);
- }
- },
- {
- level: 8,
- label: 'Campaign',
- load: function () {
- //Load map
- Map.setCurrentMap('TheHunters');
- Map.offsetX = 0;
- Map.offsetY = 3424;
- //Multiplayer
- Game.playerNum = 4;
- //Choose side and apply race style
- var races = ['Terran', 'Zerg', 'Terran', 'Protoss'];
- var startPoint = [{ x: 100, y: 4000 - innerHeight }, { x: 4000 - innerWidth, y: 4000 - innerHeight }, { x: 100, y: 100 }, { x: 4000 - innerWidth, y: 100 }];
- if (!Game.replayFlag)
- Game.team = Math.random() * 4 >> 0;
- Game.race.choose(races[Game.team]);
- Map.offsetX = startPoint[Game.team].x;
- Map.offsetY = startPoint[Game.team].y;
- //Apply cheat
- Cheat.execute('black sheep wall');
- //Our buildings and units
- new Building.ZergBuilding.OvermindI({ x: 662, y: 3828 });
- new Building.ZergBuilding.OvermindII({ x: 300, y: 3694 });
- new Building.TerranBuilding.CrashCruiser({ x: 820, y: 3600 });
- new Building.TerranBuilding.BigCannon({ x: 260, y: 3560 });
- new Building.ProtossBuilding.Pyramid({ x: 560, y: 3690 });
- new Building.ProtossBuilding.TeleportGate({ x: 560, y: 3558 });
- new Building.ProtossBuilding.TeleportPoint({ x: 534, y: 3884 });
- new Hero.HeroCruiser({ x: 300, y: 3455 });
- new Hero.HeroCruiser({ x: 690, y: 3500 });
- new Hero.HeroCruiser({ x: 866, y: 3744 });
- new Hero.Sarah({ x: 434, y: 3600 });
- new Hero.Sarah({ x: 700, y: 3730 });
- new Hero.Kerrigan({ x: 464, y: 3568 });
- new Hero.Kerrigan({ x: 694, y: 3690 });
- new Protoss.Observer({ x: 484, y: 3824 });
- new Protoss.Observer({ x: 524, y: 3824 });
- //Zerg
- new Building.ZergBuilding.Hatchery({ x: 3470, y: 3720, team: 1 });
- new Building.ZergBuilding.Lair({ x: 3265, y: 3795, team: 1 });
- new Building.ZergBuilding.Hive({ x: 3650, y: 3700, team: 1 });
- new Building.ZergBuilding.CreepColony({ x: 3488, y: 3552, team: 1 });
- new Building.ZergBuilding.CreepColony({ x: 3264, y: 3552, team: 1 });
- new Building.ZergBuilding.SunkenColony({ x: 3328, y: 3552, team: 1 });
- new Building.ZergBuilding.SunkenColony({ x: 3392, y: 3552, team: 1 });
- new Building.ZergBuilding.SporeColony({ x: 3136, y: 3552, team: 1 });
- new Building.ZergBuilding.Extractor({ x: 3420, y: 3800, team: 1 });
- new Building.ZergBuilding.SpawningPool({ x: 3440, y: 3616, team: 1 });
- new Building.ZergBuilding.EvolutionChamber({ x: 3248, y: 3616, team: 1 });
- new Building.ZergBuilding.HydraliskDen({ x: 3344, y: 3616, team: 1 });
- new Building.ZergBuilding.Spire({ x: 3744, y: 3552, team: 1 });
- new Building.ZergBuilding.GreaterSpire({ x: 3808, y: 3616, team: 1 });
- new Building.ZergBuilding.QueenNest({ x: 3728, y: 3616, team: 1 });
- new Building.ZergBuilding.NydusCanal({ x: 3200, y: 3552, team: 1 });
- new Building.ZergBuilding.UltraliskCavern({ x: 3824, y: 3520, team: 1 });
- new Building.ZergBuilding.DefilerMound({ x: 3104, y: 3776, team: 1 });
- new Building.ZergBuilding.InfestedBase({ x: 3264, y: 3920, team: 1 });
- new Zerg.Drone({ x: 3828, y: 3724, team: 1 });
- new Zerg.Drone({ x: 3832, y: 3826, team: 1 });
- new Zerg.Drone({ x: 3700, y: 3850, team: 1 });
- new Zerg.Zergling({ x: 3473, y: 3500, team: 1 });
- new Zerg.Zergling({ x: 3541, y: 3535, team: 1 });
- new Zerg.Hydralisk({ x: 3314, y: 3500, team: 1 });
- new Zerg.Hydralisk({ x: 3353, y: 3500, team: 1 });
- new Zerg.Overlord({ x: 3044, y: 3632, team: 1 });
- new Zerg.Overlord({ x: 3522, y: 3438, team: 1 });
- new Zerg.Mutalisk({ x: 3135, y: 3615, team: 1 });
- new Zerg.Mutalisk({ x: 3870, y: 3596, team: 1 });
- new Zerg.Devourer({ x: 3292, y: 3675, team: 1 });
- new Zerg.Devourer({ x: 3644, y: 3535, team: 1 });
- new Zerg.Guardian({ x: 3138, y: 3675, team: 1 });
- new Zerg.Guardian({ x: 3580, y: 3585, team: 1 });
- new Zerg.Scourge({ x: 3154, y: 3490, team: 1 });
- new Zerg.Scourge({ x: 3213, y: 3668, team: 1 });
- new Zerg.Lurker({ x: 3260, y: 3500, team: 1 });
- new Zerg.Lurker({ x: 3408, y: 3500, team: 1 });
- new Zerg.Ultralisk({ x: 3638, y: 3463, team: 1 });
- new Zerg.Broodling({ x: 3602, y: 3666, team: 1 });
- new Zerg.InfestedTerran({ x: 3184, y: 3950, team: 1 });
- new Zerg.Queen({ x: 3647, y: 3610, team: 1 });
- new Zerg.Defiler({ x: 3047, y: 3710, team: 1 });
- //Terran
- new Building.TerranBuilding.CommandCenter({ x: 320, y: 180, team: 2 });
- new Building.TerranBuilding.ComstatStation({ x: 434, y: 220, team: 2 });
- new Building.TerranBuilding.SupplyDepot({ x: 368, y: 416, team: 2 });
- new Building.TerranBuilding.SupplyDepot({ x: 464, y: 416, team: 2 });
- new Building.TerranBuilding.SupplyDepot({ x: 368, y: 480, team: 2 });
- new Building.TerranBuilding.SupplyDepot({ x: 464, y: 480, team: 2 });
- new Building.TerranBuilding.Refinery({ x: 96, y: 246, team: 2 });
- new Building.TerranBuilding.Barracks({ x: 576, y: 432, team: 2 });
- new Building.TerranBuilding.EngineeringBay({ x: 576, y: 336, team: 2 });
- new Building.TerranBuilding.MissileTurret({ x: 384, y: 576, team: 2 });
- new Building.TerranBuilding.MissileTurret({ x: 544, y: 576, team: 2 });
- new Building.TerranBuilding.Academy({ x: 272, y: 416, team: 2 });
- new Building.TerranBuilding.Bunker({ x: 636, y: 556, team: 2 });
- new Building.TerranBuilding.Bunker({ x: 764, y: 460, team: 2 });
- new Building.TerranBuilding.Factory({ x: 732, y: 220, team: 2 });
- new Building.TerranBuilding.MachineShop({ x: 832, y: 256, team: 2 });
- new Building.TerranBuilding.Starport({ x: 732, y: 316, team: 2 });
- new Building.TerranBuilding.ControlTower({ x: 832, y: 352, team: 2 });
- new Building.TerranBuilding.ScienceFacility({ x: 60, y: 390, team: 2 });
- new Building.TerranBuilding.PhysicsLab({ x: 160, y: 416, team: 2 });
- new Building.TerranBuilding.Armory({ x: 272, y: 480, team: 2 });
- new Terran.SCV({ x: 246, y: 116, team: 2 });
- new Terran.SCV({ x: 400, y: 114, team: 2 });
- new Terran.SCV({ x: 222, y: 220, team: 2 });
- new Terran.Marine({ x: 816, y: 528, team: 2 });
- new Terran.Marine({ x: 726, y: 590, team: 2 });
- new Terran.Firebat({ x: 692, y: 618, team: 2 });
- new Terran.Firebat({ x: 846, y: 526, team: 2 });
- new Terran.Ghost({ x: 690, y: 530, team: 2 });
- new Terran.Medic({ x: 725, y: 528, team: 2 });
- new Terran.Vulture({ x: 918, y: 373, team: 2 });
- new Terran.Vulture({ x: 920, y: 512, team: 2 });
- new Terran.Tank({ x: 922, y: 325, team: 2 });
- new Terran.Tank({ x: 920, y: 468, team: 2 });
- new Terran.Goliath({ x: 918, y: 270, team: 2 });
- new Terran.Goliath({ x: 940, y: 420, team: 2 });
- new Terran.Wraith({ x: 672, y: 400, team: 2 });
- new Terran.Wraith({ x: 728, y: 400, team: 2 });
- new Terran.Dropship({ x: 475, y: 548, team: 2 });
- new Terran.Vessel({ x: 692, y: 472, team: 2 });
- new Terran.BattleCruiser({ x: 500, y: 326, team: 2 });
- new Terran.BattleCruiser({ x: 580, y: 510, team: 2 });
- new Terran.Valkyrie({ x: 790, y: 400, team: 2 });
- new Terran.Valkyrie({ x: 854, y: 400, team: 2 });
- new Terran.Civilian({ x: 400, y: 350, team: 2 });
- new Terran.Civilian({ x: 580, y: 250, team: 2 });
- //Protoss
- new Building.ProtossBuilding.Nexus({ x: 3614, y: 222, team: 3 });
- new Building.ProtossBuilding.Pylon({ x: 3296, y: 512, team: 3 });
- new Building.ProtossBuilding.Pylon({ x: 3424, y: 288, team: 3 });
- new Building.ProtossBuilding.Pylon({ x: 3648, y: 512, team: 3 });
- new Building.ProtossBuilding.Assimilator({ x: 3582, y: 86, team: 3 });
- new Building.ProtossBuilding.Gateway({ x: 3648, y: 624, team: 3 });
- new Building.ProtossBuilding.Forge({ x: 3504, y: 448, team: 3 });
- new Building.ProtossBuilding.PhotonCannon({ x: 3200, y: 448, team: 3 });
- new Building.ProtossBuilding.PhotonCannon({ x: 3200, y: 608, team: 3 });
- new Building.ProtossBuilding.PhotonCannon({ x: 3392, y: 608, team: 3 });
- new Building.ProtossBuilding.CyberneticsCore({ x: 3760, y: 448, team: 3 });
- new Building.ProtossBuilding.ShieldBattery({ x: 3728, y: 544, team: 3 });
- new Building.ProtossBuilding.RoboticsFacility({ x: 3344, y: 224, team: 3 });
- new Building.ProtossBuilding.StarGate({ x: 3232, y: 304, team: 3 });
- new Building.ProtossBuilding.CitadelOfAdun({ x: 3632, y: 408, team: 3 });
- new Building.ProtossBuilding.RoboticsSupportBay({ x: 3344, y: 384, team: 3 });
- new Building.ProtossBuilding.FleetBeacon({ x: 3438, y: 182, team: 3 });
- new Building.ProtossBuilding.TemplarArchives({ x: 3504, y: 544, team: 3 });
- new Building.ProtossBuilding.Observatory({ x: 3504, y: 320, team: 3 });
- new Building.ProtossBuilding.ArbiterTribunal({ x: 3216, y: 192, team: 3 });
- new Protoss.Probe({ x: 3668, y: 202, team: 3 });
- new Protoss.Probe({ x: 3794, y: 244, team: 3 });
- new Protoss.Probe({ x: 3796, y: 338, team: 3 });
- new Protoss.Zealot({ x: 3535, y: 640, team: 3 });
- new Protoss.Zealot({ x: 3635, y: 736, team: 3 });
- new Protoss.Dragoon({ x: 3536, y: 688, team: 3 });
- new Protoss.Dragoon({ x: 3585, y: 720, team: 3 });
- new Protoss.Templar({ x: 3472, y: 655, team: 3 });
- new Protoss.DarkTemplar({ x: 3730, y: 712, team: 3 });
- new Protoss.Reaver({ x: 3358, y: 475, team: 3 });
- new Protoss.Archon({ x: 3478, y: 722, team: 3 });
- new Protoss.DarkArchon({ x: 3780, y: 636, team: 3 });
- new Protoss.Shuttle({ x: 3296, y: 612, team: 3 });
- new Protoss.Observer({ x: 3250, y: 398, team: 3 });
- new Protoss.Observer({ x: 3378, y: 692, team: 3 });
- new Protoss.Arbiter({ x: 3350, y: 296, team: 3 });
- new Protoss.Scout({ x: 3132, y: 390, team: 3 });
- new Protoss.Scout({ x: 3100, y: 636, team: 3 });
- new Protoss.Carrier({ x: 3102, y: 470, team: 3 });
- new Protoss.Corsair({ x: 3106, y: 580, team: 3 });
- new Protoss.Corsair({ x: 3838, y: 544, team: 3 });
- //Apply cheat for testing magic
- Game.commandTimeout(function () {
- Cheat.execute('show me the money');
- }, 0);
- }
- },
- {
- level: 9,
- label: 'ProtectAthena',
- load: function () {
- //Load map
- Map.setCurrentMap('OrbitalRelay');
- Map.offsetX = (1536 - Game.HBOUND / 2) >> 0;
- Map.offsetY = (1536 - Game.VBOUND / 2) >> 0;
- Map.fogFlag = false;
- //Apply race style
- Game.race.choose('Protoss');
- //Single player
- Multiplayer.ON = false;
- //Add our buildings and units
- //Override
- Building.ProtossBuilding.Pyramid.prototype.HP = 3000;
- Building.ProtossBuilding.Pyramid.prototype.SP = 3000;
- Building.ProtossBuilding.Pyramid.prototype.detector = Gobj.detectorBuffer;
- //Patch: Overlord speed up
- Game.commandTimeout(function () {
- Upgrade.EvolvePneumatizedCarapace.effect(1);
- Upgrade.IncreaseCarrierCapacity.effect(1);
- }, 0);
- //Patch: Larva can move
- Zerg.Larva.prototype.moveTo = Unit.prototype.moveTo;
- Zerg.Larva.prototype.moveToward = Unit.prototype.moveToward;
- var Pyramid = new Building.ProtossBuilding.Pyramid({ x: 1450, y: 1480 });
- for (var N = 0; N < 6; N++) {
- new Hero.HeroCruiser({ x: 1470, y: 1500 });
- }
- //Override win and lose condition
- Referee.winCondition = function () {
- return false;
- };
- Referee.loseCondition = function () {
- return Pyramid.status == 'dead'; //Closure
- };
- //Enemy coming
- var offsets = [{ x: 1536, y: 36 }, { x: 1536, y: 3036 }, { x: 36, y: 1536 }, { x: 3036, y: 1536 },
- { x: 486, y: 486 }, { x: 486, y: 2586 }, { x: 2586, y: 486 }, { x: 2586, y: 2586 }];
- var num = 0, wave = 1;
- var interval = 20000; //20 seconds per wave
- _$.traverse([Neutral, Zerg, Terran, Protoss], function (enemyType) {
- Game.commandTimeout(function () {
- offsets.forEach(function (offset) {
- offset.team = 1;
- new enemyType(offset).attackGround({ x: 1536, y: 1536 });
- });
- Game.showWarning('Wave ' + wave++ + ': ' + enemyType.prototype.name);
- }, interval * num++);
- });
- //Game win when time reach
- Game.commandTimeout(function () {
- Game.win();
- }, interval * num + interval);
- }
- },
- {
- level: 10,
- label: 'HUNTERxHUNTER',
- /*Once upon a time there was a young hunter lost in strange jungle, and was warmly welcome by forest friends.
- # About 200 units in the map, designed for stress test
- # You have 6 random kinds of magic, and will refresh when you killed each 50 units
- # You can use magic freely without MP consumption
- # Kill 10 units will upgrade, enemies will upgrade every 1 minute
- # Infinite enemy number and unlimited upgrade level
- # Two different modes: easy and nightmare*/
- load: function () {
- /*var isNightmare=confirm('Want challenge nightmare mode?');
- if (!isNightmare){
- //Make it easy
- Hero.DevilHunter.prototype.HP=9999;
- Hero.DevilHunter.prototype.SP=9999;
- Hero.DevilHunter.prototype.MP=999;
- Hero.DevilHunter.prototype.damage=50;
- Hero.DevilHunter.prototype.isInvisible=true;
- }*/
- var isNightmare = true;
- //Load map
- Map.setCurrentMap('Grass');
- var mapSize = Map.getCurrentMap();
- Map.offsetX = (mapSize.width - Game.HBOUND) / 2 >> 0;
- Map.offsetY = (mapSize.height - Game.VBOUND) / 2 >> 0;
- //Apply race style
- Game.race.choose('Zerg');
- //Single player
- Multiplayer.ON = false;
- //Show me the money
- Game.commandTimeout(function () {
- Resource[0].mine = Resource[0].gas = 9999;
- }, 0);
- //Fulfill nuclear bombs
- Magic.NuclearStrike.enabled = 999;
- //Change kill to EXP:
- $('p.kill').html('EXP:');
- //Magic infinite
- Cheat.execute('the gathering');
- //Patch: Overlord speed up
- Game.commandTimeout(function () {
- Upgrade.EvolvePneumatizedCarapace.effect(1);
- Upgrade.IncreaseCarrierCapacity.effect(1);
- }, 0);
- //Override win and lose condition
- Referee.winCondition = function () {
- //Infinite enemies
- if (Unit.allUnits.length < 150) {
- Game.showWarning('Refreshing...');
- Levels.enemyWave();
- Levels.refreshMagic();
- }
- //Upgrade your hunter
- var curLevel = Levels.DevilHunter.kill / 10 >> 0;
- if (curLevel > Levels.DevilHunter.level) {
- for (var N = 0; N < curLevel - Levels.DevilHunter.level; N++) {
- //Upgraded
- if (isNightmare) {
- Hero.DevilHunter.prototype.HP[0] += 100;
- Hero.DevilHunter.prototype.SP[0] += 100;
- Hero.DevilHunter.prototype.MP[0] += 10;
- }
- Cheat.execute("something for nothing");
- Cheat.execute("full recovery");
- Levels.DevilHunter.level = curLevel;
- Game.refreshInfo();
- Referee.voice('upgrade')[Game.race.selected].play();
- Game.showMessage('Upgrade complete');
- }
- }
- return false;
- };
- //Random magics for hunter
- Levels.refreshMagic = function () {
- var magics = ["Parasite", "SpawnBroodlings", "Ensnare", "DarkSwarm", "Plague", "StimPacks", "Lockdown", "NuclearStrike",
- "Restoration", "OpticalFlare", "DefensiveMatrix", "EMPShockwave", "Irradiate", "Yamato", "ScannerSweep", "PsionicStorm",
- "Hallucination", "Feedback", "MindControl", "MaelStorm", "Recall", "StasisField", "DisruptionWeb", "RechargeShields"];
- var items = {};
- for (var N = 4; N <= 9; N++) {
- //Doesn't affect replay here
- var index = Math.random() * magics.length >> 0;
- items[N] = { name: magics[index] };
- magics.splice(index, 1);
- }
- Hero.DevilHunter.prototype.items = items;
- Button.refreshButtons();
- };
- Levels.refreshMagic();
- //Add units on map
- Levels.DevilHunter = new Hero.DevilHunter({ x: mapSize.width / 2, y: mapSize.height / 2 });
- Levels.DevilHunter.level = 0;
- Game.commandTimeout(function () {
- Game.changeSelectedTo(Levels.DevilHunter);
- }, 0);
- //Enemy coming
- Levels.enemyWave = function () {
- var pos = { team: 1 };
- _$.traverse([Neutral, Zerg, Terran, Protoss], function (enemyType) {
- pos.x = (Game.getNextRandom() * mapSize.width) >> 0;
- pos.y = (Game.getNextRandom() * mapSize.height) >> 0;
- var enemy = new enemyType(pos);
- if (enemy.attack) {
- enemy.attackLimit = null;
- }
- });
- };
- for (var N = 0; N < 4; N++) {
- Levels.enemyWave();
- }
- //Enemies will becomes stronger and stronger
- Game.commandInterval(function () {
- Game.showWarning('Enemies become stronger!');
- //Upgrade all grades for enemy
- for (var grade in Upgrade) {
- Upgrade[grade].effect(1);
- }
- }, isNightmare ? 90000 : 60000);
- //Baby hunter will talk every 30s
- var speech = [
- "What the hell is going on? Where am I?",
- "This world is weird! There must be some mistake!",
- "Hey, gloomyson, you sent me to the wrong game!",
- "I'm so scared! I want my mummy!",
- "Let me out! I wanna go home! Plz!",
- "You dare fool me? I'm blind not deaf!",
- "Do you know who I am? My papa is GinBliz!",
- "Let me out of here! Or I'll tell papa to sue you!",
- "At least let me pass hunter exam and get license first!",
- "Nen power, release!",
- "Help me, Killua, Kurapika!",
- "(T_T) cry~~~"
- ];
- for (var N = 0; N < speech.length; N++) {
- (function (n) {
- Game.commandTimeout(function () {
- Game.showMessage('HunterBoy: ' + speech[n], 5000);
- }, n * 30000 + 10000);
- })(N);
- }
- }
- },
- {
- level: 11,
- label: 'TowerDefense',
- load: function () {
- //Load map
- Map.setCurrentMap('TowerDefense');
- Map.offsetX = 4096 - Game.HBOUND;
- Map.offsetY = 3072 - Game.VBOUND;
- Map.fogFlag = false;
- //Apply race style
- Game.race.choose('Terran');
- //Single player
- Multiplayer.ON = false;
- //Patch
- Game.commandTimeout(function () {
- Upgrade.EvolvePneumatizedCarapace.effect(1);
- }, 0);
- Building.prototype.sight = 1000;
- Map.drawMud = function () { };
- Zerg.Lurker.prototype.reactionWhenAttackedBy = Unit.prototype.reactionWhenAttackedBy;
- Zerg.Larva.prototype.moveTo = Unit.prototype.moveTo;
- Zerg.Larva.prototype.moveToward = Unit.prototype.moveToward;
- //Missile fixed duration, original behavior
- Bullets.Spore.prototype.duration = 500;
- delete Bullets.Spore.prototype.speedVal;
- Bullets.SingleMissile.prototype.duration = 600;
- delete Bullets.SingleMissile.prototype.speedVal;
- Bullets.DragoonBall.prototype.duration = 800;
- delete Bullets.DragoonBall.prototype.speedVal;
- //Upgrade utility
- Building.ProtossBuilding.TeleportPoint.prototype.items = {
- '1': { name: 'UpgradeSunkenDamage' },
- '2': { name: 'EnlargeSunkenArea' },
- '3': { name: 'UpgradeSporeDamage' },
- '4': { name: 'EnlargeSporeChain' },
- '5': { name: 'UpgradeMissileDamage' },
- '6': { name: 'IncreaseMissileCount' },
- '7': { name: 'UpgradePhotonCannonDamage' },
- '8': { name: 'IncreasePhotonCannonCount' },
- '9': { name: 'CleanScreen' }
- };
- //#######Transform defensing tower#######
- //Circle attack: 1 VS N
- Building.ZergBuilding.SunkenColony.prototype.AOE = {
- type: "CIRCLE",
- hasEffect: true,
- radius: 50
- };
- Building.ZergBuilding.SunkenColony.prototype.upgrade = ['UpgradeSunkenDamage', 'EnlargeSunkenArea'];
- Building.ZergBuilding.SporeColony.prototype.upgrade = ['UpgradeSporeDamage', 'EnlargeSporeChain'];
- Building.TerranBuilding.MissileTurret.prototype.upgrade = ['UpgradeMissileDamage', 'IncreaseMissileCount'];
- Building.ProtossBuilding.PhotonCannon.prototype.upgrade = ['UpgradePhotonCannonDamage', 'IncreasePhotonCannonCount'];
- //Chain attack: 1 VS 1+1+1
- Bullets.Spore.prototype.fire = function () {
- this.life = this.traceTimes;
- Bullets.prototype.fire.apply(this, arguments);
- };
- Bullets.Spore.prototype.die = Bullets.Darts.prototype.die;
- Bullets.Spore.prototype.traceTimes = 1;
- Bullets.Spore.prototype.traceRadius = 100;
- Bullets.Spore.prototype.noDamage = true;
- //Multiple bullets attack: N VS N
- Building.TerranBuilding.MissileTurret.prototype.AOE = {
- type: "MULTIPLE",
- hasEffect: false,
- radius: 150,
- count: 1
- };
- //Multiple times attack: N VS 1
- Building.ProtossBuilding.PhotonCannon.prototype.continuousAttack = {
- count: 1,
- layout: function (bullet, num) {
- //Reassign location
- if (Math.abs(bullet.speed.x) > Math.abs(bullet.speed.y)) {
- if (bullet.speed.x > 0) {
- bullet.x += (20 * num);
- bullet.y += (20 * num * bullet.speed.y / bullet.speed.x) >> 0;
- }
- else {
- bullet.x -= (20 * num);
- bullet.y -= (20 * num * bullet.speed.y / bullet.speed.x) >> 0;
- }
- }
- else {
- if (bullet.speed.y > 0) {
- bullet.y += (20 * num);
- bullet.x += (20 * num * bullet.speed.x / bullet.speed.y) >> 0;
- }
- else {
- bullet.y -= (20 * num);
- bullet.x -= (20 * num * bullet.speed.x / bullet.speed.y) >> 0;
- }
- }
- }
- };
- //Add our buildings
- Building.ZergBuilding.SunkenColony.prototype.attackLimit = null;
- Building.ZergBuilding.SunkenColony.prototype.attackRange = 700;
- Building.ZergBuilding.SunkenColony.prototype.HP = 9999;
- new Building.ZergBuilding.SunkenColony({ x: 2524, y: 452 });
- new Building.ZergBuilding.SunkenColony({ x: 60, y: 1500 });
- new Building.ZergBuilding.SunkenColony({ x: 2438, y: 2320 });
- Building.ZergBuilding.SporeColony.prototype.attackLimit = null;
- Building.ZergBuilding.SporeColony.prototype.attackRange = 700;
- Building.ZergBuilding.SporeColony.prototype.HP = 9999;
- new Building.ZergBuilding.SporeColony({ x: 3980, y: 1500 });
- new Building.ZergBuilding.SporeColony({ x: 1476, y: 452 });
- new Building.ZergBuilding.SporeColony({ x: 1240, y: 2956 });
- Building.TerranBuilding.MissileTurret.prototype.attackLimit = null;
- Building.TerranBuilding.MissileTurret.prototype.attackRange = 700;
- Building.TerranBuilding.MissileTurret.prototype.HP = 9999;
- new Building.TerranBuilding.MissileTurret({ x: 3228, y: 2632 });
- new Building.TerranBuilding.MissileTurret({ x: 2000, y: 80 });
- new Building.TerranBuilding.MissileTurret({ x: 784, y: 2320 });
- Building.ProtossBuilding.PhotonCannon.prototype.attackLimit = null;
- Building.ProtossBuilding.PhotonCannon.prototype.attackRange = 700;
- Building.ProtossBuilding.PhotonCannon.prototype.SP = 9999;
- new Building.ProtossBuilding.PhotonCannon({ x: 3228, y: 1054 });
- new Building.ProtossBuilding.PhotonCannon({ x: 784, y: 1054 });
- new Building.ProtossBuilding.PhotonCannon({ x: 1684, y: 2320 });
- Building.ProtossBuilding.TeleportPoint.prototype.SP = 9999;
- new Building.ProtossBuilding.TeleportPoint({ x: 2060, y: 1586 });
- //Add our unit
- new Hero.Tassadar({ x: 3200, y: 3072 - Game.VBOUND / 2 }).magic = 999;
- //Override win and lose condition
- var killCount = 0; //Closure
- Referee.winCondition = function () {
- var kills = 0;
- Building.ourBuildings().forEach(function (build) {
- if (build.kill)
- kills += build.kill;
- });
- if (kills > killCount) {
- Resource[0].mine += (kills - killCount);
- killCount = kills;
- }
- return (wave > num && Unit.allEnemyUnits().length == 0);
- };
- var LIFE = 20;
- Referee.loseCondition = function () {
- //Closure LIFE
- Unit.allEnemyUnits().forEach(function (chara) {
- if (chara.inside({ centerX: 2048, centerY: 1536, radius: 200 })) {
- LIFE--;
- Game.showMessage('Remaining life: ' + LIFE);
- chara.die();
- }
- });
- return (LIFE <= 0);
- };
- //Enemy coming
- var num = 0, wave = 1;
- var interval = 30000; //30 seconds per wave
- _$.traverse([Neutral, Zerg, Terran, Protoss], function (enemyType) {
- Game.commandTimeout(function () {
- for (var N = 0; N < 15; N++) {
- (function (n) {
- Game.commandTimeout(function () {
- var enemy = new enemyType({ x: 3622, y: 2916, team: 1 });
- //Focus on routing
- if (enemy.attack)
- enemy.attack = function () {
- this.targetLock = true;
- };
- //Enemies route
- Game.commandTimeout(function () {
- enemy.targetLock = true;
- enemy.destination = { x: 3622, y: 280 };
- enemy.destination.next = { x: 422, y: 280 };
- enemy.destination.next.next = { x: 422, y: 2800 };
- enemy.destination.next.next.next = { x: 2100, y: 2800 };
- enemy.destination.next.next.next.next = { x: 2100, y: 1500 };
- }, 0);
- }, n * 1000);
- })(N);
- }
- Game.showWarning('Wave ' + wave++ + ': ' + enemyType.prototype.name);
- }, interval * num++);
- });
- //Game win when time reach
- Game.commandTimeout(function () {
- Game.win();
- }, interval * num + 60000);
- }
- },
- {
- level: 12,
- label: 'Replay',
- load: function () {
- //Load replay
- var lastReplay = localStorage.getItem('lastReplay');
- if (lastReplay != null) {
- Game.replayFlag = true;
- //Map.fogFlag=false;
- // Should not click buttons or trigger key control during replay
- Button.equipButtonsFor = function () { };
- //Equip with replay buttons
- Button.equipButtonsForReplay();
- //Parse last replay data
- lastReplay = JSON.parse(lastReplay);
- //Select same team
- if (lastReplay.hasOwnProperty('team'))
- Game.team = lastReplay.team;
- Levels[lastReplay.level - 1].load();
- Game.replayLevel = lastReplay.level;
- //Parse user moves
- var recordCmds = lastReplay.cmds;
- for (var tick in recordCmds) {
- Multiplayer.parseTickCmd({ tick: parseInt(tick), cmds: recordCmds[tick] });
- }
- //Replay ends
- Game.endTick = lastReplay.end;
- Game.commandTimeout(function () {
- Game.stopAnimation();
- $('div.panel_Control button').attr('disabled', true);
- Game.showMessage('Replay ended...', 10000);
- }, 100 * Game.endTick);
- }
- else {
- alert('Cannot find any replay!');
- //Error occurs
- delete Game.level;
- return true;
- }
- }
- }
-];
-//# sourceMappingURL=Levels.js.map
\ No newline at end of file
diff --git a/GameRule/Multiplayer.js b/GameRule/Multiplayer.js
deleted file mode 100644
index b1641fe..0000000
--- a/GameRule/Multiplayer.js
+++ /dev/null
@@ -1,418 +0,0 @@
-var Multiplayer = (function () {
- function Multiplayer() {
- this.getSocket = function () {
- if (window.WebSocket) {
- //ServerList: (1)HongKong:nvhae.com (3)Canada:104.128.82.12
- var webSocket = Multiplayer.webSocket = new WebSocket('ws://nvhae.com:28082');
- webSocket.onerror = function () {
- //Offline flag for Store&Forward
- Game.offline = true;
- };
- return webSocket;
- }
- else
- return null;
- };
- this.sendUserInfo = function () {
- var webSocket = Multiplayer.getSocket();
- if (webSocket) {
- webSocket.onopen = function () {
- webSocket.send(JSON.stringify({ type: 'login', level: Game.level, team: Game.team, version: navigator.userAgent,
- platform: navigator.platform, language: navigator.language, size: { x: innerWidth, y: innerHeight } }));
- Multiplayer.statistic = { left: 0, right: 0 };
- //Test parse info
- var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_=' + Math.random();
- $.getJSON(url, function (data) {
- webSocket.send(JSON.stringify({
- type: 'log', log: "Isp(" + data.Isp + "), Browser(" + data.Browser + "), OS(" + data.OS + ")"
- }));
- });
- //Test snapshot
- if (Multiplayer.snapshotFlag) {
- var N = 1;
- setInterval(function () {
- webSocket.send(JSON.stringify({
- type: 'snapshot',
- units: Unit.allUnits.sort(function (u1, u2) {
- if (u1.team == u2.team)
- return u1.name.localeCompare(u2.name);
- else
- return u1.team - u2.team;
- }).map(function (chara) {
- var result = (chara.name + ' HP' + chara.life + ' T' + chara.team + ' [' + (chara.x >> 0) + ',' + (chara.y >> 0) + ']');
- if (chara.magic != null)
- result += ' M' + chara.magic;
- return result;
- }),
- buildings: Building.allBuildings.sort(function (b1, b2) {
- if (b1.team == b2.team)
- return b1.name.localeCompare(b2.name);
- else
- return b1.team - b2.team;
- }).map(function (chara) {
- return chara.name + ' HP' + chara.life + ' T' + chara.team + ' [' + (chara.x >> 0) + ',' + (chara.y >> 0) + ']';
- }),
- click: { left: Multiplayer.statistic.left, right: Multiplayer.statistic.right },
- count: { ourUnits: Unit.allOurUnits().length, enemyUnits: Unit.allEnemyUnits().length,
- ourBuildings: Building.ourBuildings().length, enemyBuildings: Building.enemyBuildings().length },
- num: N
- }));
- //Reset click statistic
- Multiplayer.statistic = { left: 0, right: 0 };
- N++;
- }, 60000);
- }
- //Test replay record every 10 seconds
- if (Multiplayer.replaySnapshotFlag) {
- setInterval(function () {
- webSocket.send(JSON.stringify({
- type: 'replaySnapshot',
- replaySnapshot: {
- team: Game.team,
- level: Game.level,
- cmds: Game.replay,
- end: Game.mainTick
- }
- }));
- }, 10000);
- }
- };
- }
- };
- this.enable = function () {
- var webSocket = Multiplayer.getSocket();
- if (webSocket) {
- webSocket.onopen = function () {
- Game.showMessage("Already connected to server!");
- };
- webSocket.onclose = function () {
- Game.showMessage("You've disconnected from server!");
- };
- webSocket.onerror = function () {
- Game.showMessage("Cannot connect to server...");
- };
- webSocket.onmessage = function (message) {
- var msgObj = JSON.parse(message.data);
- switch (msgObj.type) {
- case "ping":
- Multiplayer.webSocket.send(JSON.stringify({ type: 'pong' }));
- console.log('Receive ping');
- break;
- case "notice":
- Game.showMessage(msgObj.msg);
- break;
- case "start":
- //Choose team
- Game.team = msgObj.team;
- //Bind controller
- mouseController.toControlAll(); //Can control all units
- keyController.start(); //Start monitor
- Game.animation();
- break;
- case "replay":
- Game.saveReplay(msgObj.replay);
- break;
- case "tick":
- Game.serverTick = msgObj.tick;
- Multiplayer.parseTickCmd(msgObj);
- break;
- }
- };
- Multiplayer.ON = true;
- }
- else {
- Game.showMessage("Your browser doesn't support WebSocket...");
- }
- };
- this.parseTickCmd = function (msgObj) {
- if (msgObj.cmds) {
- if (!Game.commands[msgObj.tick])
- Game.commands[msgObj.tick] = [];
- msgObj.cmds.forEach(function (cmdStr) {
- var cmd = JSON.parse(cmdStr);
- switch (cmd.type) {
- case 'rightClick':
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var pos = cmd.pos;
- var unlock = cmd.unlock;
- var btn = cmd.btn;
- return function () {
- var charas = Multiplayer.getUnitsByUIDs(uids);
- mouseController.rightClickHandler(charas, pos, unlock, btn);
- };
- }());
- break;
- case 'stop':
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- return function () {
- var charas = Multiplayer.getUnitsByUIDs(uids);
- Button.stopHandler(charas);
- };
- }());
- break;
- case 'hold':
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- return function () {
- var charas = Multiplayer.getUnitsByUIDs(uids);
- Button.holdHandler(charas);
- };
- }());
- break;
- case 'magic':
- //Scarab and Interceptor
- if (cmd.duration) {
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var name = cmd.name;
- var duration = cmd.duration;
- return function () {
- var owner = Multiplayer.getUnitsByUIDs(uids)[0];
- if (owner && Resource.paypal.call(owner, Resource.getCost(name))) {
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 0;
- Game.commandTimeout(function () {
- Magic[name].spell.call(owner);
- delete owner.processing;
- }, duration * 100);
- //Occupy flag
- owner.processing = {
- name: name,
- startTime: Game.mainTick,
- time: duration
- };
- }
- };
- }());
- }
- else {
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var name = cmd.name;
- var pos = cmd.pos;
- var creditBill = cmd.creditBill;
- return function () {
- var owner = Multiplayer.getUnitsByUIDs(uids)[0];
- if (owner) {
- //Need callback with location
- if (pos) {
- //Spell magic with location in multiplayer mode
- if (creditBill)
- owner.creditBill = creditBill;
- Magic[name].spell.call(owner, pos);
- }
- else {
- if (Resource.paypal.call(owner, Resource.getCost(name))) {
- Magic[name].spell.call(owner);
- }
- }
- }
- };
- }());
- }
- break;
- case 'upgrade':
- if (cmd.duration) {
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var name = cmd.name;
- var duration = cmd.duration;
- var team = cmd.team;
- return function () {
- var owner = Multiplayer.getUnitsByUIDs(uids)[0];
- //Still owner alive and can afford payment
- if (owner && Resource.paypal.call(owner, Resource.getCost(name))) {
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 0;
- Game.commandTimeout(function () {
- Upgrade[name].effect(team);
- delete owner.processing;
- if (team == Game.team) {
- Referee.voice('upgrade')[Game.race.selected].play();
- Game.refreshInfo();
- Game.showMessage('Upgrade complete');
- }
- }, duration * 100);
- //Occupy flag
- owner.processing = {
- name: name,
- startTime: Game.mainTick,
- time: duration
- };
- }
- };
- }());
- }
- else {
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var team = cmd.team;
- var name = cmd.name;
- return function () {
- //Will effect immediately
- Upgrade[name].effect(team);
- };
- }());
- }
- break;
- case 'unit':
- if (cmd.evolve) {
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var unitType = cmd.name;
- var duration = cmd.duration;
- switch (cmd.evolve) {
- case 'archon':
- return function () {
- var chara = Multiplayer.getUnitsByUIDs(uids)[0];
- if (chara && Resource.paypal.call(chara, Resource.getCost(unitType))) {
- //Evolve as Archon or DarkArchon
- var evolve = chara.evolveTo({ type: Building.ProtossBuilding[unitType + 'Evolve'] });
- Game.commandTimeout(function () {
- if (evolve.status != 'dead') {
- evolve.evolveTo({ type: Protoss[unitType], burstArr: [unitType + 'Birth'] });
- }
- }, duration * 100);
- //Processing flag
- evolve.processing = {
- name: unitType,
- startTime: Game.mainTick,
- time: duration
- };
- }
- };
- case 'zerg':
- var exceptions = ['Guardian', 'Devourer']; //Closure
- return function () {
- var chara = Multiplayer.getUnitsByUIDs(uids)[0];
- if (chara && Resource.paypal.call(chara, Resource.getCost(unitType))) {
- //Evolve as egg
- var egg;
- //Clossure: which base larvas belong to
- var base = chara.owner;
- //Evolve as cocoon
- if (exceptions.indexOf(unitType) != -1) {
- egg = chara.evolveTo({ type: Building.ZergBuilding.Cocoon });
- }
- else {
- egg = chara.evolveTo({ type: Building.ZergBuilding.Egg });
- if (unitType == 'Lurker')
- egg.action = 18;
- }
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 0;
- Game.commandTimeout(function () {
- if (egg.status != 'dead') {
- //Evolve
- if (exceptions.indexOf(unitType) != -1) {
- //Cocoon
- egg.evolveTo({ type: Zerg[unitType], burstArr: [unitType + 'Birth'] });
- }
- else {
- //Egg
- egg.evolveTo({ type: Zerg[unitType], burstArr: ['EggBirth', unitType + 'Birth'], rallyPoint: base ? base.rallyPoint : null });
- }
- }
- }, duration * 100);
- //Processing flag on egg
- egg.processing = {
- name: unitType,
- startTime: Game.mainTick,
- time: duration
- };
- }
- };
- }
- }());
- }
- else
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var unitType = cmd.name;
- var duration = cmd.duration;
- //Find unit name from which race
- var Race;
- [Zerg, Terran, Protoss, Hero].forEach(function (race) {
- if (race[unitType] != null)
- Race = race;
- });
- return function () {
- var owner = Multiplayer.getUnitsByUIDs(uids)[0];
- if (owner && Resource.paypal.call(owner, Resource.getCost(unitType))) {
- //Cheat: Operation cwal
- if (Cheat.cwal)
- duration = 0;
- Game.commandTimeout(function () {
- var trainedUnit;
- if (Race[unitType].prototype.isFlying)
- trainedUnit = new Race[unitType]({ x: owner.x, y: owner.y, team: owner.team });
- else
- trainedUnit = new Race[unitType]({ x: owner.x, y: owner.y + owner.height, team: owner.team });
- delete owner.processing;
- if (owner.rallyPoint)
- trainedUnit.destination = owner.rallyPoint;
- }, duration * 100);
- //Occupy flag
- owner.processing = {
- name: unitType,
- startTime: Game.mainTick,
- time: duration
- };
- }
- };
- }());
- break;
- case 'build':
- Game.commands[msgObj.tick].push(function () {
- //Closures
- var uids = cmd.uids;
- var buildName = cmd.name;
- var BuildType = cmd.buildType;
- var pos = cmd.pos;
- return function () {
- var farmer = Multiplayer.getUnitsByUIDs(uids)[0];
- if (farmer && Resource.paypal.call(farmer, Resource.getCost(buildName))) {
- //Destination building name
- farmer.buildName = buildName;
- //Farmer build with location
- if (pos)
- farmer['build' + BuildType](pos);
- else
- farmer['build' + BuildType]();
- }
- };
- }());
- break;
- }
- });
- }
- };
- this.getUIDs = function (charas) {
- return charas.map(function (chara) {
- return chara.id;
- });
- };
- this.getUnitsByUIDs = function (uids) {
- return Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
- //Need filter out dead units to execute commands
- return uids.indexOf(chara.id) != -1 && chara.status != 'dead';
- });
- };
- }
- return Multiplayer;
-}());
-;
-//# sourceMappingURL=Multiplayer.js.map
\ No newline at end of file
diff --git a/GameRule/Referee.js b/GameRule/Referee.js
deleted file mode 100644
index 6d318ea..0000000
--- a/GameRule/Referee.js
+++ /dev/null
@@ -1,426 +0,0 @@
-var Referee = (function () {
- function Referee() {
- this.voice = function () {
- var voice;
- return function (name) {
- //Single instance pattern
- if (!voice)
- voice = {
- pError: new Audio(Game.CDN + 'bgm/PointError.wav'),
- button: new Audio(Game.CDN + 'bgm/Button.wav'),
- resource: {
- Zerg: {
- mine: new Audio(Game.CDN + 'bgm/mine.Zerg.wav'),
- gas: new Audio(Game.CDN + 'bgm/gas.Zerg.wav'),
- man: new Audio(Game.CDN + 'bgm/man.Zerg.wav'),
- magic: new Audio(Game.CDN + 'bgm/magic.Zerg.wav')
- },
- Terran: {
- mine: new Audio(Game.CDN + 'bgm/mine.Terran.wav'),
- gas: new Audio(Game.CDN + 'bgm/gas.Terran.wav'),
- man: new Audio(Game.CDN + 'bgm/man.Terran.wav'),
- magic: new Audio(Game.CDN + 'bgm/magic.Terran.wav')
- },
- Protoss: {
- mine: new Audio(Game.CDN + 'bgm/mine.Protoss.wav'),
- gas: new Audio(Game.CDN + 'bgm/gas.Protoss.wav'),
- man: new Audio(Game.CDN + 'bgm/man.Protoss.wav'),
- magic: new Audio(Game.CDN + 'bgm/magic.Protoss.wav')
- }
- },
- upgrade: {
- Zerg: new Audio(Game.CDN + 'bgm/upgrade.Zerg.wav'),
- Terran: new Audio(Game.CDN + 'bgm/upgrade.Terran.wav'),
- Protoss: new Audio(Game.CDN + 'bgm/upgrade.Protoss.wav')
- }
- };
- return voice[name];
- };
- };
- }
- return Referee;
-}());
-(),
- winCondition;
-function () {
- //By default: All our units and buildings are killed
- return (Unit.allEnemyUnits().length == 0 && Building.enemyBuildings().length == 0);
-}
-loseCondition: function () {
- //By default: All enemies and buildings are killed
- return (Unit.allOurUnits().length == 0 && Building.ourBuildings().length == 0);
-}
-judgeArbiter: function () {
- //Every 0.4 sec
- if (Game.mainTick % 4 == 0) {
- //Special skill: make nearby units invisible
- var arbiterBuffer = Protoss.Arbiter.prototype.bufferObj;
- var allArbiters = Game.getPropArray([]);
- Unit.allUnits.forEach(function (chara) {
- if (chara.name == 'Arbiter')
- allArbiters[chara.team].push(chara);
- });
- //Clear old units' Arbiter buffer
- Referee.underArbiterUnits.forEach(function (charas) {
- charas.forEach(function (chara) {
- chara.removeBuffer(arbiterBuffer);
- });
- });
- Referee.underArbiterUnits = Game.getPropArray([]);
- allArbiters.forEach(function (arbiters, N) {
- //Find new under arbiter units
- arbiters.forEach(function (arbiter) {
- //Find targets: same team units inside Arbiter sight, exclude Arbiter
- var targets = Game.getInRangeOnes(arbiter.posX(), arbiter.posY(), arbiter.get('sight'), N, true, null, function (chara) {
- return arbiters.indexOf(chara) == -1;
- });
- Referee.underArbiterUnits[N] = Referee.underArbiterUnits[N].concat(targets);
- });
- $.unique(Referee.underArbiterUnits[N]);
- });
- //Arbiter buffer effect on these units
- Referee.underArbiterUnits.forEach(function (charas) {
- charas.forEach(function (chara) {
- chara.addBuffer(arbiterBuffer);
- });
- });
- }
-}
-//detectorBuffer are reverse of arbiterBuffer
-judgeDetect: function () {
- //Every 0.4 sec
- if (Game.mainTick % 4 == 0) {
- //Same detector buffer reference
- var detectorBuffer = Gobj.detectorBuffer;
- var allDetectors = Game.getPropArray([]);
- Unit.allUnits.forEach(function (chara) {
- if (chara.detector)
- allDetectors[chara.team].push(chara);
- });
- //Clear old units detected buffer
- Referee.detectedUnits.forEach(function (charas, team) {
- //For each team
- charas.forEach(function (chara) {
- chara.removeBuffer(detectorBuffer[team]);
- });
- });
- Referee.detectedUnits = Game.getPropArray([]);
- allDetectors.forEach(function (detectors, N) {
- //Find new under detector units
- detectors.forEach(function (detector) {
- //Find targets: enemy invisible units inside detector sight
- var targets = Game.getInRangeOnes(detector.posX(), detector.posY(), detector.get('sight'), N + '', true, null, function (chara) {
- return chara['isInvisible' + Game.team];
- });
- Referee.detectedUnits[N] = Referee.detectedUnits[N].concat(targets);
- });
- $.unique(Referee.detectedUnits[N]);
- });
- //Detector buffer effect on these units
- Referee.detectedUnits.forEach(function (charas, team) {
- //For each team
- charas.forEach(function (chara) {
- chara.addBuffer(detectorBuffer[team]);
- });
- });
- //PurpleEffect, RedEffect and GreenEffect are also detector, override invisible
- Animation.allEffects.filter(function (effect) {
- return (effect instanceof Animation.PurpleEffect) ||
- (effect instanceof Animation.RedEffect) ||
- (effect instanceof Animation.GreenEffect);
- }).forEach(function (effect) {
- var target = effect.target;
- for (var team = 0; team < Game.playerNum; team++) {
- //Make already invisible units to visible by all teams
- if (target['isInvisible' + team])
- target['isInvisible' + team] = false;
- }
- });
- }
-}
-judgeReachDestination: function (chara) {
- //Idle but has destination
- if (chara.destination && chara.isIdle()) {
- //Already here
- if (chara.insideSquare({ centerX: chara.destination.x, centerY: chara.destination.y, radius: Unit.moveRange })) {
- //Has next destination
- if (chara.destination.next) {
- chara.destination = chara.destination.next;
- chara.moveTo(chara.destination.x, chara.destination.y);
- chara.targetLock = false;
- }
- else {
- delete chara.destination;
- }
- }
- else {
- chara.moveTo(chara.destination.x, chara.destination.y);
- chara.targetLock = false;
- }
- }
-}
-judgeRecover: function () {
- //Every 1 sec
- if (Game.mainTick % 10 == 0) {
- Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
- if (chara.recover)
- chara.recover();
- });
- }
-}
-judgeDying: function () {
- //Kill die survivor every 1 sec
- if (Game.mainTick % 10 == 0) {
- Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
- return chara.life <= 0 && chara.status != 'dead';
- }).forEach(function (chara) {
- chara.die();
- });
- }
-}
-//Avoid collision
-judgeCollision: function () {
- //N*N->N
- var units = Unit.allGroundUnits().concat(Building.allBuildings);
- for (var N = 0; N < units.length; N++) {
- var chara1 = units[N];
- for (var M = N + 1; M < units.length; M++) {
- var chara2 = units[M];
- var dist = chara1.distanceFrom(chara2);
- //Ground unit collision limit
- var distLimit;
- if (chara2 instanceof Unit) {
- distLimit = (chara1.radius() + chara2.radius()) * 0.5;
- if (distLimit < Unit.meleeRange)
- distLimit = Unit.meleeRange; //Math.max
- }
- else {
- distLimit = (chara1.radius() + chara2.radius()) * 0.8;
- }
- //Separate override ones
- if (dist == 0) {
- var colPos = Referee._pos[Game.getNextRandom() * 4 >> 0];
- if (chara1 instanceof Unit) {
- chara1.x += colPos[0];
- chara1.y += colPos[1];
- dist = 1;
- }
- else {
- if (chara2 instanceof Unit) {
- chara2.x += colPos[0];
- chara2.y += colPos[1];
- dist = 1;
- }
- }
- }
- if (dist < distLimit) {
- //Collision flag
- chara1.collision = chara2;
- chara2.collision = chara1;
- //Adjust ratio
- var K = (distLimit - dist) / dist / 2;
- var adjustX = K * (chara1.x - chara2.x) >> 0;
- var adjustY = K * (chara1.y - chara2.y) >> 0;
- //Adjust location
- var interactRatio1 = 0;
- var interactRatio2 = 0;
- if (chara1 instanceof Building) {
- interactRatio1 = 0;
- //Building VS Unit
- if (chara2 instanceof Unit)
- interactRatio2 = 2;
- else
- interactRatio2 = 0;
- }
- else {
- //Unit VS Unit
- if (chara2 instanceof Unit) {
- if (chara1.status == "moving") {
- //Move VS Move
- if (chara2.status == "moving") {
- interactRatio1 = 1;
- interactRatio2 = 1;
- }
- else {
- interactRatio1 = 2;
- interactRatio2 = 0;
- }
- }
- else {
- //Dock VS Move
- if (chara2.status == "moving") {
- interactRatio1 = 0;
- interactRatio2 = 2;
- }
- else {
- interactRatio1 = 1;
- interactRatio2 = 1;
- }
- }
- }
- else {
- interactRatio1 = 2;
- interactRatio2 = 0;
- }
- }
- chara1.x += interactRatio1 * adjustX;
- chara1.y += interactRatio1 * adjustY;
- chara2.x -= interactRatio2 * adjustX;
- chara2.y -= interactRatio2 * adjustY;
- }
- }
- }
- units = Unit.allFlyingUnits();
- for (var N = 0; N < units.length; N++) {
- var chara1 = units[N];
- for (var M = N + 1; M < units.length; M++) {
- var chara2 = units[M];
- var dist = chara1.distanceFrom(chara2);
- //Flying unit collision limit
- var distLimit = Unit.meleeRange;
- //Separate override ones
- if (dist == 0) {
- var colPos = Referee._pos[Game.getNextRandom() * 4 >> 0];
- chara1.x += colPos[0];
- chara1.y += colPos[1];
- dist = 1;
- }
- if (dist < distLimit) {
- //Adjust ratio
- var K = (distLimit - dist) / dist / 2;
- var adjustX = K * (chara1.x - chara2.x) >> 0;
- var adjustY = K * (chara1.y - chara2.y) >> 0;
- //Adjust location
- chara1.x += adjustX;
- chara1.y += adjustY;
- chara2.x -= adjustX;
- chara2.y -= adjustY;
- }
- }
- }
-}
-coverFog: function () {
- //No need to set interval as 1sec
- if (Game.mainTick % 10 == 0)
- Map.drawFogAndMinimap();
-}
-alterSelectionMode: function () {
- //GC after some user changes
- $.extend([], Game.allSelected).forEach(function (chara) {
- if (chara.status == 'dead' || (chara['isInvisible' + Game.team] && chara.isEnemy()))
- Game.allSelected.splice(Game.allSelected.indexOf(chara), 1);
- });
- //Alter info UI: Multi selection mode
- if (Game.allSelected.length > 1) {
- //Need minor refresh or big move
- if (_$.arrayEqual(Game.allSelected, Game._oldAllSelected)) {
- //Only refresh
- Game.refreshMultiSelectBox();
- }
- else {
- //Redraw multiSelection div
- Game.drawMultiSelectBox();
- //Record this operation
- Game._oldAllSelected = _$.mixin([], Game.allSelected);
- }
- //Show multiSelection box
- $('div.override').show();
- $('div.override div.multiSelection').show();
- }
- else {
- $('div.override').hide();
- $('div.override div.multiSelection').hide();
- }
-}
-addLarva: function () {
- //Every 20 sec
- if (Game.mainTick % 200 == 0) {
- Building.allBuildings.filter(function (build) {
- return build.produceLarva;
- }).forEach(function (build) {
- //Can give birth to 3 larvas
- for (var N = 0; N < 3; N++) {
- if (build.larvas[N] == null || build.larvas[N].status == "dead") {
- build.larvas[N] = new Zerg.Larva({ x: (build.x + N * 48), y: (build.y + build.height + 4), team: build.team });
- //Which base larva belongs to
- build.larvas[N].owner = build;
- break;
- }
- }
- });
- }
-}
-judgeBuildingInjury: function () {
- //Every 1 sec
- if (Game.mainTick % 10 == 0) {
- Building.allBuildings.filter(function (build) {
- return build.injuryOffsets;
- }).forEach(function (build) {
- var injuryLevel = (1 - build.life / build.HP) / 0.25 >> 0;
- if (injuryLevel > 3)
- injuryLevel = 3;
- var curLevel = build.injuryAnimations.length;
- if (injuryLevel > curLevel) {
- var offsets = build.injuryOffsets;
- var scale = build.injuryScale ? build.injuryScale : 1;
- for (var N = curLevel; N < injuryLevel; N++) {
- //Add injury animations
- build.injuryAnimations.push(new Animation[build.injuryNames[N]]({ target: build, offset: offsets[N], scale: scale }));
- }
- if ((build instanceof Building.TerranBuilding) || (build instanceof Building.ProtossBuilding)) {
- if (injuryLevel > 1)
- build.sound.selected = build.sound.onfire;
- }
- }
- if (injuryLevel < curLevel) {
- for (var N = curLevel; N > injuryLevel; N--) {
- //Clear injury animations
- build.injuryAnimations.pop().die();
- }
- if ((build instanceof Building.TerranBuilding) || (build instanceof Building.ProtossBuilding)) {
- if (injuryLevel <= 1)
- build.sound.selected = build.sound.normal;
- }
- }
- });
- }
-}
-judgeMan: function () {
- //Update current man and total man for all teams
- //?We may only need to judge our team's man for client consume use
- var curMan = Game.getPropArray(0), totalMan = Game.getPropArray(0);
- Unit.allUnits.concat(Building.allBuildings).forEach(function (chara) {
- if (chara.cost && chara.cost.man)
- (curMan[chara.team]) += chara.cost.man;
- if (chara.manPlus)
- (totalMan[chara.team]) += chara.manPlus;
- //Transport
- if (chara.loadedUnits) {
- chara.loadedUnits.forEach(function (passenger) {
- if (passenger.cost && passenger.cost.man)
- (curMan[passenger.team]) += passenger.cost.man;
- });
- }
- });
- for (var N = 0; N < Game.playerNum; N++) {
- Resource[N].curMan = curMan[N];
- Resource[N].totalMan = totalMan[N];
- }
-}
-judgeWinLose: function () {
- //Every 1 sec
- if (Game.mainTick % 10 == 0) {
- if (Referee.loseCondition())
- Game.lose();
- if (Referee.winCondition())
- Game.win();
- }
-}
-saveReplaySnapshot: function () {
- //Save replay snapshot every 3 sec
- if (Game.mainTick % 30 == 0) {
- Game.saveReplay();
- }
-}
-;
-//# sourceMappingURL=Referee.js.map
\ No newline at end of file
diff --git a/GameRule/Resource.js b/GameRule/Resource.js
deleted file mode 100644
index f1f54f7..0000000
--- a/GameRule/Resource.js
+++ /dev/null
@@ -1,129 +0,0 @@
-var Resource = (function () {
- function Resource() {
- this.init = function () {
- for (var N = 0; N < Game.playerNum; N++) {
- Resource[N] = {
- mine: 50,
- gas: 0,
- curMan: 0,
- totalMan: 0
- };
- }
- };
- this.getCost = function (name, team) {
- var cost, count;
- if (!team)
- team = Game.team;
- [Zerg, Terran, Protoss, Building.ZergBuilding, Building.TerranBuilding, Building.ProtossBuilding, Magic, Upgrade].forEach(function (Type) {
- //Not found yet
- if (!cost) {
- for (var item in Type) {
- //Filter out noise
- if (item == 'inherited' || item == 'super' || item == 'extends')
- continue;
- if (item == name) {
- if (typeof (Type[item]) == 'function') {
- cost = Type[item].prototype.cost;
- count = Type[item].prototype.birthCount;
- }
- else
- cost = Type[item].cost;
- //Resolve array cost
- if (cost) {
- //Clone fetched cost object, but sometimes undefined
- cost = _$.clone(cost);
- ['mine', 'gas', 'man', 'magic', 'time'].forEach(function (res) {
- if (cost[res]) {
- if (cost[res] instanceof Array) {
- cost[res] = cost[res][Type[item].level[team]];
- }
- if (count) {
- cost[res] *= count;
- }
- }
- });
- }
- break;
- }
- }
- }
- });
- return cost;
- };
- //Check if paid successfully
- this.paypal = function (cost) {
- if (cost) {
- var oweFlag = false;
- if (Cheat.gathering)
- cost.magic = 0;
- var team = (this.team != null) ? this.team : Game.team;
- if (cost['mine'] && cost['mine'] > Resource[team].mine) {
- oweFlag = true;
- Game.showMessage('Not enough minerals...mine more minerals');
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].mine.play();
- }
- if (cost['gas'] && cost['gas'] > Resource[team].gas) {
- oweFlag = true;
- Game.showMessage('Not enough Vespene gases...harvest more gas');
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].gas.play();
- }
- if (cost['man'] && cost['man'] > (Resource[team].totalMan - Resource[team].curMan) && !Cheat.manUnlimited) {
- oweFlag = true;
- switch (Game.race.selected) {
- case 'Zerg':
- Game.showMessage('Too many underlings...create more Overlords');
- break;
- case 'Terran':
- Game.showMessage('Not enough supplies...build more Supply Depots');
- break;
- case 'Protoss':
- Game.showMessage('Not enough psi...build more Pylons');
- break;
- }
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].man.play();
- }
- if (cost['magic'] && cost['magic'] > this.magic) {
- oweFlag = true;
- Game.showMessage('Not enough energy');
- //Advisor voice
- Referee.voice('resource')[Game.race.selected].magic.play();
- }
- if (oweFlag) {
- //Payment failed
- return false;
- }
- else {
- if (!this.creditBill) {
- //Pay immediately
- if (cost['mine']) {
- Resource[team].mine -= cost['mine'];
- }
- if (cost['gas']) {
- Resource[team].gas -= cost['gas'];
- }
- if (cost['magic']) {
- this.magic -= cost['magic'];
- }
- }
- //Already paid
- return true;
- }
- }
- else
- return true;
- };
- //Pay credit card bill
- this.payCreditBill = function () {
- var cost = this.creditBill;
- //Paid credit bill, no longer owe money this time
- delete this.creditBill;
- return Resource.paypal.call(this, cost);
- };
- }
- return Resource;
-}());
-;
-//# sourceMappingURL=Resource.js.map
\ No newline at end of file
diff --git a/GameRule/SC_server.js b/GameRule/SC_server.js
deleted file mode 100644
index 96bd613..0000000
--- a/GameRule/SC_server.js
+++ /dev/null
@@ -1,171 +0,0 @@
-var http = require('http');
-var httpServer = http.createServer(function (request, response) {
- console.log('Receive request from ' + request.url);
- response.end('');
-});
-httpServer.listen(28082);
-console.log('HTTP server starts listening port 28082...');
-var wsServer = new (require('websocket').server)({
- httpServer: httpServer
-}); //Closure
-wsServer.rooms = [];
-var multiPlayerNum = 2; //Closure
-var webSockets = []; //Closure
-var getServerTime = function () {
- var now = new Date();
- var timestamp = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate() + ' '
- + now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds();
- return timestamp;
-};
-wsServer.on('request', function (request) {
- var socket = request.accept(); //Closure
- var latencyMeasures = [{ start: new Date() }]; //Closure
- var IP = request.remoteAddress; //Closure
- webSockets.push(socket);
- console.log(getServerTime() + ' ' + IP + ' is connected...');
- socket.send(JSON.stringify({ type: 'ping' }));
- socket.on('message', function (message) {
- var data = message.utf8Data;
- data = JSON.parse(data);
- switch (data.type) {
- case 'pong':
- var times = latencyMeasures.length;
- latencyMeasures[times - 1].end = new Date();
- //console.log('Receive pong '+times);
- if (times == 5) {
- var latency = 0;
- latencyMeasures.forEach(function (latencyMeasure) {
- latency += (latencyMeasure.end - latencyMeasure.start);
- });
- latency = (latency / times) >> 0;
- socket.tickLag = Math.ceil(latency * 2 / 100); //Can adjust it here
- console.log(IP + ' average latency is ' + latency);
- console.log(IP + ' tick lag is ' + socket.tickLag);
- if (webSockets.length == multiPlayerNum) {
- //Game start: Init new room
- var room = { id: wsServer.rooms.length, webSockets: webSockets }; //Closure
- webSockets = [];
- console.log('Open room ' + room.id); //test
- room.tick = 0;
- room.clientTicks = [];
- for (var N = 0; N < multiPlayerNum; N++) {
- room.clientTicks.push(0);
- }
- room.replay = {};
- room.roomLag = 0;
- //Inner name list for each socket
- var names = ['Tom', 'John', 'Steve', 'Mike', 'Cindy', 'Emile']; //Closure for each room
- var colors = ['yellow', 'orange', 'lime', 'aqua', 'violet', 'red']; //Closure for each room
- //Set max latency as roomLag
- room.webSockets.forEach(function (socket) {
- if (room.roomLag < socket.tickLag)
- room.roomLag = socket.tickLag; //max
- socket.room = room;
- });
- room.webSockets.forEach(function (socket, N) {
- socket.team = N;
- //Give a random name
- var index = Math.random() * names.length >> 0;
- socket.name = names[index];
- socket.color = colors[index];
- names.splice(index, 1);
- colors.splice(index, 1);
- socket.send(JSON.stringify({ type: 'start', team: N }));
- //Start server ticking, trigger clients
- socket.send(JSON.stringify({ type: 'tick', tick: (room.tick + room.roomLag) }));
- });
- wsServer.rooms.push(room);
- //Start server ticking
- setInterval(function () {
- var minTick = Math.min.apply({}, room.clientTicks);
- //console.log('minTick:'+minTick);
- if (room.tick < minTick) {
- room.tick++;
- //console.log('ServerTick:'+room.tick+' roomLag:'+room.roomLag+' minTick:'+minTick);//test
- var sendTick = (room.tick + room.roomLag);
- room.webSockets.forEach(function (webSocket) {
- webSocket.send(JSON.stringify({ type: 'tick', tick: sendTick, cmds: room.cmds }));
- });
- if (room.cmds) {
- room.replay[sendTick] = room.cmds;
- room.cmds = null; //Clear
- }
- }
- }, 100);
- }
- else {
- socket.send(JSON.stringify({ type: 'notice', msg: ('CurrentPlayer:' + webSockets.length + '/' + multiPlayerNum) }));
- }
- }
- else {
- socket.send(JSON.stringify({ type: 'ping' }));
- latencyMeasures.push({ start: new Date() });
- }
- break;
- case 'tick':
- var clientTick = (data.tick + socket.tickLag);
- socket.room.clientTicks[socket.team] = clientTick;
- if (data.cmds) {
- if (!socket.room.cmds)
- socket.room.cmds = [];
- socket.room.cmds = socket.room.cmds.concat(data.cmds); //Multiple cmds in one frame
- }
- //console.log('Team'+socket.team+':'+data.tick);//test
- break;
- case 'chat':
- if (socket.room) {
- socket.room.webSockets.forEach(function (webSocket) {
- webSocket.send(JSON.stringify({ type: 'notice', msg: '' + socket.name + ': ' + data.msg + '' }));
- });
- }
- break;
- case 'getReplay':
- socket.send(JSON.stringify({ type: 'replay', replay: socket.room.replay }));
- break;
- case 'login':
- console.log(getServerTime() + ' ' + IP + ' login to level ' + data.level + ' in team ' + data.team);
- console.log(IP + ' Version: ' + data.version);
- console.log(IP + ' Browser: size={x:' + data.size.x + ',y:' + data.size.y + '} lang=' + data.language + ' OS=' + data.platform);
- break;
- case 'snapshot':
- console.log('\n####### ' + getServerTime() + ' ' + IP + ' snapshot No.' + data.num + ' #######');
- console.log('Click statistics: left=' + data.click.left + ' right=' + data.click.right);
- console.log('Unit statistics: ours=' + data.count.ourUnits + ' enemies=' + data.count.enemyUnits);
- if (data.count.ourUnits + data.count.enemyUnits < 20)
- console.log(data.units);
- console.log('Building statistics: ours=' + data.count.ourBuildings + ' enemies=' + data.count.enemyBuildings);
- if (data.count.ourBuildings + data.count.enemyBuildings < 20)
- console.log(data.buildings);
- console.log('##########################################\n');
- break;
- case 'replaySnapshot':
- socket.replaySnapshot = JSON.stringify(data.replaySnapshot);
- break;
- case 'log':
- //Just print out
- console.log(data.log);
- }
- });
- socket.on('close', function (message) {
- //Broadcast disconnect info
- var msg = (getServerTime() + ' ' + (socket.name ? socket.name : IP) + ' has left from game...');
- console.log(msg);
- //Print replay
- if (socket.replaySnapshot) {
- console.log('################ ' + IP + ' replay: ################');
- console.log(socket.replaySnapshot);
- console.log('################################################################');
- }
- //Kick off losing connection user
- if (socket.room) {
- var webSockets = socket.room.webSockets;
- webSockets.splice(webSockets.indexOf(socket), 1);
- //Make game to continue without player control
- socket.room.clientTicks[socket.team] = Number.MAX_VALUE;
- webSockets.forEach(function (webSocket) {
- webSocket.send(JSON.stringify({ type: 'notice', msg: msg }));
- });
- }
- });
-});
-//# sourceMappingURL=SC_server.js.map
\ No newline at end of file
diff --git a/SVN.log b/SVN.log
deleted file mode 100644
index 746651e..0000000
--- a/SVN.log
+++ /dev/null
@@ -1,2050 +0,0 @@
-Revision: 158
-Author: gloomyson
-Date: 17:00:59, 2016-8-29
-Message:
-Double check in from ES6 branch #152:
-Support input CDN location for image/audio materials
-----
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Resource.js
-
-Revision: 155
-Author: gloomyson
-Date: 17:01:55, 2016-8-24
-Message:
-Double check in for #154:
-1.Change walkAroundLarva behavior
-2.Adjust larva born position
-3.Fix Goliath attack imgPos issue
-4.Adjust sprite images for Archon/Goliath/Tank
-----
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/img/Charas/Archon.png
-Modified : /StarCraft/img/Charas/Goliath.png
-Modified : /StarCraft/img/Charas/Tank.png
-
-Revision: 153
-Author: gloomyson
-Date: 16:50:37, 2016-8-18
-Message:
-Double check in #149 and #152 to main branch from ES6 branch
-----
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Hero.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/Characters/Neutral.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/img/Charas/Archon.png
-Modified : /StarCraft/img/Charas/BattleCruiser.png
-Modified : /StarCraft/img/Charas/Broodling.png
-Modified : /StarCraft/img/Charas/Carrier.png
-Modified : /StarCraft/img/Charas/Civilian.png
-Modified : /StarCraft/img/Charas/Corsair.png
-Modified : /StarCraft/img/Charas/Dropship.png
-Modified : /StarCraft/img/Charas/Goliath.png
-Modified : /StarCraft/img/Charas/Mutalisk.png
-Modified : /StarCraft/img/Charas/Overlord.png
-Modified : /StarCraft/img/Charas/SCV.png
-Modified : /StarCraft/img/Charas/Shuttle.png
-Modified : /StarCraft/img/Charas/Tank.png
-Modified : /StarCraft/img/Charas/Tassadar.png
-Modified : /StarCraft/img/Charas/Valkyrie.png
-Modified : /StarCraft/img/Charas/Wraith.png
-
-Revision: 151
-Author: gloomyson
-Date: 17:19:42, 2016-8-5
-Message:
-Double check in to main branch from ES6 for #150:
-Change logic to improve fog drawing performance
-----
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Referee.js
-
-Revision: 142
-Author: gloomyson
-Date: 9:49:09, 2016-7-16
-Message:
-Disable hack mode and change to nvhae server
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-
-Revision: 141
-Author: gloomyson
-Date: 9:36:27, 2016-7-16
-Message:
-Fix loading process bar cannot work issue
-----
-Modified : /StarCraft/Utils/sourceLoader.js
-
-Revision: 139
-Author: gloomyson
-Date: 14:21:12, 2016-7-13
-Message:
-1.And keywords, descriptions and author in index.html
-2.Use _$.mixin to replace $.makeArray, make custom game frame clean
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/index.html
-
-Revision: 138
-Author: gloomyson
-Date: 13:56:31, 2016-4-29
-Message:
-1.Save replays into indexedDB, has offline flag to SAF
-2.Avoid collision draft added
-3.Add cache.manifest
-4.Pause when hide window
-5.Disable panel buttons after replay ended
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Added : /StarCraft/cache.manifest
-
-Revision: 137
-Author: gloomyson
-Date: 23:23:21, 2016-4-13
-Message:
-1.Add replay panel buttons and progress bar
-2.Add replay button icons
-3.Fix icon position issue
-4.Fix invisible farmer cannot build issue
-5.Adjust some of Button.reset()
-6.Fix 2 fingers touch rectangle incorrect issue
-7.Remove some redundant css
-8.Fix compatible issues for css3 styles: border-image and transform
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/img/Menu/CmdIcons.png
-Modified : /StarCraft/img/Menu/CmdIconsDisabled.png
-
-Revision: 136
-Author: gloomyson
-Date: 2:12:41, 2016-4-9
-Message:
-1.Another css set for mobile
-2.Finish all kinds of mobile event handlers, add Game.isApp
-3.Fix cannot hide tooltip issue in mobile
-4.Delete 2 nbsp besides "Upgraded:" to save space
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/style.css
-
-Revision: 135
-Author: gloomyson
-Date: 18:25:00, 2016-4-1
-Message:
-1.Fix tower defense cannot upgrade during replay issue
-2.Disable touch event during replay
-3.Add mobile control for tap/press/pan events
-4.Fix mobile cannot enter level 10 issue
-5.Add 10000 money for some levels
-6.Add hummer.js into jquery.js
-----
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/Utils/jquery.min.js
-
-Revision: 134
-Author: gloomyson
-Date: 13:56:08, 2016-3-16
-Message:
-1.Add shortcut key pageUp and pageDown for replay speed adjust
-2.Add hackFlag to control hacking user info or not
-3.Enable fog during replay
-4.Add more ### to surround replay data
-5.Fix overlord using hold error issue
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/GameRule/SC_server.js
-
-Revision: 133
-Author: gloomyson
-Date: 17:01:58, 2016-3-14
-Message:
-1.Add replay speed up and slow down feature
-2.Stop animation when replay ended
-3.Send replay to server instead of snapshot
-4.Can save replay before game ended
-5.Add Game.commandInterval and Game.getNextRandom to reduce uncontrollable random
-6.Fix Game.showMessage cannot line break issue
-7.Fix random team selection in replay mode issue
-8.Remove HUNTERxNHUNTER easy mode popup dialog
-9.Remove redundant button callback code
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/SC_server.js
-Modified : /StarCraft/GameRule/Referee.js
-
-Revision: 132
-Author: gloomyson
-Date: 17:34:45, 2016-3-10
-Message:
-1.Can replay single player game
-2.Single play moves latency to next frame
-3.Fix lurker evolve doesn't have rally point issue
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/mouseController.js
-
-Revision: 131
-Author: gloomyson
-Date: 16:27:06, 2016-3-2
-Message:
-Enrich login user info collection feature:
-1.Collect OS&Browser version
-2.Collect snapshot every 1 minute: Unit/Building status and click times
-3.Collect location
-----
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/SC_server.js
-
-Revision: 130
-Author: gloomyson
-Date: 17:02:28, 2016-3-1
-Message:
-1.Fix close socket cannot show time bug, onclose and logout event cannot use bug
-2.Get login user random team info
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/GameRule/SC_server.js
-
-Revision: 129
-Author: gloomyson
-Date: 16:29:05, 2016-3-1
-Message:
-1.Collect login user info in online site
-2.Disable multiplayer mode in most of levels
-3.Random team selection for most of levels
-4.Forbid cheat during replay
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/GameRule/SC_server.js
-Modified : /StarCraft/GameRule/Cheat.js
-
-Revision: 128
-Author: gloomyson
-Date: 17:59:23, 2016-1-7
-Message:
-1.Support replay (Need add menu with button Pause/Faster/Slower/ChangeTeam)
-2.Fix room.replay saves all empty frames with [] command issue
-3.Stop all units after completely fade out
-4.Add Multiplayer.parseTickCmd function
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/SC_server.js
-
-Revision: 127
-Author: gloomyson
-Date: 17:27:51, 2016-1-6
-Message:
-1.Support some bullets have fixed speed
-2.Middle bullet in multiple causes damage
-3.Lurker thron has 5 bullets
-4.Change transport icon style
-5.Fix larva cannot move in level issue
-6.Fix some bugs
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-
-Revision: 126
-Author: gloomyson
-Date: 18:14:40, 2015-12-29
-Message:
-1.Add life status color on passenger border
-2.Make game continue when other user disconnect with server
-3.Adjust info center position and width, adjust passenger margin
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/SC_server.js
-
-Revision: 125
-Author: gloomyson
-Date: 17:48:00, 2015-12-28
-Message:
-1.Paypal sync for upgrade/unit/evolve/building
-2.Add transport icons for ships
-3.Add filter to hide enemy passenger and process bar
-4.Give mine and gas to all teams
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/css/style.css
-
-Revision: 124
-Author: gloomyson
-Date: 0:10:00, 2015-12-28
-Message:
-1.Make consume magic sync in multiplayer mode (cloak/yamato/scarab)
-2.Add new magic Load and UnloadAll (add manLimit, splice from team, show passenger number and die with transport) and their audios
-3.Add new magic SetRallyPoint
-4.Reduce frequency of Button.reset
-5.Add needLocation prop for some magic
-6.Replace Resource.creditBill with this.creditBill to prevent conflict
-7.Resource.paypal need to cost correct team resource
-8.Remove Cheat.gathering from Levels.js for testing
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/GameRule/Resource.js
-Added : /StarCraft/bgm/Magic.Load.Protoss.wav
-Added : /StarCraft/bgm/Magic.Load.Terran.wav
-Added : /StarCraft/bgm/Magic.Load.Zerg.wav
-Added : /StarCraft/bgm/Magic.Unload.Protoss.wav
-Added : /StarCraft/bgm/Magic.Unload.Terran.wav
-Added : /StarCraft/bgm/Magic.Unload.Zerg.wav
-
-Revision: 123
-Author: gloomyson
-Date: 17:55:45, 2015-12-25
-Message:
-1.Adjust Game.win and Game.lose to use fadeout callback
-2.Rearrange button callback code
-3.Fix resource message show in one line regression issue
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/GameRule/Resource.js
-
-Revision: 122
-Author: gloomyson
-Date: 0:39:22, 2015-12-25
-Message:
-1.Finish multiplayer sync and testing for upgrade/unit/evolve/building
-2.PurpleEffect/RedEffect/GreenEffect can make enemy visible to all teams
-3.Fix train other team units when Game.team is not 0 issue
-4.Fix magic SpawnBroodlings/Hallucination always summon team 0 units issue
-5.Remove remaining _$.hitch from farmer build buildings
-6.Optimize Unit.randomDirection generate random by *5+3
-7.Update level 3,4,5,6,8 to support multiplayer testing
-8.Make mapping uids to units later to the time when taking effect
-9.Fix cannot train new units issue by correct typo
-10.Make function getUnitsByUIDs to filter out dead units
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Burst.js
-
-Revision: 121
-Author: gloomyson
-Date: 18:00:06, 2015-12-23
-Message:
-1.Multiplayer sync basic finished for magic/upgrade/unit/evolve/build
-/*Only tested 2 magics, all other multiplayer types and singleplayer regression need to test*/
-2.Revert magic callback from _$.hitch style to .owner style
-----
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-
-Revision: 120
-Author: gloomyson
-Date: 23:37:29, 2015-12-22
-Message:
-1.Optimize algorithm for multiplayer chat
-2.Auto assign colorful name for each socket
-3.Fix cheat 'liuda is god' cannot work issue
-----
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/GameRule/SC_server.js
-Modified : /StarCraft/GameRule/Cheat.js
-
-Revision: 119
-Author: gloomyson
-Date: 18:35:17, 2015-12-22
-Message:
-1.Player can chat with others in multiplayer mode
-2.Fix server broken when close connection before room generated issue
-----
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/GameRule/SC_server.js
-Modified : /StarCraft/GameRule/Cheat.js
-
-Revision: 118
-Author: gloomyson
-Date: 22:24:37, 2015-12-20
-Message:
-1.Sync stop/hold and patrol for multi-player mode
-2.Support multiple cmds for send to server
-3.Fix throw error when resize before init level issue
-4.Fix play selected voice from other team when multiplayer
-5.Fix cannot draw mini-map after black sheep wall issue
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/SC_server.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 117
-Author: gloomyson
-Date: 12:26:35, 2015-12-20
-Message:
-1.Optimize draw fog algorithm again, draw inside screen units fog is the key
-2.Set magic parasite and scanner sweep to effect for owner team
-3.Fix 'black sheep wall' cannot work issue, need clean fog
-4.Add Map.refreshFogsImmediate for window resize and move
-5.Fix resize window should resize all $('#GamePlay>canvas') issue
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 116
-Author: gloomyson
-Date: 17:18:40, 2015-12-18
-Message:
-1.Optimize draw fog algorithm, speed up by N/10 average calculation: average insideScreen or enlarge refresh fog interval?
-2.Remove redundant Map.fogType
-3.Adjust draw fog functions name: refreshFogs,drawFogAndMinimap, drawMinimap
-4.Add fogCanvas and fogCxt, replace mouseController trigger from frontCxt to fogCxt
-5.Remove Referee.monitorMiniMap
-
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 115
-Author: gloomyson
-Date: 18:08:08, 2015-12-17
-Message:
-1.Finish basic network frame: Support move/attack/rightclick
-2.Fix Irradiate animation frame incorrect issue
-3.Add Multiplayer.js and SC_server.js into GameRule
-4.Enhance Game.showMessage function, can show multiple lines now
-5.Adjust generate random code, delete redundant rem lines
-6.Enhance level1 and level2 to support multiplayer mode
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Added : /StarCraft/GameRule/Multiplayer.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Added : /StarCraft/GameRule/SC_server.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-
-Revision: 114
-Author: gloomyson
-Date: 18:30:54, 2015-12-16
-Message:
-1.Add Unit.randomDirection function, can keep random in all clients same
-2.Keep charas change direction by id, not in same time
-3.Add _$.toArray in gFrame
-4.Delete redundant isInvisible after expansion
-5.Optimize array function selections by Array.prototype.reduce
-6.Remove redundant timers in Magic.js
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Building.js
-
-Revision: 113
-Author: gloomyson
-Date: 0:13:51, 2015-12-15
-Message:
-1.Fix cannot open some levels by wrong initial timing
-2.Fix incorrect delete upgrade button condition in Upgrade.js
-3.Fix 'show me the money'
-4.Fix Referee.judgeMan behavior for multiple players
-5.Correct initial totalMan
-6.Remove Unit.ourFlyingUnits/ourGroundUnits/ enemyFlyingUnits/enemyGroundUnits
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 112
-Author: gloomyson
-Date: 22:53:34, 2015-12-14
-Message:
-1.Enhance Referee.judgeArbiter and Referee.judgeDetect to behave evenly, new detectorBuffer and arbiter buffer
-2.Add property obj.isInvisible0~N, replace all chara.isInvisible
-3.Fix unburrow animation incorrect issue
-4.Fix upgrade level undefined issue and initial them later
-5.Fix getPropArray(object) use same reference issue
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 111
-Author: gloomyson
-Date: 23:38:52, 2015-12-13
-Message:
-1.Remove remaining setTimeout in Magic.js
-2.Fix some units cannot play attack animation by animateFrame
-3.Fix some bullets show above owner at beginning
-4.Add expandProps to expand props for multiple teams after load level
-5.Fix drawSourceBox cannot draw other team's resource issue
-6.Fix cannot pay other team's resource issue
-7.Fix somethingForNothing cannot apply correctly issue
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 110
-Author: gloomyson
-Date: 18:09:35, 2015-12-11
-Message:
-1.Fix AOE cannot cause damage issue
-2.Replace some setTimeout in magic with Game.commandTimeout, remove setInterval in heal
-3.Update button when burrowed
-4.Enrich Game.getSelectedOne and Game.getInRangeOnes to filter by team number
-5.Correct Game.team in magic to myself.team
-6.Don't show invisible enemy on minimap
-7.Forbid Cheat.execute when multiplayer mode
-8.Remove redundant Game.getNearbyOnes and Game.getNearestOne
-
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 109
-Author: gloomyson
-Date: 1:07:20, 2015-12-11
-Message:
-1.Merge types of timer: moving/dock/attack/routing/burst into allFrames, and call playFrame in main loop (operation part)
-2.Replace setTimeout with Game.commandTimeout
-3.And process Game.commands[frame] part in main loop
-4.Adjust dock types and their interval
-5.Fix regression issues due to update as below:
-Black flash and cannot refresh miniFog at beginning, slow drawing in main loop, process commands and mainTick++ and playFrames order decision in main loop, burst redundant frame, cannot create unit/building/evolve, percentage calculation method update, cannot show burrow animation
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 108
-Author: gloomyson
-Date: 0:42:56, 2015-12-9
-Message:
-1.Use chara.team to replace chara.isEnemy
-2.Add chara.isEnemy()
-3.Remove Building.enemyBuildings and Building.ourBuildings, replace them by function
-4.Remove Unit.ourFlyingUnits/Unit.ourGroundUnits/Unit.enemyFlyingUnits/Unit.enemyGroundUnits, replace them by function
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 107
-Author: gloomyson
-Date: 0:12:11, 2015-11-19
-Message:
-1.Adjust TowerDefense win condition
-2.Adjust fire DragoonBall direction for fire delay
-3.Add RPG lock for some upgrades
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/Characters/Building.js
-
-Revision: 106
-Author: gloomyson
-Date: 18:05:08, 2015-11-18
-Message:
-Enrich RPG level "TowerDefense": Add new upgrades and magic, and get mines when kill enemy units
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 105
-Author: gloomyson
-Date: 1:47:54, 2015-11-18
-Message:
-1.Finish RPG level: TowerDefense
-2.Add new hero: Tassadar and HeroCruiser
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Hero.js
-Added : /StarCraft/bgm/Tassadar.death.wav
-Added : /StarCraft/bgm/Tassadar.moving.wav
-Added : /StarCraft/bgm/Tassadar.selected.wav
-Modified : /StarCraft/css/portraitStyle.css
-Modified : /StarCraft/img/Charas/HeroCruiser.png
-Added : /StarCraft/img/Charas/Tassadar.png
-
-Revision: 104
-Author: gloomyson
-Date: 18:43:18, 2015-11-16
-Message:
-New RPG level draft: Tower Defense
-----
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/css/mapStyle.css
-
-Revision: 103
-Author: gloomyson
-Date: 10:22:32, 2015-11-2
-Message:
-Add TowerDefense level (PART A)
-----
-Modified : /StarCraft/GameRule/Game.js
-Added : /StarCraft/img/Maps/(4)TowerDefense.jpg
-Modified : /StarCraft/img/Maps/Snapshot.jpg
-
-Revision: 102
-Author: gloomyson
-Date: 22:14:22, 2015-10-18
-Message:
-1.Make refreshFog as async to avoid latency
-2.Map moving trigger adjustment
-3.Add InfestTerranCommandCenter magic
-4.Fix dead lurker can still attack issue
-5.Fix strange melee attack tracing and highest priority algorithm
-6.Fix always evolveTo our units issue
-7.Adjust Tank.png
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/img/Charas/Tank.png
-
-Revision: 101
-Author: gloomyson
-Date: 19:58:26, 2015-10-5
-Message:
-1.Change Terran units to red
-2.Change Protoss units to green
-3.Update level units
-----
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/img/Charas/Tank.png
-Modified : /StarCraft/img/Charas/Arbiter.png
-Modified : /StarCraft/img/Charas/Burst.png
-Modified : /StarCraft/img/Charas/Carrier.png
-Modified : /StarCraft/img/Charas/Civilian.png
-Modified : /StarCraft/img/Charas/Corsair.png
-Modified : /StarCraft/img/Charas/DarkTemplar.png
-Modified : /StarCraft/img/Charas/Dragoon.png
-Modified : /StarCraft/img/Charas/Dropship.png
-Modified : /StarCraft/img/Charas/Firebat.png
-Modified : /StarCraft/img/Charas/Ghost.png
-Modified : /StarCraft/img/Charas/Goliath.png
-Modified : /StarCraft/img/Charas/Kerrigan.png
-Modified : /StarCraft/img/Charas/Marine.png
-Modified : /StarCraft/img/Charas/Medic.png
-Modified : /StarCraft/img/Charas/Observer.png
-Modified : /StarCraft/img/Charas/Probe.png
-Modified : /StarCraft/img/Charas/Reaver.png
-Modified : /StarCraft/img/Charas/SCV.png
-Modified : /StarCraft/img/Charas/Scout.png
-Modified : /StarCraft/img/Charas/Shuttle.png
-Modified : /StarCraft/img/Charas/Templar.png
-Modified : /StarCraft/img/Charas/Valkyrie.png
-Modified : /StarCraft/img/Charas/Vessel.png
-Modified : /StarCraft/img/Charas/Vulture.png
-Modified : /StarCraft/img/Charas/Zealot.png
-
-Revision: 100
-Author: gloomyson
-Date: 20:45:18, 2015-9-20
-Message:
-1.OnFire and Bleed effect (PART B)
-2.Adjust Terran Refinery construction sprites
-3.Can train InfestedTerran and create nuclear bomb now
-4.Adjust Drone location when start mutation
-5.Enemy units don't have confirmation sound
-6.Adjust onfire opacity
-----
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/img/Charas/ProtossBuilding.png
-Modified : /StarCraft/img/Charas/TerranBuilding.png
-
-Revision: 99
-Author: gloomyson
-Date: 18:03:19, 2015-9-18
-Message:
-1.Support build buildings (PART B)
-2.Support all kinds of evolve, like ZergBuilding/ TerranAttachment/ProtossUnitEvolve
-3.Adjust condition for enable 'unit training'/'add appendix' by building.attach attribute
-4.Prevent vibration for level selector
-5.Adjust props for Gobj.evolveTo
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/GameRule/Resource.js
-
-Revision: 98
-Author: gloomyson
-Date: 17:41:57, 2015-9-16
-Message:
-1.OnFire and Bleed (PART A)
-2.Build buildings (PART A)
-3.Add TerranBuilding.ConstructionF
-4.Join all referee tasks into Referee.tasks in main loop
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Animation.js
-
-Revision: 97
-Author: gloomyson
-Date: 18:37:15, 2015-9-12
-Message:
-Modify Gon's speech
-##### HunterXHunter #####
-Once upon a time there was a young hunter lost in strange jungle, and was warmly welcome by forest friends.
-# About 200 units in the map.
-# You have 6 random kinds of magic(Nen power), and will refresh when you killed each 50 units
-# You can use magic freely without MP consumption
-# Kill 10 units will upgrade, enemies will upgrade every 1 minute
-# Infinite enemy number and unlimited upgrade level
-# Two different mode: easy and nightmare
-# This level is designed for stress test, please report to my Github if browser crash or serious memory leak, along with your browser version and memory size
-----
-Modified : /StarCraft/GameRule/Levels.js
-
-Revision: 96
-Author: gloomyson
-Date: 17:31:23, 2015-9-12
-Message:
-1.Finish new RPG level 'HunterXHunter' for stress test
-2.Add sprite/portrait/bullet/burst/upgrade/audio for new unit DevilHunter
-3.New AI for enemy lurker
-4.Delete all portraitOffset
-5.Fix cannot recover when cloaking
-6.Stop attacking when locked down
-7.Fix enemy burrowed unit opacity issue
-8.Add new cheat "food for thought"
-9.Fix onkeyup event issue
-10.Adjust level selector opacity
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Hero.js
-Modified : /StarCraft/css/portraitStyle.css
-Modified : /StarCraft/Characters/Neutral.js
-Added : /StarCraft/bgm/DevilHunter.attack.wav
-Added : /StarCraft/bgm/DevilHunter.death.wav
-Added : /StarCraft/bgm/DevilHunter.moving.wav
-Added : /StarCraft/bgm/DevilHunter.selected.wav
-Modified : /StarCraft/img/Bg/GameStart.jpg
-Added : /StarCraft/img/Charas/DevilHunter.png
-Modified : /StarCraft/img/Charas/Mutalisk.png
-Modified : /StarCraft/img/Charas/Portrait.png
-
-Revision: 95
-Author: gloomyson
-Date: 18:19:52, 2015-9-11
-Message:
-Add new RPG level: "DemonHunter", continue...
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Hero.js
-Modified : /StarCraft/css/portraitStyle.css
-Modified : /StarCraft/img/Bg/GameStart.jpg
-
-Revision: 94
-Author: gloomyson
-Date: 12:39:48, 2015-9-11
-Message:
-1.Merge pull requests from Github
-2.Fix '#5 Two zerglings cost 25 minerals'
-3.Fix '#20 Fog disappeared as soon as characters outside screen'
-4.Fix nuclear strike cannot burst issue
-5.Give you money and magic for playing
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 93
-Author: gloomyson
-Date: 21:33:18, 2015-9-5
-Message:
-1.Add construction building and complete animation for Zerg/Terran/Protoss
-2.Add onFire or Bleed animation for Zerg/Terran/Protoss
-3.Zerg base can produce larvas every 20 seconds
-4.Change selectLarva to select its own larvas
-5.Fix refresh mud after ZergBuilding born or die
-6.Fix minor SunkenColony align issue
-7.Fix ZergBuilding portrait error issue
-8.Add building onfire audio for later use
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/css/portraitStyle.css
-Modified : /StarCraft/img/Charas/ProtossBuilding.png
-Modified : /StarCraft/img/Charas/TerranBuilding.png
-Modified : /StarCraft/Characters/Animation.js
-Added : /StarCraft/bgm/Building.onfire.wav
-Modified : /StarCraft/img/Charas/Magic.png
-Modified : /StarCraft/img/Charas/ZergBuilding.png
-
-Revision: 92
-Author: gloomyson
-Date: 0:39:15, 2015-9-2
-Message:
-1.Add Archon and DarkArchon evolve animation
-2.Change DefensiveMatrix, DisruptionWeb, MaelStorm and Feedback animation
-3.Fix Button.wav bug
-4.Delete redundant bgm and images
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Animation.js
-Modified : /StarCraft/img/Charas/Magic.png
-Deleted : /StarCraft/bgm/Devourer.hit.wav
-Deleted : /StarCraft/bgm/Dragoon.wav
-Deleted : /StarCraft/bgm/Drone.hit.wav
-Deleted : /StarCraft/bgm/Tank.hit.wav
-Deleted : /StarCraft/bgm/Tank.hit2.wav
-Deleted : /StarCraft/bgm/ZergDefense.attack.wav
-Modified : /StarCraft/img/Charas/Archon.png
-Modified : /StarCraft/img/Charas/DarkArchon.png
-Deleted : /StarCraft/img/Charas/ZergBuilding.death.png
-
-Revision: 91
-Author: gloomyson
-Date: 17:15:59, 2015-8-25
-Message:
-1.Fix onclick handler still exist when select larva issue
-2.Fix not select egg when larva evolve issue
-3.Support unsubscribe topic in gFrame
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Button.js
-
-Revision: 90
-Author: gloomyson
-Date: 22:49:33, 2015-8-24
-Message:
-1.Add _$.hitch function
-2.Update all magic callback to use _$.hitch
-3.Fix minor magic sound issue
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-
-Revision: 89
-Author: gloomyson
-Date: 1:35:53, 2015-8-24
-Message:
-1.Support Zerg egg and cocoon evolve
-2.Add Larva, can walkaround but cannot be controlled, Larva produce and SelectLarva not complete
-3.Fix no border-image issue on Firefox and IE11
-4.Fix red border color issue on IE11
-5.Building and Unit support multi hidden frames
-6.Support noMud,birthCount,source,portrait
-7.Support Gobj initial position by props.target
-8.Delete old born hidden frames
-9.Add Gobj.prototype.evolveTo
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/css/portraitStyle.css
-Added : /StarCraft/bgm/Cocoon.selected.wav
-Added : /StarCraft/bgm/Egg.death.wav
-Added : /StarCraft/bgm/Egg.selected.wav
-Added : /StarCraft/bgm/Larva.death.wav
-Added : /StarCraft/bgm/Larva.moving.wav
-Added : /StarCraft/bgm/Larva.selected.wav
-Added : /StarCraft/img/Charas/Larva.png
-
-Revision: 88
-Author: gloomyson
-Date: 18:45:56, 2015-8-21
-Message:
-1.Finish multi-inherit in gFrame
-2.Add _$.delegate into gFrame, can use for add buffer and multi-inherit
-3.Change ArchonBurst to attackEffect, adjust Archon attack frames
-4.Add Cheat.execute to execute cheat code directly
-5.Add cheat code "power overwhelming"
-6.Apply cheat "something for nothing" in some levels for testing
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Burst.js
-
-Revision: 87
-Author: gloomyson
-Date: 5:32:42, 2015-8-17
-Message:
-1.Magic burrow and unburrow complete
-2.Evolve animation when born
-3.Support building AOE attack
-4.All units having same magic can spell in same time
-5.Support hidden frames in unit
-6.Support attackable building attack chosen target
-7.Change to alpha 0 for invisible enemy
-8.Change all instaceofAttackableUnit to .attack
-9.Add evolve and burrow frames into some unit png
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/img/Charas/Archon.png
-Modified : /StarCraft/img/Charas/DarkArchon.png
-Added : /StarCraft/bgm/Lurker.burrow.wav
-Added : /StarCraft/bgm/Zerg.burrow.wav
-Added : /StarCraft/bgm/Zerg.unburrow.wav
-Modified : /StarCraft/img/Charas/Devourer.png
-Modified : /StarCraft/img/Charas/Drone.png
-Modified : /StarCraft/img/Charas/Guardian.png
-Modified : /StarCraft/img/Charas/Hydralisk.png
-Modified : /StarCraft/img/Charas/InfestedTerran.png
-Modified : /StarCraft/img/Charas/Lurker.png
-Modified : /StarCraft/img/Charas/Zergling.png
-
-Revision: 86
-Author: gloomyson
-Date: 17:59:36, 2015-8-13
-Message:
-1.Add fire bullet delay for dragoon and photon cannon
-2.Fix multiple bursts issue when killed
-3.Enhance _$() to support [filter] in selector
-4.Fix cancel button cannot work
-5.Adjust frames for dragoon and photon cannon
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Protoss.js
-
-Revision: 85
-Author: gloomyson
-Date: 21:34:42, 2015-8-12
-Message:
-1.Clean inherit method complete
-2.Change _$.extends and _$.declare to support multiple inherit (temp)
-3.Add publish and subscribe topic in gFrame
-4.Adjust some magic effect and levels
-5.Format index.html
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Magic.js
-
-Revision: 84
-Author: gloomyson
-Date: 14:52:21, 2015-8-7
-Message:
-1.Add loop reference warning into my Dojo algorithms
-2.Adjust attack frames and bullet frames setting for Marine and Firebat
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Terran.js
-
-Revision: 83
-Author: gloomyson
-Date: 0:16:47, 2015-8-7
-Message:
-Adjust my Dojo algorithm:
-1.Resolve loop reference
-2.Resolve duplicate script file loading
-3.Correct factory OR instance recognize method
-4.Support declare arguments length==2
-----
-Modified : /StarCraft/Utils/gFrame.js
-
-Revision: 82
-Author: gloomyson
-Date: 12:21:53, 2015-8-6
-Message:
-Add my algorithm for Dojo into gFrame (define/require/declare)
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Utils/sourceLoader.js
-
-Revision: 81
-Author: gloomyson
-Date: 18:24:56, 2015-8-5
-Message:
-1.Arbiter making units invisible buffer
-2.Detector making units visible buffer
-3.Magic ScannerSweep complete
-4.Basic _$() selector function complete
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/Characters/Animation.js
-
-Revision: 80
-Author: gloomyson
-Date: 1:28:49, 2015-8-5
-Message:
-1.Pay bill postpone by creditCard mode
-2.Add ScannerSweep animation
-3.Add NuclearBomb bullet
-----
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/img/Charas/Burst.png
-Modified : /StarCraft/Characters/Animation.js
-Modified : /StarCraft/img/Charas/Magic.png
-
-Revision: 79
-Author: gloomyson
-Date: 14:30:00, 2015-8-2
-Message:
-1.Add Gobj.addBuffer and Gobj.removeBuffer for buffer override (moveTo/moveToward/attack)
-2.Add Burst.PurpleCloudSpread multiple levels buffer
-3.Fix unit holding behavior like building, use red border as mark
-4.Change Halluation instance created by temp constructor
-5.Add bullet fire in-range magic
-6.Nuclear sound and scale adjustment
-7.Fix forEach->splice bug
-8.Adjust hero magic,recover and MP
-9.Use 0.5 damage when defense larger than damage
-10.Recycle leak for routingTimer
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Hero.js
-Modified : /StarCraft/Characters/Animation.js
-Added : /StarCraft/bgm/Magic.NuclearStrike.wav
-
-Revision: 78
-Author: gloomyson
-Date: 17:18:41, 2015-7-30
-Message:
-1.Forbid shortcut key when input cheat code
-2.Complete cloak consumes magic
-3.Fix no lockdown sound issue
-4.Fix Irradiate cannot infect issue
-5.Speed up hover actions
-6.Adjust mini-map position
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/css/mapStyle.css
-
-Revision: 77
-Author: gloomyson
-Date: 18:28:44, 2015-7-29
-Message:
-1.Add magic sound effects
-2.Forbid magic sound outside screen
-----
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Burst.js
-Added : /StarCraft/bgm/Magic.Consume.wav
-Added : /StarCraft/bgm/Magic.DefensiveMatrix.wav
-Added : /StarCraft/bgm/Magic.DisruptionWeb.wav
-Added : /StarCraft/bgm/Magic.EMPShockwave.wav
-Added : /StarCraft/bgm/Magic.Ensnare.wav
-Added : /StarCraft/bgm/Magic.Feedback.wav
-Added : /StarCraft/bgm/Magic.Hallucination.wav
-Added : /StarCraft/bgm/Magic.Heal.wav
-Added : /StarCraft/bgm/Magic.Irradiate.wav
-Added : /StarCraft/bgm/Magic.Lockdown.wav
-Added : /StarCraft/bgm/Magic.MaelStorm.wav
-Added : /StarCraft/bgm/Magic.MindControl.wav
-Added : /StarCraft/bgm/Magic.OpticalFlare.wav
-Added : /StarCraft/bgm/Magic.Parasite.wav
-Added : /StarCraft/bgm/Magic.PsionicStorm.wav
-Added : /StarCraft/bgm/Magic.Recall.wav
-Added : /StarCraft/bgm/Magic.RechargeShields.wav
-Added : /StarCraft/bgm/Magic.Restoration.wav
-Added : /StarCraft/bgm/Magic.ScannerSweep.wav
-Added : /StarCraft/bgm/Magic.StasisField.wav
-Added : /StarCraft/bgm/Magic.StimPacks.wav
-Added : /StarCraft/bgm/Magic.Yamato.wav
-
-Revision: 76
-Author: gloomyson
-Date: 23:59:01, 2015-7-28
-Message:
-1.Remove noise for Hydralisk death
-2.Change alpha for StasisField
-3.Remove noise from Lockdown
-4.Add opacity for Recall
-----
-Modified : /StarCraft/img/Charas/Magic.png
-Modified : /StarCraft/img/Charas/Hydralisk.png
-
-Revision: 75
-Author: gloomyson
-Date: 18:29:10, 2015-7-28
-Message:
-1.Improve Gobj.insideSquare, magic can take effect on rect
-2.Add buffer object to store all buffers
-3.Purple cloud buffer has 9 levels
-4.Callback typed buffer end
-5.Only one time for one type buffer
-6.Improve Restoration: can stop buffer animation
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 74
-Author: gloomyson
-Date: 0:36:36, 2015-7-28
-Message:
-1.Complete all basic magics
-2.Finish purple cloud effect
-3.Finish irradiate spread
-4.Slow down disruption web animation
-5.Recover every 1 second, infoBox show integer
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Animation.js
-
-Revision: 73
-Author: gloomyson
-Date: 2:08:19, 2015-7-27
-Message:
-1.Add all animations for Magic, add Animation.js
-2.Finish part of magic
-3.Add callback to moveTo,add above,duration,autoSize,scale for burst constructor, add drawEffect function
-4.Multi select in range ones function
-5.Redraw mud after build new ZergBuildings
-6.Add cheat 'the gathering'
-7.Fix unit cannot escape from attackable building
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Map.js
-Added : /StarCraft/Characters/Animation.js
-Modified : /StarCraft/img/Charas/Magic.png
-
-Revision: 72
-Author: gloomyson
-Date: 17:27:34, 2015-7-23
-Message:
-1.Correct all cost time
-2.Optimize all for() to array.func
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-
-Revision: 71
-Author: gloomyson
-Date: 0:22:34, 2015-7-23
-Message:
-1.Complete attackableBuilding feature
-2.Add all magic into png
-3.Fix sound play outside screen issue
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/img/Charas/Burst.png
-Modified : /StarCraft/img/Charas/Magic.png
-Added : /StarCraft/bgm/Colony.attack.wav
-Added : /StarCraft/bgm/Sunken.burst.wav
-
-Revision: 70
-Author: gloomyson
-Date: 23:48:58, 2015-7-19
-Message:
-1.Add timing for build scarab and interceptor
-2.Disable attack button after bullets full\
-3.Add basic Magic.png
-----
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Protoss.js
-Added : /StarCraft/img/Charas/Magic.png
-
-Revision: 69
-Author: gloomyson
-Date: 13:53:00, 2015-7-16
-Message:
-1.Redraw multiSelection box immediately after call team and double click
-2.Sync timer of training unit or upgrading
-3.Add cheat: operation cwal
-4.Fix issue: select unit always add into team
-5.Remove tooltip timer
-6.Select sound after call team
-
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Cheat.js
-
-Revision: 68
-Author: gloomyson
-Date: 23:40:30, 2015-7-14
-Message:
-1.Finish multiSelection feature, refresh in different frequency: minor refresh and redraw
-2.Add _$.arrayEqual in gFrame
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Referee.js
-
-Revision: 67
-Author: gloomyson
-Date: 18:13:05, 2015-7-14
-Message:
-1.Add new feature: multiSelection
-2.Add array: Game.allSelected
-3.Add div.override for further use
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/css/portraitStyle.css
-
-Revision: 66
-Author: gloomyson
-Date: 17:36:50, 2015-7-13
-Message:
-1.Add magic:Heal,ActivateDefensiveMatrix,Irradiate,Hallucination,MindControl,RechargeShields
-2.Add bullet burst callback
-3.Add Bullets.SingleMissile
-4.Change Unit.isInSight to Gobj.canSee
-5.Fix 4 hallucinations issue
-6.Speed up recover
-7.Resource.paypal.call(chara,cost)
-----
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Resource.js
-
-Revision: 65
-Author: gloomyson
-Date: 13:29:38, 2015-7-13
-Message:
-1.Add new fog feature into map: main fog and mini-map fog
-2.Add click button callback frame
-3.Add magic: Parasite,SpawnBroodlings,Consume,Lockdown, Restoration,OpticalFlare,Yamato with no animation effect
-4.Set timer for button tooltip
-5.Add bullet with fixed damage
-6.Add callback on reach destination in navigation
-7.Adjust drawImage performance for removing float position
-8.Enrich getSelectedOne function with different types filter
-9.Fix neutral creature has no sight issue
-10.Cheat: 'black sheep wall', disable and enable fog
-11.Need refresh after cheat enabled
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/Characters/Neutral.js
-
-Revision: 64
-Author: gloomyson
-Date: 2:04:11, 2015-7-10
-Message:
-1.Add upgraded box
-2.Fix new building position bug
-3.Add cost time for Corsair
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-
-Revision: 63
-Author: gloomyson
-Date: 18:12:52, 2015-7-9
-Message:
-1.Add feature:processing box
-2.Add building time for all charas
-3.Add upgrade sound effect
-4.Move all sound effect to Referee
-5.Set favicon.ico as shortcut icon
-6.Remove sound.js
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/GameRule/Resource.js
-Deleted : /StarCraft/Utils/sound.js
-Added : /StarCraft/bgm/upgrade.Protoss.wav
-Added : /StarCraft/bgm/upgrade.Terran.wav
-Added : /StarCraft/bgm/upgrade.Zerg.wav
-Modified : /StarCraft/favicon.ico
-Modified : /StarCraft/img/Menu/Thingy.png
-
-Revision: 62
-Author: gloomyson
-Date: 19:13:34, 2015-7-5
-Message:
-1.Optimize shape for ZergBuilding's mud
-2.Can create Building
-3.Add cost and tooltip
-4.Create resource payment system
-5.Optimize attack priority
-6.Click button sound, advisor mine/gas/man/magic sound
-7.Initial magic as 50
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Added : /StarCraft/GameRule/Resource.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/img/Menu/Thingy.png
-Added : /StarCraft/bgm/Button.wav
-Added : /StarCraft/bgm/gas.Protoss.wav
-Added : /StarCraft/bgm/gas.Terran.wav
-Added : /StarCraft/bgm/gas.Zerg.wav
-Added : /StarCraft/bgm/magic.Protoss.wav
-Added : /StarCraft/bgm/magic.Terran.wav
-Added : /StarCraft/bgm/magic.Zerg.wav
-Added : /StarCraft/bgm/man.Protoss.wav
-Added : /StarCraft/bgm/man.Terran.wav
-Added : /StarCraft/bgm/man.Zerg.wav
-Added : /StarCraft/bgm/mine.Protoss.wav
-Added : /StarCraft/bgm/mine.Terran.wav
-Added : /StarCraft/bgm/mine.Zerg.wav
-Modified : /StarCraft/img/Charas/Mud.png
-
-Revision: 61
-Author: gloomyson
-Date: 17:42:23, 2015-7-3
-Message:
-Add mud drawing for ZergBuilding on backCxt
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Map.js
-Added : /StarCraft/img/Charas/Mud.png
-
-Revision: 60
-Author: gloomyson
-Date: 13:16:03, 2015-7-3
-Message:
-1.Add Thingy.png to show mine,gas and man info
-2.Add cost info for unit,manPlus info for building
-3.Add cursor icos
-4.Add cheat 'Show me the money'
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Hero.js
-Added : /StarCraft/img/Menu/Thingy.png
-Modified : /StarCraft/img/Menu/cursor.ico
-Deleted : /StarCraft/img/Menu/cursor.jpg
-Added : /StarCraft/img/Menu/cursorLocating.ico
-
-Revision: 59
-Author: gloomyson
-Date: 15:19:17, 2015-7-1
-Message:
-1.Fix memory leak issue for ${}.html
-2.Fix building doesn't have portrait issue
-3.Change cheat box and message box position
-4.Fix HP color not change issue
-5.Fix target doesn't die after cheating issue
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/css/portraitStyle.css
-
-Revision: 58
-Author: gloomyson
-Date: 18:16:02, 2015-6-29
-Message:
-1.Fix hover issue
-2.Fix syntax errors: yellow warning
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/css/mapStyle.css
-
-Revision: 57
-Author: gloomyson
-Date: 1:47:33, 2015-6-29
-Message:
-1.Change panel_Info to html+css mode
-2.Fix BuildingBurst override issue
-3.Change map refresh to global event handler
-4.Add portraitStyle.css
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Burst.js
-Added : /StarCraft/css/portraitStyle.css
-Modified : /StarCraft/img/Charas/BuildingBurst.png
-Modified : /StarCraft/img/Menu/ControlPanel.png
-
-Revision: 56
-Author: gloomyson
-Date: 1:15:33, 2015-6-26
-Message:
-Remove noise from BuildingBurst.png
-----
-Modified : /StarCraft/img/Charas/BuildingBurst.png
-
-Revision: 55
-Author: gloomyson
-Date: 1:07:20, 2015-6-26
-Message:
-1.New HD animation for redExplode and blueExplode
-2.Add Game.getSelected for testing
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/img/Charas/BuildingBurst.png
-
-Revision: 54
-Author: gloomyson
-Date: 18:05:21, 2015-6-25
-Message:
-1.Adjust attack priority: Unit->Building,Near->Far,Attacked attract hatred
-2.Stop following target when miss it, won't miss if attack locked
-3.Restore 5 px margin for bottom panel
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 53
-Author: gloomyson
-Date: 1:30:29, 2015-6-25
-Message:
-1.Finish mini map monitor canvas: show unit,building and white stroke
-2.Fix map/screen convert mistake
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Map.js
-Modified : /StarCraft/css/mapStyle.css
-
-Revision: 52
-Author: gloomyson
-Date: 18:04:23, 2015-6-24
-Message:
-Fix canvas onresize handler: need bind it earlier
-----
-Modified : /StarCraft/GameRule/Game.js
-
-Revision: 51
-Author: gloomyson
-Date: 17:53:52, 2015-6-24
-Message:
-1.Canvas onresize handler
-2.Enhance extends for constructor in gFrame
-3.Fix 5 pixer border in Map.js
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Map.js
-
-Revision: 50
-Author: gloomyson
-Date: 21:52:43, 2015-6-22
-Message:
-Fullfill bullets for enemy Reaver and Carrier
-----
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Protoss.js
-
-Revision: 49
-Author: gloomyson
-Date: 21:03:27, 2015-6-22
-Message:
-1.Rewrite css for basic frame: center align, 100% screen
-2.Fix call attack when inputting
-3.Add message box
-4.Add new cheat code
-5.Remove tank png noise
-6.ChangeSeletectedTo function will select that unit
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/img/Charas/Tank.png
-
-Revision: 48
-Author: gloomyson
-Date: 16:20:02, 2015-6-19
-Message:
-1.Add cheat code inputting
-2.Fix building cannot detect bug
-3.Test basic image processing for change color by AlloyImage
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Controller/keyController.js
-Modified : /StarCraft/css/style.css
-Added : /StarCraft/GameRule/Cheat.js
-Modified : /StarCraft/Characters/Building.js
-
-Revision: 47
-Author: gloomyson
-Date: 15:52:01, 2015-6-15
-Message:
-1.Evolve unit application for click some unit buttons
-2.Remaining number display for Scarab,Interceptor and SpiderMines
-----
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/Characters/Terran.js
-
-Revision: 46
-Author: gloomyson
-Date: 19:18:34, 2015-6-14
-Message:
-1.Enrich upgrade.js by delete after click
-2.Add game clock, use it for recover
-3.Referee check collision to separate distance zero ones
-4.Can build units
-5.Referee will help kill die survivor
-6.Finish whole melee attack action then cause damage
-7.No sound from outside screen
-8.Build scarab and interceptor, then can attack
-9.Remove noise for ControlPanel and Archon
-10.Control panel style for Zerg and Protoss
-11.Fix shaking when reach attack target
-12.Basic fix for hold handler
-----
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Hero.js
-Modified : /StarCraft/Characters/Neutral.js
-Modified : /StarCraft/img/Charas/Archon.png
-Modified : /StarCraft/img/Charas/Hydralisk.png
-Modified : /StarCraft/img/Menu/ControlPanel.png
-
-Revision: 45
-Author: gloomyson
-Date: 18:14:12, 2015-6-12
-Message:
-1.Add all of basic upgrade effects
-2.Add plasma, apply and show it
-3.Add sight property and update isInSight function
-4.Adjust all moving speed
-5.Adjust detector property to true, use sight as detect radius
-6.Add magic: StimPacks
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/Characters/Upgrade.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 44
-Author: gloomyson
-Date: 23:23:49, 2015-6-11
-Message:
-1.Prepare for upgrade: property share array
-2.Fix bug overrun by adding moveToward
-----
-Modified : /StarCraft/Utils/gFrame.js
-Modified : /StarCraft/index.html
-Modified : /StarCraft/Characters/Gobj.js
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 43
-Author: gloomyson
-Date: 21:21:08, 2015-6-7
-Message:
-1.Add icons into menu for unit/building/magic/upgrade
-2.Add reference conditions for these icons
-3.Move equipButtonsFor into Button.js
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Button.js
-Modified : /StarCraft/Characters/Magic.js
-Modified : /StarCraft/css/buttonStyle.css
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Zerg.js
-Modified : /StarCraft/Characters/Protoss.js
-Modified : /StarCraft/Characters/Terran.js
-Modified : /StarCraft/Characters/Hero.js
-
-Revision: 42
-Author: gloomyson
-Date: 22:28:04, 2015-6-3
-Message:
-Completely fix bottom white line issue
-----
-Modified : /StarCraft/GameRule/Game.js
-
-Revision: 41
-Author: gloomyson
-Date: 17:52:23, 2015-6-2
-Message:
-1.Update critters name (js, png and wav)
-2.Fully fix bottom white line issue
-3.Zerg building burst changed to 18 frames
-----
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/css/style.css
-Modified : /StarCraft/Characters/Burst.js
-Modified : /StarCraft/Characters/Neutral.js
-Deleted : /StarCraft/bgm/Acritter.death.wav
-Deleted : /StarCraft/bgm/Acritter.moving.wav
-Deleted : /StarCraft/bgm/Acritter.selected.wav
-Deleted : /StarCraft/bgm/Bcritter.death.wav
-Deleted : /StarCraft/bgm/Bcritter.moving.wav
-Deleted : /StarCraft/bgm/Bcritter.selected.wav
-Added : /StarCraft/bgm/Bengalaas.death.wav (Copy from path: /StarCraft/bgm/Jcritter.death.wav, Revision, 27)
-Deleted : /StarCraft/bgm/Jcritter.death.wav
-Added : /StarCraft/bgm/Bengalaas.moving.wav (Copy from path: /StarCraft/bgm/Jcritter.moving.wav, Revision, 27)
-Deleted : /StarCraft/bgm/Jcritter.moving.wav
-Added : /StarCraft/bgm/Bengalaas.selected.wav (Copy from path: /StarCraft/bgm/Jcritter.selected.wav, Revision, 27)
-Deleted : /StarCraft/bgm/Jcritter.selected.wav
-Deleted : /StarCraft/bgm/Icritter.death.wav
-Deleted : /StarCraft/bgm/Icritter.moving.wav
-Deleted : /StarCraft/bgm/Icritter.selected.wav
-Added : /StarCraft/bgm/Kakaru.death.wav (Copy from path: /StarCraft/bgm/Scritter.death.wav, Revision, 27)
-Deleted : /StarCraft/bgm/Scritter.death.wav
-Added : /StarCraft/bgm/Kakaru.moving.wav (Copy from path: /StarCraft/bgm/Scritter.moving.wav, Revision, 27)
-Deleted : /StarCraft/bgm/Scritter.moving.wav
-Added : /StarCraft/bgm/Kakaru.selected.wav (Copy from path: /StarCraft/bgm/Scritter.selected.wav, Revision, 27)
-Deleted : /StarCraft/bgm/Scritter.selected.wav
-Deleted : /StarCraft/bgm/Kcritter.death.wav
-Deleted : /StarCraft/bgm/Kcritter.moving.wav
-Deleted : /StarCraft/bgm/Kcritter.selected.wav
-Added : /StarCraft/bgm/Ragnasaur.death.wav (Copy from path: /StarCraft/bgm/Acritter.death.wav, Revision, 27)
-Added : /StarCraft/bgm/Ragnasaur.moving.wav (Copy from path: /StarCraft/bgm/Acritter.moving.wav, Revision, 27)
-Added : /StarCraft/bgm/Ragnasaur.selected.wav (Copy from path: /StarCraft/bgm/Acritter.selected.wav, Revision, 27)
-Added : /StarCraft/bgm/Rhynsdon.death.wav (Copy from path: /StarCraft/bgm/Bcritter.death.wav, Revision, 27)
-Added : /StarCraft/bgm/Rhynsdon.moving.wav (Copy from path: /StarCraft/bgm/Bcritter.moving.wav, Revision, 27)
-Added : /StarCraft/bgm/Rhynsdon.selected.wav (Copy from path: /StarCraft/bgm/Bcritter.selected.wav, Revision, 27)
-Added : /StarCraft/bgm/Scantid.death.wav (Copy from path: /StarCraft/bgm/Kcritter.death.wav, Revision, 27)
-Added : /StarCraft/bgm/Scantid.moving.wav (Copy from path: /StarCraft/bgm/Kcritter.moving.wav, Revision, 27)
-Added : /StarCraft/bgm/Scantid.selected.wav (Copy from path: /StarCraft/bgm/Kcritter.selected.wav, Revision, 27)
-Added : /StarCraft/bgm/Ursadon.death.wav (Copy from path: /StarCraft/bgm/Icritter.death.wav, Revision, 27)
-Added : /StarCraft/bgm/Ursadon.moving.wav (Copy from path: /StarCraft/bgm/Icritter.moving.wav, Revision, 27)
-Added : /StarCraft/bgm/Ursadon.selected.wav (Copy from path: /StarCraft/bgm/Icritter.selected.wav, Revision, 27)
-Deleted : /StarCraft/img/Charas/Acritter.png
-Deleted : /StarCraft/img/Charas/Bcritter.png
-Added : /StarCraft/img/Charas/Bengalaas.png (Copy from path: /StarCraft/img/Charas/Jcritter.png, Revision, 27)
-Deleted : /StarCraft/img/Charas/Jcritter.png
-Deleted : /StarCraft/img/Charas/Icritter.png
-Added : /StarCraft/img/Charas/Kakaru.png (Copy from path: /StarCraft/img/Charas/Scritter.png, Revision, 27)
-Deleted : /StarCraft/img/Charas/Scritter.png
-Deleted : /StarCraft/img/Charas/Kcritter.png
-Added : /StarCraft/img/Charas/Ragnasaur.png (Copy from path: /StarCraft/img/Charas/Acritter.png, Revision, 27)
-Added : /StarCraft/img/Charas/Rhynsdon.png (Copy from path: /StarCraft/img/Charas/Bcritter.png, Revision, 27)
-Added : /StarCraft/img/Charas/Scantid.png (Copy from path: /StarCraft/img/Charas/Kcritter.png, Revision, 27)
-Added : /StarCraft/img/Charas/Ursadon.png (Copy from path: /StarCraft/img/Charas/Icritter.png, Revision, 27)
-
-Revision: 40
-Author: gloomyson
-Date: 0:37:50, 2015-6-1
-Message:
-1.Add building burst animation
-2.Fix control panel buttom line
-3.Support building detector
-4.Fix AOE attack building
-5.Fix melee cannot attack
-6.Move can cancel holding
-7.Adjust level design
-
-----
-Modified : /StarCraft/Characters/Units.js
-Modified : /StarCraft/GameRule/Game.js
-Modified : /StarCraft/GameRule/Levels.js
-Modified : /StarCraft/Characters/Bullets.js
-Modified : /StarCraft/Controller/mouseController.js
-Modified : /StarCraft/GameRule/Referee.js
-Modified : /StarCraft/Characters/Building.js
-Modified : /StarCraft/Characters/Burst.js
-Added : /StarCraft/img/Charas/BuildingBurst.png
-Modified : /StarCraft/img/Menu/ControlPanel.png
-
diff --git a/conf/browsersync-dist.conf.js b/conf/browsersync-dist.conf.js
new file mode 100644
index 0000000..fa45845
--- /dev/null
+++ b/conf/browsersync-dist.conf.js
@@ -0,0 +1,12 @@
+const conf = require('./gulp.conf');
+
+module.exports = function () {
+ return {
+ server: {
+ baseDir: [
+ conf.paths.dist
+ ]
+ },
+ open: false
+ };
+};
diff --git a/conf/browsersync.conf.js b/conf/browsersync.conf.js
new file mode 100644
index 0000000..49936d4
--- /dev/null
+++ b/conf/browsersync.conf.js
@@ -0,0 +1,13 @@
+const conf = require('./gulp.conf');
+
+module.exports = function () {
+ return {
+ server: {
+ baseDir: [
+ conf.paths.tmp,
+ conf.paths.src
+ ]
+ },
+ open: false
+ };
+};
diff --git a/conf/gulp.conf.js b/conf/gulp.conf.js
new file mode 100644
index 0000000..31a6a9b
--- /dev/null
+++ b/conf/gulp.conf.js
@@ -0,0 +1,52 @@
+'use strict';
+
+/**
+ * This file contains the variables used in other gulp files
+ * which defines tasks
+ * By design, we only put there very generic config values
+ * which are used in several places to keep good readability
+ * of the tasks
+ */
+
+const path = require('path');
+const gutil = require('gulp-util');
+
+/**
+ * The main paths of your project handle these with care
+ */
+exports.paths = {
+ src: 'src',
+ dist: 'dist',
+ tmp: '.tmp',
+ e2e: 'e2e',
+ tasks: 'gulp_tasks'
+};
+
+/**
+* used on gulp dist
+*/
+exports.htmlmin = {
+ ignoreCustomFragments: [/{{.*?}}/]
+};
+
+exports.path = {};
+for (const pathName in exports.paths) {
+ if (Object.prototype.hasOwnProperty.call(exports.paths, pathName)) {
+ exports.path[pathName] = function () {
+ const pathValue = exports.paths[pathName];
+ const funcArgs = Array.prototype.slice.call(arguments);
+ const joinArgs = [pathValue].concat(funcArgs);
+ return path.join.apply(this, joinArgs);
+ };
+ }
+}
+
+/**
+ * Common implementation for an error handler of a Gulp plugin
+ */
+exports.errorHandler = function (title) {
+ return function (err) {
+ gutil.log(gutil.colors.red(`[${title}]`), err.toString());
+ this.emit('end');
+ };
+};
diff --git a/conf/karma-auto.conf.js b/conf/karma-auto.conf.js
new file mode 100644
index 0000000..c665d66
--- /dev/null
+++ b/conf/karma-auto.conf.js
@@ -0,0 +1,46 @@
+const conf = require('./gulp.conf');
+
+module.exports = function (config) {
+ const configuration = {
+ basePath: '../',
+ singleRun: false,
+ autoWatch: true,
+ logLevel: 'INFO',
+ junitReporter: {
+ outputDir: 'test-reports'
+ },
+ browsers: [
+ 'Chrome'
+ ],
+ frameworks: [
+ 'jasmine'
+ ],
+ files: [
+ 'node_modules/es6-shim/es6-shim.js',
+ conf.path.src('index.spec.js')
+ ],
+ preprocessors: {
+ [conf.path.src('index.spec.js')]: [
+ 'webpack'
+ ]
+ },
+ reporters: ['progress', 'coverage'],
+ coverageReporter: {
+ type: 'html',
+ dir: 'coverage/'
+ },
+ webpack: require('./webpack-test.conf'),
+ webpackMiddleware: {
+ noInfo: true
+ },
+ plugins: [
+ require('karma-jasmine'),
+ require('karma-junit-reporter'),
+ require('karma-coverage'),
+ require('karma-chrome-launcher'),
+ require('karma-webpack')
+ ]
+ };
+
+ config.set(configuration);
+};
diff --git a/conf/karma.conf.js b/conf/karma.conf.js
new file mode 100644
index 0000000..38ad80b
--- /dev/null
+++ b/conf/karma.conf.js
@@ -0,0 +1,46 @@
+const conf = require('./gulp.conf');
+
+module.exports = function (config) {
+ const configuration = {
+ basePath: '../',
+ singleRun: true,
+ autoWatch: false,
+ logLevel: 'INFO',
+ junitReporter: {
+ outputDir: 'test-reports'
+ },
+ browsers: [
+ 'Chrome'
+ ],
+ frameworks: [
+ 'jasmine'
+ ],
+ files: [
+ 'node_modules/es6-shim/es6-shim.js',
+ conf.path.src('index.spec.js')
+ ],
+ preprocessors: {
+ [conf.path.src('index.spec.js')]: [
+ 'webpack'
+ ]
+ },
+ reporters: ['progress', 'coverage'],
+ coverageReporter: {
+ type: 'html',
+ dir: 'coverage/'
+ },
+ webpack: require('./webpack-test.conf'),
+ webpackMiddleware: {
+ noInfo: true
+ },
+ plugins: [
+ require('karma-jasmine'),
+ require('karma-junit-reporter'),
+ require('karma-coverage'),
+ require('karma-chrome-launcher'),
+ require('karma-webpack')
+ ]
+ };
+
+ config.set(configuration);
+};
diff --git a/conf/webpack-dist.conf.js b/conf/webpack-dist.conf.js
new file mode 100644
index 0000000..90acdd7
--- /dev/null
+++ b/conf/webpack-dist.conf.js
@@ -0,0 +1,93 @@
+const webpack = require('webpack');
+const conf = require('./gulp.conf');
+const path = require('path');
+
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const FailPlugin = require('webpack-fail-plugin');
+const ExtractTextPlugin = require('extract-text-webpack-plugin');
+const autoprefixer = require('autoprefixer');
+
+module.exports = {
+ module: {
+ loaders: [
+ {
+ test: /\.json$/,
+ loaders: [
+ 'json-loader'
+ ]
+ },
+ {
+ test: /\.ts$/,
+ exclude: /node_modules/,
+ loader: 'tslint-loader',
+ enforce: 'pre'
+ },
+ {
+ test: /\.(css|scss)$/,
+ loaders: ExtractTextPlugin.extract({
+ fallback: 'style-loader',
+ use: 'css-loader?minimize!sass-loader!postcss-loader'
+ })
+ },
+ {
+ test: /\.ts$/,
+ exclude: /node_modules/,
+ loaders: [
+ 'ts-loader'
+ ]
+ },
+ {
+ test: /\.html$/,
+ loaders: [
+ 'html-loader'
+ ]
+ }
+ ]
+ },
+ plugins: [
+ new webpack.optimize.OccurrenceOrderPlugin(),
+ new webpack.NoEmitOnErrorsPlugin(),
+ FailPlugin,
+ new HtmlWebpackPlugin({
+ template: conf.path.src('index.html')
+ }),
+ new webpack.ContextReplacementPlugin(
+ /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
+ conf.paths.src
+ ),
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': '"production"'
+ }),
+ new webpack.optimize.UglifyJsPlugin({
+ output: {comments: false},
+ compress: {unused: true, dead_code: true, warnings: false} // eslint-disable-line camelcase
+ }),
+ new ExtractTextPlugin('index-[contenthash].css'),
+ new webpack.optimize.CommonsChunkPlugin({name: 'vendor'}),
+ new webpack.LoaderOptionsPlugin({
+ options: {
+ postcss: () => [autoprefixer],
+ resolve: {},
+ ts: {
+ configFileName: 'tsconfig.json'
+ },
+ tslint: {
+ configuration: require('../tslint.json')
+ }
+ }
+ })
+ ],
+ output: {
+ path: path.join(process.cwd(), conf.paths.dist),
+ filename: '[name]-[hash].js'
+ },
+ resolve: {
+ extensions: [
+ '.webpack.js',
+ '.web.js',
+ '.js',
+ '.ts'
+ ]
+ },
+ entry: `./${conf.path.src('index')}`
+};
diff --git a/conf/webpack-test.conf.js b/conf/webpack-test.conf.js
new file mode 100644
index 0000000..032da00
--- /dev/null
+++ b/conf/webpack-test.conf.js
@@ -0,0 +1,60 @@
+const webpack = require('webpack');
+const conf = require('./gulp.conf');
+module.exports = {
+ module: {
+ loaders: [
+ {
+ test: /\.json$/,
+ loaders: [
+ 'json-loader'
+ ]
+ },
+ {
+ test: /\.ts$/,
+ exclude: /node_modules/,
+ loader: 'tslint-loader',
+ enforce: 'pre'
+ },
+ {
+ test: /\.ts$/,
+ exclude: /node_modules/,
+ loaders: [
+ 'ts-loader'
+ ]
+ },
+ {
+ test: /\.html$/,
+ loaders: [
+ 'html-loader'
+ ]
+ }
+ ]
+ },
+ plugins: [
+ new webpack.ContextReplacementPlugin(
+ /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
+ conf.paths.src
+ ),
+ new webpack.LoaderOptionsPlugin({
+ options: {
+ resolve: {},
+ ts: {
+ configFileName: 'tsconfig.json'
+ },
+ tslint: {
+ configuration: require('../tslint.json')
+ }
+ },
+ debug: true
+ })
+ ],
+ devtool: 'source-map',
+ resolve: {
+ extensions: [
+ '.webpack.js',
+ '.web.js',
+ '.js',
+ '.ts'
+ ]
+ }
+};
diff --git a/conf/webpack.conf.js b/conf/webpack.conf.js
new file mode 100644
index 0000000..4e35c2a
--- /dev/null
+++ b/conf/webpack.conf.js
@@ -0,0 +1,87 @@
+const webpack = require('webpack');
+const conf = require('./gulp.conf');
+const path = require('path');
+
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const FailPlugin = require('webpack-fail-plugin');
+const autoprefixer = require('autoprefixer');
+
+module.exports = {
+ module: {
+ loaders: [
+ {
+ test: /\.json$/,
+ loaders: [
+ 'json-loader'
+ ]
+ },
+ {
+ test: /\.ts$/,
+ exclude: /node_modules/,
+ loader: 'tslint-loader',
+ enforce: 'pre'
+ },
+ {
+ test: /\.(css|scss)$/,
+ loaders: [
+ 'style-loader',
+ 'css-loader',
+ 'sass-loader',
+ 'postcss-loader'
+ ]
+ },
+ {
+ test: /\.ts$/,
+ exclude: /node_modules/,
+ loaders: [
+ 'ts-loader'
+ ]
+ },
+ {
+ test: /\.html$/,
+ loaders: [
+ 'html-loader'
+ ]
+ }
+ ]
+ },
+ plugins: [
+ new webpack.optimize.OccurrenceOrderPlugin(),
+ new webpack.NoEmitOnErrorsPlugin(),
+ FailPlugin,
+ new HtmlWebpackPlugin({
+ template: conf.path.src('index.html')
+ }),
+ new webpack.ContextReplacementPlugin(
+ /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
+ conf.paths.src
+ ),
+ new webpack.LoaderOptionsPlugin({
+ options: {
+ postcss: () => [autoprefixer],
+ resolve: {},
+ ts: {
+ configFileName: 'tsconfig.json'
+ },
+ tslint: {
+ configuration: require('../tslint.json')
+ }
+ },
+ debug: true
+ })
+ ],
+ devtool: 'source-map',
+ output: {
+ path: path.join(process.cwd(), conf.paths.tmp),
+ filename: 'index.js'
+ },
+ resolve: {
+ extensions: [
+ '.webpack.js',
+ '.web.js',
+ '.js',
+ '.ts'
+ ]
+ },
+ entry: `./${conf.path.src('index')}`
+};
diff --git a/gulp_tasks/browsersync.js b/gulp_tasks/browsersync.js
new file mode 100644
index 0000000..945a88d
--- /dev/null
+++ b/gulp_tasks/browsersync.js
@@ -0,0 +1,21 @@
+const gulp = require('gulp');
+const browserSync = require('browser-sync');
+const spa = require('browser-sync-spa');
+
+const browserSyncConf = require('../conf/browsersync.conf');
+const browserSyncDistConf = require('../conf/browsersync-dist.conf');
+
+browserSync.use(spa());
+
+gulp.task('browsersync', browserSyncServe);
+gulp.task('browsersync:dist', browserSyncDist);
+
+function browserSyncServe(done) {
+ browserSync.init(browserSyncConf());
+ done();
+}
+
+function browserSyncDist(done) {
+ browserSync.init(browserSyncDistConf());
+ done();
+}
diff --git a/gulp_tasks/karma.js b/gulp_tasks/karma.js
new file mode 100644
index 0000000..98aaf1d
--- /dev/null
+++ b/gulp_tasks/karma.js
@@ -0,0 +1,27 @@
+process.env.NODE_ENV = 'test';
+
+const path = require('path');
+
+const gulp = require('gulp');
+const karma = require('karma');
+
+gulp.task('karma:single-run', karmaSingleRun);
+gulp.task('karma:auto-run', karmaAutoRun);
+
+function karmaFinishHandler(done) {
+ return failCount => {
+ done(failCount ? new Error(`Failed ${failCount} tests.`) : null);
+ };
+}
+
+function karmaSingleRun(done) {
+ const configFile = path.join(process.cwd(), 'conf', 'karma.conf.js');
+ const karmaServer = new karma.Server({configFile}, karmaFinishHandler(done));
+ karmaServer.start();
+}
+
+function karmaAutoRun(done) {
+ const configFile = path.join(process.cwd(), 'conf', 'karma-auto.conf.js');
+ const karmaServer = new karma.Server({configFile}, karmaFinishHandler(done));
+ karmaServer.start();
+}
diff --git a/gulp_tasks/misc.js b/gulp_tasks/misc.js
new file mode 100644
index 0000000..6cc14bc
--- /dev/null
+++ b/gulp_tasks/misc.js
@@ -0,0 +1,25 @@
+const path = require('path');
+
+const gulp = require('gulp');
+const del = require('del');
+const filter = require('gulp-filter');
+
+const conf = require('../conf/gulp.conf');
+
+gulp.task('clean', clean);
+gulp.task('other', other);
+
+function clean() {
+ return del([conf.paths.dist, conf.paths.tmp]);
+}
+
+function other() {
+ const fileFilter = filter(file => file.stat.isFile());
+
+ return gulp.src([
+ path.join(conf.paths.src, '/**/*'),
+ path.join(`!${conf.paths.src}`, '/**/*.{scss,ts,html}')
+ ])
+ .pipe(fileFilter)
+ .pipe(gulp.dest(conf.paths.dist));
+}
diff --git a/gulp_tasks/webpack.js b/gulp_tasks/webpack.js
new file mode 100644
index 0000000..ec8e8b1
--- /dev/null
+++ b/gulp_tasks/webpack.js
@@ -0,0 +1,49 @@
+const gulp = require('gulp');
+const gutil = require('gulp-util');
+
+const webpack = require('webpack');
+const webpackConf = require('../conf/webpack.conf');
+const webpackDistConf = require('../conf/webpack-dist.conf');
+const gulpConf = require('../conf/gulp.conf');
+const browsersync = require('browser-sync');
+
+gulp.task('webpack:dev', done => {
+ webpackWrapper(false, webpackConf, done);
+});
+
+gulp.task('webpack:watch', done => {
+ webpackWrapper(true, webpackConf, done);
+});
+
+gulp.task('webpack:dist', done => {
+ process.env.NODE_ENV = 'production';
+ webpackWrapper(false, webpackDistConf, done);
+});
+
+function webpackWrapper(watch, conf, done) {
+ const webpackBundler = webpack(conf);
+
+ const webpackChangeHandler = (err, stats) => {
+ if (err) {
+ gulpConf.errorHandler('Webpack')(err);
+ }
+ gutil.log(stats.toString({
+ colors: true,
+ chunks: false,
+ hash: false,
+ version: false
+ }));
+ if (done) {
+ done();
+ done = null;
+ } else {
+ browsersync.reload();
+ }
+ };
+
+ if (watch) {
+ webpackBundler.watch(200, webpackChangeHandler);
+ } else {
+ webpackBundler.run(webpackChangeHandler);
+ }
+}
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..541d6e4
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,29 @@
+const gulp = require('gulp');
+const HubRegistry = require('gulp-hub');
+const browserSync = require('browser-sync');
+
+const conf = require('./conf/gulp.conf');
+
+// Load some files into the registry
+const hub = new HubRegistry([conf.path.tasks('*.js')]);
+
+// Tell gulp to use the tasks just loaded
+gulp.registry(hub);
+
+gulp.task('build', gulp.series(gulp.parallel('other', 'webpack:dist')));
+gulp.task('test', gulp.series('karma:single-run'));
+gulp.task('test:auto', gulp.series('karma:auto-run'));
+gulp.task('serve', gulp.series('webpack:watch', 'watch', 'browsersync'));
+gulp.task('serve:dist', gulp.series('default', 'browsersync:dist'));
+gulp.task('default', gulp.series('clean', 'build'));
+gulp.task('watch', watch);
+
+function reloadBrowserSync(cb) {
+ browserSync.reload();
+ cb();
+}
+
+function watch(done) {
+ gulp.watch(conf.path.tmp('index.html'), reloadBrowserSync);
+ done();
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..5f40d2e
--- /dev/null
+++ b/package.json
@@ -0,0 +1,76 @@
+{
+ "dependencies": {
+ "@angular/core": "^2.4.8",
+ "@angular/compiler": "^2.4.8",
+ "@angular/common": "^2.4.8",
+ "@angular/platform-browser": "^2.4.8",
+ "@angular/platform-browser-dynamic": "^2.4.8",
+ "@angular/http": "^2.4.8",
+ "rxjs": "5.1.1",
+ "zone.js": "^0.7.7",
+ "core-js": "^2.4.1",
+ "@angular/router": "^3.4.8"
+ },
+ "devDependencies": {
+ "@types/es6-shim": "^0.31.32",
+ "@types/jasmine": "^2.5.43",
+ "@types/jquery": "^2.0.40",
+ "@types/node": "^7.0.5",
+ "autoprefixer": "^6.7.3",
+ "babel-eslint": "^7.1.1",
+ "babel-loader": "^6.3.2",
+ "browser-sync": "^2.18.8",
+ "browser-sync-spa": "^1.0.3",
+ "css-loader": "^0.26.1",
+ "del": "^2.2.2",
+ "es6-shim": "^0.35.3",
+ "eslint": "^3.15.0",
+ "eslint-config-xo-space": "^0.15.0",
+ "eslint-loader": "^1.6.1",
+ "eslint-plugin-babel": "^4.0.1",
+ "extract-text-webpack-plugin": "^2.0.0-rc.3",
+ "gulp": "gulpjs/gulp#4ed9a4a3275559c73a396eff7e1fde3824951ebb",
+ "gulp-filter": "^5.0.0",
+ "gulp-hub": "frankwallis/gulp-hub#d461b9c700df9010d0a8694e4af1fb96d9f38bf4",
+ "gulp-sass": "^3.1.0",
+ "gulp-util": "^3.0.8",
+ "html-loader": "^0.4.4",
+ "html-webpack-plugin": "^2.28.0",
+ "jasmine": "^2.5.3",
+ "json-loader": "^0.5.4",
+ "karma": "^1.4.1",
+ "karma-chrome-launcher": "^2.0.0",
+ "karma-coverage": "^1.1.1",
+ "karma-jasmine": "^1.1.0",
+ "karma-junit-reporter": "^1.2.0",
+ "karma-webpack": "^2.0.2",
+ "node-sass": "^4.5.0",
+ "postcss-loader": "^1.3.1",
+ "sass-loader": "^6.0.1",
+ "style-loader": "^0.13.1",
+ "ts-loader": "^2.0.0",
+ "tslint": "^4.4.2",
+ "tslint-loader": "^3.4.2",
+ "typescript": "^2.1.0",
+ "webpack": "^2.2.1",
+ "webpack-fail-plugin": "^1.0.5"
+ },
+ "scripts": {
+ "build": "gulp",
+ "serve": "gulp serve",
+ "serve:dist": "gulp serve:dist",
+ "test": "gulp test",
+ "test:auto": "gulp test:auto"
+ },
+ "eslintConfig": {
+ "root": true,
+ "env": {
+ "browser": true,
+ "jasmine": true
+ },
+ "parser": "babel-eslint",
+ "extends": [
+ "xo-space/esnext"
+ ]
+ }
+}
diff --git a/Characters/Animation.ts b/src/Characters/Animation.ts
similarity index 100%
rename from Characters/Animation.ts
rename to src/Characters/Animation.ts
diff --git a/Characters/Building.ts b/src/Characters/Building.ts
similarity index 99%
rename from Characters/Building.ts
rename to src/Characters/Building.ts
index 5de0f52..37a86ff 100644
--- a/Characters/Building.ts
+++ b/src/Characters/Building.ts
@@ -1,4 +1,4 @@
-var Building=Gobj.extends({
+class Building extends Gobj {
constructorPlus:function(props){
//Add id for building
this.id=Unit.currentID++;
diff --git a/Characters/Bullets.ts b/src/Characters/Bullets.ts
similarity index 100%
rename from Characters/Bullets.ts
rename to src/Characters/Bullets.ts
diff --git a/Characters/Burst.ts b/src/Characters/Burst.ts
similarity index 100%
rename from Characters/Burst.ts
rename to src/Characters/Burst.ts
diff --git a/Characters/Button.ts b/src/Characters/Button.ts
similarity index 100%
rename from Characters/Button.ts
rename to src/Characters/Button.ts
diff --git a/src/Characters/Gobj.ts b/src/Characters/Gobj.ts
new file mode 100644
index 0000000..fad304c
--- /dev/null
+++ b/src/Characters/Gobj.ts
@@ -0,0 +1,270 @@
+import { Game } from '../GameRule/Game';
+import {Map} from './Map';
+//Gobj is original object used in StarCraft
+export class Gobj {
+
+ function(props) {
+ this.x = props.x;
+ this.y = props.y;
+ if (props.target instanceof Gobj) {
+ this.x = (props.target.posX() - this.width / 2) >> 0;
+ this.y = (props.target.posY() - this.height / 2) >> 0;
+ }
+ this.action = 0;//Only for moving
+ this.status = "";
+ this.buffer = {};//Buffer names
+ this.override = {};//Buffer effects
+ this.bufferObjs = [];
+ this.allFrames = {};
+ this.team = props.team ? props.team : 0;//team 0 by default
+ };
+
+ //Default value used if not initialize properly
+ name = "Gobj";
+ width = 0;
+ height = 0;
+
+ isEnemy = function () {
+ return this.team != Game.team;
+ };
+ posX = function () {
+ return this.x + this.width / 2;
+ };
+ posY = function () {
+ return this.y + this.height / 2;
+ };
+ imgPos = {
+ moving: {
+ left: [0, 0, 0, 0, 0, 0, 0, 0],
+ top: [0, 0, 0, 0, 0, 0, 0, 0]
+ }
+ };
+ //Only for moving
+ frame = {
+ moving: 1
+ };
+ //Better only for moving
+ speed = { x: 0, y: 0 };
+
+ //Basic behaviors
+ detectOutOfBound = function () {
+ //Do nothing here
+ };
+ //Only for moving
+ updateLocation = function () {
+ //Override here
+ };
+ animeFrame = function () {
+ //Animation play
+ this.action++;
+ if (this.action >= this.frame[this.status]) {
+ this.action = 0;
+ }
+ };
+ moving = function () {
+ //Clear old timer
+ this.stop();
+ //Launch new moving timer
+ this.status = "moving";
+ var myself = this;
+ var movingFrame = function () {
+ myself.animeFrame();
+ //Relocate character
+ myself.updateLocation();
+ //Detect OutOfBound
+ myself.detectOutOfBound();
+ };
+ this.allFrames['moving'] = movingFrame;
+ var animateFrame = function () {
+ //Only play animation, will not move
+ myself.animeFrame();
+ };
+ this.allFrames['animate'] = animateFrame;
+ };
+ stop = function () {
+ //Clear both kinds of timer
+ delete this.allFrames['moving'];
+ delete this.allFrames['dock'];
+ delete this.allFrames['animate'];
+ };
+ playFrames = function () {
+ var frames = this.allFrames;
+ for (var type in frames) {
+ frames[type]();
+ }
+ };
+ die = function () {
+ //Clear old timer
+ this.stop();
+ this.status = "dead";
+ this.action = 0;
+ //If has die animation
+ if (this.dieEffect) {
+ new this.dieEffect({ x: this.posX(), y: this.posY() });
+ }
+ };
+ include = function (obj) {
+ return (obj.posY() > this.y) && (obj.posY() < this.y + this.height) && (obj.posX() > this.x) && (obj.posX() < this.x + this.width);
+ };
+ includePoint = function (x, y) {
+ return (y > this.y) && (y < this.y + this.height) && (x > this.x) && (x < this.x + this.width);
+ };
+ //rect={centerX:?,centerY:?,radius:?} or {centerX:?,centerY:?,radius:[?,?]}
+ insideSquare = function (rect) {
+ if (rect.radius instanceof Array)
+ return Math.abs(rect.centerX - this.posX()) < rect.radius[0] && Math.abs(rect.centerY - this.posY()) < rect.radius[1];
+ else return Math.abs(rect.centerX - this.posX()) < rect.radius && Math.abs(rect.centerY - this.posY()) < rect.radius;
+ };
+ //rect={start:{x:?,y:?},end:{x:?,y:?}}
+ insideRect = function (rect) {
+ return (this.posX() > rect.start.x) && (this.posX() < rect.end.x) &&
+ (this.posY() > rect.start.y) && (this.posY() < rect.end.y);
+ };
+
+ //circle={centerX:?,centerY:?,radius:?}
+ insideCircle = function (circle) {
+ return Math.pow(circle.centerX - this.posX(), 2) + Math.pow(circle.centerY - this.posY(), 2) < Math.pow(circle.radius, 2);
+ };
+ //Default is circle mode
+ inside = insideCircle;
+ //Radius
+ radius = function () {
+ return (this.width < this.height) ? (this.width / 2) : (this.height / 2);//Math.min
+ };
+ //Distance
+ distanceFrom = function (obj) {
+ if (obj instanceof Gobj) {
+ return Math.pow((this.posX() - obj.posX()) * (this.posX() - obj.posX()) +
+ (this.posY() - obj.posY()) * (this.posY() - obj.posY()), 0.5);
+ }
+ else {
+ return Math.pow((this.posX() - obj.x) * (this.posX() - obj.x) +
+ (this.posY() - obj.y) * (this.posY() - obj.y), 0.5);
+ }
+ };
+ insideScreen = function () {
+ return ((this.x + this.width) > Map.offsetX) && (this.x < (Map.offsetX + Game.HBOUND))
+ && ((this.y + this.height) > Map.offsetY) && (this.y < (Map.offsetY + Game.VBOUND));
+ };
+ sightInsideScreen = function () {
+ return ((this.x + this.width) > (Map.offsetX - this.get('sight'))) && (this.x < (Map.offsetX + Game.HBOUND + this.get('sight')))
+ && ((this.y + this.height) > (Map.offsetY - this.get('sight'))) && (this.y < (Map.offsetY + Game.VBOUND + this.get('sight')));
+ };
+ softCollideWith = function (chara, N) {
+ if (N == null) N = 1;
+ //Twice radius of hard collision
+ return chara.insideSquare({ centerX: this.posX(), centerY: this.posY(), radius: [this.width * N, this.height * N] });
+ };
+ collideWith = function (chara) {
+ //Bounding box: right-left-down-up
+ return !((this.x > (chara.x + chara.width)) || (chara.x > (this.x + this.width))
+ || (this.y > (chara.y + chara.height)) || (chara.y > (this.y + this.height)));
+ };
+ isIdle = function () {
+ return this.status == "dock";
+ };
+ canSee = function (enemy) {
+ return enemy.inside({ centerX: this.posX(), centerY: this.posY(), radius: this.get('sight') });
+ };
+ get = function (prop) {
+ //Currently only support upgrade for unit properties, no buildings
+ var result = eval('this.' + prop);//Can get A.B.C
+ //ShareFlag is symbol for team sharing array, not speed matrix array
+ if (result instanceof Array) return result[this.team];
+ else return result;
+ };
+ addBuffer = function (bufferObj, onAll) {
+ for (var prop in bufferObj) {
+ //Register in override if not exist
+ if (!this.override[prop]) this.override[prop] = [];
+ var buffer = bufferObj[prop];
+ //Add buffer into override list
+ this.override[prop].unshift(buffer);
+ //Override unit property by time sequence if has
+ if (this[prop] != null || prop.indexOf('isInvisible') != -1 || onAll) this[prop] = buffer;
+ }
+ this.bufferObjs.push(bufferObj);
+ //Refresh
+ if (this == Game.selectedUnit) Game.refreshInfo();
+ };
+ removeBuffer = function (bufferObj) {
+ var bufferObjIndex = this.bufferObjs.indexOf(bufferObj);
+ //Buffer obj still exist, prevent remove twice
+ if (bufferObjIndex != -1) {
+ for (var prop in bufferObj) {
+ var buffer = bufferObj[prop];
+ var overrideList = this.override[prop];
+ //Remove buffer from override list
+ var index = overrideList.indexOf(buffer);
+ if (index != -1) overrideList.splice(index, 1);
+ //Have other buffer, apply it by time sequence
+ if (overrideList.length > 0) this[prop] = overrideList[0];
+ else delete this[prop];
+ }
+ //Remove from bufferObjs
+ this.bufferObjs.splice(bufferObjIndex, 1);
+ //Refresh
+ if (this == Game.selectedUnit) Game.refreshInfo();
+ //Remove successfully
+ return true;
+ }
+ //Remove failure
+ else return false;
+ };
+ cannotMove = function () {
+ return (this instanceof Building) || Boolean(this.burrowBuffer);
+ };
+ evolveTo = function (props) {
+ //Init
+ var charaType = props.type, burstArr = props.burstArr, mixin = props.mixin, rallyPoint = props.rallyPoint;
+ var newTypeChara = null, selectedStatus = [this.selected, (this == Game.selectedUnit)], team = this.team;
+ //Hide die burst and sound for old unit, then die
+ this.dieEffect = this.sound.death = null;
+ this.die();
+ if (this.processing && !props.chain) delete this.processing;
+ //Birth function
+ var bornAt = function (chara) {
+ var prop = { target: chara, team: team };
+ if (mixin) _$.mixin(prop, mixin);
+ newTypeChara = new charaType(prop);
+ if (rallyPoint) newTypeChara.destination = rallyPoint;
+ //Fix cannot select egg issue
+ Game.commandTimeout(function () {
+ if (selectedStatus[0]) Game.addIntoAllSelected(newTypeChara);
+ if (selectedStatus[1]) Game.changeSelectedTo(newTypeChara);
+ }, 0);
+ };
+ //Burst chain
+ if (burstArr) {
+ var pos = { x: this.posX(), y: this.posY() };
+ var birth = new Burst[burstArr[0]](pos);
+ var evolveChain = function (N) {
+ return function () {
+ birth = new Burst[burstArr[N]](pos);
+ if ((N + 1) < burstArr.length) birth.callback = evolveChain(N + 1);
+ //Finish evolve chain
+ else birth.callback = function () {
+ var times = charaType.prototype.birthCount;
+ if (times == null) times = 1;
+ for (var N = 0; N < times; N++) {
+ bornAt(birth);
+ }
+ };
+ };
+ };
+ //Start evolve chain
+ if (burstArr.length > 1) birth.callback = evolveChain(1);
+ //Finish evolve chain
+ else birth.callback = function () {
+ var times = charaType.prototype.birthCount;
+ if (times == null) times = 1;
+ for (var N = 0; N < times; N++) {
+ bornAt(birth);
+ }
+ };
+ }
+ else bornAt(this);
+ return newTypeChara;
+ };
+ //This buffer makes invisible units visible
+ Gobj.detectorBuffer = [];
\ No newline at end of file
diff --git a/Characters/Hero.ts b/src/Characters/Hero.ts
similarity index 100%
rename from Characters/Hero.ts
rename to src/Characters/Hero.ts
diff --git a/Characters/Magic.ts b/src/Characters/Magic.ts
similarity index 100%
rename from Characters/Magic.ts
rename to src/Characters/Magic.ts
diff --git a/Characters/Map.ts b/src/Characters/Map.ts
similarity index 89%
rename from Characters/Map.ts
rename to src/Characters/Map.ts
index 74273d2..bb9d29c 100644
--- a/Characters/Map.ts
+++ b/src/Characters/Map.ts
@@ -1,25 +1,27 @@
-class Map {
- currentMap:'Switchback',//By default
- ready:false,
- offsetX:0,
- offsetY:0,
- speed:40,
- triggerMargin:20,
+import {Game} from '../GameRule/Game'
+
+export class Map {
+ static currentMap = 'Switchback'//By default
+ ready=false
+ static offsetX =0
+ static offsetY=0
+ speed=40
+ triggerMargin=20
//To synchronize drawing map and units, will not refresh immediately
- needRefresh:false,
- fogFlag:true,
- fogUnits:[],//Units need to draw fog on screen
- allUnits:[],//Units need to draw fog on minimap
- batchSize:0,//Draw fog by each batch
- miniCxt:$('canvas[name="mini_map"]')[0].getContext('2d'),
- fogCanvas:document.createElement('canvas'),
- shadowCanvas:document.createElement('canvas'),//Pre-render for fog shadow
+ needRefresh=false
+ static fogFlag=true
+ fogUnits=[]//Units need to draw fog on screen
+ allUnits=[]//Units need to draw fog on minimap
+ batchSize=0//Draw fog by each batch
+ miniCxt=$('canvas[name="mini_map"]')[0].getContext('2d')
+ static fogCanvas=document.createElement('canvas')
+ static shadowCanvas=document.createElement('canvas')//Pre-render for fog shadow
insideStroke:{
width:0,
height:0
- },
+ }
//Init map
- setCurrentMap:function(name){
+ setCurrentMap= function(name){
Map.currentMap=name;
$('canvas[name="mini_map"]').attr('class',name);
//Init inside stroke size
@@ -42,12 +44,12 @@ class Map {
Map.shadowCxt.fill();
//Map is ready after current map set
Map.ready=true;
- },
- getCurrentMap:function(){
+ }
+ getCurrentMap= function(){
return sourceLoader.sources['Map_'+Map.currentMap];
- },
+ }
//Draw interface call
- drawFogAndMinimap:function(){
+ drawFogAndMinimap= function(){
if (Map.fogFlag){
Map.refreshFog();
//Draw fog on main map
@@ -58,9 +60,9 @@ class Map {
}
//Draw mini-map
Map.drawMiniMap();
- },
+ }
//Used by drawFogAndMinimap
- refreshFog:function(){
+ refreshFog= function(){
//Reset composite operation
Map.fogCxt.globalCompositeOperation='source-over';
//Brush black fog to clean old fog
@@ -88,9 +90,9 @@ class Map {
var radius=Math.round(chara.get('sight')*ratio<<1);
Map.fogCxt.drawImage(Map.shadowCanvas,0,0,100,100,centerX-radius,centerY-radius,radius<<1,radius<<1);
});
- },
+ }
//Used by drawFogAndMinimap: draw red&green block and white stroke
- drawMiniMap:function(){
+ drawMiniMap= function(){
//Selected map size
var mapWidth=Map.getCurrentMap().width;
var mapHeight=Map.getCurrentMap().height;
@@ -113,8 +115,8 @@ class Map {
Map.miniCxt.strokeStyle='white';
Map.miniCxt.lineWidth=2;
Map.miniCxt.strokeRect((130*Map.offsetX/mapWidth)>>0,(130*Map.offsetY/mapHeight)>>0,Map.insideStroke.width,Map.insideStroke.height);
- },
- drawMud:function(){
+ }
+ drawMud= function(){
var _increments=[[0,1],[-1,0],[0,-1],[1,0]];
var mudRadius=120;
var mudIncrements=_$.mapTraverse(_increments,function(x){
@@ -149,8 +151,8 @@ class Map {
//Fill mud
Game.backCxt.fill();
Game.backCxt.restore();
- },
- drawBg:function(){
+ }
+ drawBg= function(){
//Clear background
Game.backCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
//Draw map as background
@@ -158,8 +160,8 @@ class Map {
0,0,Game.HBOUND,Game.VBOUND-Game.infoBox.height+5);
//Draw mud for ZergBuildings
Map.drawMud();
- },
- refresh:function(direction){
+ }
+ refresh= function(direction){
var edgeX=Map.getCurrentMap().width-Game.HBOUND;
var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
var onlyMap;
@@ -187,15 +189,15 @@ class Map {
Map.drawBg();
//Need re-calculate fog when screen moves
if (!onlyMap) Map.drawFogAndMinimap();
- },
- clickHandler:function(event){
+ }
+ clickHandler= function(event){
//Mouse at (clickX,clickY)
var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
//Relocate map center
Map.relocateAt(Map.getCurrentMap().width*clickX/130,Map.getCurrentMap().height*clickY/130);
- },
- dblClickHandler:function(event){
+ }
+ dblClickHandler= function(event){
//Mouse at (clickX,clickY)
var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
@@ -210,8 +212,8 @@ class Map {
chara.targetLock=true;
chara.moveTo(mapX,mapY);
});
- },
- relocateAt:function(centerX,centerY){
+ }
+ relocateAt= function(centerX,centerY){
//Get map edge
var edgeX=Map.getCurrentMap().width-Game.HBOUND;
var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
diff --git a/Characters/Neutral.ts b/src/Characters/Neutral.ts
similarity index 100%
rename from Characters/Neutral.ts
rename to src/Characters/Neutral.ts
diff --git a/Characters/Protoss.ts b/src/Characters/Protoss.ts
similarity index 100%
rename from Characters/Protoss.ts
rename to src/Characters/Protoss.ts
diff --git a/Characters/Terran.ts b/src/Characters/Terran.ts
similarity index 100%
rename from Characters/Terran.ts
rename to src/Characters/Terran.ts
diff --git a/Characters/Units.ts b/src/Characters/Units.ts
similarity index 100%
rename from Characters/Units.ts
rename to src/Characters/Units.ts
diff --git a/Characters/Upgrade.ts b/src/Characters/Upgrade.ts
similarity index 100%
rename from Characters/Upgrade.ts
rename to src/Characters/Upgrade.ts
diff --git a/Characters/Zerg.ts b/src/Characters/Zerg.ts
similarity index 100%
rename from Characters/Zerg.ts
rename to src/Characters/Zerg.ts
diff --git a/Controller/keyController.ts b/src/Controller/keyController.ts
similarity index 100%
rename from Controller/keyController.ts
rename to src/Controller/keyController.ts
diff --git a/Controller/mouseController.ts b/src/Controller/mouseController.ts
similarity index 100%
rename from Controller/mouseController.ts
rename to src/Controller/mouseController.ts
diff --git a/GameRule/Cheat.ts b/src/GameRule/Cheat.ts
similarity index 100%
rename from GameRule/Cheat.ts
rename to src/GameRule/Cheat.ts
diff --git a/GameRule/Game.ts b/src/GameRule/Game.ts
similarity index 94%
rename from GameRule/Game.ts
rename to src/GameRule/Game.ts
index 4fa69b8..90a706f 100644
--- a/GameRule/Game.ts
+++ b/src/GameRule/Game.ts
@@ -1,36 +1,41 @@
-class Game {
+import * as $ from 'jquery';
+import {Gobj} from '../Characters/Gobj';
+
+export class Game {
+
//Global variables
- HBOUND:innerWidth,//$('body')[0].scrollWidth
- VBOUND:innerHeight,//$('body')[0].scrollHeight
- infoBox:{
+ static public HBOUND = innerWidth//$('body')[0].scrollWidth
+ static public VBOUND = innerHeight//$('body')[0].scrollHeight
+ public infoBox = {
x:145,
y:innerHeight-110,
width:innerWidth-295,
height:110
- },
- team:0,
- playerNum:2,//By default
- teams:{},
- multiplayer:false,//By default
- cxt:$('#middleCanvas')[0].getContext('2d'),
- frontCxt:$('#frontCanvas')[0].getContext('2d'),
- backCxt:$('#backCanvas')[0].getContext('2d'),
- fogCxt:$('#fogCanvas')[0].getContext('2d'),
- _timer:-1,
- _frameInterval:100,
- mainTick:0,
- serverTick:0,
- commands:{},
- replay:{},
- randomSeed:0,//For later use
- selectedUnit:{},
- allSelected:[],
- _oldAllSelected:[],
- hackMode:false,
- isApp:false,
- offline:false,
- CDN:'',
- addIntoAllSelected:function(chara,override){
+ }
+ public static team:number = 0
+ public playerNum:number = 2//By default
+ public teams = {}
+ public multiplayer:boolean = false//By default
+ public cxt = $('#middleCanvas')[0].getContext('2d')
+ public frontCxt = $('#frontCanvas')[0].getContext('2d')
+ public static backCxt = $('#backCanvas')[0].getContext('2d')
+ public fogCxt = $('#fogCanvas')[0].getContext('2d')
+ private _timer:number = -1
+ private _frameInterval:number = 100
+ public static mainTick: number = 0
+ public serverTick:number = 0
+ public commands = {}
+ public replay = {}
+ public randomSeed:number = 0//For later use
+ public static selectedUnit={}
+ public static allSelected = []
+ public _oldAllSelected = []
+ public hackMode = false
+ public isApp = false
+ public offline =false
+ public static CDN =''
+
+ static public addIntoAllSelected = function(chara,override){
if (chara instanceof Gobj){
//Add into allSelected if not included
if (Game.allSelected.indexOf(chara)==-1) {
@@ -59,33 +64,37 @@ class Game {
});
//Notify referee to redraw
Referee.alterSelectionMode();
- },
+ }
+
//To replace setTimeout
- commandTimeout:function(func,delay){
+ static commandTimeout= function(func,delay){
var dueTick=Game.mainTick+(delay/100>>0);
if (!Game.commands[dueTick]) Game.commands[dueTick]=[];
Game.commands[dueTick].push(func);
- },
+ }
//To replace setInterval
- commandInterval:function(func,interval){
+ commandInterval= function(func,interval){
var funcAdjust=function(){
func();
Game.commandTimeout(funcAdjust,interval);
};
Game.commandTimeout(funcAdjust,interval);
- },
+ }
+
race:{
selected:'Terran',//Terran race by default
- choose:function(race){
+ choose= function(race){
this.selected=race;
$('div#GamePlay').attr('race',race);
}
- },
- layerSwitchTo:function(layerName){
+ }
+
+ layerSwitchTo= function(layerName){
$('div.GameLayer').hide();
$('#'+layerName).show(); //show('slow')
- },
- static init:function(){
+ }
+
+ static init= function(){
//Prevent full select
$('div.GameLayer').on("selectstart",function(event){
event.preventDefault();
@@ -205,8 +214,8 @@ class Game {
AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
Game.start();
})
- },
- start:function(){
+ }
+ start= function(){
//Game start
Game.layerSwitchTo("GameStart");
//Init level selector
@@ -223,8 +232,8 @@ class Game {
Game.level=parseInt(this.value);
Game.play();
});
- },
- play:function(){
+ }
+ play= function(){
//Load level to initial when no error occurs
if (!(Levels[Game.level-1].load())){
//Need Game.playerNum before expansion
@@ -242,16 +251,16 @@ class Game {
Game.initIndexDB();//Hew H5 feature:Indexed DB
Game.animation();
}
- },
- getPropArray:function(prop){
+ }
+ getPropArray= function(prop){
var result=[];
for (var N=0;N0) Game.changeSelectedTo(inRectUnits[0]);
else Game.changeSelectedTo({});
Game.addIntoAllSelected(inRectUnits,true);
- },
- getSelectedOne:function(clickX,clickY,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
+ }
+ getSelectedOne= function(clickX,clickY,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
var distance=function(chara){
return (clickX-chara.posX())*(clickX-chara.posX())+(clickY-chara.posY())*(clickY-chara.posY());//Math.pow2
};
@@ -394,8 +403,8 @@ class Game {
})[0];
if (!selectedOne) selectedOne={};
return selectedOne;
- },
- getInRangeOnes:function(clickX,clickY,range,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
+ }
+ getInRangeOnes= function(clickX,clickY,range,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
//Initial
var selectedOnes=[],charas=[];
switch (unitBuildingFilter){
@@ -438,14 +447,14 @@ class Game {
return chara.status!='dead' && chara.insideSquare({centerX:clickX,centerY:clickY,radius:range});
});
return selectedOnes;
- },
+ }
//For test use
- getSelected:function(){
+ getSelected= function(){
return Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
return chara.selected;
});
- },
- showInfoFor:function(chara){
+ }
+ showInfoFor= function(chara){
//Show selected living unit info
if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
//Display info
@@ -562,19 +571,20 @@ class Game {
//Hide info
$('div.panel_Info>div').hide();
}
- },
- refreshInfo:function(){
+ }
+ static public refreshInfo= function(){
Game.showInfoFor(Game.selectedUnit);
- },
- changeSelectedTo:function(chara){
+ }
+
+ static changeSelectedTo = function(chara){
Game.selectedUnit=chara;
Button.equipButtonsFor(chara);
if (chara instanceof Gobj){
chara.selected=true;
}
Game.showInfoFor(chara);
- },
- draw:function(chara){
+ }
+ draw= function(chara){
//Can draw units and no-rotate bullets
if (!(chara instanceof Gobj)) return;//Will only show Gobj
if (chara.status=="dead") return;//Will not show dead
@@ -687,7 +697,7 @@ class Game {
}
}
},
- drawEffect:function(chara){
+ drawEffect= function(chara){
//Can draw units and no-rotate bullets
if (!(chara instanceof Burst)) return;//Will only show Burst
if (chara.status=="dead") return;//Will not show dead
@@ -724,7 +734,7 @@ class Game {
//Remove shadow
cxt.restore();
},
- drawBullet:function(chara){
+ drawBullet= function(chara){
//Can draw bullets need rotate
if (!(chara instanceof Bullets)) return;//Will only show bullet
if (chara.status=="dead") return;//Will not show dead
@@ -766,7 +776,7 @@ class Game {
//Game.frontCxt.translate(-centerX,-centerY);
//Game.frontCxt.rotate(chara.angle);
},
- drawInfoBox:function(){
+ drawInfoBox= function(){
//Update selected unit active info which need refresh
if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
//Update selected unit life,shield and magic
@@ -785,7 +795,7 @@ class Game {
}
}
},
- drawSourceBox:function(){
+ drawSourceBox= function(){
//Update min, gas, curMan and totalMan
$('div.resource_Box span.mineNum')[0].innerHTML=Resource[Game.team].mine;
$('div.resource_Box span.gasNum')[0].innerHTML=Resource[Game.team].gas;
@@ -794,7 +804,7 @@ class Game {
//Check if man overflow
$('div.resource_Box span.manNum')[0].style.color=(Resource[Game.team].curMan>Resource[Game.team].totalMan)?"red":"#00ff00";
},
- drawProcessingBox:function(){
+ drawProcessingBox= function(){
//Show processing box if it's processing
var processing=Game.selectedUnit.processing;
//Can disable this filter for testing
@@ -822,14 +832,14 @@ class Game {
else $('div.upgrading').removeAttr('title').hide();
}
},
- refreshMultiSelectBox:function(){
+ refreshMultiSelectBox= function(){
var divs=$('div.override div.multiSelection div');
//Only refresh border color on current multiSelect box
for (var n=0;nN
var units=Unit.allGroundUnits().concat(Building.allBuildings);
for(var N=0;N{{ hello }}
\ No newline at end of file
diff --git a/src/app/hello.js b/src/app/hello.js
new file mode 100644
index 0000000..62a89ea
--- /dev/null
+++ b/src/app/hello.js
@@ -0,0 +1,27 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+var __metadata = (this && this.__metadata) || function (k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
+};
+exports.__esModule = true;
+var core_1 = require("@angular/core");
+var HelloComponent = (function () {
+ function HelloComponent() {
+ this.hello = 'Hello World!';
+ }
+ return HelloComponent;
+}());
+HelloComponent = __decorate([
+ core_1.Component({
+ selector: 'fountain-app',
+ template: require('./hello.html')
+ }),
+ __metadata("design:paramtypes", [])
+], HelloComponent);
+exports.HelloComponent = HelloComponent;
+//# sourceMappingURL=hello.js.map
\ No newline at end of file
diff --git a/src/app/hello.spec.js b/src/app/hello.spec.js
new file mode 100644
index 0000000..325f89c
--- /dev/null
+++ b/src/app/hello.spec.js
@@ -0,0 +1,21 @@
+"use strict";
+exports.__esModule = true;
+var hello_1 = require("./hello");
+var testing_1 = require("@angular/core/testing");
+describe('hello component', function () {
+ beforeEach(testing_1.async(function () {
+ testing_1.TestBed.configureTestingModule({
+ declarations: [
+ hello_1.HelloComponent
+ ]
+ });
+ testing_1.TestBed.compileComponents();
+ }));
+ it('should render hello world', function () {
+ var fixture = testing_1.TestBed.createComponent(hello_1.HelloComponent);
+ fixture.detectChanges();
+ var hello = fixture.nativeElement;
+ expect(hello.querySelector('h1').textContent).toBe('Hello World!');
+ });
+});
+//# sourceMappingURL=hello.spec.js.map
\ No newline at end of file
diff --git a/src/app/hello.spec.ts b/src/app/hello.spec.ts
new file mode 100644
index 0000000..678451f
--- /dev/null
+++ b/src/app/hello.spec.ts
@@ -0,0 +1,20 @@
+import {HelloComponent} from './hello';
+import {TestBed, async} from '@angular/core/testing';
+
+describe('hello component', () => {
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ HelloComponent
+ ]
+ });
+ TestBed.compileComponents();
+ }));
+
+ it('should render hello world', () => {
+ const fixture = TestBed.createComponent(HelloComponent);
+ fixture.detectChanges();
+ const hello = fixture.nativeElement;
+ expect(hello.querySelector('h1').textContent).toBe('Hello World!');
+ });
+});
diff --git a/src/app/hello.ts b/src/app/hello.ts
new file mode 100644
index 0000000..9f42916
--- /dev/null
+++ b/src/app/hello.ts
@@ -0,0 +1,13 @@
+import {Component} from '@angular/core';
+
+@Component({
+ selector: 'fountain-app',
+ template: require('./hello.html')
+})
+export class HelloComponent {
+ public hello: string;
+
+ constructor() {
+ this.hello = 'Hello World!';
+ }
+}
diff --git a/src/app/index.js b/src/app/index.js
new file mode 100644
index 0000000..cbd8197
--- /dev/null
+++ b/src/app/index.js
@@ -0,0 +1,32 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+exports.__esModule = true;
+var core_1 = require("@angular/core");
+var platform_browser_1 = require("@angular/platform-browser");
+var routes_1 = require("./routes");
+var hello_1 = require("./hello");
+var AppModule = (function () {
+ function AppModule() {
+ }
+ return AppModule;
+}());
+AppModule = __decorate([
+ core_1.NgModule({
+ imports: [
+ platform_browser_1.BrowserModule,
+ routes_1.routing
+ ],
+ declarations: [
+ routes_1.RootComponent,
+ hello_1.HelloComponent
+ ],
+ bootstrap: [routes_1.RootComponent]
+ })
+], AppModule);
+exports.AppModule = AppModule;
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/src/app/index.ts b/src/app/index.ts
new file mode 100644
index 0000000..5f02fe6
--- /dev/null
+++ b/src/app/index.ts
@@ -0,0 +1,18 @@
+import {NgModule} from '@angular/core';
+import {BrowserModule} from '@angular/platform-browser';
+import {routing, RootComponent} from './routes';
+
+import {HelloComponent} from './hello';
+
+@NgModule({
+ imports: [
+ BrowserModule,
+ routing
+ ],
+ declarations: [
+ RootComponent,
+ HelloComponent
+ ],
+ bootstrap: [RootComponent]
+})
+export class AppModule {}
diff --git a/src/app/routes.js b/src/app/routes.js
new file mode 100644
index 0000000..4c1ca65
--- /dev/null
+++ b/src/app/routes.js
@@ -0,0 +1,31 @@
+"use strict";
+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+};
+exports.__esModule = true;
+var core_1 = require("@angular/core");
+var router_1 = require("@angular/router");
+var hello_1 = require("./hello");
+var RootComponent = (function () {
+ function RootComponent() {
+ }
+ return RootComponent;
+}());
+RootComponent = __decorate([
+ core_1.Component({
+ selector: 'fountain-root',
+ template: ''
+ })
+], RootComponent);
+exports.RootComponent = RootComponent;
+exports.routes = [
+ {
+ path: '',
+ component: hello_1.HelloComponent
+ }
+];
+exports.routing = router_1.RouterModule.forRoot(exports.routes);
+//# sourceMappingURL=routes.js.map
\ No newline at end of file
diff --git a/src/app/routes.ts b/src/app/routes.ts
new file mode 100644
index 0000000..8542592
--- /dev/null
+++ b/src/app/routes.ts
@@ -0,0 +1,18 @@
+import {Component} from '@angular/core';
+import {RouterModule, Routes} from '@angular/router';
+import {HelloComponent} from './hello';
+
+@Component({
+ selector: 'fountain-root',
+ template: ''
+})
+export class RootComponent {}
+
+export const routes: Routes = [
+ {
+ path: '',
+ component: HelloComponent
+ }
+];
+
+export const routing = RouterModule.forRoot(routes);
diff --git a/css/buttonStyle.css b/src/css/buttonStyle.css
similarity index 100%
rename from css/buttonStyle.css
rename to src/css/buttonStyle.css
diff --git a/css/mapStyle.css b/src/css/mapStyle.css
similarity index 100%
rename from css/mapStyle.css
rename to src/css/mapStyle.css
diff --git a/css/portraitStyle.css b/src/css/portraitStyle.css
similarity index 100%
rename from css/portraitStyle.css
rename to src/css/portraitStyle.css
diff --git a/css/style.css b/src/css/style.css
similarity index 100%
rename from css/style.css
rename to src/css/style.css
diff --git a/img/Bg/Deleted b/src/img/Bg/Deleted
similarity index 100%
rename from img/Bg/Deleted
rename to src/img/Bg/Deleted
diff --git a/img/Charas/Deleted b/src/img/Charas/Deleted
similarity index 100%
rename from img/Charas/Deleted
rename to src/img/Charas/Deleted
diff --git a/img/Demo/Demo.jpg b/src/img/Demo/Demo.jpg
similarity index 100%
rename from img/Demo/Demo.jpg
rename to src/img/Demo/Demo.jpg
diff --git a/img/Demo/Demo.png b/src/img/Demo/Demo.png
similarity index 100%
rename from img/Demo/Demo.png
rename to src/img/Demo/Demo.png
diff --git a/img/Maps/Deleted b/src/img/Maps/Deleted
similarity index 100%
rename from img/Maps/Deleted
rename to src/img/Maps/Deleted
diff --git a/img/Menu/Deleted b/src/img/Menu/Deleted
similarity index 100%
rename from img/Menu/Deleted
rename to src/img/Menu/Deleted
diff --git a/index.html b/src/index.html
similarity index 99%
rename from index.html
rename to src/index.html
index 39336ef..3987731 100644
--- a/index.html
+++ b/src/index.html
@@ -10,7 +10,7 @@
-
+
diff --git a/src/index.js b/src/index.js
new file mode 100644
index 0000000..66e0a45
--- /dev/null
+++ b/src/index.js
@@ -0,0 +1,19 @@
+"use strict";
+exports.__esModule = true;
+require("core-js/client/shim");
+require("zone.js/dist/zone");
+require("@angular/common");
+require("rxjs");
+require("./index.scss");
+var core_1 = require("@angular/core");
+var platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
+var app_1 = require("./app");
+if (process.env.NODE_ENV === 'production') {
+ core_1.enableProdMode();
+}
+else {
+ Error['stackTraceLimit'] = Infinity; // tslint:disable-line:no-string-literal
+ require('zone.js/dist/long-stack-trace-zone'); // tslint:disable-line:no-var-requires
+}
+platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_1.AppModule);
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/src/index.scss b/src/index.scss
new file mode 100644
index 0000000..f1df96a
--- /dev/null
+++ b/src/index.scss
@@ -0,0 +1,3 @@
+body {
+ background-color: lightgrey;
+}
diff --git a/src/index.spec.js b/src/index.spec.js
new file mode 100644
index 0000000..3f4ad63
--- /dev/null
+++ b/src/index.spec.js
@@ -0,0 +1,20 @@
+Error.stackTraceLimit = Infinity;
+
+require('core-js/client/shim');
+
+require('@angular/common');
+require('rxjs');
+
+require('zone.js/dist/zone');
+require('zone.js/dist/long-stack-trace-zone');
+require('zone.js/dist/proxy');
+require('zone.js/dist/sync-test');
+require('zone.js/dist/jasmine-patch');
+require('zone.js/dist/async-test');
+require('zone.js/dist/fake-async-test');
+const context = require.context('./app', true, /\.(js|ts|tsx)$/);
+context.keys().forEach(context);
+const testing = require('@angular/core/testing');
+const testingBrowser = require('@angular/platform-browser-dynamic/testing');
+
+testing.TestBed.initTestEnvironment(testingBrowser.BrowserDynamicTestingModule, testingBrowser.platformBrowserDynamicTesting());
diff --git a/src/index.ts b/src/index.ts
new file mode 100644
index 0000000..128a34a
--- /dev/null
+++ b/src/index.ts
@@ -0,0 +1,21 @@
+import 'core-js/client/shim';
+import 'zone.js/dist/zone';
+
+import '@angular/common';
+import 'rxjs';
+
+import './index.scss';
+
+import {enableProdMode} from '@angular/core';
+import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
+import {AppModule} from './app';
+
+declare var process: any;
+if (process.env.NODE_ENV === 'production') {
+ enableProdMode();
+} else {
+ Error['stackTraceLimit'] = Infinity; // tslint:disable-line:no-string-literal
+ require('zone.js/dist/long-stack-trace-zone'); // tslint:disable-line:no-var-requires
+}
+
+platformBrowserDynamic().bootstrapModule(AppModule);
diff --git a/src/index1.html b/src/index1.html
new file mode 100644
index 0000000..2d0e805
--- /dev/null
+++ b/src/index1.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
FountainJS
+
+
+
+
+
+
+
Loading...
+
+
diff --git a/tsconfig.json b/tsconfig.json
index e6a6eac..cadfcff 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,12 +1,21 @@
{
"compilerOptions": {
- "target": "es5",
- "module": "commonjs",
- "moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
- "noImplicitAny": false
- }
+ "noImplicitAny": false,
+ "typeRoots": ["node_modules/@types/"],
+ "types": [
+ "node",
+ "jasmine",
+ "es6-shim"
+ ]
+ },
+ "compileOnSave": false,
+ "filesGlob": [
+ "src/**/*.ts",
+ "src/**/*.tsx",
+ "!node_modules/**"
+ ]
}
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 0000000..1f66715
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,79 @@
+{
+ "rules": {
+ "ban": [true,
+ ["_", "extend"],
+ ["_", "isNull"],
+ ["_", "isDefined"]
+ ],
+ "class-name": true,
+ "comment-format": [true,
+ "check-space",
+ "check-lowercase"
+ ],
+ "curly": true,
+ "eofline": true,
+ "forin": true,
+ "indent": [true, 2],
+ "interface-name": true,
+ "jsdoc-format": true,
+ "label-position": true,
+ "max-line-length": [false, 140],
+ "member-ordering": [true,
+ "public-before-private",
+ "static-before-instance",
+ "variables-before-functions"
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-parameter-properties": false,
+ "no-debugger": true,
+ "no-duplicate-variable": true,
+ "no-empty": true,
+ "no-eval": true,
+ "no-string-literal": true,
+ "no-switch-case-fall-through": true,
+ "trailing-comma": true,
+ "no-trailing-whitespace": true,
+ "no-unused-expression": true,
+ "no-use-before-declare": true,
+ "no-var-requires": true,
+ "one-line": [true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "quotemark": [true, "single"],
+ "radix": true,
+ "semicolon": true,
+ "triple-equals": [true, "allow-null-check"],
+ "typedef": [true,
+ "callSignature",
+ "indexSignature",
+ "parameter",
+ "propertySignature",
+ "variableDeclarator"
+ ],
+ "typedef-whitespace": [true,
+ ["callSignature", "noSpace"],
+ ["catchClause", "noSpace"],
+ ["indexSignature", "space"]
+ ],
+ "variable-name": false,
+ "whitespace": [true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ]
+ }
+}
From b4dc3bf3a20050949b065aa8a984fdee82162db3 Mon Sep 17 00:00:00 2001
From: mario meltzow
Date: Sun, 5 Mar 2017 12:21:26 +0100
Subject: [PATCH 03/15] next step
---
src/Characters/Gobj.ts | 14 +++++++++++---
src/GameRule/Game.ts | 4 ++--
src/app/hello.js | 27 ---------------------------
src/app/hello.spec.js | 21 ---------------------
src/app/index.js | 32 --------------------------------
src/app/routes.js | 23 +++++++++++++----------
src/index.js | 19 -------------------
7 files changed, 26 insertions(+), 114 deletions(-)
delete mode 100644 src/app/hello.js
delete mode 100644 src/app/hello.spec.js
delete mode 100644 src/app/index.js
delete mode 100644 src/index.js
diff --git a/src/Characters/Gobj.ts b/src/Characters/Gobj.ts
index fad304c..0c20d69 100644
--- a/src/Characters/Gobj.ts
+++ b/src/Characters/Gobj.ts
@@ -3,14 +3,20 @@ import {Map} from './Map';
//Gobj is original object used in StarCraft
export class Gobj {
- function(props) {
+ x: number;
+ y: number;
+ action: number;
+ status: string;
+
+
+ static init = function (props) {
this.x = props.x;
this.y = props.y;
if (props.target instanceof Gobj) {
this.x = (props.target.posX() - this.width / 2) >> 0;
this.y = (props.target.posY() - this.height / 2) >> 0;
}
- this.action = 0;//Only for moving
+ this.action = 0; //Only for moving
this.status = "";
this.buffer = {};//Buffer names
this.override = {};//Buffer effects
@@ -126,7 +132,9 @@ export class Gobj {
return Math.pow(circle.centerX - this.posX(), 2) + Math.pow(circle.centerY - this.posY(), 2) < Math.pow(circle.radius, 2);
};
//Default is circle mode
- inside = insideCircle;
+ inside = function (circle) {
+ return Math.pow(circle.centerX - this.posX(), 2) + Math.pow(circle.centerY - this.posY(), 2) < Math.pow(circle.radius, 2);
+ };
//Radius
radius = function () {
return (this.width < this.height) ? (this.width / 2) : (this.height / 2);//Math.min
diff --git a/src/GameRule/Game.ts b/src/GameRule/Game.ts
index 90a706f..21395af 100644
--- a/src/GameRule/Game.ts
+++ b/src/GameRule/Game.ts
@@ -454,7 +454,7 @@ export class Game {
return chara.selected;
});
}
- showInfoFor= function(chara){
+ static showInfoFor= function(chara){
//Show selected living unit info
if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
//Display info
@@ -572,7 +572,7 @@ export class Game {
$('div.panel_Info>div').hide();
}
}
- static public refreshInfo= function(){
+ public static refreshInfo = function(){
Game.showInfoFor(Game.selectedUnit);
}
diff --git a/src/app/hello.js b/src/app/hello.js
deleted file mode 100644
index 62a89ea..0000000
--- a/src/app/hello.js
+++ /dev/null
@@ -1,27 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var __metadata = (this && this.__metadata) || function (k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
-};
-exports.__esModule = true;
-var core_1 = require("@angular/core");
-var HelloComponent = (function () {
- function HelloComponent() {
- this.hello = 'Hello World!';
- }
- return HelloComponent;
-}());
-HelloComponent = __decorate([
- core_1.Component({
- selector: 'fountain-app',
- template: require('./hello.html')
- }),
- __metadata("design:paramtypes", [])
-], HelloComponent);
-exports.HelloComponent = HelloComponent;
-//# sourceMappingURL=hello.js.map
\ No newline at end of file
diff --git a/src/app/hello.spec.js b/src/app/hello.spec.js
deleted file mode 100644
index 325f89c..0000000
--- a/src/app/hello.spec.js
+++ /dev/null
@@ -1,21 +0,0 @@
-"use strict";
-exports.__esModule = true;
-var hello_1 = require("./hello");
-var testing_1 = require("@angular/core/testing");
-describe('hello component', function () {
- beforeEach(testing_1.async(function () {
- testing_1.TestBed.configureTestingModule({
- declarations: [
- hello_1.HelloComponent
- ]
- });
- testing_1.TestBed.compileComponents();
- }));
- it('should render hello world', function () {
- var fixture = testing_1.TestBed.createComponent(hello_1.HelloComponent);
- fixture.detectChanges();
- var hello = fixture.nativeElement;
- expect(hello.querySelector('h1').textContent).toBe('Hello World!');
- });
-});
-//# sourceMappingURL=hello.spec.js.map
\ No newline at end of file
diff --git a/src/app/index.js b/src/app/index.js
deleted file mode 100644
index cbd8197..0000000
--- a/src/app/index.js
+++ /dev/null
@@ -1,32 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-exports.__esModule = true;
-var core_1 = require("@angular/core");
-var platform_browser_1 = require("@angular/platform-browser");
-var routes_1 = require("./routes");
-var hello_1 = require("./hello");
-var AppModule = (function () {
- function AppModule() {
- }
- return AppModule;
-}());
-AppModule = __decorate([
- core_1.NgModule({
- imports: [
- platform_browser_1.BrowserModule,
- routes_1.routing
- ],
- declarations: [
- routes_1.RootComponent,
- hello_1.HelloComponent
- ],
- bootstrap: [routes_1.RootComponent]
- })
-], AppModule);
-exports.AppModule = AppModule;
-//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/src/app/routes.js b/src/app/routes.js
index 4c1ca65..1237150 100644
--- a/src/app/routes.js
+++ b/src/app/routes.js
@@ -5,21 +5,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
-exports.__esModule = true;
-var core_1 = require("@angular/core");
-var router_1 = require("@angular/router");
-var hello_1 = require("./hello");
+var __metadata = (this && this.__metadata) || function (k, v) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
+};
+var core_1 = require('@angular/core');
+var router_1 = require('@angular/router');
+var hello_1 = require('./hello');
var RootComponent = (function () {
function RootComponent() {
}
+ RootComponent = __decorate([
+ core_1.Component({
+ selector: 'fountain-root',
+ template: ''
+ }),
+ __metadata('design:paramtypes', [])
+ ], RootComponent);
return RootComponent;
}());
-RootComponent = __decorate([
- core_1.Component({
- selector: 'fountain-root',
- template: ''
- })
-], RootComponent);
exports.RootComponent = RootComponent;
exports.routes = [
{
diff --git a/src/index.js b/src/index.js
deleted file mode 100644
index 66e0a45..0000000
--- a/src/index.js
+++ /dev/null
@@ -1,19 +0,0 @@
-"use strict";
-exports.__esModule = true;
-require("core-js/client/shim");
-require("zone.js/dist/zone");
-require("@angular/common");
-require("rxjs");
-require("./index.scss");
-var core_1 = require("@angular/core");
-var platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
-var app_1 = require("./app");
-if (process.env.NODE_ENV === 'production') {
- core_1.enableProdMode();
-}
-else {
- Error['stackTraceLimit'] = Infinity; // tslint:disable-line:no-string-literal
- require('zone.js/dist/long-stack-trace-zone'); // tslint:disable-line:no-var-requires
-}
-platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_1.AppModule);
-//# sourceMappingURL=index.js.map
\ No newline at end of file
From ed36efa45b50c6d0772cc15135f609705ec511d7 Mon Sep 17 00:00:00 2001
From: mario meltzow
Date: Sun, 5 Mar 2017 13:06:21 +0100
Subject: [PATCH 04/15] next...
---
src/Characters/Building.ts | 270 +++++++++++++++++++-----------------
src/Characters/Bullets.ts | 75 +++++-----
src/Characters/Burst.ts | 156 +++++++++++----------
src/Characters/Gobj.ts | 8 +-
src/Characters/Map.ts | 26 ++--
src/Characters/Terran.ts | 76 +++++-----
src/Characters/Units.ts | 89 ++++++------
src/Characters/Zerg.ts | 5 +-
src/GameRule/Cheat.ts | 20 +--
src/GameRule/Game.ts | 110 +++++++--------
src/GameRule/Levels.ts | 8 ++
src/GameRule/Multiplayer.ts | 32 +++--
src/GameRule/Race.ts | 7 +
src/GameRule/Referee.ts | 63 ++++-----
tslint.json | 79 -----------
15 files changed, 496 insertions(+), 528 deletions(-)
create mode 100644 src/GameRule/Race.ts
delete mode 100644 tslint.json
diff --git a/src/Characters/Building.ts b/src/Characters/Building.ts
index 37a86ff..b336210 100644
--- a/src/Characters/Building.ts
+++ b/src/Characters/Building.ts
@@ -1,5 +1,10 @@
-class Building extends Gobj {
- constructorPlus:function(props){
+import {Gobj} from './Gobj';
+import {Unit} from './Units';
+import {Game} from '../GameRule/Game';
+
+export class Building extends Gobj {
+
+ constructorPlus= function(props){
//Add id for building
this.id=Unit.currentID++;
this.life=this.get('HP');
@@ -16,13 +21,13 @@ class Building extends Gobj {
//Show unit
myself.dock();
},0);
- },
- prototypePlus:{
+ }
+ 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
@@ -32,7 +37,7 @@ class Building extends Gobj {
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
@@ -45,11 +50,11 @@ class Building extends Gobj {
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;
@@ -62,7 +67,7 @@ class Building extends Gobj {
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) {
@@ -76,11 +81,11 @@ class Building extends Gobj {
}
},
//Fix bug, for consistent, cause 100% damage on building
- calculateDamageBy:function(enemyObj){
+ calculateDamageBy= function(enemyObj){
return (enemyObj instanceof Gobj)?enemyObj.get('damage'):enemyObj;
},
//Calculate damage, for consistence
- getDamageBy:function(enemy,percent){
+ getDamageBy= function(enemy,percent){
if (percent==undefined) percent=1;//100% by default
var damage=0;
//If has SP and shield remain
@@ -101,12 +106,15 @@ class Building extends Gobj {
}
},
//Life status
- lifeStatus:function(){
+ 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(){
@@ -122,7 +130,7 @@ Building.enemyBuildings=function(){
//Zerg buildings
Building.ZergBuilding=Building.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
this.sound={
selected:new Audio(Game.CDN+'bgm/ZergBuilding.selected.wav'),
death:new Audio(Game.CDN+'bgm/ZergBuilding.death.wav')
@@ -135,7 +143,7 @@ Building.ZergBuilding=Building.extends({
name: "ZergBuilding",
dieEffect:Burst.ZergBuildingBurst,
injuryNames:['bloodA','bloodB','bloodC'],
- recover:function(){
+ recover= function(){
if (this.life0) {
@@ -693,7 +700,7 @@ Bullets.ReaverBomb=Bullets.extends({
}
});
Bullets.ReaverBombII=Bullets.extends({
- constructorPlus:function(props){},
+ constructorPlus= function(props){},
prototypePlus:{
//Add basic unit info
name:"Burst",
@@ -714,7 +721,7 @@ Bullets.ReaverBombII=Bullets.extends({
}
});
Bullets.Interceptor=Bullets.extends({
- constructorPlus:function(props){},
+ constructorPlus= function(props){},
prototypePlus:{
//Add basic unit info
name:"Burst",
@@ -732,7 +739,7 @@ Bullets.Interceptor=Bullets.extends({
},
//Override cause damage timing
noDamage:true,
- fire:function(){
+ fire= function(){
this.inherited.fire.call(this);
var target=this.target;
var owner=this.owner;
@@ -744,7 +751,7 @@ Bullets.Interceptor=Bullets.extends({
}
});
Bullets.DevilBall=Bullets.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
this.life=this.traceTimes;
},
prototypePlus:{
diff --git a/src/Characters/Burst.ts b/src/Characters/Burst.ts
index a935dbb..b0aac3d 100644
--- a/src/Characters/Burst.ts
+++ b/src/Characters/Burst.ts
@@ -1,6 +1,8 @@
+import {Gobj} from './Gobj';
+
//One animation period which only play for a while and die
-var Burst=Gobj.extends({
- constructorPlus:function(props){
+export class Burst extends Gobj{
+ constructorPlus= function(props){
//Override if has props.scale
if (props.scale) this.scale=props.scale;
//Resize drawing by scale
@@ -54,7 +56,7 @@ var Burst=Gobj.extends({
},
prototypePlus:{
//Override Gobj method
- animeFrame:function(){
+ animeFrame= function(){
//Animation play
this.action++;
//Override Gobj here, can have hidden frames
@@ -70,7 +72,7 @@ var Burst=Gobj.extends({
this.y=(this.target.posY()-this.height*times/2)>>0;
}
},
- burst:function(){
+ burst= function(){
this.status="burst";
//Start play burst animation
var myself=this;
@@ -88,7 +90,7 @@ var Burst=Gobj.extends({
},duration);
}
},
- die:function(){
+ die= function(){
//Run callback when burst die
if (this.callback) this.callback();
Gobj.prototype.die.call(this);
@@ -99,7 +101,7 @@ var Burst=Gobj.extends({
Burst.allEffects=[];
//Define different bursts
Burst.GreenFog=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/GreenFog.burst.wav').play();
},
@@ -120,7 +122,7 @@ Burst.GreenFog=Burst.extends({
}
});
Burst.Parasite=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Parasite.wav').play();
},
@@ -141,7 +143,7 @@ Burst.Parasite=Burst.extends({
}
});
Burst.Spore=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//No sound
},
prototypePlus:{
@@ -161,7 +163,7 @@ Burst.Spore=Burst.extends({
}
});
Burst.GreenBallBroken=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/Greenball.burst.wav').play();
},
@@ -182,7 +184,7 @@ Burst.GreenBallBroken=Burst.extends({
}
});
Burst.PurpleCloudSpread=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/PurpleCloud.burst.wav').play();
},
@@ -197,7 +199,7 @@ Burst.PurpleCloudSpread=Burst.extends({
},
width:50,
height:60,
- callback:function(){
+ callback= function(){
var chara=this.target;
//Fix all spored issue
if (chara.status=='dead' || chara.status==null) return;
@@ -217,7 +219,7 @@ Burst.PurpleCloudSpread=Burst.extends({
if (!chara.purpleBuffer) chara.purpleBuffer=[];
chara.purpleBuffer.push(bufferObj);
//Purple effect
- new Animation.PurpleEffect({team:this.team,target:chara,callback:function(){
+ new Animation.PurpleEffect({team:this.team,target:chara,callback= function(){
//Restore in 30 seconds, Last In First Out
if (chara.purpleBuffer && chara.removeBuffer(chara.purpleBuffer.pop())) {
chara.buffer.PurpleCloud--;
@@ -235,7 +237,7 @@ Burst.PurpleCloudSpread=Burst.extends({
}
});
Burst.Sunken=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/Sunken.burst.wav').play();
},
@@ -256,7 +258,7 @@ Burst.Sunken=Burst.extends({
}
});
Burst.SmallFireSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
},
@@ -277,7 +279,7 @@ Burst.SmallFireSpark=Burst.extends({
}
});
Burst.FireSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -297,7 +299,7 @@ Burst.FireSpark=Burst.extends({
}
});
Burst.FireSparkSound=Burst.FireSpark.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
},
@@ -306,7 +308,7 @@ Burst.FireSparkSound=Burst.FireSpark.extends({
}
});
Burst.LaserSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -326,7 +328,7 @@ Burst.LaserSpark=Burst.extends({
}
});
Burst.VultureSpark=Burst.LaserSpark.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/VultureSpark.burst.wav').play();
},
@@ -335,7 +337,7 @@ Burst.VultureSpark=Burst.LaserSpark.extends({
}
});
Burst.HydraSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -355,7 +357,7 @@ Burst.HydraSpark=Burst.extends({
}
});
Burst.CorsairCloud=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -375,7 +377,7 @@ Burst.CorsairCloud=Burst.extends({
}
});
Burst.ArchonBurst=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -395,7 +397,7 @@ Burst.ArchonBurst=Burst.extends({
}
});
Burst.DragoonBallBroken=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/DragoonBall.burst.wav').play();
},
@@ -416,7 +418,7 @@ Burst.DragoonBallBroken=Burst.extends({
}
});
Burst.ShootSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -436,7 +438,7 @@ Burst.ShootSpark=Burst.extends({
}
});
Burst.BlueShootSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -456,7 +458,7 @@ Burst.BlueShootSpark=Burst.extends({
}
});
Burst.SCVSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -476,7 +478,7 @@ Burst.SCVSpark=Burst.extends({
}
});
Burst.ProbeSpark=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -496,7 +498,7 @@ Burst.ProbeSpark=Burst.extends({
}
});
Burst.ReaverBurst=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
},
@@ -517,7 +519,7 @@ Burst.ReaverBurst=Burst.extends({
}
});
Burst.PurpleFog=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
},
@@ -539,7 +541,7 @@ Burst.PurpleFog=Burst.extends({
});
Burst.InfestedBomb=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
},
@@ -560,7 +562,7 @@ Burst.InfestedBomb=Burst.extends({
}
});
Burst.ScourgeBomb=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -581,7 +583,7 @@ Burst.ScourgeBomb=Burst.extends({
});
Burst.SmallExplode=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -601,7 +603,7 @@ Burst.SmallExplode=Burst.extends({
}
});
Burst.MiddleExplode=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -621,7 +623,7 @@ Burst.MiddleExplode=Burst.extends({
}
});
Burst.BigExplode=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -641,7 +643,7 @@ Burst.BigExplode=Burst.extends({
}
});
Burst.SmallBlueExplode=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -661,7 +663,7 @@ Burst.SmallBlueExplode=Burst.extends({
}
});
Burst.MiddleBlueExplode=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -681,7 +683,7 @@ Burst.MiddleBlueExplode=Burst.extends({
}
});
Burst.BigBlueExplode=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -701,7 +703,7 @@ Burst.BigBlueExplode=Burst.extends({
}
});
Burst.ZergBuildingBurst=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Need clear mud when ZergBuildingBurst finished
this.callback=function(){
Map.needRefresh="MAP";
@@ -724,7 +726,7 @@ Burst.ZergBuildingBurst=Burst.extends({
}
});
Burst.TerranBuildingBurst=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -744,7 +746,7 @@ Burst.TerranBuildingBurst=Burst.extends({
}
});
Burst.ProtossBuildingBurst=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -764,7 +766,7 @@ Burst.ProtossBuildingBurst=Burst.extends({
}
});
Burst.HumanDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -784,7 +786,7 @@ Burst.HumanDeath=Burst.extends({
}
});
Burst.MedicDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -804,7 +806,7 @@ Burst.MedicDeath=Burst.extends({
}
});
Burst.SmallZergFlyingDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -824,7 +826,7 @@ Burst.SmallZergFlyingDeath=Burst.extends({
}
});
Burst.BigZergFlyingDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -844,7 +846,7 @@ Burst.BigZergFlyingDeath=Burst.extends({
}
});
Burst.DroneDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -864,7 +866,7 @@ Burst.DroneDeath=Burst.extends({
}
});
Burst.ZerglingDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -884,7 +886,7 @@ Burst.ZerglingDeath=Burst.extends({
}
});
Burst.HydraliskDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -904,7 +906,7 @@ Burst.HydraliskDeath=Burst.extends({
}
});
Burst.LurkerDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -924,7 +926,7 @@ Burst.LurkerDeath=Burst.extends({
}
});
Burst.UltraliskDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -944,7 +946,7 @@ Burst.UltraliskDeath=Burst.extends({
}
});
Burst.DefilerDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -964,7 +966,7 @@ Burst.DefilerDeath=Burst.extends({
}
});
Burst.BroodlingDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -984,7 +986,7 @@ Burst.BroodlingDeath=Burst.extends({
}
});
Burst.LarvaDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1004,7 +1006,7 @@ Burst.LarvaDeath=Burst.extends({
}
});
Burst.EggDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1024,7 +1026,7 @@ Burst.EggDeath=Burst.extends({
}
});
Burst.EggBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1044,7 +1046,7 @@ Burst.EggBirth=Burst.extends({
}
});
Burst.DroneBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1064,7 +1066,7 @@ Burst.DroneBirth=Burst.extends({
}
});
Burst.OverlordBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1084,7 +1086,7 @@ Burst.OverlordBirth=Burst.extends({
}
});
Burst.ZerglingBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1104,7 +1106,7 @@ Burst.ZerglingBirth=Burst.extends({
}
});
Burst.HydraliskBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1124,7 +1126,7 @@ Burst.HydraliskBirth=Burst.extends({
}
});
Burst.MutaliskBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1144,7 +1146,7 @@ Burst.MutaliskBirth=Burst.extends({
}
});
Burst.ScourgeBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1164,7 +1166,7 @@ Burst.ScourgeBirth=Burst.extends({
}
});
Burst.QueenBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1184,7 +1186,7 @@ Burst.QueenBirth=Burst.extends({
}
});
Burst.UltraliskBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1204,7 +1206,7 @@ Burst.UltraliskBirth=Burst.extends({
}
});
Burst.DefilerBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1224,7 +1226,7 @@ Burst.DefilerBirth=Burst.extends({
}
});
Burst.LurkerBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1244,7 +1246,7 @@ Burst.LurkerBirth=Burst.extends({
}
});
Burst.GuardianBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1264,7 +1266,7 @@ Burst.GuardianBirth=Burst.extends({
}
});
Burst.DevourerBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1284,7 +1286,7 @@ Burst.DevourerBirth=Burst.extends({
}
});
Burst.SmallProtossDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1304,7 +1306,7 @@ Burst.SmallProtossDeath=Burst.extends({
}
});
Burst.DragoonDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1324,7 +1326,7 @@ Burst.DragoonDeath=Burst.extends({
}
});
Burst.TemplarDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1344,7 +1346,7 @@ Burst.TemplarDeath=Burst.extends({
}
});
Burst.HallucinationDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1364,7 +1366,7 @@ Burst.HallucinationDeath=Burst.extends({
}
});
Burst.ArchonBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1384,7 +1386,7 @@ Burst.ArchonBirth=Burst.extends({
}
});
Burst.DarkArchonBirth=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Mixin
},
prototypePlus:{
@@ -1405,7 +1407,7 @@ Burst.DarkArchonBirth=Burst.extends({
});
Burst.RagnasaurDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1425,7 +1427,7 @@ Burst.RagnasaurDeath=Burst.extends({
}
});
Burst.RhynsdonDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1445,7 +1447,7 @@ Burst.RhynsdonDeath=Burst.extends({
}
});
Burst.UrsadonDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1465,7 +1467,7 @@ Burst.UrsadonDeath=Burst.extends({
}
});
Burst.BengalaasDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1485,7 +1487,7 @@ Burst.BengalaasDeath=Burst.extends({
}
});
Burst.ScantidDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
@@ -1505,7 +1507,7 @@ Burst.ScantidDeath=Burst.extends({
}
});
Burst.KakaruDeath=Burst.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus:{
diff --git a/src/Characters/Gobj.ts b/src/Characters/Gobj.ts
index 0c20d69..7d8a65c 100644
--- a/src/Characters/Gobj.ts
+++ b/src/Characters/Gobj.ts
@@ -1,5 +1,8 @@
import { Game } from '../GameRule/Game';
-import {Map} from './Map';
+import { Map } from './Map';
+import { Building } from './Building';
+import { Burst } from './Burst';
+
//Gobj is original object used in StarCraft
export class Gobj {
@@ -275,4 +278,5 @@ export class Gobj {
return newTypeChara;
};
//This buffer makes invisible units visible
- Gobj.detectorBuffer = [];
\ No newline at end of file
+ // Gobj.detectorBuffer = [];
+}
\ No newline at end of file
diff --git a/src/Characters/Map.ts b/src/Characters/Map.ts
index bb9d29c..3934c39 100644
--- a/src/Characters/Map.ts
+++ b/src/Characters/Map.ts
@@ -1,4 +1,5 @@
import {Game} from '../GameRule/Game'
+import {Unit} from './Units';
export class Map {
static currentMap = 'Switchback'//By default
@@ -13,10 +14,10 @@ export class Map {
fogUnits=[]//Units need to draw fog on screen
allUnits=[]//Units need to draw fog on minimap
batchSize=0//Draw fog by each batch
- miniCxt=$('canvas[name="mini_map"]')[0].getContext('2d')
+ miniCxt=($('canvas[name="mini_map"]')[0] as any).getContext('2d')
static fogCanvas=document.createElement('canvas')
static shadowCanvas=document.createElement('canvas')//Pre-render for fog shadow
- insideStroke:{
+ static insideStroke ={
width:0,
height:0
}
@@ -45,11 +46,12 @@ export class Map {
//Map is ready after current map set
Map.ready=true;
}
- getCurrentMap= function(){
+
+ static getCurrentMap= function(){
return sourceLoader.sources['Map_'+Map.currentMap];
}
//Draw interface call
- drawFogAndMinimap= function(){
+ static drawFogAndMinimap= function(){
if (Map.fogFlag){
Map.refreshFog();
//Draw fog on main map
@@ -62,7 +64,7 @@ export class Map {
Map.drawMiniMap();
}
//Used by drawFogAndMinimap
- refreshFog= function(){
+ static refreshFog= function(){
//Reset composite operation
Map.fogCxt.globalCompositeOperation='source-over';
//Brush black fog to clean old fog
@@ -92,7 +94,7 @@ export class Map {
});
}
//Used by drawFogAndMinimap: draw red&green block and white stroke
- drawMiniMap= function(){
+ static drawMiniMap= function(){
//Selected map size
var mapWidth=Map.getCurrentMap().width;
var mapHeight=Map.getCurrentMap().height;
@@ -116,7 +118,7 @@ export class Map {
Map.miniCxt.lineWidth=2;
Map.miniCxt.strokeRect((130*Map.offsetX/mapWidth)>>0,(130*Map.offsetY/mapHeight)>>0,Map.insideStroke.width,Map.insideStroke.height);
}
- drawMud= function(){
+ static drawMud= function(){
var _increments=[[0,1],[-1,0],[0,-1],[1,0]];
var mudRadius=120;
var mudIncrements=_$.mapTraverse(_increments,function(x){
@@ -152,7 +154,7 @@ export class Map {
Game.backCxt.fill();
Game.backCxt.restore();
}
- drawBg= function(){
+ static drawBg= function(){
//Clear background
Game.backCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
//Draw map as background
@@ -161,7 +163,7 @@ export class Map {
//Draw mud for ZergBuildings
Map.drawMud();
}
- refresh= function(direction){
+ static refresh= function(direction){
var edgeX=Map.getCurrentMap().width-Game.HBOUND;
var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
var onlyMap;
@@ -190,14 +192,14 @@ export class Map {
//Need re-calculate fog when screen moves
if (!onlyMap) Map.drawFogAndMinimap();
}
- clickHandler= function(event){
+ static clickHandler= function(event){
//Mouse at (clickX,clickY)
var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
//Relocate map center
Map.relocateAt(Map.getCurrentMap().width*clickX/130,Map.getCurrentMap().height*clickY/130);
}
- dblClickHandler= function(event){
+ static dblClickHandler= function(event){
//Mouse at (clickX,clickY)
var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
@@ -213,7 +215,7 @@ export class Map {
chara.moveTo(mapX,mapY);
});
}
- relocateAt= function(centerX,centerY){
+ static relocateAt= function(centerX,centerY){
//Get map edge
var edgeX=Map.getCurrentMap().width-Game.HBOUND;
var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
diff --git a/src/Characters/Terran.ts b/src/Characters/Terran.ts
index f22e8a1..6b716ef 100644
--- a/src/Characters/Terran.ts
+++ b/src/Characters/Terran.ts
@@ -1,7 +1,7 @@
/******* Define Terran units *******/
var Terran={};
Terran.SCV=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -70,7 +70,7 @@ Terran.SCV=AttackableUnit.extends({
'7':{name:'BasicBuilding'},
'8':{name:'AdvancedBuilding'}
},
- buildTerranBuilding:function(location){
+ buildTerranBuilding= function(location){
//Has location callback info or nothing
if (location){
//Move toward target to fire Ensnare
@@ -140,7 +140,7 @@ Terran.SCV=AttackableUnit.extends({
}
});
Terran.Marine=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus: {
@@ -224,19 +224,19 @@ Terran.Marine=AttackableUnit.extends({
},
upgrade:['UpgradeInfantryWeapons','UpgradeInfantryArmors'],
items:{
- '7':{name:'StimPacks',condition:function(){
+ '7':{name:'StimPacks',condition= function(){
return Magic.StimPacks.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
Terran.Firebat=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus: {
@@ -326,19 +326,19 @@ Terran.Firebat=AttackableUnit.extends({
},
upgrade:['UpgradeInfantryWeapons','UpgradeInfantryArmors'],
items:{
- '7':{name:'StimPacks',condition:function(){
+ '7':{name:'StimPacks',condition= function(){
return Magic.StimPacks.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
Terran.Ghost=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus: {
@@ -424,25 +424,25 @@ Terran.Ghost=AttackableUnit.extends({
},
upgrade:['UpgradeInfantryWeapons','UpgradeInfantryArmors'],
items:{
- '7':{name:'Cloak',condition:function(){
+ '7':{name:'Cloak',condition= function(){
return Magic.PersonalCloak.enabled
}},
- '8':{name:'Lockdown',condition:function(){
+ '8':{name:'Lockdown',condition= function(){
return Magic.Lockdown.enabled
}},
- '9':{name:'NuclearStrike',condition:function(){
+ '9':{name:'NuclearStrike',condition= function(){
return Magic.NuclearStrike.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
Terran.Medic=Unit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Nothing
},
prototypePlus: {
@@ -524,22 +524,22 @@ Terran.Medic=Unit.extends({
upgrade:['UpgradeInfantryArmors'],
items:{
'7':{name:'Heal'},
- '8':{name:'Restoration',condition:function(){
+ '8':{name:'Restoration',condition= function(){
return Magic.Restoration.enabled
}},
- '9':{name:'OpticalFlare',condition:function(){
+ '9':{name:'OpticalFlare',condition= function(){
return Magic.OpticalFlare.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
Unit.turnAround.call(this);
}
}
});
Terran.Vulture=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.attack=this.imgPos.dock=this.imgPos.moving;
this.frame.attack=this.frame.dock=this.frame.moving;
@@ -580,14 +580,14 @@ Terran.Vulture=AttackableUnit.extends({
},
upgrade:['UpgradeVehicleWeapons','UpgradeVehicleArmors'],
items:{
- '7':{name:'SpiderMines',condition:function(){
+ '7':{name:'SpiderMines',condition= function(){
return Magic.SpiderMines.enabled
}}
}
}
});
Terran.Tank=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
this.imgPos.attack=this.imgPos.dock;
this.frame.attack=this.frame.dock;
},
@@ -651,14 +651,14 @@ Terran.Tank=AttackableUnit.extends({
},
upgrade:['UpgradeVehicleWeapons','UpgradeVehicleArmors'],
items:{
- '7':{name:'SeigeMode',condition:function(){
+ '7':{name:'SeigeMode',condition= function(){
return Magic.SeigeMode.enabled
}}
}
}
});
Terran.Goliath=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Bind bgm
this.sound.attackG=new Audio(Game.CDN+'bgm/'+this.name+'.attack.wav');
this.sound.attackF=new Audio(Game.CDN+'bgm/'+this.name+'.attackF.wav');
@@ -761,7 +761,7 @@ Terran.Goliath=AttackableUnit.extends({
}
});
Terran.Wraith=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -819,19 +819,19 @@ Terran.Wraith=AttackableUnit.extends({
},
upgrade:['UpgradeShipWeapons','UpgradeShipArmors'],
items:{
- '7':{name:'Cloak',condition:function(){
+ '7':{name:'Cloak',condition= function(){
return Magic.Cloak.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
AttackableUnit.hover.call(this);
}
}
});
Terran.Dropship=Unit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -873,7 +873,7 @@ Terran.Dropship=Unit.extends({
'9':{name:'UnloadAll'}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
Unit.hover.call(this);
},
@@ -881,7 +881,7 @@ Terran.Dropship=Unit.extends({
}
});
Terran.Vessel=Unit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -920,22 +920,22 @@ Terran.Vessel=Unit.extends({
upgrade:['UpgradeShipArmors'],
items:{
'7':{name:'DefensiveMatrix'},
- '8':{name:'EMPShockwave',condition:function(){
+ '8':{name:'EMPShockwave',condition= function(){
return Magic.EMPShockwave.enabled
}},
- '9':{name:'Irradiate',condition:function(){
+ '9':{name:'Irradiate',condition= function(){
return Magic.Irradiate.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
Unit.hover.call(this);
}
}
});
Terran.BattleCruiser=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -976,19 +976,19 @@ Terran.BattleCruiser=AttackableUnit.extends({
},
upgrade:['UpgradeShipWeapons','UpgradeShipArmors'],
items:{
- '7':{name:'Yamato',condition:function(){
+ '7':{name:'Yamato',condition= function(){
return Magic.Yamato.enabled
}}
},
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
AttackableUnit.hover.call(this);
}
}
});
Terran.Valkyrie=AttackableUnit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.attack=this.imgPos.dock=this.imgPos.moving;
this.frame.attack=this.frame.dock=this.frame.moving;
@@ -1034,14 +1034,14 @@ Terran.Valkyrie=AttackableUnit.extends({
},
upgrade:['UpgradeShipWeapons','UpgradeShipArmors'],
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
AttackableUnit.hover.call(this);
}
}
});
Terran.Civilian=Unit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
},
@@ -1089,7 +1089,7 @@ Terran.Civilian=Unit.extends({
recover:Building.TerranBuilding.prototype.recover,
upgrade:['UpgradeInfantryArmors'],
//Override
- dock:function(){
+ dock= function(){
//Use the same behavior
Unit.turnAround.call(this);
}
diff --git a/src/Characters/Units.ts b/src/Characters/Units.ts
index 0365664..974610c 100644
--- a/src/Characters/Units.ts
+++ b/src/Characters/Units.ts
@@ -1,6 +1,10 @@
+import {Gobj} from './Gobj';
+import {Game} from '../GameRule/Game';
+
//Define unit which has HP/direction and be selectable, unattackable unit
-var Unit=Gobj.extends({
- constructorPlus:function(props){
+export class Unit extends Gobj {
+
+ constructorPlus= function(props){
//Add id for unit
this.id=Unit.currentID++;
this.direction=Unit.randomDirection();
@@ -25,12 +29,13 @@ var Unit=Gobj.extends({
//Show unit
myself.dock();
},0);
- },
+ }
+
prototypePlus:{
name:"Unit",
isFlying:true,
//Override Gobj method
- animeFrame:function(){
+ animeFrame= function(){
//Animation play
this.action++;
//Override Gobj here, support hidden frames
@@ -41,7 +46,7 @@ var Unit=Gobj.extends({
//Multiple hidden frames support
if (this.imgPos[this.status].left[0][this.action]==-1) this.action=0;
},
- detectOutOfBound:function(){
+ detectOutOfBound= function(){
var boundX=Map.getCurrentMap().width-this.width;
var boundY=Map.getCurrentMap().height-this.height;
//Right Bound
@@ -62,17 +67,17 @@ var Unit=Gobj.extends({
}
},
//Can move in any direction
- updateLocation:function(){
+ updateLocation= function(){
this.x=Math.round(this.x+this.get('speed')*Math.cos(this.angle));
this.y=Math.round(this.y+this.get('speed')*Math.sin(this.angle));
},
//Add new functions to prototype
- turnTo:function(direction){
+ turnTo= function(direction){
//Change direction
this.direction=direction;
},
//Dock means stop moving but keep animation
- dock:function(){
+ dock= function(){
//Clear old timer
this.stop();
//Launch new dock timer
@@ -87,16 +92,16 @@ var Unit=Gobj.extends({
};
this.allFrames['animate']=animateFrame;
},
- stand:function(){
+ stand= function(){
this.dock();
},//alias
- stopMoving:function(){
+ stopMoving= function(){
this.dock();
},//alias
- run:function(){
+ run= function(){
this.moving();
},//alias
- navigateTo:function(clickX,clickY,range){
+ navigateTo= function(clickX,clickY,range){
if (!range) range=Unit.moveRange;//Smallest limit by default
//Center position
var charaX=this.posX();
@@ -149,7 +154,7 @@ var Unit=Gobj.extends({
this.angle=Math.atan2(vector[0],vector[1]);
}
},
- faceTo:function(target,preventAction){
+ faceTo= function(target,preventAction){
var direction;
//Unit or Building
if (target instanceof Gobj){
@@ -162,7 +167,7 @@ var Unit=Gobj.extends({
if (!preventAction) this.turnTo(direction);
return direction;
},
- escapeFrom:function(enemy){
+ escapeFrom= function(enemy){
//Add to fix holding issue
if (this.hold) return;
//From enemy to myself
@@ -174,7 +179,7 @@ var Unit=Gobj.extends({
//Escape along vector
this.moveTo(this.posX()+escapeVector[0],this.posY()+escapeVector[1]);
},
- moveTo:function(clickX,clickY,range,callback){
+ moveTo= function(clickX,clickY,range,callback){
if (!range) range=Unit.moveRange;//Smallest limit by default
//Start new routing
var myself=this;
@@ -189,7 +194,7 @@ var Unit=Gobj.extends({
//Start moving
this.run();
},
- moveToward:function(target,range,callback){
+ moveToward= function(target,range,callback){
if (!range) range=Unit.moveRange;//Smallest limit by default
//Start new routing
var myself=this;
@@ -213,7 +218,7 @@ var Unit=Gobj.extends({
this.run();
},
//Override for sound effect
- die:function(){
+ die= function(){
//Old behavior
Gobj.prototype.die.call(this);
this.life=0;
@@ -225,7 +230,7 @@ var Unit=Gobj.extends({
}
},
//AI when attacked by enemy
- reactionWhenAttackedBy:function(enemy,onlyDamage){
+ reactionWhenAttackedBy= function(enemy,onlyDamage){
//Resign and give reward to enemy if has no life before dead
if (this.life<=0) {
//If multiple target, only die once and give reward
@@ -244,7 +249,7 @@ var Unit=Gobj.extends({
}
},
//Calculate damage, if enemy is damage itself, return that damage directly
- calculateDamageBy:function(enemyObj){
+ calculateDamageBy= function(enemyObj){
var damage=0;
if (enemyObj instanceof Gobj){
var enemyAttackType=enemyObj.attackType;
@@ -256,7 +261,7 @@ var Unit=Gobj.extends({
else damage=enemyObj;
return damage;
},
- getDamageBy:function(enemy,percent){
+ getDamageBy= function(enemy,percent){
if (percent==undefined) percent=1;//100% by default
var damage=0;
//If has SP and shield remain
@@ -277,7 +282,7 @@ var Unit=Gobj.extends({
}
},
//Attack ground action
- attackGround:function(position,loop){
+ attackGround= function(position,loop){
//Convert to array
var positions=[].concat(position);
if (this.attack) this.stopAttack();
@@ -294,19 +299,19 @@ var Unit=Gobj.extends({
if (loop) checkpoint.next=this.destination;
},
//Patrol action
- patrol:function(position,addHere){
+ patrol= function(position,addHere){
//Convert to array
var positions=[].concat(position);
if (addHere) positions.push({x:this.posX(),y:this.posY()});
this.attackGround(positions,true);
},
- isMachine:function(){
+ isMachine= function(){
return ["SCV","Vulture","Tank","Goliath","Wraith","Dropship","Vessel","BattleCruiser","Valkyrie",
"Probe","Dragoon","Shuttle","Reaver","Observer","Scout","Carrier","Arbiter","Corsair","HeroCruiser"]
.indexOf(this.name)!=-1;
},
//Life status
- lifeStatus:function(){
+ lifeStatus= function(){
var lifeRatio=this.life/this.get('HP');
return ((lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red");
}
@@ -530,7 +535,7 @@ Unit.walkAroundLarva=function(){
this.allFrames['dock']=dockFrame;
};
var AttackableUnit=Unit.extends({
- constructorPlus:function(props){
+ constructorPlus= function(props){
this.bullet={};
this.kill=0;
this.target={};
@@ -546,10 +551,10 @@ var AttackableUnit=Unit.extends({
prototypePlus:{
//Add basic unit info
name:"AttackableUnit",
- isInAttackRange:function(enemy){
+ isInAttackRange= function(enemy){
return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('attackRange')});
},
- matchAttackLimit:function(enemy){
+ matchAttackLimit= function(enemy){
//Has attack limit
if (this.attackLimit){
//Doesn't match attack limit
@@ -559,7 +564,7 @@ var AttackableUnit=Unit.extends({
//No attack limit or match attack limit
return true;
},
- attack:function(enemy){
+ attack= function(enemy){
//Cannot attack invisible unit or unit who mismatch your attack type
if (enemy['isInvisible'+this.team] || !(this.matchAttackLimit(enemy))) {
Referee.voice('pError').play();
@@ -775,13 +780,13 @@ var AttackableUnit=Unit.extends({
this.allFrames['attack']=attackFrame;
}
},
- stopAttack:function(){
+ stopAttack= function(){
//Stop attacking animation
delete this.allFrames['attack'];
//Clear target
this.target={};
},
- findNearbyTargets:function(){
+ findNearbyTargets= function(){
//Initial
var myself=this;
var units=Unit.allUnits.filter(function(chara){
@@ -815,10 +820,10 @@ var AttackableUnit=Unit.extends({
//Take attackable>>unattackable,unit>>building,near>>far as priority, will attracted if be attacked
return results;
},
- highestPriorityTarget:function(){
+ highestPriorityTarget= function(){
return this.findNearbyTargets()[0];
},
- AI:function(){
+ AI= function(){
//Dead unit doesn't have following AI
if (this.status=='dead') return;
//If no mission, return it to scout status
@@ -853,7 +858,7 @@ var AttackableUnit=Unit.extends({
}
},
//Override
- reactionWhenAttackedBy:function(enemy,onlyDamage){
+ reactionWhenAttackedBy= function(enemy,onlyDamage){
//Resign and give reward to enemy if has no life before dead
if (this.life<=0) {
//If multiple target, only die once and give reward
@@ -883,43 +888,43 @@ var AttackableUnit=Unit.extends({
}
}
},
- isAttacking:function(){
+ isAttacking= function(){
//Has target
return (this.target instanceof Gobj);
},
- followEnemy:function(){
+ followEnemy= function(){
//Remind to attack again
this.attack(this.target);
//Filter out building target
if (this.target instanceof Unit) this.tracing=true;
},
- isTracing:function(){
+ isTracing= function(){
return this.isAttacking() && this.status=="moving";
},
- isFiring:function(){
+ isFiring= function(){
//May out of range and cannot fire, don't follow when attack status
return this.isAttacking() && this.status=="dock";
},
//Override
- isIdle:function(){
+ isIdle= function(){
//Not moving or attacking
return !this.isAttacking() && this.status=="dock";
},
- cannotReachTarget:function(){
+ cannotReachTarget= function(){
//Found target outside attack range after once firing, need follow once
return this.isFiring() && !(this.isInAttackRange(this.target));
},
- isMissingTarget:function(){
+ isMissingTarget= function(){
//Lock on target has global sight, lock off (attackGround) use its own sight
return !this.targetLock && this.isAttacking() && !(this.canSee(this.target));
},
- isReloaded:function(){
+ isReloaded= function(){
//Add for newly reloaded yamato, two kinds of bullet conflict, ignore bullet array
if ((this.bullet instanceof Gobj) && this.bullet.status!='dead') return false;
return this.coolDown;
},
//Override for attackable unit
- die:function(){
+ die= function(){
//Old behavior
Unit.prototype.die.call(this);
//Clear new timer for unit
diff --git a/src/Characters/Zerg.ts b/src/Characters/Zerg.ts
index 238e4f7..30bdd7a 100644
--- a/src/Characters/Zerg.ts
+++ b/src/Characters/Zerg.ts
@@ -1,6 +1,7 @@
/******* Define Zerg units *******/
var Zerg={};
-Zerg.Drone=AttackableUnit.extends({
+
+export class Zerg.Drone extends AttackableUnit{
constructorPlus:function(props){
this.sound.burrow=new Audio(Game.CDN+'bgm/Zerg.burrow.wav');
this.sound.unburrow=new Audio(Game.CDN+'bgm/Zerg.unburrow.wav');
@@ -216,6 +217,8 @@ Zerg.Drone=AttackableUnit.extends({
}
}
});
+
+
Zerg.Zergling=AttackableUnit.extends({
constructorPlus:function(props){
this.sound.burrow=new Audio(Game.CDN+'bgm/Zerg.burrow.wav');
diff --git a/src/GameRule/Cheat.ts b/src/GameRule/Cheat.ts
index 130a7c0..24ae896 100644
--- a/src/GameRule/Cheat.ts
+++ b/src/GameRule/Cheat.ts
@@ -1,9 +1,13 @@
-var Cheat={
- isShown:false,
- cwal:false,
- gathering:false,
- manUnlimited:false,
- handler:function(){
+import {Multiplayer} from './Multiplayer';
+import {Game} from './Game';
+
+
+class Cheat {
+ static isShown:false
+ static cwal:false
+ static gathering:false
+ static manUnlimited:false
+ handler= function(){
if (Cheat.isShown){
if (Multiplayer.ON){
Multiplayer.webSocket.send(JSON.stringify({
@@ -34,8 +38,8 @@ var Cheat={
Cheat.isShown=true;
keyController.disable=true;
}
- },
- execute:function(cheatCode){
+ }
+ execute= function(cheatCode){
//Forbid cheating when multiplayer mode
if (Multiplayer.ON) return;
var cheatFlag=true;
diff --git a/src/GameRule/Game.ts b/src/GameRule/Game.ts
index 21395af..54a8aa0 100644
--- a/src/GameRule/Game.ts
+++ b/src/GameRule/Game.ts
@@ -1,5 +1,6 @@
import * as $ from 'jquery';
import {Gobj} from '../Characters/Gobj';
+import {Referee} from './Referee';
export class Game {
@@ -16,10 +17,10 @@ export class Game {
public playerNum:number = 2//By default
public teams = {}
public multiplayer:boolean = false//By default
- public cxt = $('#middleCanvas')[0].getContext('2d')
- public frontCxt = $('#frontCanvas')[0].getContext('2d')
- public static backCxt = $('#backCanvas')[0].getContext('2d')
- public fogCxt = $('#fogCanvas')[0].getContext('2d')
+ public cxt = ($('#middleCanvas')[0] as any) .getContext('2d')
+ public frontCxt = ($('#frontCanvas')[0]as any).getContext('2d')
+ public static backCxt = ($('#backCanvas')[0]as any).getContext('2d')
+ public static fogCxt = ($('#fogCanvas')[0]as any).getContext('2d')
private _timer:number = -1
private _frameInterval:number = 100
public static mainTick: number = 0
@@ -32,10 +33,10 @@ export class Game {
public _oldAllSelected = []
public hackMode = false
public isApp = false
- public offline =false
+ public static offline =false
public static CDN =''
- static public addIntoAllSelected = function(chara,override){
+ static public addIntoAllSelected = function(chara, override){
if (chara instanceof Gobj){
//Add into allSelected if not included
if (Game.allSelected.indexOf(chara)==-1) {
@@ -73,7 +74,7 @@ export class Game {
Game.commands[dueTick].push(func);
}
//To replace setInterval
- commandInterval= function(func,interval){
+ static commandInterval= function(func,interval){
var funcAdjust=function(){
func();
Game.commandTimeout(funcAdjust,interval);
@@ -81,15 +82,7 @@ export class Game {
Game.commandTimeout(funcAdjust,interval);
}
- race:{
- selected:'Terran',//Terran race by default
- choose= function(race){
- this.selected=race;
- $('div#GamePlay').attr('race',race);
- }
- }
-
- layerSwitchTo= function(layerName){
+ static layerSwitchTo = function(layerName){
$('div.GameLayer').hide();
$('#'+layerName).show(); //show('slow')
}
@@ -215,7 +208,7 @@ export class Game {
Game.start();
})
}
- start= function(){
+ static start= function(){
//Game start
Game.layerSwitchTo("GameStart");
//Init level selector
@@ -233,7 +226,7 @@ export class Game {
Game.play();
});
}
- play= function(){
+ static play= function(){
//Load level to initial when no error occurs
if (!(Levels[Game.level-1].load())){
//Need Game.playerNum before expansion
@@ -252,7 +245,7 @@ export class Game {
Game.animation();
}
}
- getPropArray= function(prop){
+ static getPropArray= function(prop){
var result=[];
for (var N=0;Nspan')[1].innerHTML=Resource[Game.team].totalMan;
//Check if man overflow
$('div.resource_Box span.manNum')[0].style.color=(Resource[Game.team].curMan>Resource[Game.team].totalMan)?"red":"#00ff00";
- },
- drawProcessingBox= function(){
+ }
+ static drawProcessingBox= function(){
//Show processing box if it's processing
var processing=Game.selectedUnit.processing;
//Can disable this filter for testing
@@ -831,15 +824,15 @@ export class Game {
}
else $('div.upgrading').removeAttr('title').hide();
}
- },
- refreshMultiSelectBox= function(){
+ }
+ static refreshMultiSelectBox= function(){
var divs=$('div.override div.multiSelection div');
//Only refresh border color on current multiSelect box
for (var n=0;nN
var units=Unit.allGroundUnits().concat(Building.allBuildings);
for(var N=0;N
Date: Sun, 2 Apr 2017 18:53:44 +0200
Subject: [PATCH 05/15] revert to javascript
---
src/Characters/{Animation.ts => Animation.js} | 0
src/Characters/{Building.ts => Building.js} | 270 ++++++------
src/Characters/{Bullets.ts => Bullets.js} | 75 ++--
src/Characters/{Burst.ts => Burst.js} | 156 ++++---
src/Characters/{Button.ts => Button.js} | 0
src/Characters/Gobj.js | 264 +++++++++++
src/Characters/Gobj.ts | 282 ------------
src/Characters/{Hero.ts => Hero.js} | 0
src/Characters/{Magic.ts => Magic.js} | 0
src/Characters/{Map.ts => Map.js} | 80 ++--
src/Characters/{Neutral.ts => Neutral.js} | 0
src/Characters/{Protoss.ts => Protoss.js} | 0
src/Characters/{Terran.ts => Terran.js} | 76 ++--
src/Characters/{Units.ts => Units.js} | 89 ++--
src/Characters/{Upgrade.ts => Upgrade.js} | 0
src/Characters/{Zerg.ts => Zerg.js} | 5 +-
.../{keyController.ts => keyController.js} | 0
...{mouseController.ts => mouseController.js} | 0
src/GameRule/{Cheat.ts => Cheat.js} | 20 +-
src/GameRule/{Game.ts => Game.js} | 231 +++++-----
src/GameRule/{Levels.ts => Levels.js} | 8 -
.../{Multiplayer.ts => Multiplayer.js} | 32 +-
src/GameRule/Race.ts | 7 -
src/GameRule/{Referee.ts => Referee.js} | 77 ++--
src/GameRule/{Resource.ts => Resource.js} | 3 +-
src/GameRule/{SC_server.ts => SC_server.js} | 0
src/Utils/sourceLoader.js | 61 ++-
src/Utils/sourceLoader.ts | 54 ---
src/bgm/Deleted | 0
src/cache.manifest | 410 ++++++++++++++++++
src/favicon.ico | Bin 0 -> 4286 bytes
src/index.html | 2 +-
32 files changed, 1240 insertions(+), 962 deletions(-)
rename src/Characters/{Animation.ts => Animation.js} (100%)
rename src/Characters/{Building.ts => Building.js} (94%)
rename src/Characters/{Bullets.ts => Bullets.js} (94%)
rename src/Characters/{Burst.ts => Burst.js} (92%)
rename src/Characters/{Button.ts => Button.js} (100%)
create mode 100644 src/Characters/Gobj.js
delete mode 100644 src/Characters/Gobj.ts
rename src/Characters/{Hero.ts => Hero.js} (100%)
rename src/Characters/{Magic.ts => Magic.js} (100%)
rename src/Characters/{Map.ts => Map.js} (88%)
rename src/Characters/{Neutral.ts => Neutral.js} (100%)
rename src/Characters/{Protoss.ts => Protoss.js} (100%)
rename src/Characters/{Terran.ts => Terran.js} (96%)
rename src/Characters/{Units.ts => Units.js} (96%)
rename src/Characters/{Upgrade.ts => Upgrade.js} (100%)
rename src/Characters/{Zerg.ts => Zerg.js} (99%)
rename src/Controller/{keyController.ts => keyController.js} (100%)
rename src/Controller/{mouseController.ts => mouseController.js} (100%)
rename src/GameRule/{Cheat.ts => Cheat.js} (95%)
rename src/GameRule/{Game.ts => Game.js} (94%)
rename src/GameRule/{Levels.ts => Levels.js} (99%)
rename src/GameRule/{Multiplayer.ts => Multiplayer.js} (98%)
delete mode 100644 src/GameRule/Race.ts
rename src/GameRule/{Referee.ts => Referee.js} (94%)
rename src/GameRule/{Resource.ts => Resource.js} (99%)
rename src/GameRule/{SC_server.ts => SC_server.js} (100%)
delete mode 100644 src/Utils/sourceLoader.ts
create mode 100644 src/bgm/Deleted
create mode 100644 src/cache.manifest
create mode 100644 src/favicon.ico
diff --git a/src/Characters/Animation.ts b/src/Characters/Animation.js
similarity index 100%
rename from src/Characters/Animation.ts
rename to src/Characters/Animation.js
diff --git a/src/Characters/Building.ts b/src/Characters/Building.js
similarity index 94%
rename from src/Characters/Building.ts
rename to src/Characters/Building.js
index b336210..5de0f52 100644
--- a/src/Characters/Building.ts
+++ b/src/Characters/Building.js
@@ -1,10 +1,5 @@
-import {Gobj} from './Gobj';
-import {Unit} from './Units';
-import {Game} from '../GameRule/Game';
-
-export class Building extends Gobj {
-
- constructorPlus= function(props){
+var Building=Gobj.extends({
+ constructorPlus:function(props){
//Add id for building
this.id=Unit.currentID++;
this.life=this.get('HP');
@@ -21,13 +16,13 @@ export class Building extends Gobj {
//Show unit
myself.dock();
},0);
- }
- prototypePlus = {
+ },
+ 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
@@ -37,7 +32,7 @@ export class Building extends Gobj {
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
@@ -50,11 +45,11 @@ export class Building extends Gobj {
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;
@@ -67,7 +62,7 @@ export class Building extends Gobj {
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) {
@@ -81,11 +76,11 @@ export class Building extends Gobj {
}
},
//Fix bug, for consistent, cause 100% damage on building
- calculateDamageBy= function(enemyObj){
+ calculateDamageBy:function(enemyObj){
return (enemyObj instanceof Gobj)?enemyObj.get('damage'):enemyObj;
},
//Calculate damage, for consistence
- getDamageBy= function(enemy,percent){
+ getDamageBy:function(enemy,percent){
if (percent==undefined) percent=1;//100% by default
var damage=0;
//If has SP and shield remain
@@ -106,15 +101,12 @@ export class Building extends Gobj {
}
},
//Life status
- lifeStatus= function(){
+ 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(){
@@ -130,7 +122,7 @@ Building.enemyBuildings=function(){
//Zerg buildings
Building.ZergBuilding=Building.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
this.sound={
selected:new Audio(Game.CDN+'bgm/ZergBuilding.selected.wav'),
death:new Audio(Game.CDN+'bgm/ZergBuilding.death.wav')
@@ -143,7 +135,7 @@ Building.ZergBuilding=Building.extends({
name: "ZergBuilding",
dieEffect:Burst.ZergBuildingBurst,
injuryNames:['bloodA','bloodB','bloodC'],
- recover= function(){
+ recover:function(){
if (this.life0) {
@@ -700,7 +693,7 @@ Bullets.ReaverBomb=Bullets.extends({
}
});
Bullets.ReaverBombII=Bullets.extends({
- constructorPlus= function(props){},
+ constructorPlus:function(props){},
prototypePlus:{
//Add basic unit info
name:"Burst",
@@ -721,7 +714,7 @@ Bullets.ReaverBombII=Bullets.extends({
}
});
Bullets.Interceptor=Bullets.extends({
- constructorPlus= function(props){},
+ constructorPlus:function(props){},
prototypePlus:{
//Add basic unit info
name:"Burst",
@@ -739,7 +732,7 @@ Bullets.Interceptor=Bullets.extends({
},
//Override cause damage timing
noDamage:true,
- fire= function(){
+ fire:function(){
this.inherited.fire.call(this);
var target=this.target;
var owner=this.owner;
@@ -751,7 +744,7 @@ Bullets.Interceptor=Bullets.extends({
}
});
Bullets.DevilBall=Bullets.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
this.life=this.traceTimes;
},
prototypePlus:{
diff --git a/src/Characters/Burst.ts b/src/Characters/Burst.js
similarity index 92%
rename from src/Characters/Burst.ts
rename to src/Characters/Burst.js
index b0aac3d..a935dbb 100644
--- a/src/Characters/Burst.ts
+++ b/src/Characters/Burst.js
@@ -1,8 +1,6 @@
-import {Gobj} from './Gobj';
-
//One animation period which only play for a while and die
-export class Burst extends Gobj{
- constructorPlus= function(props){
+var Burst=Gobj.extends({
+ constructorPlus:function(props){
//Override if has props.scale
if (props.scale) this.scale=props.scale;
//Resize drawing by scale
@@ -56,7 +54,7 @@ export class Burst extends Gobj{
},
prototypePlus:{
//Override Gobj method
- animeFrame= function(){
+ animeFrame:function(){
//Animation play
this.action++;
//Override Gobj here, can have hidden frames
@@ -72,7 +70,7 @@ export class Burst extends Gobj{
this.y=(this.target.posY()-this.height*times/2)>>0;
}
},
- burst= function(){
+ burst:function(){
this.status="burst";
//Start play burst animation
var myself=this;
@@ -90,7 +88,7 @@ export class Burst extends Gobj{
},duration);
}
},
- die= function(){
+ die:function(){
//Run callback when burst die
if (this.callback) this.callback();
Gobj.prototype.die.call(this);
@@ -101,7 +99,7 @@ export class Burst extends Gobj{
Burst.allEffects=[];
//Define different bursts
Burst.GreenFog=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/GreenFog.burst.wav').play();
},
@@ -122,7 +120,7 @@ Burst.GreenFog=Burst.extends({
}
});
Burst.Parasite=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/Magic.Parasite.wav').play();
},
@@ -143,7 +141,7 @@ Burst.Parasite=Burst.extends({
}
});
Burst.Spore=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//No sound
},
prototypePlus:{
@@ -163,7 +161,7 @@ Burst.Spore=Burst.extends({
}
});
Burst.GreenBallBroken=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/Greenball.burst.wav').play();
},
@@ -184,7 +182,7 @@ Burst.GreenBallBroken=Burst.extends({
}
});
Burst.PurpleCloudSpread=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/PurpleCloud.burst.wav').play();
},
@@ -199,7 +197,7 @@ Burst.PurpleCloudSpread=Burst.extends({
},
width:50,
height:60,
- callback= function(){
+ callback:function(){
var chara=this.target;
//Fix all spored issue
if (chara.status=='dead' || chara.status==null) return;
@@ -219,7 +217,7 @@ Burst.PurpleCloudSpread=Burst.extends({
if (!chara.purpleBuffer) chara.purpleBuffer=[];
chara.purpleBuffer.push(bufferObj);
//Purple effect
- new Animation.PurpleEffect({team:this.team,target:chara,callback= function(){
+ new Animation.PurpleEffect({team:this.team,target:chara,callback:function(){
//Restore in 30 seconds, Last In First Out
if (chara.purpleBuffer && chara.removeBuffer(chara.purpleBuffer.pop())) {
chara.buffer.PurpleCloud--;
@@ -237,7 +235,7 @@ Burst.PurpleCloudSpread=Burst.extends({
}
});
Burst.Sunken=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/Sunken.burst.wav').play();
},
@@ -258,7 +256,7 @@ Burst.Sunken=Burst.extends({
}
});
Burst.SmallFireSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
},
@@ -279,7 +277,7 @@ Burst.SmallFireSpark=Burst.extends({
}
});
Burst.FireSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -299,7 +297,7 @@ Burst.FireSpark=Burst.extends({
}
});
Burst.FireSparkSound=Burst.FireSpark.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/FireSpark.burst.wav').play();
},
@@ -308,7 +306,7 @@ Burst.FireSparkSound=Burst.FireSpark.extends({
}
});
Burst.LaserSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -328,7 +326,7 @@ Burst.LaserSpark=Burst.extends({
}
});
Burst.VultureSpark=Burst.LaserSpark.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/VultureSpark.burst.wav').play();
},
@@ -337,7 +335,7 @@ Burst.VultureSpark=Burst.LaserSpark.extends({
}
});
Burst.HydraSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -357,7 +355,7 @@ Burst.HydraSpark=Burst.extends({
}
});
Burst.CorsairCloud=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -377,7 +375,7 @@ Burst.CorsairCloud=Burst.extends({
}
});
Burst.ArchonBurst=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -397,7 +395,7 @@ Burst.ArchonBurst=Burst.extends({
}
});
Burst.DragoonBallBroken=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/DragoonBall.burst.wav').play();
},
@@ -418,7 +416,7 @@ Burst.DragoonBallBroken=Burst.extends({
}
});
Burst.ShootSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -438,7 +436,7 @@ Burst.ShootSpark=Burst.extends({
}
});
Burst.BlueShootSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -458,7 +456,7 @@ Burst.BlueShootSpark=Burst.extends({
}
});
Burst.SCVSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -478,7 +476,7 @@ Burst.SCVSpark=Burst.extends({
}
});
Burst.ProbeSpark=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -498,7 +496,7 @@ Burst.ProbeSpark=Burst.extends({
}
});
Burst.ReaverBurst=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
},
@@ -519,7 +517,7 @@ Burst.ReaverBurst=Burst.extends({
}
});
Burst.PurpleFog=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
},
@@ -541,7 +539,7 @@ Burst.PurpleFog=Burst.extends({
});
Burst.InfestedBomb=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Has burst sound effect
if (this.insideScreen()) new Audio(Game.CDN+'bgm/ReaverBomb.burst.wav').play();
},
@@ -562,7 +560,7 @@ Burst.InfestedBomb=Burst.extends({
}
});
Burst.ScourgeBomb=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -583,7 +581,7 @@ Burst.ScourgeBomb=Burst.extends({
});
Burst.SmallExplode=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -603,7 +601,7 @@ Burst.SmallExplode=Burst.extends({
}
});
Burst.MiddleExplode=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -623,7 +621,7 @@ Burst.MiddleExplode=Burst.extends({
}
});
Burst.BigExplode=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -643,7 +641,7 @@ Burst.BigExplode=Burst.extends({
}
});
Burst.SmallBlueExplode=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -663,7 +661,7 @@ Burst.SmallBlueExplode=Burst.extends({
}
});
Burst.MiddleBlueExplode=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -683,7 +681,7 @@ Burst.MiddleBlueExplode=Burst.extends({
}
});
Burst.BigBlueExplode=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -703,7 +701,7 @@ Burst.BigBlueExplode=Burst.extends({
}
});
Burst.ZergBuildingBurst=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Need clear mud when ZergBuildingBurst finished
this.callback=function(){
Map.needRefresh="MAP";
@@ -726,7 +724,7 @@ Burst.ZergBuildingBurst=Burst.extends({
}
});
Burst.TerranBuildingBurst=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -746,7 +744,7 @@ Burst.TerranBuildingBurst=Burst.extends({
}
});
Burst.ProtossBuildingBurst=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -766,7 +764,7 @@ Burst.ProtossBuildingBurst=Burst.extends({
}
});
Burst.HumanDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -786,7 +784,7 @@ Burst.HumanDeath=Burst.extends({
}
});
Burst.MedicDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -806,7 +804,7 @@ Burst.MedicDeath=Burst.extends({
}
});
Burst.SmallZergFlyingDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -826,7 +824,7 @@ Burst.SmallZergFlyingDeath=Burst.extends({
}
});
Burst.BigZergFlyingDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -846,7 +844,7 @@ Burst.BigZergFlyingDeath=Burst.extends({
}
});
Burst.DroneDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -866,7 +864,7 @@ Burst.DroneDeath=Burst.extends({
}
});
Burst.ZerglingDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -886,7 +884,7 @@ Burst.ZerglingDeath=Burst.extends({
}
});
Burst.HydraliskDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -906,7 +904,7 @@ Burst.HydraliskDeath=Burst.extends({
}
});
Burst.LurkerDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -926,7 +924,7 @@ Burst.LurkerDeath=Burst.extends({
}
});
Burst.UltraliskDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -946,7 +944,7 @@ Burst.UltraliskDeath=Burst.extends({
}
});
Burst.DefilerDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -966,7 +964,7 @@ Burst.DefilerDeath=Burst.extends({
}
});
Burst.BroodlingDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -986,7 +984,7 @@ Burst.BroodlingDeath=Burst.extends({
}
});
Burst.LarvaDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1006,7 +1004,7 @@ Burst.LarvaDeath=Burst.extends({
}
});
Burst.EggDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1026,7 +1024,7 @@ Burst.EggDeath=Burst.extends({
}
});
Burst.EggBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1046,7 +1044,7 @@ Burst.EggBirth=Burst.extends({
}
});
Burst.DroneBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1066,7 +1064,7 @@ Burst.DroneBirth=Burst.extends({
}
});
Burst.OverlordBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1086,7 +1084,7 @@ Burst.OverlordBirth=Burst.extends({
}
});
Burst.ZerglingBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1106,7 +1104,7 @@ Burst.ZerglingBirth=Burst.extends({
}
});
Burst.HydraliskBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1126,7 +1124,7 @@ Burst.HydraliskBirth=Burst.extends({
}
});
Burst.MutaliskBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1146,7 +1144,7 @@ Burst.MutaliskBirth=Burst.extends({
}
});
Burst.ScourgeBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1166,7 +1164,7 @@ Burst.ScourgeBirth=Burst.extends({
}
});
Burst.QueenBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1186,7 +1184,7 @@ Burst.QueenBirth=Burst.extends({
}
});
Burst.UltraliskBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1206,7 +1204,7 @@ Burst.UltraliskBirth=Burst.extends({
}
});
Burst.DefilerBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1226,7 +1224,7 @@ Burst.DefilerBirth=Burst.extends({
}
});
Burst.LurkerBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1246,7 +1244,7 @@ Burst.LurkerBirth=Burst.extends({
}
});
Burst.GuardianBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1266,7 +1264,7 @@ Burst.GuardianBirth=Burst.extends({
}
});
Burst.DevourerBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1286,7 +1284,7 @@ Burst.DevourerBirth=Burst.extends({
}
});
Burst.SmallProtossDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1306,7 +1304,7 @@ Burst.SmallProtossDeath=Burst.extends({
}
});
Burst.DragoonDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1326,7 +1324,7 @@ Burst.DragoonDeath=Burst.extends({
}
});
Burst.TemplarDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1346,7 +1344,7 @@ Burst.TemplarDeath=Burst.extends({
}
});
Burst.HallucinationDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1366,7 +1364,7 @@ Burst.HallucinationDeath=Burst.extends({
}
});
Burst.ArchonBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1386,7 +1384,7 @@ Burst.ArchonBirth=Burst.extends({
}
});
Burst.DarkArchonBirth=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Mixin
},
prototypePlus:{
@@ -1407,7 +1405,7 @@ Burst.DarkArchonBirth=Burst.extends({
});
Burst.RagnasaurDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1427,7 +1425,7 @@ Burst.RagnasaurDeath=Burst.extends({
}
});
Burst.RhynsdonDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1447,7 +1445,7 @@ Burst.RhynsdonDeath=Burst.extends({
}
});
Burst.UrsadonDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1467,7 +1465,7 @@ Burst.UrsadonDeath=Burst.extends({
}
});
Burst.BengalaasDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1487,7 +1485,7 @@ Burst.BengalaasDeath=Burst.extends({
}
});
Burst.ScantidDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
@@ -1507,7 +1505,7 @@ Burst.ScantidDeath=Burst.extends({
}
});
Burst.KakaruDeath=Burst.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus:{
diff --git a/src/Characters/Button.ts b/src/Characters/Button.js
similarity index 100%
rename from src/Characters/Button.ts
rename to src/Characters/Button.js
diff --git a/src/Characters/Gobj.js b/src/Characters/Gobj.js
new file mode 100644
index 0000000..a257951
--- /dev/null
+++ b/src/Characters/Gobj.js
@@ -0,0 +1,264 @@
+//Gobj is original object used in StarCraft
+var Gobj=function(props){
+ this.x=props.x;
+ this.y=props.y;
+ if (props.target instanceof Gobj){
+ this.x=(props.target.posX()-this.width/2)>>0;
+ this.y=(props.target.posY()-this.height/2)>>0;
+ }
+ this.action=0;//Only for moving
+ this.status="";
+ this.buffer={};//Buffer names
+ this.override={};//Buffer effects
+ this.bufferObjs=[];
+ this.allFrames={};
+ this.team=props.team?props.team:0;//team 0 by default
+};
+
+//Default value used if not initialize properly
+Gobj.prototype.name="Gobj";
+Gobj.prototype.width=0;
+Gobj.prototype.height=0;
+Gobj.prototype.isEnemy=function(){
+ return this.team!=Game.team;
+};
+Gobj.prototype.posX=function(){
+ return this.x+this.width/2;
+};
+Gobj.prototype.posY=function(){
+ return this.y+this.height/2;
+};
+Gobj.prototype.imgPos={
+ moving:{
+ left:[0,0,0,0,0,0,0,0],
+ top:[0,0,0,0,0,0,0,0]
+ }
+};
+//Only for moving
+Gobj.prototype.frame={
+ moving:1
+};
+//Better only for moving
+Gobj.prototype.speed={x:0,y:0};
+
+//Basic behaviors
+Gobj.prototype.detectOutOfBound=function(){
+ //Do nothing here
+};
+//Only for moving
+Gobj.prototype.updateLocation=function(){
+ //Override here
+};
+Gobj.prototype.animeFrame=function(){
+ //Animation play
+ this.action++;
+ if (this.action>=this.frame[this.status]) {
+ this.action=0;
+ }
+};
+Gobj.prototype.moving=function(){
+ //Clear old timer
+ this.stop();
+ //Launch new moving timer
+ this.status="moving";
+ var myself=this;
+ var movingFrame=function(){
+ myself.animeFrame();
+ //Relocate character
+ myself.updateLocation();
+ //Detect OutOfBound
+ myself.detectOutOfBound();
+ };
+ this.allFrames['moving']=movingFrame;
+ var animateFrame=function(){
+ //Only play animation, will not move
+ myself.animeFrame();
+ };
+ this.allFrames['animate']=animateFrame;
+};
+Gobj.prototype.stop=function(){
+ //Clear both kinds of timer
+ delete this.allFrames['moving'];
+ delete this.allFrames['dock'];
+ delete this.allFrames['animate'];
+};
+Gobj.prototype.playFrames=function(){
+ var frames=this.allFrames;
+ for (var type in frames){
+ frames[type]();
+ }
+};
+Gobj.prototype.die=function(){
+ //Clear old timer
+ this.stop();
+ this.status="dead";
+ this.action=0;
+ //If has die animation
+ if (this.dieEffect) {
+ new this.dieEffect({x:this.posX(),y:this.posY()});
+ }
+};
+Gobj.prototype.include=function(obj){
+ return (obj.posY()>this.y)&&(obj.posY()this.x)&&(obj.posX()this.y)&&(ythis.x)&&(xrect.start.x) && (this.posX()rect.start.y) && (this.posY()Map.offsetX) && (this.x<(Map.offsetX+Game.HBOUND))
+ && ((this.y+this.height)>Map.offsetY) && (this.y<(Map.offsetY+Game.VBOUND));
+};
+Gobj.prototype.sightInsideScreen=function(){
+ return ((this.x+this.width)>(Map.offsetX-this.get('sight'))) && (this.x<(Map.offsetX+Game.HBOUND+this.get('sight')))
+ && ((this.y+this.height)>(Map.offsetY-this.get('sight'))) && (this.y<(Map.offsetY+Game.VBOUND+this.get('sight')));
+};
+Gobj.prototype.softCollideWith=function(chara,N){
+ if (N==null) N=1;
+ //Twice radius of hard collision
+ return chara.insideSquare({centerX:this.posX(),centerY:this.posY(),radius:[this.width*N,this.height*N]});
+};
+Gobj.prototype.collideWith=function(chara){
+ //Bounding box: right-left-down-up
+ return !((this.x>(chara.x+chara.width)) || (chara.x>(this.x+this.width))
+ || (this.y>(chara.y+chara.height)) || (chara.y>(this.y+this.height)));
+};
+Gobj.prototype.isIdle=function(){
+ return this.status=="dock";
+};
+Gobj.prototype.canSee=function(enemy){
+ return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('sight')});
+};
+Gobj.prototype.get=function(prop){
+ //Currently only support upgrade for unit properties, no buildings
+ var result=eval('this.'+prop);//Can get A.B.C
+ //ShareFlag is symbol for team sharing array, not speed matrix array
+ if (result instanceof Array) return result[this.team];
+ else return result;
+};
+Gobj.prototype.addBuffer=function(bufferObj,onAll){
+ for (var prop in bufferObj){
+ //Register in override if not exist
+ if (!this.override[prop]) this.override[prop]=[];
+ var buffer=bufferObj[prop];
+ //Add buffer into override list
+ this.override[prop].unshift(buffer);
+ //Override unit property by time sequence if has
+ if (this[prop]!=null || prop.indexOf('isInvisible')!=-1 || onAll) this[prop]=buffer;
+ }
+ this.bufferObjs.push(bufferObj);
+ //Refresh
+ if (this==Game.selectedUnit) Game.refreshInfo();
+};
+Gobj.prototype.removeBuffer=function(bufferObj){
+ var bufferObjIndex=this.bufferObjs.indexOf(bufferObj);
+ //Buffer obj still exist, prevent remove twice
+ if (bufferObjIndex!=-1){
+ for (var prop in bufferObj){
+ var buffer=bufferObj[prop];
+ var overrideList=this.override[prop];
+ //Remove buffer from override list
+ var index=overrideList.indexOf(buffer);
+ if (index!=-1) overrideList.splice(index,1);
+ //Have other buffer, apply it by time sequence
+ if (overrideList.length>0) this[prop]=overrideList[0];
+ else delete this[prop];
+ }
+ //Remove from bufferObjs
+ this.bufferObjs.splice(bufferObjIndex,1);
+ //Refresh
+ if (this==Game.selectedUnit) Game.refreshInfo();
+ //Remove successfully
+ return true;
+ }
+ //Remove failure
+ else return false;
+};
+Gobj.prototype.cannotMove=function(){
+ return (this instanceof Building) || Boolean(this.burrowBuffer);
+};
+Gobj.prototype.evolveTo=function(props){
+ //Init
+ var charaType=props.type,burstArr=props.burstArr,mixin=props.mixin,rallyPoint=props.rallyPoint;
+ var newTypeChara=null,selectedStatus=[this.selected,(this==Game.selectedUnit)],team=this.team;
+ //Hide die burst and sound for old unit, then die
+ this.dieEffect=this.sound.death=null;
+ this.die();
+ if (this.processing && !props.chain) delete this.processing;
+ //Birth function
+ var bornAt=function(chara){
+ var prop={target:chara,team:team};
+ if (mixin) _$.mixin(prop,mixin);
+ newTypeChara=new charaType(prop);
+ if (rallyPoint) newTypeChara.destination=rallyPoint;
+ //Fix cannot select egg issue
+ Game.commandTimeout(function(){
+ if (selectedStatus[0]) Game.addIntoAllSelected(newTypeChara);
+ if (selectedStatus[1]) Game.changeSelectedTo(newTypeChara);
+ },0);
+ };
+ //Burst chain
+ if (burstArr){
+ var pos={x:this.posX(),y:this.posY()};
+ var birth=new Burst[burstArr[0]](pos);
+ var evolveChain=function(N){
+ return function(){
+ birth=new Burst[burstArr[N]](pos);
+ if ((N+1)1) birth.callback=evolveChain(1);
+ //Finish evolve chain
+ else birth.callback=function(){
+ var times=charaType.prototype.birthCount;
+ if (times==null) times=1;
+ for (var N=0;N> 0;
- this.y = (props.target.posY() - this.height / 2) >> 0;
- }
- this.action = 0; //Only for moving
- this.status = "";
- this.buffer = {};//Buffer names
- this.override = {};//Buffer effects
- this.bufferObjs = [];
- this.allFrames = {};
- this.team = props.team ? props.team : 0;//team 0 by default
- };
-
- //Default value used if not initialize properly
- name = "Gobj";
- width = 0;
- height = 0;
-
- isEnemy = function () {
- return this.team != Game.team;
- };
- posX = function () {
- return this.x + this.width / 2;
- };
- posY = function () {
- return this.y + this.height / 2;
- };
- imgPos = {
- moving: {
- left: [0, 0, 0, 0, 0, 0, 0, 0],
- top: [0, 0, 0, 0, 0, 0, 0, 0]
- }
- };
- //Only for moving
- frame = {
- moving: 1
- };
- //Better only for moving
- speed = { x: 0, y: 0 };
-
- //Basic behaviors
- detectOutOfBound = function () {
- //Do nothing here
- };
- //Only for moving
- updateLocation = function () {
- //Override here
- };
- animeFrame = function () {
- //Animation play
- this.action++;
- if (this.action >= this.frame[this.status]) {
- this.action = 0;
- }
- };
- moving = function () {
- //Clear old timer
- this.stop();
- //Launch new moving timer
- this.status = "moving";
- var myself = this;
- var movingFrame = function () {
- myself.animeFrame();
- //Relocate character
- myself.updateLocation();
- //Detect OutOfBound
- myself.detectOutOfBound();
- };
- this.allFrames['moving'] = movingFrame;
- var animateFrame = function () {
- //Only play animation, will not move
- myself.animeFrame();
- };
- this.allFrames['animate'] = animateFrame;
- };
- stop = function () {
- //Clear both kinds of timer
- delete this.allFrames['moving'];
- delete this.allFrames['dock'];
- delete this.allFrames['animate'];
- };
- playFrames = function () {
- var frames = this.allFrames;
- for (var type in frames) {
- frames[type]();
- }
- };
- die = function () {
- //Clear old timer
- this.stop();
- this.status = "dead";
- this.action = 0;
- //If has die animation
- if (this.dieEffect) {
- new this.dieEffect({ x: this.posX(), y: this.posY() });
- }
- };
- include = function (obj) {
- return (obj.posY() > this.y) && (obj.posY() < this.y + this.height) && (obj.posX() > this.x) && (obj.posX() < this.x + this.width);
- };
- includePoint = function (x, y) {
- return (y > this.y) && (y < this.y + this.height) && (x > this.x) && (x < this.x + this.width);
- };
- //rect={centerX:?,centerY:?,radius:?} or {centerX:?,centerY:?,radius:[?,?]}
- insideSquare = function (rect) {
- if (rect.radius instanceof Array)
- return Math.abs(rect.centerX - this.posX()) < rect.radius[0] && Math.abs(rect.centerY - this.posY()) < rect.radius[1];
- else return Math.abs(rect.centerX - this.posX()) < rect.radius && Math.abs(rect.centerY - this.posY()) < rect.radius;
- };
- //rect={start:{x:?,y:?},end:{x:?,y:?}}
- insideRect = function (rect) {
- return (this.posX() > rect.start.x) && (this.posX() < rect.end.x) &&
- (this.posY() > rect.start.y) && (this.posY() < rect.end.y);
- };
-
- //circle={centerX:?,centerY:?,radius:?}
- insideCircle = function (circle) {
- return Math.pow(circle.centerX - this.posX(), 2) + Math.pow(circle.centerY - this.posY(), 2) < Math.pow(circle.radius, 2);
- };
- //Default is circle mode
- inside = function (circle) {
- return Math.pow(circle.centerX - this.posX(), 2) + Math.pow(circle.centerY - this.posY(), 2) < Math.pow(circle.radius, 2);
- };
- //Radius
- radius = function () {
- return (this.width < this.height) ? (this.width / 2) : (this.height / 2);//Math.min
- };
- //Distance
- distanceFrom = function (obj) {
- if (obj instanceof Gobj) {
- return Math.pow((this.posX() - obj.posX()) * (this.posX() - obj.posX()) +
- (this.posY() - obj.posY()) * (this.posY() - obj.posY()), 0.5);
- }
- else {
- return Math.pow((this.posX() - obj.x) * (this.posX() - obj.x) +
- (this.posY() - obj.y) * (this.posY() - obj.y), 0.5);
- }
- };
- insideScreen = function () {
- return ((this.x + this.width) > Map.offsetX) && (this.x < (Map.offsetX + Game.HBOUND))
- && ((this.y + this.height) > Map.offsetY) && (this.y < (Map.offsetY + Game.VBOUND));
- };
- sightInsideScreen = function () {
- return ((this.x + this.width) > (Map.offsetX - this.get('sight'))) && (this.x < (Map.offsetX + Game.HBOUND + this.get('sight')))
- && ((this.y + this.height) > (Map.offsetY - this.get('sight'))) && (this.y < (Map.offsetY + Game.VBOUND + this.get('sight')));
- };
- softCollideWith = function (chara, N) {
- if (N == null) N = 1;
- //Twice radius of hard collision
- return chara.insideSquare({ centerX: this.posX(), centerY: this.posY(), radius: [this.width * N, this.height * N] });
- };
- collideWith = function (chara) {
- //Bounding box: right-left-down-up
- return !((this.x > (chara.x + chara.width)) || (chara.x > (this.x + this.width))
- || (this.y > (chara.y + chara.height)) || (chara.y > (this.y + this.height)));
- };
- isIdle = function () {
- return this.status == "dock";
- };
- canSee = function (enemy) {
- return enemy.inside({ centerX: this.posX(), centerY: this.posY(), radius: this.get('sight') });
- };
- get = function (prop) {
- //Currently only support upgrade for unit properties, no buildings
- var result = eval('this.' + prop);//Can get A.B.C
- //ShareFlag is symbol for team sharing array, not speed matrix array
- if (result instanceof Array) return result[this.team];
- else return result;
- };
- addBuffer = function (bufferObj, onAll) {
- for (var prop in bufferObj) {
- //Register in override if not exist
- if (!this.override[prop]) this.override[prop] = [];
- var buffer = bufferObj[prop];
- //Add buffer into override list
- this.override[prop].unshift(buffer);
- //Override unit property by time sequence if has
- if (this[prop] != null || prop.indexOf('isInvisible') != -1 || onAll) this[prop] = buffer;
- }
- this.bufferObjs.push(bufferObj);
- //Refresh
- if (this == Game.selectedUnit) Game.refreshInfo();
- };
- removeBuffer = function (bufferObj) {
- var bufferObjIndex = this.bufferObjs.indexOf(bufferObj);
- //Buffer obj still exist, prevent remove twice
- if (bufferObjIndex != -1) {
- for (var prop in bufferObj) {
- var buffer = bufferObj[prop];
- var overrideList = this.override[prop];
- //Remove buffer from override list
- var index = overrideList.indexOf(buffer);
- if (index != -1) overrideList.splice(index, 1);
- //Have other buffer, apply it by time sequence
- if (overrideList.length > 0) this[prop] = overrideList[0];
- else delete this[prop];
- }
- //Remove from bufferObjs
- this.bufferObjs.splice(bufferObjIndex, 1);
- //Refresh
- if (this == Game.selectedUnit) Game.refreshInfo();
- //Remove successfully
- return true;
- }
- //Remove failure
- else return false;
- };
- cannotMove = function () {
- return (this instanceof Building) || Boolean(this.burrowBuffer);
- };
- evolveTo = function (props) {
- //Init
- var charaType = props.type, burstArr = props.burstArr, mixin = props.mixin, rallyPoint = props.rallyPoint;
- var newTypeChara = null, selectedStatus = [this.selected, (this == Game.selectedUnit)], team = this.team;
- //Hide die burst and sound for old unit, then die
- this.dieEffect = this.sound.death = null;
- this.die();
- if (this.processing && !props.chain) delete this.processing;
- //Birth function
- var bornAt = function (chara) {
- var prop = { target: chara, team: team };
- if (mixin) _$.mixin(prop, mixin);
- newTypeChara = new charaType(prop);
- if (rallyPoint) newTypeChara.destination = rallyPoint;
- //Fix cannot select egg issue
- Game.commandTimeout(function () {
- if (selectedStatus[0]) Game.addIntoAllSelected(newTypeChara);
- if (selectedStatus[1]) Game.changeSelectedTo(newTypeChara);
- }, 0);
- };
- //Burst chain
- if (burstArr) {
- var pos = { x: this.posX(), y: this.posY() };
- var birth = new Burst[burstArr[0]](pos);
- var evolveChain = function (N) {
- return function () {
- birth = new Burst[burstArr[N]](pos);
- if ((N + 1) < burstArr.length) birth.callback = evolveChain(N + 1);
- //Finish evolve chain
- else birth.callback = function () {
- var times = charaType.prototype.birthCount;
- if (times == null) times = 1;
- for (var N = 0; N < times; N++) {
- bornAt(birth);
- }
- };
- };
- };
- //Start evolve chain
- if (burstArr.length > 1) birth.callback = evolveChain(1);
- //Finish evolve chain
- else birth.callback = function () {
- var times = charaType.prototype.birthCount;
- if (times == null) times = 1;
- for (var N = 0; N < times; N++) {
- bornAt(birth);
- }
- };
- }
- else bornAt(this);
- return newTypeChara;
- };
- //This buffer makes invisible units visible
- // Gobj.detectorBuffer = [];
-}
\ No newline at end of file
diff --git a/src/Characters/Hero.ts b/src/Characters/Hero.js
similarity index 100%
rename from src/Characters/Hero.ts
rename to src/Characters/Hero.js
diff --git a/src/Characters/Magic.ts b/src/Characters/Magic.js
similarity index 100%
rename from src/Characters/Magic.ts
rename to src/Characters/Magic.js
diff --git a/src/Characters/Map.ts b/src/Characters/Map.js
similarity index 88%
rename from src/Characters/Map.ts
rename to src/Characters/Map.js
index 3934c39..f26d6e4 100644
--- a/src/Characters/Map.ts
+++ b/src/Characters/Map.js
@@ -1,28 +1,25 @@
-import {Game} from '../GameRule/Game'
-import {Unit} from './Units';
-
-export class Map {
- static currentMap = 'Switchback'//By default
- ready=false
- static offsetX =0
- static offsetY=0
- speed=40
- triggerMargin=20
+var Map={
+ currentMap:'Switchback',//By default
+ ready:false,
+ offsetX:0,
+ offsetY:0,
+ speed:40,
+ triggerMargin:20,
//To synchronize drawing map and units, will not refresh immediately
- needRefresh=false
- static fogFlag=true
- fogUnits=[]//Units need to draw fog on screen
- allUnits=[]//Units need to draw fog on minimap
- batchSize=0//Draw fog by each batch
- miniCxt=($('canvas[name="mini_map"]')[0] as any).getContext('2d')
- static fogCanvas=document.createElement('canvas')
- static shadowCanvas=document.createElement('canvas')//Pre-render for fog shadow
- static insideStroke ={
+ needRefresh:false,
+ fogFlag:true,
+ fogUnits:[],//Units need to draw fog on screen
+ allUnits:[],//Units need to draw fog on minimap
+ batchSize:0,//Draw fog by each batch
+ miniCxt:$('canvas[name="mini_map"]')[0].getContext('2d'),
+ fogCanvas:document.createElement('canvas'),
+ shadowCanvas:document.createElement('canvas'),//Pre-render for fog shadow
+ insideStroke:{
width:0,
height:0
- }
+ },
//Init map
- setCurrentMap= function(name){
+ setCurrentMap:function(name){
Map.currentMap=name;
$('canvas[name="mini_map"]').attr('class',name);
//Init inside stroke size
@@ -45,13 +42,12 @@ export class Map {
Map.shadowCxt.fill();
//Map is ready after current map set
Map.ready=true;
- }
-
- static getCurrentMap= function(){
+ },
+ getCurrentMap:function(){
return sourceLoader.sources['Map_'+Map.currentMap];
- }
+ },
//Draw interface call
- static drawFogAndMinimap= function(){
+ drawFogAndMinimap:function(){
if (Map.fogFlag){
Map.refreshFog();
//Draw fog on main map
@@ -62,9 +58,9 @@ export class Map {
}
//Draw mini-map
Map.drawMiniMap();
- }
+ },
//Used by drawFogAndMinimap
- static refreshFog= function(){
+ refreshFog:function(){
//Reset composite operation
Map.fogCxt.globalCompositeOperation='source-over';
//Brush black fog to clean old fog
@@ -92,9 +88,9 @@ export class Map {
var radius=Math.round(chara.get('sight')*ratio<<1);
Map.fogCxt.drawImage(Map.shadowCanvas,0,0,100,100,centerX-radius,centerY-radius,radius<<1,radius<<1);
});
- }
+ },
//Used by drawFogAndMinimap: draw red&green block and white stroke
- static drawMiniMap= function(){
+ drawMiniMap:function(){
//Selected map size
var mapWidth=Map.getCurrentMap().width;
var mapHeight=Map.getCurrentMap().height;
@@ -117,8 +113,8 @@ export class Map {
Map.miniCxt.strokeStyle='white';
Map.miniCxt.lineWidth=2;
Map.miniCxt.strokeRect((130*Map.offsetX/mapWidth)>>0,(130*Map.offsetY/mapHeight)>>0,Map.insideStroke.width,Map.insideStroke.height);
- }
- static drawMud= function(){
+ },
+ drawMud:function(){
var _increments=[[0,1],[-1,0],[0,-1],[1,0]];
var mudRadius=120;
var mudIncrements=_$.mapTraverse(_increments,function(x){
@@ -153,8 +149,8 @@ export class Map {
//Fill mud
Game.backCxt.fill();
Game.backCxt.restore();
- }
- static drawBg= function(){
+ },
+ drawBg:function(){
//Clear background
Game.backCxt.clearRect(0,0,Game.HBOUND,Game.VBOUND);
//Draw map as background
@@ -162,8 +158,8 @@ export class Map {
0,0,Game.HBOUND,Game.VBOUND-Game.infoBox.height+5);
//Draw mud for ZergBuildings
Map.drawMud();
- }
- static refresh= function(direction){
+ },
+ refresh:function(direction){
var edgeX=Map.getCurrentMap().width-Game.HBOUND;
var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
var onlyMap;
@@ -191,15 +187,15 @@ export class Map {
Map.drawBg();
//Need re-calculate fog when screen moves
if (!onlyMap) Map.drawFogAndMinimap();
- }
- static clickHandler= function(event){
+ },
+ clickHandler:function(event){
//Mouse at (clickX,clickY)
var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
//Relocate map center
Map.relocateAt(Map.getCurrentMap().width*clickX/130,Map.getCurrentMap().height*clickY/130);
- }
- static dblClickHandler= function(event){
+ },
+ dblClickHandler:function(event){
//Mouse at (clickX,clickY)
var clickX=event.pageX-$('canvas[name="mini_map"]').offset().left;
var clickY=event.pageY-$('canvas[name="mini_map"]').offset().top;
@@ -214,8 +210,8 @@ export class Map {
chara.targetLock=true;
chara.moveTo(mapX,mapY);
});
- }
- static relocateAt= function(centerX,centerY){
+ },
+ relocateAt:function(centerX,centerY){
//Get map edge
var edgeX=Map.getCurrentMap().width-Game.HBOUND;
var edgeY=Map.getCurrentMap().height-Game.VBOUND+Game.infoBox.height-5;
diff --git a/src/Characters/Neutral.ts b/src/Characters/Neutral.js
similarity index 100%
rename from src/Characters/Neutral.ts
rename to src/Characters/Neutral.js
diff --git a/src/Characters/Protoss.ts b/src/Characters/Protoss.js
similarity index 100%
rename from src/Characters/Protoss.ts
rename to src/Characters/Protoss.js
diff --git a/src/Characters/Terran.ts b/src/Characters/Terran.js
similarity index 96%
rename from src/Characters/Terran.ts
rename to src/Characters/Terran.js
index 6b716ef..f22e8a1 100644
--- a/src/Characters/Terran.ts
+++ b/src/Characters/Terran.js
@@ -1,7 +1,7 @@
/******* Define Terran units *******/
var Terran={};
Terran.SCV=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -70,7 +70,7 @@ Terran.SCV=AttackableUnit.extends({
'7':{name:'BasicBuilding'},
'8':{name:'AdvancedBuilding'}
},
- buildTerranBuilding= function(location){
+ buildTerranBuilding:function(location){
//Has location callback info or nothing
if (location){
//Move toward target to fire Ensnare
@@ -140,7 +140,7 @@ Terran.SCV=AttackableUnit.extends({
}
});
Terran.Marine=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus: {
@@ -224,19 +224,19 @@ Terran.Marine=AttackableUnit.extends({
},
upgrade:['UpgradeInfantryWeapons','UpgradeInfantryArmors'],
items:{
- '7':{name:'StimPacks',condition= function(){
+ '7':{name:'StimPacks',condition:function(){
return Magic.StimPacks.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
Terran.Firebat=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus: {
@@ -326,19 +326,19 @@ Terran.Firebat=AttackableUnit.extends({
},
upgrade:['UpgradeInfantryWeapons','UpgradeInfantryArmors'],
items:{
- '7':{name:'StimPacks',condition= function(){
+ '7':{name:'StimPacks',condition:function(){
return Magic.StimPacks.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
Terran.Ghost=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus: {
@@ -424,25 +424,25 @@ Terran.Ghost=AttackableUnit.extends({
},
upgrade:['UpgradeInfantryWeapons','UpgradeInfantryArmors'],
items:{
- '7':{name:'Cloak',condition= function(){
+ '7':{name:'Cloak',condition:function(){
return Magic.PersonalCloak.enabled
}},
- '8':{name:'Lockdown',condition= function(){
+ '8':{name:'Lockdown',condition:function(){
return Magic.Lockdown.enabled
}},
- '9':{name:'NuclearStrike',condition= function(){
+ '9':{name:'NuclearStrike',condition:function(){
return Magic.NuclearStrike.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
AttackableUnit.turnAround.call(this);
}
}
});
Terran.Medic=Unit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Nothing
},
prototypePlus: {
@@ -524,22 +524,22 @@ Terran.Medic=Unit.extends({
upgrade:['UpgradeInfantryArmors'],
items:{
'7':{name:'Heal'},
- '8':{name:'Restoration',condition= function(){
+ '8':{name:'Restoration',condition:function(){
return Magic.Restoration.enabled
}},
- '9':{name:'OpticalFlare',condition= function(){
+ '9':{name:'OpticalFlare',condition:function(){
return Magic.OpticalFlare.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
Unit.turnAround.call(this);
}
}
});
Terran.Vulture=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.attack=this.imgPos.dock=this.imgPos.moving;
this.frame.attack=this.frame.dock=this.frame.moving;
@@ -580,14 +580,14 @@ Terran.Vulture=AttackableUnit.extends({
},
upgrade:['UpgradeVehicleWeapons','UpgradeVehicleArmors'],
items:{
- '7':{name:'SpiderMines',condition= function(){
+ '7':{name:'SpiderMines',condition:function(){
return Magic.SpiderMines.enabled
}}
}
}
});
Terran.Tank=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
this.imgPos.attack=this.imgPos.dock;
this.frame.attack=this.frame.dock;
},
@@ -651,14 +651,14 @@ Terran.Tank=AttackableUnit.extends({
},
upgrade:['UpgradeVehicleWeapons','UpgradeVehicleArmors'],
items:{
- '7':{name:'SeigeMode',condition= function(){
+ '7':{name:'SeigeMode',condition:function(){
return Magic.SeigeMode.enabled
}}
}
}
});
Terran.Goliath=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Bind bgm
this.sound.attackG=new Audio(Game.CDN+'bgm/'+this.name+'.attack.wav');
this.sound.attackF=new Audio(Game.CDN+'bgm/'+this.name+'.attackF.wav');
@@ -761,7 +761,7 @@ Terran.Goliath=AttackableUnit.extends({
}
});
Terran.Wraith=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -819,19 +819,19 @@ Terran.Wraith=AttackableUnit.extends({
},
upgrade:['UpgradeShipWeapons','UpgradeShipArmors'],
items:{
- '7':{name:'Cloak',condition= function(){
+ '7':{name:'Cloak',condition:function(){
return Magic.Cloak.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
AttackableUnit.hover.call(this);
}
}
});
Terran.Dropship=Unit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -873,7 +873,7 @@ Terran.Dropship=Unit.extends({
'9':{name:'UnloadAll'}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
Unit.hover.call(this);
},
@@ -881,7 +881,7 @@ Terran.Dropship=Unit.extends({
}
});
Terran.Vessel=Unit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -920,22 +920,22 @@ Terran.Vessel=Unit.extends({
upgrade:['UpgradeShipArmors'],
items:{
'7':{name:'DefensiveMatrix'},
- '8':{name:'EMPShockwave',condition= function(){
+ '8':{name:'EMPShockwave',condition:function(){
return Magic.EMPShockwave.enabled
}},
- '9':{name:'Irradiate',condition= function(){
+ '9':{name:'Irradiate',condition:function(){
return Magic.Irradiate.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
Unit.hover.call(this);
}
}
});
Terran.BattleCruiser=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
this.frame.dock=this.frame.moving;
@@ -976,19 +976,19 @@ Terran.BattleCruiser=AttackableUnit.extends({
},
upgrade:['UpgradeShipWeapons','UpgradeShipArmors'],
items:{
- '7':{name:'Yamato',condition= function(){
+ '7':{name:'Yamato',condition:function(){
return Magic.Yamato.enabled
}}
},
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
AttackableUnit.hover.call(this);
}
}
});
Terran.Valkyrie=AttackableUnit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.attack=this.imgPos.dock=this.imgPos.moving;
this.frame.attack=this.frame.dock=this.frame.moving;
@@ -1034,14 +1034,14 @@ Terran.Valkyrie=AttackableUnit.extends({
},
upgrade:['UpgradeShipWeapons','UpgradeShipArmors'],
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
AttackableUnit.hover.call(this);
}
}
});
Terran.Civilian=Unit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
//Same action mapping
this.imgPos.dock=this.imgPos.moving;
},
@@ -1089,7 +1089,7 @@ Terran.Civilian=Unit.extends({
recover:Building.TerranBuilding.prototype.recover,
upgrade:['UpgradeInfantryArmors'],
//Override
- dock= function(){
+ dock:function(){
//Use the same behavior
Unit.turnAround.call(this);
}
diff --git a/src/Characters/Units.ts b/src/Characters/Units.js
similarity index 96%
rename from src/Characters/Units.ts
rename to src/Characters/Units.js
index 974610c..0365664 100644
--- a/src/Characters/Units.ts
+++ b/src/Characters/Units.js
@@ -1,10 +1,6 @@
-import {Gobj} from './Gobj';
-import {Game} from '../GameRule/Game';
-
//Define unit which has HP/direction and be selectable, unattackable unit
-export class Unit extends Gobj {
-
- constructorPlus= function(props){
+var Unit=Gobj.extends({
+ constructorPlus:function(props){
//Add id for unit
this.id=Unit.currentID++;
this.direction=Unit.randomDirection();
@@ -29,13 +25,12 @@ export class Unit extends Gobj {
//Show unit
myself.dock();
},0);
- }
-
+ },
prototypePlus:{
name:"Unit",
isFlying:true,
//Override Gobj method
- animeFrame= function(){
+ animeFrame:function(){
//Animation play
this.action++;
//Override Gobj here, support hidden frames
@@ -46,7 +41,7 @@ export class Unit extends Gobj {
//Multiple hidden frames support
if (this.imgPos[this.status].left[0][this.action]==-1) this.action=0;
},
- detectOutOfBound= function(){
+ detectOutOfBound:function(){
var boundX=Map.getCurrentMap().width-this.width;
var boundY=Map.getCurrentMap().height-this.height;
//Right Bound
@@ -67,17 +62,17 @@ export class Unit extends Gobj {
}
},
//Can move in any direction
- updateLocation= function(){
+ updateLocation:function(){
this.x=Math.round(this.x+this.get('speed')*Math.cos(this.angle));
this.y=Math.round(this.y+this.get('speed')*Math.sin(this.angle));
},
//Add new functions to prototype
- turnTo= function(direction){
+ turnTo:function(direction){
//Change direction
this.direction=direction;
},
//Dock means stop moving but keep animation
- dock= function(){
+ dock:function(){
//Clear old timer
this.stop();
//Launch new dock timer
@@ -92,16 +87,16 @@ export class Unit extends Gobj {
};
this.allFrames['animate']=animateFrame;
},
- stand= function(){
+ stand:function(){
this.dock();
},//alias
- stopMoving= function(){
+ stopMoving:function(){
this.dock();
},//alias
- run= function(){
+ run:function(){
this.moving();
},//alias
- navigateTo= function(clickX,clickY,range){
+ navigateTo:function(clickX,clickY,range){
if (!range) range=Unit.moveRange;//Smallest limit by default
//Center position
var charaX=this.posX();
@@ -154,7 +149,7 @@ export class Unit extends Gobj {
this.angle=Math.atan2(vector[0],vector[1]);
}
},
- faceTo= function(target,preventAction){
+ faceTo:function(target,preventAction){
var direction;
//Unit or Building
if (target instanceof Gobj){
@@ -167,7 +162,7 @@ export class Unit extends Gobj {
if (!preventAction) this.turnTo(direction);
return direction;
},
- escapeFrom= function(enemy){
+ escapeFrom:function(enemy){
//Add to fix holding issue
if (this.hold) return;
//From enemy to myself
@@ -179,7 +174,7 @@ export class Unit extends Gobj {
//Escape along vector
this.moveTo(this.posX()+escapeVector[0],this.posY()+escapeVector[1]);
},
- moveTo= function(clickX,clickY,range,callback){
+ moveTo:function(clickX,clickY,range,callback){
if (!range) range=Unit.moveRange;//Smallest limit by default
//Start new routing
var myself=this;
@@ -194,7 +189,7 @@ export class Unit extends Gobj {
//Start moving
this.run();
},
- moveToward= function(target,range,callback){
+ moveToward:function(target,range,callback){
if (!range) range=Unit.moveRange;//Smallest limit by default
//Start new routing
var myself=this;
@@ -218,7 +213,7 @@ export class Unit extends Gobj {
this.run();
},
//Override for sound effect
- die= function(){
+ die:function(){
//Old behavior
Gobj.prototype.die.call(this);
this.life=0;
@@ -230,7 +225,7 @@ export class Unit extends Gobj {
}
},
//AI when attacked by enemy
- reactionWhenAttackedBy= function(enemy,onlyDamage){
+ reactionWhenAttackedBy:function(enemy,onlyDamage){
//Resign and give reward to enemy if has no life before dead
if (this.life<=0) {
//If multiple target, only die once and give reward
@@ -249,7 +244,7 @@ export class Unit extends Gobj {
}
},
//Calculate damage, if enemy is damage itself, return that damage directly
- calculateDamageBy= function(enemyObj){
+ calculateDamageBy:function(enemyObj){
var damage=0;
if (enemyObj instanceof Gobj){
var enemyAttackType=enemyObj.attackType;
@@ -261,7 +256,7 @@ export class Unit extends Gobj {
else damage=enemyObj;
return damage;
},
- getDamageBy= function(enemy,percent){
+ getDamageBy:function(enemy,percent){
if (percent==undefined) percent=1;//100% by default
var damage=0;
//If has SP and shield remain
@@ -282,7 +277,7 @@ export class Unit extends Gobj {
}
},
//Attack ground action
- attackGround= function(position,loop){
+ attackGround:function(position,loop){
//Convert to array
var positions=[].concat(position);
if (this.attack) this.stopAttack();
@@ -299,19 +294,19 @@ export class Unit extends Gobj {
if (loop) checkpoint.next=this.destination;
},
//Patrol action
- patrol= function(position,addHere){
+ patrol:function(position,addHere){
//Convert to array
var positions=[].concat(position);
if (addHere) positions.push({x:this.posX(),y:this.posY()});
this.attackGround(positions,true);
},
- isMachine= function(){
+ isMachine:function(){
return ["SCV","Vulture","Tank","Goliath","Wraith","Dropship","Vessel","BattleCruiser","Valkyrie",
"Probe","Dragoon","Shuttle","Reaver","Observer","Scout","Carrier","Arbiter","Corsair","HeroCruiser"]
.indexOf(this.name)!=-1;
},
//Life status
- lifeStatus= function(){
+ lifeStatus:function(){
var lifeRatio=this.life/this.get('HP');
return ((lifeRatio>0.7)?"green":(lifeRatio>0.3)?"yellow":"red");
}
@@ -535,7 +530,7 @@ Unit.walkAroundLarva=function(){
this.allFrames['dock']=dockFrame;
};
var AttackableUnit=Unit.extends({
- constructorPlus= function(props){
+ constructorPlus:function(props){
this.bullet={};
this.kill=0;
this.target={};
@@ -551,10 +546,10 @@ var AttackableUnit=Unit.extends({
prototypePlus:{
//Add basic unit info
name:"AttackableUnit",
- isInAttackRange= function(enemy){
+ isInAttackRange:function(enemy){
return enemy.inside({centerX:this.posX(),centerY:this.posY(),radius:this.get('attackRange')});
},
- matchAttackLimit= function(enemy){
+ matchAttackLimit:function(enemy){
//Has attack limit
if (this.attackLimit){
//Doesn't match attack limit
@@ -564,7 +559,7 @@ var AttackableUnit=Unit.extends({
//No attack limit or match attack limit
return true;
},
- attack= function(enemy){
+ attack:function(enemy){
//Cannot attack invisible unit or unit who mismatch your attack type
if (enemy['isInvisible'+this.team] || !(this.matchAttackLimit(enemy))) {
Referee.voice('pError').play();
@@ -780,13 +775,13 @@ var AttackableUnit=Unit.extends({
this.allFrames['attack']=attackFrame;
}
},
- stopAttack= function(){
+ stopAttack:function(){
//Stop attacking animation
delete this.allFrames['attack'];
//Clear target
this.target={};
},
- findNearbyTargets= function(){
+ findNearbyTargets:function(){
//Initial
var myself=this;
var units=Unit.allUnits.filter(function(chara){
@@ -820,10 +815,10 @@ var AttackableUnit=Unit.extends({
//Take attackable>>unattackable,unit>>building,near>>far as priority, will attracted if be attacked
return results;
},
- highestPriorityTarget= function(){
+ highestPriorityTarget:function(){
return this.findNearbyTargets()[0];
},
- AI= function(){
+ AI:function(){
//Dead unit doesn't have following AI
if (this.status=='dead') return;
//If no mission, return it to scout status
@@ -858,7 +853,7 @@ var AttackableUnit=Unit.extends({
}
},
//Override
- reactionWhenAttackedBy= function(enemy,onlyDamage){
+ reactionWhenAttackedBy:function(enemy,onlyDamage){
//Resign and give reward to enemy if has no life before dead
if (this.life<=0) {
//If multiple target, only die once and give reward
@@ -888,43 +883,43 @@ var AttackableUnit=Unit.extends({
}
}
},
- isAttacking= function(){
+ isAttacking:function(){
//Has target
return (this.target instanceof Gobj);
},
- followEnemy= function(){
+ followEnemy:function(){
//Remind to attack again
this.attack(this.target);
//Filter out building target
if (this.target instanceof Unit) this.tracing=true;
},
- isTracing= function(){
+ isTracing:function(){
return this.isAttacking() && this.status=="moving";
},
- isFiring= function(){
+ isFiring:function(){
//May out of range and cannot fire, don't follow when attack status
return this.isAttacking() && this.status=="dock";
},
//Override
- isIdle= function(){
+ isIdle:function(){
//Not moving or attacking
return !this.isAttacking() && this.status=="dock";
},
- cannotReachTarget= function(){
+ cannotReachTarget:function(){
//Found target outside attack range after once firing, need follow once
return this.isFiring() && !(this.isInAttackRange(this.target));
},
- isMissingTarget= function(){
+ isMissingTarget:function(){
//Lock on target has global sight, lock off (attackGround) use its own sight
return !this.targetLock && this.isAttacking() && !(this.canSee(this.target));
},
- isReloaded= function(){
+ isReloaded:function(){
//Add for newly reloaded yamato, two kinds of bullet conflict, ignore bullet array
if ((this.bullet instanceof Gobj) && this.bullet.status!='dead') return false;
return this.coolDown;
},
//Override for attackable unit
- die= function(){
+ die:function(){
//Old behavior
Unit.prototype.die.call(this);
//Clear new timer for unit
diff --git a/src/Characters/Upgrade.ts b/src/Characters/Upgrade.js
similarity index 100%
rename from src/Characters/Upgrade.ts
rename to src/Characters/Upgrade.js
diff --git a/src/Characters/Zerg.ts b/src/Characters/Zerg.js
similarity index 99%
rename from src/Characters/Zerg.ts
rename to src/Characters/Zerg.js
index 30bdd7a..238e4f7 100644
--- a/src/Characters/Zerg.ts
+++ b/src/Characters/Zerg.js
@@ -1,7 +1,6 @@
/******* Define Zerg units *******/
var Zerg={};
-
-export class Zerg.Drone extends AttackableUnit{
+Zerg.Drone=AttackableUnit.extends({
constructorPlus:function(props){
this.sound.burrow=new Audio(Game.CDN+'bgm/Zerg.burrow.wav');
this.sound.unburrow=new Audio(Game.CDN+'bgm/Zerg.unburrow.wav');
@@ -217,8 +216,6 @@ export class Zerg.Drone extends AttackableUnit{
}
}
});
-
-
Zerg.Zergling=AttackableUnit.extends({
constructorPlus:function(props){
this.sound.burrow=new Audio(Game.CDN+'bgm/Zerg.burrow.wav');
diff --git a/src/Controller/keyController.ts b/src/Controller/keyController.js
similarity index 100%
rename from src/Controller/keyController.ts
rename to src/Controller/keyController.js
diff --git a/src/Controller/mouseController.ts b/src/Controller/mouseController.js
similarity index 100%
rename from src/Controller/mouseController.ts
rename to src/Controller/mouseController.js
diff --git a/src/GameRule/Cheat.ts b/src/GameRule/Cheat.js
similarity index 95%
rename from src/GameRule/Cheat.ts
rename to src/GameRule/Cheat.js
index 24ae896..130a7c0 100644
--- a/src/GameRule/Cheat.ts
+++ b/src/GameRule/Cheat.js
@@ -1,13 +1,9 @@
-import {Multiplayer} from './Multiplayer';
-import {Game} from './Game';
-
-
-class Cheat {
- static isShown:false
- static cwal:false
- static gathering:false
- static manUnlimited:false
- handler= function(){
+var Cheat={
+ isShown:false,
+ cwal:false,
+ gathering:false,
+ manUnlimited:false,
+ handler:function(){
if (Cheat.isShown){
if (Multiplayer.ON){
Multiplayer.webSocket.send(JSON.stringify({
@@ -38,8 +34,8 @@ class Cheat {
Cheat.isShown=true;
keyController.disable=true;
}
- }
- execute= function(cheatCode){
+ },
+ execute:function(cheatCode){
//Forbid cheating when multiplayer mode
if (Multiplayer.ON) return;
var cheatFlag=true;
diff --git a/src/GameRule/Game.ts b/src/GameRule/Game.js
similarity index 94%
rename from src/GameRule/Game.ts
rename to src/GameRule/Game.js
index 54a8aa0..ff71f37 100644
--- a/src/GameRule/Game.ts
+++ b/src/GameRule/Game.js
@@ -1,42 +1,36 @@
-import * as $ from 'jquery';
-import {Gobj} from '../Characters/Gobj';
-import {Referee} from './Referee';
-
-export class Game {
-
+var Game={
//Global variables
- static public HBOUND = innerWidth//$('body')[0].scrollWidth
- static public VBOUND = innerHeight//$('body')[0].scrollHeight
- public infoBox = {
+ HBOUND:innerWidth,//$('body')[0].scrollWidth
+ VBOUND:innerHeight,//$('body')[0].scrollHeight
+ infoBox:{
x:145,
y:innerHeight-110,
width:innerWidth-295,
height:110
- }
- public static team:number = 0
- public playerNum:number = 2//By default
- public teams = {}
- public multiplayer:boolean = false//By default
- public cxt = ($('#middleCanvas')[0] as any) .getContext('2d')
- public frontCxt = ($('#frontCanvas')[0]as any).getContext('2d')
- public static backCxt = ($('#backCanvas')[0]as any).getContext('2d')
- public static fogCxt = ($('#fogCanvas')[0]as any).getContext('2d')
- private _timer:number = -1
- private _frameInterval:number = 100
- public static mainTick: number = 0
- public serverTick:number = 0
- public commands = {}
- public replay = {}
- public randomSeed:number = 0//For later use
- public static selectedUnit={}
- public static allSelected = []
- public _oldAllSelected = []
- public hackMode = false
- public isApp = false
- public static offline =false
- public static CDN =''
-
- static public addIntoAllSelected = function(chara, override){
+ },
+ team:0,
+ playerNum:2,//By default
+ teams:{},
+ multiplayer:false,//By default
+ cxt:$('#middleCanvas')[0].getContext('2d'),
+ frontCxt:$('#frontCanvas')[0].getContext('2d'),
+ backCxt:$('#backCanvas')[0].getContext('2d'),
+ fogCxt:$('#fogCanvas')[0].getContext('2d'),
+ _timer:-1,
+ _frameInterval:100,
+ mainTick:0,
+ serverTick:0,
+ commands:{},
+ replay:{},
+ randomSeed:0,//For later use
+ selectedUnit:{},
+ allSelected:[],
+ _oldAllSelected:[],
+ hackMode:false,
+ isApp:false,
+ offline:false,
+ CDN:'',
+ addIntoAllSelected:function(chara,override){
if (chara instanceof Gobj){
//Add into allSelected if not included
if (Game.allSelected.indexOf(chara)==-1) {
@@ -65,29 +59,33 @@ export class Game {
});
//Notify referee to redraw
Referee.alterSelectionMode();
- }
-
+ },
//To replace setTimeout
- static commandTimeout= function(func,delay){
+ commandTimeout:function(func,delay){
var dueTick=Game.mainTick+(delay/100>>0);
if (!Game.commands[dueTick]) Game.commands[dueTick]=[];
Game.commands[dueTick].push(func);
- }
+ },
//To replace setInterval
- static commandInterval= function(func,interval){
+ commandInterval:function(func,interval){
var funcAdjust=function(){
func();
Game.commandTimeout(funcAdjust,interval);
};
Game.commandTimeout(funcAdjust,interval);
- }
-
- static layerSwitchTo = function(layerName){
+ },
+ race:{
+ selected:'Terran',//Terran race by default
+ choose:function(race){
+ this.selected=race;
+ $('div#GamePlay').attr('race',race);
+ }
+ },
+ layerSwitchTo:function(layerName){
$('div.GameLayer').hide();
$('#'+layerName).show(); //show('slow')
- }
-
- static init= function(){
+ },
+ init:function(){
//Prevent full select
$('div.GameLayer').on("selectstart",function(event){
event.preventDefault();
@@ -207,8 +205,8 @@ export class Game {
AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
Game.start();
})
- }
- static start= function(){
+ },
+ start:function(){
//Game start
Game.layerSwitchTo("GameStart");
//Init level selector
@@ -225,8 +223,8 @@ export class Game {
Game.level=parseInt(this.value);
Game.play();
});
- }
- static play= function(){
+ },
+ play:function(){
//Load level to initial when no error occurs
if (!(Levels[Game.level-1].load())){
//Need Game.playerNum before expansion
@@ -244,16 +242,16 @@ export class Game {
Game.initIndexDB();//Hew H5 feature:Indexed DB
Game.animation();
}
- }
- static getPropArray= function(prop){
+ },
+ getPropArray:function(prop){
var result=[];
for (var N=0;N0) Game.changeSelectedTo(inRectUnits[0]);
else Game.changeSelectedTo({});
Game.addIntoAllSelected(inRectUnits,true);
- }
- static getSelectedOne= function(clickX,clickY,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
+ },
+ getSelectedOne:function(clickX,clickY,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
var distance=function(chara){
return (clickX-chara.posX())*(clickX-chara.posX())+(clickY-chara.posY())*(clickY-chara.posY());//Math.pow2
};
@@ -396,8 +394,8 @@ export class Game {
})[0];
if (!selectedOne) selectedOne={};
return selectedOne;
- }
- getInRangeOnes= function(clickX,clickY,range,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
+ },
+ getInRangeOnes:function(clickX,clickY,range,isEnemyFilter,unitBuildingFilter,isFlyingFilter,customFilter){
//Initial
var selectedOnes=[],charas=[];
switch (unitBuildingFilter){
@@ -440,14 +438,14 @@ export class Game {
return chara.status!='dead' && chara.insideSquare({centerX:clickX,centerY:clickY,radius:range});
});
return selectedOnes;
- }
+ },
//For test use
- getSelected= function(){
+ getSelected:function(){
return Unit.allUnits.concat(Building.allBuildings).filter(function(chara){
return chara.selected;
});
- }
- static showInfoFor= function(chara){
+ },
+ showInfoFor:function(chara){
//Show selected living unit info
if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
//Display info
@@ -564,20 +562,19 @@ export class Game {
//Hide info
$('div.panel_Info>div').hide();
}
- }
- public static refreshInfo = function(){
+ },
+ refreshInfo:function(){
Game.showInfoFor(Game.selectedUnit);
- }
-
- static changeSelectedTo = function(chara){
+ },
+ changeSelectedTo:function(chara){
Game.selectedUnit=chara;
Button.equipButtonsFor(chara);
if (chara instanceof Gobj){
chara.selected=true;
}
Game.showInfoFor(chara);
- }
- static draw= function(chara){
+ },
+ draw:function(chara){
//Can draw units and no-rotate bullets
if (!(chara instanceof Gobj)) return;//Will only show Gobj
if (chara.status=="dead") return;//Will not show dead
@@ -689,8 +686,8 @@ export class Game {
cxt.strokeRect(chara.x-Map.offsetX,chara.y-Map.offsetY+offsetY+(chara.SP?10:5),chara.width,5);
}
}
- }
- static drawEffect= function(chara){
+ },
+ drawEffect:function(chara){
//Can draw units and no-rotate bullets
if (!(chara instanceof Burst)) return;//Will only show Burst
if (chara.status=="dead") return;//Will not show dead
@@ -726,8 +723,8 @@ export class Game {
}
//Remove shadow
cxt.restore();
- }
- static drawBullet= function(chara){
+ },
+ drawBullet:function(chara){
//Can draw bullets need rotate
if (!(chara instanceof Bullets)) return;//Will only show bullet
if (chara.status=="dead") return;//Will not show dead
@@ -768,8 +765,8 @@ export class Game {
//Below 2 separated steps might cause mess
//Game.frontCxt.translate(-centerX,-centerY);
//Game.frontCxt.rotate(chara.angle);
- }
- static drawInfoBox= function(){
+ },
+ drawInfoBox:function(){
//Update selected unit active info which need refresh
if (Game.selectedUnit instanceof Gobj && Game.selectedUnit.status!="dead") {
//Update selected unit life,shield and magic
@@ -787,8 +784,8 @@ export class Game {
$('div.infoCenter p.kill span')[0].innerHTML=Game.selectedUnit.kill;
}
}
- }
- static drawSourceBox= function(){
+ },
+ drawSourceBox:function(){
//Update min, gas, curMan and totalMan
$('div.resource_Box span.mineNum')[0].innerHTML=Resource[Game.team].mine;
$('div.resource_Box span.gasNum')[0].innerHTML=Resource[Game.team].gas;
@@ -796,8 +793,8 @@ export class Game {
$('div.resource_Box span.manNum>span')[1].innerHTML=Resource[Game.team].totalMan;
//Check if man overflow
$('div.resource_Box span.manNum')[0].style.color=(Resource[Game.team].curMan>Resource[Game.team].totalMan)?"red":"#00ff00";
- }
- static drawProcessingBox= function(){
+ },
+ drawProcessingBox:function(){
//Show processing box if it's processing
var processing=Game.selectedUnit.processing;
//Can disable this filter for testing
@@ -824,15 +821,15 @@ export class Game {
}
else $('div.upgrading').removeAttr('title').hide();
}
- }
- static refreshMultiSelectBox= function(){
+ },
+ refreshMultiSelectBox:function(){
var divs=$('div.override div.multiSelection div');
//Only refresh border color on current multiSelect box
for (var n=0;nN
var units=Unit.allGroundUnits().concat(Building.allBuildings);
for(var N=0;N%dR$sj=#1QBtDL0u8S
z1HnNYRxJh!H3%c3jCcdiF5t2AV{5B+t9Ghpe^@@-(aIFV$QI5ItF~%B>PdIM-Tgi9
z)o*`Llpgt$N-6Cx)yktNbBdx|2#APUM4*+weaM`^=pEh(C$I_y8Xa+`j4Zv3>S<
z^abyl=8k8<_ToAYSBQp_4a$$D!})VpS01Q3ww-0{1SjWEh{f~K(sC*OWAJ~|emRoG
z62rvA15QrS2n<|{$jHo*KFx@1CjaOUlbjPxEo)A-w5QfLeXSaQ`46L+Yd&Orp|vAM
zV(kJpTLOtB0dB4t2o22}@3?p?a^`!+|ME8@RaQZpP$Ywe#2a*uExK;p4V<}dF5^F6
z8VKK8QonDWOUTb+TMw{JoWWuTz|}43r!(g@Ni*NEySTP8C$HqJK)4VtG6kf>Pb-o>
z#pCgpyqRnN*LdK@xW{K34>tsQul+ln<_)360`P>6ptHsB^i4tB3e|va|4*-9(X{=t
zs){}O2Idf&FNVlc4jw-a&MtDKXY9n-vlmAD_a7=M+Fe{(_ho&aZtwfrr%zt-Vj?z;
zSewT}Vx9~ZJp@da8}tkXP-NtzroI)cQZu{Hx1awd@2aZy?vY6CU}z|U3HK97?c?F%
zmIxb32>7OUNK96cyx}7@HVy&)!LQ!OtCMLo_hi-<3*jeQ4<|_)_}oR%)3ZWEyb|B^
z-o%ybH<7+hg^l?e8nt`sYHK!G3W?oZ5ts}DmJRr3t`JM+!;r~?F^7ZY(Ge&r-VHBr
zPl&C>NMEzMqv>>$T*o=R)$*HieBdfgg137n%!K|}x@-;FE?>u0jRrk^H*oCuQ7DsF
z^>(&hj8P`aZ9jq+S^vdo*iK9y)lk
zz=Y+BtV}f)1g}Eju1a+FUPrg44}-TKVsh+9Z2NQvm=qJKv2xg3+JR+Y3}wc8&{-S^
z#Zq_&E=GK;0*(?_m>6$6#P+2NP2-`1`FyfL{V=6c;Rg
zK8Xzt>#~)d;gMmZvvJNQ4+sc;-lMq=^??J}R&)U57-8A+6=1PU2)7Bb&57im8`z9+
zFb&c{*IR|q;9`UXXMv(fTqrg^-}8C7or8o>eE1z7wls1yL$wwawbj^PTZE5G)%sjcw49D
zYXA55hQ$vb-8Wk$Pwr+g7!V4Cuy?jc^{EQ%s3|~H>N3!c*+lLMYqQnh(emMDaRpY)
zb8wejg@bh!4Csp>a&QHc%f!>Mr<}QRA3kz$tMfcta=!||Vi-Uy62Z&elfMQ0q^D#eA~YJyLSwOevl@!TOjwBQ
zuq;lAu$a}LXnb&m&PY)f;!@iXhOa+|B6dBg0k$~tWk=qbh7RSn&85e!%v~|xH4s*2
z4j8yO^vieL#KaGV>(;IA*s?VbUEg-1r@IU5RjRhU^&47Bc9&Lab!>0F2v-Lgyj*?2
zFl2#g%z-jJy)%2$#H61AW)-%+Wy=%1GlYgBsR4SEVkhACE;SMXY
z6)1guOiWF^jpLKCFY|g6d;GW&=-#Op|G{_LwuZa
zVCeQE>2&{V`%j)c;pODyoRvr-eoSh*sNe6t0BW8wlX*BPd!ZU_j7d4BEMu;=uB)BAVs+>snTdQ_#=
zMJLbB$v&GbPwb6Ph#~ba61$3aR@Z)UIA1rfYe(+g7v<&VHwOhSfS0Eq934DhWhEnd
zX#=U>Qm-b%kI(?=&>Cxkdg4y+L;wH)
literal 0
HcmV?d00001
diff --git a/src/index.html b/src/index.html
index 3987731..39336ef 100644
--- a/src/index.html
+++ b/src/index.html
@@ -10,7 +10,7 @@
-
+
From f1f371cca04020444662245b8bf4c85265a56150 Mon Sep 17 00:00:00 2001
From: mario meltzow
Date: Sun, 2 Apr 2017 19:07:56 +0200
Subject: [PATCH 06/15] rename
---
{src/bgm => img/Bg}/Deleted | 0
{src/img/Bg => img/Charas}/Deleted | 0
{src/img => img}/Demo/Demo.jpg | Bin
{src/img => img}/Demo/Demo.png | Bin
{src/img/Charas => img/Maps}/Deleted | 0
{src/img/Maps => img/Menu}/Deleted | 0
src/css/buttonStyle.css | 6 ++--
src/css/mapStyle.css | 2 +-
src/css/style.css | 42 +++++++++++++--------------
src/img/Menu/Deleted | 0
10 files changed, 25 insertions(+), 25 deletions(-)
rename {src/bgm => img/Bg}/Deleted (100%)
rename {src/img/Bg => img/Charas}/Deleted (100%)
rename {src/img => img}/Demo/Demo.jpg (100%)
rename {src/img => img}/Demo/Demo.png (100%)
rename {src/img/Charas => img/Maps}/Deleted (100%)
rename {src/img/Maps => img/Menu}/Deleted (100%)
delete mode 100644 src/img/Menu/Deleted
diff --git a/src/bgm/Deleted b/img/Bg/Deleted
similarity index 100%
rename from src/bgm/Deleted
rename to img/Bg/Deleted
diff --git a/src/img/Bg/Deleted b/img/Charas/Deleted
similarity index 100%
rename from src/img/Bg/Deleted
rename to img/Charas/Deleted
diff --git a/src/img/Demo/Demo.jpg b/img/Demo/Demo.jpg
similarity index 100%
rename from src/img/Demo/Demo.jpg
rename to img/Demo/Demo.jpg
diff --git a/src/img/Demo/Demo.png b/img/Demo/Demo.png
similarity index 100%
rename from src/img/Demo/Demo.png
rename to img/Demo/Demo.png
diff --git a/src/img/Charas/Deleted b/img/Maps/Deleted
similarity index 100%
rename from src/img/Charas/Deleted
rename to img/Maps/Deleted
diff --git a/src/img/Maps/Deleted b/img/Menu/Deleted
similarity index 100%
rename from src/img/Maps/Deleted
rename to img/Menu/Deleted
diff --git a/src/css/buttonStyle.css b/src/css/buttonStyle.css
index ecdf795..7a33225 100644
--- a/src/css/buttonStyle.css
+++ b/src/css/buttonStyle.css
@@ -4,9 +4,9 @@ div.panel_Control button{
width:36px;
height:34px;
display:none;
- background-image: url('../img/Menu/CmdIcons.png');
+ background-image: url('../../img/Menu/CmdIcons.png');
border-width:2px;
- cursor:url('../img/Menu/cursor.ico'),auto;
+ cursor:url('../../img/Menu/cursor.ico'),auto;
/*For text inside button*/
color:red;
font-weight:bolder;
@@ -15,7 +15,7 @@ div.panel_Control button{
vertical-align:bottom;
}
div.panel_Control button[disabled='disabled']{
- background-image: url('../img/Menu/CmdIconsDisabled.png');
+ background-image: url('../../img/Menu/CmdIconsDisabled.png');
/*filter:grayscale(100%);
-webkit-filter:grayscale(100%);
-moz-filter:grayscale(100%);
diff --git a/src/css/mapStyle.css b/src/css/mapStyle.css
index 5d33d33..4d47dc9 100644
--- a/src/css/mapStyle.css
+++ b/src/css/mapStyle.css
@@ -4,7 +4,7 @@ div#GamePlay div.panel_Map canvas[name='mini_map']{
top:32px;
width:130px;
height:130px;
- background-image: url('../img/Maps/Snapshot.jpg');
+ background-image: url('../../img/Maps/Snapshot.jpg');
}
canvas[name='mini_map'].Switchback {
background-position: 0 0;
diff --git a/src/css/style.css b/src/css/style.css
index 26d3791..c29fac8 100644
--- a/src/css/style.css
+++ b/src/css/style.css
@@ -10,7 +10,7 @@ div.GameLayer{
height:100%;
position:absolute;
display:none;
- cursor:url('../img/Menu/cursor.ico'),auto;
+ cursor:url('../../img/Menu/cursor.ico'),auto;
}
.GameLayer img{
width:100%;
@@ -19,7 +19,7 @@ div.GameLayer{
z-index:-1;/*As background*/
}
div.GameLayer[status="button"]{
- cursor:url('../img/Menu/cursorLocating.ico'),auto;
+ cursor:url('../../img/Menu/cursorLocating.ico'),auto;
}
#backCanvas{
position:absolute;
@@ -104,7 +104,7 @@ div#GamePlay div.panel_Map {
bottom:0;
width:145px;
height:165px;
- background-image: url('../img/Menu/ControlPanel.png');
+ background-image: url('../../img/Menu/ControlPanel.png');
}
div#GamePlay div.panel_Info {
left:145px;
@@ -128,7 +128,7 @@ div#GamePlay div.panel_Info div.infoLeft div[name="portrait"] {
width:60px;
height:56px;
margin-top:12px;
- background-image:url('../img/Charas/Portrait.png');
+ background-image:url('../../img/Charas/Portrait.png');
}
div.infoLeft div#HP_SP,div.infoLeft div#MP {
width:100%;
@@ -168,7 +168,7 @@ div#GamePlay div.panel_Info div.infoCenter p.icons span {
display:inline-block;
width:36px;
height:34px;
- background-image: url('../img/Menu/CmdIcons.png');
+ background-image: url('../../img/Menu/CmdIcons.png');
border:2px solid white;
border-radius:6px;
margin-right:1px;
@@ -202,7 +202,7 @@ div.infoRight div.upgrading{
div.infoRight div[name='icon']{
width:32px;
height:34px;
- background-image: url('../img/Menu/CmdIcons.png');
+ background-image: url('../../img/Menu/CmdIcons.png');
/*For text inside icon*/
color:red;
font:bolder 1.8em Verdana,Arial;
@@ -215,7 +215,7 @@ div#GamePlay div.infoRight div.upgraded div[name='icon']{
display:inline-block;
}
div.infoRight div[name='icon'][disabled='true']{
- background-image: url('../img/Menu/CmdIconsDisabled.png');
+ background-image: url('../../img/Menu/CmdIconsDisabled.png');
}
div.infoRight div.upgrading div[name='processing']{
right:6px;
@@ -228,18 +228,18 @@ div.infoRight div.upgrading div[name='processing']{
div.infoRight div.upgrading div.processBar{
width:100%;
height:14px;
- background:url('../img/Menu/Thingy.png') 0 -14px;
+ background:url('../../img/Menu/Thingy.png') 0 -14px;
}
div.infoRight div.upgrading div.processedBar{
height:100%;
- background:url('../img/Menu/Thingy.png') 0 -28px;
+ background:url('../../img/Menu/Thingy.png') 0 -28px;
}
div#GamePlay div.panel_Control {
right:0;
bottom:0;
width:150px;
height:155px;
- background-image: url('../img/Menu/ControlPanel.png');
+ background-image: url('../../img/Menu/ControlPanel.png');
}
div#GamePlay div.panel_Info {
border-width:22px 0 0 0;
@@ -249,9 +249,9 @@ div#GamePlay[race="Zerg"] div.panel_Map {
background-position: 0 bottom;
}
div#GamePlay[race="Zerg"] div.panel_Info {
- -webkit-border-image: url('../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
- -o-border-image: url('../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
- border-image: url('../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
+ -webkit-border-image: url('../../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
+ -o-border-image: url('../../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
+ border-image: url('../../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
}
div#GamePlay[race="Zerg"] div.panel_Control {
background-position: -400px bottom;
@@ -260,9 +260,9 @@ div#GamePlay[race="Protoss"] div.panel_Map {
background-position: -555px bottom;
}
div#GamePlay[race="Protoss"] div.panel_Info {
- -webkit-border-image: url('../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
- -o-border-image: url('../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
- border-image: url('../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
+ -webkit-border-image: url('../../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
+ -o-border-image: url('../../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
+ border-image: url('../../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
}
div#GamePlay[race="Protoss"] div.panel_Control {
background-position: -958px bottom;
@@ -271,9 +271,9 @@ div#GamePlay[race="Terran"] div.panel_Map {
background-position: -1110px bottom;
}
div#GamePlay[race="Terran"] div.panel_Info {
- -webkit-border-image: url('../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
- -o-border-image: url('../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
- border-image: url('../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
+ -webkit-border-image: url('../../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
+ -o-border-image: url('../../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
+ border-image: url('../../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
}
div#GamePlay[race="Terran"] div.panel_Control {
background-position: -1516px bottom;
@@ -298,7 +298,7 @@ div#GamePlay div.panel_Info div.override div.multiSelection div{
float:left;
width:45px;
height:42px;
- background-image:url('../img/Charas/Portrait.png');
+ background-image:url('../../img/Charas/Portrait.png');
background-size:720px 210px;
border:3px solid white;
border-radius:6px;
@@ -360,7 +360,7 @@ div#GamePlay div.resource_Box div, div#GamePlay div.tooltip_Box div.cost div{
position:relative;
width:14px;
height:14px;
- background-image:url('../img/Menu/Thingy.png');
+ background-image:url('../../img/Menu/Thingy.png');
display:inline-block;
}
div#GamePlay div.mine{
diff --git a/src/img/Menu/Deleted b/src/img/Menu/Deleted
deleted file mode 100644
index e69de29..0000000
From e55fde06359b68f46c61c80f9d13515bdde1cb11 Mon Sep 17 00:00:00 2001
From: Mario Meltzow
Date: Mon, 3 Apr 2017 20:08:44 +0200
Subject: [PATCH 07/15] fix UI with hardcoded cdn
---
src/css/buttonStyle.css | 6 +++---
src/css/mapStyle.css | 2 +-
src/css/style.css | 42 ++++++++++++++++++++---------------------
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/src/css/buttonStyle.css b/src/css/buttonStyle.css
index 7a33225..05d092b 100644
--- a/src/css/buttonStyle.css
+++ b/src/css/buttonStyle.css
@@ -4,9 +4,9 @@ div.panel_Control button{
width:36px;
height:34px;
display:none;
- background-image: url('../../img/Menu/CmdIcons.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/CmdIcons.png');
border-width:2px;
- cursor:url('../../img/Menu/cursor.ico'),auto;
+ cursor:url('http://www.nvhae.com/starcraft/img/Menu/cursor.ico'),auto;
/*For text inside button*/
color:red;
font-weight:bolder;
@@ -15,7 +15,7 @@ div.panel_Control button{
vertical-align:bottom;
}
div.panel_Control button[disabled='disabled']{
- background-image: url('../../img/Menu/CmdIconsDisabled.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/CmdIconsDisabled.png');
/*filter:grayscale(100%);
-webkit-filter:grayscale(100%);
-moz-filter:grayscale(100%);
diff --git a/src/css/mapStyle.css b/src/css/mapStyle.css
index 4d47dc9..0a99527 100644
--- a/src/css/mapStyle.css
+++ b/src/css/mapStyle.css
@@ -4,7 +4,7 @@ div#GamePlay div.panel_Map canvas[name='mini_map']{
top:32px;
width:130px;
height:130px;
- background-image: url('../../img/Maps/Snapshot.jpg');
+ background-image: url('http://www.nvhae.com/starcraft/img/Maps/Snapshot.jpg');
}
canvas[name='mini_map'].Switchback {
background-position: 0 0;
diff --git a/src/css/style.css b/src/css/style.css
index c29fac8..68a58a6 100644
--- a/src/css/style.css
+++ b/src/css/style.css
@@ -10,7 +10,7 @@ div.GameLayer{
height:100%;
position:absolute;
display:none;
- cursor:url('../../img/Menu/cursor.ico'),auto;
+ cursor:url('http://www.nvhae.com/starcraft/img/Menu/cursor.ico'),auto;
}
.GameLayer img{
width:100%;
@@ -19,7 +19,7 @@ div.GameLayer{
z-index:-1;/*As background*/
}
div.GameLayer[status="button"]{
- cursor:url('../../img/Menu/cursorLocating.ico'),auto;
+ cursor:url('http://www.nvhae.com/starcraft/img/Menu/cursorLocating.ico'),auto;
}
#backCanvas{
position:absolute;
@@ -104,7 +104,7 @@ div#GamePlay div.panel_Map {
bottom:0;
width:145px;
height:165px;
- background-image: url('../../img/Menu/ControlPanel.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png');
}
div#GamePlay div.panel_Info {
left:145px;
@@ -128,7 +128,7 @@ div#GamePlay div.panel_Info div.infoLeft div[name="portrait"] {
width:60px;
height:56px;
margin-top:12px;
- background-image:url('../../img/Charas/Portrait.png');
+ background-image:url('http://www.nvhae.com/starcraft/img/Charas/Portrait.png');
}
div.infoLeft div#HP_SP,div.infoLeft div#MP {
width:100%;
@@ -168,7 +168,7 @@ div#GamePlay div.panel_Info div.infoCenter p.icons span {
display:inline-block;
width:36px;
height:34px;
- background-image: url('../../img/Menu/CmdIcons.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/CmdIcons.png');
border:2px solid white;
border-radius:6px;
margin-right:1px;
@@ -202,7 +202,7 @@ div.infoRight div.upgrading{
div.infoRight div[name='icon']{
width:32px;
height:34px;
- background-image: url('../../img/Menu/CmdIcons.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/CmdIcons.png');
/*For text inside icon*/
color:red;
font:bolder 1.8em Verdana,Arial;
@@ -215,7 +215,7 @@ div#GamePlay div.infoRight div.upgraded div[name='icon']{
display:inline-block;
}
div.infoRight div[name='icon'][disabled='true']{
- background-image: url('../../img/Menu/CmdIconsDisabled.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/CmdIconsDisabled.png');
}
div.infoRight div.upgrading div[name='processing']{
right:6px;
@@ -228,18 +228,18 @@ div.infoRight div.upgrading div[name='processing']{
div.infoRight div.upgrading div.processBar{
width:100%;
height:14px;
- background:url('../../img/Menu/Thingy.png') 0 -14px;
+ background:url('http://www.nvhae.com/starcraft/img/Menu/Thingy.png') 0 -14px;
}
div.infoRight div.upgrading div.processedBar{
height:100%;
- background:url('../../img/Menu/Thingy.png') 0 -28px;
+ background:url('http://www.nvhae.com/starcraft/img/Menu/Thingy.png') 0 -28px;
}
div#GamePlay div.panel_Control {
right:0;
bottom:0;
width:150px;
height:155px;
- background-image: url('../../img/Menu/ControlPanel.png');
+ background-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png');
}
div#GamePlay div.panel_Info {
border-width:22px 0 0 0;
@@ -249,9 +249,9 @@ div#GamePlay[race="Zerg"] div.panel_Map {
background-position: 0 bottom;
}
div#GamePlay[race="Zerg"] div.panel_Info {
- -webkit-border-image: url('../../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
- -o-border-image: url('../../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
- border-image: url('../../img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
+ -webkit-border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
+ -o-border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
+ border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 1265 0 163 repeat;
}
div#GamePlay[race="Zerg"] div.panel_Control {
background-position: -400px bottom;
@@ -260,9 +260,9 @@ div#GamePlay[race="Protoss"] div.panel_Map {
background-position: -555px bottom;
}
div#GamePlay[race="Protoss"] div.panel_Info {
- -webkit-border-image: url('../../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
- -o-border-image: url('../../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
- border-image: url('../../img/Menu/ControlPanel.png') 22 743 0 745 repeat;
+ -webkit-border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 743 0 745 repeat;
+ -o-border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 743 0 745 repeat;
+ border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 743 0 745 repeat;
}
div#GamePlay[race="Protoss"] div.panel_Control {
background-position: -958px bottom;
@@ -271,9 +271,9 @@ div#GamePlay[race="Terran"] div.panel_Map {
background-position: -1110px bottom;
}
div#GamePlay[race="Terran"] div.panel_Info {
- -webkit-border-image: url('../../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
- -o-border-image: url('../../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
- border-image: url('../../img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
+ -webkit-border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
+ -o-border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
+ border-image: url('http://www.nvhae.com/starcraft/img/Menu/ControlPanel.png') 22 149 0 1284 repeat;
}
div#GamePlay[race="Terran"] div.panel_Control {
background-position: -1516px bottom;
@@ -298,7 +298,7 @@ div#GamePlay div.panel_Info div.override div.multiSelection div{
float:left;
width:45px;
height:42px;
- background-image:url('../../img/Charas/Portrait.png');
+ background-image:url('http://www.nvhae.com/starcraft/img/Charas/Portrait.png');
background-size:720px 210px;
border:3px solid white;
border-radius:6px;
@@ -360,7 +360,7 @@ div#GamePlay div.resource_Box div, div#GamePlay div.tooltip_Box div.cost div{
position:relative;
width:14px;
height:14px;
- background-image:url('../../img/Menu/Thingy.png');
+ background-image:url('http://www.nvhae.com/starcraft/img/Menu/Thingy.png');
display:inline-block;
}
div#GamePlay div.mine{
From d4fd3d51c9bef940779babaf53d66b5aad2e1801 Mon Sep 17 00:00:00 2001
From: Mario Meltzow
Date: Mon, 3 Apr 2017 20:26:34 +0200
Subject: [PATCH 08/15] webpack build is now working
---
.gitignore | 1 +
tsconfig.json | 7 +++++++
tslint.json | 9 +++++++++
3 files changed, 17 insertions(+)
create mode 100644 tslint.json
diff --git a/.gitignore b/.gitignore
index e9bc4e2..b7e8330 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@ Thumbs.db
Original/
*.map
node_modules/
+dist/
diff --git a/tsconfig.json b/tsconfig.json
index cadfcff..9208668 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,10 +1,13 @@
{
"compilerOptions": {
+ "outDir": "./dist",
+ "allowJs": true,
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
+ "noImplicitReturns": true,
"typeRoots": ["node_modules/@types/"],
"types": [
"node",
@@ -12,10 +15,14 @@
"es6-shim"
]
},
+ "include": [
+ "./src/**/*"
+ ],
"compileOnSave": false,
"filesGlob": [
"src/**/*.ts",
"src/**/*.tsx",
+ "src/**/*.js",
"!node_modules/**"
]
}
diff --git a/tslint.json b/tslint.json
new file mode 100644
index 0000000..32fa6e5
--- /dev/null
+++ b/tslint.json
@@ -0,0 +1,9 @@
+{
+ "defaultSeverity": "error",
+ "extends": [
+ "tslint:recommended"
+ ],
+ "jsRules": {},
+ "rules": {},
+ "rulesDirectory": []
+}
\ No newline at end of file
From 770ec831c062d91b1ebc9ae179ec1fde1951780c Mon Sep 17 00:00:00 2001
From: Mario Meltzow
Date: Mon, 3 Apr 2017 20:44:29 +0200
Subject: [PATCH 09/15] remove not needed angularjs dependencies.
---
.tmp/index.html | 142 ++++++++++++++++++++++++++++++++++++++++++
.tmp/index.js | 101 ++++++++++++++++++++++++++++++
package.json | 10 ---
src/app/hello.html | 1 -
src/app/hello.spec.ts | 20 ------
src/app/hello.ts | 13 ----
src/app/index.ts | 18 ------
src/app/routes.js | 34 ----------
src/app/routes.ts | 18 ------
src/index.spec.js | 20 ------
src/index.ts | 4 ++
src/index1.html | 15 -----
12 files changed, 247 insertions(+), 149 deletions(-)
create mode 100644 .tmp/index.html
create mode 100644 .tmp/index.js
delete mode 100644 src/app/hello.html
delete mode 100644 src/app/hello.spec.ts
delete mode 100644 src/app/hello.ts
delete mode 100644 src/app/index.ts
delete mode 100644 src/app/routes.js
delete mode 100644 src/app/routes.ts
delete mode 100644 src/index.spec.js
delete mode 100644 src/index1.html
diff --git a/.tmp/index.html b/.tmp/index.html
new file mode 100644
index 0000000..73bd573
--- /dev/null
+++ b/.tmp/index.html
@@ -0,0 +1,142 @@
+
+
+
+ StarCraft
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Detector
+
Kill:
+
Damage:
+
Armor:
+
Plasma:
+
Passenger:
+
+
+
+
+
+
+
+
+ Message:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.tmp/index.js b/.tmp/index.js
new file mode 100644
index 0000000..e68587d
--- /dev/null
+++ b/.tmp/index.js
@@ -0,0 +1,101 @@
+/******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+/******/
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ i: moduleId,
+/******/ l: false,
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.l = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/
+/******/ // identity function for calling harmony imports with the correct context
+/******/ __webpack_require__.i = function(value) { return value; };
+/******/
+/******/ // define getter function for harmony exports
+/******/ __webpack_require__.d = function(exports, name, getter) {
+/******/ if(!__webpack_require__.o(exports, name)) {
+/******/ Object.defineProperty(exports, name, {
+/******/ configurable: false,
+/******/ enumerable: true,
+/******/ get: getter
+/******/ });
+/******/ }
+/******/ };
+/******/
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function getDefault() { return module['default']; } :
+/******/ function getModuleExports() { return module; };
+/******/ __webpack_require__.d(getter, 'a', getter);
+/******/ return getter;
+/******/ };
+/******/
+/******/ // Object.prototype.hasOwnProperty.call
+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(__webpack_require__.s = 0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports) {
+
+/*
+import 'core-js/client/shim';
+import 'zone.js/dist/zone';
+
+import '@angular/common';
+import 'rxjs';
+
+import './index.scss';
+
+import {enableProdMode} from '@angular/core';
+import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
+import {AppModule} from './app';
+*/
+/*
+declare var process: any;
+if (process.env.NODE_ENV === 'production') {
+ enableProdMode();
+} else {
+ Error['stackTraceLimit'] = Infinity; // tslint:disable-line:no-string-literal
+ require('zone.js/dist/long-stack-trace-zone'); // tslint:disable-line:no-var-requires
+}
+
+platformBrowserDynamic().bootstrapModule(AppModule);
+*/
+
+
+/***/ })
+/******/ ]);
+//# sourceMappingURL=index.js.map
\ No newline at end of file
diff --git a/package.json b/package.json
index 5f40d2e..849283b 100644
--- a/package.json
+++ b/package.json
@@ -1,15 +1,5 @@
{
"dependencies": {
- "@angular/core": "^2.4.8",
- "@angular/compiler": "^2.4.8",
- "@angular/common": "^2.4.8",
- "@angular/platform-browser": "^2.4.8",
- "@angular/platform-browser-dynamic": "^2.4.8",
- "@angular/http": "^2.4.8",
- "rxjs": "5.1.1",
- "zone.js": "^0.7.7",
- "core-js": "^2.4.1",
- "@angular/router": "^3.4.8"
},
"devDependencies": {
"@types/es6-shim": "^0.31.32",
diff --git a/src/app/hello.html b/src/app/hello.html
deleted file mode 100644
index 2ec8382..0000000
--- a/src/app/hello.html
+++ /dev/null
@@ -1 +0,0 @@
-{{ hello }}
\ No newline at end of file
diff --git a/src/app/hello.spec.ts b/src/app/hello.spec.ts
deleted file mode 100644
index 678451f..0000000
--- a/src/app/hello.spec.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import {HelloComponent} from './hello';
-import {TestBed, async} from '@angular/core/testing';
-
-describe('hello component', () => {
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- declarations: [
- HelloComponent
- ]
- });
- TestBed.compileComponents();
- }));
-
- it('should render hello world', () => {
- const fixture = TestBed.createComponent(HelloComponent);
- fixture.detectChanges();
- const hello = fixture.nativeElement;
- expect(hello.querySelector('h1').textContent).toBe('Hello World!');
- });
-});
diff --git a/src/app/hello.ts b/src/app/hello.ts
deleted file mode 100644
index 9f42916..0000000
--- a/src/app/hello.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import {Component} from '@angular/core';
-
-@Component({
- selector: 'fountain-app',
- template: require('./hello.html')
-})
-export class HelloComponent {
- public hello: string;
-
- constructor() {
- this.hello = 'Hello World!';
- }
-}
diff --git a/src/app/index.ts b/src/app/index.ts
deleted file mode 100644
index 5f02fe6..0000000
--- a/src/app/index.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import {NgModule} from '@angular/core';
-import {BrowserModule} from '@angular/platform-browser';
-import {routing, RootComponent} from './routes';
-
-import {HelloComponent} from './hello';
-
-@NgModule({
- imports: [
- BrowserModule,
- routing
- ],
- declarations: [
- RootComponent,
- HelloComponent
- ],
- bootstrap: [RootComponent]
-})
-export class AppModule {}
diff --git a/src/app/routes.js b/src/app/routes.js
deleted file mode 100644
index 1237150..0000000
--- a/src/app/routes.js
+++ /dev/null
@@ -1,34 +0,0 @@
-"use strict";
-var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
-};
-var __metadata = (this && this.__metadata) || function (k, v) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
-};
-var core_1 = require('@angular/core');
-var router_1 = require('@angular/router');
-var hello_1 = require('./hello');
-var RootComponent = (function () {
- function RootComponent() {
- }
- RootComponent = __decorate([
- core_1.Component({
- selector: 'fountain-root',
- template: ''
- }),
- __metadata('design:paramtypes', [])
- ], RootComponent);
- return RootComponent;
-}());
-exports.RootComponent = RootComponent;
-exports.routes = [
- {
- path: '',
- component: hello_1.HelloComponent
- }
-];
-exports.routing = router_1.RouterModule.forRoot(exports.routes);
-//# sourceMappingURL=routes.js.map
\ No newline at end of file
diff --git a/src/app/routes.ts b/src/app/routes.ts
deleted file mode 100644
index 8542592..0000000
--- a/src/app/routes.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import {Component} from '@angular/core';
-import {RouterModule, Routes} from '@angular/router';
-import {HelloComponent} from './hello';
-
-@Component({
- selector: 'fountain-root',
- template: ''
-})
-export class RootComponent {}
-
-export const routes: Routes = [
- {
- path: '',
- component: HelloComponent
- }
-];
-
-export const routing = RouterModule.forRoot(routes);
diff --git a/src/index.spec.js b/src/index.spec.js
deleted file mode 100644
index 3f4ad63..0000000
--- a/src/index.spec.js
+++ /dev/null
@@ -1,20 +0,0 @@
-Error.stackTraceLimit = Infinity;
-
-require('core-js/client/shim');
-
-require('@angular/common');
-require('rxjs');
-
-require('zone.js/dist/zone');
-require('zone.js/dist/long-stack-trace-zone');
-require('zone.js/dist/proxy');
-require('zone.js/dist/sync-test');
-require('zone.js/dist/jasmine-patch');
-require('zone.js/dist/async-test');
-require('zone.js/dist/fake-async-test');
-const context = require.context('./app', true, /\.(js|ts|tsx)$/);
-context.keys().forEach(context);
-const testing = require('@angular/core/testing');
-const testingBrowser = require('@angular/platform-browser-dynamic/testing');
-
-testing.TestBed.initTestEnvironment(testingBrowser.BrowserDynamicTestingModule, testingBrowser.platformBrowserDynamicTesting());
diff --git a/src/index.ts b/src/index.ts
index 128a34a..4ef7508 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,3 +1,4 @@
+/*
import 'core-js/client/shim';
import 'zone.js/dist/zone';
@@ -9,7 +10,9 @@ import './index.scss';
import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app';
+*/
+/*
declare var process: any;
if (process.env.NODE_ENV === 'production') {
enableProdMode();
@@ -19,3 +22,4 @@ if (process.env.NODE_ENV === 'production') {
}
platformBrowserDynamic().bootstrapModule(AppModule);
+*/
diff --git a/src/index1.html b/src/index1.html
deleted file mode 100644
index 2d0e805..0000000
--- a/src/index1.html
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
- FountainJS
-
-
-
-
-
-
- Loading...
-
-
From 0e92f592ca2a7a1453a87eb06a5ad3f06c70b564 Mon Sep 17 00:00:00 2001
From: mario meltzow
Date: Mon, 3 Apr 2017 20:59:21 +0200
Subject: [PATCH 10/15] add build docu
---
README.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/README.md b/README.md
index c65566b..0e0d598 100644
--- a/README.md
+++ b/README.md
@@ -41,3 +41,9 @@ Classic RTS game at html5 canvas and javascript, only js codes, copyright materi
## Try it online at:
[SC Html5 Online](http://www.nvhae.com/starcraft/)
+
+## Build it
+* npm install
+* npm run serve
+* go to http://localhost:3000 (more info see console.log)
+
From 0f0b6574c10a68888fe53a69d9244d9f7c89363c Mon Sep 17 00:00:00 2001
From: Mario Meltzow
Date: Tue, 4 Apr 2017 10:57:55 +0200
Subject: [PATCH 11/15] ignore files
---
.gitignore | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.gitignore b/.gitignore
index b7e8330..6ca7a94 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,5 @@ Original/
*.map
node_modules/
dist/
+bgm/
+img/
From 3c68158eededa3ab85ca9104db9021a6b5e8a56f Mon Sep 17 00:00:00 2001
From: Mario Meltzow
Date: Mon, 2 Oct 2017 16:40:07 +0200
Subject: [PATCH 12/15] ts for Game
---
.tmp/index.js | 4 +--
.vscode/settings.json | 3 ++
npm-debug.log | 54 +++++++++++++++++++++++++++++++
package.json | 4 +--
src/Characters/Map.js | 2 +-
src/GameRule/{Game.js => Game.ts} | 21 ++++++++----
src/Utils/sourceLoader.js | 2 ++
src/index.ts | 24 --------------
tsconfig.json | 5 ++-
tslint.json | 8 +----
10 files changed, 81 insertions(+), 46 deletions(-)
create mode 100644 .vscode/settings.json
create mode 100644 npm-debug.log
rename src/GameRule/{Game.js => Game.ts} (98%)
diff --git a/.tmp/index.js b/.tmp/index.js
index e68587d..9891eb2 100644
--- a/.tmp/index.js
+++ b/.tmp/index.js
@@ -6,9 +6,9 @@
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
+/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
-/******/
+/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..55712c1
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "typescript.tsdk": "node_modules/typescript/lib"
+}
\ No newline at end of file
diff --git a/npm-debug.log b/npm-debug.log
new file mode 100644
index 0000000..1e7225c
--- /dev/null
+++ b/npm-debug.log
@@ -0,0 +1,54 @@
+0 info it worked if it ends with ok
+1 verbose cli [ '/usr/bin/nodejs',
+1 verbose cli '/usr/bin/npm',
+1 verbose cli 'uninstall',
+1 verbose cli '--save-dev',
+1 verbose cli '@types/es6-shim' ]
+2 info using npm@3.5.2
+3 info using node@v4.7.2
+4 silly loadCurrentTree Starting
+5 silly install loadCurrentTree
+6 silly install readLocalPackageData
+7 silly install normalizeTree
+8 silly loadCurrentTree Finishing
+9 silly loadIdealTree Starting
+10 silly install loadIdealTree
+11 silly cloneCurrentTree Starting
+12 silly install cloneCurrentTreeToIdealTree
+13 silly cloneCurrentTree Finishing
+14 silly loadShrinkwrap Starting
+15 silly install loadShrinkwrap
+16 silly loadShrinkwrap Finishing
+17 silly loadAllDepsIntoIdealTree Starting
+18 silly uninstall loadAllDepsIntoIdealtree
+19 verbose stack Error: Missing required argument #3
+19 verbose stack at replaceModule (/usr/share/npm/lib/install/deps.js:438:3)
+19 verbose stack at /usr/share/npm/lib/install/deps.js:234:7
+19 verbose stack at Array.forEach (native)
+19 verbose stack at exports.removeDeps (/usr/share/npm/lib/install/deps.js:230:8)
+19 verbose stack at Array. (/usr/share/npm/node_modules/slide/lib/bind-actor.js:15:8)
+19 verbose stack at LOOP (/usr/share/npm/node_modules/slide/lib/chain.js:15:14)
+19 verbose stack at chain (/usr/share/npm/node_modules/slide/lib/chain.js:20:5)
+19 verbose stack at Uninstaller.loadAllDepsIntoIdealTree (/usr/share/npm/lib/uninstall.js:72:3)
+19 verbose stack at Array. (/usr/share/npm/node_modules/slide/lib/bind-actor.js:15:8)
+19 verbose stack at LOOP (/usr/share/npm/node_modules/slide/lib/chain.js:15:14)
+20 verbose cwd /tmp/SC_Js
+21 error Linux 4.10.0-33-generic
+22 error argv "/usr/bin/nodejs" "/usr/bin/npm" "uninstall" "--save-dev" "@types/es6-shim"
+23 error node v4.7.2
+24 error npm v3.5.2
+25 error code EMISSINGARG
+26 error typeerror Error: Missing required argument #3
+26 error typeerror at replaceModule (/usr/share/npm/lib/install/deps.js:438:3)
+26 error typeerror at /usr/share/npm/lib/install/deps.js:234:7
+26 error typeerror at Array.forEach (native)
+26 error typeerror at exports.removeDeps (/usr/share/npm/lib/install/deps.js:230:8)
+26 error typeerror at Array. (/usr/share/npm/node_modules/slide/lib/bind-actor.js:15:8)
+26 error typeerror at LOOP (/usr/share/npm/node_modules/slide/lib/chain.js:15:14)
+26 error typeerror at chain (/usr/share/npm/node_modules/slide/lib/chain.js:20:5)
+26 error typeerror at Uninstaller.loadAllDepsIntoIdealTree (/usr/share/npm/lib/uninstall.js:72:3)
+26 error typeerror at Array. (/usr/share/npm/node_modules/slide/lib/bind-actor.js:15:8)
+26 error typeerror at LOOP (/usr/share/npm/node_modules/slide/lib/chain.js:15:14)
+27 error typeerror This is an error with npm itself. Please report this error at:
+27 error typeerror
+28 verbose exit [ 1, true ]
diff --git a/package.json b/package.json
index 849283b..7e6341d 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,6 @@
{
- "dependencies": {
- },
+ "dependencies": {},
"devDependencies": {
- "@types/es6-shim": "^0.31.32",
"@types/jasmine": "^2.5.43",
"@types/jquery": "^2.0.40",
"@types/node": "^7.0.5",
diff --git a/src/Characters/Map.js b/src/Characters/Map.js
index f26d6e4..e261c59 100644
--- a/src/Characters/Map.js
+++ b/src/Characters/Map.js
@@ -6,7 +6,7 @@ var Map={
speed:40,
triggerMargin:20,
//To synchronize drawing map and units, will not refresh immediately
- needRefresh:false,
+ needRefresh:null,
fogFlag:true,
fogUnits:[],//Units need to draw fog on screen
allUnits:[],//Units need to draw fog on minimap
diff --git a/src/GameRule/Game.js b/src/GameRule/Game.ts
similarity index 98%
rename from src/GameRule/Game.js
rename to src/GameRule/Game.ts
index ff71f37..608552a 100644
--- a/src/GameRule/Game.js
+++ b/src/GameRule/Game.ts
@@ -1,3 +1,9 @@
+declare var Gobj, $, _$, Building, Referee, sourceLoader;
+declare var Levels, Resource, Multiplayer, Button, Map;
+declare var webkitIndexedDB, mozIndexedDB, msIndexedDB;
+declare var Protoss, Zerg, Hero, Terran, Upgrade, Unit, Neutral, mouseController, Burst, Bullets;
+declare var keyController;
+
var Game={
//Global variables
HBOUND:innerWidth,//$('body')[0].scrollWidth
@@ -23,13 +29,16 @@ var Game={
commands:{},
replay:{},
randomSeed:0,//For later use
- selectedUnit:{},
+ selectedUnit:null,
allSelected:[],
_oldAllSelected:[],
hackMode:false,
isApp:false,
offline:false,
CDN:'',
+ level: null,
+ replayFlag: null,
+ endTick: null,
addIntoAllSelected:function(chara,override){
if (chara instanceof Gobj){
//Add into allSelected if not included
@@ -863,7 +872,7 @@ var Game={
$('div.override div.multiSelection div:nth-child('+n+')').css('background-position',bgPosition);
}
},
- animation:function(){
+ animation:function() {
Game.animation.loop=function(){
//Process due commands for current frame before drawing
var commands=Game.commands[Game.mainTick];
@@ -994,7 +1003,7 @@ var Game={
}
};
if (Multiplayer.ON){
- Game._timer=setInterval(function(){
+ Game._timer= setInterval(function(){
if (Game.mainTick
Date: Thu, 5 Oct 2017 15:33:17 +0200
Subject: [PATCH 13/15] first step for working game
---
.gitignore | 1 +
.tmp/index.html | 8 +-
.tmp/index.js | 1618 ++++++++++++++++-
conf/webpack.conf.js | 10 +-
img/Bg/Deleted | 0
img/Charas/Deleted | 0
img/Demo/Demo.jpg | Bin 220295 -> 0 bytes
img/Demo/Demo.png | Bin 570231 -> 0 bytes
img/Maps/Deleted | 0
img/Menu/Deleted | 0
npm-debug.log | 54 -
src/Characters/{Map.js => Map.ts} | 11 +-
src/GameRule/Game.ts | 277 +--
.../{sourceLoader.js => sourceLoader.ts} | 4 +-
src/css/buttonStyle.css | 6 +-
src/css/mapStyle.css | 2 +-
src/css/style.css | 42 +-
src/index.html | 8 +-
src/index.ts | 7 +
tsconfig.json | 5 +-
20 files changed, 1796 insertions(+), 257 deletions(-)
delete mode 100644 img/Bg/Deleted
delete mode 100644 img/Charas/Deleted
delete mode 100644 img/Demo/Demo.jpg
delete mode 100644 img/Demo/Demo.png
delete mode 100644 img/Maps/Deleted
delete mode 100644 img/Menu/Deleted
delete mode 100644 npm-debug.log
rename src/Characters/{Map.js => Map.ts} (97%)
rename src/Utils/{sourceLoader.js => sourceLoader.ts} (97%)
diff --git a/.gitignore b/.gitignore
index 6ca7a94..15abe15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ node_modules/
dist/
bgm/
img/
+npm-debug.log
diff --git a/.tmp/index.html b/.tmp/index.html
index 73bd573..51268a5 100644
--- a/.tmp/index.html
+++ b/.tmp/index.html
@@ -107,7 +107,7 @@
-
+
@@ -122,11 +122,11 @@
-
+
-
+
@@ -135,7 +135,7 @@
diff --git a/.tmp/index.js b/.tmp/index.js
index 9891eb2..f753871 100644
--- a/.tmp/index.js
+++ b/.tmp/index.js
@@ -63,37 +63,1601 @@
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 0);
+/******/ return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
-/***/ (function(module, exports) {
-
-/*
-import 'core-js/client/shim';
-import 'zone.js/dist/zone';
-
-import '@angular/common';
-import 'rxjs';
-
-import './index.scss';
-
-import {enableProdMode} from '@angular/core';
-import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
-import {AppModule} from './app';
-*/
-/*
-declare var process: any;
-if (process.env.NODE_ENV === 'production') {
- enableProdMode();
-} else {
- Error['stackTraceLimit'] = Infinity; // tslint:disable-line:no-string-literal
- require('zone.js/dist/long-stack-trace-zone'); // tslint:disable-line:no-var-requires
-}
-
-platformBrowserDynamic().bootstrapModule(AppModule);
-*/
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+exports.__esModule = true;
+var sourceLoader_1 = __webpack_require__(1);
+exports.Game = {
+ //Global variables
+ HBOUND: innerWidth,
+ VBOUND: innerHeight,
+ infoBox: {
+ x: 145,
+ y: innerHeight - 110,
+ width: innerWidth - 295,
+ height: 110
+ },
+ team: 0,
+ playerNum: 2,
+ teams: {},
+ multiplayer: false,
+ cxt: $('#middleCanvas')[0].getContext('2d'),
+ frontCxt: $('#frontCanvas')[0].getContext('2d'),
+ backCxt: $('#backCanvas')[0].getContext('2d'),
+ fogCxt: $('#fogCanvas')[0].getContext('2d'),
+ _timer: -1,
+ _frameInterval: 100,
+ mainTick: 0,
+ serverTick: 0,
+ commands: {},
+ replay: {},
+ randomSeed: 0,
+ selectedUnit: {},
+ allSelected: [],
+ _oldAllSelected: [],
+ hackMode: false,
+ isApp: false,
+ offline: true,
+ CDN: '',
+ level: null,
+ replayFlag: null,
+ endTick: null,
+ addIntoAllSelected: function (chara, override) {
+ if (chara instanceof Gobj) {
+ //Add into allSelected if not included
+ if (exports.Game.allSelected.indexOf(chara) == -1) {
+ if (override)
+ exports.Game.allSelected = chara;
+ else
+ exports.Game.allSelected.push(chara);
+ chara.selected = true;
+ }
+ }
+ //Override directly
+ if (chara instanceof Array) {
+ if (override)
+ exports.Game.allSelected = chara;
+ else
+ chara.forEach(function (char) {
+ //Add into allSelected if not included
+ if (exports.Game.allSelected.indexOf(char) == -1)
+ exports.Game.allSelected.push(char);
+ });
+ chara.forEach(function (char) {
+ char.selected = true;
+ });
+ }
+ //Sort allSelected by its name order
+ exports.Game.allSelected.sort(function (chara1, chara2) {
+ //Need sort building icon together
+ var name1 = (chara1 instanceof Building) ? (chara1.inherited.name + '.' + chara1.name) : chara1.name;
+ var name2 = (chara2 instanceof Building) ? (chara2.inherited.name + '.' + chara2.name) : chara2.name;
+ return ([name1, name2].sort()[0] != name1) ? 1 : -1;
+ });
+ //Notify referee to redraw
+ Referee.alterSelectionMode();
+ },
+ //To replace setTimeout
+ commandTimeout: function (func, delay) {
+ var dueTick = exports.Game.mainTick + (delay / 100 >> 0);
+ if (!exports.Game.commands[dueTick])
+ exports.Game.commands[dueTick] = [];
+ exports.Game.commands[dueTick].push(func);
+ },
+ //To replace setInterval
+ commandInterval: function (func, interval) {
+ var funcAdjust = function () {
+ func();
+ exports.Game.commandTimeout(funcAdjust, interval);
+ };
+ exports.Game.commandTimeout(funcAdjust, interval);
+ },
+ race: {
+ selected: 'Terran',
+ choose: function (race) {
+ this.selected = race;
+ $('div#GamePlay').attr('race', race);
+ }
+ },
+ layerSwitchTo: function (layerName) {
+ $('div.GameLayer').hide();
+ $('#' + layerName).show(); //show('slow')
+ },
+ init: function () {
+ //Prevent full select
+ $('div.GameLayer').on("selectstart", function (event) {
+ event.preventDefault();
+ });
+ //Bind resize canvas handler
+ window.onresize = exports.Game.resizeWindow;
+ /*window.requestAnimationFrame=requestAnimationFrame || webkitRequestAnimationFrame
+ || mozRequestAnimationFrame || msRequestAnimationFrame || oRequestAnimationFrame;//Old browser compatible*/
+ //Online mode
+ if (!exports.Game.offline) {
+ exports.Game.CDN = prompt('Please input CDN location for images and audios:');
+ if (exports.Game.CDN) {
+ if (!exports.Game.CDN.startsWith('http://'))
+ exports.Game.CDN = 'http://' + exports.Game.CDN;
+ if (!exports.Game.CDN.endsWith('/'))
+ exports.Game.CDN += '/';
+ }
+ }
+ //Start loading
+ exports.Game.layerSwitchTo("GameLoading");
+ //Zerg
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Mutalisk.png", "Mutalisk");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Devourer.png", "Devourer");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Guardian.png", "Guardian");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Overlord.png", "Overlord");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Drone.png", "Drone");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Zergling.png", "Zergling");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Hydralisk.png", "Hydralisk");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Scourge.png", "Scourge");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Lurker.png", "Lurker");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Ultralisk.png", "Ultralisk");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Broodling.png", "Broodling");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/InfestedTerran.png", "InfestedTerran");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Queen.png", "Queen");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Defiler.png", "Defiler");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Larva.png", "Larva");
+ //Terran
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/BattleCruiser.png", "BattleCruiser");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Wraith.png", "Wraith");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/SCV.png", "SCV");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Civilian.png", "Civilian");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Marine.png", "Marine");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Firebat.png", "Firebat");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Ghost.png", "Ghost");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Vulture.png", "Vulture");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Tank.png", "Tank");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Goliath.png", "Goliath");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Medic.png", "Medic");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Dropship.png", "Dropship");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Vessel.png", "Vessel");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Valkyrie.png", "Valkyrie");
+ //Protoss
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Probe.png", "Probe");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Zealot.png", "Zealot");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Dragoon.png", "Dragoon");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Templar.png", "Templar");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/DarkTemplar.png", "DarkTemplar");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Reaver.png", "Reaver");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Archon.png", "Archon");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/DarkArchon.png", "DarkArchon");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Shuttle.png", "Shuttle");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Observer.png", "Observer");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Arbiter.png", "Arbiter");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Scout.png", "Scout");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Carrier.png", "Carrier");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Corsair.png", "Corsair");
+ //Neuture
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Ragnasaur.png", "Ragnasaur");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Rhynsdon.png", "Rhynsdon");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Ursadon.png", "Ursadon");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Bengalaas.png", "Bengalaas");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Scantid.png", "Scantid");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Kakaru.png", "Kakaru");
+ //Hero
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/HeroCruiser.png", "HeroCruiser");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Sarah.png", "Sarah");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Kerrigan.png", "Kerrigan");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/DevilHunter.png", "DevilHunter");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Tassadar.png", "Tassadar");
+ //Building
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/ZergBuilding.png", "ZergBuilding");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/TerranBuilding.png", "TerranBuilding");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/ProtossBuilding.png", "ProtossBuilding");
+ /*sourceLoader.load("audio","bgm/PointError.wav","PointError");*/
+ //Map
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(2)Switchback.jpg", "Map_Switchback");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(2)Volcanis.jpg", "Map_Volcanis");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(3)Trench wars.jpg", "Map_TrenchWars");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(4)Blood Bath.jpg", "Map_BloodBath");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(4)Orbital Relay.jpg", "Map_OrbitalRelay");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(4)TowerDefense.jpg", "Map_TowerDefense");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(6)Thin Ice.jpg", "Map_ThinIce");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(8)BigGameHunters.jpg", "Map_BigGameHunters");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(8)TheHunters.jpg", "Map_TheHunters");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/(8)Turbo.jpg", "Map_Turbo");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Maps/Map_Grass.jpg", "Map_Grass");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Mud.png", "Mud");
+ //Extra
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Burst.png", "Burst");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/BuildingBurst.png", "BuildingBurst");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Portrait.png", "Portrait");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Charas/Magic.png", "Magic");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Menu/ControlPanel.png", "ControlPanel");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Bg/GameStart.jpg", "GameStart");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Bg/GameWin.jpg", "GameWin");
+ sourceLoader_1.sourceLoader.load("img", exports.Game.CDN + "img/Bg/GameLose.jpg", "GameLose");
+ sourceLoader_1.sourceLoader.allOnLoad(function () {
+ $('#GameStart').prepend(sourceLoader_1.sourceLoader.sources['GameStart']);
+ $('#GameWin').prepend(sourceLoader_1.sourceLoader.sources['GameWin']);
+ $('#GameLose').prepend(sourceLoader_1.sourceLoader.sources['GameLose']);
+ $('#GamePlay>canvas').attr('width', exports.Game.HBOUND); //Canvas width adjust
+ $('#GamePlay>canvas').attr('height', exports.Game.VBOUND - exports.Game.infoBox.height + 5); //Canvas height adjust
+ for (var N = 1; N <= 9; N++) {
+ $('div.panel_Control').append("");
+ }
+ /*//Test image effect
+ AlloyImage(sourceLoader.sources['Wraith']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['Wraith']);
+ AlloyImage(sourceLoader.sources['BattleCruiser']).act("setHSI",100,0,0,false).replace(sourceLoader.sources['BattleCruiser']);*/
+ exports.Game.start();
+ });
+ },
+ start: function () {
+ //Game start
+ exports.Game.layerSwitchTo("GameStart");
+ //Init level selector
+ for (var level = 1; level <= Levels.length; level++) {
+ $('.levelSelectionBg').append("" +
+ "" +
+ (Levels[level - 1].label ? (Levels[level - 1].label) : ("Level " + level))
+ + "
");
+ }
+ //Wait for user select level and play game
+ $('input[name="levelSelect"]').click(function () {
+ //Prevent vibration
+ if (exports.Game.level != null)
+ return;
+ exports.Game.level = parseInt(this.value);
+ exports.Game.play();
+ });
+ },
+ play: function () {
+ //Load level to initial when no error occurs
+ if (!(Levels[exports.Game.level - 1].load())) {
+ //Need Game.playerNum before expansion
+ exports.Game.expandUnitProps();
+ Resource.init();
+ //Game background
+ exports.Game.layerSwitchTo("GamePlay");
+ exports.Game.resizeWindow();
+ //Collect login user info
+ if (exports.Game.hackMode)
+ Multiplayer.sendUserInfo();
+ //Bind controller
+ mouseController.toControlAll(); //Can control all units
+ keyController.start(); //Start monitor
+ exports.Game.pauseWhenHide(); //Hew H5 feature:Page Visibility
+ exports.Game.initIndexDB(); //Hew H5 feature:Indexed DB
+ exports.Game.animation();
+ }
+ },
+ getPropArray: function (prop) {
+ var result = [];
+ for (var N = 0; N < exports.Game.playerNum; N++) {
+ result.push(typeof (prop) == 'object' ? (_$.clone(prop)) : prop);
+ }
+ return result;
+ },
+ //Do we need this because we only support Zerg vs Terran vs Protoss?
+ expandUnitProps: function () {
+ //Post-operation for all unit types, prepare basic properties for different team numbers, init in level.js
+ _$.traverse([Zerg, Terran, Protoss, Neutral, Hero], function (unitType) {
+ ['HP', 'SP', 'MP', 'damage', 'armor', 'speed', 'attackRange', 'attackInterval', 'plasma', 'sight'].forEach(function (prop) {
+ //Prop array, first one for us, second for enemy
+ if (unitType.prototype[prop] != undefined) {
+ unitType.prototype[prop] = exports.Game.getPropArray(unitType.prototype[prop]);
+ }
+ });
+ if (unitType.prototype.isInvisible) {
+ for (var N = 0; N < exports.Game.playerNum; N++) {
+ unitType.prototype['isInvisible' + N] = unitType.prototype.isInvisible;
+ }
+ }
+ delete unitType.prototype.isInvisible; //No need anymore
+ if (unitType.prototype.attackMode) {
+ ['damage', 'attackRange', 'attackInterval'].forEach(function (prop) {
+ //Prop array, first one for us, second for enemy
+ unitType.prototype.attackMode.flying[prop] = exports.Game.getPropArray(unitType.prototype.attackMode.flying[prop]);
+ unitType.prototype.attackMode.ground[prop] = exports.Game.getPropArray(unitType.prototype.attackMode.ground[prop]);
+ });
+ }
+ unitType.upgrade = function (prop, value, team) {
+ switch (team) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ eval('unitType.prototype.' + prop)[team] = value;
+ break;
+ default:
+ unitType.prototype[prop] = value;
+ break;
+ }
+ };
+ });
+ Protoss.Carrier.prototype.interceptorCapacity = exports.Game.getPropArray(Protoss.Carrier.prototype.interceptorCapacity);
+ Protoss.Reaver.prototype.scarabCapacity = exports.Game.getPropArray(Protoss.Reaver.prototype.scarabCapacity);
+ Referee.underArbiterUnits = exports.Game.getPropArray([]);
+ Referee.detectedUnits = exports.Game.getPropArray([]);
+ for (var N = 0; N < exports.Game.playerNum; N++) {
+ //Initial detector buffer
+ var buffer = {};
+ buffer['isInvisible' + N] = false;
+ Gobj.detectorBuffer.push(buffer);
+ //Initial arbiter buffer
+ Protoss.Arbiter.prototype.bufferObj['isInvisible' + N] = true;
+ }
+ for (var grade in Upgrade) {
+ if (Upgrade[grade].level != null) {
+ Upgrade[grade].level = exports.Game.getPropArray(Upgrade[grade].level);
+ }
+ }
+ },
+ addSelectedIntoTeam: function (teamNum) {
+ //Build a new team
+ exports.Game.teams[teamNum] = _$.mixin([], exports.Game.allSelected);
+ },
+ callTeam: function (teamNum) {
+ var team = _$.mixin([], exports.Game.teams[teamNum]);
+ //When team already exist
+ if (team instanceof Array) {
+ exports.Game.unselectAll();
+ //GC
+ $.extend([], team).forEach(function (chara) {
+ if (chara.status == 'dead')
+ team.splice(team.indexOf(chara), 1);
+ });
+ exports.Game.addIntoAllSelected(team, true);
+ if (team[0] instanceof Gobj) {
+ exports.Game.changeSelectedTo(team[0]);
+ //Sound effect
+ team[0].sound.selected.play();
+ //Relocate map center
+ Map.relocateAt(team[0].posX(), team[0].posY());
+ }
+ }
+ },
+ unselectAll: function () {
+ //Unselect all
+ var units = Unit.allUnits.concat(Building.allBuildings);
+ units.forEach(function (chara) { chara.selected = false; });
+ exports.Game.addIntoAllSelected([], true);
+ },
+ multiSelectInRect: function () {
+ exports.Game.unselectAll();
+ //Multi select in rect
+ var startPoint = { x: Map.offsetX + Math.min(mouseController.startPoint.x, mouseController.endPoint.x),
+ y: Map.offsetY + Math.min(mouseController.startPoint.y, mouseController.endPoint.y) };
+ var endPoint = { x: Map.offsetX + Math.max(mouseController.startPoint.x, mouseController.endPoint.x),
+ y: Map.offsetY + Math.max(mouseController.startPoint.y, mouseController.endPoint.y) };
+ var inRectUnits = Unit.allOurUnits().filter(function (chara) {
+ return chara.insideRect({ start: (startPoint), end: (endPoint) });
+ });
+ if (inRectUnits.length > 0)
+ exports.Game.changeSelectedTo(inRectUnits[0]);
+ else
+ exports.Game.changeSelectedTo({});
+ exports.Game.addIntoAllSelected(inRectUnits, true);
+ },
+ getSelectedOne: function (clickX, clickY, isEnemyFilter, unitBuildingFilter, isFlyingFilter, customFilter) {
+ var distance = function (chara) {
+ return (clickX - chara.posX()) * (clickX - chara.posX()) + (clickY - chara.posY()) * (clickY - chara.posY()); //Math.pow2
+ };
+ //Initial
+ var selectedOne = {}, charas = [];
+ switch (unitBuildingFilter) {
+ case true:
+ charas = Unit.allUnits;
+ break;
+ case false:
+ charas = Building.allBuildings;
+ break;
+ default:
+ charas = Unit.allUnits.concat(Building.allBuildings);
+ }
+ switch (isEnemyFilter) {
+ case true:
+ case false:
+ charas = charas.filter(function (chara) {
+ return chara.isEnemy() == isEnemyFilter;
+ });
+ break;
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ charas = charas.filter(function (chara) {
+ return chara.team == isEnemyFilter;
+ });
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ charas = charas.filter(function (chara) {
+ return chara.team != isEnemyFilter;
+ });
+ }
+ if (isFlyingFilter != null) {
+ charas = charas.filter(function (chara) {
+ return chara.isFlying == isFlyingFilter;
+ });
+ }
+ //customFilter is filter function
+ if (customFilter != null) {
+ charas = charas.filter(customFilter);
+ }
+ //Find nearest one
+ selectedOne = charas.filter(function (chara) {
+ return chara.status != 'dead' && chara.includePoint(clickX, clickY);
+ }).sort(function (chara1, chara2) {
+ return distance(chara1) - distance(chara2);
+ })[0];
+ if (!selectedOne)
+ selectedOne = {};
+ return selectedOne;
+ },
+ getInRangeOnes: function (clickX, clickY, range, isEnemyFilter, unitBuildingFilter, isFlyingFilter, customFilter) {
+ //Initial
+ var selectedOnes = [], charas = [];
+ switch (unitBuildingFilter) {
+ case true:
+ charas = Unit.allUnits;
+ break;
+ case false:
+ charas = Building.allBuildings;
+ break;
+ default:
+ charas = Unit.allUnits.concat(Building.allBuildings);
+ }
+ switch (isEnemyFilter) {
+ case true:
+ case false:
+ charas = charas.filter(function (chara) {
+ return chara.isEnemy() == isEnemyFilter;
+ });
+ break;
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ charas = charas.filter(function (chara) {
+ return chara.team == isEnemyFilter;
+ });
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ charas = charas.filter(function (chara) {
+ return chara.team != isEnemyFilter;
+ });
+ }
+ if (isFlyingFilter != null) {
+ charas = charas.filter(function (chara) {
+ return chara.isFlying == isFlyingFilter;
+ });
+ }
+ //customFilter is filter function
+ if (customFilter != null) {
+ charas = charas.filter(customFilter);
+ }
+ //Find in range ones
+ selectedOnes = charas.filter(function (chara) {
+ return chara.status != 'dead' && chara.insideSquare({ centerX: clickX, centerY: clickY, radius: range });
+ });
+ return selectedOnes;
+ },
+ //For test use
+ getSelected: function () {
+ return Unit.allUnits.concat(Building.allBuildings).filter(function (chara) {
+ return chara.selected;
+ });
+ },
+ showInfoFor: function (chara) {
+ //Show selected living unit info
+ if (exports.Game.selectedUnit instanceof Gobj && exports.Game.selectedUnit.status != "dead") {
+ //Display info
+ $('div.panel_Info>div[class*="info"]').show();
+ //Draw selected unit portrait
+ if (chara.portrait)
+ $('div.infoLeft div[name="portrait"]')[0].className = chara.portrait; //Override portrait
+ else {
+ if (exports.Game.selectedUnit instanceof Unit)
+ $('div.infoLeft div[name="portrait"]')[0].className = exports.Game.selectedUnit.name;
+ if (exports.Game.selectedUnit instanceof Building)
+ $('div.infoLeft div[name="portrait"]')[0].className =
+ exports.Game.selectedUnit.attack ? exports.Game.selectedUnit.inherited.inherited.name : exports.Game.selectedUnit.inherited.name;
+ }
+ //Show selected unit HP,SP and MP
+ $('div.infoLeft span._Health')[0].style.color = exports.Game.selectedUnit.lifeStatus();
+ $('div.infoLeft span.life')[0].innerHTML = exports.Game.selectedUnit.life >> 0;
+ $('div.infoLeft span.HP')[0].innerHTML = exports.Game.selectedUnit.get('HP');
+ if (exports.Game.selectedUnit.SP) {
+ $('div.infoLeft span.shield')[0].innerHTML = exports.Game.selectedUnit.shield >> 0;
+ $('div.infoLeft span.SP')[0].innerHTML = exports.Game.selectedUnit.get('SP');
+ $('div.infoLeft span._Shield').show();
+ }
+ else {
+ $('div.infoLeft span._Shield').hide();
+ }
+ if (exports.Game.selectedUnit.MP) {
+ $('div.infoLeft span.magic')[0].innerHTML = exports.Game.selectedUnit.magic >> 0;
+ $('div.infoLeft span.MP')[0].innerHTML = exports.Game.selectedUnit.get('MP');
+ $('div.infoLeft span._Magic').show();
+ }
+ else {
+ $('div.infoLeft span._Magic').hide();
+ }
+ //Draw selected unit name,kill,damage,armor and shield
+ $('div.infoCenter h3.name')[0].innerHTML = exports.Game.selectedUnit.name;
+ if (exports.Game.selectedUnit.detector) {
+ $('div.infoCenter p.detector').show();
+ }
+ else {
+ $('div.infoCenter p.detector').hide();
+ }
+ if (exports.Game.selectedUnit.attack) {
+ $('div.infoCenter p.kill span')[0].innerHTML = exports.Game.selectedUnit.kill;
+ if (exports.Game.selectedUnit.attackMode) {
+ $('div.infoCenter p.damage span')[0].innerHTML = (exports.Game.selectedUnit.get('attackMode.ground.damage') + '/' + exports.Game.selectedUnit.get('attackMode.flying.damage'));
+ }
+ else {
+ $('div.infoCenter p.damage span')[0].innerHTML = (exports.Game.selectedUnit.get('damage') + (exports.Game.selectedUnit.suicide ? ' (1)' : ''));
+ }
+ //Show kill and damage
+ $('div.infoCenter p.kill').show();
+ $('div.infoCenter p.damage').show();
+ }
+ else {
+ //Hide kill and damage
+ $('div.infoCenter p.kill').hide();
+ $('div.infoCenter p.damage').hide();
+ }
+ $('div.infoCenter p.armor span')[0].innerHTML = exports.Game.selectedUnit.get('armor');
+ if (exports.Game.selectedUnit.get('plasma') != undefined) {
+ $('div.infoCenter p.plasma span')[0].innerHTML = exports.Game.selectedUnit.get('plasma');
+ $('div.infoCenter p.plasma').show();
+ }
+ else {
+ $('div.infoCenter p.plasma').hide();
+ }
+ //Can disable this filter for testing
+ if (exports.Game.selectedUnit.loadedUnits && exports.Game.selectedUnit.team == exports.Game.team) {
+ $('div.infoCenter p.passenger span')[0].innerHTML = exports.Game.selectedUnit.loadedUnits.length;
+ $('div.infoCenter p.passenger').show();
+ //Clear old icons
+ $('div.infoCenter p.icons')[0].innerHTML = '';
+ //Show passenger icons
+ exports.Game.selectedUnit.loadedUnits.forEach(function (passenger) {
+ $('div.infoCenter p.icons').append($('')
+ .attr('class', passenger.name).css('border-color', passenger.lifeStatus()));
+ });
+ $('div.infoCenter p.icons').show();
+ }
+ else {
+ $('div.infoCenter p.passenger').hide();
+ $('div.infoCenter p.icons').hide();
+ }
+ //Draw upgraded
+ var upgraded = exports.Game.selectedUnit.upgrade;
+ var team = exports.Game.selectedUnit.team;
+ if (upgraded) {
+ for (var N = 0; N < 3; N++) {
+ var upgradeIcon = $('div.upgraded div[name="icon"]')[N];
+ upgradeIcon.innerHTML = '';
+ upgradeIcon.style.display = 'none';
+ if (N < upgraded.length) {
+ upgradeIcon.className = upgradeIcon.title = upgraded[N];
+ upgradeIcon.innerHTML = Upgrade[upgraded[N]].level[team];
+ if (Upgrade[upgraded[N]].level[team]) {
+ upgradeIcon.setAttribute('disabled', 'false');
+ upgradeIcon.style.color = 'aqua';
+ }
+ else {
+ upgradeIcon.setAttribute('disabled', 'true');
+ upgradeIcon.style.color = 'red';
+ }
+ upgradeIcon.style.display = 'inline-block';
+ }
+ }
+ $('div.upgraded').show();
+ }
+ else {
+ //$('div.upgraded div[name="icon"]').html('').removeAttr('title').hide();
+ $('div.upgraded').hide();
+ }
+ }
+ else {
+ //Hide info
+ $('div.panel_Info>div').hide();
+ }
+ },
+ refreshInfo: function () {
+ exports.Game.showInfoFor(exports.Game.selectedUnit);
+ },
+ changeSelectedTo: function (chara) {
+ exports.Game.selectedUnit = chara;
+ Button.equipButtonsFor(chara);
+ if (chara instanceof Gobj) {
+ chara.selected = true;
+ }
+ exports.Game.showInfoFor(chara);
+ },
+ draw: function (chara) {
+ //Can draw units and no-rotate bullets
+ if (!(chara instanceof Gobj))
+ return; //Will only show Gobj
+ if (chara.status == "dead")
+ return; //Will not show dead
+ //Won't draw units outside screen
+ if (!chara.insideScreen())
+ return;
+ //Choose context
+ var cxt = ((chara instanceof Unit) || (chara instanceof Building)) ? exports.Game.cxt : exports.Game.frontCxt;
+ //Draw shadow
+ cxt.save();
+ //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ cxt.shadowOffsetX = (chara.isFlying) ? 5 : 3;
+ cxt.shadowOffsetY = (chara.isFlying) ? 20 : 8;
+ cxt.shadowColor = "rgba(0,0,0,0.4)";
+ //Close shadow for burrowed
+ if (chara.buffer.Burrow)
+ cxt.shadowOffsetX = cxt.shadowOffsetY = 0;
+ //Draw invisible
+ if (chara['isInvisible' + exports.Game.team] != null) {
+ cxt.globalAlpha = (chara.isEnemy() && chara['isInvisible' + exports.Game.team]) ? 0 : 0.5;
+ if (chara.burrowBuffer) {
+ if (chara.isEnemy()) {
+ if (!chara['isInvisible' + exports.Game.team])
+ cxt.globalAlpha = 1;
+ }
+ else
+ cxt.globalAlpha = 1;
+ }
+ }
+ //Draw unit or building
+ var imgSrc;
+ if (chara instanceof Building) {
+ if (chara.source)
+ imgSrc = sourceLoader_1.sourceLoader.sources[chara.source];
+ else {
+ imgSrc = sourceLoader_1.sourceLoader.sources[chara.attack ? chara.inherited.inherited.name : chara.inherited.name];
+ }
+ }
+ else
+ imgSrc = sourceLoader_1.sourceLoader.sources[chara.source ? chara.source : chara.name];
+ //Convert position
+ var charaX = (chara.x - Map.offsetX) >> 0;
+ var charaY = (chara.y - Map.offsetY) >> 0;
+ //Same image in different directions
+ if (chara.direction == undefined) {
+ var _left = chara.imgPos[chara.status].left;
+ var _top = chara.imgPos[chara.status].top;
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array) {
+ cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width, chara.height);
+ }
+ else {
+ cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width, chara.height);
+ }
+ }
+ else {
+ var _left = chara.imgPos[chara.status].left[chara.direction];
+ var _top = chara.imgPos[chara.status].top[chara.direction];
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array) {
+ cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width, chara.height);
+ }
+ else {
+ cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width, chara.height);
+ }
+ }
+ //Remove shadow
+ cxt.restore();
+ //Draw HP if has selected and is true
+ if (chara.selected == true) {
+ cxt = exports.Game.frontCxt;
+ //Draw selected circle
+ cxt.strokeStyle = (chara.isEnemy()) ? "red" : "green"; //Distinguish enemy
+ cxt.lineWidth = 2; //Cannot see 1px width circle clearly
+ cxt.beginPath();
+ cxt.arc(chara.posX() - Map.offsetX, chara.posY() - Map.offsetY, chara.radius(), 0, 2 * Math.PI);
+ cxt.stroke();
+ //Draw HP bar and SP bar and magic bar
+ cxt.globalAlpha = 1;
+ cxt.lineWidth = 1;
+ var offsetY = -6 - (chara.MP ? 5 : 0) - (chara.SP ? 5 : 0);
+ var lifeRatio = chara.life / chara.get('HP');
+ cxt.strokeStyle = "black";
+ if (chara.SP) {
+ //Draw HP and SP
+ cxt.fillStyle = "blue";
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width * chara.shield / chara.get('SP'), 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width, 5);
+ cxt.fillStyle = (lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"; //Distinguish life
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + 5, chara.width * lifeRatio, 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + 5, chara.width, 5);
+ }
+ else {
+ //Only draw HP
+ cxt.fillStyle = (lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red"; //Distinguish life
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width * lifeRatio, 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY, chara.width, 5);
+ }
+ if (chara.MP) {
+ //Draw MP
+ cxt.fillStyle = "darkviolet";
+ cxt.fillRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + (chara.SP ? 10 : 5), chara.width * chara.magic / chara.get('MP'), 5);
+ cxt.strokeRect(chara.x - Map.offsetX, chara.y - Map.offsetY + offsetY + (chara.SP ? 10 : 5), chara.width, 5);
+ }
+ }
+ },
+ drawEffect: function (chara) {
+ //Can draw units and no-rotate bullets
+ if (!(chara instanceof Burst))
+ return; //Will only show Burst
+ if (chara.status == "dead")
+ return; //Will not show dead
+ //Won't draw units outside screen
+ if (!chara.insideScreen())
+ return;
+ //Choose context
+ var cxt = exports.Game.frontCxt;
+ //Draw shadow
+ cxt.save();
+ //cxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ cxt.shadowOffsetX = (chara.isFlying) ? 5 : 3;
+ cxt.shadowOffsetY = (chara.isFlying) ? 20 : 8;
+ cxt.shadowColor = "rgba(0,0,0,0.4)";
+ var imgSrc = sourceLoader_1.sourceLoader.sources[chara.name];
+ //Convert position
+ var charaX = (chara.x - Map.offsetX) >> 0;
+ var charaY = (chara.y - Map.offsetY) >> 0;
+ var _left = chara.imgPos[chara.status].left;
+ var _top = chara.imgPos[chara.status].top;
+ //Will stretch effect if scale
+ var times = chara.scale ? chara.scale : 1;
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array) {
+ cxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, charaX, charaY, chara.width * times >> 0, chara.height * times >> 0);
+ }
+ else {
+ cxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, charaX, charaY, chara.width * times >> 0, chara.height * times >> 0);
+ }
+ //Remove shadow
+ cxt.restore();
+ },
+ drawBullet: function (chara) {
+ //Can draw bullets need rotate
+ if (!(chara instanceof Bullets))
+ return; //Will only show bullet
+ if (chara.status == "dead")
+ return; //Will not show dead
+ //Won't draw bullets outside screen
+ if (!chara.insideScreen())
+ return;
+ //Draw unit
+ var imgSrc = sourceLoader_1.sourceLoader.sources[chara.name];
+ var _left = chara.imgPos[chara.status].left;
+ var _top = chara.imgPos[chara.status].top;
+ //Convert position
+ var centerX = (chara.posX() - Map.offsetX) >> 0;
+ var centerY = (chara.posY() - Map.offsetY) >> 0;
+ //Rotate canvas
+ exports.Game.frontCxt.save();
+ //Rotate to draw bullet
+ exports.Game.frontCxt.translate(centerX, centerY);
+ exports.Game.frontCxt.rotate(-chara.angle);
+ //Draw shadow
+ //Game.frontCxt.shadowBlur=50;//Different blur level on Firefox and Chrome, bad performance
+ exports.Game.frontCxt.shadowOffsetX = (chara.owner.isFlying) ? 5 : 3;
+ exports.Game.frontCxt.shadowOffsetY = (chara.owner.isFlying) ? 20 : 5;
+ exports.Game.frontCxt.shadowColor = "rgba(0,0,0,0.4)";
+ //Game.frontCxt.shadowColor="rgba(255,0,0,1)";
+ //Multiple actions status
+ if (_left instanceof Array || _top instanceof Array) {
+ exports.Game.frontCxt.drawImage(imgSrc, _left[chara.action], _top[chara.action], chara.width, chara.height, -chara.width / 2 >> 0, -chara.height / 2 >> 0, chara.width, chara.height);
+ }
+ else {
+ exports.Game.frontCxt.drawImage(imgSrc, _left, _top, chara.width, chara.height, -chara.width / 2 >> 0, -chara.height / 2 >> 0, chara.width, chara.height);
+ }
+ //Rotate canvas back and remove shadow
+ exports.Game.frontCxt.restore();
+ //Below 2 separated steps might cause mess
+ //Game.frontCxt.translate(-centerX,-centerY);
+ //Game.frontCxt.rotate(chara.angle);
+ },
+ drawInfoBox: function () {
+ //Update selected unit active info which need refresh
+ if (exports.Game.selectedUnit instanceof Gobj && exports.Game.selectedUnit.status != "dead") {
+ //Update selected unit life,shield and magic
+ var lifeRatio = exports.Game.selectedUnit.life / exports.Game.selectedUnit.get('HP');
+ $('div.infoLeft span._Health')[0].style.color = ((lifeRatio > 0.7) ? "green" : (lifeRatio > 0.3) ? "yellow" : "red");
+ $('div.infoLeft span.life')[0].innerHTML = exports.Game.selectedUnit.life >> 0;
+ if (exports.Game.selectedUnit.SP) {
+ $('div.infoLeft span.shield')[0].innerHTML = exports.Game.selectedUnit.shield >> 0;
+ }
+ if (exports.Game.selectedUnit.MP) {
+ $('div.infoLeft span.magic')[0].innerHTML = exports.Game.selectedUnit.magic >> 0;
+ }
+ //Update selected unit kill
+ if (exports.Game.selectedUnit.kill != null) {
+ $('div.infoCenter p.kill span')[0].innerHTML = exports.Game.selectedUnit.kill;
+ }
+ }
+ },
+ drawSourceBox: function () {
+ //Update min, gas, curMan and totalMan
+ $('div.resource_Box span.mineNum')[0].innerHTML = Resource[exports.Game.team].mine;
+ $('div.resource_Box span.gasNum')[0].innerHTML = Resource[exports.Game.team].gas;
+ $('div.resource_Box span.manNum>span')[0].innerHTML = Resource[exports.Game.team].curMan;
+ $('div.resource_Box span.manNum>span')[1].innerHTML = Resource[exports.Game.team].totalMan;
+ //Check if man overflow
+ $('div.resource_Box span.manNum')[0].style.color = (Resource[exports.Game.team].curMan > Resource[exports.Game.team].totalMan) ? "red" : "#00ff00";
+ },
+ drawProcessingBox: function () {
+ //Show processing box if it's processing
+ var processing = exports.Game.selectedUnit.processing;
+ //Can disable this filter for testing
+ if (processing && exports.Game.selectedUnit.team == exports.Game.team) {
+ $('div.upgrading div[name="icon"]')[0].className = processing.name;
+ //var percent=((new Date().getTime()-processing.startTime)/(processing.time)+0.5)>>0;
+ var percent = ((exports.Game.mainTick - processing.startTime) * 100 / (processing.time) + 0.5) >> 0;
+ $('div.upgrading div[name="processing"] span')[0].innerHTML = percent;
+ $('div.upgrading div[name="processing"] div.processedBar')[0].style.width = percent + '%';
+ $('div.upgrading').attr('title', processing.name).show();
+ }
+ else {
+ //Select nothing, show replay progress
+ if (exports.Game.replayFlag && exports.Game.endTick > 0) {
+ $('div.upgrading div[name="icon"]')[0].className = 'Replay';
+ var percent = (exports.Game.mainTick * 100 / (exports.Game.endTick) + 0.5) >> 0;
+ $('div.upgrading div[name="processing"] span')[0].innerHTML = percent;
+ $('div.upgrading div[name="processing"] div.processedBar')[0].style.width = percent + '%';
+ $('div.upgrading').attr('title', 'Replay Progress').show();
+ if (!(exports.Game.selectedUnit instanceof Gobj)) {
+ $('div.infoRight').show();
+ $('div.upgraded').hide();
+ }
+ }
+ else
+ $('div.upgrading').removeAttr('title').hide();
+ }
+ },
+ refreshMultiSelectBox: function () {
+ var divs = $('div.override div.multiSelection div');
+ //Only refresh border color on current multiSelect box
+ for (var n = 0; n < divs.length; n++) {
+ divs[n].style.borderColor = exports.Game.allSelected[n].lifeStatus();
+ }
+ },
+ drawMultiSelectBox: function () {
+ //Clear old icons
+ $('div.override div.multiSelection')[0].innerHTML = '';
+ //Redraw all icons
+ exports.Game.allSelected.forEach(function (chara, N) {
+ var node = document.createElement('div');
+ node.setAttribute('name', 'portrait');
+ //Override portrait
+ if (chara.portrait)
+ node.className = chara.portrait;
+ else
+ node.className = (chara instanceof Building) ? (chara.attack ? chara.inherited.inherited.name : chara.inherited.name) : chara.name;
+ node.title = chara.name;
+ node.style.borderColor = chara.lifeStatus();
+ node.onclick = function () {
+ //Selection execute
+ exports.Game.unselectAll();
+ exports.Game.changeSelectedTo(chara);
+ //Single selection mode
+ $('div.override').hide();
+ $('div.override div.multiSelection').hide();
+ };
+ $('div.override div.multiSelection')[0].appendChild(node);
+ });
+ var iconNum = $('div.override div.multiSelection div').length;
+ //Adjust width if unit icon space overflow
+ $('div.override div.multiSelection').css('width', (iconNum > 12 ? Math.ceil(iconNum / 2) * 55 : 330) + 'px');
+ //Adjust background position after added into DOM, nth starts from 1st(no 0th)
+ for (var n = 1; n <= iconNum; n++) {
+ var bgPosition = $('div.override div.multiSelection div:nth-child(' + n + ')').css('background-position');
+ bgPosition = bgPosition.split(' ').map(function (pos) {
+ return parseInt(pos) * 0.75 + 'px';
+ }).join(' ');
+ $('div.override div.multiSelection div:nth-child(' + n + ')').css('background-position', bgPosition);
+ }
+ },
+ loop: function () {
+ //Process due commands for current frame before drawing
+ var commands = exports.Game.commands[exports.Game.mainTick];
+ if (commands instanceof Array) {
+ for (var N = 0; N < commands.length; N++) {
+ commands[N]();
+ }
+ delete exports.Game.commands[exports.Game.mainTick];
+ }
+ /************ Draw part *************/
+ //Clear all canvas
+ exports.Game.cxt.clearRect(0, 0, exports.Game.HBOUND, exports.Game.VBOUND);
+ exports.Game.frontCxt.clearRect(0, 0, exports.Game.HBOUND, exports.Game.VBOUND);
+ //DrawLayer0: Refresh map if needed
+ if (mouseController.mouseX < Map.triggerMargin)
+ Map.needRefresh = "LEFT";
+ if (mouseController.mouseX > (exports.Game.HBOUND - Map.triggerMargin))
+ Map.needRefresh = "RIGHT";
+ if (mouseController.mouseY < Map.triggerMargin)
+ Map.needRefresh = "TOP";
+ if (mouseController.mouseY > (exports.Game.VBOUND - Map.triggerMargin))
+ Map.needRefresh = "BOTTOM";
+ if (Map.needRefresh) {
+ Map.refresh(Map.needRefresh);
+ Map.needRefresh = false;
+ }
+ //DrawLayer1: Show all buildings
+ for (var N = 0; N < Building.allBuildings.length; N++) {
+ var build = Building.allBuildings[N];
+ //GC
+ if (build.status == "dead") {
+ Building.allBuildings.splice(N, 1);
+ N--; //Next unit come to this position
+ continue;
+ }
+ //Draw
+ exports.Game.draw(build);
+ }
+ //DrawLayer2: Show all existed units
+ for (var N = 0; N < Unit.allUnits.length; N++) {
+ var chara = Unit.allUnits[N];
+ //GC
+ if (chara.status == "dead") {
+ Unit.allUnits.splice(N, 1);
+ N--;
+ continue;
+ }
+ //Draw
+ exports.Game.draw(chara);
+ }
+ //DrawLayer3: Draw all bullets
+ for (var N = 0; N < Bullets.allBullets.length; N++) {
+ var bullet = Bullets.allBullets[N];
+ //GC
+ if (bullet.status == "dead" && bullet.used) {
+ Bullets.allBullets.splice(N, 1);
+ N--;
+ continue;
+ }
+ exports.Game.drawBullet(bullet);
+ }
+ //DrawLayer4: Draw effects above units
+ for (var N = 0; N < Burst.allEffects.length; N++) {
+ var effect = Burst.allEffects[N];
+ //GC
+ if (effect.status == "dead" || (effect.target && effect.target.status == "dead")) {
+ Burst.allEffects.splice(N, 1);
+ N--;
+ continue;
+ }
+ exports.Game.drawEffect(effect);
+ }
+ //DrawLayer5: Draw drag rect
+ if (mouseController.drag) {
+ exports.Game.cxt.lineWidth = 3;
+ exports.Game.cxt.strokeStyle = "green";
+ exports.Game.cxt.strokeRect(mouseController.startPoint.x, mouseController.startPoint.y, mouseController.endPoint.x - mouseController.startPoint.x, mouseController.endPoint.y - mouseController.startPoint.y);
+ }
+ //DrawLayerBottom: Draw info box and resource box
+ exports.Game.drawInfoBox();
+ exports.Game.drawSourceBox();
+ exports.Game.drawProcessingBox();
+ /************ Calculate for next frame *************/
+ //Clock ticking
+ exports.Game.mainTick++;
+ //For network mode
+ if (Multiplayer.ON) {
+ //Send current tick to server
+ Multiplayer.webSocket.send(JSON.stringify({
+ type: 'tick',
+ tick: exports.Game.mainTick,
+ cmds: (Multiplayer.cmds.length ? Multiplayer.cmds : null)
+ }));
+ }
+ else {
+ //Record user moves and execute if have
+ if (Multiplayer.cmds.length > 0) {
+ //MainTick++ just before this code piece
+ exports.Game.replay[exports.Game.mainTick] = $.extend([], Multiplayer.cmds);
+ //Execute command
+ Multiplayer.parseTickCmd({
+ tick: exports.Game.mainTick,
+ cmds: Multiplayer.cmds
+ });
+ }
+ }
+ //Clear commands
+ if (Multiplayer.cmds.length > 0) {
+ Multiplayer.cmds = [];
+ }
+ //Postpone play frames and AI after drawing (consume time)
+ Building.allBuildings.concat(Unit.allUnits).concat(Bullets.allBullets).concat(Burst.allEffects).forEach(function (chara) {
+ //Add this makes chara intelligent for attack
+ if (chara.AI)
+ chara.AI();
+ //Judge reach destination
+ if (chara instanceof Unit)
+ Referee.judgeReachDestination(chara);
+ //Join timers together
+ chara.playFrames();
+ });
+ //Will invite Mr.Referee to make some judgments
+ Referee.tasks.forEach(function (task) {
+ Referee[task]();
+ });
+ //Release selected unit when unit died or is invisible enemy
+ if (exports.Game.selectedUnit instanceof Gobj) {
+ if (exports.Game.selectedUnit.status == "dead" || (exports.Game.selectedUnit['isInvisible' + exports.Game.team] && exports.Game.selectedUnit.isEnemy())) {
+ exports.Game.selectedUnit.selected = false;
+ exports.Game.changeSelectedTo({});
+ }
+ }
+ },
+ animation: function () {
+ if (Multiplayer.ON) {
+ exports.Game._timer = setInterval(function () {
+ if (exports.Game.mainTick < exports.Game.serverTick)
+ exports.Game.loop();
+ }, exports.Game._frameInterval);
+ }
+ else
+ exports.Game.startAnimation();
+ },
+ stopAnimation: function () {
+ if (exports.Game._timer != -1)
+ clearInterval(exports.Game._timer);
+ exports.Game._timer = -1;
+ },
+ startAnimation: function () {
+ if (exports.Game._timer == -1)
+ exports.Game._timer = setInterval(exports.Game.loop, exports.Game._frameInterval);
+ },
+ stop: function (charas) {
+ charas.forEach(function (chara) {
+ chara.stop();
+ });
+ exports.Game.stopAnimation();
+ },
+ win: function () {
+ if (Multiplayer.ON) {
+ Multiplayer.webSocket.send(JSON.stringify({
+ type: 'getReplay'
+ }));
+ }
+ else {
+ exports.Game.saveReplay();
+ exports.Game.saveReplayIntoDB();
+ }
+ $('div#GamePlay').fadeOut(3000, function () {
+ exports.Game.stop(Unit.allUnits);
+ //Win poster
+ exports.Game.layerSwitchTo("GameWin");
+ new Audio(exports.Game.CDN + 'bgm/GameWin.wav').play();
+ });
+ //Self destruction to prevent duplicate fadeout
+ exports.Game.win = function () { };
+ },
+ lose: function () {
+ if (Multiplayer.ON) {
+ Multiplayer.webSocket.send(JSON.stringify({
+ type: 'getReplay'
+ }));
+ }
+ else {
+ exports.Game.saveReplay();
+ exports.Game.saveReplayIntoDB();
+ }
+ $('div#GamePlay').fadeOut(3000, function () {
+ exports.Game.stop(Unit.allUnits);
+ //Lose poster
+ exports.Game.layerSwitchTo("GameLose");
+ new Audio(exports.Game.CDN + 'bgm/GameLose.wav').play();
+ });
+ //Self destruction to prevent duplicate fadeout
+ exports.Game.lose = function () { };
+ },
+ saveReplay: function (replayData) {
+ if (!exports.Game.replayFlag) {
+ localStorage.setItem('lastReplay', JSON.stringify({
+ level: exports.Game.level,
+ team: exports.Game.team,
+ //Save Game.replay by default
+ cmds: (replayData != null) ? replayData : (exports.Game.replay),
+ end: exports.Game.mainTick
+ }));
+ }
+ },
+ showWarning: function (msg, interval) {
+ //Default interval
+ if (!interval)
+ interval = 3000;
+ //Show message for a period
+ $('div.warning_Box').html(msg).show();
+ //Hide message after a period
+ setTimeout(function () {
+ $('div.warning_Box').html('').hide();
+ }, interval);
+ },
+ showMessage: function () {
+ //Clossure timer
+ var _timer = 0;
+ return function (msg, interval) {
+ //Default interval
+ if (!interval)
+ interval = 3000;
+ //Show message for a period
+ $('div.message_Box').append('' + msg + '
').show();
+ //Can show multiple lines together
+ if (_timer)
+ clearTimeout(_timer);
+ //Hide message after a period
+ _timer = setTimeout(function () {
+ $('div.message_Box').html('').hide();
+ }, interval);
+ };
+ }(),
+ //Return from 0 to 0.99
+ getNextRandom: (function () {
+ //Clossure variable and function
+ var rands = [];
+ var getRands = function () {
+ //Use current tick as seed
+ var seed = exports.Game.mainTick + exports.Game.randomSeed;
+ var rands = [];
+ for (var N = 0; N < 100; N++) {
+ //Seed grows up in range 100
+ seed = (seed * 21 + 3) % 100;
+ rands.push(seed);
+ }
+ return rands;
+ };
+ return function () {
+ //If all rands used, generate new ones
+ if (rands.length == 0)
+ rands = getRands();
+ return rands.shift() / 100;
+ };
+ })(),
+ resizeWindow: function () {
+ //Update parameters
+ exports.Game.HBOUND = innerWidth; //$('body')[0].scrollWidth
+ exports.Game.VBOUND = innerHeight; //$('body')[0].scrollHeight
+ exports.Game.infoBox.width = exports.Game.HBOUND - 295;
+ exports.Game.infoBox.y = exports.Game.VBOUND - 110;
+ //Resize canvas
+ $('#GamePlay>canvas').attr('width', exports.Game.HBOUND); //Canvas width adjust
+ $('#GamePlay>canvas').attr('height', exports.Game.VBOUND - exports.Game.infoBox.height + 5); //Canvas height adjust
+ //Resize panel_Info
+ $('div.panel_Info')[0].style.width = ((exports.Game.HBOUND - 295) + 'px');
+ if (Map.ready) {
+ //Update map inside-stroke size
+ Map.insideStroke.width = (130 * exports.Game.HBOUND / Map.getCurrentMap().width) >> 0;
+ Map.insideStroke.height = (130 * exports.Game.VBOUND / Map.getCurrentMap().height) >> 0;
+ //Redraw background
+ Map.drawBg();
+ //Need re-calculate fog immediately
+ Map.drawFogAndMinimap();
+ }
+ },
+ getCurrentTs: function () {
+ var now = new Date();
+ var formatNum = function (num) {
+ if (num < 10)
+ return ('0' + num);
+ else
+ return num.toString();
+ };
+ var timestamp = now.getFullYear() + '-' + formatNum(now.getMonth() + 1) + '-' + formatNum(now.getDate()) + ' '
+ + formatNum(now.getHours()) + ':' + formatNum(now.getMinutes()) + ':' + formatNum(now.getSeconds());
+ return timestamp;
+ },
+ //New H5 features demo
+ pauseWhenHide: function () {
+ //Add pause when hide window
+ $(document).on('visibilitychange', function () {
+ if ($(document).attr('hidden') != null) {
+ if ($(document).attr('hidden')) {
+ Button.pauseHandler();
+ $('title').html('Paused...');
+ }
+ else {
+ Button.playHandler();
+ $('title').html('StarCraft');
+ }
+ }
+ });
+ },
+ initIndexDB: function () {
+ //(window as any).indexedDB=(indexedDB || webkitIndexedDB || mozIndexedDB || msIndexedDB);
+ var connect = indexedDB.open('StarCraftHTML5', 1);
+ connect.onupgradeneeded = function (evt) {
+ var db = evt.target.result;
+ var objStore = db.createObjectStore('Replays', { keyPath: 'id', autoIncrement: true });
+ objStore.createIndex('levelIndex', 'level', { unique: false });
+ objStore.createIndex('teamIndex', 'team', { unique: false });
+ objStore.createIndex('endIndex', 'end', { unique: false });
+ objStore.createIndex('msIndex', 'millisec', { unique: false });
+ objStore.createIndex('tsIndex', 'timestamp', { unique: false });
+ objStore.createIndex('offlineIndex', 'offline', { unique: false });
+ db.close();
+ };
+ },
+ saveReplayIntoDB: function () {
+ var connect = indexedDB.open('StarCraftHTML5', 1);
+ connect.onsuccess = function (evt) {
+ var db = evt.target.result;
+ var objStore = db.transaction(['Replays'], 'readwrite').objectStore('Replays');
+ objStore.add({
+ level: exports.Game.level,
+ team: exports.Game.team,
+ cmds: exports.Game.replay,
+ end: exports.Game.mainTick,
+ millisec: new Date().getTime(),
+ timestamp: exports.Game.getCurrentTs(),
+ offline: Boolean(exports.Game.offline).toString()
+ });
+ db.close();
+ };
+ }
+};
+
+
+/***/ }),
+/* 1 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+exports.__esModule = true;
+exports.sourceLoader = {
+ sources: {},
+ sourceNum: 0,
+ loadedNum: 0,
+ allLoaded: true,
+ load: function (type, src, id) {
+ exports.sourceLoader.sourceNum++;
+ exports.sourceLoader.allLoaded = false;
+ var source;
+ var loaded = function () {
+ exports.sourceLoader.loadedNum++;
+ if (exports.sourceLoader.loadedNum == exports.sourceLoader.sourceNum) {
+ exports.sourceLoader.allLoaded = true;
+ }
+ }; //Code copy
+ if (type == 'img') {
+ source = new Image();
+ source.src = src;
+ source.onload = loaded;
+ exports.sourceLoader.sources[id] = source;
+ }
+ if (type == 'audio') {
+ source = new Audio();
+ source.addEventListener('canplaythrough', loaded, false);
+ //source.oncanplaythrough=loaded;
+ source.src = src; //Pose after listener to prevent fired early
+ exports.sourceLoader.sources[id] = source;
+ }
+ //For my Dojo: src==pathName
+ if (type == 'js') {
+ var node = document.createElement('script');
+ node.onload = function () {
+ //Load builder
+ _$.modules[src] = _$.define.loadedBuilders.shift();
+ loaded();
+ };
+ node.src = src + '.js';
+ document.getElementsByTagName('head')[0].appendChild(node);
+ }
+ },
+ allOnLoad: function (callback) {
+ if (exports.sourceLoader.allLoaded) {
+ callback();
+ }
+ else {
+ //Show Load Process
+ $('div.LoadedBlock').css('width', (Math.round(100 * exports.sourceLoader.loadedNum / exports.sourceLoader.sourceNum) + "%"));
+ //Recursion
+ setTimeout(function () {
+ exports.sourceLoader.allOnLoad(callback);
+ }, 100);
+ }
+ }
+};
+
+
+/***/ }),
+/* 2 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+exports.__esModule = true;
+var Game_1 = __webpack_require__(0);
+var sourceLoader_1 = __webpack_require__(1);
+exports.Map = {
+ currentMap: 'Switchback',
+ ready: false,
+ offsetX: 0,
+ offsetY: 0,
+ speed: 40,
+ triggerMargin: 20,
+ //To synchronize drawing map and units, will not refresh immediately
+ needRefresh: null,
+ fogFlag: true,
+ fogUnits: [],
+ allUnits: [],
+ batchSize: 0,
+ miniCxt: $('canvas[name="mini_map"]')[0].getContext('2d'),
+ fogCanvas: document.createElement('canvas'),
+ shadowCanvas: document.createElement('canvas'),
+ insideStroke: {
+ width: 0,
+ height: 0
+ },
+ fogCxt: null,
+ shadowCxt: null,
+ //Init map
+ setCurrentMap: function (name) {
+ exports.Map.currentMap = name;
+ $('canvas[name="mini_map"]').attr('class', name);
+ //Init inside stroke size
+ exports.Map.insideStroke.width = (130 * Game_1.Game.HBOUND / exports.Map.getCurrentMap().width) >> 0;
+ exports.Map.insideStroke.height = (130 * Game_1.Game.VBOUND / exports.Map.getCurrentMap().height) >> 0;
+ //Init fog relative
+ exports.Map.fogCxt = exports.Map.fogCanvas.getContext('2d');
+ exports.Map.fogCanvas.width = 130;
+ exports.Map.fogCanvas.height = Math.round(130 * exports.Map.getCurrentMap().height / exports.Map.getCurrentMap().width);
+ exports.Map.fogCanvas.ratio = 130 / exports.Map.getCurrentMap().width;
+ exports.Map.shadowCanvas.width = exports.Map.shadowCanvas.height = 100;
+ exports.Map.shadowCxt = exports.Map.shadowCanvas.getContext('2d');
+ //Prepared fog shadow for quick render
+ var radial = exports.Map.shadowCxt.createRadialGradient(50, 50, 25, 50, 50, 50);
+ radial.addColorStop(0, 'rgba(0,0,0,1)');
+ radial.addColorStop(1, 'rgba(0,0,0,0)');
+ exports.Map.shadowCxt.fillStyle = radial;
+ exports.Map.shadowCxt.beginPath();
+ exports.Map.shadowCxt.arc(50, 50, 50, 0, Math.PI * 2);
+ exports.Map.shadowCxt.fill();
+ //Map is ready after current map set
+ exports.Map.ready = true;
+ },
+ getCurrentMap: function () {
+ return sourceLoader_1.sourceLoader.sources['Map_' + exports.Map.currentMap];
+ },
+ //Draw interface call
+ drawFogAndMinimap: function () {
+ if (exports.Map.fogFlag) {
+ exports.Map.refreshFog();
+ //Draw fog on main map
+ var ratio = exports.Map.fogCanvas.ratio;
+ Game_1.Game.fogCxt.clearRect(0, 0, Game_1.Game.HBOUND, Game_1.Game.VBOUND);
+ Game_1.Game.fogCxt.drawImage(exports.Map.fogCanvas, Math.round(exports.Map.offsetX * ratio), Math.round(exports.Map.offsetY * ratio), Math.round(Game_1.Game.HBOUND * ratio), Math.round(Game_1.Game.VBOUND * ratio), 0, 0, Game_1.Game.HBOUND, Game_1.Game.VBOUND);
+ }
+ //Draw mini-map
+ exports.Map.drawMiniMap();
+ },
+ //Used by drawFogAndMinimap
+ refreshFog: function () {
+ //Reset composite operation
+ exports.Map.fogCxt.globalCompositeOperation = 'source-over';
+ //Brush black fog to clean old fog
+ exports.Map.fogCxt.fillStyle = 'rgba(0,0,0,1)';
+ exports.Map.fogCxt.fillRect(0, 0, exports.Map.fogCanvas.width, exports.Map.fogCanvas.height);
+ //Other things have sight
+ var parasitedEnemies = Unit.allEnemyUnits().filter(function (chara) {
+ return chara.buffer.Parasite == Game_1.Game.team;
+ });
+ var scannerSweeps = Burst.allEffects.filter(function (anime) {
+ return anime.constructor.name == "ScannerSweep" && anime.team == Game_1.Game.team;
+ });
+ var addInObjs = parasitedEnemies.concat(scannerSweeps);
+ //Clear fog
+ exports.Map.fogCxt.globalCompositeOperation = 'destination-out';
+ //Initial
+ exports.Map.allUnits = Unit.allOurUnits().concat(Building.ourBuildings()).concat(addInObjs);
+ //Draw fog
+ exports.Map.fogCxt.fillStyle = 'rgba(0,0,0,1)';
+ var ratio = exports.Map.fogCanvas.ratio;
+ exports.Map.allUnits.forEach(function (chara) {
+ //Clear fog on screen for our units inside screen
+ var centerX = Math.round(chara.posX() * ratio);
+ var centerY = Math.round(chara.posY() * ratio);
+ var radius = Math.round(chara.get('sight') * ratio << 1);
+ exports.Map.fogCxt.drawImage(exports.Map.shadowCanvas, 0, 0, 100, 100, centerX - radius, centerY - radius, radius << 1, radius << 1);
+ });
+ },
+ //Used by drawFogAndMinimap: draw red&green block and white stroke
+ drawMiniMap: function () {
+ //Selected map size
+ var mapWidth = exports.Map.getCurrentMap().width;
+ var mapHeight = exports.Map.getCurrentMap().height;
+ //Clear mini-map
+ exports.Map.miniCxt.clearRect(0, 0, 130, 130);
+ //Re-draw mini-map points
+ var miniX, miniY, rectSize;
+ Building.allBuildings.concat(Unit.allUnits).forEach(function (chara) {
+ //Filter out invisible enemy
+ if (chara['isInvisible' + Game_1.Game.team] && chara.isEnemy())
+ return;
+ miniX = (130 * chara.x / mapWidth) >> 0;
+ miniY = (130 * chara.y / mapHeight) >> 0;
+ exports.Map.miniCxt.fillStyle = (chara.isEnemy()) ? 'red' : 'lime';
+ rectSize = (chara instanceof Building) ? 4 : 3;
+ exports.Map.miniCxt.fillRect(miniX, miniY, rectSize, rectSize);
+ });
+ //Draw fog on mini-map
+ if (exports.Map.fogFlag)
+ exports.Map.miniCxt.drawImage(exports.Map.fogCanvas, 0, 0, exports.Map.fogCanvas.width, exports.Map.fogCanvas.height, 0, 0, 130, 130);
+ //Re-draw inside stroke
+ exports.Map.miniCxt.strokeStyle = 'white';
+ exports.Map.miniCxt.lineWidth = 2;
+ exports.Map.miniCxt.strokeRect((130 * exports.Map.offsetX / mapWidth) >> 0, (130 * exports.Map.offsetY / mapHeight) >> 0, exports.Map.insideStroke.width, exports.Map.insideStroke.height);
+ },
+ drawMud: function () {
+ var _increments = [[0, 1], [-1, 0], [0, -1], [1, 0]];
+ var mudRadius = 120;
+ var mudIncrements = _$.mapTraverse(_increments, function (x) {
+ return x * mudRadius / 2;
+ });
+ Game_1.Game.backCxt.save();
+ Game_1.Game.backCxt.beginPath();
+ //Create fill style for mud
+ var mudPattern = Game_1.Game.backCxt.createPattern(sourceLoader_1.sourceLoader.sources['Mud'], "repeat");
+ Game_1.Game.backCxt.fillStyle = mudPattern;
+ Building.allBuildings.filter(function (chara) {
+ return (chara instanceof Building.ZergBuilding) && !chara.noMud && chara.insideScreen();
+ }).forEach(function (chara) {
+ var centerX = chara.posX() - exports.Map.offsetX;
+ var centerY = chara.posY() - exports.Map.offsetY;
+ var pos = [centerX + mudRadius, centerY - mudRadius];
+ Game_1.Game.backCxt.moveTo(pos[0], pos[1]);
+ for (var M = 0, angle = -Math.PI / 4; M < 4; M++, angle += Math.PI / 2) {
+ for (var N = 0; N < 5; N++) {
+ Game_1.Game.backCxt.arc(pos[0], pos[1], mudRadius / 4, angle, angle + Math.PI / 2);
+ if (N < 4) {
+ pos[0] += mudIncrements[M][0];
+ pos[1] += mudIncrements[M][1];
+ }
+ }
+ }
+ });
+ //Stroke edge clearly
+ Game_1.Game.backCxt.strokeStyle = "#212";
+ Game_1.Game.backCxt.lineWidth = 3;
+ Game_1.Game.backCxt.stroke();
+ //Fill mud
+ Game_1.Game.backCxt.fill();
+ Game_1.Game.backCxt.restore();
+ },
+ drawBg: function () {
+ //Clear background
+ Game_1.Game.backCxt.clearRect(0, 0, Game_1.Game.HBOUND, Game_1.Game.VBOUND);
+ //Draw map as background
+ Game_1.Game.backCxt.drawImage(exports.Map.getCurrentMap(), exports.Map.offsetX, exports.Map.offsetY, Game_1.Game.HBOUND, Game_1.Game.VBOUND - Game_1.Game.infoBox.height + 5, 0, 0, Game_1.Game.HBOUND, Game_1.Game.VBOUND - Game_1.Game.infoBox.height + 5);
+ //Draw mud for ZergBuildings
+ exports.Map.drawMud();
+ },
+ refresh: function (direction) {
+ var edgeX = exports.Map.getCurrentMap().width - Game_1.Game.HBOUND;
+ var edgeY = exports.Map.getCurrentMap().height - Game_1.Game.VBOUND + Game_1.Game.infoBox.height - 5;
+ var onlyMap;
+ switch (direction) {
+ case "LEFT":
+ exports.Map.offsetX -= exports.Map.speed;
+ if (exports.Map.offsetX < 0)
+ exports.Map.offsetX = 0;
+ break;
+ case "RIGHT":
+ exports.Map.offsetX += exports.Map.speed;
+ if (exports.Map.offsetX > edgeX)
+ exports.Map.offsetX = edgeX;
+ break;
+ case "TOP":
+ exports.Map.offsetY -= exports.Map.speed;
+ if (exports.Map.offsetY < 0)
+ exports.Map.offsetY = 0;
+ break;
+ case "BOTTOM":
+ exports.Map.offsetY += exports.Map.speed;
+ if (exports.Map.offsetY > edgeY)
+ exports.Map.offsetY = edgeY;
+ break;
+ case "MAP":
+ onlyMap = true;
+ break;
+ }
+ exports.Map.drawBg();
+ //Need re-calculate fog when screen moves
+ if (!onlyMap)
+ exports.Map.drawFogAndMinimap();
+ },
+ clickHandler: function (event) {
+ //Mouse at (clickX,clickY)
+ var clickX = event.pageX - $('canvas[name="mini_map"]').offset().left;
+ var clickY = event.pageY - $('canvas[name="mini_map"]').offset().top;
+ //Relocate map center
+ exports.Map.relocateAt(exports.Map.getCurrentMap().width * clickX / 130, exports.Map.getCurrentMap().height * clickY / 130);
+ },
+ dblClickHandler: function (event) {
+ //Mouse at (clickX,clickY)
+ var clickX = event.pageX - $('canvas[name="mini_map"]').offset().left;
+ var clickY = event.pageY - $('canvas[name="mini_map"]').offset().top;
+ //Map (clickX,clickY) to position (mapX,mapY) on map
+ var mapX = exports.Map.getCurrentMap().width * clickX / 130;
+ var mapY = exports.Map.getCurrentMap().height * clickY / 130;
+ //Move selected units to (mapX,mapY)
+ Unit.allUnits.filter(function (chara) {
+ return (chara.team == Game_1.Game.team) && chara.selected;
+ }).forEach(function (chara) {
+ if (chara.attack)
+ chara.stopAttack();
+ chara.targetLock = true;
+ chara.moveTo(mapX, mapY);
+ });
+ },
+ relocateAt: function (centerX, centerY) {
+ //Get map edge
+ var edgeX = exports.Map.getCurrentMap().width - Game_1.Game.HBOUND;
+ var edgeY = exports.Map.getCurrentMap().height - Game_1.Game.VBOUND + Game_1.Game.infoBox.height - 5;
+ //Map (centerX,centerY) to position (offsetX,offsetY) on top-left in map
+ var offsetX = (centerX - Game_1.Game.HBOUND / 2) >> 0;
+ if (offsetX < 0)
+ offsetX = 0;
+ if (offsetX > edgeX)
+ offsetX = edgeX;
+ var offsetY = (centerY - (Game_1.Game.VBOUND - Game_1.Game.infoBox.height + 5) / 2) >> 0;
+ if (offsetY < 0)
+ offsetY = 0;
+ if (offsetY > edgeY)
+ offsetY = edgeY;
+ //Relocate map
+ exports.Map.offsetX = offsetX;
+ exports.Map.offsetY = offsetY;
+ exports.Map.needRefresh = true; //For synchronize
+ }
+};
+
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+exports.__esModule = true;
+var Game_1 = __webpack_require__(0);
+var Map_1 = __webpack_require__(2);
+window.Map = Map_1.Map;
+window.Game = Game_1.Game;
+Game_1.Game.init();
/***/ })
diff --git a/conf/webpack.conf.js b/conf/webpack.conf.js
index 4e35c2a..aee61ec 100644
--- a/conf/webpack.conf.js
+++ b/conf/webpack.conf.js
@@ -67,7 +67,15 @@ module.exports = {
configuration: require('../tslint.json')
}
},
- debug: true
+ debug: true,
+ /*alias: {
+ 'img': path.resolve(__dirname, 'img'), // or wherever it is located relative to this file
+ 'bgm': path.resolve(__dirname, 'bmg')
+ },*/
+ /*build: {
+ assetsPublicPath: '/img',
+ assetsSubDirectory: 'img'
+ }*/
})
],
devtool: 'source-map',
diff --git a/img/Bg/Deleted b/img/Bg/Deleted
deleted file mode 100644
index e69de29..0000000
diff --git a/img/Charas/Deleted b/img/Charas/Deleted
deleted file mode 100644
index e69de29..0000000
diff --git a/img/Demo/Demo.jpg b/img/Demo/Demo.jpg
deleted file mode 100644
index 7136137876218d00daf728daa11d9055589f8b9b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 220295
zcmb6BXIPU>*ES4;fYPN)m)-&>B_LILFVX@eG-&}s5kisXi69-K^o~I25NZNaReB3O
zlpr9T&{Ud&<^1rvpX+_TKli(B@5+xg+pIPFteMGVGW#6I{JZq;XCgWS9eo`lVqzj9
z;+qfAzbizVL=?AgliwzzAiqOSNkKtL!$M0#O-;kj$VA6-pOcs8J|{Ofzp%6zzu*Hw
zZf<~*_yZZ>qeqW;#Z=Ul<
z799!QO~KvtEaRH`UmWg9+ik5)g(rh${Vg!9FHC$oWv;!#w$e-szD{245-kfEY|}WS
zraAZLwjCLyrrM4DDCoPYm#tJRXZc>kc?tqJ7>Cs7RsFnxbnynDlCDno&tneMQ09`a
znS}dJZD*neJH|Fkd_^4&81QCuPean&UchH}d}C
zCmE^DjNR9aeZPP_K%wFCz|co-Nc|tJVA(}U>0h#JhOohSe?<#;0wQit%H1XCN}}7V
z!GZ?r`UYngl0Px#U-l~#D0>A3h1YUscbl|+b_H@|I2FAqeLjJhc~Pw5WnBpsx$6DI
z?4pexd8s(P4avmTXb3-*y3ewt(C0Zmh)!LoUV2
z*830-;%5C?LwgTsQpN6Xu)nqaZKzy3-Giw|^s3P-Opy+^%jwU246Pp<#lR(vPg`@s
zVkLmVqj6*NVEfwL=ydHWgJ*l|t`*MD?apEMcw({@9y~=>>eQy;irc`W{P*MSlOOHF
zG|4bdi06Sro^@R+?)lOM@|wcBzIp*+a-In0=!(r{oq+*tfPM@z<^UXr<1I=P6{iqM
zv%Rg&5Aex@q0wjwBcr5r^(VU2%;^Gbb(z;w`qpptazN8@Gcug5WJ;1`YV?*#W@UBW
zSu+G7kg4Ral!#iaOX_EA0ppqYM)Y}-1pd1ZErdirV
zR=KEB>ts({fd>-ghE2`v&e}s2H-cM1`7R)>k7Uw
z3|Tl!1IW+%O-dbE_`taB83Sc{YV8{r&Y9+pL|1cN+Svv73SnXS`Vr}R<}WOileu{s
zYKtUxZ$P#BBfB3*5{1cQUe&4|DScm*XLRUgws|^J9d`j+5OiK+rvH#omSWaNlE$u}
z6}7*et5d^3$3us9hQ_|gf#usL@lkCNyqj50Z
zVuX7_mp=;Yumr=I}hoC1S!?o-pRP^sV2%UTwELRuvgpQbBc
zI8TwzXCab}mK}}3gPxoQd&qv0)A;h`ZYFS$vb`F}~(*Tesg@=ObQ>
zS$7*PGSbVcHyd&q@}oF!Zo&_@T*_pBT;N!jt6jX8LBF2{@sJR{@VwN3L#>-aGA72^fqo9h=RD
z#>nB`gLR%Z)i_Gr=iqv+rm%d>Alqg(O5wf3m+k)Bt-^Trf&!+!4&~U91bNoHy-=lV95~XcKzgDD>jp
zWjJQx>e<8d!Zj{_t5NSXl)=~{An>gU-mz(?RoMLVyqPYYI)ryZPwz>m7=Jm+lKu57
zR}i3&ynZ1uwcIMNE+vLPLW9VJ)YN920!5!h;8{#S`8)o@xhPSKe!4Efx&mtX1{t5V
zY}ZtQW>a)rziGINi>c&G0(mB_Gz!W#4Xuv1s-A?c7wDAPRH+7LSgq)moAZJ{lV(dU
zbA$GGTZELD+-3s_9)rDf(&H}KYwhx!koshRdF8NI^&&znn~*w%W@GAnBsf)x2yN0E
z*ZNtw2?|?+2bMu(4%lqNaX!Udho`fS!9`cSLLtth2wQv}Ba0rDRxPeT3MYxbJd-fZ
z`X)ZHa)wVz-4`Q`Z((gBlubG{efkMxrkWvB$6DP6Y}mSn+NEtd%x6q{OnWRwpb%wsG*_nLl1|)=0Hhb?yHcKjLfNWhI-jl>fz_@Oixh$k&YM~~j
z{Yg<%nR9Uemhe$W{hg`)W%Sbmd7|9R;SDX~lVcjZNXGS@3bJmRh4UuvT@>*G+R;8W$g>oP3%6VVr
zv4}a`Nq*s3>+@8Hg$0a1F4eb?BzTOoD00Dw~IqrqF4wx?Ku?G@Rc>8hL>3j&iS%|VVSj>UN2Ku
zApcYf5$I~1Pp(P*b)cVgT0=-BP26SqZ?hxs(KP#v;K=v2E$P+NE!q5cgqBheSb@F6
z_m+rGAS(SwG%8TSiqZKIh|ifSX=u4Xh7{gql$Ne-3{rXCbcD?@lq<66fcf+t0>Ai2
zYDfHR_StLOMxDO^w^ahy9Nq1G{T%1Mksk~U1&`#}vo@g8UhDHIG`WR~SVS~|T-)=P
ziYTR)5~s}qOQJ{OT;qZ>%_M3xR}|J%B34_ta;25%bL14RFN*tmgO8z%CVKIj?pnLX
zNOcBv8A@Q7L1M-0a0XoG^|(h7v$J*iCcbvs;9r2h6VXsQ`R2*|D+M|7Uivl(^P>E6C(6ODK<<3L8=|
zU%{ohksB7c(W}s-LL=F$(29Wt2Uxliva{$3gY!ub)m_+kQc{_b{GfrM;bEG^ew9)%
z1Cz&&PFl;j=+jMyva&?dNty4Sp!$pN&qWVaq+O5tP{TYAOH5;0<2gd=4-$I%z)Kb~UrWX!0=p>BtbC4{P*I}uRf_55jVO}P;7d8>EQ`Af9E_B?>l$=One
z!#f|PsL!aAd2(>hvUKpdIDe##)~iGV?9$1yeaI0>&0Az}nAWIL9r&zFQHHgFy;?nO
zVsohK(ZQ6lqw2A{t}(mI2&Py(=X3*!eAy}%8X2UJ@}$P2%`&i0&ggeYM?e=LGrC1g
z;7wnBxf6rH*B$u9kBqhr(EEl-wFX*cz?npLO@<$W(KLqUS_Fmkwc7o2p|gJGlZL|lgzitL
z-QMo_9As?h=XAU+I2cwCU!K3nQ(a9I8!A|5yEL~`UcbL4b~p8iStkjpZRK&UlPoT$Z^cQ&VnD<*Glt?!h}uBD^4M|tpk}Gf
zgiupsP;m4*FmJq_H^s3zd5VER$^%;HF(cVcNpwm&UXu~0n&dE3E2YN7Ycm*_O5tD$
z9YU60*71_6lr6v~35+rp&rqBQ01K$0DS5W(Dfud@cQt_Nti~adgFdZ74igmBiSNn6
zD@4wnG&kHb&v0Sa8JxHdQE;0ML%7*2d&xWpX{?O^6tvJd{$O7p-E;>bE|oKPRzLXD-=jq)+;+
zu4RTy1Ji
zW>#6^dkKn42}OkmW}NA8hmYU7*+l@%A7->YHX5`!n2uv1F}frI+s|m8fW%|K%37R2
zHCP(*BdHm3gy&U_5DuyuNe+{;u5!&}HC3REwn+{U-U2Q(25QnOAhPgVeW9O7v0E{<=VPp9XU_+W2_#DNM!E
z^1(nw?%_RNggGX$IvE5b|5&<&%Mq5$wkrMFD=K$q(1NE+EWl+g$nM*V`R3FlZH)_7
z6OrN=_=CU-hxzCIUJjEBlO|dT2WS2bwlg;I7OE+G)cNn6^Z*jp$Url-Uc9G%%UtG3
zm4MMdxgMbOnwwAipBk@67PIiApIDd@Q(i$)o;T(xFXNip;DLhk0(ct=C>%l))}5th=U?^y8j$76
zsTG9z@FvaJVj9Q$S&lY$-Evobsc7=PK8;tK(0e-jWTeZZ)U<@wvq&ao53~=HH5UJo
z>$K1#u6MG9mvHRkwL!CoD>oX7-7b^?Tb{UTeST>x3vZ-1bs)!l-%V4b#R^HvRTs2L
zXR|-+2L^&X3Fl`4r{+e1(~WjOw)|#AA%7_(_+5}?m};UjNZuB67s%597E73~b3`V&
zqSC7&PFnQ#`vA`HF7ezpFFpGwZG7d~;=(3Jq38Pt?^F~ig9EAe3nPvriVMpk6Y8pT
zr%&H_zIIHTavN-G>LVidtw8FqxR2Y6(gcpuxCq3xxZN)08o>md*osXfV6|=x3(}f)
zBQ&mKw8afmYR^Oo9bY%SltgA_G;IUgH!-?db(|#wIUs&ECCWTVo_=Z_y+|$tHa9M~
zFc{lT__gOE&k=~uN^gv*%IOhHVvp^^jZV&vC$?n0e8NK{fwy*cK?T2wGP+@A1Oo0A
z_E4{xbKQB+1Wzi5~BtjaMM2(h0Vcaq{o3RHp=g^AB8i
zCyp1$O%^zFJWYN#deGXe>D&|A!O{IE^Pu+2)VS{*i{dYego0$;Gu!2*uIEK;Q8&m`
zzKhu`r)g4@R;ZC3c1Yl%(@Ob#
ziu<7fPXd4axx9D$gR36l<*&26HXzr353FCtwh*Aw^SvSw_iT9u+4Oq?nmmBt`w7=-
zh)amW7!`RJdf&j_I&|F!;p$c^Jc!hYh$M%U+g@wO7rOtN0nT43ioAsVt@?k2GU~s&
z4X~8BUlg_wb~Z5!**+-Z2PkK!4$NZC!d0Pw-HoFyA2sru?o(!=@La7B_)m-cKyLLd
zh#g_{L>$(KoOI*{icy@{^ZW*rOznSgZ+bKY##o(gZ=7%_)et8;!1miyYOt#Ha{z2G
z8!>Tus^|b$YV!Azg(r+My*5?c@e%T=Z6zoD@OM<2#ta+U4U991T;BW_?f+`huXp@R
zH6KVc>G?%dWAiZ^D*-Ltt8s62zwP5_HM(8$t<#HT3L<>y
zqB?&9dFsP9)p;fdskI2)uv&1H8Nb;<^|jb&bb9dWy{owOGv#vsVYz2%{?AhVPD-d`
zjDg^}NV|Ro%bI!geq7k9`ODBD|1!3k@GSYzgpU0p70%c(E~__Y*4%SRtZpv?o*96e4i#yKvJ|z+9x%~$3E5Q)Exei*dx-uuVmxGtkxoJ<`!9Ch
z4GM5B??>Ux!KgF_y#*l;7iZyOro3#ilX@d`^oD-y_uWsqdGH;e$H1$dI|HjC;~r>y
za*+?p;}{lelX}O}4dxH`0o%*c4H%f^$t8WASmWXQ&6El9obfna6ht)+FDnl3dKk$8
z)R}Gw2iHEGQW@~ZSc;I%N3$`W1TjF|J171^sj-hw%s8vXfI4*_VCuT=`44u#Xc|Tx
zDU1|*g{5h_a}I0|YZQ7$1`3W@1xYx6u@H7VfF2fJ?kk4Z=quF$I8)~e#-%Qs0j~P%
z;^E5*!E#9yQ
zSTeJzb*O|UT6&Qqt#XvCL!|SeXI$}0^lvUJL&DiV>vU3*
zix8tS(+{uLgsayj%!?9ZIZ5oum%*W`pao_hx0Bl)Eu}B*r7^Czbxsuy4S?dZ#U7F%
z*2}!jVO7jIgifey`DLsAbdR%+LMubobUsiIur@GU|qd{%|$nJJujHHud_AjX^g!z>a@Zfi-HjK
ze4`qlUo}S$lqWUO+qv=|4bubCwyd~ib@gjM(~sVUdZ`tMSMIfYLJy$U0y4DvPMjJ26s)gawJa4LTr)YR
zaDvzs=u+Y7^Jzj)ERzzp4fvP%v-H+PfKLMWXxVshpy*oOgmWX!m_@V#ZSnaO5=U1N
zKf5=veF#rn8J%-KYZ|y#Is|X;Cvl`Lcn+5v${hk2vBuk|X!S2~AAVG%z&2AlIN^ml
zcl=GuLfbD7tM1T$Qv8=l-YCV|!cK)FYEYZ~kA*?|5}d=XC*
zm&4km6`9)i>r%jq5l3atI};6UE|u@t=fpQNl9R7h?0ii8)7c0!PMq@nkU
zbTt;@G$`HpH+l(Ewq>(5;@a+dR#8hFI;fD*8mGKz{#zBcyeQ6@8ESoEW~L>idv6c(
zQuE@S<{hzNK0)vWeS@Wro?x@yw_1@TDO%nyiVXd
z879~lXHWad;_UdlhWF$-RKk|t^|tU01T)NV0UFsDCSCUjzD=(r&`&b}Ehn2D75zIN
zJVs&KDw2hZ!&of3!g&rb1vaf0J*)xBC%;x%AqqaUCf%xYX#~->s7p{1{@(0ex=EKR
zn_}I2v*yC1b=SjLPFu`1B(`7ggtJ@kSrrp>IYG_0rT5H07L#hX$8OxEho!kg?Dg4#hn
zGT9(g8H>{Kz00Zj=MG-OCXopF$C&JSrFE50y^#w(h^N^cGtG?}pH?RwGGYB01W|3s
zv8;qH-y^_eJniI~!PJ}9cRK++%-*=%88a~++frl}hDAY35oas#!@a?%dd9_?ex%k@
zK5*E<;aKsfwMKVM1*j+d$DTPhQaSh3polB$TGe^&UiGg2%((MTi1u59xkk?-1`uC%
z(eu0l6IkCnqgM5OYug!mJq0m-HBONvK9M+NmINth2|$aC&dlbKQ_$7|Qe}VpNsaM;1ZOgk9Yi2G!@?8U<rb*jgVU<63j@&y%P0_Df!K5)tT9O?$qvS^mJpA;1_VS
zegAUP62zR!oEbVs7|LG%+{)r-X-Y*L$ak~
zb?_tdS7*G^>*Cb~xfd1us!HGvLbx;O*r)G)qZijZhD~2Vu($u@y`1|R*iiTlT2j4w
zaIR)X_k5TrLD@M8sGYd~Y^lf!@0eVHN_+T&mHhj=2HY(@6!Wrs(~q@zLVu7?h+%<6
z@SmW2gq9<-^{Haoe`>dRg_1dLez(f1K$AA5dwa{f!mVLez2jcMWC47Is56Sr9HZ@#
zL&5qTNCwL^tEJJ6E{SqUf2{^e5J;#dWk5aS1KdubU+P7#H5PX+;ceGok;J334T+x6
zW_7DteuwF2eW-l4?iKJuZ$k^y^rf3Evt>^hAG*tRw*%m1+i_+8={I*H-4*J($6msJ
zbt9~R%``XMFXNiaZ?DHazCio;;aKQl!tsyZNlAxBspk2!&_j6TW;=kr=MKlRqo_UQ
z8h4rjrEC~b>k0S5&8|{RmUv_L(e;muR;wt&Rw%pF9sW<&;!UZjY?fV=^R+Fgw|>{y
z{Mvhuu%#>c;v_gL2quopLjjW(^U@98tsrMUSMD4k{(u_&$P)0a3P(LUXjq(_8|QjIf(?h={4L8L{zNtrO?Fie?B=2czIGgG=^f0zo#wkz0r0is}cVum`1*)J2m
z#YUjoI5ECRhR%hRJz?~Tq3<|T_QOaBO}s+<60Ya@_zDg)Rk1CjWG^}m4^Ll_lxfdt
zo&2?95)4y4_Zt?*{j1*{txa=k-8|
z*SC*j_E+kFk-!L$(!oWAw^ysoE()x|s--udMPFMz1J1HkAHi{^K970w9KlXV2GhBD
zZP+N(@JQ_gz(}&YKGuT!wSDBZdZ3ux+S^`MwEbuzv^#TSpcYZL1*5%!+r5i`ss
z%Iv>}jXb^@{W{k>B2gInSNyKz)T6?K5LD{
zyY3!&IYKhuuu0Mo;>8m7p7rq4Ue#Dw{!Br{=0-S(?qJNOA`a8)Fu(wZ#<9rA68aVF
z@YA3kYJK)ME`zXFx1#wJ)x-_CQ`?u08
z;*Oawj?JwD_PS0wm7A{ZgGGzEP_#aoIdL)*65_>^Zc8}@t{4)O{&X%&%1xt-KI6ou
zgyFltmJnQ?_1O%mhLtxB^D3VU<*qJ|RfHQ)U9acOj`|kPam=^6lmiYuz&P%x8CL^!Tj+JRvjp5g4ayHoweB4
zVBp9Hlo)t2uK}g)@{(CYUe+=VNu<)#=(CS_;=!Zraf!ae|FY33VTZMaXP)z6CTkM;
zCZ8&xW9Pg=d9MK4DCwt5lW7h2oq0m{ENMGx(DvbTo+Md#QjHtAxX6>Hk?~k60ot_K
zq{%nJR?$5AiGZ8_#QFy}*NLN>5Gk>898|`Xs08(G28C%ut7EXwta_;Uu(OeRd7=e3
zf2EHheHqdX!#O-GoHPPF@_-&r=l0~`43|F+dOG9_-!X3>6i6fnV-qHQvsV#Coai~D
zgR6Dqhy8orb&uWa7qbw$SHGJ^YBSYGIAmR26Ebh#)kR0W(QQXVaENd%OLa?6UOENl
zZ7Ugg(-A>mY
zU>fMW*i>O#90S9f*ZHDJpS?-|>O?1r$?;D;4DpA#hJ&eXUN-QEC3?qbTT%r(U>|^j
z@~NG>VH9J5a#Dv6gO-B!D$mNt(FEicLLC|vpf{@6joaw`W4;c({o9BpQe-^h*E?7h
zjG@~YFVg)J!2ol%yMz3kE@^*pzpUt2ZpQh%iBDHZ=c
z$Nv)rq<9scFE(_;s)0vr?$9tJhm_TiNwwL(H8}@_6L*nHWr)I>m3x4!A?#F``fd
zbSF#WV{JeTCu}4%ar@`NR0LAIg_2kWOX~G_I)@ao_7YY$Me-Jy@Fg#uOgM{EtAkCp
z#!hY=icopZ<%TJ5niw^vo~9LyWAVqdmfGG~NFY~0sKM2-a58OTGo4{kDP{XOU29b;
z6l^an_-v)up3E+R;!yYgeWMY2eh5$WFrz3r*wkV=AXKok5PR`Os-x8)uu9haH}jfi
z02vWNbkdsZ2V(d5xFn0)OspCrFOwgL^hQQRw6`!q|+i
z^PH2GF?+U|f8O+&k&E=#hal1Mc;kD@TogD3<$~)X{#aju+t*HX1pW`pR+rV86&F)f
z(~GlW*$k~@i=|tf5&TEZhF^?#a8WGXr$g=$DzMMq!K6hX@7)})8e8cJxi<=j5AU$JmufiWL
z4HMn@-hEF$TS>~zLJ@TKGHsu;?d0C!qlT*Dq2iZ)jD35+u#-tZ7^XM{eE~nez!w|t
zJA@_uWd0GnC$nK{N^yG_;_0@&d)ixJkhY*j5k=HtGGAn}^YAYvcB_d0J7dPo;8fGf
z95+Xh{Fa(f$xXJ8(Q-<@(!;#C1rZ{p>YYw8Xy{c#-ikXrQzy0WYmTtDh=ajFPPXbW
z|7@?@?zN6nBAv8;U2_$As-@$hN~bw37b@aj8|TU|(n6(XFZT6PJvC)?72DKgnr?c)
zYAg`EmtlS^W=~WfMMUfsS=RZ*SxX&*m21xT*u#VW@^W`w_sl?(PpfiBhPQ5*wWzXN
z36wk{e-&+yrpd*jsHgPR<`TY`N#?u1)B?DG;kcMe<$g}z59LPF2~QC+*Z**tqd19q
zBA%O8mIT4i+B>cfeD|=BEz4F&Ra%MhO*4tsddv(ZqHDNqh;EItLd57HZfb3oRBmdE
zhO4jLU;OjHOb$LacT!?{zbC$~qD$2W9nsT8-hIu6IE*)m4-1GdbsN}W!Fr|^ROJ$x
ze;^|2xu=9e0cJ4PN<8#DM8tlkq>A}hsVlG0yCeH*rxo(`GO7a3Lhs{zmYB
zgsLV7RiP+hlx&0j;{Z$c3UUa~8ZQ5n`f+uC>eC~V*Iz^Sn%bLQAoGYOKM)at>%0uj
zaZmokX_~sfWbVd0MHxr^7wi9M+N5>yo~y7us!2)tgYUoQ6GH6cXS6Y=dlRSadocX#
z=|0J>?0w^upvmpoZ$?K`olr$^5933+eV5%*Mf48cp)FP?NOWqP5q)GCH{PuIbg2=T
z!ABD5&nvh0VHSn1g!9yxNMrLs8bUfY`B@v(`3wue0&p&B1&Q2GIfd!MRdy1O^4xr$
zgGHCQNDl9@6mFwsdBs|&^AJhitY5hJ;4OIh6qf!{g>(7kxaC0Fz4>4lpp2REub%3$
zLomVd%`rsYUsj^PYuYHJ`(;1+8^CEc4OevRErOC;K+1Sjgm*_uurGXZ6S#<|!#@ue
z>YS-msq@UN+{Hr|JI2f91J+j%Si6eZHt2g50yXU@+P2ZQu!w^jx%DEi4Z`hq{KvlF
z?d-=cd%qn){f1ZedopuVDNAglxCZpSc*E54xMa^-S?bZs#n~1K?`lTOx4_NxKD}^9
zigE^1U0L-HwgxxEqv|?J98M{`E#ATE*EL9`TCzU=%w<_iZH2{
z7uTvNP@|qS<=|+2JU6zw9$F==z3_1IY*DL_g<|!E*Xx4vbE&QEYrnoa<%x~{)=xw8
zOFr#-<%I9Qm7f7s6Fy>8!;B06sBFhU{qgnIhkoo+eJTx}ovOZ<7Bw9&lXE01Wz7}O
zWff|E9eTUI+v}*yK9!)|TDknU}L
z7w6W*s^(;O$mTb$l7(WpR-Ep07&`dgSR
z&tBX0^N=Q)y0*D|HuSDuIfd+3hU`O&yXHdAA6QWE=h4X>GBUKd+>=3tDF}PJg2e@4
zEH60?7dlM7pbP()nu4lAKbRVRL!3aGc9+qI*LzcM{Qb^Za^gR)buHbi3+s(72t5R
z6w&WEqhJ&`DBHPK|HEYE4)J3v&j`%4xk~?}V(kKgWa{^qfsQX`9Kw>g&lsUJ!?Mw9
zs)e1p&BxX|XO7!Hi<8ICJf{>)B3Zvtkv_!ksqHP=&1upfnoKXi$5!Ic5t
z0I&`e;+mg=)ej?(G=?E#5nsqU|M=zvh
znO^Ayf*y6;S36ZfydLu2nKbE=cH!0fpD8x~j@u%indt4r%X%
zD?7;h`(B44rb2w5?KDTSnE1X`oH}~#208Y+va*_XI{^een-M{sXtN$G9AqwYdWM4GStW5(5Ic8kyEw-iQGc;f(|aiC=IyTudJ~ZD3v9H6zaU{Fk1z7
z=F{Kq(ZMHorBTn_uX9%hNBsHuroa+AUjyO81`FBMoP~CYE@K{;a9896x)3Af(!zV
zWc!TISWuvS{k8);BgnyZM@Q)wuu!tloc?*23hjIALyPz^ylTN_=G
z!MX!~?`JLZ-Ak_0@MC%XvGFk2!lbuBt=-v0efFFZ=s=q*d}65sg}Y%C}=
zsI!^SwSNENeb%*6*mpogJN~0CNTTX(Ms*#=|6Jyt?Q9{FyW;@$Q^^tA55>P$SR64px#;&lyQlJ$sIVqdt_y;YT$
zNp9KaHmM$^(-lu_6d#v^IdbB8X*_#ggv*yF>R4iR^(!D!@1gwuCVRQ
zkX9U0cMfF+6B5IGEmWZm+lmd3mA=ePe@GQyLc)z$bm~7Oe0J_+c1?QRds6e`NiTgw?JF+hHMn2++d(n>%oJ`U-EDm`_UQ2Nh2kTI0>_$Jw=}E8kEutN
zT~G&3W76XJ*lc1!tvA)t37b6fRy2>WMPrZ}feD%4_G`&yy!W%CeG~q3M8mr{r@sxtsVK
zA4`veE5h?Z9|kd2;BO6D(Fyw6S~Q$*)GXBkD0LPU3tGTugPVc~K|w@AB%{JT6Hoqd
zccD0ErzERHy;*&Y8gWg*IMh=I5UhcLqmQuvFqcWtGl_d}b
z4;)NI8g$y3DLvwhrV@~h4NQtu@*OOKW(l}nf13*%XMZm`e_R|3pZ+@c>Yt|;s=Z3q
z08=CHU3^Dmz^ZNjDWOYAN6O4zWM;vjPvq9Ew2zzRv2-r?A+!W@tzN4K8oB5C?1NML
z6C=BGc~Ab)<(xKwJbDtwt#NeC4)D=}D~UmJ=Ejodm)hfzHrEsi+!<$+=e{qCpQv1Q
z&pmh(b_aN#v(?to-H1B->EQfcpAoC>MZRzQIs0i_NpP;XbPFy*y5IO%ZP~ebp=IK-
zoyiCz?A7oNXqVuYTb?Ng;WQWoxU-rAT0rWr4
zIM6w79`?DZ?CAk9v`)QQMj&j)DOEoe8)G_>Rgzj1F=34`7aUMk~!qE
zBlNnc9bi(hWN~40ZO1e_Uob9cx&OJh++NlDYuV1qt#^9|Nye-lk=G1w0-s+Bmi+!9
zUfVzO;Q}_)@?3^cG%aXh4TBR}?GGEpNhT5csniF1Bvt8Fz8}T=s+U!mOAsEli;18<
zjhBLtiflI3#pazY&62IeNS6=sw&;`^$Oi`ciilS*}R!0j)*TG1{jK*m#RM|GDfP
z%#~;IWE~v&C_Q4Nch@JC9Y%_f-I>hC8aNCd9V{eYo}vNrBE~L~4Z$GxfSZ>-9J+uf
z)@W<1I`Z?|W5hn8Z%ws*X?3(q4T?O&Rfiw<{<_+ld#$PTqId0fp!x9rReFno&4q1J
z-?N|CrHb&oR#GZdQ(+N|Et`Rj{UvMd8Xcaka(+t2Q1u6Qjizn(p04^|d0#01cy=BT
zNxfTtG(tF#{92?F$r)*{82Z!Hp3?rl>W{Z~L*8V*SKj7b4}Z@!_uIz8z5nZb`sEN?N`768tP
zSsd#znN(dXZU-Q%iqTz0D$4b%CkBzBT@B#ZP<`xtqfppWQ=lP!ZSQVQL|B&{w&qvmZT!)TINp(rqQMq(uixJxUAb+>aLQ;^S)gK*HDKfh}mgw_~BVrLZ=_Zh$
z*%)ZPX#(k-w;k>pU
zQ#FZgtmJZ|_VldCbdPoKp0S;(^&q(U^ncnpGfju?Pq|y3RjQy+Ug3KNhb4H0#Sp3y#A<|~Xau0mV~&2m2uIMr01f1jgo7^lCo@m<#Q
zc)ggzl_FazQT;_;AFk>Om>3(z+KxL8
zFxcddm_1phbV~9PV85=ext<;ZU%zqW*(rRx9)~QQ>9j?O=6+J#h1;}@f(;VcyPRL8
zt=}onJlpT#3boX8^$jAzOF&VUR
z6i=m2^umov@t+qJdBK;01?unI>RDMZt0%njcl@vV=a(qdco|r^OY`^NYLn=0E4RD!eZwpN_KNljZcfv+F7(!pOaiHfN4Rjhr>z>jzrQFdhM7
z`kad-R+JK5MOmFN&eGwAVpqeNqMzhFObrB1ojnHEH*=Gh>F5lGT|BzYsz|u9HLF%y
zR!IK5V|WkeKpU5OTF(bz_NOlAZKR>x?SU#8ge>^V)e5A3N4RHK2ACfkW~0JZo($~i
zhZ(7GzLPIchF7+k*xy6C{8Vo4mp*ige+;=_GU*3b46K{kwgU&8hn{IF$?jz{nfR%@
zgp2kh%qTvBTFW><=sP((537GEA~UoL*G^n28fUh!ev(6fBHsxlSH;-~C&cO3J)MzZ
zP*xFLwLeQTq%Pw0#ejVtI!n1z0ipG8^f?FKjI(=NH#;~tonD!juBha2RiL~wO!E(2
z7A4(&3w}D^K!=G)KrSWEe<__ZD@~e9R(5zii_K$Qx^~8f(qo4faiNa$MjrC*N(r?WaqcfhBF+=FF8%s3V#aH-tmNb
z|M2lmzN@q})}fl`{MZ&f$Gy4&DmOX^dn`Y9Mx~lH3VSW;zi|2;eqs~Py*OCK&0Qt;
z+oi65LiUUJvy6TX3>>55i%l<9&TIiD{
z_}pdXWAMOl2RShx8RWniu
z_Oq48>UFEJ+nt^#r#}wbrk124PW~m5{oWRF^H2rh^ePtf^YBGbj?Kl$FU*;0hVIB5
zvL2s$?eD1XKC&JoS?#U(uN$g|_v7ziaNkbnFYRC7QgCRl+tf7*k5CoU{*C^|tGYXN_pW9Qx4aHV
zv+H{mp}r3Dr#Uq~o_0W6>E1V0CMwFl$x6eG1<2w#xzyqpDVgcRregZ$kgd_}L)V3U
zGV#BhEpbIvo?Php)uDmnE)1r7&n!8FCG3l09bk0E6_54xa9+xX%`_Ltksyx2SI3qd!=tF&zqC^)WoznWJ2nnGbePY)u_*Fs9-B
zld{wztok7((HbDo?y=Hl`8A{|%q!~eG0y)ghy0ky^D|FLuKJ7VxJ-)q41N$!%i9w3
za#$zaG|9+M=u$kCPzM#v#Aju9{wVKcYJ7V?tD*qH!*oOU6A_VqmoZqh&vOO+JkvVT
z&E`Arcr`g-`%0V8GH|F}$j;~*SI?wre8mU!niqOPW%suTv7cE-*mu_JkmI*1cXdDz
zi|_|D4?7tgQqIuAP>HL2(1D*sT9s<8oNX;Xi})&~JbGM-%8}ozgz4sp<$sl+A4*LZ
zXPck8pnxqIWW8l~-_w~7*LbO+t3wuR8n3ZrLu-JcM}ARWnQPh`d|{=}HPgGlCkg+X
zK!POJdiI28=W4Pf@*K8yE3g>fg2H7&|MWXluiwZ@R`j;&o(wCi_j&3CU?XtccfP&S
z_W5;a{s*$Z4?X{H!c|N=1?*)Rn{(+I8Z>Y|?*LT-$jukyxbi|M*^Ds6QpCXQXZ5%Q
z@sS2rkN*wiCZFt0?(8c?X(oW{6Z%`zuWxPM4w$E0dLtgI<{XPutafoCfAjxRdf6jz
zGl99Knnn%H_saO0{M5}=0NQj!#3aOIWMrfiB&4^9Nl9*QH@HR5KtjjJE5-9r-Rvo!
zw7Gv8shY-1ewioEE&=JKUzwUeYFf-}2taBl_
z{a2yCWhLGG|F>!UmX++e1z`Ro-Rz_6=JI&xhOGJPm^66fk@Ej|Z2s57`TYrrO3YZhV(Ayw(t^96Mf83lO4}kc)
zwLxF#t?+kK>Y-B+*Z++R`eSSe{f+s*as5ZP6-zfeZUI>4hCniZtNow&Af{|K3;)*w
zya^fhKUoDno+{tPt#RuCa(^9;m3{x?cpUNnBkQdLqI{mmaX=6RDJeE@`B&0()`l!1jB$ZH<5{^ER6p$|I6cGHKuh;ui-`^km?6Whovoo`Mw>A5$
zr|Qh%kN?twEa))guj)jE_c(VC^$Wv4Ia2Dx#1JS6=?VEabkY`Za9!E45#V-VG;OR?YDu&=>ORCKcfG&*lh4W
zHvKPa|BHG4j}>vOROfyr^aRC~LT@Mp?~V81Yz%xRkF!*3))U;@r=I_1J@GzV6@2)o
z3jUe|ClAhQSxLAmU>pCkmg2VJ+t>UD&u5Tr>bg&KTR39Q_XhEQUxmW#m{SQa=X~{c
zZS?^9JzdE|SFc?HHzF@MZAR*Y+3=*!Z%Ad{OuT^Fs$InqV(8@RPUoU`aEikAqkiUQ63_&
z9vdob{IOaTD+{Yv0P!2w`FdI#JIb<0V|-prDXcF
zKLDP$m${Ob4>namqUof>3ggFdi#hUwYJN$|-UhF02cHIMtmuoW{N4k|?zn|KEK{Ar
zxFWLHk;*CFi~Z@tf8A&EK|HC`y*m_%oa)kz$f
z(AW#G4eCkHBWgV`2#28x^GXB5s7h3E;?qQ=QEfM17_&77)fp}_O&%^UCez7ODc3Gjrg$6Y_ny=c2*tgoGU)jtIhvSYr?7ATC?ye`dQ}0U(
z*g{2#CCT)?go)@?lXdkcioE%)+(IDy4MabNy$ZIz31qqt9y9T$JkMFK2+9w1acvt=
zG!3x4S5*6L=Vv`Yda0k*lWG3QsN!5TX`Is0j+r7co`rx2JRUrLd%Y=l6%Apez2c*v
z>h_kabSl?IxHpk#Ql+%?j*|vy+H~sQn`vP(x}RLAE5Oe2sH4!5)*y(|CsSORAIzUu
z0)h1wSIciW6@31X`GZWI-qV-7X0|et^p<=@kcXIZU_vo5Q0+p!@f3?bjxwe-{xQ*HK&uMvQw!?Xe)ev-?3Enw{w9XLcDo~d7
z!1^wNWa=sV4TKR3MM#)bY#KA90YsPxLET2fpx|N`-O{v{^Gx<{@&HdxW9kV_-L(&+
z2%b-Oe|HhfmqmURyFk*CJQgeo*%=ZQY%(pH{#xlD6!Swcxnoi4LzX(UOc*3Eo!76X
z63!u*tR-^@Cb2@AG`GZ%W}!>y(-6A`@rXA=IuaX51NS;_e3Lq?yC(&dL)$Xz!Bf+g
z@p*}b*L$plML>;vWp{k|0M~9gdI+89=3O|Fl3d0rXz8@fkJaz1-A-9UJCGcvAHg
zZAdbIaRM`b18U8O<{m9U;+^Oeb@lsm84TcIx5jQ4fgzgJ_R0p3Mmy0hCK#@gd_TZ+
zu+S1J3e=DSRX?hLs^2*|k1K`j^osDSv0_kTYrzIt?;@AKwV&xQq~mT<-^cc^+pVZi
zku$P2^sO`%iFcNoP3%L~>Q}3hjQmk3#%Wm2hj`E!jb8qE)658!nhaHkXq`dFsjMgG
z?e|U$PNZf?+CWNmaWV-^pw^K!T~0M_g1#u#gjFx`itA^3>-M^J*9Rl{ZM)eBL5sA4
zHt-W#(^oa*iwx@@ly_1%QPxp>dOFG@t9m`52y*gwY_il@jK$>WUw)FnD;;L#kfbjB
z4UxY0WL{9rX=YdTre79RuFOA51jlDoCIM?`eH2%>A}w7{>Op7O(0_Vb5JXj?u`G?)
z1Wx&=T&y>%ZqC9wZ=E~?t&v7+f+(QAKaw}k@3$*KlnTHmm#rnlK$1A+>V)y9{1ocp
zV@Ypc8p6i|Rx9UZ=1FNi%MF$pSikuJMC4`Xq?|<Ott2iza08N0MQbbM<(UYc;2R&93ts2s9HQ!VGNobBO~pP{KG!)-nY9e_(b#BmDAwCtoAC$mMO%fv=ZqAY#!c^=ex78vd2$ZJgZ;*S--pI(|
zMjq$UZ5X=JmX|VJeJ>?6YeI+DD@(qE;BuXkTSjw_+U1^EoFVJ$GQC>Cb@Y5!CfNE+
zLJa|9(C^`cmV4`;*UIO2^fRigx3~TT)c$~D+kL|MLC4dq*l^x9G5$;`1o*L}riA;2
zuncNGy$M|7Z#)c%>Y%rG^MNQ(H*#T&`%Cr}o=+;C2TF{PqiEq6EC8liDXFS3N-J^2Ut^@4bo(>Fx8=?<
zl3yBLuI3_{zKXoya$%(-sh1Y3I|c#7{@@8-%dEa?(mSg+NhRfi
z%2rFW(vw{XF&r6DHTYoVh8nFiIlJb8i;RMIW*wCvGi@@V)zT*^lCjHNjhE5gLX3Ur
zmF@|jT$=R?N;~=3BIiTPWOSMS*O!AjJ#1RDY@`i|Dfh~ChI-hi+#bjp?Jtq0-!5uV
z$9@ehNdqGm!668!+FTd5bG26f5~8lqmxJ{xkoTE5sb$d|44v5L?kka9ahS3I4>j!7;kAz46;DO1@
zX!N$I##t(uOL9Zz!;kY83#1
z29yJkz*Q7D%Urn%&^T-syk2f^bsNlxJGHDH`#xd!&Nz=Tn9d{%&`=Hn>vTk!fnDHP
zfbux769^0hMGad2>muVG3b{2_@msa<(|M8$&6PBgGoJUk04dG>i-*6qX+(lQv%~ch5kXmpShal
zJSTdR`e7NBidCl-~Jh+aiS
zdV#IYdP75Xo9~gMGmM_qH<*2nRptK&3rq+N704b1^#xX6(n`ECi8wQOL$VWfk3F&kzHdl1p
z(mc3y_ip#=6RZ`y##)o6L0+iP?f)kdFn&5`1tVs20E0kMe*Ir@{|dyuz3u?)l>c~;
zs=R{rj{W-h%=oUH+pwX1W*TQO>UH;%$GP~q+$kV0ipZh>oj`a&?dI!>E8gfEY^3;n
zwv;56nfKuF=%T?>Qf$*fQfqDw2m_A?bO0gA5Ab>&yc^q
zKza!6fNUm|Fy4Ks~wm1wOCoIdkG+pl4(+mgwpZ7Dt-TGvkx
zlFt!Mek=#>%V`U0+c&O}^v!L0fAIV*yz|#w4nz2Yg1A7tWBpv|Z-;3{1HS|MOzPV2
zQ6B%IZiv*|OvLkIEunDK6Z${Wpox=Eu~8ZD`jjN}_?Aq)eG0SL{ln(}L`Di8mSSPb
za~s)edEGY*&)jYs)aqY0u7AQt)w=FERJ%Gp<2oHV(l{z=b)gNCQms-Z?SjY(YP{oi
zH1e0dbw)Mu5DUGt!OtYobe+*|_36yIG~MqDkG_9+T7cT8KX|8>rg#G)RC9~XioMrA
z4QEK7$Q~H%?cpj7aV;k_0=Xm5B~#j#1<+nbKcd;|Ioqaqospy_eKW{D4~qV>K?q1m
zIa9tp5>8D@3cGW;XT>9L(~lvRNj|hZ1`WtQkCD_HnJMCCeX`ValUi>*eo%C++7!L0
z$pbkOdphQ;{KWsnFu*JVw+CU_z?DKMcmr=4J&F+~ds$H+%QZKbWcuD1QLb7MTzbY@
zx*0h(Pux|0LL4Z5RU$hvvq_8r1LFq8%mgoAWIiy}dh`fmsq7H{pus8a51vWd*VL3}
zUrA^WBy3!3*J4=;Ij+#5^Q^{R)5@J@cDAGG9+l4NG+T1c9rPEx5$8ps2RY;hZ?qJR
zF}1(@>t-c0Pj7x++V)E3SU3;0$akd#`AQnhdmE!KklQKKo_Mp}uLCvDK#AITIbMNA
zdk-YSvR^pea#1Nf`h#b5K|5OIe`5AZ)-VFw-OOXqs`GB&qj%U~DgXe=dTd|crr6p?
zxXdTzvR>ZtU|x2jfM)krv+F5XN=X#7LCQ`7UcDXSD@b#E(`?qta#`uxO0rk3lU{Zm
zxAAIwUaoeOYdf+1AtB%kE4Rq#!YMdX>`qDx?||0nH!
z0K;h@PEN^@n5?C%Kn$^pY;Em?O%c)|CizaDdAs^e<}VE3HM?U
zkEuB^J-6I^sT&hp&&Yy@>)*lHPvwRxmteKj6EjB{SCS?+(%4_BWxk+WpM|7;X(GB^
zVnT(af>pb{VnPATOKb_>#vvL;a)42e%_>Djx)*lkW}%^gQA42J8$|WV3Am_z6a6>{
z3ksq9ivInn4A3Thf==PROsU<>0YU01k^wB8mnt!M1k)7V{VM
z!tN`bX2x@Zw?{Ww#;cEYs*Wy+%r!2Fav4oG(VIX1DH12oO_n*XSnvf-CN}*O@QK$y
zyh+~;5PWftFjFbS`_BLgxM_
zM&kPZJ~8B~o?kCEE2!rv0}8PHT+sRfaoG}KIRXDQ4i{9*T20s3>yl?5?{*{lU`(
z13*9APDjr1P)3MN5VDQdmH@_}jx>Jf$kGMb{ew4v^;XWN&-5>lBH;oPsjL>ysoSv9
z(!uZgFcLn=_c03L2c1~iq{k8Pq4(u*1M(qb0VbXbOjf7f@kMe#hP@va!4jETbK2hakBB?b*F|r
z*CVnIVgTPEVSkl*^0Agx^S#Q|*M7E7B*V&W8e|Ui!f6y}c8&e#&xrSO7A8(Zkom`?a-;D0rRR?-
zIv-0iXRb3ttSd|z~VXD$&Eyn?@O;t5JlCAh`S
z2bGdEjz}Ml2y59VDKHj}dz~sKEs8ua3Ss@OoW}2(J^yyHeU1Q4;{fONSN78Xt<>q(
zT^mN$QZeHKFAwrJ31;6Zr@<%AO^Q!lqiG4#u!j?Fpz!%uA)%(E9QykKJsNtXGy?2yAUP9?x9x
zw+@qLPD%wMGvxSL8jYEsp%b36=WhhL(QdTGo0&P7{vGLi(s~@I;B6&=v?Ik^s1hA+
z-u=OIDoJXrUD1HPf*+p;N>QpmAftZf1gFpFBw+itTp5ih$wsnFq|HH5SH0eLJfLvi
zKX_S(6Q;-N&cu=&4f#8#`aXOT5&n0RkbZMk1n&q&KNv5nHIO({_wy-4E6X0MJ!<*P
z!f^5jFNB$oNPF$w)K@bxskyATldK=!@wsp_Eia5D&PWK(+OjO^Fy5ErI`{vuPNg1a
zV>BESKIWb|FY3qk1w$RuCe@^VWUaWgq@bD^;XiUI^hO8qV65_C^71%9uVPg^CF|=R
z`KiJ4QjMn^UdwmhQjR;P`It7svkqwqDo8yYBsfrS7ttTu(s;}Pqjf{4X7A`zlI~c@
zxRXCJaTRJRm-{M1N7R}O80Gz8ahr6?J%?mHNOXT!XUdaz>rVC;fhervdTCcMueu7p
zyg;-yweM|D{yRVfP^1tN%4eu(w6oDm)~taYaiWl?nf_{&(;s%jZU`{HJN|mTWi>YU
zXR{HD>HJI*Sdqd8oEK(VIIjjDjdg1tcNvCw`r=h;xekX(k}f3RzJ|)4tU*`ep;!)j
zkKPYckfHr)+aDP1NBXHe^xf{0=-b-sGR{<3e1_J~kA-mykFMj40O32sPuarWoR9pv
zyF{HeM0Y<&(X<==>h2hUpII8!lnwzkl$hHF?&*xLCRR`hd_xwUmyEnyD<@R!W6AaA
z6Wa*T?OxMG#nw=@fTIrN5wZJpG9#Ds(uB624jBd
zVy>;0Wb_`GbE#ruU`2t>hBRK|8h<$|yAqNj!7Q?#R8Z!EKGp;s7NTCJof-x{)jLwl
z$l^FeC2L1EtxK^0^gZM&KS+c04lNwF;GB}v5id69Kl7)}98_w2NDYH?O|V?@1HD0+
zjK)@u#)CkYr)*u?MkT7Qjr0!#Ow-T8ciF3+J#Ycb9#21h`c5oU(~WzRh}6ozT=q9O
z_jE3;pM7}F#0R-RQFldDWDYk>}A;1l}{sJWcpDIZ(t)MZ~Hs$DmDF*
zN}#dIJncqBm5jawEKVggKD~odF<#v6uarCiY?Ou
z%+6LOfD0@P5R}{tis=i5%gS;w2iSSlV7_bTE2&MCYEe?JQW0#e|KS9gI*SX?DL);_
zSiptI@1LLnga~`Ckg8W2tGtx%o6gGUWuQUO^noX2@aLC{50stSp{bk=no}XVC+#j{W%J614v6fqfkQ#9&PdKM!OTv)O-U6g%4(P$=6nbp
zenES#T&YU)yyWmsg{5gsl{{~n5nRhGW$)#l=1d=fse7c^C##>0b0Zj8KqZj0W59Kd
z6mz7PIjHd}BmM!;LU^(GaQGO;$4DXD+B{pUsiZF8ifDE<7P4L4%H@#DA^FPOX{|jd
z2tHV}msm3Y*^JMv&EKM?P$BI-ROhk7=UM~e9-FSU1yfX|kkZ@xZn7nmRkOJf9(Y{rSh5wG-+L><~^7twg*5F!n7l$Aw8$@u9$Q7F0fjOID5tRr*>P^fk6)%k8vw{@`O3kWk3n
z_01NkS#sw2tA~E-0x)rZel?Ie5d~O*qwYng^Fws0cvn)sU=|HZ!vgNT6eh1Zu
zN_<9PD#i+?2RT`;yJG$L(v9%ChD#a+aCtlvAn^#_@=B5oI-gUJ`Te%|M|jAkIJue2
zd;b9AJH=@v{hp1afIBsb9YIJvC|j*!E&btkBP40eCKjZv-xyGf$gcdJ$nQq;5mi?$46vq-O-Kl8
zVmn9Fz2}*)p}CT3Rkr+tN03(vCUNB48WdbXnUZ>D74A*_v`)zC6Yi9!80D>m#;RUe
zT2C)`a1;7Y!x-@E4BIqJNfoa^OQc4-wDZzZHLrB)8*%{C+0&~CW`RlN88BdEihN*d
z*03w7agM$A=*&9$eSijmv%4`y`=C@o(y~V6xP4@0L^WqzGI#6ayUQtog_pxF*_x7I
z(V%nVFrWsfY3q?G&Z|0i!GLa~m%PzuY99Is&E#{wcdr=`!~D*cpqjZEte8uXxUeUX
z{{+yR!6kv~y}5vfP--WAWhx4L;RAwr^Sy9WixSumZ2T*8Ks}bN2K;_Y?pp2?XTolo7GWz03IV+
zAc8)}AkgaVHY<~`4bR^x4ZCQR--qQ*D-=)@$cTu(*mZ5jwVXC72S?|`5GX7+o{Ptp
zOh)HR03UxA%E~QJnGZkyyBcCbBS_uTATKnBBrU+Mg
z)dpg>g2;|c^28^CicV@P3Q4jVHkA#Zr`AOVu+XYXgZvlcGhRH&HEwa4B=i%QJ+;cz
zd^*s$vswW67~M;$D}6@m-riF0EO
z|7r7y>BwMH>}O-)uZoAVadFl(jArN&z^M9tDn}|+8pU$)w}j7l+TOw*l4>s(rB^k=
zz32`FbrpJi3?OcvDGeO-{IEN%oA4h2Hv?%He>=gZ?RFcgx!G&ixe)#tQVut7W?~+G
z!`e7!G!fbQQHg?RlqR+-(6vOIukyrdwE#UPk7ndt_GGIvCE1Kxea%V4?5Nq!pjs^)
zR983V)vmt)A;E^fajV$FjeR>9LfqGzK?7nmb-k&TAM%(~vEP$Pok}r!tBHW+m#O!D
zW%^%d*l@_KDPRK!0}OT}UyG3{F4K$z#SZfNt=0{25`zifJ^vDDyR+|Bd|idB-{A%LMqA#(xe_edsxFN5>P
z6{vj)g{dXUF)jScPOQAYwmY1N1H&{l&-C|V_VxxP=JhsTO;fkNdvHNyV(>}?`f`-V
z&^q&eAxQ|DwD|W0fO42^@iBKGeoBDSB9TGNp4N<7n!BvbH4FQuJJ)wWb>wQYOMr@;
z5Fdy0o=$Y}%~;($#=bqhOYlxV2~|kNInfA}Z<}erTn34?;}(f)QAY;;JzKG-F<5B#
z^sNEYT>zuBq{tQ8=KMLReeV(#Bz1`{Sav}pf8}nYm83$e3~LL(YRS*(lz$RwEvo?3
zT?i{2g8^+Rl3YW8#VuX7)65jXi|7leyMF1uDwwnbQNauNqTj(Azc*r~C^SKnb(OJb7b*1sK}yW+
zFJ+;~E8Moq(sn8G6m$`aJUZ2U^}B}B%>edLI>FD1K&~77I7>ZPbJ%Iw3oYxzhL(e|
z*`gI{N4Pc7PJD`BA;U7~#uc`z@d>A895Mx@q$8ICX0t`E4Nim`zd(>$_OT-r4l5^TA%d
zeQY0uakWnNBO;`l`sOEf{eTZsc-kXte+}FU{x
z;>XBl9UGy@5M6^eU7a^t8Y9HlF+$rkfAGl2E;#HXxY-9zvR?j9g=P9&cL@(w(VT=5
z{xll%#aBFS3*2e{Bw_n`1$|TdcvpT_a9@XhGCaS2r{nTV!|G{@(^BY{h61+woeNoq
znIm8NNwt^Q_YDdxNsV{LN_J__UDiKU6-ICiyY~?bg+2aIztgJdFcWN>)SR}6%ZwRh
z8_md;eDlNNEWEG^|6^Z?JGNXU!orL{2r_B!V0q-*hbtt>3G%zFj$O|nioDh8tS3j8sGbR<^z*thxF|C_u1t2CqM+K4_Qxz>?9N9s*UQ2c`R0|yl{_t
zf}UfGM5+Lbm*{FCl?l*-&buRvQgkn?8NWr8+20g6S*ITJETmdx;-80EJu%nFlM7w?oNppZ(E(5a3)^(gGbs=Iuun#yKd^i
zrJ6S%f!k)`pvMy%WryWuludF8~`m1NuE|0bq{g6k~GizaH5M057I>??E#yyqv
z5*c^*IAX7~VuRj1W6vgd=Ads{7yCRuIzFS$)iuEh^n-X0?e+2;EZup9&Re{m&_8&w
z9ed!8xUWQa60(N4ORPb=%_RSc=PsIQ#!gfA9kmc~>s590E$gg8ryq}Z+OHQELx~{E
zzas@^qsI7(%9{w;4u?4HQ^)qjs4xiM39I$V)i7kI0}-*XudPrVqoBcs#VaKzR*CPP
zsM)O5NtIt7=X{RP5niIOR5B?^N$OF@xmLCXpAs(E%_PkeZy96tqpsX*Y?MAGw0(q
zBhge%n^a7C%URnjyop5TAJZ
zE+hA`$a~A#rSEL)KLL|N^35)lJhBC0{cwW!BJ3azv2lvVFGjb=(!bqY=TsldDG^3f7rbg2qJmY
zawx#UrkD@3#O&drcPe;GD24K%VCUqw?xp7x1ou(nC`#wuJ6z~6SHPE1dSZ~pm*yvt
zbMLCJHihvnwFdPjDE{Di-)t>L{V0qJ;%!q${mE1pNeH6=`XDO03hI{*X=3PMZhND-s
zB-}G!!YSEno~V%pl&uyNUvT2TFFU^@zFlK=e|a)UfIo;h*9c`y^yGXXOWtEb-e!z7
zbJH_FJL>Lu^E@dk6=cQ9vZj{Jc(=-tz`a*48ZpVqk}qt7^sSiM2YATJ+JEXYy#-$o
zS9s%o7=%GjGxQLL3Q7Oc>5ho0{-4N!=$X`VOa
z)-EGxHpcBYwh>}0wKcGZmB+u#1YZ%_ZYt(@CVYsCDxA=SBagvs(9&U02s%a5cpa@U
zmd>j)#DcL*(zfi`AR%VuVJp|!4b)oAgSf61l$cQ>Mzx2{tdBM|TokY$AVsxn1zotB
zjeYlCwbM_0klT${UJjJsC)w;++!akHpN19<{&qK^MeTfYd(597yzokC(P|P(24!>G(|dQ
z`~Fj08%9x62wd)2o;p452*T_766hNsi(X){kwa{>;08e095Cyol-mQ4B7&7){z|jW
z@;rkQm+5Apd)sE%%4O%rQ9)IB^v=p`FnYP>#r4Bab?wN$Ovh|R_9
z1_b~bP50kdPH(KOb3q{
zX8p$dM#9PUdP2PF4_;fyZq^AK!`tG6kI#u=KQ|R9?NpXR|KRogO-KFwgZH58^k4ie
z|5*e%qH^Z9sPWDXGtjW{mj`Xw<5;Ze-xS;EQYa23m7rMEb@~@Yr}Qu6zlm*;b&tsr
zU3CYaChRSO?Y8T7WFJo$+b@Ow3z`nLMV`Gd1X=k02VmhFf$pwb#d&J5jbgSHi!!dk
ze_5tDE3lQ~WKby_30A~0vaPHBhY#i_X?Mo88Qm+s%W6RiLyJH*2DFfZs6`-4(Z5Cg
zrNw3ZD`Cde4Nh)NoRn1bY|OwDmcovg8B=4vp_deff3^Ql^w$WpqW>6%uS&J+I3uoBqoh84Wy2K_~a{{l+-&g4AI%4Qorg+9jbBBKeNPIsO>B1LU+xI`A
zS}Nc#gMWh2=*R7n{DOZ&TIolS<@G*zdi9?GnzU^1DRBOB3=-pO>PXoa`45l(;#X0h
zdJv|Qyc5O_UVQ~i2vG_c}|aSmt`y`BVuG>u+Hecha%aHgH}1F6c*
z%fE+KYd)9(x+sx6l9cBPmmy7S8r1z|8$|8%^+NxlXbS&3!)E5e&-sz74|
zpJJk@n|J?uO0$$qrC7(}MV3ldMLB~nz=b_;`l(q;!8!Bsj}bRX_05-fExlvWFw(ri
zR_71j+;6XOcV!h3X*>@>P_jg}$Rs1>JYgGw2}CsE1C?<6IwMBDRV~w?%jZt=9f8T{
z(d_{*TE8KVJ7a(F(j5f*ovVdNJfA+0gbwM7eY+ylfPRy{1@)9ae{(lq@>6X0T_ICY
zrA!NExwg}QzS(A?d*gm+fb{`Gb{u9Zit3Q=dG0rv+@l!_t$&g?j?2h1gLzT^TpnMGqBub
z8ZzjACF5W>EYXG5x>Giljs&%Ot5!*`)`v0aw%X{COvq1juWlNgG2C8tM6h>$Z#XlP
z<1XUa4dfgl^PiiZG5g&UGe{=&I(NIK8W}Pu!t7nWqkCdz<{!l_>Q*P!=B+V2v`;dp
zV;@~q(eU!)=b!$b>pNoye$6n2Bh;QI(|B7S=8zx-tu?Ro7re>{8_%Q?ZpScv>5)R?~dRJcX
zRGk`qW-iz95LVWrJP7wj3O;!R?H9bH?5O#eHu+4$!EI>4sc!WvY}
z&qMZ5B%E!4{AUqpUEX>s8}j_LqBDZ0w!K}Rfr9_5uMht=IM4dXbsQe3$)#vMOdge<
ztDH(>!?_7tZ)oFzRBUEGA=$YS{2s$7iVh0A2l9-a_BGyV7adHZs+mS>_>DfUm5A@0?k!(!uiw|FeCp0b{842yra+UQEV
zS0?HfPLhDu6iVtE@sp)MEeu(4Gq$sChJ_qdQ9^rI%RF-Ct?4`hQ^6fvn6w#alV^;N
zS)j&vzo4L?yjg)G*R+VMSXmN{@UBpg|j@JKz-5W6X9L+JaonbxXZ>yvkSpwFiruv%Y
zPLEAoKUz*oBciAM&VakHL&|bHk<}pwFg{COp5vD4A7@5C4OGHr2Z9^uY)~;mYsO6T
zq?4cP3{cr`8^@nM{HWBq(-NlQjwhz}-3mXptNttsDl2d+J!_YuCuFC`XQ5ySz^DHG
zp%fQ9&~nb&cH!{I+7ZxOy!+CekeSBpRk~l#nJQlamV>218WJ#D_#VI0fH|~E^9?PQ
zhcJZSw8>mQa&tSX0O$JZ#ktiEvh-O`I15vFVqrV+?5A0RjOb>*P-TKcjEcTLr&wwM
zkrPH!xPX%TDoAN0vy=Z3J>NSjv&R=E!VbdJ`|MwL=?Wr~CnkhIETl+478G0_`2vn+
zd0y;
z=g#luHq83)DUr*regx3{;7Z0V+RtxCo9v+xw?FvUs)HbMtbiul{E8==>zI*f*Tmz*
z(B2W8iN+gpj&)lvdd$O$v+^zK?U8}V#1b%|oQ|Et)LR8oy<7)=-=KIl{`oEBESx?X
zO~I1j5ba$V?eB)hutvch1}Su~>)4|;=P@wJOlg{4Q^1>mCy!#gsqT){cgXF~X&-^w
zqv@XpbbuAU0a{VUay8WW_ZUVFz1>S|orvE*GAO4R1v>C)Ir0^2zMkMzDfmDLDTa!3Ae2jgbGz5jy*I<04{|>q#uQLFj|8oIW_l1zfpi!FAX~@vVD>wEgiK@OqY0Gxk;eu;g}PU$
zTf&C4cCvS0@zlm8mT@}WYUd>#;D|PqJao==F?WlO>e(2N?srrS^tYt5c7s#=ZOefy
z`ap|!cQeoRzqZUf`x>Si2dFul3di+x9xb}P&|b;}(I%6dK0b)#;~qt1J`g2YrCm6|
z=YYh+I)TH=g0A#~RMNvrlNI>Aq(zx%lBHvPX9!#Z%U~-87@2?T353*i`VB6b<+|P(
zrNPL<8yk?&8lmHMuCIG17eAz7dpcy9h*Sacok~6
zUzipfSu_bW-fXh@K9hjzR(9MlSleKRB0A4~r3d9<(}5K@Y5v{yHZ>*!Mkd#|SQYyj
zqcBjgE4%tqb|*0fBr2MW#7wXb16yPI$ZVd=3K|`z?QNoV&OkY_FDK-_`T}azcu*N|
zw{}Yy(M&yZP=}75P0i%l;b_OAWZg2NbN!*=ZE&5@a
z4u$E&Fq46G%1y)h)!oUoSSBkLs}~-uC;g@|-nU__Was96&*OEfS-42HqY-!8ON$2mEZ3TXsF;9+B+ZDYROPaE|_^A
zSwS!O#HS)*Zkxef4j-lBYvwY2jgL0??@u}2>z=V_`MCJKUDzf5$Lvx&4CDq!`x^{k
zH6TRt)5gJ2&YfSp-`8gK{p=8&)Zs+VPOf#6Rk~IhRtVjpEK*vVdnLfbkWYHpaM&ki(OGA}j0w!MHr8_O};Cxzvp)l4=`8Ma^
zw~8+vRgUiz&@_6JQF5B$t}DEuldUNAwtcaCw4gDCA?&n)OBo>~tYTF0@!_1=+E%$g
zx?r8EFlLuW;rt!AGcPs_;6Vw;pY56INPHjM-Z%$EJ2CiR-S?mr!g+tL?a<72>{eL)
zjp>z_RPxS=9jQIFj%?hWSdyP;P8Q(ErH172Vk6@w{Hx!+0x7dcJ(;)t5F*R@jsspi
z*$IlPo*I3usUM44OktMDVbx;(BpRlgXUSh5DHbGA^v|)zS+VZr(e;6}SK9Ns?i3vQ
z42Y~W`L=~AwBbIuTcR&h8jo;8n4NQ<`?4DE3)|G|T&@2=h}@iz8n-vn2(j4{Un
zX~l@d#(qJ;Vuk&uMhq-(VFG0)Dr%bv9@+lW3gtBgyj=d8VwLN$;J#F=XouQlIfH
zG^AFB9dThz>v?p3%O^rSIMCEt8?XrlSjA#-`=w@4W;HyvvM>`R-tmxCC4q`&cR+r@WNk
zRg@d7$ICSLFK(>u({mkrrMeV(oF;*SUwro7dxz4l>c&nPmzdS?Y>i0fR|oBAJC
z#jwg#_zRoH%!2Z@1MM}m6nB^FopN`Q(qFac(JGGepa=Cq#hnl_S)|X>Lve#0c|M(7
z=TKA>19?dikShV78Xq^CDbL(^16FG_Oy^Y?H;!&%H9D(YGA1MXgGX=c#_l^>Gdxro
z|3bxbV`rZ@dSB{s?Uq5S>
zRGPn~lz5q;=_iSh-O>MAjyv{CEtpV9La>4lj>X-3v24bbJ1;1m>&vCeke+|RL0c$K
zWTaqJ^*XO8$FK=`t3Z0ebE_Lj14aCM~s>sDW1GE{SA0(4@vB$n6qC40E}mB*0T3J3ueT
zc3_CtY|RV$0IKUrL>|iJeCDiS?g}Rq$Xi~{Q=k@kz_5qTNhySw*F4276mw(5q6N7F
zCTOxTDsVPZanNei1A0h`I>Fba9|o@ZlZmj)V)Hx7T};)5-*!^Zcdqk0
zxW{#RTqmAMO^I)3Z`yJH{j6yD0
zZCM+6p8$XnAri(wKNnU)9t~GY($H#?tH_@;543kOutKb$iA8j66IJR64=uO6`IRE;
zR7ey2R$EZ72Aq(rq~7_R!vseGS@;V5ar*R0izUb7=}#r;5OS+eqQ92i?-U1!a%
zE9Gk3h?AC@?&wZseNM7&(t(b1tR8=o@wh`Y12rPA8A#TGYKb&&M1VLZB1y)7H?cs%$#b>
zp!tAZ0>cmZ)eBU|Ts9j6gSN{`Dk2v4(~q7NPU{EJg4WzNe)XRwqCm
z7y@^m%aBNsVcp7$B#W0$i@cMRLx&NO{6?BbaJ2~tiR{lGx6>YGvg!5Fj9oU>%aSe0
znbS!xh3xdM>x>Cl8~sM?e6h!UD*^e0LZGR`h5P>f*=7T`!d#9+GRo#0!MkheT?(lU
z>%ImJcZUO?8HX9tu7Ho9%WLd(4WX=xMOT6`Y+9GajS95>Mx4fe{%gIV!lE3`Ff5=5
z9z$`wG?PE+U55I29t73}5ipf3jIPJF>Wt0Nd-gk*(06%iwXnT-lHg>@0+x?65-o_g
zD!`D+BE&H&CdE6=z2#