Frame 1
function getSound(linkName) {
var _local1 = new Sound(soundMC);
_local1.attachSound(linkName);
return(_local1);
}
createEmptyMovieClip("soundMC", 213123);
var i = 0;
while (i <= 8) {
_global[("sys" + i) + "Sound"] = getSound("sys" + i);
i++;
}
var i = 0;
while (i <= 0) {
_global[("hit" + i) + "Sound"] = getSound("hit" + i);
i++;
}
_global.missSound = getSound("miss");
a.loadMovie("slg.swf");
var shieldBlock = {spcType:"skill", specialName:"\u76FE\u9632", specialPicLabel:4, specialInfo:"\u76FE\u9632\u5FA1\u3002\r\u8BE5\u89D2\u8272\u4F7F\u7528\u76FE\u683C\u6321\u5F13\u7BAD\u3002\r\u56DE\u907F\u8FDC\u7A0B\u7269\u7406+40%", gainSpcInfo:"\u76FE\u9632\u5FA1\u3002\r\u8BE5\u89D2\u8272\u4F7F\u7528\u76FE\u683C\u6321\u5F13\u7BAD\u3002\r\u56DE\u907F\u8FDC\u7A0B\u7269\u7406+40%", effect:{dodgeShoot:40}};
var frostbite = {spcType:"spc", specialName:"\u51BB\u4F24", linkName:"S-\u51BB\u4F24", specialPicLabel:2, specialInfo:"\u51BB\u4F24\u654C\u4EBA\uFF0C\u9020\u6210\u51CF\u901F\u6548\u679C\u3002\r\u79FB\u52A8\u901F\u5EA6-4 /\u4F24\u5BB3-5 \r\u6B66\u5668\u957F\u5EA6\u5148\u5236\u6743-2", gainSpcInfo:"\u4ED6\u6D51\u8EAB\u54C6\u55E6\uFF0C\u663E\u7136\u662F\u88AB\u51BB\u4F24\u4E86\u3002\r\u88AB\u51BB\u4F24\u7684\u5355\u4F4D\u79FB\u52A8\u901F\u5EA6-4 /\u4F24\u5BB3-5 \r\u6B66\u5668\u957F\u5EA6\u5148\u5236\u6743-2", effect:{mv:-4, weaponLength:-2, damage:-5}, timeForHero:2, timeForUnit:6};
var weaponCurse = {spcType:"spc", specialName:"\u6B66\u5668\u8BC5\u5492", linkName:"S-\u6B66\u5668\u8BC5\u5492", specialPicLabel:3, specialInfo:"\u8BC5\u5492\u5BF9\u65B9\u624B\u4E2D\u7684\u6B66\u5668\u3002\r\u4F7F\u5BF9\u65B9\u7684\u6B66\u5668\u547D\u4E2D\u7387-90%\r\u5982\u679C\u5BF9\u65B9\u6CA1\u6709\u6B66\u5668\u5219\u65E0\u6548\u3002", gainSpcInfo:"\u8BE5\u5355\u4F4D\u4E2D\u4E86\u6B66\u5668\u8BC5\u5492\u3002\r\u4E2D\u4E86\u6B66\u5668\u8BC5\u5492\u7684\u4EBA\u4F7F\u7528\u6B66\u5668\u7684\u65F6\u5019\u4F1A\u5384\u8FD0\u8FDE\u8FDE\uFF0C\u5C31\u7B97\u6325\u821E\u7684\u4EBA\u662F\u5251\u5723\uFF0C\u4ED6\u7684\u52A8\u4F5C\u4E5F\u4E0D\u4F1A\u6BD4\u521D\u5B66\u7684\u5C0F\u5B69\u597D\u591A\u5C11\u3002\r\u88AB\u8BC5\u5492\u540E\u6B66\u5668\u547D\u4E2D\u7387-90% \r\u4F46\u662F\u5982\u679C\u6CA1\u6709\u6B66\u5668\u5219\u65E0\u6548\u3002", effect:{weaponTohit:-90}, timeForHero:5, timeForUnit:10};
var kenOfFrost = {weaponName:"Archzard\u7684\u971C\u5251", linkName:"S-KenofFrost_S", headName:"S-KenofFrost", weaponType:"\u5200/\u5251\u7C7B", damageType:"\u7269\u7406\u4F24\u5BB3", attackType:"combat", weaponInfo:"\n \u8FD9\u628A\u971C\u5251\u5BD2\u6C14\u903C\u4EBA\uFF0C\u4EC5\u4EC5\u662F\u9760\u8FD1\u5B83\u90FD\u8BA9\u4EBA\u5168\u8EAB\u98A4\u6296\u3002\u600E\u4E48\u4F1A\u6709\u4EBA\u80FD\u591F\u6325\u821E\u8FD9\u628A\u5251\u5462\uFF1F\u56E0\u4E3A\uFF0C\u4ED6\u7684\u4E3B\u4EBA\u5E76\u4E0D\u662F\u4EBA\u3002\r \u971C\u5251\u62E5\u6709\u51BB\u4F24\u654C\u4EBA\u7684\u80FD\u529B\u3002", atk:15, range:1, weaponLength:4, special:frostbite};
var bansheeCry = {weaponName:"\u54ED\u568E\u4E4B\u6756", linkName:"S-BansheeCry_S", headName:"S-BansheeCry", weaponType:"\u6756\u7C7B", damageType:"\u9B54\u6CD5\u4F24\u5BB3", attackType:"rangeMagic", weaponInfo:"\n \u8FD9\u662F\u4E00\u6839\u505A\u5DE5\u7CBE\u7EC6\u7684\u6756\u5B50\uFF0C\u6756\u5C16\u6709\u4E00\u4E2A\u5973\u5DEB\u7684\u5934\u9AA8\u3002\u5973\u5DEB\u75DB\u82E6\u7684\u7075\u9B42\u88AB\u56DA\u7981\u5728\u8FD9\u91CC\uFF0C\u542C\u89C1\u5979\u54ED\u568E\u7684\u4EBA\u5FC5\u6B7B\u65E0\u7591\u3002\r \u54ED\u568E\u4E4B\u6756\u4F1A\u8BC5\u5492\u654C\u4EBA\u7684\u6B66\u5668\uFF0C\u5C31\u7B97\u6325\u821E\u7684\u4EBA\u662F\u5251\u5723\uFF0C\u4ED6\u7684\u52A8\u4F5C\u4E5F\u4E0D\u4F1A\u6BD4\u521D\u5B66\u7684\u5C0F\u5B69\u597D\u591A\u5C11\u3002", atk:20, range:4, minRange:1, weaponLength:8, special:weaponCurse};
var longsword = {weaponName:"\u957F\u5251", linkName:"S-longSword_S", headName:"S-longSword", weaponType:"\u5200/\u5251\u7C7B", damageType:"\u7269\u7406\u4F24\u5BB3", attackType:"combat", weaponInfo:"\n \u957F\u5251\uFF0C\u6253\u5F97\u4E0D\u9519\uFF0C\u91CD\u91CF\u5341\u8DB3\u800C\u4E14\u76F8\u5F53\u9510\u5229\u2014\u2014\u7136\u800C\u5BF9\u4E8E\u4ED6\u6240\u8981\u5BF9\u6297\u7684\u90AA\u6076\u6765\u8BF4\uFF0C\u8FD9\u628A\u5251\u597D\u6BD4\u73A9\u5177\u4E00\u822C\u53EF\u7B11\u3002", atk:10, range:1, weaponLength:3};
var bow = {weaponName:"\u5F13", linkName:"S-bow_S", headName:"S-bow", weaponType:"\u5F13\u7C7B", damageType:"\u7269\u7406\u4F24\u5BB3", attackType:"shoot", weaponInfo:"\n \u4E00\u822C\u7684\u5F13\u7BAD\u3002\u7528\u786C\u6749\u6728\u5236\u4F5C\uFF0C\u5C04\u7A0B\u4E00\u822C\u3002\r", atk:15, range:4, minRange:2, weaponLength:9};
var frostStaff = {weaponName:"\u971C\u4E4B\u6756", linkName:"S-frostStaff_S", headName:"S-frostStaff", weaponType:"\u6756\u7C7B", damageType:"\u9B54\u6CD5\u4F24\u5BB3", attackType:"rangeMagic", weaponInfo:"\n \u971C\u6CD5\u5E08\u7684\u6756\uFF0C\u653B\u51FB\u5E26\u971C\u51BB\u3002\r \u88AB\u51FB\u4E2D\u8005\u4F1A\u88AB\u9B54\u6CD5\u51BB\u4F24\u3002", atk:10, range:3, minRange:2, weaponLength:8, special:frostbite};
var corseletOfEternality = {armorName:"\u6C38\u6052\u4E4B\u51EF", linkName:"S-CorseletOfEternality_S", headName:"S-CorseletOfEternality", armorType:"\u91CD\u7532", armorInfo:"\n \u8FD9\u5957\u96D5\u523B\u7740\u9F99\u7FFC\u7684\u6DF1\u7D2B\u8272\u94E0\u7532\u5C31\u662F\u8457\u540D\u7684\u6C38\u6052\u4E4B\u94E0\u3002\u4ED6\u6C38\u6052\u4E4B\u540D\u4E0D\u662F\u56E0\u4E3A\u94E0\u7532\u672C\u8EAB\uFF0C\u800C\u662F\u51FA\u81EA\u5B83\u7684\u4E3B\u4EBA\u3002\r \u6C38\u6052\u4E4B\u94E0\u7269\u7406\u9632\u5FA1\u4E00\u822C\uFF0C\u62E5\u6709\u4E0D\u9519\u7684\u9B54\u6CD5\u9632\u5FA1\u529B\u3002", def:8, mdef:10};
var deathKnightBasic = {linkName:"S-deathKnight", headName:"S-Archzard", unitName:"Archzard", jobName:"\u6B7B\u4EA1\u9A91\u58EB", unitType:"hero", unitInfo:" Archzard \u662F\u4E00\u4E2A\u60A0\u95F2\u7684\u5BB6\u4F19\u3002\n \u4ED6\u603B\u662F\u9A91\u5728\u70C8\u7130\u9A6C\u4E0A\uFF0C\u8E0F\u7740\u67AF\u840E\u7684\u6811\u679D\u6E38\u8361\u5230\u5404\u4E2A\u57CE\u5E02\u3002\n \u4EFB\u4F55\u5F71\u54CD\u6DF1\u8FDC\u7684\u4E8B\u4EF6\u7684\u80CC\u540E\u90FD\u6709\u4ED6\u7684\u5F71\u5B50\uFF0C\u4F46\u662F\u8FD9\u5E76\u4E0D\u610F\u5473\u7740\u4ED6\u4F1A\u4E3A\u4EFB\u4F55\u4EBA\uFF0C\u6216\u8005\u4EFB\u4F55\u4E8B\u800C\u52A8\uFF1A\u4ED6\u5E76\u4E0D\u5173\u5FC3\u4EFB\u4F55\u4E1C\u897F\u3002\u4ED6\u53EA\u662F\u597D\u5947\u2014\u2014\u7136\u800C\u8FD9\u597D\u5947\u8DB3\u4EE5\u8981\u4ED6\u7684\u547D\u3002", atk:12, def:8, mdef:5, tohit:140, dodge:20, hp:50, mp:15, mv:7, mvType:"\u9A91\u5175", weapon:kenOfFrost, armor:corseletOfEternality};
var necromancerBasic = {linkName:"S-necromancer", headName:"S-Kelly", unitName:"Arkara", jobName:"\u4EA1\u7075\u6CD5\u5E08", unitType:"hero", unitInfo:" \u867D\u7136\u770B\u4E0A\u53BB\u50CF\u662F\u4E00\u4E2A\u5999\u9F84\u5C11\u5973\uFF0C\u8C08\u5410\u95F4\u4F60\u751A\u81F3\u4F1A\u611F\u5230\u76F8\u89C1\u6068\u665A\uFF0C\u4F46\u662FArkara\u662F\u4E16\u754C\u4E0A\u6700\u4E3A\u53EF\u6015\u7684\u201C\u751F\u7269\u201D\u4E4B\u4E00\u3002\n \u6CA1\u6709\u4EBA\u77E5\u9053\uFF0C\u8FD9\u4E2A\u5DF2\u7ECF\u6709\u4E0A\u5343\u5E74\u5386\u53F2\u8BB0\u5F55\u7684\u6076\u9B54\u5B9E\u9645\u4E0A\u662F\u4EC0\u4E48\u4E1C\u897F\u3002\u4F60\u8D8A\u662F\u4E86\u89E3\u5B83\u5C31\u8D8A\u89C9\u5F97\u5B83\u7684\u53EF\u6015\uFF0C\u4EE5\u81F3\u4E8E\u4EA7\u751F\u618E\u6068\u3002\n \u6709\u8DA3\u7684\u662F\u5F88\u591A\u4EBA\u90FD\u58F0\u79F0\u66FE\u7ECF\u6740\u6B7B\u8FC7\u5B83\u3002", atk:10, def:7, mdef:18, tohit:140, dodge:0, hp:35, mp:25, mv:4, mvType:"\u6CD5\u5E08", weapon:bansheeCry};
var manBeastBasic = {linkName:"S-manBeast", headName:"S-Dulri", unitName:"Dulri", jobName:"\u91CE\u517D", unitType:"hero", unitInfo:" Dulri\u662F\u4E00\u4E2A\u53EF\u6015\u7684\u602A\u7269\uFF0C\u4ED6\u767D\u8272\u7684\u76AE\u6BDB\u5200\u67AA\u4E0D\u5165\u3002\r \u65E0\u8BBA\u654C\u4EBA\u662F\u68EE\u6797\u3001\u5C71\u5DDD\u8FD8\u662F\u57CE\u5821\uFF0C\u5728Dulri\u9762\u524D\u90FD\u662F\u5316\u6E23\u7684\u6599\u963F\uFF01\r \u5DEB\u5E08?\u5DEB\u5E08\u624D\u5E03\u4E01\u5927\uFF0C\u6211\u4E00\u722A\u5B50\u5C31\u62CD\u6B7B\u4E86\uFF0C\u4F46\u662F\u9B54\u6CD5\u73A9\u610F\u513F\u8FD8\u662F\u6709\u4E9B\u9EBB\u70E6\u7684\uFF1B\u4ED6\u4F1A\u8BA9\u4F60\u611F\u89C9\u5F88\u5947\u602A\u2014\u2014Dulri\u6478\u6478\u5934\u561F\u565C\u7740\u3002", atk:40, def:18, mdef:0, tohit:160, dodge:20, hp:60, mp:10, mv:6, mvType:"\u731B\u517D\u4EBA"};
var footManBasic = {linkName:"S-footMan", headName:"S-FootManHead", unitName:"\u4EBA\u7C7B", jobName:"\u6B65\u5175", unitType:"army", unitInfo:"\n \u624B\u6301\u957F\u5251\u7684\u4F63\u5175\u3002\u4FBF\u5B9C\u53C8\u5B9E\u60E0\u7684\u70AE\u7070\u3002\r \u7531\u4E8E\u6709\u94E0\u7532\u548C\u76FE\u724C\uFF0C\u5E26\u76FE\u6B65\u5175\u662F\u5F13\u7BAD\u624B\u7684\u5929\u654C\u3002\u4F46\u662F\u65E0\u8BBA\u591A\u539A\u5B9E\u7684\u94E0\u7532\u4E5F\u662F\u6321\u4E0D\u4F4F\u9B54\u6CD5\u7684\u3002", atk:13, def:10, mdef:0, tohit:140, dodge:40, hp:40, mp:0, mv:5, mvType:"\u6B65\u5175", weapon:longsword, skillList:[shieldBlock]};
var footMan2Basic = {linkName:"S-footMan2", headName:"S-FootManHead", unitName:"\u4EBA\u7C7B", jobName:"\u6B65\u5175", unitType:"army", unitInfo:"\n \u624B\u6301\u957F\u5251\u7684\u4F63\u5175\u3002\u4FBF\u5B9C\u53C8\u5B9E\u60E0\u7684\u70AE\u7070\u3002\r \u7531\u4E8E\u6709\u94E0\u7532\u548C\u76FE\u724C\uFF0C\u5E26\u76FE\u6B65\u5175\u662F\u5F13\u7BAD\u624B\u7684\u5929\u654C\u3002\u4F46\u662F\u65E0\u8BBA\u591A\u539A\u5B9E\u7684\u94E0\u7532\u4E5F\u662F\u6321\u4E0D\u4F4F\u9B54\u6CD5\u7684\u3002", atk:13, def:10, mdef:0, tohit:140, dodge:40, hp:40, mp:0, mv:5, mvType:"\u6B65\u5175", weapon:longsword, skillList:[shieldBlock]};
var archerBasic = {linkName:"S-archer", headName:"S-ArcherHead", unitName:"\u4EBA\u7C7B", jobName:"\u5F13\u624B", unitType:"army", unitInfo:"\n \u64C5\u957F\u4E1B\u6797\u6218\u7684\u5F13\u7BAD\u624B\u3002\n \u957F\u671F\u5438\u53D6\u81EA\u7136\u7CBE\u534E\uFF0C\u5F13\u7BAD\u624B\u7684\u9B54\u6CD5\u6297\u6027\u5F88\u9AD8\u3002\u800C\u4E14\u540C\u6837\u662F\u8FDC\u7A0B\u5355\u4F4D\uFF0C\u5F13\u7BAD\u624B\u5BF9\u5F31\u9632\u5FA1\u7684\u6CD5\u5E08\u7684\u4F24\u5BB3\u5F88\u9AD8\u3002\u53E6\u5916\uFF0C\u5F13\u624B\u53EF\u4EE5\u5728\u57CE\u5899\u4E0A\u653B\u51FB\u654C\u4EBA\u3002", atk:13, def:0, mdef:15, tohit:100, dodge:20, hp:25, mp:0, mv:4, mvType:"\u5F13\u624B", weapon:bow};
var archer2Basic = {linkName:"S-archer2", headName:"S-ArcherHead", unitName:"\u4EBA\u7C7B", jobName:"\u5F13\u624B", unitType:"army", unitInfo:"\n \u64C5\u957F\u4E1B\u6797\u6218\u7684\u5F13\u7BAD\u624B\u3002\n \u957F\u671F\u5438\u53D6\u81EA\u7136\u7CBE\u534E\uFF0C\u5F13\u7BAD\u624B\u7684\u9B54\u6CD5\u6297\u6027\u5F88\u9AD8\u3002\u800C\u4E14\u540C\u6837\u662F\u8FDC\u7A0B\u5355\u4F4D\uFF0C\u5F13\u7BAD\u624B\u5BF9\u5F31\u9632\u5FA1\u7684\u6CD5\u5E08\u7684\u4F24\u5BB3\u5F88\u9AD8\u3002\u53E6\u5916\uFF0C\u5F13\u624B\u53EF\u4EE5\u5728\u57CE\u5899\u4E0A\u653B\u51FB\u654C\u4EBA\u3002", atk:13, def:0, mdef:15, tohit:100, dodge:20, hp:25, mp:0, mv:4, mvType:"\u5F13\u624B", weapon:bow};
var frostMagiBasic = {linkName:"S-forstMagi", headName:"S-FrostMagiHead", unitName:"\u4EBA\u7C7B", jobName:"\u6CD5\u5E08", unitType:"army", unitInfo:"\n \u4F7F\u7528\u51B0\u9B54\u6CD5\u7684\u6CD5\u5E08\u3002\u653B\u51FB\u51BB\u4F24\u654C\u4EBA\u3002\r \u6CD5\u5E08\u76F8\u5BF9\u8106\u5F31\uFF0C\u4F46\u662F\u9B54\u6CD5\u9644\u5E26\u7684\u5F02\u5E38\u72B6\u6001\u53EF\u4EE5\u8BA9\u654C\u4EBA\u4E07\u5206\u5934\u75BC\u3002\r", atk:10, def:6, mdef:12, tohit:140, dodge:0, hp:30, mp:0, mv:4, mvType:"\u6CD5\u5E08", weapon:frostStaff};
var frostMagi2Basic = {linkName:"S-forstMagi2", headName:"S-FrostMagiHead", unitName:"\u4EBA\u7C7B", jobName:"\u6CD5\u5E08", unitType:"army", unitInfo:"\n \u4F7F\u7528\u51B0\u9B54\u6CD5\u7684\u6CD5\u5E08\u3002\u653B\u51FB\u51BB\u4F24\u654C\u4EBA\u3002\r \u6CD5\u5E08\u76F8\u5BF9\u8106\u5F31\uFF0C\u4F46\u662F\u9B54\u6CD5\u9644\u5E26\u7684\u5F02\u5E38\u72B6\u6001\u53EF\u4EE5\u8BA9\u654C\u4EBA\u4E07\u5206\u5934\u75BC\u3002\r", atk:10, def:6, mdef:13, tohit:140, dodge:0, hp:30, mp:0, mv:4, mvType:"\u6CD5\u5E08", weapon:frostStaff};
function create2DArray(width, height, init) {
if ((width <= 0) || (height <= 0)) {
trace("create2DArray(width, height) \u51FD\u6570\u51FA\u9519\uFF1Awidth\u3001height\u5927\u4E8E0");
} else {
var _local3 = new Array(height);
if (init == null) {
var _local2 = 0;
while (_local2 < height) {
_local3[_local2] = new Array(width);
_local2++;
}
} else {
var _local2 = 0;
while (_local2 < height) {
_local3[_local2] = new Array(width);
var _local1 = 0;
while (_local1 < width) {
_local3[_local2][_local1] = init;
_local1++;
}
_local2++;
}
}
return(_local3);
}
return(undefined);
}
function trace2DArray(Array2D) {
var _local3 = Array2D;
var _local2 = _local3.length;
var width = _local3[0].length;
if ((width == null) || (width <= 0)) {
trace("\u4E0D\u662F2D\u6570\u7EC4");
} else {
trace((width + " x ") + _local2);
var _local1 = 0;
while (_local1 < _local2) {
trace(_local3[_local1]);
_local1++;
}
}
}
function myWatchFunc(id, oldval, newval, userdata) {
var _local1 = userdata;
var _local2 = newval;
if (_local1.lock == "lock") {
return(oldval);
}
for (var _local3 in _local1.bandData) {
_local1.bandData[_local3] = _local2;
}
return(_local2);
}
function getColorCX(colorx, alpha) {
var _local1 = alpha;
var _local2 = colorx;
if (_local2 == null) {
_local2 = 16777215 /* 0xFFFFFF */;
}
if (_local1 == null) {
_local1 = 100;
}
alpha_1 = 100 - _local1;
_local1 = _local1 / 100;
var colorR = int(_local2 / 65536);
var _local3 = int(_local2 / 256) % 256;
var colorB = int(_local2 % 256);
return({ra:alpha_1, rb:colorR * _local1, ga:alpha_1, gb:_local3 * _local1, ba:alpha_1, bb:colorB * _local1, aa:100, ab:0});
}
function createTileList(tileList) {
var _local2 = tileList;
var _local3 = this;
_local3.tileList = new Array();
if (_local2 instanceof Array) {
var _local1 = 0;
while (_local1 < _local2.length) {
_local3.tileList[_local1] = {};
for (var j in _local2[_local1]) {
_local3.tileList[_local1][j] = _local2[_local1][j];
}
_local1++;
}
} else {
var _local1 = 0;
while (_local2[_local1] != undefined) {
_local3.tileList[_local1] = {};
for (var j in _local2[_local1]) {
_local3.tileList[_local1][j] = _local2[_local1][j];
}
_local1++;
}
}
}
function addtoTileList(newtile) {
var _local1 = newtile;
if (_local1 == null) {
} else {
var _local2 = {};
for (var _local3 in _local1) {
_local2 = _local1[_local3];
}
this.tileList.push(_local2);
}
}
function clearTileList() {
this.tileList = new Array();
}
function listPorpertyFromTileList(proto) {
var _local2 = this;
if (_local2.tileList == undefined) {
trace("listPorpertyFromTileList () \u51FD\u6570\u51FA\u9519\uFF1AtileMap\u672A\u521D\u59CB\u5316 !");
return(null);
}
var _local3 = new Array();
var _local1 = 0;
while (_local1 < _local2.tileList.length) {
_local3.push(_local2.tileList[_local1][proto]);
_local1++;
}
return(_local3);
}
function getTile(proto) {
var _local1 = proto;
if (this.tileList[_local1] == null) {
trace(("getTile(proto) \u51FD\u6570\u51FA\u9519\uFF1Aproto:" + _local1) + "\u4E0D\u5B58\u5728\u4E8EtileList\u4E2D");
}
return(this.tileList[_local1]);
}
function getTileListLen() {
if (this.tileList == null) {
return(0);
}
return(this.tileList.length);
}
function tileListtoString() {
var _local3 = this;
if (_local3.tileList == null) {
return("tileListNotCreated");
}
var str = ("TileList Length: " + _local3.tileList.length);
var _local1 = 0;
while (_local1 < _local3.tileList.length) {
str = str + (newline + _local1);
var _local2 = "";
for (var j in _local3.tileList[_local1]) {
_local2 = (((" \t" + j) + ":") + _local3.tileList[_local1][j]) + _local2;
}
str = str + _local2;
_local1++;
}
return(str);
}
function createTileMap(map2DArray) {
var _local2 = this;
_local2.mapWidth = 0;
_local2.mapHeight = 0;
var _local3 = 0;
while (map2DArray[_local3] != undefined) {
_local2.mapHeight++;
var _local1 = 0;
while (map2DArray[_local3][_local1] != undefined) {
if (_local1 >= _local2.mapWidth) {
_local2.mapWidth = _local1 + 1;
}
_local1++;
}
_local3++;
}
if ((_local2.mapHeight == 0) || (_local2.mapWidth == 0)) {
trace("new Map( map2DArray ) \u51FD\u6570\u51FA\u9519\uFF1A\u6CE8\u610Fmap2DArray\u662F\u975E\u7A7A2\u7EF4\u6570\u7EC4");
} else {
_local2.tileMap = new Array(_local2.mapHeight);
_local3 = 0;
while (_local3 < _local2.mapHeight) {
_local2.tileMap[_local3] = new Array(_local2.mapWidth);
var _local1 = 0;
while (_local1 < _local2.mapWidth) {
_local2.tileMap[_local3][_local1] = {};
_local2.tileMap[_local3][_local1].proto = 0;
_local2.tileMap[_local3][_local1].flag = 0;
_local2.tileMap[_local3][_local1].pathLength = 0;
_local2.tileMap[_local3][_local1].prevTile = null;
_local2.tileMap[_local3][_local1].weight = 0;
_local2.tileMap[_local3][_local1].unitList = {};
if (map2DArray[_local3][_local1] != null) {
_local2.tileMap[_local3][_local1].proto = map2DArray[_local3][_local1];
}
_local1++;
}
_local3++;
}
}
}
function setTileMap(x, y, index) {
var _local1 = this;
var _local2 = y;
var _local3 = x;
if (((typeof(_local3) != "number") || (typeof(_local2) != "number")) || (index == undefined)) {
trace("Map.set( x, y, mapIndex) \u51FD\u6570\u51FA\u9519\uFF1A\u53C2\u6570\u7C7B\u578B\u9519\u8BEF !");
}
if (_local1.tileMap == null) {
trace("Map.set( x, y, mapIndex ) \u51FD\u6570\u51FA\u9519\uFF1AtileMap\u672A\u521D\u59CB\u5316 !");
}
if ((((_local3 < 0) || (_local2 < 0)) || (_local3 >= _local1.mapHeight)) || (_local2 >= _local1.mapWidth)) {
trace("Map.set( x, y, mapIndex ) \u51FD\u6570\u51FA\u9519\uFF1Ax , y \u8D8A\u754C!");
}
_local1.tileMap[_local3][_local2].proto = index;
}
function getTileMap(x, y) {
return(this.tileMap[y][x].proto);
}
function getMapWidth() {
return(this.mapWidth);
}
function getMapHeight() {
return(this.mapHeight);
}
function tileMapInfo(proto, tileList, useTab:Boolean) {
if (proto == null) {
var proto = "proto";
}
if (tileList == null) {
var mapProperty = true;
} else {
var mapProperty = false;
}
if (useTab) {
var sepStr = ",\t";
} else {
var sepStr = ",";
}
var _local1 = (("Map: " + this.mapWidth) + " x ") + this.mapHeight;
var _local3 = 0;
while (_local3 < this.mapHeight) {
_local1 = _local1 + newline;
var _local2 = 0;
while (_local2 < this.mapWidth) {
if (mapProperty) {
_local1 = _local1 + this.tileMap[_local3][_local2][proto];
} else {
_local1 = _local1 + tileList.tileList[this.tileMap[_local3][_local2].proto][proto];
}
_local1 = _local1 + sepStr;
_local2++;
}
if (useTab == true) {
_local1 = _local1.slice(0, _local1.length - 2);
} else {
_local1 = _local1.slice(0, _local1.length - 1);
}
_local3++;
}
return(_local1);
}
function getSubMap(proto, tileList) {
var _local3 = this;
if (proto == null) {
var proto = "proto";
}
if (tileList == null) {
var mapProperty = true;
} else {
var mapProperty = false;
}
var subMap = new Array(_local3.mapHeight);
var _local2 = 0;
while (_local2 < _local3.mapHeight) {
subMap[_local2] = [];
var _local1 = 0;
while (_local1 < _local3.mapWidth) {
if (mapProperty) {
subMap[_local2][_local1] = _local3.tileMap[_local2][_local1][proto];
} else {
subMap[_local2][_local1] = tileList.tileList[_local3.tileMap[_local2][_local1].proto][proto];
}
_local1++;
}
_local2++;
}
return(subMap);
}
function setSubMap(proto, proto2D) {
var _local1 = this;
if ((proto2D == null) || ((proto2D instanceof Array) && ((proto2D.length != _local1.mapHeight) || (proto2D[0].length != _local1.mapWidth)))) {
trace("Map.setsub(proto, proto2D) \u51FD\u6570\u51FA\u9519\uFF1Aproto2D\u662F\u5C5E\u6027\u6216\u8005\u4E00\u4E2A\u548CMap\u5927\u5C0F\u76F8\u540C\u76842D\u6570\u7EC4 !");
} else {
if (proto == null) {
var proto = "proto";
}
if (proto2D instanceof Array) {
var _local3 = 0;
while (_local3 < _local1.mapHeight) {
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
_local1.tileMap[_local3][_local2][proto] = proto2D[_local3][_local2];
_local2++;
}
_local3++;
}
} else {
var _local3 = 0;
while (_local3 < _local1.mapHeight) {
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
_local1.tileMap[_local3][_local2][proto] = proto2D;
_local2++;
}
_local3++;
}
}
}
}
function setFlag(x, y, flag) {
var _local1 = flag;
var _local2 = this;
var _local3 = y;
if ((((x < 0) || (_local3 < 0)) || (x >= _local2.mapWidth)) || (_local3 >= _local2.mapHeight)) {
} else {
if (_local1 == undefined) {
_local1 = 0;
}
_local2.tileMap[x][_local3].flag = _local1;
}
}
function getFlag(x, y) {
return(this.tileMap[x][y].flag);
}
function setFlagMap(flag) {
var _local1 = flag;
if (_local1 == undefined) {
_local1 = 0;
}
this.setSubMap("flag", _local1);
}
function getFlagMap() {
return(this.getSubMap("flag"));
}
function checkMoveRange(posx, posy, speed, moveMentCostList, passFunction) {
if ((((posx == null) || (posy == null)) || (this.tileMap[posy][posx] == null)) || (speed < 0)) {
return(false);
}
if ((moveMentCostList == nul) && (passFunction == null)) {
trace("Map.checkMoveRange (posx, posy, speed, moveCostList, passFun) \u53C2\u6570\u51FA\u9519\uFF1AmoveCostList\u548CpassFunc\u4E0D\u80FD\u540C\u65F6\u4E3A\u7A7A\u3002");
return(false);
}
posx = int(posx);
posy = int(posy);
speed = int(speed);
if (speed < 0) {
speed = 0;
}
var map = this.tileMap;
var border = {};
var borderIndex = 0;
if ((moveMentCostList != null) && (passFunction == null)) {
var _local3 = function (x, y) {
if (map[y][x].flag == -1) {
map[y][x].flag = moveMentCostList[map[y][x].proto];
border[borderIndex++] = {x:x, y:y};
}
};
} else if ((passFunction != null) && (moveMentCostList == null)) {
var _local3 = function (x, y, prevx, prevy) {
if ((map[y][x].flag == -1) && (passFunction(x, y, prevx, prevy))) {
map[y][x].flag = 1;
border[borderIndex++] = {x:x, y:y};
}
};
} else {
var _local3 = function (x, y, prevx, prevy) {
if ((map[y][x].flag == -1) && (passFunction(x, y, prevx, prevy))) {
map[y][x].flag = moveMentCostList[map[y][x].proto];
border[borderIndex++] = {x:x, y:y};
}
};
}
this.setFlagMap(-1);
border[borderIndex++] = {x:posx, y:posy};
map[posy][posx].flag = 1;
var i = 0;
while (i <= speed) {
for (var j in border) {
map[border[j].y][border[j].x].flag--;
if (map[border[j].y][border[j].x].flag <= 0) {
var _local2 = border[j].x;
var _local1 = border[j].y;
_local3(_local2 - 1, _local1, _local2, _local1);
_local3(_local2, _local1 - 1, _local2, _local1);
_local3(_local2 + 1, _local1, _local2, _local1);
_local3(_local2, _local1 + 1, _local2, _local1);
delete border[j];
}
}
i++;
}
return(this.getFlagMap());
}
function getPath(xstart, ystart, xto, yto, moveMentCostList, passFunc, minCost) {
if ((((((xstart == null) || (ystart == null)) || (this.tileMap[ystart][xstart] == null)) || (xto == null)) || (yto == null)) || (this.tileMap[yto][xto] == null)) {
return(false);
}
if ((moveMentCostList == nul) && (passFunction == null)) {
trace("Map.checkMoveRange (posx, posy, speed, moveCostList, passFun) \u53C2\u6570\u51FA\u9519\uFF1AmoveCostList\u548CpassFunc\u4E0D\u80FD\u540C\u65F6\u4E3A\u7A7A\u3002");
return(false);
}
if (avcose == null) {
minCost = 1;
}
var map = this.tileMap;
var border = {};
var borderIndex = 0;
if (passFunction == null) {
passFunction = function () {
return(true);
};
}
var tryPushSeed = function (x, y, prevx, prevy) {
if ((map[y][x].flag == -1) && (passFunction(xto, yto, x, y))) {
var _local1 = map[y][x];
_local1.flag = 0;
_local1.weight = _local1.pathLength + (minCost * (Math.abs(x - xto) + Math.abs(y - yto)));
if ((map[y][x - 1].flag == -1) && (map[y][x - 1].pathLength > (map[y][x].pathLength + moveMentCostList[map[y][x - 1].proto]))) {
map[y][x - 1].pathLength = map[y][x].pathLength + moveMentCostList[map[y][x - 1].proto];
map[y][x - 1].prevTile = {x:x, y:y};
}
if ((map[y][x + 1].flag == -1) && (map[y][x + 1].pathLength > (map[y][x].pathLength + moveMentCostList[map[y][x + 1].proto]))) {
map[y][x + 1].pathLength = map[y][x].pathLength + moveMentCostList[map[y][x + 1].proto];
map[y][x + 1].prevTile = {x:x, y:y};
}
if ((map[y - 1][x].flag == -1) && (map[y - 1][x].pathLength > (map[y][x].pathLength + moveMentCostList[map[y - 1][x].proto]))) {
map[y - 1][x].pathLength = map[y][x].pathLength + moveMentCostList[map[y - 1][x].proto];
map[y - 1][x].prevTile = {x:x, y:y};
}
if ((map[y + 1][x].flag == -1) && (map[y + 1][x].pathLength > (map[y][x].pathLength + moveMentCostList[map[y + 1][x].proto]))) {
map[y + 1][x].pathLength = map[y][x].pathLength + moveMentCostList[map[y + 1][x].proto];
map[y + 1][x].prevTile = {x:x, y:y};
}
border[borderIndex++] = {x:x, y:y};
stackCount++;
}
};
this.setFlagMap(-1);
this.setSubMap("pathLength", Infinity);
var _local3 = map[ystart][xstart];
_local3.flag = 0;
_local3.pathLength = 0;
_local3.weight = minCost * (Math.abs(xstart - xto) + Math.abs(ystart - yto));
_local3.prevTile = null;
map[ystart][xstart - 1].pathLength = map[ystart][xstart].pathLength + moveMentCostList[map[ystart][xstart - 1].proto];
map[ystart][xstart - 1].prevTile = {x:xstart, y:ystart};
map[ystart][xstart + 1].pathLength = map[ystart][xstart].pathLength + moveMentCostList[map[ystart][xstart + 1].proto];
map[ystart][xstart + 1].prevTile = {x:xstart, y:ystart};
map[ystart - 1][xstart].pathLength = map[ystart][xstart].pathLength + moveMentCostList[map[ystart - 1][xstart].proto];
map[ystart - 1][xstart].prevTile = {x:xstart, y:ystart};
map[ystart + 1][xstart].pathLength = map[ystart][xstart].pathLength + moveMentCostList[map[ystart + 1][xstart].proto];
map[ystart + 1][xstart].prevTile = {x:xstart, y:ystart};
border[borderIndex++] = {x:xstart, y:ystart};
var stackCount = 1;
var success = false;
while (stackCount > 0) {
var _local2 = Infinity;
var _local1 = null;
for (var i in border) {
if (_local2 > map[border[i].y][border[i].x].weight) {
_local2 = map[border[i].y][border[i].x].weight;
_local1 = i;
}
}
var x = border[_local1].x;
var y = border[_local1].y;
if ((x == xto) && (y == yto)) {
success = true;
break;
}
tryPushSeed(x - 1, y, x, y);
tryPushSeed(x, y - 1, x, y);
tryPushSeed(x + 1, y, x, y);
tryPushSeed(x, y + 1, x, y);
delete border[_local1];
stackCount--;
}
if (success) {
var path = [];
_local3 = {x:xto, y:yto};
while (_local3 != null) {
path.push(_local3);
_local3 = map[_local3.y][_local3.x].prevTile;
}
path.reverse();
return(path);
}
return(null);
}
function createTileScene2D(textureList2D, linkName, scale, depth) {
var _local1 = this;
if ((textureList2D == null) || (depth == null)) {
trace("new TileScene2D(textureList2D ,scale, depth) \u51FD\u6570\u53C2\u6570\u51FA\u9519");
} else {
_local1.depth = depth;
}
if (scale == undefined) {
_local1.scale = 50;
} else {
_local1.scale = scale;
}
if (typeof(linkName) != "string") {
trace("new TileScene2D(textureList2D ,scale, depth) \u51FD\u6570\u53C2\u6570\u51FA\u9519");
}
_local1.linkName = linkName;
_local1.mapHeight = textureList2D.length;
_local1.mapWidth = textureList2D[0].length;
if ((_local1.mapHeight == 0) || (_local1.mapWidth == 0)) {
trace("new TileScene2D(textureList2D ,scale, depth) \u51FD\u6570\u51FA\u9519\uFF1A\u6CE8\u610FtextureList2D\u662F\u975E\u7A7A2\u7EF4\u6570\u7EC4");
} else {
_local1.tileMap = new Array(_local1.mapHeight);
var _local3 = 0;
while (_local3 < _local1.mapHeight) {
_local1.tileMap[_local3] = new Array(_local1.mapWidth);
var _local2 = 0;
while (_local2 < _local1.mapWidth) {
_local1.tileMap[_local3][_local2] = {};
_local1.tileMap[_local3][_local2].linkName = textureList2D[_local3][_local2];
_local1.tileMap[_local3][_local2].texture = null;
_local1.tileMap[_local3][_local2].colorxArray = [];
_local1.tileMap[_local3][_local2].highLightListId = -1;
_local2++;
}
_local3++;
}
_root.createEmptyMovieClip("OxSLGEngineSceneMC" + depth, depth);
_local1.mainScene = _root["OxSLGEngineSceneMC" + depth];
_local1.mainScene.map = _local1;
_local1.mainScene.createEmptyMovieClip("mapScene", 0);
_local1.mapScene = _local1.mainScene.mapScene;
_local1.mapScene._x = OxSLGEngine.stageWidth / 2;
_local1.mapScene._y = OxSLGEngine.stageHeight / 2;
_local1.maskScene = null;
_local1.depth = 0;
_local1.timeCount = 0;
_local1.mainScene.onEnterFrame = function () {
var _local1 = this.map;
_local1.timeCount++;
};
_local1.highLightList = {};
_local1.highLightListCount = 0;
_local1.stageLeft = 0;
_local1.stageTop = 0;
_local1.stageRight = OxSLGEngine.stageWidth;
_local1.stageBottom = OxSLGEngine.stageHeight;
_local1.tileShowx = 0;
_local1.tileShowy = 0;
_local1.tileShow = false;
_local1.tileShowLeft = 0;
_local1.tileShowRight = 0;
_local1.tileShowTop = 0;
_local1.tileShowBottom = 0;
_local1.tileShowScale = _local1.scale;
_local1.highLightFrequency = 30;
_local1.changed = false;
_local1.frame = 5;
_local1.highLightAlphaMax = 60;
_local1.highLightAlphaMin = 30;
_local1.highLightper = 45;
_local1.hasShadow = false;
_local1.shadowColor = 0;
_local1.shadowAlpha = 20;
_local1.normalColorcx = OxSLGEngine.nocolor;
_local1.targetX = null;
_local1.targetY = null;
_local1.targetScale = null;
_local1.targetSpeed = null;
_local1.speed = null;
}
}
function setSceneClip(maskflag, left, top, right, bottom) {
var _local1 = this;
if (typeof(left) == "number") {
_local1.stageLeft = left;
}
if (typeof(top) == "number") {
_local1.stageTop = top;
}
if (typeof(right) == "number") {
_local1.stageRight = right;
}
if (typeof(bottom) == "number") {
_local1.stageBottom = bottom;
}
_local1.mapScene._x = (_local1.stageLeft + _local1.stageRight) / 2;
_local1.mapScene._y = (_local1.stageTop + _local1.stageRight) / 2;
if (maskflag == true) {
_local1.maskScene = _local1.mainScene.createEmptyMovieClip("maskScene", 10);
_local1.maskScene.beginFill(0, 100);
_local1.maskScene.moveTo(_local1.stageLeft, _local1.stageTop);
_local1.maskScene.lineTo(_local1.stageLeft, _local1.stageBottom);
_local1.maskScene.lineTo(_local1.stageRight, _local1.stageBottom);
_local1.maskScene.lineTo(_local1.stageRight, _local1.stageTop);
_local1.maskScene.endFill();
_local1.mapScene.setMask(_local1.maskScene);
} else {
removeMovieClip(maskflag);
}
}
function randerScene() {
var _local1 = this;
_local1.autoMove();
_local1.reflushScene();
_local1.randerHighLight(_local1.timeCount);
}
function autoMove_delete() {
var _local1 = this;
if ((_local1.targetX != null) || (_local1.targetY != null)) {
x = ((_local1.stageLeft + _local1.stageRight) / 2) - ((_local1.targetX + 0.5) * _local1.scale);
y = ((_local1.stageTop + _local1.stageBottom) / 2) - ((_local1.targetY + 0.5) * _local1.scale);
if (_local1.mapScene._x < x) {
_local1.mapScene._x = _local1.mapScene._x + _local1.targetSpeed;
if (_local1.mapScene._x >= x) {
delete _local1.targetX;
}
} else if (_local1.mapScene._x > x) {
_local1.mapScene._x = _local1.mapScene._x - _local1.targetSpeed;
if (_local1.mapScene._x <= x) {
delete _local1.targetX;
}
} else {
delete _local1.targetX;
}
if (_local1.mapScene._y < y) {
_local1.mapScene._y = _local1.mapScene._y + _local1.targetSpeed;
if (_local1.mapScene._y >= y) {
delete _local1.targetY;
}
} else if (_local1.mapScene._y > y) {
_local1.mapScene._y = _local1.mapScene._y - _local1.targetSpeed;
if (_local1.mapScene._y <= y) {
delete _local1.targetY;
}
} else {
delete _local1.targetY;
}
}
}
function reflushScene() {
var _local1 = this;
var scale = int(_local1.scale);
if (((tileShow && (_local1.mapScene._x == _local1.tileShowx)) && (_local1.mapScene._y == _local1.tileShowy)) && (_local1.tileShowScale == scale)) {
return(false);
}
_local1.tileShowx = _local1.mapScene._x;
_local1.tileShowy = _local1.mapScene._y;
var left = int((_local1.stageLeft - _local1.mapScene._x) / scale);
if (left < 0) {
left = 0;
}
var top = int((_local1.stageTop - _local1.mapScene._y) / scale);
if (top < 0) {
top = 0;
}
var right = int((_local1.stageRight - _local1.mapScene._x) / scale);
if (right >= _local1.mapWidth) {
right = _local1.mapWidth - 1;
}
var bottom = int((_local1.stageBottom - _local1.mapScene._y) / scale);
if (bottom >= _local1.mapHeight) {
bottom = _local1.mapHeight - 1;
}
if ((((left >= _local1.mapWidth) || (top >= _local1.mapHeight)) || (right < 0)) || (bottom < 0)) {
var tileShow = false;
} else {
tileShow = true;
}
if ((tileShow == false) && (_local1.tileShow == false)) {
return(false);
}
if (((((_local1.tileShow && (left == _local1.tileShowLeft)) && (right == _local1.tileShowRight)) && (top == _local1.tileShowTop)) && (bottom == _local1.tileShowBottom)) && (scale == _local1.tileShowScale)) {
return(false);
}
if (_local1.tileShow) {
var i = _local1.tileShowTop;
while (i <= _local1.tileShowBottom) {
var _local2 = _local1.tileShowLeft;
while (_local2 <= _local1.tileShowRight) {
_local1.tileMap[i][_local2].showNow = false;
_local2++;
}
i++;
}
}
if (tileShow) {
var i = top;
while (i <= bottom) {
var _local2 = left;
while (_local2 <= right) {
_local1.tileMap[i][_local2].showNow = true;
if (_local1.tileMap[i][_local2].texture == null) {
_local1.mapScene.attachMovie(_local1.linkName, "tile" + _local1.depth, _local1.depth++);
_local1.tileMap[i][_local2].texture = _local1.mapScene["tile" + _local1.depth];
_local1.tileMap[i][_local2].texture.gotoAndStop(_local1.tileMap[i][_local2].linkName);
_local1.tileMap[i][_local2].colorObject = new Color(_local1.tileMap[i][_local2].texture);
if (_local1.tileMap[i][_local2].colorxArray.length != 0) {
_local1.tileMap[i][_local2].colorObject.setTransform(getColorCX(tileNow.colorx, _local1.highLightper));
} else if (_local1.hasShadow) {
_local1.tileMap[i][_local2].colorObject.setTransform(_local1.normalColorcx);
}
}
var _local3 = _local1.tileMap[i][_local2].texture;
_local3._xscale = (_local3._yscale = scale);
_local3._x = (_local2 + 1) * scale;
_local3._y = (i + 1) * scale;
_local2++;
}
i++;
}
}
if (_local1.tileShow) {
var i = _local1.tileShowTop;
while (i <= _local1.tileShowBottom) {
var _local2 = _local1.tileShowLeft;
while (_local2 <= _local1.tileShowRight) {
if (_local1.tileMap[i][_local2].showNow == false) {
removeMovieClip(_local1.tileMap[i][_local2].texture);
delete _local1.tileMap[i][_local2].texture;
}
_local2++;
}
i++;
}
}
_local1.tileShow = tileShow;
_local1.tileShowLeft = left;
_local1.tileShowTop = top;
_local1.tileShowRight = right;
_local1.tileShowBottom = bottom;
_local1.tileShowScale = _local1.scale;
return(true);
}
function randerHighLight(tcount) {
var _local1 = this;
if ((!_local1.changed) && ((_local1.highLightFrequency == null) || ((tcount % _local1.frame) != 0))) {
} else {
if (tcount != null) {
_local1.highLightper = (tcount % _local1.highLightFrequency) / (_local1.highLightFrequency - 1);
if (_local1.highLightper > 0.5) {
_local1.highLightper = 1 - _local1.highLightper;
}
_local1.highLightper = _local1.highLightper * 2;
_local1.highLightper = _local1.highLightAlphaMin + (_local1.highLightper * (_local1.highLightAlphaMax - _local1.highLightAlphaMin));
} else {
_local1.highLightper = (_local1.highLightAlphaMax + _local1.highLightAlphaMin) / 2;
}
for (var _local3 in _local1.highLightList) {
var tileNow = _local1.highLightList[_local3];
if (tileNow.texture != null) {
tileNow.colorObject.setTransform(getColorCX(tileNow.colorx, _local1.highLightper));
}
}
if (_local1.tileShow) {
var _local3 = _local1.tileShowTop;
while (_local3 <= _local1.tileShowBottom) {
var _local2 = _local1.tileShowLeft;
while (_local2 <= _local1.tileShowRight) {
if (_local1.tileMap[_local3][_local2].colorxArray.length == 0) {
_local1.tileMap[_local3][_local2].colorObject.setTransform(_local1.normalColorcx);
}
_local2++;
}
_local3++;
}
}
_local1.changed = false;
}
}
function setHighLight(frequency, frame, alphaMax, alphaMin) {
var _local1 = this;
var _local2 = frame;
var _local3 = alphaMin;
if ((alphaMax >= 0) && (alphaMax <= 100)) {
_local1.highLightAlphaMax = alphaMax;
}
if ((_local3 >= 0) && (_local3 <= 100)) {
_local1.highLightAlphaMin = _local3;
}
if (frequency > 1) {
_local1.highLightFrequency = frequency;
}
if (frequency == 0) {
_local1.highLightFrequency = null;
_local1.highLightper = (_local1.highLightAlphaMax + _local1.highLightAlphaMin) / 2;
}
if (_local2 == 0) {
_local1.frame = 1;
}
if (_local2 > 0) {
_local1.frame = int(_local2);
}
}
function setShadow(hasShadow, shadowColor, shadowAlpha) {
var _local1 = this;
_local1.hasShadowPrev = _local1.hasShadow;
if (hasShadow == true) {
_local1.hasShadow = true;
}
if (hasShadow == false) {
_local1.hasShadow = false;
}
if (shadowColor != null) {
_local1.shadowColor = shadowColor;
}
if (shadowAlpha != null) {
_local1.shadowAlpha = shadowAlpha;
}
if (_local1.hasShadow != _local1.hasShadowPrev) {
if (_local1.hasShadow) {
_local1.normalColorcx = getColorCX(_local1.shadowColor, _local1.shadowAlpha);
} else {
_local1.normalColorcx = OxSLGEngine.nocolor;
}
var _local3 = _local1.tileShowTop;
while (_local3 <= _local1.tileShowBottom) {
var _local2 = _local1.tileShowLeft;
while (_local2 <= _local1.tileShowRight) {
if (_local1.tileMap[_local3][_local2].colorxArray.length == 0) {
_local1.tileMap[_local3][_local2].colorObject.setTransform(_local1.normalColorcx);
}
_local2++;
}
_local3++;
}
}
}
function clearHighLightFlash6() {
var _local1 = this;
for (var _local2 in _local1.highLightList) {
_local1.highLightList[_local2].colorObject.setTransform(_local1.normalColorcx);
_local1.highLightList[_local2].colorxArray = [];
_local1.highLightList[_local2].highLightListId = -1;
}
delete _local1.highLightList;
_local1.highLightList = {};
_local1.highLightListCount = 0;
}
function addHighLightMap(flagArray2D, colorx) {
var _local3 = this;
if (flagArray2D == null) {
trace("TileScene2D.showMoveHighLight(flagArray2D, colorx) \u51FD\u6570\u51FA\u9519: flagArray2D\u662F\u4E00\u4E2A2D\u6570\u7EC4");
} else {
if (colorx == null) {
var colorx = 53055;
}
var newhighLightList = [];
var i = 0;
while (i < _local3.mapHeight) {
var j = 0;
while (j < _local3.mapWidth) {
if (flagArray2D[i][j] == 0) {
var _local1 = _local3.tileMap[i][j];
_local1.colorxArray.push({colorx:colorx});
var length = _local1.colorxArray.length;
colorxNow = 0;
var _local2 = 0;
while (_local2 < _local1.colorxArray.length) {
colorxNow = (colorxNow + (2 * _local1.colorxArray[_local2].colorx)) / 3;
_local2++;
}
_local1.colorx = colorxNow;
_local1.colorObject.setTransform(getColorCX(colorxNow, _local3.highLightper));
if (_local1.highLightListId == -1) {
_local1.highLightListId = _local3.highLightListCount;
_local3.highLightList[_local3.highLightListCount++] = _local1;
}
newhighLightList.push({tileHandle:_local1, colorxArrayItem:_local1.colorxArray[length - 1]});
}
j++;
}
i++;
}
if (newhighLightList.length == 0) {
return(null);
}
return(newhighLightList);
}
return(undefined);
}
function addHighLight(x, y, colorx) {
var _local3 = colorx;
if (_local3 == null) {
_local3 = 65280;
}
var _local2 = this.tileMap[y][x];
if (_local2 == null) {
return(null);
}
_local2.colorxArray.push({colorx:_local3});
var length = _local2.colorxArray.length;
_local3 = _local2.colorxArray[0].colorx;
var _local1 = 1;
while (_local1 < _local2.colorxArray.length) {
_local3 = (_local3 + (2 * _local2.colorxArray[_local1].colorx)) / 3;
_local1++;
}
_local2.colorx = _local3;
_local2.colorObject.setTransform(getColorCX(_local3, this.highLightper));
if (_local2.highLightListId == -1) {
_local2.highLightListId = this.highLightListCount;
this.highLightList[this.highLightListCount++] = _local2;
}
return([{tileHandle:_local2, colorxArrayItem:_local2.colorxArray[length - 1]}]);
}
function deleteHighLight(highLightList) {
if ((!highLightList) instanceof Array) {
trace("TileScene2D.clearHighLightArray(highLightList) \u51FD\u6570\u51FA\u9519: highLightList \u662F addHighLight()\u6216\u8005 addHighLightMap()\u64CD\u4F5C\u7684\u8FD4\u56DE\u503C");
} else {
for (var i in highLightList) {
var _local1 = highLightList[i].tileHandle;
var success = false;
var _local2 = 0;
while (_local2 < _local1.colorxArray.length) {
if (_local1.colorxArray[_local2] == highLightList[i].colorxArrayItem) {
success = true;
break;
}
_local2++;
}
if (success) {
_local1.colorxArray.splice(_local2, 1);
}
if (_local1.colorxArray.length == 0) {
delete this.highLightList[_local1.highLightListId];
_local1.highLightListId = -1;
_local1.colorObject.setTransform(this.normalColorcx);
} else {
var _local3 = 0;
var i = 0;
while (i < _local1.colorxArray.length) {
_local3 = (_local3 + (2 * _local1.colorxArray[i].colorx)) / 3;
i++;
}
_local1.colorx = _local3;
_local1.colorObject.setTransform(getColorCX(_local3, this.highLightper));
}
}
}
}
function sceneSetTo(x, y, scale) {
var _local1 = this;
var _local2 = y;
var _local3 = x;
if (_local3 != null) {
if (_local3 > ((_local1.stageRight - _local1.stageLeft) / 4)) {
_local3 = (_local1.stageRight - _local1.stageLeft) / 4;
}
if (_local3 < (((_local1.stageRight - _local1.stageLeft) * 0.75) - (_local1.scale * _local1.mapWidth))) {
_local3 = ((_local1.stageRight - _local1.stageLeft) * 0.75) - (_local1.scale * _local1.mapWidth);
}
if (_local1.mapScene._x != _local3) {
_local1.mapScene._x = _local3;
}
}
if (_local2 != null) {
if (_local2 > ((_local1.stageBottom - _local1.stageTop) / 4)) {
_local2 = (_local1.stageBottom - _local1.stageTop) / 4;
}
if (_local2 < (((_local1.stageBottom - _local1.stageTop) * 0.75) - (_local1.scale * _local1.mapHeight))) {
_local2 = ((_local1.stageBottom - _local1.stageTop) * 0.75) - (_local1.scale * _local1.mapHeight);
}
if (_local1.mapScene._y != _local2) {
_local1.mapScene._y = _local2;
}
}
if (scale != null) {
_local1.scale = scale;
}
}
function getSceneX() {
return(this.mapScene._x);
}
function getSceneY() {
return(this.mapScene._y);
}
function getSceneScale() {
return(this.scale);
}
function sceneCenterMoveTo(x, y, scale, speed) {
var _local1 = this;
var _local2 = x;
if (_local2 == false) {
_local1.targetX = null;
_local1.targetY = null;
_local1.targetScale = null;
_local1.targetSpeed = null;
}
if (_local2 != null) {
_local1.targetX = int(_local2);
}
if (y != null) {
_local1.targetY = int(y);
}
if (scale != null) {
_local1.targetScale = int(scale);
}
if (speed != null) {
_local1.targetSpeed = int(speed);
}
}
function getTileIndex(screenPosx, screenPosy) {
var _local2 = this;
var _local1 = {};
_local1.x = (screenPosx - _local2.mapScene._x) / _local2.scale;
_local1.y = (screenPosy - _local2.mapScene._y) / _local2.scale;
if ((((_local1.x < 0) || (_local1.x > _local2.mapWidth)) || (_local1.y < 0)) || (_local1.y > _local2.mapHeight)) {
return(null);
}
_local1.x = int(_local1.x);
_local1.y = int(_local1.y);
return(_local1);
}
function getTileCenter(tileIndexX, tileIndexY) {
var _local1 = this;
var _local2 = tileIndexX;
var _local3 = tileIndexY;
_local2 = int(_local2);
_local3 = int(_local3);
return({x:_local1.mapScene._x + ((_local2 + 0.5) * _local1.scale), y:_local1.mapScene._y + ((_local3 + 0.5) * _local1.scale)});
}
function createScrollManager(speed, boundLR, boundUD, left, top, right, bottom) {
var _local1 = this;
if (speed == null) {
trace("new ScrollManager(speed, boundLR, boundUD, left, top, right, bottom) \u51FA\u9519\uFF1A\u9700\u8981\u6307\u5B9A\u4E00\u4E2A\u901F\u5EA6speed");
} else {
_local1.speed = speed;
if (left == null) {
_local1.left = 0;
} else {
_local1.left = left;
}
if (top == null) {
_local1.top = 0;
} else {
_local1.top = top;
}
if (right == null) {
_local1.right = OxSLGEngine.stageWidth;
} else {
_local1.right = right;
}
if (bottom == null) {
_local1.bottom = OxSLGEngine.stageHeight;
} else {
_local1.bottom = bottom;
}
if (_local1.boundLR == null) {
_local1.boundLR = (_local1.right - _local1.left) / 8;
} else {
_local1.boundLR = boundLR;
}
if (_local1.boundUD == null) {
_local1.boundUD = (_local1.bottom - _local1.top) / 8;
} else {
_local1.boundUD = boundUD;
}
}
}
function getScroll(x, y) {
var _local1 = this;
var _local2 = y;
var _local3 = x;
if ((_local3 == null) || (_local2 == null)) {
trace("ScrollManager.getScroll(x, y) \u51FD\u6570\u9519\u8BEF\uFF1A\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A");
} else {
var xinc = 0;
var yinc = 0;
if (_local3 < (_local1.left + _local1.boundLR)) {
xinc = 0.5 * _local1.speed;
}
if (_local3 < (_local1.left + (0.5 * _local1.boundLR))) {
xinc = 0.75 * _local1.speed;
}
if (_local3 < (_local1.left + (0.25 * _local1.boundLR))) {
xinc = _local1.speed;
}
if (_local3 > (_local1.right - _local1.boundLR)) {
xinc = -0.5 * _local1.speed;
}
if (_local3 > (_local1.right - (0.5 * _local1.boundLR))) {
xinc = -0.75 * _local1.speed;
}
if (_local3 > (_local1.right - (0.25 * _local1.boundLR))) {
xinc = -1 * _local1.speed;
}
if (_local2 < (_local1.top + _local1.boundUD)) {
yinc = 0.5 * _local1.speed;
}
if (_local2 < (_local1.top + (0.5 * _local1.boundUD))) {
yinc = 0.75 * _local1.speed;
}
if (_local2 < (_local1.top + (0.25 * _local1.boundUD))) {
yinc = _local1.speed;
}
if (_local2 > (_local1.bottom - _local1.boundUD)) {
yinc = -0.5 * _local1.speed;
}
if (_local2 > (_local1.bottom - (0.5 * _local1.boundUD))) {
yinc = -0.75 * _local1.speed;
}
if (_local2 > (_local1.bottom - (0.25 * _local1.boundUD))) {
yinc = -1 * _local1.speed;
}
return({xinc:xinc, yinc:yinc});
}
return(undefined);
}
function moveSceneCenter(xinc, yinc) {
var _local2 = OxSLGEngine.sceneCenterx;
var _local1 = OxSLGEngine.sceneCentery;
_local2 = _local2 + (OxSLGEngine.mapScrollSpeed * xinc);
_local1 = _local1 + (OxSLGEngine.mapScrollSpeed * yinc);
if (_local2 < 0) {
_local2 = 0;
} else if (_local2 > (OxSLGEngine.mapWidth * OxSLGEngine.scale)) {
_local2 = OxSLGEngine.mapWidth * OxSLGEngine.scale;
}
if (_local1 < 0) {
_local1 = 0;
} else if (_local1 > (OxSLGEngine.mapHeight * OxSLGEngine.scale)) {
_local1 = OxSLGEngine.mapHeight * OxSLGEngine.scale;
}
if ((_local2 != OxSLGEngine.sceneCenterx) || (_local1 != OxSLGEngine.sceneCentery)) {
OxSLGEngine.sceneCenterx = _local2;
OxSLGEngine.sceneCentery = _local1;
reflushScene();
}
}
function TileGrass() {
}
function TileTree() {
}
function TileHouse() {
}
function TileWall() {
}
function TileGround() {
}
function onEnterFrame() {
checkKeyStatus();
if (statusPrev != statusNow) {
statusPrev = statusNow;
initStatus = true;
endStatus = false;
mousePointTo = null;
hint.info = "";
hint.statusNow = "noInfo";
hint._visible = false;
}
this[statusNow + "Func"]();
}
function startPlayerTurnFunc() {
if (initStatus) {
initStatus = false;
turnNow = "playerTurn";
totalTurns++;
for (var _local1 in playerList) {
playerList[_local1].colorObject.setTransform(OxSLGEngine.nocolor);
playerList[_local1].moved = false;
playerList[_local1].attacked = false;
}
for (var _local1 in enemyList) {
enemyList[_local1].colorObject.setTransform(OxSLGEngine.nocolor);
enemyList[_local1].counterstroke = 1;
}
attachMovie("S-PlayerTurn", "\u56DE\u5408\u5207\u6362\u52A8\u753B", 31);
for (var _local1 in playerList) {
tile = map.getSub(playerList[_local1].x, playerList[_local1].y);
hpgain = tileList.getTile(tile).heal / 100;
playerList[_local1].hpNow = playerList[_local1].hpNow + int(hpgain * playerList[_local1].hp);
if (playerList[_local1].hpNow > playerList[_local1].hp) {
playerList[_local1].hpNow = playerList[_local1].hp;
}
}
spcTimeAction();
reflushUnitPic();
}
if (endStatus) {
statusNow = "mapNormal";
if (mainChar) {
setImgPos(mainChar);
}
img.rander();
reflushUnitPic();
}
}
function mapNormalFunc() {
if (initStatus) {
initStatus = false;
unitPointTo = null;
img.clearHighLight();
img.setShadow(false);
}
checkAndMoveMap();
var _local1 = mousePointTo;
mousePointTo = img.getTileIndex(_xmouse, _ymouse);
if ((_local1.x != mousePointTo.x) || (_local1.y != mousePointTo.y)) {
img.deleteHighLight(unitPointToHighLight);
unitPointTo = unitMap[mousePointTo.y][mousePointTo.x];
if (unitPointTo != null) {
if (unitPointTo.side == "enemy") {
var _local2 = enemyColorx;
} else if (unitPointTo.side == "player") {
var _local2 = playerColorx;
}
unitPointToHighLight = img.addHighLight(unitPointTo.x, unitPointTo.y, _local2);
sys0Sound.start();
unitSelectedTo = img.getTileCenter(unitPointTo.x, unitPointTo.y);
currentSelectTo._x = unitSelectedTo.x;
currentSelectTo._y = unitSelectedTo.y;
} else {
currentSelectTo._x = 650;
}
\u5C0F\u72B6\u6001\u680F.reflush(mousePointTo.x, mousePointTo.y);
}
if (keyStatus[1] == "down") {
if (unitPointTo != null) {
unitSelected = unitPointTo;
if ((unitPointTo.attacked == true) || (unitPointTo.side == "enemy")) {
statusNow = "mapShowMoveRange";
} else {
statusNow = "mapShowUnitMenu";
}
sys2Sound.start();
} else if (mousePointTo != null) {
statusNow = "mapShowSystemMenu";
sys2Sound.start();
}
}
img.rander();
}
function mapShowUnitMenuFunc() {
if (initStatus) {
frameNow = 0;
initStatus = false;
img.clearHighLight();
img.setShadow(false);
img.addHighLight(unitSelected.x, unitSelected.y, playerColorx);
attachMovie("S-\u997C\u72B6\u83DC\u5355", "\u997C\u72B6\u83DC\u5355", 20);
menuStartPoint = img.getTileIndex(_xmouse, _ymouse);
var _local3 = img.getTileCenter(menuStartPoint.x, menuStartPoint.y);
\u997C\u72B6\u83DC\u5355._x = _local3.x;
\u997C\u72B6\u83DC\u5355._y = _local3.y;
mouseDragx = _xmouse - img.getX();
mouseDragy = _ymouse - img.getY();
if (unitSelected.moved) {
\u997C\u72B6\u83DC\u5355["\u79FB\u52A8"]._visible = false;
\u997C\u72B6\u83DC\u5355["\u72B6\u6001"]._visible = false;
\u997C\u72B6\u83DC\u5355["\u6CBB\u7597"]._visible = false;
pidArray = ["\u653B\u51FB", "cancel", "cancel", "cancel", "\u7B49\u5F85", "cancel", "cancel"];
} else {
\u997C\u72B6\u83DC\u5355["\u7B49\u5F85"]._visible = false;
pidArray = ["\u653B\u51FB", "\u79FB\u52A8", "cancel", "cancel", "\u72B6\u6001", "\u6CBB\u7597", "\u72B6\u6001"];
var _local1 = false;
if (unitSelected.hp != unitSelected.hpNow) {
_local1 = true;
}
if (!_local1) {
for (var _local2 in unitSelected.spcList) {
if (unitSelected.spcList[_local2].spcType == "spc") {
_local1 = true;
break;
}
}
}
if (!_local1) {
pidArray[5] = "cancel";
\u997C\u72B6\u83DC\u5355["\u6CBB\u7597"]._visible = false;
}
}
maskMenuStatus = "start";
}
maskMenuFunc(selectUnitMaskMenu);
}
function selectUnitMaskMenu() {
removeMovieClip(\u997C\u72B6\u83DC\u5355);
switch (actionNow) {
case "cancel" :
if (!unitSelected.moved) {
statusNow = "mapNormal";
} else {
unitSelected.x = unitPrevx;
unitSelected.y = unitPrevy;
unitSelected.moved = false;
reflushUnitPic();
statusNow = "mapMoveUnit";
}
break;
case "\u79FB\u52A8" :
statusNow = "mapMoveUnit";
break;
case "\u653B\u51FB" :
statusNow = "mapAttackUnit";
break;
case "\u7B49\u5F85" :
unitSelected.attacked = true;
unitSelected.colorObject.setTransform(OxSLGEngine.darken);
unitMap = getUnitMap();
statusNow = "mapNormal";
break;
case "\u72B6\u6001" :
statusNow = "mapShowStatus";
break;
case "\u6CBB\u7597" :
statusNow = "mapHeal";
}
if (actionNow == "cancel") {
sys4Sound.start();
} else {
sys3Sound.start();
}
}
function mapHealFunc() {
if (initStatus) {
initStatus = false;
nowAttack = 0;
attachMovie("S-hpGain", "hpGainMC", 31);
sys7Sound.start();
var _local2 = int(unitSelected.hp / 3);
unitSelected.hpNow = unitSelected.hpNow + _local2;
if (unitSelected.hpNow > unitSelected.hp) {
_local2 = _local2 - (unitSelected.hpNow - unitSelected.hp);
unitSelected.hpNow = unitSelected.hp;
}
hpGainMC.hpGain.hpGain = "+" + _local2;
pos = img.getTileCenter(unitSelected.x, unitSelected.y);
hpGainMC._x = pos.x;
hpGainMC._y = pos.y;
for (var _local1 in unitSelected.spcList) {
if (unitSelected.spcList[_local1].pic != null) {
removeMovieClip(unitSelected.spcList[_local1].pic);
}
}
unitSelected.spcList = [];
}
if (nowAttack == 1) {
endStatus = true;
unitSelected.colorObject.setTransForm(OxSLGEngine.darken);
unitSelected.attacked = true;
}
if (endStatus) {
switch (turnNow) {
case "playerTurn" :
statusNow = "mapNormal";
return;
case "enemyTurn" :
statusNow = "enemyTurn";
}
}
}
function mapMoveUnitFunc() {
if (initStatus) {
initStatus = false;
unitPrevx = unitSelected.x;
unitPrevy = unitSelected.y;
showMoveRange();
}
checkAndMoveMap();
reflushMousePointTo();
img.deleteHighLight(highLightHandel);
if ((unitPointTo == unitSelected) || (moveRangeMap[mousePointTo.y][mousePointTo.x] != 0)) {
hint.info = "\u53D6\u6D88";
mouseTo._x = -150;
} else if (moveRangeMap[mousePointTo.y][mousePointTo.x] == 0) {
highLightHandel = img.addHighLight(mousePointTo.x, mousePointTo.y, moveToColorx);
var _local1 = img.getTileCenter(mousePointTo.x, mousePointTo.y);
mouseTo._x = _local1.x;
mouseTo._y = _local1.y;
hint.info = "\u79FB\u52A8";
}
if (keyStatus[1] == "down") {
mouseTo._x = -150;
if ((unitPointTo == unitSelected) || (moveRangeMap[mousePointTo.y][mousePointTo.x] != 0)) {
img.setShadow(false);
img.clearHighLight();
statusNow = "mapNormal";
unitPointTo = null;
sys4Sound.start();
} else if (moveRangeMap[mousePointTo.y][mousePointTo.x] == 0) {
unitSelected.moved = true;
unitSelected.x = mousePointTo.x;
unitSelected.y = mousePointTo.y;
reflushUnitPic();
img.clearHighLight();
img.addHighLight(unitSelected.x, unitSelected.y, playerColorx);
statusNow = "mapShowUnitMenu";
sys2Sound.start();
}
}
img.rander();
}
function mapShowStatusFunc() {
if (initStatus) {
initStatus = false;
attachMovie("S-\u72B6\u6001", "\u72B6\u6001", 32);
_root["\u524D\u666F\u8272"]._visible = true;
\u5C0F\u72B6\u6001\u680F.reflush();
img.rander();
}
if (keyStatus[1] == "down") {
if (!\u72B6\u6001.hit.hitTest(_xmouse, _ymouse)) {
endStatus = true;
}
}
if (keyStatus[27] == "down") {
endStatus = true;
}
if (endStatus) {
_root["\u524D\u666F\u8272"]._visible = false;
endStatus = false;
removeMovieClip(\u72B6\u6001);
statusNow = "mapNormal";
}
}
function mapShowMoveRangeFunc() {
if (initStatus) {
initStatus = false;
showMoveRange();
}
checkAndMoveMap();
reflushMousePointTo();
if (keyStatus[1] == "down") {
if (unitPointTo == unitSelected) {
statusNow = "mapShowStatus";
} else if ((unitPointTo.side == "player") && (!unitPointTo.attacked)) {
unitSelected = unitPointTo;
statusNow = "mapShowUnitMenu";
sys2Sound.start();
} else if (unitPointTo != null) {
unitSelected = unitPointTo;
initStatus = true;
sys2Sound.start();
} else {
statusNow = "mapNormal";
sys4Sound.start();
}
}
img.rander();
}
function mapAttackUnitFunc() {
if (initStatus) {
initStatus = false;
img.clearHighLight();
img.setShadow(true);
attackRangeMap = getAttackRangeMap(unitSelected);
img.addHighLightMap(attackRangeMap, attackColorx);
img.addHighLight(unitSelected.x, unitSelected.y, playerColorx);
attachMovie("S-\u653B\u51FB\u72B6\u6001\u680F", "\u653B\u51FB\u72B6\u6001\u680F", 32);
\u653B\u51FB\u72B6\u6001\u680F._x = 275;
\u653B\u51FB\u72B6\u6001\u680F._y = 284.1;
\u5C0F\u72B6\u6001\u680F._visible = false;
}
checkAndMoveMap();
reflushMousePointTo();
if (attackRangeMap[mousePointTo.y][mousePointTo.x] == 0) {
if (unitPointTo.side == "enemy") {
hint.info = "\u653B\u51FB";
invoidTarget._x = -100;
} else if (unitPointTo.side == "player") {
hint.info = "\u53CB\u519B";
} else {
hint.info = "\u6CA1\u6709\u76EE\u6807";
}
} else {
hint.info = "\u53D6\u6D88";
}
if ((mousePointTo == null) || (attackRangeMap[mousePointTo.y][mousePointTo.x] != 0)) {
mouseAttackTo._x = -150;
invoidTarget._x = -150;
} else if (hint.info == "\u653B\u51FB") {
invoidTarget._x = -150;
var _local1 = img.getTileCenter(mousePointTo.x, mousePointTo.y);
mouseAttackTo._x = _local1.x;
mouseAttackTo._y = _local1.y;
} else {
var _local1 = img.getTileCenter(mousePointTo.x, mousePointTo.y);
mouseAttackTo._x = -150;
invoidTarget._x = _local1.x;
invoidTarget._y = _local1.y;
}
if (keyStatus[1] == "down") {
if ((unitPointTo == unitSelected) || (attackRangeMap[mousePointTo.y][mousePointTo.x] != 0)) {
if (!unitSelected.moved) {
statusNow = "mapNormal";
endStatus = true;
} else {
unitSelected.x = unitPrevx;
unitSelected.y = unitPrevy;
unitSelected.moved = false;
reflushUnitPic();
statusNow = "mapMoveUnit";
endStatus = true;
}
sys4Sound.start();
} else if (attackRangeMap[mousePointTo.y][mousePointTo.x] == 0) {
if (unitPointTo.side == "enemy") {
targetSelected = unitPointTo;
statusNow = "attackMovie";
endStatus = true;
}
sys2Sound.start();
}
}
img.rander();
if (endStatus) {
invoidTarget._x = -150;
mouseAttackTo._x = -150;
if (statusNow != "attackMovie") {
\u653B\u51FB\u72B6\u6001\u680F.removeMovieClip();
\u5C0F\u72B6\u6001\u680F.visible = true;
}
}
}
function mapShowSystemMenuFunc() {
if (initStatus) {
initStatus = false;
maskMenuStatus = "start";
attachMovie("S-\u997C\u72B6\u4E3B\u83DC\u5355", "\u997C\u72B6\u83DC\u5355", 20);
menuStartPoint = img.getTileIndex(_xmouse, _ymouse);
var _local1 = img.getTileCenter(menuStartPoint.x, menuStartPoint.y);
\u997C\u72B6\u83DC\u5355._x = _local1.x;
\u997C\u72B6\u83DC\u5355._y = _local1.y;
mouseDragx = _xmouse - img.getX();
mouseDragy = _ymouse - img.getY();
pidArray = ["\u53D6\u6863", "\u5B58\u6863", "cancel", "cancel", "\u56DE\u5408\u7ED3\u675F", "cancel"];
}
maskMenuFunc(selectSystemMaskMenu);
}
function selectSystemMaskMenu() {
removeMovieClip(\u997C\u72B6\u83DC\u5355);
switch (actionNow) {
case "\u5B58\u6863" :
case "\u53D6\u6863" :
case "cancel" :
statusNow = "mapNormal";
sys4Sound.start();
return;
case "\u56DE\u5408\u7ED3\u675F" :
statusNow = "startEnemyTurn";
sys2Sound.start();
}
}
function startEnemyTurnFunc() {
if (initStatus) {
img.rander();
checkAndMoveMap();
initStatus = false;
for (var _local1 in enemyList) {
enemyList[_local1].moved = false;
enemyList[_local1].attacked = false;
enemyList[_local1].colorObject.setTransform(OxSLGEngine.nocolor);
}
for (var _local1 in playerList) {
playerList[_local1].colorObject.setTransform(OxSLGEngine.nocolor);
playerList[_local1].counterstroke = 1;
}
for (var _local1 in enemyList) {
tile = map.getSub(enemyList[_local1].x, enemyList[_local1].y);
hpgain = tileList.getTile(tile).heal / 100;
enemyList[_local1].hpNow = enemyList[_local1].hpNow + int(hpgain * enemyList[_local1].hp);
if (enemyList[_local1].hpNow > enemyList[_local1].hp) {
enemyList[_local1].hpNow = enemyList[_local1].hp;
}
}
spcTimeAction();
attachMovie("S-EnemyTurn", "\u56DE\u5408\u5207\u6362\u52A8\u753B", 31);
reflushUnitPic();
}
if (endStatus) {
statusNow = "enemyTurn";
}
}
function enemyTurnFunc() {
if (initStatus) {
initStatus = false;
if (enemyTurnEnd) {
enemyTurnEnd = false;
turnNow = "enemyTurn";
enemyStack = [];
for (var _local1 in enemyList) {
enemyStack.push(enemyList[_local1]);
}
}
subStatus = "next";
nextEnemy = true;
}
switch (subStatus) {
case "next" :
unitMap = getUnitMap();
if (nextEnemy) {
if (enemyStack.length == 0) {
endStatus = true;
// unexpected jump
}
unitSelected = enemyStack.pop();
nextEnemy = false;
// unexpected jump
}
nextEnemy = true;
bestTarget = highestDamage(unitSelected);
if (bestTarget == null) {
var targetSelected = null;
var distanceNow = Infinity;
for (var _local1 in playerList) {
var _local2 = Math.abs(playerList[_local1].x - unitSelected.x) + Math.abs(playerList[_local1].y - unitSelected.y);
if (_local2 < distanceNow) {
_local2 = distanceNow;
targetSelected = playerList[_local1];
}
}
passFunc = function (xto, yto) {
if ((xto == targetSelected.x) && (yto == targetSelected.y)) {
return(true);
}
return(landForcePassFunc(xto, yto));
};
movePathNow = map.getPath(unitSelected.x, unitSelected.y, targetSelected.x, targetSelected.y, moveCostList, passFunc);
if (movePathNow == null) {
subStatus = "next";
return;
}
getMoveRangeMap();
var _local3 = movePathNow.length - 1;
var _local1 = 0;
while (_local1 < movePathNow.length) {
if (moveRangeMap[movePathNow[_local1].y][movePathNow[_local1].x] != 0) {
_local3 = _local1 - 1;
break;
}
_local1++;
}
_local1 = _local3;
while (_local1 >= 0) {
if ((_local1 == 0) || (unitMap[movePathNow[_local1].y][movePathNow[_local1].x] == null)) {
_local3 = _local1;
break;
}
_local1--;
}
bestTarget = {xto:movePathNow[_local3].x, yto:movePathNow[_local3].y};
}
subStatus = "move";
// unexpected jump
case "move" :
unitSelected.x = bestTarget.xto;
unitSelected.y = bestTarget.yto;
if (bestTarget.targetSelected != null) {
subStatus = "attack";
} else {
unitSelected.moved = true;
unitSelected.colorObject.setTransform(OxSLGEngine.darken);
subStatus = "next";
}
// unexpected jump
case "attack" :
unitMap = getUnitMap();
targetSelected = bestTarget.targetSelected;
statusNow = "attackMovie";
attachMovie("S-\u653B\u51FB\u72B6\u6001\u680F", "\u653B\u51FB\u72B6\u6001\u680F", 32);
\u653B\u51FB\u72B6\u6001\u680F._x = 275;
\u653B\u51FB\u72B6\u6001\u680F._y = 284.1;
\u5C0F\u72B6\u6001\u680F._visible = false;
default :
if (endStatus) {
statusNow = "startPlayerTurn";
enemyTurnEnd = true;
}
setImgPos(unitSelected);
unitSelectedTo = img.getTileCenter(unitSelected.x, unitSelected.y);
currentSelectTo._x = unitSelectedTo.x;
currentSelectTo._y = unitSelectedTo.y;
reflushUnitPic();
img.rander();
}
}
function setImgPos(unit) {
var _local2 = unit.x * gameScale;
var _local1 = unit.y * gameScale;
img.setTo(275 - _local2, 200 - _local1);
}
function attackMovieFunc() {
if (initStatus) {
initStatus = false;
nowAttack = 0;
}
switch (nowAttack) {
case 0 :
nowAttack++;
attackInit(unitSelected, unitSelected.x, unitSelected.y, targetSelected, targetSelected.x, targetSelected.y);
if ((100 * Math.random()) < tohit) {
var _local1 = damage;
targetSelected.hpNow = targetSelected.hpNow - damage;
if (targetSelected.hpNow < 0) {
targetSelected.hpNow = 0;
}
addSpc(targetSelected, special, timeCount);
\u653B\u51FB\u72B6\u6001\u680F.reflush(targetSelected.x, targetSelected.y);
} else {
var _local1 = "miss";
}
attachMovie("S-hpLose", "hpLose", 31);
hpLose.hpLose.hpLose = _local1;
pos = img.getTileCenter(targetSelected.x, targetSelected.y);
hpLose._x = pos.x;
hpLose._y = pos.y;
if (_local1 != "miss") {
hit0Sound.start();
} else {
missSound.start();
}
break;
case 2 :
unitSelected.attacked = true;
unitSelected.colorObject.setTransform(OxSLGEngine.darken);
if (targetSelected.hpNow == 0) {
removeUnit(targetSelected);
}
unitMap = getUnitMap();
attackInit(targetSelected, targetSelected.x, targetSelected.y, unitSelected, unitSelected.x, unitSelected.y);
if (counterstrokeAble) {
targetSelected.counterstroke--;
nowAttack++;
if ((100 * Math.random()) < tohit) {
var _local1 = damage;
unitSelected.hpNow = unitSelected.hpNow - damage;
if (unitSelected.hpNow < 0) {
unitSelected.hpNow = 0;
}
addSpc(unitSelected, special, timeCount);
\u653B\u51FB\u72B6\u6001\u680F.reflushBasic(1, unitSelected.x, unitSelected.y);
} else {
var _local1 = "miss";
}
attachMovie("S-hpLose", "hpLose", 31);
hpLose.hpLose.hpLose = _local1;
pos = img.getTileCenter(unitSelected.x, unitSelected.y);
hpLose._x = pos.x;
hpLose._y = pos.y;
if (_local1 != "miss") {
hit0Sound.start();
} else {
missSound.start();
}
} else {
nowAttack = 4;
break;
}
break;
case 4 :
if (unitSelected.hpNow == 0) {
removeUnit(unitSelected);
}
if (targetSelected.counterstroke <= 0) {
targetSelected.colorObject.setTransform(OxSLGEngine.darken);
}
endStatus = true;
}
if (endStatus) {
removeMovieClip(\u653B\u51FB\u72B6\u6001\u680F);
var _local2 = checkGameResult();
if (_local2 == "win") {
statusNow = "mapWin";
} else if (_local2 == "lose") {
statusNow = "mapLose";
} else {
\u5C0F\u72B6\u6001\u680F._visible = true;
switch (turnNow) {
case "playerTurn" :
statusNow = "mapNormal";
return;
case "enemyTurn" :
statusNow = "enemyTurn";
}
}
}
}
function checkGameResult() {
playerNumLeft = 0;
enemyNumLeft = 0;
for (var _local1 in playerList) {
playerNumLeft++;
}
for (var _local1 in enemyList) {
enemyNumLeft++;
}
if (playerNumLeft == 0) {
return("lose");
}
if (enemyNumLeft == 0) {
return("win");
}
return(undefined);
}
function mapWinFunc() {
if (initStatus) {
initStatus = false;
unitPointTo = null;
img.clearHighLight();
img.setShadow(false);
attachMovie("S-VictoryMovie", "VictoryMovie", 31);
}
if (VictoryMovie._currentframe == VictoryMovie._totalframes) {
clearAllPic();
}
}
function mapLoseFunc() {
if (initStatus) {
initStatus = false;
unitPointTo = null;
img.clearHighLight();
img.setShadow(false);
attachMovie("S-GameOverMovie", "GameOverMovie", 31);
}
if (GameOverMovie._currentframe == GameOverMovie._totalframes) {
clearAllPic();
}
}
function clearAllPic() {
}
function addEnemy(info, tileX, tileY) {
var _local2 = info;
var _local1 = {};
_local1.unitCount = unitCount;
_local1.side = "enemy";
for (var _local3 in _local2) {
_local1[_local3] = _local2[_local3];
}
_local1.pic = unitLayer.attachMovie(_local1.linkName, "enemy" + unitCount, unitCount);
_local1.colorObject = new Color(_local1.pic);
_local1.x = tileX;
_local1.y = tileY;
_local1.hpNow = _local1.hp;
_local1.mpNow = _local1.mp;
_local1.spcList = [];
for (var _local3 in _local1.skillList) {
addSpc(_local1, _local1.skillList[_local3], Infinity);
}
enemyList[unitCount] = _local1;
unitCount++;
enemyNumTotal++;
}
function addPlayer(info, tileX, tileY) {
var _local2 = info;
var _local1 = {};
_local1.unitCount = unitCount;
_local1.side = "player";
for (var _local3 in _local2) {
_local1[_local3] = _local2[_local3];
}
_local1.pic = unitLayer.attachMovie(_local1.linkName, "player" + unitCount, unitCount);
_local1.colorObject = new Color(_local1.pic);
_local1.x = tileX;
_local1.y = tileY;
_local1.hpNow = _local1.hp;
_local1.mpNow = _local1.mp;
_local1.weight = null;
_local1.spcList = [];
for (var _local3 in _local1.skillList) {
addSpc(_local1, _local1.skillList[_local3], Infinity);
}
playerList[unitCount] = _local1;
unitCount++;
playerNumTotal++;
}
function removeUnit(handel) {
var _local1 = handel;
removeMovieClip(_local1.pic);
if (_local1.side == "enemy") {
delete enemyList[_local1.unitCount];
} else {
delete playerList[_local1.unitCount];
}
unitMap = getUnitMap();
}
function getUnitMap() {
var _local1 = createMap(map.getWidth(), map.getHeight());
for (var _local2 in enemyList) {
_local1[enemyList[_local2].y][enemyList[_local2].x] = enemyList[_local2];
}
for (var _local2 in playerList) {
_local1[playerList[_local2].y][playerList[_local2].x] = playerList[_local2];
}
return(_local1);
}
function checkKeyStatus() {
for (var _local2 in keyNowArray) {
var _local1 = keyNowArray[_local2];
switch (keyStatus[_local1]) {
case "unpressed" :
if (Key.isDown(_local1)) {
keyStatus[_local1] = "down";
}
break;
case "down" :
if (Key.isDown(_local1)) {
keyStatus[_local1] = "pressed";
} else if (!Key.isDown(_local1)) {
keyStatus[_local1] = "up";
}
break;
case "pressed" :
if (!Key.isDown(_local1)) {
keyStatus[_local1] = "up";
}
break;
case "up" :
if (Key.isDown(_local1)) {
keyStatus[_local1] = "down";
} else {
if (Key.isDown(_local1)) {
break;
}
keyStatus[_local1] = "unpressed";
}
}
}
}
function addSpc(unit, spc, timeCount) {
var _local1 = unit;
var _local2 = spc;
if (_local2 == null) {
} else if ((_local1 == null) || (timeCount == null)) {
trace("addSpc \u51FD\u6570\u51FA\u9519!");
} else {
for (var _local3 in _local1.spcList) {
if (_local1.spcList[_local3].specialName == _local2.specialName) {
if (_local1.spcList[_local3].timeCount < timeCount) {
_local1.spcList[_local3].timeCount = timeCount;
}
return;
}
}
newSpc = {timeCount:timeCount};
for (var _local3 in _local2) {
newSpc[_local3] = _local2[_local3];
}
_local1.spcList.unshift(newSpc);
if (_local2.spcType != "skill") {
if (_local1.spcList[3].pic != null) {
removeMovieClip(_local1.spcList[1].pic);
_local1.spcList[3].pic = null;
}
if (_local1.spcList[2].pic != null) {
_local1.spcList[2].pic.swapDepths(2);
_local1.spcList[2].pic._y = 50;
}
if (_local1.spcList[1].pic != null) {
_local1.spcList[1].pic.swapDepths(1);
_local1.spcList[1].pic._y = 25;
}
_local1.pic.attachMovie(_local1.spcList[0].linkName, "pic" + _local1.spcList[0].specialName, 0);
_local1.spcList[0].pic = _local1.pic["pic" + _local1.spcList[0].specialName];
}
}
}
function spcTimeAction() {
listNow = playerList;
finished = false;
while (!finished) {
for (var _local2 in listNow) {
spliceList = [];
for (var _local1 in listNow[_local2].spcList) {
listNow[_local2].spcList[_local1].timeCount--;
if (listNow[_local2].spcList[_local1].timeCount <= 0) {
if (listNow[_local2].spcList[_local1].pic != null) {
removeMovieClip(listNow[_local2].spcList[_local1].pic);
}
spliceList.push(_local1);
}
}
for (var _local1 in spliceList) {
listNow[_local2].spcList.splice(spliceList[_local1], 1);
}
showSpcPic(listNow[_local2]);
}
if (listNow == enemyList) {
finished = true;
}
listNow = enemyList;
}
}
function showSpcPic(unit) {
var _local2 = unit;
var _local1 = 0;
while (_local1 < _local2.spcList.length) {
if (_local2.spcList[_local1].pic == null) {
_local2.pic.attachMovie(_local2.spcList[_local1].linkName, "pic" + _local2.spcList[_local1].specialName, _local1);
_local2.spcList[_local1].pic = _local2.pic["pic" + _local2.spcList[_local1].specialName];
_local2.pic._y = 25 * _local1;
}
_local1++;
}
}
function maskMenuFunc(maskMenuHandel) {
var _local3 = maskMenuHandel;
frameNow++;
checkAndMoveMap();
\u997C\u72B6\u83DC\u5355[actionNow].gotoAndStop(1);
mousePointTo = img.getTileIndex(_xmouse, _ymouse);
if ((mousePointTo.x == menuStartPoint.x) && (mousePointTo.y == menuStartPoint.y)) {
actionNow = "cancel";
} else {
var _local2 = img.getTileCenter(menuStartPoint.x, menuStartPoint.y);
var _local1 = Math.atan2(_local2.y - _ymouse, _local2.x - _xmouse);
if ((_local1 >= 0) && (_local1 <= 1.0471975511966)) {
pid = 0;
}
if ((_local1 >= 1.0471975511966) && (_local1 <= 2.0943951023932)) {
pid = 1;
}
if ((_local1 >= 2.0943951023932) && (_local1 <= Math.PI)) {
pid = 2;
}
if ((_local1 <= 0) && (_local1 >= -1.0471975511966)) {
pid = 3;
}
if ((_local1 <= -1.0471975511966) && (_local1 >= -2.0943951023932)) {
pid = 4;
}
if ((_local1 <= -2.0943951023932) && (_local1 >= -3.14159265358979)) {
pid = 5;
}
actionNow = pidArray[pid];
}
\u997C\u72B6\u83DC\u5355[actionNow].gotoAndStop(2);
hint.info = \u997C\u72B6\u83DC\u5355[actionNow].info;
mouseDragPic.clear();
mouseDragPic.lineStyle(2, 4194111, 100);
mouseDragPic.moveTo(mouseDragx + img.getX(), mouseDragy + img.getY());
if (maskMenuStatus == "start") {
if (keyStatus[1] == "up") {
maskMenuStatus = "waitForDoubleClick";
}
if ((Math.abs((mouseDragx + img.getX()) - _xmouse) > 20) || (Math.abs((mouseDragy + img.getY()) - _ymouse) > 20)) {
maskMenuStatus = "waitForUp";
}
} else if (maskMenuStatus == "waitForDoubleClick") {
if ((Math.abs((mouseDragx + img.getX()) - _xmouse) > 20) || (Math.abs((mouseDragy + img.getY()) - _ymouse) > 20)) {
maskMenuStatus = "waitForClick";
} else if (keyStatus[1] == "down") {
actionNow = pidArray[6];
mouseDragPic.clear();
_local3();
} else if (frameNow > 15) {
maskMenuStatus = "waitForClick";
}
} else if ((maskMenuStatus == "waitForClick") && (keyStatus[1] == "down")) {
mouseDragPic.clear();
_local3();
} else if ((maskMenuStatus == "waitForUp") && (keyStatus[1] == "up")) {
mouseDragPic.clear();
_local3();
}
if (unitSelected) {
unitSelectedTo = img.getTileCenter(unitSelected.x, unitSelected.y);
currentSelectTo._x = unitSelectedTo.x;
currentSelectTo._y = unitSelectedTo.y;
}
img.rander();
}
function checkAndMoveMap() {
scrollInc = mouseScroll.getScroll(_xmouse, _ymouse);
var _local1 = scrollInc.xinc;
var _local2 = scrollInc.yinc;
if (Key.isDown(16)) {
_local1 = _local1 * 2;
_local2 = _local2 * 2;
}
if (((_local1 != 0) || (_local2 != 0)) || (mapRepaint)) {
mapRepaint = false;
var _local3 = (mapScrollSpeed * 0.06) * img.getScale();
img.setTo(img.getX() + (_local3 * _local1), img.getY() + (_local3 * _local2));
reflushUnitPic();
if (\u997C\u72B6\u83DC\u5355 != null) {
var pos = img.getTileCenter(menuStartPoint.x, menuStartPoint.y);
\u997C\u72B6\u83DC\u5355._x = pos.x;
\u997C\u72B6\u83DC\u5355._y = pos.y;
}
}
}
function reflushUnitPic() {
var imgxNow = img.getX();
var imgyNow = img.getY();
var _local1 = img.getScale();
for (var _local3 in enemyList) {
var _local2 = img.getTileCenter(enemyList[_local3].x, enemyList[_local3].y);
enemyList[_local3].pic._x = _local2.x;
enemyList[_local3].pic._y = _local2.y;
enemyList[_local3].pic._xscale = _local1;
enemyList[_local3].pic._yscale = _local1;
}
for (var _local3 in playerList) {
var _local2 = img.getTileCenter(playerList[_local3].x, playerList[_local3].y);
playerList[_local3].pic._x = _local2.x;
playerList[_local3].pic._y = _local2.y;
playerList[_local3].pic._xscale = -1 * _local1;
playerList[_local3].pic._yscale = _local1;
}
}
function showMoveRange() {
img.clearHighLight();
getMoveRangeMap();
img.addHighLightMap(moveRangeMap, moveColorx);
var _local1 = getFullAttackRangeMap(unitSelected);
for (var _local3 in moveRangeMap) {
for (var _local2 in moveRangeMap[_local3]) {
if (moveRangeMap[_local3][_local2] == 0) {
_local1[_local3][_local2] = -1;
}
}
}
allyList = this[unitSelected.side + "List"];
for (var _local3 in allyList) {
_local1[allyList[_local3].y][allyList[_local3].x] = -1;
}
img.setShadow(true);
img.addHighLightMap(_local1, attackColorx);
img.addHighLight(unitSelected.x, unitSelected.y, this[unitSelected.side + "Colorx"]);
}
function landForcePassFunc(x, y) {
if ((unitMap[y][x].side == null) || (unitMap[y][x].side == unitSelected.side)) {
return(true);
}
return(false);
}
function showAttackRange() {
}
function reflushMousePointTo() {
var _local1 = mousePointTo;
mousePointTo = img.getTileIndex(_xmouse, _ymouse);
if ((_local1.x != mousePointTo.x) || (_local1.y != mousePointTo.y)) {
img.deleteHighLight(unitPointToHighLight);
unitPointTo = unitMap[mousePointTo.y][mousePointTo.x];
if (unitPointTo != null) {
if (unitPointTo.side == "enemy") {
var _local2 = enemyColorx;
} else if (unitPointTo.side == "player") {
var _local2 = playerColorx;
}
unitPointToHighLight = img.addHighLight(unitPointTo.x, unitPointTo.y, _local2);
}
if (statusNow == "mapAttackUnit") {
\u653B\u51FB\u72B6\u6001\u680F.reflush(mousePointTo.x, mousePointTo.y);
} else {
\u5C0F\u72B6\u6001\u680F.reflush(mousePointTo.x, mousePointTo.y);
}
}
if (unitSelected) {
unitSelectedTo = img.getTileCenter(unitSelected.x, unitSelected.y);
currentSelectTo._x = unitSelectedTo.x;
currentSelectTo._y = unitSelectedTo.y;
}
}
function getAttackRangeMap(unit) {
var x = unit.x;
var y = unit.y;
if (unit.weapon == undefined) {
var attackType = "combat";
var range = 1;
var minRange = 1;
} else {
var attackType = unit.weapon.attackType;
var range = unit.weapon.range;
var minRange = unit.weapon.minRange;
if (minRange == null) {
minRange = 1;
}
}
var _local3 = createMap(map.getWidth(), map.getHeight(), -1);
var _local2 = minRange;
while (_local2 <= range) {
var _local1 = 0;
while (_local1 < _local2) {
_local3[(y - _local2) + _local1][x + _local1] = 0;
_local3[y + _local1][(x + _local2) - _local1] = 0;
_local3[(y + _local2) - _local1][x - _local1] = 0;
_local3[y - _local1][(x - _local2) + _local1] = 0;
_local1++;
}
_local2++;
}
return(_local3);
}
function highestDamage(unit) {
var attackRangeMap = getFullAttackRangeMap(unit);
var maxWeight = (-Infinity);
bestTarget = null;
for (var i in playerList) {
playerList[i].weight = null;
if (attackRangeMap[playerList[i].y][playerList[i].x] == 0) {
var _local1 = createMap(map.getWidth(), map.getHeight(), -1);
var x = playerList[i].x;
var _local3 = playerList[i].y;
var range = unit.weapon.range;
var minRange = unit.weapon.minRange;
if (minRange == null) {
minRange = 1;
}
var i2 = minRange;
while (i2 <= range) {
var j2 = 0;
while (j2 < i2) {
_local1[(_local3 - i2) + j2][x + j2] = 0;
_local1[_local3 + j2][(x + i2) - j2] = 0;
_local1[(_local3 + i2) - j2][x - j2] = 0;
_local1[_local3 - j2][(x - i2) + j2] = 0;
j2++;
}
i2++;
}
for (var i2 in moveRangeMap) {
for (var j2 in moveRangeMap[i2]) {
if ((moveRangeMap[i2][j2] == 0) && (_local1[i2][j2] == 0)) {
attackInit(unitSelected, j2, i2, playerList[i], playerList[i].x, playerList[i].y);
var _local2 = damage * tohit;
if (counterstrokeAble) {
attackInit(playerList[i], playerList[i].x, playerList[i].y, unitSelected, j2, i2);
_local2 = _local2 - ((damage * tohit) / 2);
}
if (_local2 > maxWeight) {
maxWeight = _local2;
bestTarget = {xto:int(j2), yto:int(i2), targetSelected:playerList[i]};
}
}
}
}
}
}
return(bestTarget);
}
function attackInit(from, fromx, fromy, to, tox, toy) {
var _local1 = from;
var _local2 = to;
damageType = "\u7269\u7406\u4F24\u5BB3";
atk = _local1.atk;
def = _local2.def;
mdef = _local2.mdef;
if (_local1.weapon != null) {
damageType = _local1.weapon.damageType;
atk = atk + _local1.weapon.atk;
}
if (_local2.armor != null) {
def = def + _local2.armor.def;
mdef = mdef + _local2.armor.mdef;
}
if (damageType == "\u9B54\u6CD5\u4F24\u5BB3") {
def = mdef;
}
landEffect = (100 - defExMap[toy][tox]) / 100;
damage = int((atk - def) * landEffect);
tohit = _local1.tohit - _local2.dodge;
for (var _local3 in _local1.spcList) {
if (_local1.spcList[_local3].effect.weaponTohit && (_local1.weapon != null)) {
tohit = tohit + _local1.spcList[_local3].effect.weaponTohit;
}
if (_local1.spcList[_local3].effect.damage) {
damage = damage + _local1.spcList[_local3].effect.damage;
}
}
for (var _local3 in _local2.spcList) {
if (_local2.spcList[_local3].effect.dodgeShoot && (_local1.weapon.attackType == "shoot")) {
tohit = tohit - _local2.spcList[_local3].effect.dodgeShoot;
}
}
if (tohit < 0) {
tohit = 0;
}
if (tohit > 100) {
tohit = 100;
}
if (damage <= 0) {
damage = 0;
}
special = null;
if (_local1.weapon.special != null) {
special = _local1.weapon.special;
if (_local2.unitType == hero) {
timeCount = special.timeForHero;
} else {
timeCount = special.timeForUnit;
}
}
counterstrokeAble = true;
if ((_local1.hpNow == 0) || (_local1.counterstroke <= 0)) {
counterstrokeAble = false;
}
var rangeMap = getAttackRangeMap(_local1);
if (rangeMap[_local2.y][_local2.x] != 0) {
counterstrokeAble = false;
}
}
function getFullAttackRangeMap(unit) {
if (unit == null) {
} else {
getMoveRangeMap();
for (var i in foeList) {
moveRangeMap[foeList[i].y][foeList[i].x] = -1;
}
for (var i in allyList) {
moveRangeMap[allyList[i].y][allyList[i].x] = -1;
}
moveRangeMap[unit.y][unit.x] = 0;
var x = unit.x;
var _local3 = unit.y;
if (unit.weapon == undefined) {
var attackType = "combat";
var range = 1;
var minRange = 1;
} else {
var attackType = unit.weapon.attackType;
var range = unit.weapon.range;
var minRange = unit.weapon.minRange;
if (minRange == null) {
minRange = 1;
}
}
var attackRangeMap = createMap(map.getWidth(), map.getHeight(), -1);
var rangeMap = createMap(map.getWidth(), map.getHeight(), -1);
for (var i in moveRangeMap) {
for (var j in moveRangeMap[i]) {
if (moveRangeMap[i][j] != 0) {
continue;
}
var x = int(j);
_local3 = int(i);
var _local2 = minRange;
while (_local2 <= range) {
var _local1 = 0;
while (_local1 < _local2) {
rangeMap[(_local3 - _local2) + _local1][x + _local1] = 0;
rangeMap[_local3 + _local1][(x + _local2) - _local1] = 0;
rangeMap[(_local3 + _local2) - _local1][x - _local1] = 0;
rangeMap[_local3 - _local1][(x - _local2) + _local1] = 0;
_local1++;
}
_local2++;
}
}
}
return(rangeMap);
}
return(undefined);
}
function getMoveRangeMap() {
moveCostList = tileList.getSub(unitSelected.mvType + "MoveCost");
if (unitSelected.side == "player") {
allyList = playerList;
foeList = enemyList;
} else {
allyList = enemyList;
foeList = playerList;
}
passFunc = landForcePassFunc;
mv = unitSelected.mv;
for (var _local1 in unitSelected.spcList) {
if (unitSelected.spcList[_local1].effect.mv != null) {
mv = mv + unitSelected.spcList[_local1].effect.mv;
}
}
if (mv < 0) {
mv = 0;
}
moveRangeMap = map.checkMoveRange(unitSelected.x, unitSelected.y, mv, moveCostList, passFunc);
}
function getBestPoseToAttack(x, y, moveRangeMap) {
}
create2DArray = create2DArray;
createMap = create2DArray;
trace2DArray = trace2DArray;
traceMap = trace2DArray;
getColorCX = getColorCX;
TileList = createTileList;
TileList.prototype.push = addtoTileList;
TileList.prototype.clear = clearTileList;
TileList.prototype.getSub = listPorpertyFromTileList;
TileList.prototype.getTile = getTile;
TileList.prototype.getLength = getTileListLen;
TileList.prototype.toString = tileListtoString;
Map = createTileMap;
Map.prototype.setSub = setTileMap;
Map.prototype.getSub = getTileMap;
Map.prototype.getWidth = getMapWidth;
Map.prototype.getHeight = getMapHeight;
Map.prototype.toString = tileMapInfo;
Map.prototype.setFlag = setFlag;
Map.prototype.getFlag = getFlag;
Map.prototype.setFlagMap = setFlagMap;
Map.prototype.getFlagMap = getFlagMap;
Map.prototype.getSubMap = getSubMap;
Map.prototype.setSubMap = setSubMap;
Map.prototype.checkMoveRange = checkMoveRange;
Map.prototype.getPath = getPath;
TileScene2D = createTileScene2D;
TileScene2D.prototype.setClip = setSceneClip;
TileScene2D.prototype.rander = randerScene;
TileScene2D.prototype.setTo = sceneSetTo;
TileScene2D.prototype.sceneCenterMoveTo = sceneCenterMoveTo;
TileScene2D.prototype.getX = getSceneX;
TileScene2D.prototype.getY = getSceneY;
TileScene2D.prototype.getScale = getSceneScale;
TileScene2D.prototype.getTileIndex = getTileIndex;
TileScene2D.prototype.getTileCenter = getTileCenter;
TileScene2D.prototype.setHighLight = setHighLight;
TileScene2D.prototype.clearHighLight = clearHighLightFlash6;
TileScene2D.prototype.addHighLightMap = addHighLightMap;
TileScene2D.prototype.addHighLight = addHighLight;
TileScene2D.prototype.deleteHighLight = deleteHighLight;
TileScene2D.prototype.setShadow = setShadow;
ScrollManager = createScrollManager;
ScrollManager.prototype.getScroll = getScroll;
var OxSLGEngine = {};
OxSLGEngine.unitList = {};
OxSLGEngine.stageWidth = Stage.width;
OxSLGEngine.stageHeight = Stage.height;
OxSLGEngine.darken = getColorCX(6316128, 60);
OxSLGEngine.yellow = {ra:"100", rb:"100", ga:"100", gb:"0", ba:"100", bb:"80", aa:"100", ab:"0"};
OxSLGEngine.blue = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"255", aa:"100", ab:"0"};
OxSLGEngine.red = {ra:"100", rb:"255", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
OxSLGEngine.nocolor = {ra:"100", rb:"0", ga:"100", gb:"0", ba:"100", bb:"0", aa:"100", ab:"0"};
TileScene2D.prototype.reflushScene = reflushScene;
TileScene2D.prototype.randerHighLight = randerHighLight;
TileScene2D.prototype.autoMove = autoMove;
var nul = null;
_quality = "low";
moveColorx = 13631439 /* 0xCFFFCF */;
attackColorx = 16740255 /* 0xFF6F9F */;
playerColorx = 65535;
enemyColorx = 16711680 /* 0xFF0000 */;
moveToColorx = 16777071 /* 0xFFFF6F */;
TileGrass.prototype = {name:"\u8349\u5730", image:"S-\u8349\u5730", \u5F13\u624BMoveCost:1, \u731B\u517D\u4EBAMoveCost:1, \u6B65\u5175MoveCost:1, \u9A91\u5175MoveCost:1, \u6CD5\u5E08MoveCost:1, defEx:10};
TileTree.prototype = {name:"\u6811\u6797", image:"S-\u6811\u6797", \u5F13\u624BMoveCost:1, \u731B\u517D\u4EBAMoveCost:1, \u6B65\u5175MoveCost:2, \u9A91\u5175MoveCost:2, \u6CD5\u5E08MoveCost:1, defEx:30};
TileHouse.prototype = {name:"\u623F\u5B50", image:"S-\u623F\u5B50", \u5F13\u624BMoveCost:1, \u731B\u517D\u4EBAMoveCost:4, \u6B65\u5175MoveCost:1, \u9A91\u5175MoveCost:3, \u6CD5\u5E08MoveCost:1, defEx:40, heal:20};
TileWall.prototype = {name:"\u57CE\u5899", image:"S-\u57CE\u5899", \u5F13\u624BMoveCost:4, \u731B\u517D\u4EBAMoveCost:4, \u6B65\u5175MoveCost:Infinity, \u9A91\u5175MoveCost:Infinity, \u6CD5\u5E08MoveCost:Infinity, defEx:60};
TileGround.prototype = {name:"\u5730\u9762", image:"S-\u5730\u9762", \u5F13\u624BMoveCost:1, \u731B\u517D\u4EBAMoveCost:1, \u6B65\u5175MoveCost:1, \u9A91\u5175MoveCost:1, \u6CD5\u5E08MoveCost:1, defEx:10};
var myTileList = [];
var i = 1;
while (i <= 19) {
myTileList[i] = new TileGrass();
i++;
}
var i = 20;
while (i <= 37) {
myTileList[i] = new TileTree();
i++;
}
var i = 38;
while (i <= 45) {
myTileList[i] = new TileHouse();
i++;
}
var i = 46;
while (i <= 49) {
myTileList[i] = new TileGround();
i++;
}
var i = 50;
while (i <= 65) {
myTileList[i] = new TileWall();
i++;
}
var i = 66;
while (i <= 81) {
myTileList[i] = new TileGround();
i++;
}
tileList = new TileList(myTileList);
var mapTile = [[20, 20, 20, 20, 20, 20, 20, 20, 20, 2, 2, 2, 33, 35, 37, 37, 37, 37, 35, 35, 17, 17, 17, 19, 52, 37, 37, 37, 37, 36, 2, 33], [20, 20, 20, 20, 20, 2, 2, 2, 2, 2, 2, 2, 12, 2, 33, 35, 35, 34, 2, 2, 2, 2, 2, 15, 60, 37, 37, 19, 37, 35, 9, 37], [20, 2, 20, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 16, 20, 38, 2, 2, 5, 9, 11, 11, 19, 60, 37, 37, 37, 16, 2, 2, 33], [2, 20, 2, 2, 7, 53, 55, 55, 55, 56, 2, 2, 4, 2, 2, 2, 2, 5, 8, 20, 2, 15, 17, 19, 60, 35, 37, 16, 2, 7, 11, 37], [2, 2, 2, 2, 15, 60, 67, 73, 70, 60, 11, 8, 2, 2, 2, 7, 10, 2, 2, 2, 2, 14, 2, 13, 58, 38, 12, 2, 2, 33, 37, 37], [2, 2, 20, 20, 33, 59, 56, 76, 53, 62, 18, 2, 2, 38, 2, 13, 19, 10, 2, 2, 52, 18, 2, 2, 2, 4, 2, 2, 7, 37, 37, 37], [2, 20, 2, 2, 33, 37, 58, 74, 58, 17, 17, 9, 10, 2, 2, 2, 13, 19, 51, 55, 63, 54, 8, 2, 2, 2, 7, 29, 37, 37, 17, 37], [20, 20, 2, 20, 31, 35, 19, 17, 16, 38, 2, 2, 14, 2, 2, 2, 2, 15, 17, 35, 17, 16, 2, 2, 5, 11, 37, 19, 37, 16, 2, 33], [20, 20, 20, 20, 20, 2, 14, 20, 2, 2, 20, 2, 13, 11, 28, 2, 2, 12, 20, 20, 2, 2, 24, 2, 2, 31, 17, 17, 16, 2, 20, 33], [20, 20, 20, 20, 20, 2, 13, 9, 8, 2, 2, 2, 2, 15, 19, 9, 8, 20, 2, 20, 2, 2, 14, 2, 4, 2, 2, 2, 2, 2, 5, 35], [28, 20, 20, 25, 53, 56, 20, 20, 2, 4, 2, 2, 7, 42, 18, 2, 2, 20, 20, 25, 29, 29, 18, 2, 2, 2, 20, 2, 20, 2, 20, 2], [37, 29, 27, 37, 59, 63, 55, 55, 54, 2, 2, 5, 37, 51, 55, 54, 20, 20, 20, 31, 37, 19, 16, 2, 2, 2, 2, 2, 38, 2, 2, 20], [37, 34, 20, 31, 35, 35, 17, 19, 16, 2, 2, 2, 13, 17, 34, 20, 20, 20, 2, 2, 15, 18, 2, 2, 2, 2, 2, 2, 2, 2, 20, 20], [34, 20, 20, 20, 2, 2, 20, 14, 2, 2, 2, 2, 2, 2, 2, 2, 2, 7, 53, 55, 55, 55, 55, 55, 55, 56, 2, 2, 20, 2, 2, 7], [20, 20, 4, 2, 38, 5, 9, 42, 8, 2, 2, 2, 2, 7, 11, 53, 55, 55, 62, 69, 73, 73, 73, 73, 72, 59, 55, 56, 2, 7, 11, 19], [20, 2, 2, 2, 2, 2, 2, 2, 20, 50, 2, 2, 38, 15, 19, 60, 49, 49, 69, 81, 81, 81, 81, 81, 81, 72, 48, 61, 55, 55, 54, 46], [2, 2, 2, 20, 2, 2, 20, 2, 2, 20, 5, 9, 9, 19, 19, 60, 46, 46, 75, 79, 79, 79, 79, 79, 79, 78, 47, 60, 49, 49, 49, 46], [2, 20, 2, 20, 20, 20, 2, 7, 11, 10, 2, 2, 2, 15, 53, 65, 57, 55, 55, 55, 55, 57, 56, 47, 53, 57, 55, 62, 46, 47, 53, 54], [20, 20, 20, 2, 20, 2, 7, 53, 54, 16, 2, 51, 55, 55, 65, 65, 64, 49, 49, 49, 48, 59, 62, 47, 59, 62, 46, 46, 46, 47, 60, 20], [20, 20, 4, 2, 2, 2, 15, 60, 16, 2, 2, 13, 19, 17, 59, 63, 64, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 51, 55, 62, 20], [29, 10, 2, 7, 11, 53, 55, 62, 2, 40, 6, 2, 12, 2, 13, 17, 59, 54, 17, 17, 17, 17, 17, 51, 55, 55, 55, 54, 20, 20, 20, 25], [19, 19, 11, 19, 19, 60, 16, 2, 5, 50, 37, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 20, 20, 25, 37], [51, 55, 55, 55, 55, 62, 2, 2, 20, 2, 30, 2, 20, 53, 54, 40, 6, 2, 2, 2, 20, 2, 2, 2, 4, 2, 2, 20, 20, 25, 37, 37], [37, 19, 16, 2, 4, 2, 20, 7, 11, 10, 2, 2, 7, 58, 44, 29, 37, 10, 20, 20, 20, 20, 2, 20, 2, 7, 11, 11, 11, 37, 37, 37]];
mapLinkName = "S-\u6807\u51C6\u5730\u56FE";
var map = new Map(mapTile);
var defExMap = map.getSubMap("defEx", tileList);
gameScale = 46;
var img = new TileScene2D(mapTile, mapLinkName, gameScale, 10);
img.setClip(true);
img.setHighLight(30, 4, 90, 20);
img.setShadow(false, 159, 60);
img.setTo(-200, -200);
var unitCount = 0;
var unitTypeList = [];
var count = 2;
unitTypeList[count++] = {race:"player", type:deathKnightBasic};
unitTypeList[count++] = {race:"player", type:necromancerBasic};
unitTypeList[count++] = {race:"player", type:manBeastBasic};
unitTypeList[count++] = {race:"player", type:footManBasic};
unitTypeList[count++] = {race:"player", type:archerBasic};
unitTypeList[count++] = {race:"player", type:frostMagiBasic};
unitTypeList[count++] = {race:"enemy", type:footMan2Basic};
unitTypeList[count++] = {race:"enemy", type:archer2Basic};
unitTypeList[count++] = {race:"enemy", type:frostMagi2Basic};
var unitMap = [[9, nul, 8, nul, nul, 9, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 10, 9, 9], [8, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, 9], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, 9, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, 8, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, nul, nul, nul, nul, nul, nul, nul, nul, 8, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, 8, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, 5, nul, 5, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, 6, 4, nul, nul, nul, 6, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 7, 7, 3, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 2, nul, 5, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, 6, 5, 5, nul, nul, nul, nul, nul, 9, 10, 8, nul, 8, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 9, nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, 8, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, 8, nul, nul, 9, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 10, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 10, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, nul, nul, nul, nul, nul, 10, nul], [nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, 8, nul, 9, nul, nul, nul, 9, 10, nul, nul]];
var width = unitMap[0].length;
var height = unitMap.length;
createEmptyMovieClip("unitLayer", 15);
var enemyList = {};
var playerList = {};
enemyNumTotal = 0;
playerNumTotal = 0;
var i = 0;
while (i < height) {
var unitMapi = unitMap[i];
var j = 0;
while (j < width) {
var listItemNow = unitTypeList[unitMapi[j]];
if (listItemNow.race == "enemy") {
addEnemy(listItemNow.type, j, i);
} else if (listItemNow.race == "player") {
addPlayer(listItemNow.type, j, i);
}
j++;
}
i++;
}
var mainChar = null;
for (var i in playerList) {
if (playerList[i].unitType == "hero") {
mainChar = playerList[i];
break;
}
}
if (!mainChar) {
mainChar = playerList[0];
}
if (mainChar) {
setImgPos(mainChar);
}
mapRepaint = true;
var keyStatus = {};
var i = 0;
while (i < 256) {
keyStatus[i] = "unpressed";
i++;
}
var unitMap = getUnitMap();
var unitSelected = null;
var unitPointTo = null;
var unitPointToHighLight = null;
var unitSelectedHighLight = null;
var mousePointTo = {x:0, y:0};
mouseScroll = new ScrollManager(3);
var mouseDragx = null;
var mouseDragy = null;
createEmptyMovieClip("mouseDragPic", 21);
var actionNow = null;
totalTurns = 0;
statusNow = "startPlayerTurn";
statusPrev = null;
img.rander();
checkAndMoveMap();
mouseTo.swapDepths(16);
invoidTarget.swapDepths(17);
mouseAttackTo.swapDepths(18);
currentSelectTo.swapDepths(19);
enemyTurnEnd = true;
keyNowArray = [1, 27];
mapScrollSpeed = 3;
keyListener = {};
Key.addListener(keyListener);
keyListener.onKeyDown = function () {
if (!(Key.getCode() === 16)) {
return;
}
};
Symbol 172 MovieClip [S-标准地图] Frame 1
var i = 1;
while (i <= 19) {
myTileList[i] = new TileGrass();
i++;
}
var i = 20;
while (i <= 37) {
myTileList[i] = new TileTree();
i++;
}
var i = 38;
while (i <= 45) {
myTileList[i] = new TileHouse();
i++;
}
var i = 46;
while (i <= 49) {
myTileList[i] = new TileGround();
i++;
}
var i = 50;
while (i <= 65) {
myTileList[i] = new TileWall();
i++;
}
var i = 66;
while (i <= 81) {
myTileList[i] = new TileGround();
i++;
}
Symbol 178 MovieClip Frame 1
info = "\u56DE\u5408\u7ED3\u675F";
stop();
Symbol 182 MovieClip Frame 1
info = "\u53D6\u6863";
stop();
Symbol 186 MovieClip Frame 1
info = "\u5B58\u6863";
stop();
Symbol 187 MovieClip [S-饼状主菜单] Frame 1
cancel = {info:"\u53D6\u6D88"};
Symbol 187 MovieClip [S-饼状主菜单] Frame 10
stop();
Symbol 191 MovieClip Frame 1
info = "\u72B6\u6001";
stop();
Symbol 195 MovieClip Frame 1
info = "\u7B49\u5F85";
stop();
Symbol 199 MovieClip Frame 1
info = "\u6CBB\u7597";
stop();
Symbol 203 MovieClip Frame 1
info = "\u653B\u51FB";
stop();
Symbol 207 MovieClip Frame 1
info = "\u79FB\u52A8";
stop();
Symbol 208 MovieClip [S-饼状菜单] Frame 1
cancel = {info:"\u53D6\u6D88"};
Symbol 208 MovieClip [S-饼状菜单] Frame 10
stop();
Symbol 210 MovieClip Frame 1
_visible = false;
Symbol 220 MovieClip Frame 1
swapDepths(50);
Symbol 246 Button
on (release) {
gotoAndStop (1);
}
Symbol 247 Button
on (release) {
gotoAndStop (2);
}
Symbol 248 Button
on (release) {
gotoAndStop (3);
}
Symbol 249 Button
on (release) {
gotoAndStop (4);
}
Symbol 253 MovieClip Frame 1
stop();
Symbol 270 MovieClip Frame 1
stop();
Symbol 270 MovieClip Frame 2
e.swapDepths(2);
Symbol 279 MovieClip [S-状态] Frame 1
function onEnterFrame() {
if (hit2.hitTest(_root._xmouse, _root._ymouse) && (Key.isDown(1))) {
unitInfo = unitSelected.unitInfo;
}
}
function selectSpcPic(id) {
var _local1 = id;
unitInfo = "";
if ((_local1 >= spcMax) && (_local1 >= spcList.length)) {
} else {
unitInfo = spcList[_local1].gainSpcInfo + "\r";
if (spcList[_local1].timeCount != Infinity) {
unitInfo = unitInfo + (("\u5269\u4F59\u6301\u7EED\u65F6\u95F4: " + (spcList[_local1].timeCount / 2)) + "\u56DE\u5408");
} else {
unitInfo = unitInfo + "\u6C38\u4E45\u6027\u6280\u80FD/\u72B6\u6001";
}
}
}
stop();
unitSelected = _root.unitSelected;
unitName.unitName = (unitSelected.unitName + " * ") + unitSelected.jobName;
hp = (unitSelected.hpNow + "/") + unitSelected.hp;
mp = (unitSelected.mpNow + "/") + unitSelected.mp;
atk = unitSelected.atk;
atkChanged = 0;
if (unitSelected.weapon != null) {
atkChanged = atkChanged + unitSelected.weapon.atk;
}
for (var i in unitSelected.spcList) {
if (unitSelected.spcList[i].effect.damage != null) {
atkChanged = atkChanged + unitSelected.spcList[i].effect.damage;
}
}
if (atkChanged) {
atk = atk + ("+" + atkChanged);
}
if (unitSelected.weapon != null) {
range = unitSelected.weapon.range;
if (unitSelected.weapon.minRange != null) {
range = (unitSelected.weapon.minRange + "-") + range;
}
} else {
range = 1;
}
def = unitSelected.def;
if (unitSelected.armor != null) {
def = def + ("+" + unitSelected.armor.def);
}
mdef = unitSelected.mdef;
if (unitSelected.armor != null) {
mdef = mdef + ("+" + unitSelected.armor.mdef);
}
tohit = unitSelected.tohit + "%";
var tohitChanged = 0;
for (var i in unitSelected.spcList) {
if ((unitSelected.spcList[i].effect.weaponTohit != null) && (unitSelected.weapon != null)) {
tohitChanged = tohitChanged + unitSelected.spcList[i].effect.weaponTohit;
}
}
if (tohitChanged > 0) {
tohit = tohit + (("+" + tohitChanged) + "%");
} else if (tohitChanged < 0) {
tohit = tohit + (("" + tohitChanged) + "%");
}
dodge = unitSelected.dodge + "%";
mv = unitSelected.mv;
var mvChanged = 0;
for (var i in unitSelected.spcList) {
if (unitSelected.spcList[i].effect.mv != null) {
mvChanged = mvChanged + unitSelected.spcList[i].effect.mv;
}
}
if (mvChanged > 0) {
mv = mv + (" +" + mvChanged);
} else if (mvChanged < 0) {
mv = mv + (" " + mvChanged);
}
mv = mv + (("(" + unitSelected.mvtype) + ")");
attachMovie(unitSelected.headName, "unitHead", 0);
jobName = unitSelected.jobName;
unitInfo = unitSelected.unitInfo;
spcMax = 8;
spcList = unitSelected.spcList;
var count = 0;
var i = (spcList.length - 1);
while (i >= 0) {
this["spc" + count].id = i;
this["spc" + count].gotoAndStop(spcList[i].specialPicLabel);
this["spc" + count].onRelease = function () {
selectSpcPic(this.id);
};
if ((count++) >= spcMax) {
break;
}
i--;
}
Symbol 279 MovieClip [S-状态] Frame 2
function reflush() {
if ((itemNow.weaponName != null) || (itemNow.armorName != null)) {
spcPic.gotoAndStop(1);
spcPicInfo = "";
}
if (unitSelected.jobName == "\u91CE\u517D") {
itemName = "";
unitInfo = "\n\n \u517D\u4EBA\u4E0D\u9700\u8981\u88C5\u5907\u4EFB\u4F55\u7269\u54C1";
info = "";
spcPic.gotoAndStop(1);
spcPicInfo = "";
} else {
if (itemNow.weaponName != null) {
itemName = (itemNow.weaponName + " \t") + itemNow.weaponType;
unitInfo = itemNow.weaponInfo;
info = ("ATK: \t" + itemNow.atk) + newline;
info = info + (("Type: \t" + itemNow.damageType) + newline);
range = itemNow.range;
if (itemNow.minRange != null) {
range = (itemNow.minRange + "-") + range;
}
info = info + (("range: \t" + range) + newline);
info = info + ("length: \t" + itemNow.weaponLength);
var _local1 = 0;
for (var _local2 in unitSelected.spcList) {
if (unitSelected.spcList[_local2].effect.weaponLength != null) {
_local1 = _local1 + unitSelected.spcList[_local2].effect.weaponLength;
}
}
if (_local1 > 0) {
info = info + (" +" + _local1);
} else if (_local1 < 0) {
info = info + (" " + _local1);
}
info = info + newline;
if (itemNow.special != null) {
info = info + (("SPC: \t" + itemNow.special.specialName) + newline);
spcPic.gotoAndStop(itemNow.special.specialPicLabel);
spcPicInfo = itemNow.special.specialInfo;
}
attachMovie(itemNow.headName, "unitHead", 0);
}
if (itemNow.armorName != null) {
itemName = (itemNow.armorName + " \t") + itemNow.armorType;
unitInfo = itemNow.armorInfo;
info = ("DEF: \t" + itemNow.def) + newline;
info = info + (("MDEF: \t" + itemNow.mdef) + newline);
attachMovie(itemNow.headName, "unitHead", 0);
if (itemNow.special != null) {
info = info + (("SPC: \t" + itemNow.special.specialName) + newline);
spcPic.gotoAndStop(itemNow.special.specialPicLabel);
spcPicInfo = itemNow.special.specialInfo;
}
}
}
}
itemNow = unitSelected.weapon;
if (itemNow.weaponName != null) {
s1.attachMovie(unitSelected.weapon.linkName, "item1", 0);
item1 = unitSelected.weapon;
s1.gotoAndStop(2);
}
if (unitSelected.armor != null) {
s2.attachMovie(unitSelected.armor.linkName, "item2", 0);
item2 = unitSelected.armor;
s2.gotoAndStop(2);
}
reflush();
onEnterFrame = function () {
var _local2 = this;
currentSelection = null;
var _local1 = 1;
while (_local1 <= 8) {
if (_local2["s" + _local1].hit.hitTest(_xmouse, _ymouse)) {
currentSelection = _local1;
break;
}
_local1++;
}
if (_local2["item" + currentSelection] != null) {
} else {
_root.hint.info = "";
}
if (_root.keyStatus[1] == "down") {
if (itemNow != _local2["item" + currentSelection]) {
itemNow = _local2["item" + currentSelection];
reflush();
}
}
};
Symbol 279 MovieClip [S-状态] Frame 3
function selectSpcPic(id) {
var _local1 = id;
unitInfo = "";
if ((_local1 >= spcMax) && (_local1 >= spcList.length)) {
} else {
unitInfo = spcList[_local1].gainSpcInfo + "\r";
if (spcList[_local1].timeCount != Infinity) {
unitInfo = unitInfo + (("\u5269\u4F59\u6301\u7EED\u65F6\u95F4: " + (spcList[_local1].timeCount / 2)) + "\u56DE\u5408");
} else {
unitInfo = unitInfo + "\u6C38\u4E45\u6027\u6280\u80FD/\u72B6\u6001";
}
}
}
spcMax = 18;
spcList = unitSelected.spcList;
var count = 0;
var i = (spcList.length - 1);
while (i >= 0) {
this["spc" + count].id = i;
this["spc" + count].gotoAndStop(spcList[i].specialPicLabel);
this["spc" + count].onRelease = function () {
selectSpcPic(this.id);
};
if ((count++) >= spcMax) {
break;
}
i--;
}
selectSpcPic(0);
unitName.unitName = (unitSelected.unitName + " * ") + unitSelected.jobName;
Symbol 284 MovieClip [S-EnemyTurn] Frame 1
_root["\u524D\u666F\u8272"]._visible = true;
Symbol 284 MovieClip [S-EnemyTurn] Frame 40
_root.endStatus = true;
_root["\u524D\u666F\u8272"]._visible = false;
removeMovieClip(this);
Symbol 285 MovieClip [S-PlayerTurn] Frame 1
_root["\u524D\u666F\u8272"]._visible = true;
Symbol 285 MovieClip [S-PlayerTurn] Frame 40
_root.endStatus = true;
_root["\u524D\u666F\u8272"]._visible = false;
removeMovieClip(this);
Symbol 304 MovieClip [S-hpGain] Frame 22
_root.nowAttack++;
removeMovieClip(this);
Symbol 307 MovieClip [S-hpLose] Frame 22
_root.nowAttack++;
removeMovieClip(this);
Symbol 325 MovieClip [S-攻击状态栏] Frame 1
function reflush(tilex, tiley) {
var _local1 = _root;
var _local2 = tiley;
var _local3 = tilex;
if (_local1.unitSelected.moved) {
reflushBasic(1, _local1.unitPrevx, _local1.unitPrevy);
} else {
reflushBasic(1, _local1.unitSelected.x, _local1.unitSelected.y);
}
var isEnemy = (_local1.unitMap[_local2][_local3] && (_local1.unitMap[_local2][_local3].side != _local1.unitSelected.side));
if ((!isEnemy) || ((_local1.unitSelected.side == "player") && (_local1.attackRangeMap[_local2][_local3] != 0))) {
broad._visible = false;
hp2._visible = false;
tileProto2._visible = false;
if (unitPic2 != null) {
removeMovieClip(unitPic2);
}
if (tilePic2 != null) {
removeMovieClip(tilePic2);
}
damage1 = "-";
tohit1 = "-";
damage2 = "-";
tohit2 = "-";
\u7BAD\u5934MC._visible = false;
} else {
broad._visible = true;
hp2._visible = true;
tileProto2._visible = true;
reflushBasic(2, _local3, _local2);
_local1.attackInit(_local1.unitSelected, _local1.unitSelected.x, _local1.unitSelected.y, _local1.unitMap[_local2][_local3], _local3, _local2);
damage1 = _local1.damage;
tohit1 = _local1.tohit + "%";
_local1.attackInit(_local1.unitMap[_local2][_local3], _local3, _local2, _local1.unitSelected, _local1.unitSelected.x, _local1.unitSelected.y);
if (_local1.counterstrokeAble) {
damage2 = _local1.damage;
tohit2 = _local1.tohit + "%";
} else {
damage2 = "-";
tohit2 = "-";
}
\u7BAD\u5934MC._visible = true;
}
}
function reflushBasic(index, tilex, tiley) {
var _local1 = index;
var _local2 = this;
var _local3 = _root;
tile = _local3.map.getSub(tilex, tiley);
if (tile != null) {
attachMovie(_local3.mapLinkName, "tilePic" + _local1, _local1);
_local2["tilePic" + _local1].gotoAndStop(tile);
_local2["tilePic" + _local1]._xscale = 50;
_local2["tilePic" + _local1]._yscale = 50;
if (_local1 == 1) {
tilePic1._x = -160;
tilePic1._y = 82;
} else {
tilePic2._x = 210;
tilePic2._y = 82;
}
_local2["tileProto" + _local1].tileProto = _local3.tileList.getTile(tile).defEx + "%";
if (_local3.tileList.getTile(tile).heal != null) {
_local2["tileProto" + _local1].tileProto = _local2["tileProto" + _local1].tileProto + (("+" + _local3.tileList.getTile(tile).heal) + "%");
}
}
unit = _local3.unitMap[tiley][tilex];
if (unit != null) {
_local2["hp" + _local1]._visible = true;
percentage = (100 * unit.hpNow) / unit.hp;
if (percentage < 25) {
_local2["colorObject" + _local1].setTransform(_local3.getColorCX(16711680, 70));
} else if (percentage < 50) {
_local2["colorObject" + _local1].setTransform(_local3.getColorCX(16752384, 70));
} else {
_local2["colorObject" + _local1].setTransform(_local3.OxSLGEngine.nocolor);
}
_local2["hp" + _local1].hp._xscale = percentage;
_local2["hp" + _local1].hpText = unit.hpNow;
attachMovie(unit.linkName, "unitPic" + _local1, _local1 + 2);
unitPic = _local2["unitPic" + _local1];
unitPic._xscale = 70;
unitPic._yscale = 70;
if (_local1 == 1) {
unitPic._x = -185;
} else {
unitPic._x = 185;
}
for (var i in unit.spcList) {
unitPic.attachMovie(unit.spcList[i].linkName, "spc" + i, int(i));
unitPic["spc" + i]._y = 25 * int(i);
}
} else if (_local2["unitPic" + _local1] != null) {
removeMovieClip(_local2["unitPic" + _local1]);
delete _local2["unitPic" + _local1];
_local2["hp" + _local1]._visible = false;
}
}
swapDepths(23);
hp1.swapDepths(10);
hp2.swapDepths(11);
colorObject1 = new Color(hp1.hp);
colorObject2 = new Color(hp2.hp);
tileProto1.swapDepths(12);
tileProto2.swapDepths(13);
reflush(_root.unitSelected.x, _root.unitSelected.y);
Symbol 369 MovieClip [S-冻伤] Frame 9
stop();
Symbol 373 MovieClip [S-武器诅咒] Frame 10
stop();
Symbol 425 MovieClip Frame 66
stop();
Symbol 426 MovieClip [S-GameOverMovie] Frame 1
stopAllSounds();
Symbol 426 MovieClip [S-GameOverMovie] Frame 255
totalTurns = _root.totalTurns;
unitLose = _root.playerNumTotal - _root.playerNumLeft;
EnemyKilled = _root.enemyNumTotal - _root.enemyNumLeft;
Symbol 426 MovieClip [S-GameOverMovie] Frame 392
stop();
Symbol 450 MovieClip [S-VictoryMovie] Frame 1
stopAllSounds();
Symbol 450 MovieClip [S-VictoryMovie] Frame 87
totalTurns = _root.totalTurns;
unitLose = _root.playerNumTotal - _root.playerNumLeft;
EnemyKilled = _root.enemyNumTotal - _root.enemyNumLeft;
Symbol 450 MovieClip [S-VictoryMovie] Frame 109
stop();
Symbol 453 MovieClip Frame 1
function reflush(tilex, tiley) {
var _local1 = _root;
var _local2 = _local1.map.getSub(tilex, tiley);
if (_local2 != null) {
_visible = true;
attachMovie(_local1.mapLinkName, "tilePic", 0);
tilePic.gotoAndStop(_local2);
tilePic._xscale = 50;
tilePic._yscale = 50;
tilePic._x = 24;
tilePic._y = 85;
tileProto.tileProto = _local1.tileList.getTile(_local2).defEx + "%";
if (_local1.tileList.getTile(_local2).heal != null) {
tileProto.tileProto = tileProto.tileProto + (("+" + _local1.tileList.getTile(_local2).heal) + "%");
}
} else {
_visible = false;
}
unit = _local1.unitMap[tiley][tilex];
if (unit != null) {
hp._visible = true;
percentage = (100 * unit.hpNow) / unit.hp;
if (percentage < 25) {
colorObject.setTransform(_local1.getColorCX(16711680, 70));
} else if (percentage < 50) {
colorObject.setTransform(_local1.getColorCX(16752384, 70));
} else {
colorObject.setTransform(_local1.OxSLGEngine.nocolor);
}
hp.hp._xscale = percentage;
hp.hpText = unit.hpNow;
attachMovie(unit.linkName, "unitPic", 1);
unitPic._xscale = 70;
unitPic._yscale = 70;
for (var _local3 in unit.spcList) {
unitPic.attachMovie(unit.spcList[_local3].linkName, "spc" + _local3, int(_local3));
unitPic["spc" + _local3]._y = 25 * int(_local3);
}
} else if (unitPic != null) {
removeMovieClip(unitPic);
delete unitPic;
hp._visible = false;
}
}
_visible = false;
swapDepths(22);
hp.swapDepths(2);
hp._visible = false;
colorObject = new Color(hp.hp);
tileProto.swapDepths(3);
Symbol 457 MovieClip Frame 1
function onEnterFrame() {
var _local1 = _root;
if (statusNow == "noInfo") {
if ((prevInfo == "") && (info != "")) {
statusNow = "noShow";
tcount = 0;
}
}
if (statusNow == "noShow") {
tcount++;
if ((Math.abs(_x - _local1._xmouse) > 10) || (Math.abs(_y - _local1._ymouse) > 10)) {
tcount = 0;
}
if (tcount > tcountMax) {
statusNow = "show";
_visible = true;
}
if ((info = "")) {
statusNow = "noInfo";
}
}
if (statusNow == "show") {
if ((info = "")) {
_visible = false;
statusNow = "noInfo";
}
}
prevInfo = info;
if ((_x != _local1._xmouse) || (_y != _local1._ymouse)) {
_x = _local1._xmouse;
_y = _local1._ymouse;
}
}
_visible = false;
swapDepths(54);
tcount = 0;
tcountMax = 20;
statusNow = "noInfo";
Symbol 477 MovieClip Frame 1
if (_parent.oxToolsFpsShow == undefined) {
_parent.oxToolsFpsShow = this;
_y = 0;
_x = Stage.width;
if (depth == undefined) {
depth = 200200 /* 0x030E08 */;
}
while (_parent.getInstanceAtDepth(depth) != undefined) {
depth++;
}
if (depth != -1) {
swapDepths(depth);
}
frameCount = 0;
onEnterFrame = function () {
frameCount++;
};
Unload = function () {
trace("??");
delete _parent.oxToolsFpsShow;
};
calc = function () {
fps = "FPS:" + frameCount;
frameCount = 0;
};
setInterval(this, "calc", 1000);
} else {
swapDepths(200001);
removeMovieClip(this);
}
Symbol 479 MovieClip [S-边框] Frame 1
swapDepths(500000);
Symbol 481 MovieClip Frame 1
swapDepths(30);
_visible = false;